gold/
[external/binutils.git] / gold / ChangeLog
1 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2
3         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
4         * configure: Regenerate.
5         * Makefile.in: Regenerate.
6         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
7         * testsuite/merge_string_literals_2.c: Likewise.
8         * testsuite/Makefile.am
9         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
10         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
11         literal -fmerge-constants.
12         * testsuite/Makefile.in: Regenerate.
13
14         * i386.cc (Target_i386): Remove unused member dynbss_.
15         * arm.cc (Target_arm): Likewise.
16         * powerpc.cc (Target_powerpc): Likewise.
17         * sparc.cc (Target_sparc): Likewise.
18         * tilegx.cc (Target_tilegx): Likewise.
19         * x86_64.cc (Target_x86_64): Likewise.
20         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
21         type_signature_, type_offset_.
22         * plugin.h (Plugin_hook): Remove unused member layout_.
23         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
24         mapfile_.
25         (Read_member): Remove unused members input_objects_, symtab_,
26         mapfile_, layout_.
27         (Check_library): Remove unused member symtab_.
28         * archive.h (Lib_group): Remove unused member lib_.
29         * archive.cc (Lib_group::Lib_group): Update initializer.
30         * incremental.h (Incremental_binary): Remove unused member target_.
31         (Incremental_script_entry): Removed unused member script_.
32         * layout.h (Write_symbols_task): Remove unused member input_objects_.
33         * icf.h (Icf): Remove unused member num_tracked_relocs.
34
35         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
36         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
37         its only use.
38         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
39
40         * archive.h: Use struct rather than class for forward declaration
41         of Read_symbols_data.
42
43 2013-10-07  Cary Coutant  <ccoutant@google.com>
44
45         PR gold/16010
46         * testsuite/Makefile.am (icf_test): Fix dependencies.
47         (icf_safe_test): Likewise.
48         (icf_safe_so_test): Likewise.
49         (large_symbol_alignment): Add empty _LDADD rule.
50         * testsuite/Makefile.in: Regenerate.
51
52 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
53
54         PR gold/15927
55         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
56         relocation for R_X86_64_32 on x32.
57
58 2013-08-27  Roland McGrath  <mcgrathr@google.com>
59
60         * output.cc (Output_segment::set_section_addresses): Take new
61         Target* argument.  If target->isolate_execinstr() and the segment
62         is executable and starts at a target->abi_pagesize() boundary,
63         pad its end out to a target->abi_pagesize() boundary with code fill.
64         * output.h (Output_segment::set_section_addresses): Update decl.
65         * layout.h (Layout::check_output_data_for_reset_values): Take new
66         argument RELAX_OUTPUTS.
67         (Layout): New member relax_output_list_.
68         (Layout::add_relax_output): New method.
69         * layout.cc (Layout::Layout): Update constructor.
70         (Layout::reset_relax_output): New method.
71         (Layout::clean_up_after_relaxation): Call it.
72         (Layout::prepare_for_relaxation): Update caller.
73         (Layout::set_segment_offsets): Update callers of set_section_addresses.
74         Call reset_relax_output before re-processing segments for
75         isolate_execinstr case.
76         (Layout::write_data): Handle relax_output_list_.
77         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
78         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
79
80 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
81
82         PR binutils/15834
83         * object.h: Fix typos.
84
85 2013-08-16  Roland McGrath  <mcgrathr@google.com>
86
87         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
88         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
89
90 2013-08-07  Cary Coutant  <ccoutant@google.com>
91
92         Revert support for v2 DWP files:
93
94         2013-03-01  Cary Coutant  <ccoutant@google.com>
95
96             Add dwp support for v2 DWARF package file format.
97             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
98             tu_length parameter.  Adjust all callers.
99             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
100             * dwp.cc: Include dwarf.h.
101             (Section_bounds): New struct type.
102             (Unit_set): New struct type.
103             (Dwo_file::Dwo_file): Initialize new data member.
104             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
105             Combine and rename to...
106             (Dwo_file::read_unit_index): ...this.
107             (Dwo_file::sized_read_compunit_index)
108             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
109             (Dwo_file::sized_read_unit_index): ...this.
110             (Dwo_file::copy_section): Remove section_name, is_str_offsets
111             parameters; add section_id parameter.
112             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
113             (Dwo_file::add_unit_set): ...this.
114             (Dwo_file::shndx_map_): Remove.
115             (Dwo_file::sect_offsets_): New data member.
116             (Dwp_output_file::Dwp_output_file): Initialize new data members.
117             (Dwp_output_file::add_section): Rename to...
118             (Dwp_output_file::add_contribution): ...this.
119             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
120             (Dwp_output_file::add_tu_set): Likewise.
121             (Dwp_output_file::Contribution): New type.
122             (Dwp_output_file::Section::contributions): New data member.
123             (Dwp_output_file::Cu_or_tu_set): Remove.
124             (Dwp_output_file::Section::Section): New ctor.
125             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
126             (Dwp_output_file::Dwp_index::Section_table): New type.
127             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
128             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
129             parameter.
130             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
131             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
132             (Dwp_output_file::Dwp_index::section_table): New member function.
133             (Dwp_output_file::Dwp_index::section_table_end): New member function.
134             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
135             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
136             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
137             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
138             (Dwp_output_file::Dwp_index::section_table_): New data member.
139             (Dwp_output_file::Dwp_index::section_mask_): New data member.
140             (Dwp_output_file::add_output_section): New member function.
141             (Dwp_output_file::write_new_section): New member function.
142             (Dwp_output_file::write_contributions): New member function.
143             (Dwp_output_file::section_id_map_): New data member.
144             (class Dwo_id_info_reader): Remove.
145             (class Unit_reader): New class.
146             (get_dwarf_section_name): New function.
147             (Dwo_file::read_executable): Adjust initializations of class data.
148             (Dwo_file::read): Add support for v2 package file format.
149             (Dwo_file::read_unit_index): Likewise.
150             (Dwo_file::sized_read_unit_index): Likewise.
151             (Dwo_file::copy_section): Likewise.
152             (Dwo_file::add_unit_set): Likewise.
153             (Dwp_output_file::add_output_section): Likewise.
154             (Dwp_output_file::add_contribution): Likewise.
155             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
156             for empty slot.
157             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
158             file format.
159             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
160             slot.
161             (Dwp_output_file::initialize): Remove unused function.
162             (Dwp_output_file::finalize): Add support for v2 package file format.
163             (Dwp_output_file::write_index): Likewise.
164             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
165             function prototype.
166
167 2013-07-31  Cary Coutant  <ccoutant@google.com>
168
169         * object.cc (Sized_relobj::do_output_section_address): New function.
170         (Sized_relobj): Instantiate explicitly.
171         * object.h (Object::output_section_address): New function.
172         (Object::do_output_section_address): New function.
173         (Sized_relobj::do_output_section_address): New function.
174         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
175
176 2013-07-30  Cary Coutant  <ccoutant@google.com>
177             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
178
179         * parameters.cc (Parameters::entry): Return target-specific entry
180         symbol name.
181         * target.h (Target::entry_symbol_name): New function.
182         (Target_info::entry_symbol_name): New data member.
183
184         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
185         * i386.cc (Target_i386::i386_info): Likewise.
186         (Target_i386_nacl::i386_nacl_info): Likewise.
187         * sparc.cc (Target_sparc::sparc_info): Likewise.
188         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
189         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
190         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
191         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
192
193 2013-07-22  Sterling Augustine  <saugustine@google.com>
194
195         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
196         Convert parameter shndx to local variable. Add parameters symtab
197         and symtab_size.  Scan over section names.  Find relocation
198         section corresponding to current section.  Create and initialize
199         reloc_mapper_ and reloc_type_.
200         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
201         unit_length to off_t.  Initialize member unit_length_.  Fill in field
202         cu_offset_.
203         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
204         Initialize new fields unit_length_ and cu_offset_.
205         (Dwarf_pubnames_table::read_section): Update prototype.
206         (Dwarf_pubnames_table::cu_offset): New member function.
207         (Dwarf_pubnames_table::subsection_size): Likewise.
208         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
209         New fields.
210         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
211         member functions public.
212         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
213         Update comment.  Rework logic.  Move repeated parts to...
214         (Gdb_index_info_reader::read_pubtable): ...here. New function.
215         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
216         pubtypes_table_, and stmt_list_offset.
217         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
218         Gdb_index::find_pubtype_offset,
219         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
220         (Gdb_index::pubnames_read): Update prototype and rework logic.
221         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
222         Forward declare.
223         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
224         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
225         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
226         Gdb_index::map_pubtable_to_dies):
227         Declare functions.
228         (Gdb_index::pubnames_read): Update declaration.
229         (Gdb_index::Pubname_offset_map): New type.
230         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
231         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
232         Gdb_index::stmt_list_offset): Declare.
233         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
234         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
235         Gdb_index::pubtypes_offset_): Remove.
236
237 2013-07-19  Roland McGrath  <mcgrathr@google.com>
238
239         * options.h (General_options): Add -Trodata-segment option.
240         * parameters.cc (Parameters::check_rodata_segment): New function.
241         (Parameters::set_target_once): Call it.
242         * parameters.h (Parameters): Declare it (private member function).
243         * layout.cc (load_seg_unusable_for_headers): New function, broken
244         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
245         then validate rodata segment rather than text segment.
246         (relaxation_loop_body): Call that.
247         (is_text_segment): New function.  Don't admit a non-executable
248         segment if TARGET->isolate_execinstr().
249         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
250
251 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
252
253         PR gold/15070
254         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
255         * nacl.h (Sniff_file::View::View): Request aligned view.
256
257 2013-07-11  Cary Coutant  <ccoutant@google.com>
258
259         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
260         correct BRLT entry size.
261
262 2013-07-03  Alan Modra  <amodra@gmail.com>
263
264         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
265         comment.
266
267 2013-07-01  Cary Coutant  <ccoutant@google.com>
268
269         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
270         reloc_type_.
271         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
272         (Dwarf_ranges_table::lookup_reloc): New function.
273         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
274         reloc_type_.
275         (Dwarf_ranges_table::lookup_reloc): New function.
276         (Dwarf_ranges_table::reloc_type_): New data member.
277
278 2013-06-27  Jing Yu  <jingyu@google.com>
279
280         PR gold/15662
281         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
282         function.
283         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
284         (Target_powerpc::do_relax): Call the above.
285
286 2013-06-27  Cary Coutant  <ccoutant@google.com>
287
288         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
289         on garbage collected .opd section.
290
291 2013-06-27  Alan Modra  <amodra@gmail.com>
292
293         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
294         is non-zero.
295         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
296         (Target_powerpc::do_function_location): Likewise for loc->shndx.
297
298 2013-06-14  Cary Coutant  <ccoutant@google.com>
299
300         * resolve.cc (Symbol::override_base): Don't override st_type
301         from plugin placeholder symbols.
302         (Symbol_table::resolve): Likewise.
303         (Symbol_table::should_override): Don't complain about TLS mismatch
304         if the TO symbol is a plugin placeholder.
305         * testsuite/Makefile.am (plugin_test_tls): New test.
306         * testsuite/Makefile.in: Regenerate.
307         * testsuite/plugin_test_tls.sh: New test script.
308         * testsuite/two_file_test_2_tls.cc: New test source.
309         * testsuite/two_file_test_tls.cc: New test source.
310
311 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
312
313         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
314         the maximum segment alignment is larger than the page size.
315         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
316         correctly aligns the symbols with large alignemnt.
317         * testsuite/Makefile.in: Regenerate.
318         * testsuite/large_symbol_alignment.cc: New file.
319
320 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
321             Sriraman Tallam  <tmsriram@google.com>
322
323         * options.h (sort_section): New option.
324         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
325         Rename from Input_section_sort_section_name_special_ordering_compare.
326         (Input_section_sort_section_name_compare): New struct.
327         * output.cc (Output_section::Input_section_sort_section_name_compare::
328         operator()): New function.
329         (Output_section::sort_attached_input_sections): Use new sort function
330         for .text if --sort-section=name is specified.
331         * layout.cc (Layout::make_output_section):
332         Add sorting by name when --sort-section=name is specified.
333         * testsuite/Makefile.am (text_section_grouping): Test option
334         --sort-section=name.
335         * testsuite/Makefile.in: Regenerate.
336         * testsuite/section_sorting_name.cc: New file.
337         * testsuite/section_sorting_name.sh: New file.
338
339 2013-05-21  Cary Coutant  <ccoutant@google.com>
340
341         * symtab.h (Symbol::is_cxx_vtable): New function.
342         * target-reloc.h (relocate_section): Check for vtable symbol.
343         * testsuite/Makefile.am (missing_key_func.sh): New test case.
344         * testsuite/Makefile.in: Regenerate.
345         * testsuite/missing_key_func.cc: New test source.
346         * testsuite/missing_key_func.sh: New test script.
347
348 2013-05-21  Cary Coutant  <ccoutant@google.com>
349
350         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
351         type of enclosing symbol.
352         (Relocate_info::location): Check symbol type when describing symbol.
353         * object.h (Symbol_location_info): Remove unused line_number;
354         add enclosing_symbol_type.
355         * testsuite/debug_msg.sh: Adjust expected output.
356
357 2013-05-13  Cary Coutant  <ccoutant@google.com>
358
359         * configure.ac: Export DEFAULT_TARGET.
360         * configure: Regenerate.
361         * Makefile.in: Regenerate.
362         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
363         * testsuite/Makefile.in: Regenerate.
364         * testsuite/debug_msg.sh: Delete duplicate tests.
365         Don't check undef_int error message match for powerpc where the
366         source file and line number aren't available.
367
368 2013-05-10  Roland McGrath  <mcgrathr@google.com>
369
370         * options.h (General_options): Add --rosegment-gap option.
371         * options.cc (finalize): --rosegment-gap implies --rosegment.
372         * layout.cc (set_segment_offsets): Let user option override
373         target->rosegment_gap().
374
375 2013-05-10  Roland McGrath  <mcgrathr@google.com>
376
377         * options.h (General_options): Remove leading space from help
378         messages for -nostdlib and --rosegment.
379
380 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
381
382         PR ld/15365
383         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
384
385 2013-05-03  Alan Modra  <amodra@gmail.com>
386
387         * merge.cc (Output_merge_string::do_add_input_section): Correct
388         scan for number of strings.  Rename vars to avoid shadowing.
389         Include missing terminator in input_size_.
390
391 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
392
393         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
394         Restore empty string handling.
395
396 2013-05-01  Cary Coutant  <ccoutant@google.com>
397
398         * stringpool.cc (Stringpool_template::new_key_offset): Fix
399         uninitialized warning.
400
401 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
402
403         * output.cc (Output_section::add_merge_input_section): Allow
404         to merge sections if the alignment is more than character size.
405         * merge.h (Output_merge_string::Output_merge_string): Remove
406         assert.
407         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
408         only not-null strings. Check the alignment of strings.
409         * stringpool.h
410         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
411         alignment as the argument.
412         (Stringpool_template<Stringpool_char>::addralign_): New class member.
413         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
414         Align non-zero length strings according to the addralign_.
415         (Stringpool_template<Stringpool_char>::set_string_offsets):
416         Updating offsets according to the given alignment.
417         * testsuite/Makefile.am (text_section_grouping): Test if string
418         literals are getting merged.
419         * testsuite/Makefile.in: Regenerate.
420         * testsuite/merge_string_literals_1.c: New file.
421         * testsuite/merge_string_literals_2.c: Ditto.
422         * testsuite/merge_string_literals.sh: Ditto.
423
424 2013-04-26  Ian Lance Taylor  <iant@google.com>
425
426         * target-reloc.h (relocate_section): If the reloc offset is out of
427         range, pass VIEW as NULL to relocate.relocate.
428         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
429         * i386.cc (Target_i386::Relocate::relocate): Likewise.
430         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
431         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
432         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
433         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
434
435 2013-04-26  Geoff Pike  <gpike@chromium.org>
436
437         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
438         * layout.cc (Hash_task): New class.
439         (Layout::queue_build_id_tasks): New function.
440         (Layout::write_build_id): Handle single-thread portion of build ID
441         computation.  (In some cases, all of it is single-threaded.)  Replace
442         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
443         functionality in fewer lines of code.
444         * layout.h (Layout::queue_build_id_tasks): New function declaration.
445         * options.h (General_options): make "--build-id" default to tree
446         rather than sha1.  Add two new options related to --build-id=tree:
447         --build-id-chunk-size-for-treehash and
448         --build-id-min-file-size-for-treehash.
449         * Makefile.am: add testing of --build-id=tree and related new options
450         (these tests will be invoked by "make check").
451         * Makefile.in: Regenerate.
452
453 2013-04-25  Alan Modra  <amodra@gmail.com>
454
455         * configure.tgt: Add powerpcle and powerpc64le.
456
457 2013-04-22  Alan Modra  <amodra@gmail.com>
458
459         PR gold/15355
460         * layout.cc (Layout::segment_precedes): Allow more than one
461         segment with the same type and flags.
462
463 2013-04-15  Cary Coutant  <ccoutant@google.com>
464
465         * layout.cc (Layout::set_relocatable_section_offsets): Don't
466         allocate space in file for BSS sections.
467
468 2013-04-15  Cary Coutant  <ccoutant@google.com>
469
470         * script-sections.cc (Orphan_output_section): Reset address
471         to zero after each orphaned section for relocatable links.
472
473 2013-04-15  Cary Coutant  <ccoutant@google.com>
474
475         * symtab.cc (Symbol_table::sized_write_globals): Subtract
476         section starting address for relocatable link.
477         * testsuite/Makefile.am (script_test_11): New test.
478         * testsuite/Makefile.in: Regenerate.
479         * testsuite/script_test_11.c: New source file.
480         * testsuite/script_test_11.t: New linker script.
481
482 2013-04-13  Alan Modra  <amodra@gmail.com>
483
484         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
485         owner when sections are not adjacent and exceed group size.
486         (Target_powerpc::group_sections): Handle corner case.
487         (Target_powerpc::Branch_info::make_stub): Handle case where
488         stub table doesn't exist due to branches in non-exec sections.
489         (Target_powerpc::Relocate::relocate): Likewise.
490
491 2013-04-11  Alan Modra  <amodra@gmail.com>
492
493         PR gold/15354
494         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
495         .branch_lt to match bfd ld.  Adjust comments throughout file.
496
497 2013-04-04  Ian Lance Taylor  <iant@google.com>
498
499         GCC PR c++/56840
500         * object.cc (do_layout_deferred_sections): Handle .eh_frame
501         sections before checking whether they are included in the link.
502
503 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
504
505         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
506         object before calling the plugin claim_file handler.  Pass the elf
507         object of the archive to the plugin. Delete the elf object if the
508         plugin claims the file.
509
510 2013-03-21  Alan Modra  <amodra@gmail.com>
511
512         * layout.cc (Layout::set_segment_offsets): Accept writable .text
513         segment when omagic.
514
515 2013-03-21  Alan Modra  <amodra@gmail.com>
516
517         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
518         comparison warning.
519         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
520         uninitialized" warning.
521
522 2013-03-20  Alan Modra  <amodra@gmail.com>
523
524         * symtab.h (Symbol::clear_version): New function.
525         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
526         is_needed by weak references.  Clear version for symbols defined
527         in as-needed objects that are not needed.
528
529 2013-03-15  Alan Modra  <amodra@gmail.com>
530
531         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
532         static and public.  Add report_err param.  Return false for data refs.
533         (Target_powerpc::rela_dyn_section): New overloaded function.
534         (Target_powerpc::plt_, iplt_): Elucidate.
535         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
536         (Output_data_plt_powerpc::do_write): Don't write .iplt.
537         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
538         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
539         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
540         push_branch and make_plt_entry for ifunc syms when
541         reloc_needs_plt_for_ifunc.
542         (Target_powerpc::Relocate::relocate): Don't use plt entry value
543         for ifunc unless reloc_needs_plt_for_ifunc.
544
545 2013-03-15  Alan Modra  <amodra@gmail.com>
546
547         * gc.h (gc_process_relocs): Don't look through function descriptors.
548         * icf.cc (get_section_contents): Do so here instead.
549
550 2013-03-13  Alan Modra  <amodra@gmail.com>
551
552         * powerpc.cc (is_branch_reloc): Forward declare.
553         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
554         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
555         false for 64-bit, true for 32-bit non-branch relocs.
556         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
557         * testsuite/Makefile.am (icf_test): Use linker map file instead of
558         nm output.
559         (icf_safe_test): Generate linker map file as well as nm output.
560         (icf_safe_so_test): Likewise.
561         * testsuite/Makefile.in: Regenerate.
562         * testsuite/icf_test.sh: Parse linker map file to determine
563         section folding.
564         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
565         * testsuite/icf_safe_so_test.sh: Likewise.
566         (X86_32_or_ARM_specific_safe_fold): Merge into..
567         (arch_specific_safe_fold): ..this.
568         (X86_64_specific_safe_fold): Delete unused function.
569
570 2013-03-12  Alan Modra  <amodra@gmail.com>
571
572         * gc.h (gc_process_relocs): Look through function descriptors
573         to determine shndx, symvalue and addend used by ICF.  Tidy
574         variable duplication.
575
576 2013-03-11  Alan Modra  <amodra@gmail.com>
577
578         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
579         * layout.cc (Layout_task_runner::run): ..to here.
580         * symtab.h (struct Symbol_location): Extract from..
581         (class Symbol_table): ..here.
582         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
583         * target.h (class Target): Add function_location and
584         do_function_location functions.
585         (class Sized_target): Add do_function_location.
586         * object.h (class Sized_relobj_file): Move find_shdr..
587         (class Object): ..to here.
588         * object.cc: Likewise.  Update to suit.  Instantiate.
589         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
590         * powerpc.cc (class Powerpc_dynobj): New.
591         (Target_powerpc::do_function_location): New function.
592         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
593         (Powerpc_dynobj::do_read_symbols): New function.
594         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
595
596 2013-03-08  Ian Lance Taylor  <iant@google.com>
597
598         * options.cc (General_options::string_to_object_format): Accept
599         "default".
600
601 2013-03-08  Alan Modra  <amodra@gmail.com>
602
603         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
604         pointer to Post_fde.
605         (struct Post_fde): Move definition to here..
606         * ehframe.cc (struct Post_fde): ..from here.
607         (Cie::write): Don't alloc Post_fde.
608         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
609
610 2013-03-07  Alan Modra  <amodra@gmail.com>
611
612         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
613         relocation referencing .LC0.
614         * testsuite/discard_locals_test.sh: Remove FIXMEs.
615
616 2013-03-07  Alan Modra  <amodra@gmail.com>
617
618         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
619         always_inline.  Add assembly for powerpc to avoid GOT.
620
621 2013-03-07  Alan Modra  <amodra@gmail.com>
622
623         * testsuite/script_test_10.sh: Don't test .bss section
624         header number.
625
626 2013-03-06  Alan Modra  <amodra@gmail.com>
627
628         * powerpc.cc (class Powerpc_relobj): Move some member functions.
629         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
630         all callers.  Handle folded sections.
631         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
632         to Powerpc_relobj.
633         (Global_symbol_visitor_opd::operator()): Likewise.
634
635 2013-03-04  Alan Modra  <amodra@gmail.com>
636
637         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
638         * testsuite/Makefile.in: Regenerate.
639
640 2013-03-01  Cary Coutant  <ccoutant@google.com>
641
642         Add dwp support for v2 DWARF package file format.
643         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
644         tu_length parameter.  Adjust all callers.
645         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
646         * dwp.cc: Include dwarf.h.
647         (Section_bounds): New struct type.
648         (Unit_set): New struct type.
649         (Dwo_file::Dwo_file): Initialize new data member.
650         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
651         Combine and rename to...
652         (Dwo_file::read_unit_index): ...this.
653         (Dwo_file::sized_read_compunit_index)
654         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
655         (Dwo_file::sized_read_unit_index): ...this.
656         (Dwo_file::copy_section): Remove section_name, is_str_offsets
657         parameters; add section_id parameter.
658         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
659         (Dwo_file::add_unit_set): ...this.
660         (Dwo_file::shndx_map_): Remove.
661         (Dwo_file::sect_offsets_): New data member.
662         (Dwp_output_file::Dwp_output_file): Initialize new data members.
663         (Dwp_output_file::add_section): Rename to...
664         (Dwp_output_file::add_contribution): ...this.
665         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
666         (Dwp_output_file::add_tu_set): Likewise.
667         (Dwp_output_file::Contribution): New type.
668         (Dwp_output_file::Section::contributions): New data member.
669         (Dwp_output_file::Cu_or_tu_set): Remove.
670         (Dwp_output_file::Section::Section): New ctor.
671         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
672         (Dwp_output_file::Dwp_index::Section_table): New type.
673         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
674         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
675         parameter.
676         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
677         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
678         (Dwp_output_file::Dwp_index::section_table): New member function.
679         (Dwp_output_file::Dwp_index::section_table_end): New member function.
680         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
681         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
682         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
683         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
684         (Dwp_output_file::Dwp_index::section_table_): New data member.
685         (Dwp_output_file::Dwp_index::section_mask_): New data member.
686         (Dwp_output_file::add_output_section): New member function.
687         (Dwp_output_file::write_new_section): New member function.
688         (Dwp_output_file::write_contributions): New member function.
689         (Dwp_output_file::section_id_map_): New data member.
690         (class Dwo_id_info_reader): Remove.
691         (class Unit_reader): New class.
692         (get_dwarf_section_name): New function.
693         (Dwo_file::read_executable): Adjust initializations of class data.
694         (Dwo_file::read): Add support for v2 package file format.
695         (Dwo_file::read_unit_index): Likewise.
696         (Dwo_file::sized_read_unit_index): Likewise.
697         (Dwo_file::copy_section): Likewise.
698         (Dwo_file::add_unit_set): Likewise.
699         (Dwp_output_file::add_output_section): Likewise.
700         (Dwp_output_file::add_contribution): Likewise.
701         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
702         for empty slot.
703         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
704         file format.
705         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
706         slot.
707         (Dwp_output_file::initialize): Remove unused function.
708         (Dwp_output_file::finalize): Add support for v2 package file format.
709         (Dwp_output_file::write_index): Likewise.
710         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
711         function prototype.
712
713 2013-03-01  Cary Coutant  <ccoutant@google.com>
714
715         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
716         function into class definition in header file.
717         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
718         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
719         New function.
720         (Dwarf_info_reader::check_buffer): Move here from .cc file.
721
722 2013-02-28  Alan Modra  <amodra@gmail.com>
723
724         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
725         * target.cc (Target::do_plt_fde_location): New function.
726         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
727         accessor function, and constructor param.
728         (struct Post_fde, Post_fdes): Declare.
729         (Cie::write): Add post_fdes param.
730         * ehframe.cc (Fde::write): Use plt_fde_location.
731         (struct Post_fde): Define.
732         (Cie::write): Stash FDEs added post merge mapping.
733         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
734         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
735         (Eh_frame::do_sized_write): Arrange to write post map FDES after
736         other FDEs.
737         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
738         (Target_powerpc::has_glink): New function.
739         (Target_powerpc::do_relax): Add eh_frame info for stubs.
740         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
741         glink_eh_frame_fde_32, default_fde): New data.
742         (Stub_table::eh_frame_added_): New var.
743         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
744         Make const.
745         (Stub_table::add_eh_frame): New function.
746         (Output_data_glink::add_eh_frame): New function.
747         (Target_powerpc::make_glink_section): Call add_eh_frame.
748
749 2013-02-15  Ian Lance Taylor  <iant@google.com>
750
751         * options.h (DEFINE_uint64_alias): Define.
752         (class General_options): Add -Ttext-segment as an alias for
753         -Ttext.
754
755 2013-02-15  Alan Modra  <amodra@gmail.com>
756
757         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
758         (Stub_table::do_write): ..here, two places.
759         (Stub_table::plt_call_size): Use it here too.
760
761 2013-02-11  Ian Lance Taylor  <iant@google.com>
762
763         * descriptors.cc (Descriptors::close_all): New function.
764         * descriptors.h (class Descriptors): Declare close_all.
765         (close_all_descriptors): New inline function.
766         * plugin.cc: Include "descriptors.h".
767         (Plugin_manager::cleanup): Call close_all_descriptors.
768
769 2013-02-06  Alan Modra  <amodra@gmail.com>
770
771         * README: Update coding style link.
772
773 2013-01-28  Cary Coutant  <ccoutant@google.com>
774
775         * dwp.cc (File_list): New typedef.
776         (Dwo_name_info_reader): New class.
777         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
778         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
779         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
780         (Dwo_file::read_executable): New function.
781         (Dwo_file::read): Move common setup code to ...
782         (Dwo_file::make_object): ... here.
783         (dwp_options): Add --exec/-e.
784         (usage): Likewise.
785         (main): Likewise.
786
787 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
788
789         * layout.cc (Layout::layout): Check for option text_reorder.
790         (Layout::make_output_section): Ditto.
791         * options.h (text_reorder): New option.
792         * output.cc (Input_section_sort_compare): Remove special ordering
793         of section names.
794         (Output_section::
795          Input_section_sort_section_name_special_ordering_compare::
796          operator()): New function.
797         (Output_section::sort_attached_input_sections): Use new sort function
798         for .text.
799         * output.h (Input_section_sort_section_name_special_ordering_compare):
800         New struct.
801         * testsuite/Makefile.am (text_section_grouping): Test option
802         --no-text-reorder
803         * testsuite/Makefile.in: Regenerate.
804         * testsuite/text_section_grouping.sh: Check order of functions without
805         default text reordering.
806
807 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
808
809         * options.h (General_options): Change default to true for new_dtags.
810
811 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
812
813         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
814         when enable_new_dtags is false.  Only add DT_RUNPATH when
815         enable_new_dtags is true.
816
817 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
818
819         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
820         used in declaration and definition consistent.
821         (Target_powerpc::symval_for_branch): Ditto.
822
823 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
824
825         * testsuite/plugin_final_layout.cc: Fix comment.
826
827 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
828
829         * layout.cc (Layout::layout): Do not do default sorting for
830         text sections when section ordering is specified.
831         (make_output_section): Ditto.
832         * testsuite/plugin_final_layout.cc: Name the function sections
833         to catch reordering issues.
834
835 2013-01-15  Alan Modra  <amodra@gmail.com>
836
837         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
838         plt-thread-safe.
839
840 2013-01-15  Alan Modra  <amodra@gmail.com>
841
842         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
843         * testsuite/Makefile.in: Regenerate.
844
845 2013-01-14  Alan Modra  <amodra@gmail.com>
846
847         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
848         * testsuite/Makefile.in: Regenerate.
849
850 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
851
852         PR bfd/14430
853         Fix mingw gold build with plugins enabled
854         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
855         * configure.ac: Export DLOPEN_LIBS and add headers check.
856         * plugin.cc: Handle non-dlfcn case.
857         * Makefile.in: Regenerate.
858         * config.in: Regenerate.
859         * configure: Regenerate.
860         * testsuite/Makefile.in: Regenerate.
861
862 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
863
864         * output.h (sort_attached_input_sections): Change to be public.
865         * script-sections.cc
866         (Output_section_definition::set_section_addresses): Sort
867         attached input sections according to section order before linker
868         script assigns section addresses.
869         (Orphan_output_section::set_section_addresses): Sort
870         attached input sections according to section order before linker
871         script assigns section addresses.
872         * Makefile.am (final_layout.sh): Use a simple linker script to
873         check if section ordering still works.
874         * Makefile.in: Regenerate.
875
876 2013-01-09  Ben Cheng  <bccheng@google.com>
877
878         * arm.cc (Target_arm::attributes_accept_div): New function.
879         (Target_arm::attributes_forbid_div): New function.
880         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
881         attribute using the same new functions as what bfd/elf32_arm.c
882         does.
883
884 2013-01-07  Cary Coutant  <ccoutant@google.com>
885
886         PR gold/14993
887         * output.cc (Output_section::add_input_section): For incremental
888         updates, don't track input sections that are allocated from patch
889         space.
890
891 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
892             Ian Lance Taylor  <iant@google.com>
893
894         PR gold/14897
895         * configure.ac (--enable-ld): Removed.
896         (install_as_default): Set to yes only for --enable-gold=default
897         or --disable-ld.
898         * configure: Regenerated.
899
900 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
901
902         * options.h (General_options): Add -fuse-ld= for GCC linker
903         option compatibility.
904
905 2013-01-04  Cary Coutant  <ccoutant@google.com>
906
907         * configure.ac: Fix typo restoring CXXFLAGS.
908         * configure: Regenerate.
909
910 2013-01-04  Cary Coutant  <ccoutant@google.com>
911
912         * testsuite/Makefile.am (CXXLINK_S): New macro.
913         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
914         * testsuite/Makefile.in: Regenerate.
915
916 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
917
918         * version.cc (print_version): Update copyright year to 2013.
919
920 2012-12-20  Ian Lance Taylor  <iant@google.com>
921
922         * layout.cc (Layout::special_ordering_of_input_section): New
923         function.
924         (Layout::layout): If input section requires special ordering, must
925         sort input sections.
926         (Layout::make_output_section): May sort .text input sections.
927         (Layout::is_section_name_prefix_grouped): Remove.
928         * layout.h (class Layout): Declare
929         special_ordering_of_input_section.  Don't declare
930         is_section_name_prefix_grouped.
931         * output.cc (Output_section::add_input_section): Revert last
932         change.
933         (Output_section::Input_section_sort::match_file_name): Don't crash
934         if called on output section data.
935         (Output_section::Input_section_sort_compare): Sort based on
936         special ordering.
937         (Output_section::Input_section_sort_section_order_index_compare):
938         Revert last patch.
939         (Output_section::sort_attached_input_sections): Likewise.
940
941 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
942
943         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
944         * layout.h (Layout::is_section_name_prefix_grouped): New function.
945         * output.cc (Output_section::add_input_section): Check if section
946         name contains special prefix.  Keep input sections to sort such
947         sections.
948         (Output_section::Input_section_sort_section_order_index_compare
949          ::operator()): Group sections according to prefixes.
950         (Output_section::sort_attached_input_sections): Add condition to
951         Input_section_entry constructor call.
952         * testsuite/Makefile.am (text_section_grouping): New test.
953         * testsuite/Makefile.in: Regenerate.
954         * testsuite/text_section_grouping.cc: New file.
955         * testsuite/text_section_grouping.sh: New file.
956
957 2012-12-17  Nick Clifton  <nickc@redhat.com>
958
959         * Makefile.am: Add copyright notice.
960         * NEWS: Likewise.
961         * README: Likewise.
962         * configure.ac: Likewise.
963         * ftruncate.c: Likewise.
964         * Makefile.in: Regenerate.
965
966 2012-12-14  Cary Coutant  <ccoutant@google.com>
967
968         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
969         --no-as-needed flag.
970         (exception_separate_shared_12_test): Likewise.
971         (incremental_copy_test): Likewise.
972         * testsuite/Makefile.in: Regenerate.
973
974 2012-12-14  Cary Coutant  <ccoutant@google.com>
975
976         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
977         (Dwp_output_file::Dwp_index::enter_set): Add assert.
978
979 2012-12-12  Alan Modra  <amodra@gmail.com>
980
981         * powerpc.cc (class Track_tls): New.
982         (class Relocate, class Scan): Inherit Track_tls.
983         (Target_powerpc::Scan::local, global): Track tls optimization
984         and avoid creating plt entry for __tls_get_addr if all uses
985         are optimized away.
986         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
987
988 2012-12-12  Alan Modra  <amodra@gmail.com>
989
990         * options.h (General_options): Add --toc-sort/--no-toc-sort.
991         Replace no_toc_optimize with toc_optimize.
992         * output.h (Output_section::input_sections): Provide non-const variant.
993         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
994         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
995         accessors.
996         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
997         (class Sort_toc_sections): New.
998         (Target_powerpc::do_finalize_sections): Sort toc sections.
999         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1000
1001 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1002
1003         * testsuite/binary_unittest.cc (read_all): New function.
1004         (Sized_binary_test): Use it instead of ::read.
1005         * fileread.cc (do_read): Don't assume pread always reads the whole
1006         amount in a single call.
1007
1008 2012-12-10  Alan Modra  <amodra@gmail.com>
1009
1010         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1011         Set EM_PPC64 or EM_PPC here.
1012         (Target_selector_powerpc::do_recognize): Delete.
1013
1014 2012-12-10  Alan Modra  <amodra@gmail.com>
1015
1016         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1017         stub_table_.
1018         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1019
1020 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1021
1022         * testsuite/binary_unittest.cc (Sized_binary_test):
1023         Use open_descriptor rather than ::open.
1024
1025 2012-12-07  Alan Modra  <amodra@gmail.com>
1026
1027         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1028         typedef and invalid_address constant.
1029         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1030         instantiate constants.
1031
1032 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1033
1034         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1035         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1036         * aclocal.m4: Regenerate.
1037         * configure: Regenerate.
1038         * Makefile.in: Regenerate.
1039         * testsuite/Makefile.in: Regenerate.
1040
1041 2012-12-07  Alan Modra  <amodra@gmail.com>
1042
1043         * options.h (General_options): Add no_toc_optimize.
1044         * powerpc.cc (ok_lo_toc_insn): New function.
1045         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1046
1047 2012-12-06  Alan Modra  <amodra@gmail.com>
1048
1049         * options.h (General_options): Add plt_align, plt_static_chain,
1050         plt_thread_safe.  Update stub_group_size help text.
1051         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1052         for new plt_thread_safe_ var.
1053         (use_plt_offset): Correct comments.
1054         (Target_powerpc::do_relax): Look for thread creation symbols to
1055         determine default plt_thread_safe value.  Clear plt call stubs
1056         as well as branch stubs each iteration.
1057         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1058         insn constants.
1059         (l, hi, ha, write_insn): Move earlier.
1060         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1061         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1062         plt stubs too.
1063         (Stub_table::update_size): Adjust.
1064         (Stub_table::prev_size, set_prev_size): Delete.
1065         (Stub_table::stub_align): Let --plt-align affect result.
1066         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1067         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1068         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1069         (Stub_table::do_write): Support more stub variants.
1070
1071 2012-12-04  Alan Modra  <amodra@gmail.com>
1072
1073         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1074         (Target_powerpc::do_define_standard_symbols): New function.
1075
1076 2012-12-03  Alan Modra  <amodra@gmail.com>
1077
1078         * output.h: Formatting, whitespace.
1079
1080 2012-12-03  Alan Modra  <amodra@gmail.com>
1081
1082         * layout.h (Layout::get_executable_sections): Declare.
1083         * layout.cc (Layout::get_executable_sections): New function.
1084         * arm.cc (Target_arm::group_sections): Use it.
1085         (Arm_output_section::group_sections): Delete now redundant test.
1086         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1087         param to handle relative relocs.
1088         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1089         (Output_data_reloc::add_absolute): Adjust.
1090         (Output_data_reloc::add_relative): New function.
1091         (Output_data::reset_data_size): New function.
1092         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1093         (Output_section::set_addralign): New function.
1094         (Output_section::checkpoint_set_addralign): New function.
1095         (Output_section::clear_section_offsets_need_adjustment): New function.
1096         (Output_section::input_sections): Make public.
1097         * powerpc.cc (class Output_data_brlt_powerpc): New.
1098         (class Stub_table, class Stub_control): New.
1099         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1100         stub_table_, set_stub_table, stub_table): New vectors and accessor
1101         functions.
1102         (Target_powerpc::do_may_relax, do_relax, push_branch,
1103         new_stub_table, stub_tables, brlt_section, group_sections,
1104         add_branch_lookup_table, find_branch_lookup_table,
1105         write_branch_lookup_table, make_brlt_section): New functions.
1106         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1107         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1108         branch_info_): New vars.
1109         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1110         make call stubs here.
1111         (Output_data_glink): Remove all call stub handling from this class.
1112         (Target_powerpc::Scan::local, global): Save interesting branch
1113         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1114         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1115         functions on final link.
1116         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1117         Handle long branch destinations too.
1118         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1119         do_plt_address_for_local): Adjust lookup of plt call stubs.
1120
1121 2012-11-30  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1124         relocs against protected symbols when building 32-bit shared libs.
1125
1126 2012-11-30  Alan Modra  <amodra@gmail.com>
1127
1128         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1129         param.  Call got_section() to make .got.  Update all callers
1130         and their callers and so on.
1131
1132 2012-11-30  Alan Modra  <amodra@gmail.com>
1133
1134         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1135         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1136         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1137         value if it already exists.
1138
1139 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1140
1141         PR gold/14858
1142         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1143
1144 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1145
1146         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1147         than bfc instruction for data sandboxing.
1148
1149 2012-11-08  Alan Modra  <amodra@gmail.com>
1150
1151         * po/POTFILES.in: Regenerate.
1152
1153 2012-11-05  Alan Modra  <amodra@gmail.com>
1154
1155         * configure.ac: Apply 2012-09-10 change to config.in here.
1156         * configure: Regenerate.
1157
1158 2012-11-05  Alan Modra  <amodra@gmail.com>
1159
1160         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1161         (struct Opd_ent): Use "Address" rather than "Offset".
1162         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1163         (Target_powerpc::got_section): Make public.
1164         (Target_powerpc::scan_relocs): Move code setting symbols..
1165         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1166         Create _SDA_BASE_ only when referenced.
1167
1168 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1169
1170         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1171         from last change.
1172
1173 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1174
1175         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1176         for offset_in_output_section parameter.
1177         (Sized_target::relocate_special_relocatable): Likewise.
1178         * arm.cc (Target_arm::relocate_relocs): Likewise.
1179         (Target_arm::relocate_special_relocatable): Likewise.
1180         * i386.cc (Target_i386::relocate_relocs): Likewise.
1181         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1182         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1183         * target-reloc.h (relocate_relocs): Likewise.
1184         * testsuite/testfile.cc (Target_test): Likewise.
1185         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1186         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1187
1188         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1189         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1190
1191         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1192         parameter, which is unused in the [!F_SETFD] case.
1193
1194         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1195         SYMNDX to off_t before comparing it to this->data_size().
1196         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1197         * incremental.cc (Output_section_incremental_inputs::do_write):
1198         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1199
1200         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1201
1202 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1203
1204         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1205         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1206         in EABI_VER5.
1207
1208 2012-10-29  Cary Coutant  <ccoutant@google.com>
1209
1210         * dwp.cc (usage): Add file and exit status parameters;
1211         add --help and --version options.
1212         (print_version): New function.
1213         (main): Add --help and --version options.
1214
1215 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1218         final_layout_sequence.txt.
1219         * testsuite/Makefile.in: Regenerated.
1220
1221 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1222
1223         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1224         COMPILE generated by automake.
1225         (LINK1): Likewise.
1226         (CXXCOMPILE1): Likewise.
1227         (CXXLINK1): Likewise.
1228         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1229         (LINK): Likewise.
1230         (CXXCOMPILE): Likewise.
1231         (CXXLINK): Likewise.
1232         * testsuite/Makefile.in: Regenerated.
1233
1234 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1235
1236         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1237         on bad fwrite return.
1238
1239 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1240
1241         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1242         on val.
1243
1244 2012-10-23  Cary Coutant  <ccoutant@google.com>
1245
1246         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1247         * testsuite/Makefile.in: Regenerate.
1248         * testsuite/dwp_test.h: New source file.
1249         * testsuite/dwp_test_1.cc: New source file.
1250         * testsuite/dwp_test_1.s: New source file.
1251         * testsuite/dwp_test_1.sh: New source file.
1252         * testsuite/dwp_test_1b.cc: New source file.
1253         * testsuite/dwp_test_1b.s: New source file.
1254         * testsuite/dwp_test_2.cc: New source file.
1255         * testsuite/dwp_test_2.s: New source file.
1256         * testsuite/dwp_test_2.sh: New source file.
1257         * testsuite/dwp_test_main.cc: New source file.
1258         * testsuite/dwp_test_main.s: New source file.
1259
1260 2012-10-23  Cary Coutant  <ccoutant@google.com>
1261
1262         * dwp.h: New header file.
1263         * dwp.cc: New source file.
1264         * gold.h: Move shared declarations to system.h.
1265         * system.h: New header file.
1266         * Makefile.am: Add dwp.
1267         * Makefile.in: Regenerate.
1268
1269 2012-10-23  Cary Coutant  <ccoutant@google.com>
1270
1271         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1272         Dwarf_info_reader::read_from_pointer.
1273         (Dwarf_pubnames_table::read_header): Likewise.
1274         (Dwarf_pubnames_table::next_name): Likewise.
1275         (Dwarf_die::read_attributes): Likewise.
1276         (Dwarf_die::skip_attributes): Likewise.
1277         (Dwarf_info_reader::read_from_pointer): New function template.
1278         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1279         (Dwarf_pubnames_table): Likewise.
1280         (Dwarf_info_reader::read_from_pointer): New function template.
1281         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1282         Dwarf_pubnames_table ctor.
1283
1284 2012-10-23  Cary Coutant  <ccoutant@google.com>
1285
1286         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1287         abbrev_shndx.
1288         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1289         abbrev_shndx_.
1290         (Dwarf_info_reader::set_abbrev_shndx): New method.
1291         (Dwarf_info_reader::abbrev_shndx_): New data member.
1292
1293 2012-10-23  Cary Coutant  <ccoutant@google.com>
1294
1295         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1296         from object, not parameters.
1297         (Dwarf_info_reader::parse): Likewise.
1298         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1299         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1300         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1301         methods.
1302
1303 2012-10-23  Cary Coutant  <ccoutant@google.com>
1304
1305         * fileread.cc (Input_file::Input_file): New constructor.
1306         * fileread.h (class Input_file): Add new constructor.
1307
1308 2012-10-18  Alan Modra  <amodra@gmail.com>
1309
1310         PR gold/14727
1311         * object.cc (Relobj::is_section_name_included): Also match
1312         .sdata personality section.
1313
1314 2012-10-18  Alan Modra  <amodra@gmail.com>
1315
1316         * target-reloc.h (class Default_comdat_behavior): New, package up..
1317         (get_comdat_behaviour): ..this.
1318         (relocate_section): Add Relocate_comdat_behavior template arg,
1319         adjust code to suit.
1320         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1321         (Target_arm::scan_reloc_section): Likewise.
1322         * i386.cc (Target_i386::relocate_section): Likewise.
1323         * sparc.cc (Target_sparc::relocate_section): Likewise.
1324         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1325         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1326         * powerpc.cc (class Relocate_comdat_behavior): New.
1327         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1328         gold::relocate_section with new template arg.
1329
1330 2012-10-18  Alan Modra  <amodra@gmail.com>
1331
1332         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1333         dynamic relocs for GOT_TPREL got entries, without symbol if
1334         resolving locally.
1335         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1336         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1337         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1338
1339 2012-10-17  Alan Modra  <amodra@gmail.com>
1340
1341         PR gold/14726
1342         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1343
1344 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1345
1346         * layout.cc (Layout::include_section): Keep sections marked
1347         SHF_EXCLUDE when doing relocatable links.
1348
1349 2012-10-16  Alan Modra  <amodra@gmail.com>
1350
1351         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1352         (Target_powerpc::do_finalize_sections): Call it.
1353         (Output_data_save_res): New class and supporting functions.
1354         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1355         normal symbols defined in object files.
1356
1357 2012-10-12  Alan Modra  <amodra@gmail.com>
1358
1359         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1360         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1361         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1362         section if scan_opd_relocs not yet called.
1363         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1364
1365 2012-10-12  Alan Modra  <amodra@gmail.com>
1366
1367         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1368         add_local_ifunc_entry): Revert last change.
1369         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1370
1371 2012-10-05  Alan Modra  <amodra@gmail.com>
1372
1373         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1374         do_plt_address_for_global): New functions.
1375         (Output_data_got_powerpc::do_write): Don't segfault when linking
1376         statically.
1377         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1378         add_local_ifunc_entry): Return true on adding entry..
1379         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1380         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1381         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1382         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1383         set up symbols here.
1384         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1385         syms here.  Do so even when no .iplt.  Don't segfault when linking
1386         statically.
1387         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1388         new variants without reloc param.
1389         (Glink_sym_ent::Glink_sym_ent): Likewise.
1390         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1391         reloc when refs will resolve to plt call stub.
1392         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1393         R_PPC_PLTREL24 to resolve locally.
1394         (Target_powerpc::Scan::global): Correct ifunc handling.
1395         (Target_powerpc::Relocate::relocate): Correct local sym glink
1396         lookup.  Don't destroy "value" when we have a plt call stub,
1397         and when checking plt call validity.
1398         (Target_powerpc::do_dynsym_value): Simplify.
1399
1400 2012-10-05  Alan Modra  <amodra@gmail.com>
1401
1402         * i386.cc (Output_data_plt_i386::address_for_global,
1403         address_for_local): Add plt offset to returned value.  Adjust uses.
1404         * sparc.cc (Output_data_plt_sparc::address_for_global,
1405         address_for_local): Likewise.
1406         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1407         address_for_local): Likewise.
1408         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1409         address_for_local): Likewise.
1410         * target.h (Target::plt_address_for_global, plt_address_for_local):
1411         Update comment.
1412         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1413         (Output_data_got::Got_entry::write): Nor here.
1414         * output.h: Comment fix.
1415
1416 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1417
1418         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1419         global_offset_table_ value for larget got.
1420         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1421
1422 2012-09-29  Alan Modra  <amodra@gmail.com>
1423
1424         * powerpc.cc (Target_powerpc::iplt_): New output section.
1425         (Target_powerpc::iplt_section, make_iplt_section,
1426         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1427         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1428         Target_powerpc::plt_entry_count): Count iplt entries too.
1429         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1430         reloc section in constructor.  New params.
1431         (Target_powerpc::make_plt_section): Create reloc section here instead.
1432         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1433         functions.
1434         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1435         (Output_data_glink::add_entry, find_entry): New functions to
1436         deal with local syms.
1437         (Glink_sym_ent): Add support for local syms.
1438         (Output_data_glink::do_write): Handle ifunc plt entries.
1439         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1440         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1441         (Target_powerpc::Relocate::relocate): Likewise.
1442         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1443
1444 2012-09-25  Alan Modra  <amodra@gmail.com>
1445
1446         * object.h (Sized_relobj_file::adjust_local_symbol,
1447         do_adjust_local_symbol): New functions.
1448         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1449         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1450         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1451         and irregular opd entry spacing.
1452         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1453         (Global_symbol_visitor_opd): New functor.
1454         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1455         on deleted opd entries.
1456
1457 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1458
1459         * tilegx.cc: New file.
1460         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1461         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1462         * configure.tgt: Add entries for tilegx*.
1463         * configure.ac: Likewise.
1464         * Makefile.in: Rebuild.
1465         * configure: Likewise.
1466         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1467         tilegx.
1468
1469 2012-09-13  Alan Modra  <amodra@gmail.com>
1470
1471         * target-reloc.h (scan_relocs): Call scan.local for relocs
1472         against symbols in discarded sections.  Pass is_discarded
1473         param.
1474         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1475         Add is_discarded param.
1476         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1477         is_discarded to flag opd entry as discarded.  Don't emit dyn
1478         relocs on such entries.
1479         (Target_powerpc::Scan::global): Similarly detect and handle
1480         such opd entries.
1481         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1482         opd_ent_.  Update all uses.
1483         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1484         (Target_powerpc::relocate_section): Zero out discarded opd
1485         entry relocs.
1486
1487 2012-09-12  Ian Lance Taylor  <iant@google.com>
1488
1489         PR gold/14570
1490         * output.cc: Rename Output_data_got template parameter from size
1491         to got_size for all functions.  Compile all variants of
1492         Output_data_got.
1493         (Output_data_got::Got_entry::write): Correct use of size for
1494         symbol value.  Use local_is_tls rather than casting to
1495         Sized_relobj_file.
1496         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1497         (class Sized_relobj_file): Add do_local_is_tls.
1498         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1499
1500 2012-09-11  Alan Modra  <amodra@gmail.com>
1501
1502         PR gold/14566
1503         * layout.cc (Layout::set_segment_offsets): When using
1504         common-page-size alignment, ensure we are on a new max-page-size
1505         page.
1506         * output.cc (Output_segment::set_section_addresses): Use
1507         abi_pagesize, not common_pagesize for relro boundary.
1508         (Output_segment::set_offset): Likewise.
1509
1510 2012-09-11  Alan Modra  <amodra@gmail.com>
1511
1512         * output.h (Output_data_got::add_global_tls, add_local_tls,
1513         add_local_tls_pair): New functions.
1514         (Output_data_got::add_local_pair_with_rel): Remove second
1515         reloc param.  Expand comment.
1516         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1517         use_plt_or_tls_offset_, similarly for constructor param.
1518         (Output_data_got::Got_entry::write): Add got_index param.
1519         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1520         add_local_tls_pair): New functions.
1521         (Output_data_got::Got_entry::write): Handle tls symbols
1522         with use_plt_or_tls_offset_ set specially.
1523         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1524         (Output_data_got::do_write): Replace iterator with index, pass
1525         index to entry write function.
1526         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1527         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1528         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1529         call.
1530         * i386.cc (Target_i386::Scan::local): Likewise.
1531         * sparc.cc (Target_sparc::Scan::local): Likewise.
1532         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1533         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1534         do_tls_offset_for_global): New functions.
1535         (Target_powerpc::Scan::local): Correct TLS relocations and got
1536         entry values.
1537         (Target_powerpc::Scan::global): Don't emit unnecessary
1538         dynamic relocations on TLS GOT entries.
1539
1540 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1541
1542         * config.in: Disable sanity check for kfreebsd.
1543
1544 2012-09-10  Sterling Augustine  <saugustine@google.com>
1545
1546         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1547         (Gdb_index::pubtypes_read): New parameter.
1548         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1549         to calls.
1550         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1551         pubtypes_object_.
1552
1553 2012-09-09  Alan Modra  <amodra@gmail.com>
1554
1555         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1556         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1557         * gc.h (gc_process_relocs): Call target gc_add_reference.
1558         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1559         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1560         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1561         unnecessary cast.
1562         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1563         to cater for when we don't need code offset.  Update use.
1564         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1565         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1566         set_opd_valid): New functions.
1567         (Target_powerpc::do_gc_add_reference): New function.
1568         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1569         stashed refs.
1570         (Target_powerpc::do_gc_mark_symbol): New function.
1571
1572 2012-09-06  Cary Coutant  <ccoutant@google.com>
1573
1574         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1575         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1576         (Dwarf_die::skip_attributes): Likewise.
1577         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1578         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1579         (main): Call it.
1580         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1581
1582 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1583
1584         * testsuite/script_test_3.t: Add .got.plt output section
1585         statement.
1586         * testsuite/script_test_4.t: Likewise.
1587
1588 2012-09-05  Alan Modra  <amodra@gmail.com>
1589
1590         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1591         update all uses and lose "enum" when using type.
1592
1593 2012-09-05  Alan Modra  <amodra@gmail.com>
1594
1595         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1596         * configure: Regenerate.
1597         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1598         (plugin_final_layout.stdout): Likewise.
1599         (memory_test): Set page sizes to 0x1000.
1600         * testsuite/Makefile.in: Regenerate.
1601         * testsuite/discard_locals_test.sh: Add FIXME comment.
1602         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1603         * testsuite/pr14265.t: Add .got output section statement.
1604         * testsuite/script_test_2.t: Likewise.
1605         * testsuite/script_test_3.t: Likewise.
1606         * testsuite/script_test_4.t: Likewise.
1607         * testsuite/script_test_5.t: Likewise.
1608         * testsuite/script_test_6.t: Likewise.
1609         * testsuite/script_test_7.t: Likewise.
1610         * testsuite/script_test_9.t: Likewise.
1611
1612 2012-09-05  Alan Modra  <amodra@gmail.com>
1613
1614         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1615         (Powerpc_relocate_functions::Status): New typedef.
1616         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1617         (Target_powerpc::Scan::local): Handle REL64.
1618         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1619         for REL32 and REL64.
1620         (Target_powerpc::symval_for_branch): New function, extracted from..
1621         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1622         checks.  Report overflow errors.
1623
1624 2012-09-05  Alan Modra  <amodra@gmail.com>
1625
1626         * object.h (Sized_relobj_file::emit_relocs): Delete.
1627         (Sized_relobj_file::emit_relocs_reltype): Delete.
1628         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1629         relocate_relocs for --emit-relocs.
1630         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1631         * output.h: Update comment.
1632         (Output_segment::first_section): New function.
1633         (Output_segment::first_section_load_address): Use first_section.
1634         * output.cc (Output_segment::first_section): New function extracted..
1635         (Output_segment::first_section_load_address): ..from here.  Delete.
1636         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1637         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1638         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1639         adjust call to target.h function.
1640         * i386.cc (Target_i386): Likewise.
1641         * sparc.cc (Target_sparc): Likewise.
1642         * x86_64.cc (Target_x86_64): Likewise.
1643         * powerpc.cc (Target_powerpc): Likewise.
1644         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1645         first tls section has section symbol for optimised local dynamic
1646         output relocs.
1647         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1648         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1649         optimised tls code.
1650         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1651         Rename to relocate_relocs.  Update error message.
1652
1653 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1654
1655         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1656         --just-symbols.
1657
1658 2012-08-31  Alan Modra  <amodra@gmail.com>
1659
1660         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1661         (Powerpc_relobj::toc_base_offset): New stub function.
1662         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1663         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1664         (Target_powerpc::Relocate::enum skip_tls): New.
1665         (Target_powerpc::call_tls_get_addr_): New var.
1666         (Target_powerpc::is_branch_reloc): Move to file scope.
1667         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1668         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1669         New functions.
1670         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1671         (powerpc_info): Correct common_pagesize for ppc64.
1672         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1673         (Powerpc_relocate_functions): Add overflow check enums and functions.
1674         Add non-shift version of rela, rela_ua.  Delete all rel public
1675         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1676         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1677         addr16_ha3, addr14 functions.
1678         (Output_data_got_powerpc::add_constant_pair): New function.
1679         (Output_data_got_powerpc::got_base_offset): Likewise.
1680         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1681         (instruction constants): Sort, add some more.
1682         (Output_data_glink::do_write): Add and use Address typedef.  Use
1683         object->toc_base_offset() stub for 64-bit.
1684         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1685         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1686         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1687         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1688         Always treat .opd relocs as against locally defined symbol.
1689         Correct condition for RELATIVE relocs.
1690         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1691         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1692         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1693         calculations.  Handle TLS relocs, and more.  Add overflow
1694         checking and adjust for Powerpc_relocate_functions changes.
1695         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1696         Reinstate --emit-relocs code with FIXME.
1697
1698 2012-08-30  Alan Modra  <amodra@gmail.com>
1699
1700         * layout.cc (Layout::set_segment_offsets): Set p_align to
1701         abi_pagesize, not common_pagesize.
1702         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1703         to determine whether file header can go in segment.
1704
1705 2012-08-30  Alan Modra  <amodra@gmail.com>
1706
1707         * output.h (Output_reloc::Output_reloc <output section>): Add
1708         is_relative param.  Adjust calls.
1709         (Output_reloc::add_output_section_relative): New functions.
1710         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1711         is_relative.
1712         (Output_reloc::symbol_value): Handle SECTION_CODE.
1713
1714 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1715
1716         * gold.cc (queue_middle_tasks): Call layout again when unique
1717         segments for sections is desired.
1718         * layout.cc (Layout::Layout): Initialize new members.
1719         (Layout::get_output_section_flags): New function.
1720         (Layout::choose_output_section): Call get_output_section_flags.
1721         (Layout::layout): Make output section for mapping to a unique segment.
1722         (Layout::insert_section_segment_map): New function.
1723         (Layout::attach_allocated_section_to_segment): Make unique segment for
1724         output sections marked so.
1725         (Layout::segment_precedes): Check for unique segments when sorting.
1726         * layout.h (Layout::Unique_segment_info): New struct.
1727         (Layout::Section_segment_map): New typedef.
1728         (Layout::insert_section_segment_map): New function.
1729         (Layout::get_output_section_flags): New function.
1730         (Layout::is_unique_segment_for_sections_specified): New function.
1731         (Layout::set_unique_segment_for_sections_specified): New function.
1732         (Layout::unique_segment_for_sections_specified_): New member.
1733         (Layout::section_segment_map_): New member.
1734         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1735         Rename is_gc_pass_one to is_pass_one.
1736         Rename is_gc_pass_two to is_pass_two.
1737         Rename is_gc_or_icf to is_two_pass.
1738         Check for which pass based on whether symbols data is present.
1739         Make it two pass when unique segments for sections is desired.
1740         * output.cc (Output_section::Output_section): Initialize new
1741         members.
1742         * output.h (Output_section::is_unique_segment): New function.
1743         (Output_section::set_is_unique_segment): New function.
1744         (Output_section::is_unique_segment_): New member.
1745         (Output_section::extra_segment_flags): New function.
1746         (Output_section::set_extra_segment_flags): New function.
1747         (Output_section::extra_segment_flags_): New member.
1748         (Output_section::segment_alignment): New function.
1749         (Output_section::set_segment_alignment): New function.
1750         (Output_section::segment_alignment_): New member.
1751         (Output_segment::Output_segment): Initialize is_unique_segment_.
1752         (Output_segment::is_unique_segment): New function.
1753         (Output_segment::set_is_unique_segment): New function.
1754         (Output_segment::is_unique_segment_): New member.
1755         * plugin.cc (allow_unique_segment_for_sections): New function.
1756         (unique_segment_for_sections): New function.
1757         (Plugin::load): Add new functions to transfer vector.
1758         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1759         * Makefile.in: Regenerate.
1760         * testsuite/plugin_final_layout.sh: Check if unique segment
1761         functionality works.
1762         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1763         are available.
1764         (allow_unique_segment_for_sections): New global.
1765         (unique_segment_for_sections): New global.
1766         (claim_file_hook): Call allow_unique_segment_for_sections.
1767         (all_symbols_read_hook): Call unique_segment_for_sections.
1768
1769 2012-08-22  Cary Coutant  <ccoutant@google.com>
1770
1771         * layout.cc (Layout::include_section): Don't assert on GROUP
1772         sections with --emit-relocs.
1773
1774 2012-08-21  Cary Coutant  <ccoutant@google.com>
1775
1776         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1777         if --export-dynamic-symbol names an undef symbol.
1778
1779 2012-08-18  Alan Modra  <amodra@gmail.com>
1780
1781         * powerpc.cc: Formatting and white space.
1782         (Powerpc_relobj): Rename got2_section_ to special_.
1783         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1784         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1785         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1786         (Target_powerpc): Add Address typedef and invalid_address.  Use
1787         throughout.
1788         (Target_powerpc::is_branch_reloc): New function.
1789         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1790         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1791         for dst_mask, value and addend.
1792         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1793         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1794         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1795         uint16_t for 24-bit offset.  Use get_output_section_offset and
1796         check return.
1797         (Target_powerpc::Scan::local): Handle more relocs.
1798         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1799         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1800         Plug in toc restoring insn after plt calls.  Translate branches
1801         to function descriptor symbols to corresponding entry point.
1802         (Target_powerpc::relocate_for_relocatable): Check return from
1803         get_output_section_offset.
1804         * symtab.h: Comment typo.
1805
1806 2012-08-14  Ian Lance Taylor  <iant@google.com>
1807
1808         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1809         unsupported_relocal_local to call unsupported_reloc_global.
1810
1811 2012-08-14  Nick Clifton  <nickc@redhat.com>
1812
1813         PR ld/14265
1814         * script-sections.cc (Sections_element::output_section_name): Add
1815         keep return parameter.
1816         (Output_section_element::match_name): Add keep return parameter.
1817         Return the value of the keep_ member.
1818         * script-sections.h (class Output_section): Update
1819         output_section_name prototype.
1820         * layout.cc (Layout::keep_input_section): New public member
1821         function.
1822         (Layout::choose_output_section): Pass keep parameter to
1823         output_section_name.
1824         * layout.h (class Layout): Add keep_input_section.
1825         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1826         sections.
1827         * testsuite/Makefile.am: Add a test.
1828         * testsuite/Makefile.in: Regenerate.
1829         * testsuite/pr14265.c: Source file for the test.
1830         * testsuite/pr14265.t: Linker script for the test.
1831         * testsuite/pr14265.sh: Shell script for the test.
1832
1833 2012-08-14  Alan Modra  <amodra@gmail.com>
1834
1835         * target.h (Target::output_section_name): New function.
1836         (Target::do_output_section_name): New function.
1837         * layout.cc (Layout::choose_output_section): Call the above.
1838         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1839
1840 2012-08-14  Alan Modra  <amodra@gmail.com>
1841
1842         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1843         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1844         for replace_constant call.
1845         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1846         (Output_data_glink::do_print_to_mapfile): New function.
1847         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1848         (Target_powerpc::Relocate::relocate): Likewise.
1849
1850 2012-08-14  Alan Modra  <amodra@gmail.com>
1851
1852         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1853         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1854         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1855         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1856         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1857         here.
1858         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1859         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1860         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1861         here.
1862         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1863         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1864
1865 2012-08-12  Alan Modra  <amodra@gmail.com>
1866
1867         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1868         (glink insn constants): Use uint32_t.
1869         (Output_data_glink::add_entry): Use insert, not [] operator.
1870
1871 2012-08-11  Alan Modra  <amodra@gmail.com>
1872
1873         * object.h (Sized_relobj_file::find_shdr): New function.
1874         (Sized_relobj_file::find_special_sections): New function.
1875         * object.cc (Sized_relobj_file::find_shdr): New function.
1876         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1877         (Sized_relobj_file::find_special_sections): New function, split out..
1878         (Sized_relobj_file::do_read_symbols): ..from here.
1879         * output.h (Output_data_got::replace_constant): New function.
1880         (Output_data_got::num_entries): New function.
1881         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1882         (Output_data_got::got_offset): Protected rather than private.
1883         (Output_data_got::replace_got_entry): New function.
1884         * output.cc (Output_data_got::replace_got_entry): New function.
1885         * powerpc.cc (class Powerpc_relobj): New.
1886         (class Powerpc_relocate_functions): Delete all psymval variants or
1887         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1888         Implement _ha functions using corresponding _hi function.
1889         (Powerpc_relobj::find_special_sections): New function.
1890         (Target_powerpc::do_make_elf_object): New function.
1891         (class Output_data_got_powerpc): New.
1892         (class Output_data_glink): New.
1893         (class Powerpc_scan_relocatable_reloc): New.
1894         Many more changes througout file.
1895
1896 2012-08-09  Nick Clifton  <nickc@redhat.com>
1897
1898         * po/vi.po: Updated Vietnamese translation.
1899
1900 2012-08-07  Ian Lance Taylor  <iant@google.com>
1901
1902         * layout.cc (Layout::add_target_dynamic_tags): If
1903         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1904         plt_rel.
1905
1906 2012-07-30  Nick Clifton  <nickc@redhat.com>
1907
1908         * po/gold.pot: Updated template.
1909         * po/es.po: Updated Spanish translation.
1910
1911 2012-07-18  Cary Coutant  <ccoutant@google.com>
1912
1913         PR gold/14344
1914         * configure.ac: Add check for -gpubnames support.
1915         * configure: Regenerate.
1916         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1917         support; force -gno-pubnames.
1918         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1919         support.
1920         (gdb_index_test_4): New test.
1921         * testsuite/Makefile.in: Regenerate.
1922         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1923         * testsuite/gdb_index_test_2.sh: Likewise.
1924         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1925         * testsuite/gdb_index_test_4.sh: New script.
1926         * testsuite/gdb_index_test_comm.sh: New script with common code;
1927         don't look for space after colon.
1928
1929 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1930
1931         * gold.cc (queue_middle_tasks): Update function order only after
1932         deferred objects due to plugins are processed.
1933
1934 2012-07-11  Ian Lance Taylor  <iant@google.com>
1935
1936         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1937         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1938         (Target_arm::scan_reloc_for_stub): Likewise.
1939         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1940         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1941         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1942         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1943         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1944
1945 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1946             Ian Lance Taylor  <iant@google.com>
1947
1948         PR gold/14309
1949         * configure.ac: Test whether std::tr1::hash<off_t> works.
1950         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1951         needed.
1952         * output.h (class Output_fill): Add virtual destructor.
1953         * configure, config.in: Rebuild.
1954
1955 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1956
1957         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1958
1959 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1960
1961         * plugin.cc (Plugin::load): Handle position independent executables.
1962
1963 2012-06-06  Cary Coutant  <ccoutant@google.com>
1964
1965         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1966         add .debug_macro.
1967         (lines_only_debug_sections): Likewise.
1968         (gdb_fast_lookup_sections): New static array.
1969         (is_gdb_debug_section): Rename formal parameter.
1970         (is_lines_only_debug_section): Likewise.
1971         (is_gdb_fast_lookup_section): New function.
1972         (Layout::include_section): Check for ".zdebug_" prefix; pass
1973         section name suffix to is_gdb_debug_section, et al.; check for
1974         fast-lookup sections when building .gdb_index.
1975         * options.h (--strip-debug-gdb): Update GDB version number.
1976
1977 2012-06-06  Cary Coutant  <ccoutant@google.com>
1978
1979         * configure.ac: Add check for fallocate.
1980         * configure: Regenerate.
1981         * config.in: Regenerate.
1982
1983         * options.h (class General_options): Add --mmap-output-file and
1984         --posix-fallocate options.
1985         * output.cc: (posix_fallocate): Remove; replace with...
1986         (gold_fallocate): New function.
1987         (Output_file::map_no_anonymous): Call gold_fallocate.
1988         (Output_file::map): Check --mmap-output-file option.
1989
1990 2012-06-05  Jing Yu  <jingyu@google.com>
1991
1992         * gold.h (textdomain): Add do {} to empty while(0).
1993         (bindtextdomain): Likewise.
1994
1995 2012-06-04  Cary Coutant  <ccoutant@google.com>
1996
1997         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1998         has_dynsym_index.
1999
2000 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2001
2002         * symtab.cc (Symbol_table::define_special_symbol):
2003         Initialize *poldsym to prevent uninitialized variable errors.
2004
2005 2012-05-23  Cary Coutant  <ccoutant@google.com>
2006
2007         * layout.cc (Layout::section_name_mapping): Add rules to handle
2008         exact match on .data.rel.ro.local or .data.rel.ro.
2009         (Layout::output_section_name): Check for exact matches.
2010
2011 2012-05-23  Cary Coutant  <ccoutant@google.com>
2012
2013         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2014         more carefully.
2015
2016 2012-05-22  Cary Coutant  <ccoutant@google.com>
2017
2018         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2019         object before exporting symbol.
2020
2021 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2022
2023         * testsuite/tls_test.cc: Include "config.h" first.
2024         * testsuite/tls_test_c.c: Likewise.
2025
2026 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2027             Nick Clifton  <nickc@redhat.com>
2028
2029         PR 14072
2030         * configure.in: Add check that sysdep.h has been included before
2031         any system header files.
2032         * configure: Regenerate.
2033         * config.in: Regenerate.
2034
2035 2012-05-14  Cary Coutant  <ccoutant@google.com>
2036
2037         * layout.cc (Layout::make_output_section): Mark .tdata section
2038         as RELRO.
2039         * testsuite/relro_test.cc: Add a TLS variable.
2040
2041 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2042
2043         PR gold/14091
2044         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2045         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2046         R_X86_64_64.
2047
2048 2012-05-08  Cary Coutant  <ccoutant@google.com>
2049
2050         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2051         (lines_only_debug_sections): Likewise.
2052
2053 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2054
2055         * nacl.cc: New file.
2056         * nacl.h: New file.
2057         * Makefile.am (CCFILES, HFILES): Add them.
2058         * Makefile.in: Regenerate.
2059         * i386.cc (Output_data_plt_i386_nacl): New class.
2060         (Output_data_plt_i386_nacl_exec): New class.
2061         (Output_data_plt_i386_nacl_dyn): New class.
2062         (Target_i386_nacl): New class.
2063         (Target_selector_i386_nacl): New class.
2064         (target_selector_i386): Use it instead of Target_selector_i386.
2065         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2066         (Target_x86_64_nacl): New class.
2067         (Target_selector_x86_64_nacl): New class.
2068         (target_selector_x86_64, target_selector_x32): Use it instead of
2069         Target_selector_x86_64.
2070         * arm.cc (Output_data_plt_arm_nacl): New class.
2071         (Target_arm_nacl): New class.
2072         (Target_selector_arm_nacl): New class.
2073         (target_selector_arm, target_selector_armbe): Use it instead of
2074         Target_selector_arm.
2075
2076         * target-select.cc (select_target): Take new Input_file* and off_t
2077         arguments, pass them on to recognize method of selector.
2078         * object.cc (make_elf_sized_object): Update caller.
2079         * parameters.cc (parameters_force_valid_target): Likewise.
2080         * incremental.cc (make_sized_incremental_binary): Likewise.
2081         * target-select.h: Update decl.
2082         (Target_selector::recognize): Take new Input_file* argument,
2083         pass it on to do_recognize.
2084         (Target_selector::do_recognize): Take new Input_file* argument.
2085         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2086         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2087         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2088         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2089
2090         * target.h (Target::Target_info): New members isolate_execinstr
2091         and rosegment_gap.
2092         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2093         * arm.cc (Target_arm::arm_info): Update initializer.
2094         * i386.cc (Target_i386::i386_info): Likewise.
2095         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2096         * sparc.cc (Target_sparc::sparc_info): Likewise.
2097         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2098         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2099         * layout.cc (Layout::attach_allocated_section_to_segment):
2100         Take new const Target* argument.  If target->isolate_execinstr(), act
2101         like --rosegment.
2102         (Layout::find_first_load_seg): Take new const Target* argument;
2103         if target->isolate_execinstr(), reject PF_X segments.
2104         (Layout::relaxation_loop_body): Update caller.
2105         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2106         reset file offset to zero when we hit LOAD_SEG, and then do a second
2107         loop over the segments before LOAD_SEG to reassign offsets after
2108         addresses have been determined.  Handle target->rosegment_gap().
2109         (Layout::attach_section_to_segment): Take new const Target* argument;
2110         pass it to attach_allocated_section_to_segment.
2111         (Layout::make_output_section): Update caller.
2112         (Layout::attach_sections_to_segments): Take new const Target* argument;
2113         pass it to attach_section_to_segment.
2114         * gold.cc (queue_middle_tasks): Update caller.
2115         * layout.h (Layout): Update method decls with new arguments.
2116
2117         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2118         Target_info pointer to use.
2119         (Target_arm::do_make_data_plt): New virtual method.
2120         (Target_arm::make_data_plt): New method that calls it.
2121         (Target_arm::make_plt_entry): Use it.
2122         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2123         for the section alignment.
2124         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2125         method.
2126         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2127         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2128         method.
2129         (Output_data_plt_arm::get_plt_entry_size): Call it.
2130         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2131         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2132         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2133         method.
2134         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2135         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2136         method instead of sizeof(plt_entry).
2137         (Output_data_plt_arm::add_entry): Likewise.
2138         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2139         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2140         than static method.
2141         (Target_arm::plt_entry_size): Likewise.
2142         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2143         Move to ...
2144         (Output_data_plt_arm_standard): ... here, new class.
2145         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2146         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2147         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2148
2149         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2150         Take additional argument for the PLT entry size.
2151         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2152         Use get_plt_entry_size method rather than plt_entry_size variable.
2153         (Output_data_plt_x86_64::reserve_slot): Likewise.
2154         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2155         (Output_data_plt_x86_64::add_entry): Likewise.
2156         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2157         (Output_data_plt_x86_64::address_for_global): Likewise.
2158         (Output_data_plt_x86_64::address_for_local): Likewise.
2159         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2160         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2161         Make method non-static.
2162         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2163         method.
2164         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2165         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2166         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2167         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2168         virtual method.
2169         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2170         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2171         virtual method.
2172         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2173         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2174         virtual method.
2175         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2176         (Output_data_plt_x86_64::plt_entry_size)
2177         (Output_data_plt_x86_64::first_plt_entry)
2178         (Output_data_plt_x86_64::plt_entry)
2179         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2180         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2181         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2182         (Output_data_plt_x86_64_standard): ... here, new class.
2183         (Target_x86_64::Target_x86_64): Take optional argument for the
2184         Target_info pointer to use.
2185         (Target_x86_64::do_make_data_plt): New virtual method.
2186         (Target_x86_64::make_data_plt): New method to call it.
2187         (Target_x86_64::init_got_plt_for_update): Use that.
2188         Call this->plt_->add_eh_frame method here.
2189         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2190         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2191         rather than static method.
2192         (Target_x86_64::plt_entry_size): Likewise.
2193         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2194         rather than plt_entry_size variable.  Move guts of PLT filling to...
2195         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2196         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2197         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2198
2199         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2200         additional argument for the section alignment.
2201         Don't do add_eh_frame_for_plt here.
2202         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2203         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2204         variable.
2205         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2206         method.
2207         (Output_data_plt_i386::get_plt_entry_size): Call it.
2208         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2209         (Output_data_plt_i386::add_eh_frame): New method to call it.
2210         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2211         method.
2212         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2213         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2214         method.
2215         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2216         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2217         method instead of plt_entry_size.
2218         (Output_data_plt_i386::plt_entry_size)
2219         (Output_data_plt_i386::plt_eh_frame_fde_size)
2220         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2221         (Output_data_plt_i386_standard): ... here, new class.
2222         (Output_data_plt_i386_exec): New class.
2223         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2224         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2225         (Output_data_plt_i386::exec_plt_entry): Move to ...
2226         (Output_data_plt_i386_exec::plt_entry): ... here.
2227         (Output_data_plt_i386_dyn): New class.
2228         (Output_data_plt_i386::first_plt_entry): Move to ...
2229         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2230         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2231         (Output_data_plt_i386_dyn::plt_entry): ... here.
2232         (Target_i386::Target_i386): Take optional argument for the Target_info
2233         pointer to use.
2234         (Target_i386::do_make_data_plt): New virtual method.
2235         (Target_i386::make_data_plt): New method to call it.
2236         (Target_i386::make_plt_section): Use that.
2237         Call this->plt_->add_eh_frame method here.
2238         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2239         rather than plt_entry_size variable.
2240         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2241         (Output_data_plt_i386::address_for_local): Likewise.
2242         (Output_data_plt_i386::do_write): Likewise.
2243         Move guts of PLT filling to...
2244         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2245         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2246         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2247         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2248
2249 2012-05-01  Cary Coutant  <ccoutant@google.com>
2250
2251         * dwarf_reader.cc (Dwarf_die::read_attributes)
2252         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2253         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2254         * reduced_debug_output.cc
2255         (Output_reduced_debug_info_section::get_die_end): Remove
2256         DW_FORM_GNU_ref_index.  Add default case.
2257
2258 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2259
2260         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2261         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2262         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2263         DW_AT_high_pc as offset from DW_AT_low_pc.
2264
2265         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2266         * testsuite/Makefile.in: Regenerate.
2267         * testsuite/gdb_index_test_3.c: New test source file.
2268         * testsuite/gdb_index_test_3.sh: New test source file.
2269
2270 2012-04-25  Ian Lance Taylor  <iant@google.com>
2271
2272         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2273         pointer.
2274         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2275         as a class, not a struct.
2276         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2277         (Target_arm::apply_cortex_a8_workaround): Likewise.
2278         * gc.h: Declare Reloc_types as a struct, not a class.
2279         * object.h: Declare Symbols_data as a struct.
2280         * reloc.h: Declare Read_relocs_data as a struct.
2281         * target.h: Declare Relocate_info as a struct.
2282
2283 2012-04-24  David S. Miller  <davem@davemloft.net>
2284
2285         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2286         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2287         and R_SPARC_WPLT30.
2288
2289 2012-04-24  Cary Coutant  <ccoutant@google.com>
2290
2291         * incremental-dump.cc (find_input_containing_global): Replace
2292         magic number with symbolic constant.
2293         (dump_incremental_inputs): Update version number.
2294         * incremental.cc (Output_section_incremental_inputs): Update version
2295         number; import symbolic constants from Incremental_inputs_reader.
2296         (Incremental_inputs::create_data_sections): Align relocations
2297         section correctly for 64-bit targets.
2298         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2299         constants; add padding.
2300         (Output_section_incremental_inputs::write_header): Add assert for
2301         header_size.
2302         (Output_section_incremental_inputs::write_input_files): Add assert
2303         for input_entry_size.
2304         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2305         add assert for object_info_size, input_section_entry_size,
2306         global_sym_entry_size.
2307         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2308         for data structure sizes; use them.
2309         (Incremental_input_entry_reader): Import symbolic constants from
2310         Incremental_inputs_reader; use them.
2311
2312 2012-04-23  David S. Miller  <davem@davemloft.net>
2313
2314         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2315         and elf_flags_set_.
2316         (Target_sparc::Target_sparc): Initialize new fields.
2317         (Target_sparc::do_make_elf_object): New function.
2318         (Target_sparc::do_adjust_elf_header): New function.
2319
2320 2012-04-23  Cary Coutant  <ccoutant@google.com>
2321
2322         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2323         CU range table of gdb index.
2324
2325 2012-04-20  David S. Miller  <davem@davemloft.net>
2326
2327         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2328         instead of false.
2329
2330 2012-04-16  David S. Miller  <davem@davemloft.net>
2331
2332         * sparc.cc (Target_sparc::got_address): New function.
2333         (Sparc_relocate_functions::gdop_hix22): New function.
2334         (Sparc_relocate_functions::gdop_lox10): New function.
2335         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2336         relocs.
2337         (Target_sparc::Scan::local): Likewise if the global symbol is not
2338         preemptible and is not IFUNC.
2339         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2340         transformations for local and non-preemptible non-IFUNC global
2341         symbols.
2342
2343         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2344         writing out 64-bit part of ranges.
2345
2346         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2347         -fpic and -fpie respectively.
2348         * Makefile.in: Regenerate.
2349
2350         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2351         (Target_sparc::Target_sparc): Initialize new field.
2352         (Target_sparc::do_plt_section_for_global): New function.
2353         (Target_sparc::do_plt_section_for_local): New function.
2354         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2355         (Target_sparc::make_plt_section): New function, broken out of
2356         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2357         (Target_sparc::make_plt_entry): Call make_plt_section.
2358         (Target_sparc::make_local_ifunc_plt_entry): New function.
2359         (Target_sparc::rela_ifunc_section): New function.
2360         (Target_sparc::plt_section): Remove const.
2361         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2362         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2363         and ifunc_count_ fields.
2364         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2365         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2366         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2367         (Output_data_plt_sparc::rela_ifunc): New function.
2368         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2369         (Output_data_plt_sparc::has_ifunc_section): New function.
2370         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2371         (Output_data_plt_sparc::address_for_global): New function.
2372         (Output_data_plt_sparc::address_for_local): New function.
2373         (Output_data_plt_sparc::plt_index_to_offset): New function.
2374         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2375         and entry_count.
2376         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2377         entry_count.
2378         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2379         R_SPARC_JMP_IREL to switch.
2380         (Target_sparc::Scan::check_non_pic): Likewise.
2381         (Target_sparc::Scan::local): Handle IFUNC symbols.
2382         (Target_sparc::Scan::local): Likewise.
2383         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2384         and plt_address_for_local.
2385         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2386         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2387
2388         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2389         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2390         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2391         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2392         global relocs too.
2393         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2394         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2395         calls.
2396         * sparc.cc (Target_sparc::Scan::global): Likewise.
2397         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2398
2399 2012-04-16  Cary Coutant  <ccoutant@google.com>
2400
2401         * archive.cc (Library_base::should_include_member): Check for
2402         --export-dynamic-symbol.
2403         * options.h (class General_options): Add --export-dynamic-symbol.
2404         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2405         --export-dynamic-symbol.
2406         (Symbol_table::gc_mark_undef_symbols): Likewise.
2407         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2408
2409 2012-04-12  David S. Miller  <davem@davemloft.net>
2410
2411         * sparc.cc (Reloc::wdisp10): New relocation method.
2412         (Reloc::h34): Likewise.
2413         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2414         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2415         R_SPARC_WDISP10.
2416         (Target_sparc::Scan::local): Likewise.
2417         (Target_sparc::Scan::global): Likewise.
2418         (Target_sparc::Relocate::relocate): Likewise.
2419
2420 2012-04-09  Cary Coutant  <ccoutant@google.com>
2421
2422         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2423         low_pc == 0.
2424
2425 2012-04-06  Ian Lance Taylor  <iant@google.com>
2426
2427         * timer.cc: #include <unistd.h>.
2428
2429 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2430
2431         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2432         * config.in: Regenerate.
2433         * configure: Regenerate.
2434
2435 2012-04-05  Nick Clifton  <nickc@redhat.com>
2436
2437         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2438         (AM_LC_MESSAGES): Add.
2439         * aclocal.m4: Regenerate.
2440         * config.in: Regenerate.
2441         * configure: Regenerate.
2442
2443 2012-03-21  Cary Coutant  <ccoutant@google.com>
2444
2445         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2446         * Makefile.in: Regenerate.
2447         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2448         (Sized_elf_reloc_mapper::symbol_section): New function.
2449         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2450         (make_elf_reloc_mapper): New function.
2451         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2452         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2453         (Dwarf_abbrev_table::do_get_abbrev): New function.
2454         (Dwarf_ranges_table::read_ranges_table): New function.
2455         (Dwarf_ranges_table::read_range_list): New function.
2456         (Dwarf_pubnames_table::read_section): New function.
2457         (Dwarf_pubnames_table::read_header): New function.
2458         (Dwarf_pubnames_table::next_name): New function.
2459         (Dwarf_die::Dwarf_die): New function.
2460         (Dwarf_die::read_attributes): New function.
2461         (Dwarf_die::skip_attributes): New function.
2462         (Dwarf_die::set_name): New function.
2463         (Dwarf_die::set_linkage_name): New function.
2464         (Dwarf_die::attribute): New function.
2465         (Dwarf_die::string_attribute): New function.
2466         (Dwarf_die::int_attribute): New function.
2467         (Dwarf_die::uint_attribute): New function.
2468         (Dwarf_die::ref_attribute): New function.
2469         (Dwarf_die::child_offset): New function.
2470         (Dwarf_die::sibling_offset): New function.
2471         (Dwarf_info_reader::check_buffer): New function.
2472         (Dwarf_info_reader::parse): New function.
2473         (Dwarf_info_reader::do_parse): New function.
2474         (Dwarf_info_reader::do_read_string_table): New function.
2475         (Dwarf_info_reader::lookup_reloc): New function.
2476         (Dwarf_info_reader::get_string): New function.
2477         (Dwarf_info_reader::visit_compilation_unit): New function.
2478         (Dwarf_info_reader::visit_type_unit): New function.
2479         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2480         Sized_elf_reloc_mapper.
2481         (Sized_dwarf_line_info::symbol_section): Remove function.
2482         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2483         (Sized_dwarf_line_info::read_line_mappings): Remove object
2484         parameter, adjust callers.
2485         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2486         * dwarf_reader.h: Include <sys/types.h>.
2487         (class Track_relocs): Remove forward declaration.
2488         (class Elf_reloc_mapper): New class.
2489         (class Sized_elf_reloc_mapper): New class.
2490         (class Dwarf_abbrev_table): New class.
2491         (class Dwarf_range_list): New class.
2492         (class Dwarf_ranges_table): New class.
2493         (class Dwarf_pubnames_table): New class.
2494         (class Dwarf_die): New class.
2495         (class Dwarf_info_reader): New class.
2496         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2497         (Sized_dwarf_line_info::symbol_section): Remove member function.
2498         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2499         base class.
2500         * gdb-index.cc: New source file.
2501         * gdb-index.h: New source file.
2502         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2503         and .debug_types sections, call Layout::add_to_gdb_index.
2504         (Sized_relobj_incr::do_section_name): Implement.
2505         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2506         return type; Implement.
2507         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2508         return type.
2509         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2510         parameter list and return type.
2511         (Sized_incr_dynobj::do_section_contents): Likewise.
2512         * layout.cc: Include gdb-index.h.
2513         (Layout::Layout): Initialize gdb_index_data_.
2514         (Layout::init_fixed_output_section): Check for .gdb_index section.
2515         (Layout::add_to_gdb_index): New function. Instantiate.
2516         * layout.h: Add forward declaration for class Gdb_index.
2517         (Layout::add_to_gdb_index): New member function.
2518         (Layout::gdb_index_data_): New data member.
2519         * main.cc: Include gdb-index.h.
2520         (main): Print statistics for gdb index.
2521         * object.cc (Object::section_contents): Move code into
2522         do_section_contents.
2523         (need_decompressed_section): Check for sections needed when building
2524         gdb index.
2525         (build_compressed_section_map): Likewise.
2526         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2527         gdb index.
2528         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2529         sections; call Layout::add_to_gdb_index.
2530         (Sized_relobj_file::do_decompressed_section_contents): Call
2531         do_section_contents directly.
2532         * object.h (Object::do_section_contents): Adjust parameter list and
2533         return type.
2534         (Object::do_decompressed_section_contents): Call do_section_contents
2535         directly.
2536         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2537         return type.
2538         * options.h (class General_options): Add --gdb-index option.
2539         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2540         list and return type.
2541         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2542         * reloc.h (Track_relocs::checkpoint): New function.
2543         (Track_relocs::reset): New function.
2544
2545         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2546         New test cases.
2547         * testsuite/Makefile.in: Regenerate.
2548         * testsuite/gdb_index_test.cc: New test source file.
2549         * testsuite/gdb_index_test_1.sh: New test source file.
2550         * testsuite/gdb_index_test_2.sh: New test source file.
2551
2552 2012-03-19  Doug Kwan  <dougkwan@google.com>
2553
2554         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2555         (Target_arm::do_finalize_sections): Remove code which defines
2556         __exidx_start and __exidx_end.  Make symbol table parameter
2557         anonymous as it is not used.
2558         * gold.cc (queue_middle_tasks): Call target hook to define any
2559         target-specific symbols.
2560         * target.h (Target::define_standard_symbols): New method.
2561         (Target::do_define_standard_symbols): Same.
2562         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2563         * testsuite/Makefile.in: Regenerate.
2564         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2565         and __exidx_end.
2566         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2567         relocations are generated for __exidx_start and __exidx_end.
2568
2569 2012-03-16  Doug Kwan  <dougkwan@google.com>
2570
2571         * testsuite/Makefile.am: Disable test initpri3b.
2572         * testsuite/Makefile.in: Regenerate.
2573
2574 2012-03-15  Doug Kwan  <dougkwan@google.com>
2575
2576         * arm.cc (Target_arm::got_section): Make .got section read-only
2577         if -z now is given.
2578
2579 2012-03-15  Ian Lance Taylor  <iant@google.com>
2580
2581         PR gold/13850
2582         * layout.cc (Layout::make_output_section): Correctly mark
2583         SHT_INIT_ARRAY, et. al., as relro.
2584
2585 2012-03-14  Doug Kwan  <dougkwan@google.com>
2586
2587         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2588         dynamic relocations for protected symbols in shared objects.
2589
2590 2012-03-13  Ian Lance Taylor  <iant@google.com>
2591
2592         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2593         keep the larger alignment.
2594
2595 2012-03-12  Cary Coutant  <ccoutant@google.com>
2596
2597         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2598         handling of DW_LNE_define_file.
2599
2600 2012-03-12  Cary Coutant  <ccoutant@google.com>
2601
2602         * reduced_debug_output.cc
2603         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2604         codes to switch.
2605
2606 2012-02-29  Cary Coutant  <ccoutant@google.com>
2607
2608         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2609
2610 2012-02-29  Cary Coutant  <ccoutant@google.com>
2611
2612         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2613         Call Object::decompressed_section_contents.
2614         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2615         New dtor.
2616         (Sized_dwarf_line_info::buffer_start_): New data member.
2617         * merge.cc (Output_merge_data::do_add_input_section): Call
2618         Object::decompressed_section_contents.
2619         (Output_merge_string::do_add_input_section): Likewise.
2620         * object.cc (need_decompressed_section): New function.
2621         (build_compressed_section_map): Decompress sections needed later.
2622         (Sized_relobj_file::do_decompressed_section_contents): New function.
2623         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2624         * object.h (Object::decompressed_section_contents): New function.
2625         (Object::discard_decompressed_sections): New function.
2626         (Object::do_decompressed_section_contents): New function.
2627         (Object::do_discard_decompressed_sections): New function.
2628         (Compressed_section_info): New type.
2629         (Compressed_section_map): Include decompressed section contents.
2630         (Sized_relobj_file::do_decompressed_section_contents): New function.
2631         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2632
2633 2012-02-16  Cary Coutant  <ccoutant@google.com>
2634
2635         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2636         * testsuite/Makefile.in: Regenerate.
2637
2638 2012-02-14  Cary Coutant  <ccoutant@google.com>
2639
2640         * options.cc (General_options::finalize): Disallow -pie and -static.
2641
2642 2012-02-03  Doug Kwan  <dougkwan@google.com>
2643
2644         * arm.cc (Arm_relocate_functions::abs8,
2645         Arm_relocate_functions::abs16): Use
2646         Bits::has_signed_unsigned_overflow32.
2647         (Arm_relocate_functions::thm_abs8): Correct range of
2648         overflow check.
2649         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2650         in assertions.
2651
2652 2012-02-02  Doug Kwan  <dougkwan@google.com>
2653
2654         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2655         position independent outputs, not just shared objects.
2656
2657 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2658
2659         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2660         * configure: Regenerated.
2661
2662 2012-01-27  Ian Lance Taylor  <iant@google.com>
2663
2664         * reloc.h (Bits): New class with static functions, copied from
2665         namespace utils in arm.cc.
2666         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2667         instead.
2668
2669 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2670
2671         * incremental.cc (write_info_blocks): Correct relocation offset.
2672
2673 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2674
2675         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2676         (Relocate::tls_gd_to_le): Likewise.
2677
2678 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2679
2680         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2681
2682 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2683
2684         * configure.ac: Check if -mcmodel=medium works.
2685         * configure: Regenerated.
2686
2687 2012-01-24  Cary Coutant  <ccoutant@google.com>
2688
2689         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2690         definition and ...
2691         (read_unsigned_LEB_128_x): ... this new function.
2692         (read_signed_LEB_128): Replaced with inline definition and ...
2693         (read_signed_LEB_128_x): ... this new function.
2694         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2695         (read_unsigned_LEB_128): Add inline definition.
2696         (read_signed_LEB_128_x): New function.
2697         (read_signed_LEB_128): Add inline definition.
2698         * testsuite/Makefile.am (leb128_unittest): New unit test.
2699         * testsuite/Makefile.in: Regenerate.
2700         * testsuite/leb128_unittest.cc: New unit test.
2701
2702 2012-01-23  Ian Lance Taylor  <iant@google.com>
2703
2704         PR gold/13617
2705         * i386.cc (Target_i386::do_code_fill): When using a jmp
2706         instruction, pad with nop instructions.
2707         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2708
2709 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2710
2711         * x86_64.cc (gc_process_relocs): Add typename on types used in
2712         template.
2713         (scan_relocs): Likewise.
2714         (relocate_section): Likewise.
2715         (apply_relocation): Likewise.
2716
2717 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2718
2719         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2720         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2721         under x32.
2722
2723 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2724
2725         * x86_64.cc: Initial support for x32.
2726
2727 2012-01-03  Cary Coutant  <ccoutant@google.com>
2728
2729         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2730         Use abstract base class for GOT.
2731         * gold/output.h (class Output_data_got_base): New abstract base class.
2732         (class Output_data_got): Derive from new base class, adjust ctors.
2733         (Output_data_got::reserve_slot): Make virtual; rename to
2734         do_reserve_slot; Adjust callers.
2735         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2736         pointer to abstract base class.
2737         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2738
2739 2011-12-18  Ian Lance Taylor  <iant@google.com>
2740
2741         * object.h (Relobj::local_symbol_value): New function.
2742         (Relobj::local_plt_offset): New function.
2743         (Relobj::local_has_got_offset): New function.
2744         (Relobj::local_got_offset): New function.
2745         (Relobj::set_local_got_offset): New function.
2746         (Relobj::do_local_symbol_value): New pure virtual function.
2747         (Relobj::do_local_plt_offset): Likewise.
2748         (Relobj::do_local_has_got_offset): Likewise.
2749         (Relobj::do_local_got_offset): Likewise.
2750         (Relobj::do_set_local_got_offset): Likewise.
2751         (Sized_relobj::do_local_has_got_offset): Rename from
2752         local_has_got_offset.
2753         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2754         (Sized_relobj::do_set_local_got_offset): Rename from
2755         set_local_got_offset.
2756         (Sized_relobj_file::do_local_plt_offset): Rename from
2757         local_plt_offset.
2758         (Sized_relobj_file::do_local_symbol_value): New function.
2759         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2760         local_plt_offset.
2761         * output.cc (Output_data_got::Got_entry::write): Change object to
2762         Relobj.  Use local_symbol_value.
2763         (Output_data_got::add_global_with_rel): Change rel_dyn to
2764         Output_data_reloc_generic*.  Use add_global_generic.
2765         (Output_data_got::add_global_with_rela): Remove.  Change all
2766         callers to use add_global_with_rel.
2767         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2768         Output_data_reloc_generic*.  Use add_global_generic.
2769         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2770         callers to use add_global_pair_with_rel.
2771         (Output_data_got::add_local): Change object to Relobj*.
2772         (Output_data_got::add_local_plt): Likewise.
2773         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2774         change rel_dyn to Output_data_reloc_generic*.  Use
2775         add_local_generic.
2776         (Output_data_got::add_local_with_rela): Remove.  Change all
2777         callers to use all_local_with_rel.
2778         (Output_data_got::add_local_pair_with_rel): Change object to
2779         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2780         add_output_section_generic.
2781         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2782         callers to use add_local_pair_with_rel.
2783         (Output_data_got::reserve_local): Change object to Relobj*.
2784         * output.h: (class Output_data_reloc_generic): Add pure virtual
2785         declarations for add_global_generic, add_local_generic,
2786         add_output_section_generic.
2787         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2788         functions for Output_data_reloc_generic.  Update declarations for
2789         changes listed in output.cc.
2790         (class Output_data_got): Change template parameter to got_size.
2791         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2792         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2793         function.
2794         (Sized_relobj_incr::do_local_plt_offset): New function.
2795         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2796         add_global_generic.
2797
2798 2011-12-17  Cary Coutant  <ccoutant@google.com>
2799
2800         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2801         * resolve.cc (Symbol_table::resolve): Likewise.
2802         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2803         arrays.
2804         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2805
2806 2011-12-16  Ian Lance Taylor  <iant@google.com>
2807
2808         * output.h (Output_data_reloc_generic::add): Only call
2809         add_dynamic_reloc if this is a dynamic reloc section.
2810
2811 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2812
2813         PR gold/13505
2814         * target-reloc.h (apply_relocation): Replace <64, false> with
2815         <size, big_endian>.
2816
2817 2011-11-25  Nick Clifton  <nickc@redhat.com>
2818
2819         * po/it.po: New Italian translation.
2820
2821 2011-11-17  Sterling Augustine  <saugustine@google.com>
2822
2823         * script.cc (script_include_directive): Implement.
2824         (read_script_file): New local variables name and search_path. Update
2825         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2826         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2827         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2828
2829 2011-11-11  Sterling Augustine  <saugustine@google.com>
2830
2831         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2832         (file_or_sections_cmd): Likewise.
2833
2834 2011-11-11  Doug Kwan  <dougkwan@google.com>
2835
2836         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2837         if --just-symbols is given.
2838
2839 2011-11-10  Doug Kwan  <dougkwan@google.com>
2840
2841         PR gold/13362
2842         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2843         when processing data relocs.
2844         * reloc.h (Relocate_functions::rel_unaligned): New method.
2845         (Relocate_functions::pcrel_unaligned): Ditto.
2846         (Relocate_functions::rel32_unaligned): Ditto.
2847         (Relocate_functions::pcrel32_unaligned): Ditto.
2848
2849 2011-11-09  Doug Kwan  <dougkwan@google.com>
2850
2851         PR gold/13362
2852         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2853         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2854         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2855         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2856         (Relocate_functions::rel_unaligned): New.
2857         (Relocate_functions::rel32_unaligned): New.
2858         * target-reloc.h (relocate_for_relocatable): Add code to handle
2859         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2860         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2861         arm_unaligned_reloc_r): New targets.
2862         * testsuite/Makefile.in: Regenerate.
2863         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2864         linking.
2865
2866 2011-11-02  Ian Lance Taylor  <iant@google.com>
2867
2868         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2869         NATIVE_LINKER.
2870         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2871         * options.cc (General_options::finalize): Use library search path
2872         from configure script if specified.  If not native and no sysroot,
2873         only search TOOLLIBDIR.
2874         * options.h (Search_directory::Search_directory): Change name to
2875         const std::string&.
2876         (General_options::add_to_library_path_with_sysroot): Change arg to
2877         const std::string&.
2878         * configure, Makefile.in, config.in: Rebuild.
2879
2880 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2881
2882         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2883         we are working around the ARM1176 Erratum.
2884         * options.h (General_options::fix_arm1176): Add option.
2885         * testsuite/Makefile.am: Add testcases, and keep current ones
2886         working.
2887         * testsuite/Makefile.in: Regenerate.
2888         * testsuite/arm_fix_1176.s: New file.
2889         * testsuite/arm_fix_1176.sh: Likewise.
2890
2891 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2892
2893         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2894         may_use_blx_.
2895         (Target_arm::may_use_blx): Remove method.
2896         (Target_arm::set_may_use_blx): Likewise.
2897         (Target_arm::may_use_v4t_interworking): New method.
2898         (Target_arm::may_use_v5t_interworking): Likewise.
2899         (Target_arm::may_use_blx_): Remove member variable.
2900         (Arm_relocate_functions::arm_branch_common): Check for v5T
2901         interworking.
2902         (Arm_relocate_functions::thumb_branch_common): Likewise.
2903         (Reloc_stub::stub_type_for_reloc): Likewise.
2904         (Target_arm::do_finalize_sections): Correct interworking checks.
2905         * testsuite/Makefile.am: Add new tests.
2906         * testsuite/Makefile.in: Regenerate.
2907         * testsuite/arm_farcall_arm_arm.s: New test.
2908         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2909         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2910         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2911         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2912         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2913         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2914         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2915
2916 2011-10-31  Cary Coutant  <ccoutant@google.com>
2917
2918         PR gold/13023
2919         * expression.cc (Expression::eval_with_dot): Add
2920         is_section_dot_assignment parameter.
2921         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2922         absolute and assigning to dot within a section.
2923         * script-sections.cc
2924         (Output_section_element_assignment::set_section_addresses): Pass
2925         dot_section to set_if_absolute.
2926         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2927         as is_section_dot_assignment flag to eval_with_dot.
2928         (Output_section_element_dot_assignment::set_section_addresses):
2929         Likewise.
2930         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2931         parameter.  Also set value if relative to dot_section; set the
2932         symbol's output_section.
2933         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2934         parameter.  Adjust all callers.
2935         (Expression::eval_maybe_dot): Likewise.
2936         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2937         Adjust all callers.
2938         * testsuite/script_test_2.t: Test assignment of an absolute value
2939         to dot within an output section element.
2940
2941 2011-10-31  Cary Coutant  <ccoutant@google.com>
2942
2943         * options.h (class General_options): Add --[no-]gnu-unique options.
2944         * symtab.cc (Symbol_table::sized_write_globals): Convert
2945         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2946
2947 2011-10-31  Cary Coutant  <ccoutant@google.com>
2948
2949         PR gold/13359
2950         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2951         unnecessary assertion.
2952         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2953
2954 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2955
2956         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2957         gc_mark_symbol.
2958         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2959         gc_mark_symbol.
2960         Change to just keep the section associated with symbol.
2961         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2962         they are externally visible and --export-dynamic is turned on.
2963         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2964
2965 2011-10-19  Ian Lance Taylor  <iant@google.com>
2966
2967         PR gold/13163
2968         * script-sections.cc
2969         (Output_section_element_dot_assignment::needs_output_section): New
2970         function.
2971
2972 2011-10-19  Ian Lance Taylor  <iant@google.com>
2973
2974         PR gold/13204
2975         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2976         --section-start option was seen.
2977         * options.h (General_options::any_section_start): New function.
2978
2979 2011-10-18  David S. Miller  <davem@davemloft.net>
2980
2981         PR binutils/13301
2982         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2983         member to track relocation locations that have moved during TLS
2984         reloc optimizations.
2985         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2986         (Target_sparc::Relocate::relocate): Adjust view down by 4
2987         bytes if it matches reloc_adjust_addr_.
2988         (Target_sparc::Relocate::relocate_tls): Always move the
2989         __tls_get_addr call delay slot instruction forward 4 bytes when
2990         performing relaxation.
2991
2992 2011-10-18  Cary Coutant  <ccoutant@google.com>
2993
2994         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2995         (Output_file::map_no_anonymous): Check for non-zero
2996         return code from posix_fallocate.
2997
2998 2011-10-17  Cary Coutant  <ccoutant@google.com>
2999
3000         PR gold/13245
3001         * plugin.cc (is_visible_from_outside): Check for symbols
3002         referenced from dynamic objects.
3003         * resolve.cc (Symbol_table::resolve): Don't count references
3004         from dynamic objects as references from real ELF files.
3005         * testsuite/plugin_test_2.sh: Adjust expected result.
3006
3007 2011-10-17  Cary Coutant  <ccoutant@google.com>
3008
3009         * gold.cc: Include timer.h.
3010         (queue_middle_tasks): Stamp time.
3011         (queue_final_tasks): Likewise.
3012         * main.cc (main): Store timer in parameters.  Print timers
3013         for each pass.
3014         * parameters.cc (Parameters::Parameters): Initialize timer_.
3015         (Parameters::set_timer): New function.
3016         (set_parameters_timer): New function.
3017         * parameters.h (Parameters::set_timer): New function.
3018         (Parameters::timer): New function.
3019         (Parameters::timer_): New data member.
3020         (set_parameters_timer): New function.
3021         * timer.cc (Timer::stamp): New function.
3022         (Timer::get_pass_time): New function.
3023         * timer.h (Timer::stamp): New function.
3024         (Timer::get_pass_time): New function.
3025         (Timer::pass_times_): New data member.
3026
3027 2011-10-17  Cary Coutant  <ccoutant@google.com>
3028
3029         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3030         task for members of lib groups.
3031
3032 2011-10-17  Cary Coutant  <ccoutant@google.com>
3033
3034         PR gold/13288
3035         * fileread.cc (File_read::find_view): Add assert.
3036         (File_read::make_view): Move bounds check (replace with assert)...
3037         (File_read::find_or_make_view): ... to here.
3038
3039 2011-10-12  Cary Coutant  <ccoutant@google.com>
3040
3041         * output.cc (Output_file::open_base_file): Handle case where
3042         ::read returns less than requested size.
3043
3044 2011-10-10  Cary Coutant  <ccoutant@google.com>
3045
3046         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3047         Initialize defined_count_.
3048         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3049         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3050         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3051         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3052         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3053         * incremental.h (Sized_relobj_incr::defined_count_): New data
3054         member.
3055         (Sized_incr_dynobj::defined_count_): New data member.
3056         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3057         Return zeroes instead of internal error.
3058
3059 2011-10-10  Cary Coutant  <ccoutant@google.com>
3060
3061         PR gold/13249
3062         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3063         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3064         * output.h (class Output_reloc): Add use_plt_offset flag.
3065         (Output_reloc::type_): Adjust size of bit field.
3066         (Output_reloc::use_plt_offset_): New bit field.
3067         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3068         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3069         flag.  Adjust all callers.
3070         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3071         creating RELATIVE relocations.
3072
3073 2011-10-10  Nick Clifton  <nickc@redhat.com>
3074
3075         * po/es.po: Updated Spanish translation.
3076         * po/fi.po: Updated Finnish translation.
3077
3078 2011-10-03   Diego Novillo  <dnovillo@google.com>
3079
3080         * options.cc (parse_uint): Fix dereference of RETVAL.
3081
3082 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3083
3084         * layout.h (section_order_map_): New member.
3085         (get_section_order_map): New member function.
3086         * output.cc (Output_section::add_input_section): Check for patterns
3087         only when --section-ordering-file is specified.
3088         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3089         output_sections have been formed.
3090         * layout.cc (Layout_Layout): Initialize section_order_map_.
3091         * plugin.cc (update_section_order): Store order in order_map. Do not
3092         update the order.
3093         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3094         * testsuite/Makefile.in: Regenerate.
3095         * testsuite/plugin_section_order.c: New file.
3096         * testsuite/plugin_final_layout.cc: New file.
3097         * testsuite/plugin_final_layout.sh: New file.
3098
3099 2011-09-29  Cary Coutant  <ccoutant@google.com>
3100
3101         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3102         Check for NULL.
3103         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3104         symbols during incremental update.
3105         (Symbol_table::add_from_dynobj): Likewise.
3106
3107 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3108             Ian Lance Taylor  <iant@google.com>
3109
3110         * symtab.cc (Symbol_table::define_special_symbol): Always
3111         canonicalize version string.
3112
3113 2011-09-26  Cary Coutant  <ccoutant@google.com>
3114
3115         * gold.cc (queue_initial_tasks): Move option checks ...
3116         * options.cc (General_options::finalize): ... to here. Disable
3117         some options; make others fatal.
3118
3119 2011-09-26  Cary Coutant  <ccoutant@google.com>
3120
3121         gcc PR lto/47247
3122         * plugin.cc (get_symbols_v2): New function.
3123         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3124         (is_referenced_from_outside): New function.
3125         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3126         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3127         (get_symbols): Pass version parameter.
3128         (get_symbols_v2): New function.
3129         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3130         parameter.
3131         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3132         (onload): Add LDPT_GET_SYMBOLS_V2.
3133         (all_symbols_read_hook): Use get_symbols_v2; check for
3134         LDPR_PREVAILING_DEF_IRONLY_EXP.
3135         * testsuite/plugin_test_3.sh: Update expected results.
3136
3137 2011-09-23  Simon Baldwin  <simonb@google.com>
3138
3139         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3140         configuration options.
3141         * configure: Regenerate.
3142         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3143         * Makefile.in: Regenerate.
3144         * testsuite/Makefile.in: Regenerate.
3145
3146 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3147
3148         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3149
3150 2011-09-19  Cary Coutant  <ccoutant@google.com>
3151
3152         * incremental.cc (can_incremental_update): Fix typo in comment.
3153         * incremental.h (can_incremental_update): Likewise.
3154
3155 2011-09-18  Cary Coutant  <ccoutant@google.com>
3156
3157         * incremental.cc (can_incremental_update): New function.
3158         * incremental.h (can_incremental_update): New function.
3159         * layout.cc (Layout::init_fixed_output_section): Call it.
3160         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3161         * object.cc (Sized_relobj_file::do_layout): Call
3162         can_incremental_update.
3163
3164 2011-09-13  Cary Coutant  <ccoutant@google.com>
3165
3166         * configure.ac: Check for glibc support for gnu_indirect_function
3167         support with static linking, setting automake conditional
3168         IFUNC_STATIC.
3169         * Makefile.in: Regenerate.
3170         * configure: Regenerate.
3171
3172         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3173         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3174         for IFUNC_STATIC.
3175         * testsuite/Makefile.in: Regenerate.
3176
3177 2011-09-13  Cary Coutant  <ccoutant@google.com>
3178
3179         * incremental.cc (Sized_relobj_incr::do_layout): Call
3180         report_comdat_group for kept comdat sections.
3181         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3182         * testsuite/Makefile.in: Regenerate.
3183         * testsuite/incr_comdat_test_1.cc: New source file.
3184         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3185         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3186         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3187
3188 2011-09-13  Ian Lance Taylor  <iant@google.com>
3189
3190         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3191         variable external_symbols_offset.
3192
3193 2011-09-12  Ian Lance Taylor  <iant@google.com>
3194
3195         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3196         triggered if object has no symbols.
3197
3198 2011-09-09  David S. Miller  <davem@davemloft.net>
3199
3200         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3201         (Output_fill_debug_line::do_write): Likewise.
3202
3203 2011-08-29  Cary Coutant  <ccoutant@google.com>
3204
3205         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3206         casts to match formatting specs.
3207         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3208
3209 2011-08-26  Cary Coutant  <ccoutant@google.com>
3210
3211         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3212         remaining hole size when allocating.
3213         (Layout::make_output_section): Set fill methods for debug sections.
3214         * layout.h (Free_list::Free_list_node): Move from private to
3215         public.
3216         (Free_list::set_min_hole_size): New function.
3217         (Free_list::begin, Free_list::end): New functions.
3218         (Free_list::min_hole_): New data member.
3219         * output.cc: Include dwarf.h.
3220         (Output_fill_debug_info::do_minimum_hole_size): New function.
3221         (Output_fill_debug_info::do_write): New function.
3222         (Output_fill_debug_line::do_minimum_hole_size): New function.
3223         (Output_fill_debug_line::do_write): New function.
3224         (Output_section::Output_section): Initialize new data member.
3225         (Output_section::set_final_data_size): Ensure patch space is larger
3226         than minimum hole size.
3227         (Output_section::do_write): Fill holes in debug sections.
3228         * output.h (Output_fill): New class.
3229         (Output_fill_debug_info): New class.
3230         (Output_fill_debug_line): New class.
3231         (Output_section::set_free_space_fill): New function.
3232         (Output_section::free_space_fill_): New data member.
3233         * testsuite/Makefile.am (incremental_test_3): Add
3234         --incremental-patch option.
3235         (incremental_test_4): Likewise.
3236         (incremental_test_5): Likewise.
3237         (incremental_test_6): Likewise.
3238         (incremental_copy_test): Likewise.
3239         (incremental_common_test_1): Likewise.
3240         * testsuite/Makefile.in: Regenerate.
3241
3242 2011-08-26  Nick Clifton  <nickc@redhat.com>
3243
3244         * po/es.po: Updated Spanish translation.
3245
3246 2011-08-01  Cary Coutant  <ccoutant@google.com>
3247
3248         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3249         * gold/testsuite/Makefile.in: Regenerate.
3250         * gold/testsuite/justsyms_exec.c: New source file.
3251         * gold/testsuite/justsyms_lib.c: New source file.
3252
3253 2011-08-01  Cary Coutant  <ccoutant@google.com>
3254
3255         * layout.cc (Layout::set_segment_offsets): Don't realign text
3256         segment if -Ttext was specified.
3257         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3258         file type.
3259         * object.h (Sized_relobj_file::e_type): New function.
3260         (Sized_relobj_file::e_type_): New data member.
3261         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3262         base address for ET_EXEC files.
3263         * target.cc (Target::do_make_elf_object_implementation): Allow
3264         ET_EXEC files with --just-symbols option.
3265
3266 2011-07-28  Cary Coutant  <ccoutant@google.com>
3267
3268         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3269         Add thread_number parameter.
3270         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3271         * workqueue-threads.cc
3272         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3273         current thread if its thread number is greater than desired thread
3274         count.
3275         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3276         Add thread_number parameter.
3277         (Workqueue::should_cancel_thread): Likewise.
3278         (Workqueue::find_runnable_or_wait): Pass thread_number to
3279         should_cancel_thread.
3280         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3281         parameter.
3282
3283 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3284
3285         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3286         only after checking if it cannot be forced local.
3287         * symtab.h (is_externally_visible): Check if the symbol is not forced
3288         local.
3289
3290 2011-07-15  Ian Lance Taylor  <iant@google.com>
3291
3292         * options.h (class General_options): Add --print-output-format.
3293         Move -EL next to -EB, for  better --help output.
3294         * target-select.cc: Include <cstdio>, "options.h", and
3295         "parameters.h".
3296         (Target_selector::do_target_bfd_name): New function.
3297         (print_output_format): New function.
3298         * target-select.h (class Target_selector): Update declarations.
3299         (Target_selector::target_bfd_name): New function.
3300         (print_output_format): Declare.
3301         * main.cc: Include "target-select.h".
3302         (main): Handle --print-output-format.
3303         * gold.cc: Include "target-select.h".
3304         (queue_initial_tasks): Handle --print-output-format when there are
3305         no input files.
3306         * parameters.cc (parameters_force_valid_target): Give a better
3307         error message if -EB/-EL does not match target.
3308         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3309         function.
3310
3311 2011-07-15  Ian Lance Taylor  <iant@google.com>
3312
3313         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3314         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3315         (Output_data_plt_i386::do_write): Write address of .dynamic
3316         section to first entry in .got.plt section.
3317         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3318         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3319         Initialize layout_.
3320         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3321         section to first entry in .got.plt section.
3322         * layout.h (Layout::dynamic_section): New function.
3323
3324 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3325
3326         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3327         to claim_file call.
3328         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3329         input_section_position_, and input_section_glob_.
3330         (read_layout_from_file): Call function section_ordering_specified.
3331         * layout.h (is_section_ordering_specified): New function.
3332         (section_ordering_specified): New function.
3333         (section_ordering_specified_): New boolean member.
3334         * main.cc(main): Call load_plugins after layout object is defined.
3335         * output.cc (Output_section::add_input_section): Use
3336         function section_ordering_specified to check if section ordering is
3337         needed.
3338         * output.cc (Output_section::add_relaxed_input_section): Use
3339         function section_ordering_specified to check if section ordering is
3340         needed.
3341         (Output_section::update_section_layout): New function.
3342         (Output_section::sort_attached_input_sections): Check if input section
3343         must be reordered.
3344         * output.h (Output_section::update_section_layout): New function.
3345         * plugin.cc (get_section_count): New function.
3346         (get_section_type): New function.
3347         (get_section_name): New function.
3348         (get_section_contents): New function.
3349         (update_section_order): New function.
3350         (allow_section_ordering): New function.
3351         (Plugin::load): Add the new interfaces to the transfer vector.
3352         (Plugin_manager::load_plugins): New parameter.
3353         (Plugin_manager::all_symbols_read): New parameter.
3354         (Plugin_manager::claim_file): New parameter. Save the elf object for
3355         unclaimed objects.
3356         (Plugin_manager::get_elf_object): New function.
3357         (Plugin_manager::get_view): Change to directly use the bool to check
3358         if get_view is called from claim_file_hook.
3359         * plugin.h (input_objects): New function
3360         (Plugin__manager::load_plugins): New parameter.
3361         (Plugin_manager::claim_file): New parameter.
3362         (Plugin_manager::get_elf_object): New function.
3363         (Plugin_manager::in_claim_file_handler): New function.
3364         (Plugin_manager::in_claim_file_handler_): New member.
3365         (layout): New function.
3366         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3367         handler with an extra parameter. Make the elf object before calling
3368         claim_file handler.
3369         * testsuite/plugin_test.c (get_section_count): New function pointer.
3370         (get_section_type): New function pointer.
3371         (get_section_name): New function pointer.
3372         (get_section_contents): New function pointer.
3373         (update_section_order): New function pointer.
3374         (allow_section_ordering): New function pointer.
3375         (onload): Check if the new interfaces exist.
3376
3377 2011-07-13  Ian Lance Taylor  <iant@google.com>
3378
3379         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3380         relro section.
3381         * x86_64.cc (Target_x86_64::got_section): Likewise.
3382         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3383         (relro_now_test_SOURCES): New variable.
3384         (relro_now_test_DEPENDENCIES): New variable.
3385         (relro_now_test_LDFLAGS): New variable.
3386         (relro_now_test_LDADD): New variable.
3387         (relro_now_test.so): New target.
3388         * testsuite/Makefile.in: Rebuild.
3389
3390 2011-07-12  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/12980
3393         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3394         GLOB_DAT relocation rather than a RELATIVE relocation for a
3395         protected symbol when creating a shared library.
3396         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3397         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3398         * testsuite/protected_main_1.cc (main): Test that protected
3399         function has same address.
3400
3401 2011-07-11  Ian Lance Taylor  <iant@google.com>
3402
3403         PR gold/12979
3404         * options.h (class General_options): Add -Bgroup.
3405         * options.cc (General_options::finalize): If -Bgroup is set,
3406         default to --unresolved-symbols=report-all.
3407         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3408         * target-reloc.h (issue_undefined_symbol_error): Handle
3409         --unresolved-symbols=report-all.
3410
3411 2011-07-08  Ian Lance Taylor  <iant@google.com>
3412
3413         PR gold/11985
3414         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3415         if linker script discards key sections.
3416         (Layout::create_dynamic_symtab): Likewise.
3417         (Layout::assign_local_dynsym_offsets): Likewise.
3418         (Layout::sized_create_version_sections): Likewise.
3419         (Layout::create_interp): Likewise.
3420         (Layout::finish_dynamic_section): Likewise.
3421         (Layout::set_dynamic_symbol_size): Likewise.
3422
3423 2011-07-08  Ian Lance Taylor  <iant@google.com>
3424
3425         PR gold/12386
3426         * options.h (class General_options): Add --unresolved-symbols.
3427         * target-reloc.h (issue_undefined_symbol_error): Check
3428         --unresolved-symbols.  Add comments.
3429
3430 2011-07-08  Ian Lance Taylor  <iant@google.com>
3431
3432         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3433         expression more complex.
3434
3435 2011-07-08  Ian Lance Taylor  <iant@google.com>
3436
3437         PR gold/11317
3438         * target-reloc.h (issue_undefined_symbol_error): New inline
3439         function, broken out of relocate_section.
3440         (relocate_section): Call issue_undefined_symbol_error.
3441         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3442         there is no TLS segment if we are about to issue an undefined
3443         symbol error.
3444         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3445
3446 2011-07-08  Ian Lance Taylor  <iant@google.com>
3447
3448         PR gold/12279
3449         * resolve.cc (Symbol_table::should_override): Add fromtype
3450         parameter.  Change all callers.  Give error when linking together
3451         TLS and non-TLS symbol.
3452         (Symbol_table::should_override_with_special): Add fromtype
3453         parameter.  Change all callers.
3454         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3455         there is no TLS segment if we have reported some errors.
3456         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3457
3458 2011-07-08  Ian Lance Taylor  <iant@google.com>
3459
3460         PR gold/12372
3461         * target.h (Target::plt_address_for_global): New function.
3462         (Target::plt_address_for_local): New function.
3463         (Target::plt_section_for_global): Remove.
3464         (Target::plt_section_for_local): Remove.
3465         (Target::do_plt_address_for_global): New virtual function.
3466         (Target::do_plt_address_for_local): New virtual function.
3467         (Target::do_plt_section_for_global): Remove.
3468         (Target::do_plt_section_for_local): Remove.
3469         (Target::register_global_plt_entry): Add Symbol_table and Layout
3470         parameters.
3471         * output.cc (Output_data_got::Got_entry::write): Use
3472         plt_address_for_global and plt_address_for_local.
3473         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3474         address of output section.
3475         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3476         got_irelative_, and irelative_count_ fields.  Update
3477         declarations.
3478         (Output_data_plt_i386::has_irelative_section): New function.
3479         (Output_data_plt_i386::entry_count): Add irelative_count_.
3480         (Output_data_plt_i386::set_final_data_size): Likewise.
3481         (class Target_i386): Add got_irelative_ and rel_irelative_
3482         fields.  Update declarations.
3483         (Target_i386::Target_i386): Initialize new fields.
3484         (Target_i386::do_plt_address_for_global): New function replacing
3485         do_plt_section_for_global.
3486         (Target_i386::do_plt_address_for_local): New function replacing
3487         do_plt_section_for_local.
3488         (Target_i386::got_section): Create got_irelative_.
3489         (Target_i386::rel_irelative_section): New function.
3490         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3491         fields.  Don't define __rel_iplt_{start,end}.
3492         (Output_data_plt_i386::add_entry): Add symtab and layout
3493         parameters.  Change all callers.  Use different PLT and GOT for
3494         IFUNC symbols.
3495         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3496         layout parameters.  Change all callers.  Use different PLT and
3497         GOT.
3498         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3499         (Output_data_plt_i386::rel_irelative): New function.
3500         (Output_data_plt_i386::address_for_global): New function.
3501         (Output_data_plt_i386::address_for_local): New function.
3502         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3503         IRELATIVE GOT when changing IFUNC GOT entries.
3504         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3505         reloc.
3506         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3507         if we didn't create an IRELATIVE GOT.
3508         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3509         plt_address_for_local.
3510         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3511         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3512         got_irelative_, and irelative_count_ fields.  Update
3513         declarations.
3514         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3515         Initialize new fields.  Remove symtab parameter.  Change all
3516         callers.
3517         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3518         irelative_count_.
3519         (Output_data_plt_x86_64::has_irelative_section): New function.
3520         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3521         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3522         fields.  Update declarations.
3523         (Target_x86_64::Target_x86_64): Initialize new fields.
3524         (Target_x86_64::do_plt_address_for_global): New function replacing
3525         do_plt_section_for_global.
3526         (Target_x86_64::do_plt_address_for_local): New function replacing
3527         do_plt_section_for_local.
3528         (Target_x86_64::got_section): Create got_irelative_.
3529         (Target_x86_64::rela_irelative_section): New function.
3530         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3531         all callers.  Don't create __rel_iplt_{start,end}.
3532         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3533         parameters.  Change all callers.  Use different PLT and GOT for
3534         IFUNC symbols.
3535         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3536         layout parameters.  Change all callers.  Use different PLT and
3537         GOT.
3538         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3539         parameters.  Change all callers.  Use different PLT and GOT for
3540         IFUNC symbols.
3541         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3542         (Output_data_plt_x86_64::rela_irelative): New function.
3543         (Output_data_plt_x86_64::address_for_global): New function.
3544         (Output_data_plt_x86_64::address_for_local): New function.
3545         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3546         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3547         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3548         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3549         parameters.
3550         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3551         reloc.
3552         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3553         symbols if we didn't create an IRELATIVE GOT.
3554         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3555         plt_address_for_local.
3556         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3557         * testsuite/ifuncvar1.c: New test file.
3558         * testsuite/ifuncvar2.c: New test file.
3559         * testsuite/ifuncvar3.c: New test file.
3560         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3561         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3562         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3563         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3564         * testsuite/Makefile.in: Rebuild.
3565
3566 2011-07-07  Cary Coutant  <ccoutant@google.com>
3567
3568         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3569         (two_file_test_1_ndebug.o): Likewise.
3570         (two_file_test_1b_ndebug.o): Likewise.
3571         (two_file_test_2_ndebug.o): Likewise.
3572         (two_file_test_main_ndebug.o): Likewise.
3573         (incremental_test_2): Link with no-debug versions.
3574
3575 2011-07-06  Cary Coutant  <ccoutant@google.com>
3576
3577         * gold/incremental.cc
3578         (Output_section_incremental_inputs::write_info_blocks): Check for
3579         hidden and internal symbols.
3580
3581 2011-07-06  Cary Coutant  <ccoutant@google.com>
3582
3583         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3584         Check disposition for startup file.
3585         (Incremental_inputs::report_command_line): Ignore
3586         --incremental-startup-unchanged option.
3587         * options.cc (General_options::parse_incremental_startup_unchanged):
3588         New function.
3589         (General_options::General_options): Initialize new data member.
3590         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3591         (General_options): Add --incremental-startup-unchanged option.
3592         (General_options::incremental_startup_disposition): New function.
3593         (General_options::incremental_startup_disposition_): New data member.
3594
3595 2011-07-06  Cary Coutant  <ccoutant@google.com>
3596
3597         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3598         input file index to Script_info ctor.
3599         (Sized_incremental_binary::do_file_has_changed): Find the
3600         command-line argument for files named in scripts.
3601         * incremental.h (Script_info::Script_info): New ctor
3602         with input file index.
3603         (Script_info::input_file_index): New function.
3604         (Script_info::input_file_index_): New data member.
3605         (Incremental_binary::get_library): Add const.
3606         (Incremental_binary::get_script_info): Add const.
3607         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3608         * testsuite/Makefile.am (incremental_test_5): New test case.
3609         (incremental_test_6): New test case.
3610         * testsuite/Makefile.in: Regenerate.
3611
3612 2011-07-06  Cary Coutant  <ccoutant@google.com>
3613
3614         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3615         debug output when command lines differ.
3616
3617 2011-07-06  Cary Coutant  <ccoutant@google.com>
3618
3619         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3620         --incremental-patch option.
3621         * layout.cc (Free_list::allocate): Extend allocation beyond original
3622         end if enabled.
3623         (Layout::make_output_section): Mark sections that should get
3624         patch space.
3625         * options.cc (parse_percent): New function.
3626         * options.h (parse_percent): New function.
3627         (DEFINE_percent): New macro.
3628         (General_options): Add --incremental-patch option.
3629         * output.cc (Output_section::Output_section): Initialize new data
3630         members.
3631         (Output_section::add_input_section): Print section name when out
3632         of patch space.
3633         (Output_section::add_output_section_data): Likewise.
3634         (Output_section::set_final_data_size): Add patch space when
3635         doing --incremental-full.
3636         (Output_section::do_reset_address_and_file_offset): Remove patch
3637         space.
3638         (Output_segment::set_section_list_addresses): Print debug output
3639         only if --incremental-update.
3640         * output.h (Output_section::set_is_patch_space_allowed): New function.
3641         (Output_section::is_patch_space_allowed_): New data member.
3642         (Output_section::patch_space_): New data member.
3643         * parameters.cc (Parameters::incremental_full): New function.
3644         * parameters.h (Parameters::incremental_full): New function
3645         * testsuite/Makefile.am (incremental_test_2): Add test for
3646         --incremental-patch option.
3647         * testsuite/Makefile.in: Regenerate.
3648         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3649         (t18): Remove function body.
3650
3651 2011-07-05  Doug Kwan  <dougkwan@google.com>
3652
3653         PR gold/12771
3654         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3655         Arm_Address type for relocation result.
3656         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3657         overflow check.
3658         (Arm_relocate_functions::abs32): Use unaligned access.
3659         (Arm_relocate_functions::rel32): Ditto.
3660         (Arm_relocate_functions::prel31): Ditto.
3661         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3662         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3663         static data relocations.
3664         * testsuite/Makefile.in: Regnerate.
3665         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3666
3667 2011-07-05  Ian Lance Taylor  <iant@google.com>
3668
3669         PR gold/12392
3670         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3671         symbols if necessary.
3672         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3673
3674 2011-07-05  Ian Lance Taylor  <iant@google.com>
3675
3676         PR gold/12952
3677         * resolve.cc (Symbol::override_base_with_special): Simply override
3678         version with special symbol version, ignoring previous version.
3679
3680 2011-07-05  Ian Lance Taylor  <iant@google.com>
3681
3682         * object.cc (Sized_relobj_file::include_section_group): Add
3683         information to comment about signature location.
3684
3685 2011-07-02  Ian Lance Taylor  <iant@google.com>
3686
3687         PR gold/12957
3688         * options.h (class General_options): Add -f and -F.
3689         * options.cc (General_options::finalize): Fatal error if -f/-F
3690         are used without -shared.
3691         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3692
3693 2011-07-02  Ian Lance Taylor  <iant@google.com>
3694
3695         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3696
3697 2011-07-01  Ian Lance Taylor  <iant@google.com>
3698
3699         PR gold/12525
3700         PR gold/12952
3701         * resolve.cc (Symbol::override_base_with_special): Don't override
3702         the version if the overriding symbol has a different name.
3703         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3704         all callers.  If we give an error about an undefined version,
3705         define the base version if necessary.
3706         * dynobj.h (class Versions): Update declaration.
3707         * testsuite/weak_alias_test_5.cc: New file.
3708         * testsuite/weak_alias_test.script: New file.
3709         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3710         and versioned_alias have the right value, and call t2.
3711         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3712         weak_alias_test_5.so.
3713         (weak_alias_test_LDADD): Likewise.
3714         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3715         * testsuite/Makefile.in: Rebuild.
3716
3717 2011-07-01  Ian Lance Taylor  <iant@google.com>
3718
3719         PR gold/12525
3720         * options.h (class General_options): Support -z notext.
3721         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3722         -Wl,-z,notext.
3723         (two_file_shared_nonpic.so): Likewise.
3724         (two_file_shared_mixed.so): Likewise.
3725         (two_file_shared_mixed_1.so): Likewise.
3726         (weak_undef_lib_nonpic.so): Likewise.
3727         (alt/weak_undef_lib_nonpic.so): Likewise.
3728         (tls_test_shared_nonpic.so): Likewise.
3729         * testsuite/Makefile.in: Rebuild.
3730
3731 2011-07-01  Ian Lance Taylor  <iant@google.com>
3732
3733         PR gold/12525
3734         * configure.ac: Test whether static linking works, setting
3735         the automake conditional HAVE_STATIC.
3736         * testsuite/Makefile.am: Disable tests using -static if
3737         HAVE_STATIC is not true.
3738         * configure, testsuite/Makefile.in: Rebuild.
3739
3740 2011-07-01  Ian Lance Taylor  <iant@google.com>
3741
3742         PR gold/12525
3743         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3744         Assert if we see DW_EH_PE_indirect.
3745         * target.h (Target::ehframe_datarel_base): New function.
3746         (Target::do_ehframe_datarel_base): New target function.
3747         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3748         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3749         function.
3750
3751 2011-07-01  Ian Lance Taylor  <iant@google.com>
3752
3753         PR gold/12571
3754         * options.h (class General_options): Add
3755         --ld-generated-unwind-info.
3756         * ehframe.cc (Fde::write): Add address parameter.  Change all
3757         callers.  If associated with PLT, fill in address and size.
3758         (Cie::set_output_offset): Only add merge mapping if there is an
3759         object.
3760         (Cie::write): Add address parameter.  Change all callers.
3761         (Eh_frame::add_ehframe_for_plt): New function.
3762         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3763         input_offset_ fields into union u_, with new plt field.
3764         (Fde::Fde): Adjust for new union field.
3765         (Fde::Fde) [Output_data version]: New constructor.
3766         (Fde::add_mapping): Only add merge mapping if there is an object.
3767         (class Cie): Update declarations.
3768         (class Eh_frame): Declare add_ehframe_for_plt.
3769         * layout.cc (Layout::layout_eh_frame): Break out code into
3770         make_eh_frame_section, and call it.
3771         (Layout::make_eh_frame_section): New function.
3772         (Layout::add_eh_frame_for_plt): New function.
3773         * layout.h (class Layout): Update declarations.
3774         * merge.cc (Merge_map::add_mapping): Add assertion.
3775         * i386.cc: Include "dwarf.h".
3776         (class Output_data_plt_i386): Make first_plt_entry,
3777         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3778         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3779         and plt_eh_frame_fde.
3780         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3781         boundary.  Call add_eh_frame_for_plt if appropriate.
3782         * x86_64.cc: Include "dwarf.h".
3783         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3784         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3785         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3786         and plt_eh_frame_fde.
3787         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3788         appropriate.
3789
3790 2011-06-29  Ian Lance Taylor  <iant@google.com>
3791
3792         PR gold/12629
3793         * object.cc (Sized_relobj_file::layout_section): Change shdr
3794         parameter to be const.
3795         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3796         out of do_layout.
3797         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3798         appropriate.  Call layout_eh_frame_section.
3799         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3800         sections.
3801         * object.h (class Sized_relobj_file): Update declarations.
3802
3803 2011-06-29  Ian Lance Taylor  <iant@google.com>
3804
3805         PR gold/12652
3806         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3807         modifier.
3808         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3809
3810 2011-06-29  Ian Lance Taylor  <iant@google.com>
3811
3812         PR gold/12675
3813         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3814         SHT_X86_64_UNWIND.
3815         * layout.cc (Layout::layout_eh_frame): Likewise.
3816
3817 2011-06-29  Ian Lance Taylor  <iant@google.com>
3818
3819         PR gold/12695
3820         * layout.cc (Layout::symtab_section_shndx): New function.
3821         * layout.h (class Layout): Declare symtab_section_shndx.
3822         * output.cc (Output_section::write_header): Call it.
3823
3824 2011-06-29  Ian Lance Taylor  <iant@google.com>
3825
3826         PR gold/12818
3827         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3828         symbols which are not used in a relocation.
3829
3830 2011-06-28  Ian Lance Taylor  <iant@google.com>
3831
3832         PR gold/12898
3833         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3834         script create indistinguishable segments.
3835         (Layout::set_segment_offsets): Use stable_sort when sorting
3836         segments.  Pass this to Compare_segments constructor.
3837         * layout.h (class Layout): Make segment_precedes non-static.
3838         (class Compare_segments): Change from struct to class.  Add
3839         layout_ field.  Add constructor.
3840         * script-sections.cc
3841         (Script_sections::attach_sections_using_phdrs_clause): Rename
3842         local orphan to is_orphan.  Don't report failure to put empty
3843         section in segment.  On attachment failure, report name of
3844         section, and attach to first PT_LOAD segment.
3845
3846 2011-06-28  Ian Lance Taylor  <iant@google.com>
3847
3848         PR gold/12934
3849         * target-select.cc (Target_selector::Target_selector): Add
3850         emulation parameter.  Change all callers.
3851         (select_target_by_bfd_name): Rename from select_target_by_name.
3852         Change all callers.
3853         (select_target_by_emulation): New function.
3854         (supported_emulation_names): New function.
3855         * target-select.h (class Target_selector): Add emulation_ field.
3856         Update declarations.
3857         (Target_selector::recognize_by_bfd_name): Rename from
3858         recognize_by_name.  Change all callers.
3859         (Target_selector::supported_bfd_names): Rename from
3860         supported_names.  Change all callers.
3861         (Target_selector::recognize_by_emulation): New function.
3862         (Target_selector::supported_emulations): New function.
3863         (Target_selector::emulation): New function.
3864         (Target_selector::do_recognize_by_bfd_name): Rename from
3865         do_recognize_by_name.  Change all callers.
3866         (Target_selector::do_supported_bfd_names): Rename from
3867         do_supported_names.  Change all callers.
3868         (Target_selector::do_recognize_by_emulation): New function.
3869         (Target_selector::do_supported_emulations): New function.
3870         (select_target_by_bfd_name): Change name in declaration.
3871         (select_target_by_emulation): Declare.
3872         (supported_emulation_names): Declare.
3873         * parameters.cc (parameters_force_valid_target): Try to find
3874         target based on emulation from -m option.
3875         * options.h (class General_options): Change doc string for -m.
3876         * options.cc (help): Print emulations.
3877         (General_options::parse_V): Likewise.
3878         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3879         Add emulation parameter.  Change all callers.
3880
3881 2011-06-28  Ian Lance Taylor  <iant@google.com>
3882
3883         * target.h (class Target): Add osabi_ field.
3884         (Target::osabi): New function.
3885         (Target::set_osabi): New function.
3886         (Target::Target): Initialize osabi_.
3887         (Target::do_adjust_elf_header): Make pure virtual.
3888         (Sized_target::do_adjust_elf_header): Declare.
3889         * target.cc (Sized_target::do_adjust_elf_header): New function.
3890         (class Sized_target): Instantiate all versions.
3891         * freebsd.h (class Target_freebsd): Remove.
3892         (Target_selector_freebsd::do_recognize): Call set_osabi on
3893         Target.
3894         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3895         (Target_selector_freebsd::set_osabi): Remove.
3896         * i386.cc (class Target_i386): Inherit from Sized_target rather
3897         than Target_freebsd.
3898         * x86_64.cc (class Target_x86_64): Likewise.
3899
3900 2011-06-28  Ian Lance Taylor  <iant@google.com>
3901
3902         * target.h (Target::can_check_for_function_pointers): Rewrite.
3903         Make non-virtual.
3904         (Target::can_icf_inline_merge_sections): Likewise.
3905         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3906         (Target::Target_info): Add can_icf_inline_merge_sections field.
3907         (Target::do_can_check_for_function_pointers): New virtual
3908         function.
3909         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3910         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3911         from can_check_for_function_pointers, move in file.
3912         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3913         section_may_have_icf_unsafe_poineters, move in file.
3914         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3915         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3916         Rename from can_check_for_function_pointers, move in file.
3917         (Target_i386::can_icf_inline_merge_sections): Remove.
3918         (Target_i386::i386_info): Initialize
3919         can_icf_inline_merge_sections.
3920         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3921         Initialize can_icf_inline_merge_sections.
3922         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3923         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3924         Rename from can_check_for_function_pointers, move in file.
3925         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3926         (Target_x86_64::x86_64_info): Initialize
3927         can_icf_inline_merge_sections.
3928         * testsuite/testfile.cc (Target_test::test_target_info):
3929         Likewise.
3930         * icf.cc (get_section_contents): Correct formatting.
3931
3932 2011-06-27  Ian Lance Taylor  <iant@google.com>
3933
3934         * symtab.cc (Symbol::versioned_name): New function.
3935         (Symbol_table::add_to_final_symtab): Use versioned_name when
3936         appropriate.
3937         (Symbol_table::sized_write_symbol): Likewise.
3938         * symtab.h (class Symbol): Declare versioned_name.
3939         * stringpool.h (class Stringpool_template): Add variant of add
3940         which takes a std::basic_string.
3941         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3942         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3943         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3944         (ver_test_12.o): New target.
3945         * testsuite/Makefile.in: Rebuild.
3946
3947 2011-06-27  Doug Kwan  <dougkwan@google.com>
3948
3949         * arm.cc (Arm_relocate_functions::thm_jump8,
3950         Arm_relocate_functions::thm_jump11): Use a wider signed
3951         type to compute offset.
3952         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3953         arm_thm_jump8.
3954         * testsuite/Makefile.in: Regenerate.
3955         * testsuite/arm_branch_in_range.sh: Check test results of
3956         arm_thm_jump11 and arm_thm_jump8.
3957         * testsuite/arm_thm_jump11.s: New test source file.
3958         * testsuite/arm_thm_jump11.t: New linker script.
3959         * testsuite/arm_thm_jump8.s: New test source file.
3960         * testsuite/arm_thm_jump8.t: New linker script.
3961
3962 2011-06-24  Ian Lance Taylor  <iant@google.com>
3963
3964         * layout.cc: Include "object.h".
3965         (ctors_sections_in_init_array): New static variable.
3966         (Layout::is_ctors_in_init_array): New function.
3967         (Layout::layout): Add entry to ctors_sections_in_init_array if
3968         appropriate.
3969         * layout.h (class Layout): Declare is_ctors_in_init_array.
3970         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3971         is_ctors_reverse_view is set.
3972         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3973         all callers.  Set is_ctors_reverse_view field of View_size.
3974         (Sized_relobj_file::reverse_words): New function.
3975         * object.h (Sized_relobj_file::View_size): Add
3976         is_ctors_reverse_view field.
3977         (class Sized_relobj_file): Update declarations.
3978         * testsuite/initpri3.c: New test.
3979         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3980         initpri3b.
3981         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3982         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3983         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3984         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3985         * testsuite/Makefile.in: Rebuild.
3986
3987 2011-06-24  Cary Coutant  <ccoutant@google.com>
3988
3989         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3990         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3991         (debug_msg_cdebug.err): New targets.
3992         * testsuite/Makefile.in: Regenerate.
3993         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3994         Fix checks for link with shared library.
3995
3996 2011-06-24  Doug Kwan  <dougkwan@google.com>
3997
3998         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3999         skip empty text sections.
4000         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4001
4002 2011-06-22  Ian Lance Taylor  <iant@google.com>
4003
4004         PR gold/12910
4005         * options.h (class General_options): Add --ctors-in-init-array.
4006         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4007         friends as SHT_PROGBITS for merging sections.
4008         (Layout::layout): Remove special handling of .init_array and
4009         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4010         and .dtors if ctors_in_init_array.
4011         (Layout::make_output_section): Force correct section types for
4012         .init_array and friends.  Don't sort if doing relocatable link,
4013         Don't sort .ctors and .dtors if ctors_in_init_array.
4014         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4015         (Layout::output_section_name): Add relobj parameter.  Change all
4016         callers.  Handle .ctors. and .dtors. in code rather than table.
4017         Handle .ctors and .dtors if ctors_in_init_array.
4018         (Layout::match_file_name): New function, moved from output.cc.
4019         * layout.h (class Layout): Update declarations.
4020         * output.cc: Include "layout.h".
4021         (Input_section_sort_entry::get_priority): New function.
4022         (Input_section_sort_entry::match_file_name): Just call
4023         Layout::match_file_name.
4024         (Output_section::Input_section_sort_init_fini_compare::operator()):
4025         Handle .ctors and .dtors.  Sort by explicit priority rather than
4026         by name.
4027         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4028         * testsuite/initpri2.c: New test.
4029         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4030         (check_PROGRAMS): Add initpri2.
4031         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4032         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4033         * configure, testsuite/Makefile.in: Rebuild.
4034
4035 2011-06-19  Ian Lance Taylor  <iant@google.com>
4036
4037         PR gold/12880
4038         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4039         .interp section to a PT_INTERP segment even if we have seen a
4040         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4041         clause in a linker script.
4042         (Layout::finalize): Don't create a .interp section if we've
4043         already create a PT_INTERP segment.
4044         (Layout::create_interp): Always call choose_output_section (revert
4045         patch of 2011-06-17).  Don't create PT_INTERP segment.
4046         * script-sections.cc
4047         (Script_sections::create_note_and_tls_segments): Add a .interp
4048         section to a PT_INTERP segment even if we have seen a
4049         --dynamic-linker option.
4050
4051 2011-06-18  Ian Lance Taylor  <iant@google.com>
4052
4053         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4054         merely because a non-PT_LOAD segment has a dynamic reloc.
4055
4056 2011-06-18  Ian Lance Taylor  <iant@google.com>
4057
4058         * layout.cc (Layout::finish_dynamic_section): Don't create
4059         DT_FLAGS entry if not needed.
4060
4061 2011-06-18  Ian Lance Taylor  <iant@google.com>
4062
4063         PR gold/12745
4064         * layout.cc (Layout::layout_eh_frame): Correct handling of
4065         writable .eh_frame section.
4066
4067 2011-06-17  Ian Lance Taylor  <iant@google.com>
4068
4069         PR gold/12893
4070         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4071         symbol is redefined with the exact same object and value.
4072
4073 2011-06-17  Ian Lance Taylor  <iant@google.com>
4074
4075         PR gold/12880
4076         * layout.h (class Layout): Add interp_segment_ field.
4077         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4078         (Layout::attach_allocated_section_to_segment): If making shared
4079         library, put .interp section in PT_INTERP segment.
4080         (Layout::finalize): Also call create_interp if -dynamic-linker
4081         option was used.
4082         (Layout::create_interp): Assert that there is no PT_INTERP
4083         segment.  If not using a SECTIONS clause, use make_output_section.
4084         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4085         * script-sections.cc
4086         (Script_sections::create_note_and_tls_segments): If making shared
4087         library, put .interp section in PT_INTERP segment.
4088
4089 2011-06-17  Ian Lance Taylor  <iant@google.com>
4090
4091         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4092         when making a shared library.
4093
4094 2011-06-17  Ian Lance Taylor  <iant@google.com>
4095
4096         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4097         parameter.  Change all callers.  Don't issue warning about PC32
4098         against locally defined symbol.
4099
4100 2011-06-16  Ian Lance Taylor  <iant@google.com>
4101
4102         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4103         occurs in same object.
4104
4105 2011-06-14  Alan Modra  <amodra@gmail.com>
4106
4107         * po/POTFILES.in: Regenerate.
4108
4109 2011-06-09  Ian Lance Taylor  <iant@google.com>
4110
4111         * script-sections.cc
4112         (Orphan_output_section::set_section_addresses): For a relocatable
4113         link set address to 0.
4114
4115 2011-06-09  Cary Coutant  <ccoutant@google.com>
4116
4117         PR gold/12804
4118         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4119         used with --compress-debug-sections.
4120         * gold/object.cc (Sized_relobj_file::do_layout): Report
4121         uncompressed size of compressed input sections.
4122
4123 2011-06-08  Cary Coutant  <ccoutant@google.com>
4124
4125         PR gold/12804
4126         * testsuite/two_file_test_2_v1.cc: Change initialization of
4127         v2 to keep it in .data.
4128
4129 2011-06-07  Cary Coutant  <ccoutant@google.com>
4130
4131         * common.cc (Symbol_table::do_allocate_commons_list): Call
4132         gold_fallback.
4133         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4134         (Errors::fallback): New function.
4135         (gold_fallback): New function.
4136         * errors.h (Errors::fallback): New function.
4137         * gold.cc (gold_exit): Change status parameter to enum; adjust
4138         all callers.
4139         (queue_initial_tasks): Call gold_fallback.
4140         * gold.h: Include cstdlib.
4141         (Exit_status): New enum type.
4142         (gold_exit): Change status parameter to enum.
4143         (gold_fallback): New function.
4144         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4145         (Layout::create_symtab_sections): Likewise.
4146         (Layout::create_shdrs): Likewise.
4147         * main.cc (main): Adjust call to gold_exit.
4148         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4149         (Output_data_got::add_got_entry_pair): Likewise.
4150         (Output_section::add_input_section): Likewise.
4151         (Output_section::add_output_section_data): Likewise.
4152         (Output_segment::set_section_list_addresses): Likewise.
4153         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4154
4155 2011-06-07  Cary Coutant  <ccoutant@google.com>
4156
4157         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4158         for incremental links.
4159         * output.cc (Output_segment::set_section_list_addresses): Remove
4160         FIXME and test for TLS or BSS.
4161
4162 2011-06-07  Cary Coutant  <ccoutant@google.com>
4163
4164         * testsuite/Makefile.am: Add incremental_copy_test,
4165         incremental_common_test_1.
4166         * testsuite/Makefile.in: Regenerate.
4167         * testsuite/common_test_1_v1.c: New source file.
4168         * testsuite/common_test_1_v2.c: New source file.
4169         * testsuite/copy_test_v1.cc: New source file.
4170
4171 2011-06-07  Cary Coutant  <ccoutant@google.com>
4172
4173         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4174         update, allocate common from bss section's free list.
4175         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4176         linker-defined symbols.
4177         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4178         Skip GOT and PLT entries that are no longer referenced.
4179         (Output_section_incremental_inputs::write_info_blocks): Mark
4180         linker-defined symbols.
4181         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4182         * output.cc (Output_section::allocate): New function.
4183         * output.h (Output_section::allocate): New function.
4184         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4185         linker-defined symbols.
4186         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4187         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4188         (Symbol::init_base_output_data): Likewise.
4189         (Symbol::init_base_output_segment): Likewise.
4190         (Symbol::init_base_constant): Likewise.
4191         (Sized_symbol::init_output_data): Likewise.
4192         (Sized_symbol::init_output_segment): Likewise.
4193         (Sized_symbol::init_constant): Likewise.
4194         (Symbol_table::do_define_in_output_data): Likewise.
4195         (Symbol_table::do_define_in_output_segment): Likewise.
4196         (Symbol_table::do_define_as_constant): Likewise.
4197         * symtab.h (Symbol::is_predefined): New function.
4198         (Symbol::init_base_output_data): Add is_predefined parameter.
4199         (Symbol::init_base_output_segment): Likewise.
4200         (Symbol::init_base_constant): Likewise.
4201         (Symbol::is_predefined_): New data member.
4202         (Sized_symbol::init_output_data): Add is_predefined parameter.
4203         (Sized_symbol::init_output_segment): Likewise.
4204         (Sized_symbol::init_constant): Likewise.
4205         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4206
4207 2011-06-07  Cary Coutant  <ccoutant@google.com>
4208
4209         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4210         instead of emit_copy_reloc.
4211         (Copy_relocs::emit_copy_reloc): Refactor.
4212         (Copy_relocs::make_copy_reloc): New function.
4213         (Copy_relocs::add_copy_reloc): Remove.
4214         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4215         section.
4216         (Copy_relocs::make_copy_reloc): New function.
4217         (Copy_relocs::add_copy_reloc): Remove.
4218         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4219         unchanged input files.
4220         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4221         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4222         Reserve BSS space for COPY relocations.
4223         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4224         (Output_section_incremental_inputs::write_info_blocks): Record
4225         whether a symbol is copied from a shared object.
4226         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4227         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4228         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4229         (Incremental_input_entry_reader::get_output_symbol_index): Add
4230         is_copy parameter.
4231         (Incremental_binary::emit_copy_relocs): New function.
4232         (Incremental_binary::do_emit_copy_relocs): New function.
4233         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4234         new data member.
4235         (Sized_incremental_binary::add_copy_reloc): New function.
4236         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4237         (Sized_incremental_binary::Copy_reloc): New struct.
4238         (Sized_incremental_binary::Copy_relocs): New typedef.
4239         (Sized_incremental_binary::copy_relocs_): New data member.
4240         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4241         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4242         * target.h (Sized_target::emit_copy_reloc): New function.
4243         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4244
4245 2011-06-02  Cary Coutant  <ccoutant@google.com>
4246
4247         PR gold/12163
4248         * gold/archive.cc (Archive::Archive): Initialize new data member.
4249         (Archive::include_all_members): Return if archive has already been
4250         included.
4251         * gold/archive.h (Archive::include_all_members_): New data member.
4252
4253 2011-06-02  Nick Clifton  <nickc@redhat.com>
4254
4255         * dynobj.h: Fix spelling mistake in comment.
4256         * output.cc: Likewise.
4257
4258 2011-05-31  Doug Kwan  <dougkwan@google.com>
4259             Asier Llano
4260
4261         PR gold/12826
4262         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4263         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4264         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4265         redundant arm_exidx_test.so.
4266         * testsuite/Makefile.in: Regenerate.
4267         (check_SCRIPTS): Add pr12826.sh
4268         (check_DATA): Add pr12826.stdout
4269         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4270         * testsuite/pr12826.sh: New file.
4271         * testsuite/pr12826_1.s: Ditto.
4272         * testsuite/pr12826_1.s: Ditto.
4273
4274 2011-05-30  Ian Lance Taylor  <iant@google.com>
4275
4276         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4277         sections.
4278
4279 2011-05-29  Ian Lance Taylor  <iant@google.com>
4280
4281         PR gold/12804
4282         * testsuite/Makefile.am: Use different file name for two_file_test
4283         temporary file for each incremental test.
4284         * testsuite/Makefile.in: Rebuild.
4285
4286 2011-05-29  Ian Lance Taylor  <iant@google.com>
4287
4288         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4289         binary input file is empty.
4290
4291 2011-05-27  Ian Lance Taylor  <iant@google.com>
4292
4293         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4294         (ver_test_9.so): Likewise.
4295         * testsuite/Makefile.in: Rebuild.
4296
4297 2011-05-26 Cary Coutant  <ccoutant@google.com>
4298
4299         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4300         * incremental.cc (Incremental_inputs::report_input_section): Fix
4301         comment, indentation.
4302         (Incremental_inputs::report_comdat_group): New function.
4303         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4304         of data for incremental input file entry.
4305         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4306         group count, COMDAT group signatures.
4307         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4308         an unchanged input file.
4309         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4310         Initialize new data member.
4311         (Incremental_object_entry::add_comdat_group): New function.
4312         (Incremental_object_entry::get_comdat_group_count): New function.
4313         (Incremental_object_entry::get_comdat_signature_key): New function.
4314         (Incremental_object_entry::groups_): New data member.
4315         (Incremental_inputs::report_comdat_group): New function.
4316         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4317         data for incremental input file entry.
4318         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4319         (Incremental_input_entry_reader::get_input_section): Adjust size of
4320         data for incremental input file entry.
4321         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4322         (Incremental_input_entry_reader::get_comdat_group_signature): New
4323         function.
4324         * object.cc (Sized_relobj::include_section_group): Report kept
4325         COMDAT groups for incremental links.
4326
4327 2011-05-24  David Meyer  <pdox@google.com>
4328
4329         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4330         with name parameter.  Add found_name parameter.
4331         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4332         * dirsearch.h (class Dirsearch): Update declaration.
4333
4334 2011-05-24  Ian Lance Taylor  <iant@google.com>
4335
4336         * archive.cc (Library_base::should_include_member): Pull in object
4337         from archive if it defines the entry symbol.
4338         * parameters.cc (Parameters::entry): New function.
4339         * parameters.h (class Parameters): Declare entry.
4340         * output.h (class Output_file_header): Remove entry_ field.
4341         * output.cc (Output_file_header::Output_file_header): Remove entry
4342         parameter.  Change all callers.
4343         (Output_file_header::entry): Use parameters->entry.
4344         * gold.cc (queue_middle_tasks): Likewise.
4345         * plugin.cc (Plugin_hook::run): Likewise.
4346
4347 2011-05-24 Cary Coutant  <ccoutant@google.com>
4348
4349         * gold.cc (queue_initial_tasks): Pass incremental base filename
4350         to Output_file::open_base_file; don't print error message.
4351         * incremental-dump.cc (main): Adjust call to
4352         Output_file::open_for_modification.
4353         * incremental-dump.cc (main): Likewise.
4354         * incremental.cc (Incremental_inputs::report_command_line):
4355         Ignore --incremental-base option when comparing command lines.
4356         Ignore parameter when given as separate argument.
4357         * options.h (class General_options): Add --incremental-base.
4358         * output.cc (Output_file::Output_file):
4359         (Output_file::open_base_file): Add base_name and writable parameters;
4360         read base file into new file; print error message here.
4361         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4362         callers.
4363         * output.h (Output_file::open_for_modification): Rename to...
4364         (Output_file::open_base_file): ...this; add base_name and
4365         writable parameters; adjust all callers.
4366         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4367         callers.
4368         * testsuite/Makefile.am (incremental_test_4): Test
4369         --incremental-base.
4370         * testsuite/Makefile.in: Regenerate.
4371
4372 2011-05-24 Cary Coutant  <ccoutant@google.com>
4373
4374         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4375         incremental_test_4.
4376         * testsuite/Makefile.in: Regenerate.
4377         * testsuite/two_file_test_1_v1.cc: New test source file.
4378         * testsuite/two_file_test_1b_v1.cc: New test source file.
4379         * testsuite/two_file_test_2_v1.cc: New test source file.
4380
4381 2011-05-24 Cary Coutant  <ccoutant@google.com>
4382
4383         * dynobj.h (Dynobj::do_dynobj): New function.
4384         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4385         flag and soname for shared objects.
4386         * incremental.cc (Incremental_inputs::report_object): Make
4387         either Incremental_object_entry or Incremental_dynobj_entry; add
4388         soname to string table.
4389         (Incremental_inputs::report_input_section): Add assertion.
4390         (Output_section_incremental_inputs::set_final_data_size): Adjust
4391         type of input file entry for shared libraries; adjust size of
4392         shared library info entry.
4393         (Output_section_incremental_inputs::write_input_files): Write
4394         as_needed flag for shared libraries.
4395         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4396         of input file entry for shared libraries; write soname.
4397         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4398         soname from incremental info.
4399         * incremental.h (enum Incremental_input_flags): Add
4400         INCREMENTAL_INPUT_AS_NEEDED.
4401         (Incremental_input_entry::Incremental_input_entry): Initialize new
4402         data member.
4403         (Incremental_input_entry::set_as_needed): New function.
4404         (Incremental_input_entry::as_needed): New function.
4405         (Incremental_input_entry::do_dynobj_entry): New function.
4406         (Incremental_input_entry::as_needed_): New data member.
4407         (Incremental_object_entry::Incremental_object_entry): Don't check
4408         for shared library.
4409         (Incremental_object_entry::do_type): Likewise.
4410         (class Incremental_dynobj_entry): New class.
4411         (Incremental_input_entry_reader::as_needed): New function.
4412         (Incremental_input_entry_reader::get_soname): New function.
4413         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4414         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4415         size of shared library info entry.
4416         * layout.cc (Layout::finish_dynamic_section): Don't test for
4417         incremental link when adding DT_NEEDED entries.
4418         * object.h (Object::Object): Initialize new data member.
4419         (Object::dynobj): New function.
4420         (Object::set_as_needed): New function.
4421         (Object::as_needed): New function.
4422         (Object::do_dynobj): New function.
4423         (Object::as_needed_): New data member.
4424
4425 2011-05-24 Cary Coutant  <ccoutant@google.com>
4426
4427         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4428         info; adjust display of GOT entries.
4429         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4430         vector of input objects; remove file_status_.
4431         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4432         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4433         got_plt reader; call target hooks to reserve GOT entries.
4434         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4435         of input file info header and GOT info entry.
4436         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4437         relocation info.
4438         (Got_plt_view_info::got_descriptor): Remove.
4439         (Got_plt_view_info::sym_index): New data member.
4440         (Got_plt_view_info::input_index): New data member.
4441         (Local_got_offset_visitor::visit): Write input file index.
4442         (Global_got_offset_visitor::visit): Write 0 for input file index.
4443         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4444         with sym_index and input_index.
4445         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4446         incremental info GOT entry; replace got_descriptor with input_index.
4447         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4448         map from input file index to object.
4449         (Sized_relobj_incr::do_layout): Replace direct data member reference
4450         with accessor function.
4451         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4452         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4453         Adjust size of input file info header.
4454         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4455         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4456         (Incremental_input_entry_reader::get_input_section): Adjust size of
4457         input file info header.
4458         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4459         of incremental info GOT entry.
4460         (Incremental_got_plt_reader::get_got_desc): Remove.
4461         (Incremental_got_plt_reader::get_got_symndx): New function.
4462         (Incremental_got_plt_reader::get_got_input_index): New function.
4463         (Sized_incremental_binary::Sized_incremental_binary): Remove
4464         file_status_; add input_objects_.
4465         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4466         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4467         (Sized_incremental_binary::file_is_unchanged): Remove.
4468         (Sized_incremental_binary::set_input_object): New function.
4469         (Sized_incremental_binary::input_object): New function.
4470         (Sized_incremental_binary::file_status_): Remove.
4471         (Sized_incremental_binary::input_objects_): New data member.
4472         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4473         references.
4474         (Sized_relobj_incr::invalid_address): Move to base class.
4475         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4476         class.
4477         (Sized_relobj_incr::do_output_section_offset): Likewise.
4478         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4479         (Sized_relobj_incr::section_offsets_): Likewise.
4480         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4481         function.
4482         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4483         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4484         with accessor function.
4485         (Sized_relobj_file::do_layout): Likewise.
4486         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4487         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4488         (Sized_relobj_file::compute_final_local_value): Replace refs to
4489         section_offsets_ with accessor function.
4490         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4491         * object.h (Relobj::Relobj): Initialize new data members.
4492         (Relobj::add_dyn_reloc): New function.
4493         (Relobj::first_dyn_reloc): New function.
4494         (Relobj::dyn_reloc_count): New function.
4495         (Relobj::first_dyn_reloc_): New data member.
4496         (Relobj::dyn_reloc_count_): New data member.
4497         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4498         references.
4499         (Sized_relobj::Address): New typedef.
4500         (Sized_relobj::invalid_address): Move here from child class.
4501         (Sized_relobj::Sized_relobj): Initialize new data members.
4502         (Sized_relobj::sized_relobj): New function.
4503         (Sized_relobj::is_output_section_offset_invalid): Move here from
4504         child class.
4505         (Sized_relobj::get_output_section_offset): Likewise.
4506         (Sized_relobj::local_has_got_offset): Likewise.
4507         (Sized_relobj::local_got_offset): Likewise.
4508         (Sized_relobj::set_local_got_offset): Likewise.
4509         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4510         (Sized_relobj::clear_got_offsets): New function.
4511         (Sized_relobj::section_offsets): Move here from child class.
4512         (Sized_relobj::do_output_section_offset): Likewise.
4513         (Sized_relobj::do_set_section_offset): Likewise.
4514         (Sized_relobj::Local_got_offsets): Likewise.
4515         (Sized_relobj::local_got_offsets_): Likewise.
4516         (Sized_relobj::section_offsets_): Likewise.
4517         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4518         references.
4519         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4520         class.
4521         (Sized_relobj_file::sized_relobj): New function
4522         (Sized_relobj_file::local_has_got_offset): Move to base class.
4523         (Sized_relobj_file::local_got_offset): Likewise.
4524         (Sized_relobj_file::set_local_got_offset): Likewise.
4525         (Sized_relobj_file::get_output_section_offset): Likewise.
4526         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4527         (Sized_relobj_file::do_output_section_offset): Likewise.
4528         (Sized_relobj_file::do_set_section_offset): Likewise.
4529         (Sized_relobj_file::Local_got_offsets): Likewise.
4530         (Sized_relobj_file::local_got_offsets_): Likewise.
4531         (Sized_relobj_file::section_offsets_): Likewise.
4532         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4533         (all constructors).
4534         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4535         (Output_reloc::get_symbol_index): Likewise.
4536         (Output_reloc::local_section_offset): Likewise.
4537         (Output_reloc::get_address): Likewise.
4538         (Output_reloc::symbol_value): Likewise.
4539         (Output_data_got::reserve_slot): Move to class definition.
4540         (Output_data_got::reserve_local): New function.
4541         (Output_data_got::reserve_slot_for_global): Remove.
4542         (Output_data_got::reserve_global): New function.
4543         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4544         (all constructors, two instantiations).
4545         (Output_reloc::get_relobj): New function (two instantiations).
4546         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4547         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4548         (Output_data_reloc::add_global): Adjust type of relobj.
4549         (Output_data_reloc::add_global_relative): Likewise.
4550         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4551         (Output_data_reloc::add_local): Likewise.
4552         (Output_data_reloc::add_local_relative): Likewise.
4553         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4554         (Output_data_reloc::add_local_section): Likewise.
4555         (Output_data_reloc::add_output_section): Likewise.
4556         (Output_data_reloc::add_absolute): Likewise.
4557         (Output_data_reloc::add_target_specific): Likewise.
4558         (Output_data_got::reserve_slot): Move definition here.
4559         (Output_data_got::reserve_local): New function.
4560         (Output_data_got::reserve_global): New function.
4561         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4562         section_offsets_ with accessor function.
4563         (Sized_relobj_file::write_sections): Likewise.
4564         (Sized_relobj_file::do_relocate_sections): Likewise.
4565         * target.h (Sized_target::reserve_local_got_entry): New function.
4566         (Sized_target::reserve_global_got_entry): New function.
4567         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4568         (Target_x86_64::reserve_global_got_entry): New function.
4569         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4570
4571 2011-05-23 Cary Coutant  <ccoutant@google.com>
4572
4573         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4574         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4575         bit when checking got_type.
4576         * incremental.cc (Sized_incremental_binary::setup_readers):
4577         Store symbol table and string table locations; initialize bit vector
4578         of file status flags.
4579         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4580         unchanged files.
4581         (Sized_incremental_binary::do_process_got_plt): New function.
4582         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4583         (Output_section_incremental_inputs::set_final_data_size): Record
4584         file index for each input file.
4585         (Output_section_incremental_inputs::write_got_plt): Store file index
4586         instead of input entry offset for each GOT entry.
4587         * incremental.h
4588         (Incremental_input_entry::Incremental_input_entry): Initialize new
4589         data member.
4590         (Incremental_input_entry::set_offset): Store file index.
4591         (Incremental_input_entry::get_file_index): New function.
4592         (Incremental_input_entry::file_index_): New data member.
4593         (Incremental_binary::process_got_plt): New function.
4594         (Incremental_binary::do_process_got_plt): New function.
4595         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4596         data members.
4597         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4598         (Sized_incremental_binary::set_file_is_unchanged): New function.
4599         (Sized_incremental_binary::file_is_unchanged): New function.
4600         (Sized_incremental_binary::do_process_got_plt): New function.
4601         (Sized_incremental_binary::file_status_): New data member.
4602         (Sized_incremental_binary::main_symtab_loc_): New data member.
4603         (Sized_incremental_binary::main_strtab_loc_): New data member.
4604         * output.cc (Output_data_got::Got_entry::write): Add case
4605         RESERVED_CODE.
4606         (Output_data_got::add_global): Call add_got_entry.
4607         (Output_data_got::add_global_plt): Likewise.
4608         (Output_data_got::add_global_with_rel): Likewise.
4609         (Output_data_got::add_global_with_rela): Likewise.
4610         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4611         (Output_data_got::add_global_pair_with_rela): Likewise.
4612         (Output_data_got::add_local): Call add_got_entry.
4613         (Output_data_got::add_local_plt): Likewise.
4614         (Output_data_got::add_local_with_rel): Likewise.
4615         (Output_data_got::add_local_with_rela): Likewise.
4616         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4617         (Output_data_got::add_local_pair_with_rela): Likewise.
4618         (Output_data_got::reserve_slot): New function.
4619         (Output_data_got::reserve_slot_for_global): New function.
4620         (Output_data_got::add_got_entry): New function.
4621         (Output_data_got::add_got_entry_pair): New function.
4622         (Output_section::add_output_section_data): Edit FIXME.
4623         * output.h
4624         (Output_section_data_build::Output_section_data_build): New
4625         constructor with size parameter.
4626         (Output_data_space::Output_data_space): Likewise.
4627         (Output_data_got::Output_data_got): Initialize new data member; new
4628         constructor with size parameter.
4629         (Output_data_got::add_constant): Call add_got_entry.
4630         (Output_data_got::reserve_slot): New function.
4631         (Output_data_got::reserve_slot_for_global): New function.
4632         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4633         (Output_data_got::add_got_entry): New function.
4634         (Output_data_got::add_got_entry_pair): New function.
4635         (Output_data_got::free_list_): New data member.
4636         * target.h (Sized_target::init_got_plt_for_update): New function.
4637         (Sized_target::register_global_plt_entry): New function.
4638         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4639         Initialize new data member; call init; add constructor with PLT count.
4640         (Output_data_plt_x86_64::init): New function.
4641         (Output_data_plt_x86_64::add_relocation): New function.
4642         (Output_data_plt_x86_64::reserve_slot): New function.
4643         (Output_data_plt_x86_64::free_list_): New data member.
4644         (Target_x86_64::init_got_plt_for_update): New function.
4645         (Target_x86_64::register_global_plt_entry): New function.
4646         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4647         incremental updates.
4648         (Output_data_plt_x86_64::add_relocation): New function.
4649         * testsuite/object_unittest.cc (Object_test): Set default options.
4650
4651 2011-05-16  Ian Lance Taylor  <iant@google.com>
4652
4653         * options.h (class General_options): Make -i a synonym for -r.
4654
4655 2011-05-16  Ian Lance Taylor  <iant@google.com>
4656
4657         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4658
4659 2011-05-10 Cary Coutant  <ccoutant@google.com>
4660
4661         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4662         strip_all (-s).
4663
4664 2011-05-06  Ian Lance Taylor  <iant@google.com>
4665
4666         * layout.cc (Layout::layout): If the output section flags change,
4667         update the ordering.
4668
4669 2011-04-25 Cary Coutant  <ccoutant@google.com>
4670
4671         * incremental-dump.cc (dump_incremental_inputs): Print local
4672         symbol info for each input file.
4673         * incremental.cc
4674         (Output_section_incremental_inputs::set_final_data_size): Add local
4675         symbol info to input file entries in incremental info.
4676         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4677         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4678         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4679         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4680         implementation.
4681         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4682         (Sized_incr_relobj::do_relocate): Write the local symbols.
4683         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4684         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4685         Adjust size of input file header.
4686         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4687         (Incremental_inputs_reader::get_local_symbol_count): New function.
4688         (Incremental_inputs_reader::get_input_section): Adjust size of input
4689         file header.
4690         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4691         (Sized_incr_relobj::This): New typedef.
4692         (Sized_incr_relobj::sym_size): New const data member.
4693         (Sized_incr_relobj::Local_symbol): New struct.
4694         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4695         (Sized_incr_relobj::do_local_symbol_offset): New function.
4696         (Sized_incr_relobj::local_symbol_count_): New data member.
4697         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4698         (Sized_incr_relobj::local_symbol_index_): New data member.
4699         (Sized_incr_relobj::local_symbol_offset_): New data member.
4700         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4701         (Sized_incr_relobj::local_symbols_): New data member.
4702         * object.h (Relobj::output_local_symbol_count): New function.
4703         (Relobj::local_symbol_offset): New function.
4704         (Relobj::do_output_local_symbol_count): New function.
4705         (Relobj::do_local_symbol_offset): New function.
4706         (Sized_relobj::do_output_local_symbol_count): New function.
4707         (Sized_relobj::do_local_symbol_offset): New function.
4708
4709 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4710
4711         * descriptors.cc (set_close_on_exec): New function.
4712         (Descriptors::open): Use set_close_on_exec.
4713         * output.cc (S_ISLNK): Define if not defined.
4714
4715 2011-04-22 Cary Coutant  <ccoutant@google.com>
4716
4717         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4718         global symbol map.
4719         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4720         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4721         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4722         relocations.
4723         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4724         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4725         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4726         * incremental.h
4727         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4728         function.
4729         (Incremental_binary::apply_incremental_relocs): New function.
4730         (Incremental_binary::do_apply_incremental_relocs): New function.
4731         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4732         data member.
4733         (Sized_incremental_binary::add_global_symbol): New function.
4734         (Sized_incremental_binary::global_symbol): New function.
4735         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4736         (Sized_incremental_binary::symbol_map_): New data member.
4737         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4738         * target.h (Sized_target::apply_relocation): New function.
4739         * target-reloc.h (apply_relocation): New function.
4740         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4741
4742 2011-04-22  Doug Kwan  <dougkwan@google.com>
4743
4744         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4745         flag of a SHT_ARM_EXIDX section.
4746         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4747         * testsuite/Makefile.in: Regenerate.
4748         * testsuite/arm_exidx_test.s: New file.
4749         * testsuite/arm_exidx_test.sh: Same.
4750
4751 2011-04-20 Cary Coutant  <ccoutant@google.com>
4752
4753         PR gold/12689
4754         * archive.h (Incremental_archive_entry::Archive_member):
4755         Initialize arg_serial_ (second constructor).
4756
4757 2011-04-17  Ian Lance Taylor  <iant@google.com>
4758
4759         * object.cc (Relocate_info::location): Simplify location string.
4760         * errors.cc (Errors::error_at_location): Don't print program
4761         name.
4762         (Errors::warning_at_location): Likewise.
4763         (Errors::undefined_symbol): Likewise.
4764         * testsuite/debug_msg.sh: Update accordingly.
4765
4766 2011-04-14 Cary Coutant  <ccoutant@google.com>
4767
4768         * gold/layout.cc (Layout::symtab_section_offset): New function.
4769         * gold/layout.h (Layout::symtab_section_offset): New function.
4770         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4771
4772 2011-04-12  Ian Lance Taylor  <iant@google.com>
4773
4774         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4775         with MREMAP_MAYMOVE.
4776         * output.h (class Output_file): Add map_is_allocated_ field.
4777         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4778         not available, provide stubs.  If mremap is not available, #define
4779         it to gold_mremap.
4780         (MREMAP_MAYMOVE): Define if not defined.
4781         (Output_file::Output_file): Initialize map_is_allocated_.
4782         (Output_file::resize): Check map_is_allocated_.
4783         (Output_file::map_anonymous): If mmap fails, use malloc.
4784         (Output_file::unmap): Don't do anything for an anonymous map.
4785         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4786         is not available, provide stubs.
4787         (File_read::View::~View): Use free rather than delete[].
4788         (File_read::make_view): Use malloc rather than new[].  If mmap
4789         fails, use malloc.
4790         (File_read::find_or_make_view): Use malloc rather than new[].
4791         * gold.h: Remove HAVE_REMAP code.
4792         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4793         exists.  Rename mremap to gold_mremap.  If mmap is not available
4794         don't do anything.
4795         * configure, config.in: Rebuild.
4796
4797 2011-04-11  Ian Lance Taylor  <iant@google.com>
4798
4799         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4800         initialize local variable v.
4801
4802 2011-04-11  Cary Coutant  <ccoutant@google.com>
4803
4804         * archive.cc (Archive::include_member): Adjust call to
4805         report_object.
4806         (Add_archive_symbols::run): Track argument serial numbers.
4807         (Lib_group::include_member): Likewise.
4808         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4809         * archive.h (Incremental_archive_entry::Archive_member):
4810         Initialize arg_serial_.
4811         (Archive_member::arg_serial_): New data member.
4812         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4813         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4814         incremental link.
4815         (Sized_dynobj::do_for_all_local_got_entries): New function.
4816         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4817         function.
4818         * fileread.cc (get_mtime): New function.
4819         * fileread.h (get_mtime): New function.
4820         * gold.cc (queue_initial_tasks): Check for incremental update.
4821         (process_incremental_input): New function.
4822         (queue_middle_tasks): Don't force valid target for incremental
4823         update.
4824         * incremental-dump.cc (find_input_containing_global): Adjust
4825         size of symbol info entry.
4826         (dump_incremental_inputs): Dump argument serial number and
4827         in_system_directory flag; bias shndx by 1; print symbol names
4828         when dumping per-file symbol lists; use new symbol info readers.
4829         * incremental.cc
4830         (Output_section_incremental_inputs:update_data_size): New function.
4831         (Sized_incremental_binary::setup_readers): Setup input readers
4832         for each input file; build maps for files added from libraries
4833         and scripts.
4834         (Sized_incremental_binary::check_input_args): New function.
4835         (Sized_incremental_binary::do_check_inputs): Build map of argument
4836         serial numbers to input arguments.
4837         (Sized_incremental_binary::do_file_has_changed): Rename
4838         do_file_is_unchanged to this; compare file modification times.
4839         (Sized_incremental_binary::do_init_layout): New function.
4840         (Sized_incremental_binary::do_reserve_layout): New function.
4841         (Sized_incremental_binary::do_get_input_reader): Remove.
4842         (Sized_incremental_binary::get_symtab_view): New function.
4843         (Incremental_checker::can_incrementally_link_output_file): Remove.
4844         (Incremental_inputs::report_command_line): Exclude --debug options.
4845         (Incremental_inputs::report_archive_begin): Add parameter; track
4846         argument serial numbers; don't put input file entry for archive
4847         before archive members.
4848         (Incremental_inputs::report_archive_end): Put input file entry
4849         for archive after archive members.
4850         (Incremental_inputs::report_object): Add parameter; track argument
4851         serial numbers and in_system_directory flag.
4852         (Incremental_inputs::report_script): Add parameter; track argument
4853         serial numbers.
4854         (Output_section_incremental_inputs::set_final_data_size): Adjust
4855         size of symbol info entry; check for forwarding symbols.
4856         (Output_section_incremental_inputs::write_input_files): Write
4857         in_system_directory flag and argument serial number.
4858         (Output_section_incremental_inputs::write_info_blocks): Map section
4859         indices between incremental info and original input file; store
4860         input section index for each symbol.
4861         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4862         change operator() to visit().
4863         (class Global_got_offset_visitor): Likewise.
4864         (class Global_symbol_visitor_got_plt):
4865         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4866         classes.
4867         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4868         (Sized_incr_relobj::do_read_symbols): New function.
4869         (Sized_incr_relobj::do_layout): New function.
4870         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4871         (Sized_incr_relobj::do_add_symbols): New function.
4872         (Sized_incr_relobj::do_should_include_member): New function.
4873         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4874         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4875         (Sized_incr_relobj::do_section_size): New function.
4876         (Sized_incr_relobj::do_section_name): New function.
4877         (Sized_incr_relobj::do_section_contents): New function.
4878         (Sized_incr_relobj::do_section_flags): New function.
4879         (Sized_incr_relobj::do_section_entsize): New function.
4880         (Sized_incr_relobj::do_section_address): New function.
4881         (Sized_incr_relobj::do_section_type): New function.
4882         (Sized_incr_relobj::do_section_link): New function.
4883         (Sized_incr_relobj::do_section_info): New function.
4884         (Sized_incr_relobj::do_section_addralign): New function.
4885         (Sized_incr_relobj::do_initialize_xindex): New function.
4886         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4887         (Sized_incr_relobj::do_read_relocs): New function.
4888         (Sized_incr_relobj::do_gc_process_relocs): New function.
4889         (Sized_incr_relobj::do_scan_relocs): New function.
4890         (Sized_incr_relobj::do_count_local_symbols): New function.
4891         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4892         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4893         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4894         (Sized_incr_relobj::do_relocate): New function.
4895         (Sized_incr_relobj::do_set_section_offset): New function.
4896         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4897         (Sized_incr_dynobj::do_read_symbols): New function.
4898         (Sized_incr_dynobj::do_layout): New function.
4899         (Sized_incr_dynobj::do_add_symbols): New function.
4900         (Sized_incr_dynobj::do_should_include_member): New function.
4901         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4902         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4903         (Sized_incr_dynobj::do_section_size): New function.
4904         (Sized_incr_dynobj::do_section_name): New function.
4905         (Sized_incr_dynobj::do_section_contents): New function.
4906         (Sized_incr_dynobj::do_section_flags): New function.
4907         (Sized_incr_dynobj::do_section_entsize): New function.
4908         (Sized_incr_dynobj::do_section_address): New function.
4909         (Sized_incr_dynobj::do_section_type): New function.
4910         (Sized_incr_dynobj::do_section_link): New function.
4911         (Sized_incr_dynobj::do_section_info): New function.
4912         (Sized_incr_dynobj::do_section_addralign): New function.
4913         (Sized_incr_dynobj::do_initialize_xindex): New function.
4914         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4915         (make_sized_incremental_object): New function.
4916         (Incremental_library::copy_unused_symbols): New function.
4917         (Incremental_library::do_for_all_unused_symbols): New function.
4918         * incremental.h (enum Incremental_input_flags): New type.
4919         (class Incremental_checker): Remove.
4920         (Incremental_input_entry::Incremental_input_entry): Add argument
4921         serial number.
4922         (Incremental_input_entry::arg_serial): New function.
4923         (Incremental_input_entry::set_is_in_system_directory): New function.
4924         (Incremental_input_entry::is_in_system_directory): New function.
4925         (Incremental_input_entry::arg_serial_): New data member.
4926         (Incremental_input_entry::is_in_system_directory_): New data member.
4927         (class Script_info): Move here from script.h.
4928         (Script_info::Script_info): Add filename parameter.
4929         (Script_info::filename): New function.
4930         (Script_info::filename_): New data member.
4931         (Incremental_script_entry::Incremental_script_entry): Add argument
4932         serial number.
4933         (Incremental_object_entry::Incremental_object_entry): Likewise.
4934         (Incremental_object_entry::add_input_section): Build list of input
4935         sections with map to original shndx.
4936         (Incremental_object_entry::get_input_section_index): New function.
4937         (Incremental_object_entry::shndx_): New data member.
4938         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4939         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4940         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4941         serial number.
4942         (Incremental_inputs::report_archive_begin): Likewise.
4943         (Incremental_inputs::report_object): Likewise.
4944         (Incremental_inputs::report_script): Likewise.
4945         (class Incremental_global_symbol_reader): New class.
4946         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4947         and store flags and input file type.
4948         (Incremental_input_entry_reader::arg_serial): New function.
4949         (Incremental_input_entry_reader::type): Extract type from flags.
4950         (Incremental_input_entry_reader::is_in_system_directory): New function.
4951         (Incremental_input_entry_reader::get_input_section_count): Call
4952         accessor function for type.
4953         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4954         function for type; adjust size of global symbol entry.
4955         (Incremental_input_entry_reader::get_global_symbol_count): Call
4956         accessor function for type.
4957         (Incremental_input_entry_reader::get_object_count): Likewise.
4958         (Incremental_input_entry_reader::get_object_offset): Likewise.
4959         (Incremental_input_entry_reader::get_member_count): Likewise.
4960         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4961         (Incremental_input_entry_reader::get_member_offset): Likewise.
4962         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4963         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4964         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4965         (Incremental_input_entry_reader::get_global_symbol_reader): New
4966         function.
4967         (Incremental_input_entry_reader::get_output_symbol_index): New
4968         function.
4969         (Incremental_input_entry_reader::type_): Remove.
4970         (Incremental_input_entry_reader::flags_): New data member.
4971         (Incremental_inputs_reader::input_file_offset): New function.
4972         (Incremental_inputs_reader::input_file_index): New function.
4973         (Incremental_inputs_reader::input_file): Call input_file_offset.
4974         (Incremental_inputs_reader::input_file_at_offset): New function.
4975         (Incremental_relocs_reader::get_r_type): Reformat.
4976         (Incremental_relocs_reader::get_r_shndx): Reformat.
4977         (Incremental_relocs_reader::get_r_offset): Reformat.
4978         (Incremental_relocs_reader::data): New function.
4979         (Incremental_binary::Incremental_binary): Initialize new data members.
4980         (Incremental_binary::check_inputs): Add cmdline parameter.
4981         (Incremental_binary::file_is_unchanged): Remove.
4982         (Input_reader::arg_serial): New function.
4983         (Input_reader::get_unused_symbol_count): New function.
4984         (Input_reader::get_unused_symbol): New function.
4985         (Input_reader::do_arg_serial): New function.
4986         (Input_reader::do_get_unused_symbol_count): New function.
4987         (Input_reader::do_get_unused_symbol): New function.
4988         (Incremental_binary::input_file_count): New function.
4989         (Incremental_binary::get_input_reader): Change signature to use
4990         index instead of filename.
4991         (Incremental_binary::file_has_changed): New function.
4992         (Incremental_binary::get_input_argument): New function.
4993         (Incremental_binary::get_library): New function.
4994         (Incremental_binary::get_script_info): New function.
4995         (Incremental_binary::init_layout): New function.
4996         (Incremental_binary::reserve_layout): New function.
4997         (Incremental_binary::output_file): New function.
4998         (Incremental_binary::do_check_inputs): New function.
4999         (Incremental_binary::do_file_is_unchanged): Remove.
5000         (Incremental_binary::do_file_has_changed): New function.
5001         (Incremental_binary::do_init_layout): New function.
5002         (Incremental_binary::do_reserve_layout): New function.
5003         (Incremental_binary::do_input_file_count): New function.
5004         (Incremental_binary::do_get_input_reader): Change signature.
5005         (Incremental_binary::input_args_map_): New data member.
5006         (Incremental_binary::library_map_): New data member.
5007         (Incremental_binary::script_map_): New data member.
5008         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5009         new data members.
5010         (Sized_incremental_binary::output_section): New function.
5011         (Sized_incremental_binary::inputs_reader): Add const.
5012         (Sized_incremental_binary::symtab_reader): Add const.
5013         (Sized_incremental_binary::relocs_reader): Add const.
5014         (Sized_incremental_binary::got_plt_reader): Add const.
5015         (Sized_incremental_binary::get_symtab_view): New function.
5016         (Sized_incremental_binary::Inputs_reader): New typedef.
5017         (Sized_incremental_binary::Input_entry_reader): New typedef.
5018         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5019         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5020         (Sized_incremental_binary::do_file_has_changed): New function.
5021         (Sized_incremental_binary::do_init_layout): New function.
5022         (Sized_incremental_binary::do_reserve_layout): New function.
5023         (Sized_input_reader::Inputs_reader): Remove.
5024         (Sized_input_reader::Input_entry_reader): Remove.
5025         (Sized_input_reader::do_arg_serial): New function.
5026         (Sized_input_reader::do_get_unused_symbol_count): New function.
5027         (Sized_input_reader::do_get_unused_symbol): New function.
5028         (Sized_incremental_binary::do_input_file_count): New function.
5029         (Sized_incremental_binary::do_get_input_reader): Change signature;
5030         use index instead of filename.
5031         (Sized_incremental_binary::section_map_): New data member.
5032         (Sized_incremental_binary::input_entry_readers_): New data member.
5033         (class Sized_incr_relobj): New class.
5034         (class Sized_incr_dynobj): New class.
5035         (make_sized_incremental_object): New function.
5036         (class Incremental_library): New class.
5037         * layout.cc (Free_list::num_lists): New static data member.
5038         (Free_list::num_nodes): New static data member.
5039         (Free_list::num_removes): New static data member.
5040         (Free_list::num_remove_visits): New static data member.
5041         (Free_list::num_allocates): New static data member.
5042         (Free_list::num_allocate_visits): New static data member.
5043         (Free_list::init): New function.
5044         (Free_list::remove): New function.
5045         (Free_list::allocate): New function.
5046         (Free_list::dump): New function.
5047         (Free_list::print_stats): New function.
5048         (Layout_task_runner::run): Resize output file for incremental updates.
5049         (Layout::Layout): Initialize new data members.
5050         (Layout::set_incremental_base): New function.
5051         (Layout::init_fixed_output_section): New function.
5052         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5053         incremental updates.
5054         (Layout::create_gold_note): Do not create gold note section for
5055         incremental updates.
5056         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5057         for incremental updates.
5058         (Layout::set_section_offsets): For incremental updates, allocate space
5059         from free list.
5060         (Layout::create_symtab_sections): Layout with offsets relative to
5061         start of section; for incremental updates, allocate space from free
5062         list.
5063         (Layout::create_shdrs): For incremental updates, allocate space from
5064         free list.
5065         (Layout::finish_dynamic_section): For incremental updates, do not
5066         check --as-needed (fixed in subsequent patch).
5067         * layout.h (class Free_list): New class.
5068         (Layout::set_incremental_base): New function.
5069         (Layout::incremental_base): New function.
5070         (Layout::init_fixed_output_section): New function.
5071         (Layout::allocate): New function.
5072         (Layout::incremental_base_): New data member.
5073         (Layout::free_list_): New data member.
5074         * main.cc (main): Print Free_list statistics.
5075         * object.cc (Relobj::finalize_incremental_relocs): Add
5076         clear_counts parameter; clear counts only when clear_counts is set.
5077         (Sized_relobj::Sized_relobj): Initialize new base class.
5078         (Sized_relobj::do_layout): Don't report special sections.
5079         (Sized_relobj::do_for_all_local_got_entries): New function.
5080         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5081         symtab_off to all symbol table offsets.
5082         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5083         * object.h (class Got_offset_list): Move to top of file.
5084         (Object::Object): Allow case where input_file == NULL.
5085         (Object::~Object): Likewise.
5086         (Object::input_file): Assert that input_file != NULL.
5087         (Object::lock): Allow case where input_file == NULL.
5088         (Object::unlock): Likewise.
5089         (Object::is_locked): Likewise.
5090         (Object::token): Likewise.
5091         (Object::release): Likewise.
5092         (Object::is_incremental): New function.
5093         (Object::get_mtime): New function.
5094         (Object::for_all_local_got_entries): New function.
5095         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5096         (Object::set_is_in_system_directory): New function.
5097         (Object::is_in_system_directory): New function.
5098         (Object::do_is_incremental): New function.
5099         (Object::do_get_mtime): New function.
5100         (Object::do_for_all_local_got_entries): New function.
5101         (Object::is_in_system_directory_): New data member.
5102         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5103         (class Sized_relobj_base): New class.
5104         (class Sized_relobj): Derive from Sized_relobj_base.
5105         (class Sized_relobj::Symbols): Redeclare from base class.
5106         (class Sized_relobj::local_got_offset_list): Remove.
5107         (class Sized_relobj::Output_sections): Redeclare from base class.
5108         (class Sized_relobj::do_for_all_local_got_entries): New function.
5109         (class Sized_relobj::write_local_symbols): Add offset parameter.
5110         (class Sized_relobj::local_symbol_offset_): Update comment.
5111         (class Sized_relobj::local_dynsym_offset_): Update comment.
5112         * options.cc (Input_arguments::add_file): Remove const.
5113         * options.h (Input_file_argument::Input_file_argument):
5114         Initialize arg_serial_ (all constructors).
5115         (Input_file_argument::set_arg_serial): New function.
5116         (Input_file_argument::arg_serial): New function.
5117         (Input_file_argument::arg_serial_): New data member.
5118         (Input_arguments::Input_arguments): Initialize file_count_.
5119         (Input_arguments::add_file): Remove const.
5120         (Input_arguments::number_of_input_files): New function.
5121         (Input_arguments::file_count_): New data member.
5122         (Command_line::number_of_input_files): Call
5123         Input_arguments::number_of_input_files.
5124         * output.cc (Output_segment_headers::Output_segment_headers):
5125         Set current size.
5126         (Output_section::Input_section::current_data_size): New function.
5127         (Output_section::Output_section): Initialize new data members.
5128         (Output_section::add_input_section): Don't do merge sections for
5129         an incremental link; allocate space from free list for an
5130         incremental update.
5131         (Output_section::add_output_section_data): Allocate space from
5132         free list for an incremental update.
5133         (Output_section::update_data_size): New function.
5134         (Output_section::set_fixed_layout): New function.
5135         (Output_section::reserve): New function.
5136         (Output_segment::set_section_addresses): Remove const.
5137         (Output_segment::set_section_list_addresses): Remove const; allocate
5138         space from free list for an incremental update.
5139         (Output_segment::set_offset): Adjust size of RELRO segment for an
5140         incremental update.
5141         * output.h (Output_data::current_data_size): Move here from
5142         child classes.
5143         (Output_data::pre_finalize_data_size): New function.
5144         (Output_data::update_data_size): New function.
5145         (Output_section_headers::update_data_size): new function.
5146         (Output_section_data_build::current_data_size): Move to Output_data.
5147         (Output_data_strtab::update_data_size): New function.
5148         (Output_section::current_data_size): Move to Output_data.
5149         (Output_section::set_fixed_layout): New function.
5150         (Output_section::has_fixed_layout): New function.
5151         (Output_section::reserve): New function.
5152         (Output_section::update_data_size): New function.
5153         (Output_section::has_fixed_layout_): New data member.
5154         (Output_section::free_list_): New data member.
5155         (Output_segment::set_section_addresses): Remove const.
5156         (Output_segment::set_section_list_addresses): Remove const.
5157         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5158         New function.
5159         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5160         New function.
5161         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5162         parameter when calling Add_symbols constructor; store argument
5163         serial number for members of a lib group.
5164         (Add_symbols::locks): Allow case where token == NULL.
5165         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5166         (Read_member::~Read_member): New function.
5167         (Read_member::is_runnable): New function.
5168         (Read_member::locks): New function.
5169         (Read_member::run): New function.
5170         (Check_script::~Check_script): New function.
5171         (Check_script::is_runnable): New function.
5172         (Check_script::locks): New function.
5173         (Check_script::run): New function.
5174         (Check_library::~Check_library): New function.
5175         (Check_library::is_runnable): New function.
5176         (Check_library::locks): New function.
5177         (Check_library::run): New function.
5178         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5179         (Add_symbols::library_): New data member.
5180         (class Read_member): New class.
5181         (class Check_script): New class.
5182         (class Check_library): New class.
5183         * reloc.cc (Read_relocs::is_runnable): Allow case where
5184         token == NULL.
5185         (Read_relocs::locks): Likewise.
5186         (Scan_relocs::locks): Likewise.
5187         (Relocate_task::locks): Likewise.
5188         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5189         to clear counters.
5190         (Sized_relobj::incremental_relocs_scan): Fix comment.
5191         (Sized_relobj::do_relocate): Pass output file offset to
5192         write_local_symbols.
5193         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5194         from class declaration.
5195         * script.cc (read_input_script): Allocate Script_info; pass
5196         argument serial number to report_script.
5197         * script.h (class Script_info): Move to incremental.h.
5198         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5199         * symtab.h (Symbol_table::add_from_incrobj): New function.
5200         (Symbol_table::set_file_offset): New function.
5201
5202 2011-04-05  Cary Coutant  <ccoutant@google.com>
5203
5204         * incremental-dump.cc (dump_incremental_inputs): Change signature
5205         to take a Sized_incremental_binary; change caller.  Use readers
5206         in Sized_incremental_binary.
5207         * incremental.cc
5208         (Sized_incremental_binary::find_incremental_inputs_sections):
5209         Rename do_find_incremental_inputs_sections to this.
5210         (Sized_incremental_binary::setup_readers): New function.
5211         (Sized_incremental_binary::do_check_inputs): Check
5212         has_incremental_info_ flag; move setup code to setup_readers;
5213         use input readers.
5214         (Sized_incremental_binary::do_file_is_unchanged): New function.
5215         (Sized_incremental_binary::do_get_input_reader): New function.
5216         * incremental.h (class Incremental_binary): Move to end of file.
5217         (Incremental_binary::file_is_unchanged): New function.
5218         (Incremental_binary::do_file_is_unchanged): New function.
5219         (Incremental_binary::Input_reader): New class.
5220         (Incremental_binary::get_input_reader): New function.
5221         (class Sized_incremental_binary): Move to end of file.
5222         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5223         input section reader classes.
5224         (Sized_incremental_binary::has_incremental_info): New function.
5225         (Sized_incremental_binary::inputs_reader): New function.
5226         (Sized_incremental_binary::symtab_reader): New function.
5227         (Sized_incremental_binary::relocs_reader): New function.
5228         (Sized_incremental_binary::got_plt_reader): New function.
5229         (Sized_incremental_binary::do_file_is_unchanged): New function.
5230         (Sized_incremental_binary::Sized_input_reader): New class.
5231         (Sized_incremental_binary::get_input_reader): New function.
5232         (Sized_incremental_binary::find_incremental_inputs_sections):
5233         Rename do_find_incremental_inputs_sections to this.
5234         (Sized_incremental_binary::setup_readers): New function.
5235         (Sized_incremental_binary::has_incremental_info_): New data member.
5236         (Sized_incremental_binary::inputs_reader_): New data member.
5237         (Sized_incremental_binary::symtab_reader_): New data member.
5238         (Sized_incremental_binary::relocs_reader_): New data member.
5239         (Sized_incremental_binary::got_plt_reader_): New data member.
5240         (Sized_incremental_binary::current_input_file_): New data member.
5241
5242 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5243
5244         PR gold/12640
5245         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5246         violation.
5247
5248 2011-03-30  Cary Coutant  <ccoutant@google.com>
5249
5250         * archive.cc (Archive::include_member): Adjust call to report_object.
5251         (Add_archive_symbols::run): Add script_info to call to
5252         report_archive_begin.
5253         (Lib_group::include_member): Adjust call to report_object.
5254         (Add_lib_group_symbols::run): Adjust call to report_object.
5255         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5256         blocks.  Add object count for script input files.
5257         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5258         script_info parameter; change all callers.
5259         (Incremental_inputs::report_object): Add script_info parameter;
5260         change all callers.
5261         (Incremental_inputs::report_script): Store backpointer to
5262         incremental info entry.
5263         (Output_section_incremental_inputs::set_final_data_size): Record
5264         additional information for scripts.
5265         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5266         * incremental.h (Incremental_script_entry::add_object): New function.
5267         (Incremental_script_entry::get_object_count): New function.
5268         (Incremental_script_entry::get_object): New function.
5269         (Incremental_script_entry::objects_): New data member; adjust
5270         constructor.
5271         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5272         (Incremental_inputs::report_object): Add script_info parameter.
5273         (Incremental_inputs_reader::get_object_count): New function.
5274         (Incremental_inputs_reader::get_object_offset): New function.
5275         * options.cc (Input_arguments::add_file): Return reference to
5276         new input argument.
5277         * options.h (Input_argument::set_script_info): New function.
5278         (Input_argument::script_info): New function.
5279         (Input_argument::script_info_): New data member; adjust all
5280         constructors.
5281         (Input_file_group::add_file): Return reference to new input argument.
5282         (Input_file_lib::add_file): Likewise.
5283         (Input_arguments::add_file): Likewise.
5284         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5285         * script.cc (Parser_closure::Parser_closure): Add script_info
5286         parameter; adjust all callers.
5287         (Parser_closure::script_info): New function.
5288         (Parser_closure::script_info_): New data member.
5289         (read_input_script): Report scripts earlier to incremental info.
5290         (script_add_file): Set script_info in Input_argument.
5291         (script_add_library): Likewise.
5292         * script.h (Script_options::Script_info): Rewrite class.
5293
5294 2011-03-29  Cary Coutant  <ccoutant@google.com>
5295
5296         * archive.cc (Library_base::should_include_member): Move
5297         method here from class Archive.
5298         (Archive::Archive): Initialize base class.
5299         (Archive::should_include_member): Move to base class.
5300         (Archive::do_for_all_unused_symbols): New function.
5301         (Add_archive_symbols::run): Remove redundant access to
5302         incremental_inputs.
5303         (Lib_group::Lib_group): Initialize base class.
5304         (Lib_group::do_filename): New function.
5305         (Lib_group::include_member): Pass pointer to Lib_group to
5306         report_object.
5307         (Lib_group::do_for_all_unused_symbols): New function.
5308         (Add_lib_group_symbols::run): Report archive information for
5309         incremental links.
5310         * archive.h (class Library_base): New base class.
5311         (class Archive): Derive from Library_base.
5312         (Archive::filename): Move to base class.
5313         (Archive::set_incremental_info): Likewise.
5314         (Archive::incremental_info): Likewise.
5315         (Archive::Should_include): Likewise.
5316         (Archive::should_include_member): Likewise.
5317         (Archive::Armap_entry): Remove.
5318         (Archive::Unused_symbol_iterator): Remove.
5319         (Archive::unused_symbols_begin): Remove.
5320         (Archive::unused_symbols_end): Remove.
5321         (Archive::do_filename): New function.
5322         (Archive::do_get_mtime): New function.
5323         (Archive::do_for_all_unused_symbols): New function.
5324         (Archive::task_): Move to base class.
5325         (Archive::incremental_info_): Likewise.
5326         (class Lib_group): Derive from Library_base.
5327         (Lib_group::do_filename): New function.
5328         (Lib_group::do_get_mtime): New function.
5329         (Lib_group::do_for_all_unused_symbols): New function.
5330         (Lib_group::task_): Move to base class.
5331         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5332         function.
5333         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5334         function.
5335         * incremental.cc (Incremental_inputs::report_archive_begin):
5336         Use Library_base; call library's get_mtime; add incremental inputs
5337         entry before members.
5338         (class Unused_symbol_visitor): New class.
5339         (Incremental_inputs::report_archive_end): Use Library_base; use
5340         visitor class to record unused symbols; don't add incremental inputs
5341         entry after members.
5342         (Incremental_inputs::report_object): Use Library_base.
5343         * incremental.h
5344         (Incremental_archive_entry::Incremental_archive_entry): Remove
5345         unused Archive parameter.
5346         (Incremental_inputs::report_archive_begin): Use Library_base.
5347         (Incremental_inputs::report_archive_end): Likewise.
5348         (Incremental_inputs::report_object): Likewise.
5349         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5350         function.
5351         * object.h (Object::for_all_global_symbols): New function.
5352         (Object::do_for_all_global_symbols): New function.
5353         (Sized_relobj::do_for_all_global_symbols): New function.
5354         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5355         function.
5356         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5357         function.
5358
5359 2011-03-27  Ian Lance Taylor  <iant@google.com>
5360
5361         * archive.cc (Archive::interpret_header): Return -1 if something
5362         goes wrong.  Change callers accordingly.
5363
5364 2011-03-25  Cary Coutant  <ccoutant@google.com>
5365
5366         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5367         * testsuite/Makefile.in: Regenerate.
5368
5369 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5370
5371         * plugin.cc (get_view): New.
5372         (Plugin::load): Pass get_view to the plugin.
5373         (Plugin_manager::get_view): New.
5374
5375 2011-03-21  Ian Lance Taylor  <iant@google.com>
5376
5377         * testsuite/final_layout.sh: Rewrite to not use dc.
5378         * testsuite/relro_test.sh: Fail if dc is not present.
5379
5380 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5381
5382         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5383         Change == to -eq.
5384         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5385         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5386         Change == to -eq.
5387         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5388         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5389
5390 2011-03-14  Ian Lance Taylor  <iant@google.com>
5391
5392         * script-sections.cc (Sort_output_sections::script_compare):
5393         Rename from is_before, change return type.
5394         (Sort_output_sections::operator()): Adjust accordingly.
5395
5396 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5397
5398         PR gold/12572
5399         * testsuite/odr_violation2.cc: Add comment to make all error line
5400         numbers double digits.
5401         * testsuite/debug_msg.sh: Adjust expected errors.
5402
5403 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5404
5405         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5406         but mark earlier ones as non-canonical
5407         (offset_to_iterator): Update search target and example
5408         (do_addr2line): Return extra lines in a vector*
5409         (format_file_lineno): Extract from do_addr2line
5410         (one_addr2line): Add vector* out-param
5411         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5412         when a lineno entry appeared last for its instruction
5413         (Dwarf_line_info): Add vector* out-param
5414         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5415         * symtab.cc (Odr_violation_compare): Include the lineno in the
5416         comparison again.
5417         (linenos_from_loc): New. Combine the canonical line for an
5418         address with its other lines.
5419         (True_if_intersect): New. Helper functor to make
5420         std::set_intersection a query.
5421         (detect_odr_violations): Compare sets of lines instead of just
5422         one line for each function. This became less deterministic, but
5423         has fewer false positives.
5424         * symtab.h: Declarations.
5425         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5426         mix an optimized and non-optimized object in the same binary
5427         (odr_violation2.so): Same.
5428         * testsuite/Makefile.in: Regenerate from Makefile.am.
5429         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5430         * testsuite/debug_msg.sh: Update line numbers and add
5431         assertions.
5432         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5433         non-optimized context.
5434         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5435         isn't inlined, and use OdrDerived in an optimized context.
5436         * testsuite/odr_header1.h: Defines OdrDerived, where
5437         optimization will change the
5438         first-instruction-in-the-destructor's file and line number.
5439         * testsuite/odr_header2.h: Defines OdrBase.
5440
5441 2011-03-09  Ian Lance Taylor  <iant@google.com>
5442
5443         * fileread.cc (File_read::clear_views): Don't delete the whole
5444         file view.
5445
5446 2011-03-08  Ian Lance Taylor  <iant@google.com>
5447
5448         PR gold/12525
5449         * fileread.cc: #include <climits>.
5450         (GOLD_IOV_MAX): Define.
5451         (File_read::read_multiple): Limit number of entries by iov_max.
5452         * fileread.h (class File_read): Always set max_readv_entries to
5453         128.
5454
5455 2011-03-07  Ian Lance Taylor  <iant@google.com>
5456
5457         PR gold/12525
5458         * options.h (class General_options): Add -dy and -dn.
5459
5460 2011-03-02  Cary Coutant  <ccoutant@google.com>
5461
5462         * testsuite/script_test_9.t: Add TLS segment.
5463
5464 2011-03-02  Simon Baldwin  <simonb@google.com>
5465
5466         * configure.ac: Add check for gnu_indirect_function support in
5467         the toolchain building binutils.
5468         * configure: Rebuild.
5469
5470 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5471
5472         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5473         plugin only symbols.
5474         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5475         in plugin files as not needed in the symbol table.
5476
5477 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5478
5479         * output.cc (Output_section::add_input_section): Delay fill
5480         generation for section ordering.
5481
5482 2011-02-09  Ian Lance Taylor  <iant@google.com>
5483
5484         PR gold/12316
5485         * object.h (class Sized_relobj): Remove clear_local_symbols.
5486         * reloc.cc (Sized_relobj::do_relocate): Don't call
5487         clear_local_symbols.
5488
5489 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5490
5491         * plugin.cc (is_visible_from_outside): Return true for symbols
5492         in the -u option.
5493
5494 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5495
5496         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5497         filename.
5498
5499 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5500
5501         * icf.h (is_section_foldable_candidate): Change type of parameter
5502         to std::string.
5503         * icf.cc (Icf::find_identical_sections): Change type of local variable
5504         section_name to be std::string.
5505         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5506
5507 2011-01-25  Ian Lance Taylor  <iant@google.com>
5508
5509         * script.cc (script_add_extern): Rewrite to use
5510         add_symbol_reference.
5511
5512 2011-01-25  Doug Kwan  <dougkwan@google.com>
5513
5514         * icf.cc (get_section_contents): Always lock section's object.
5515
5516 2011-01-24  Ian Lance Taylor  <iant@google.com>
5517
5518         * options.h (class General_options): Accept
5519         --no-detect-odr-violations.
5520
5521 2011-01-24  Ian Lance Taylor  <iant@google.com>
5522
5523         * version.cc (version_string): Bump to 1.11.
5524
5525 2011-01-24  Ian Lance Taylor  <iant@google.com>
5526
5527         * plugin.cc (class Plugin_rescan): Define new class.
5528         (Plugin_manager::claim_file): Set any_claimed_.
5529         (Plugin_manager::save_archive): New function.
5530         (Plugin_manager::save_input_group): New function.
5531         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5532         necessary.
5533         (Plugin_manager::new_undefined_symbol): New function.
5534         (Plugin_manager::rescan): New function.
5535         (Plugin_manager::rescannable_defines): New function.
5536         (Plugin_manager::add_input_file): Set any_added_.
5537         * plugin.h (class Plugin_manager): define new fields rescannable_,
5538         undefined_symbols_, any_claimed_, and any_added_.  Declare
5539         Plugin_rescan as friend.  Declare new functions.
5540         (Plugin_manager::Rescannable): Define type.
5541         (Plugin_manager::Rescannable_list): Define type.
5542         (Plugin_manager::Undefined_symbol_list): Define type.
5543         (Plugin_manager::Plugin_manager): Initialize new fields.
5544         * archive.cc (Archive::defines_symbol): New function.
5545         (Add_archive_symbols::run): Pass archive to plugins if any.
5546         * archive.h (class Archive): Declare defines_symbol.
5547         * readsyms.cc (Input_group::~Input_group): New function.
5548         (Finish_group::run): Pass input_group to plugins if any.
5549         * readsyms.h (class Input_group): Declare destructor.
5550         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5551         any.
5552
5553 2011-01-10  Ian Lance Taylor  <iant@google.com>
5554
5555         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5556         section as relro.
5557         (Layout::set_segment_offsets): Reset increase_relro before calling
5558         set_section_addresses a second time.
5559
5560 2011-01-04  Cary Coutant  <ccoutant@google.com>
5561
5562         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5563         sections before NOBITS sections.
5564
5565 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5566
5567         * version.cc (print_version): Update copyright to 2011.
5568
5569 2010-12-23  Cary Coutant  <ccoutant@google.com>
5570
5571         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5572         of OS to this->add.  Add OD parameter to second form of the function.
5573
5574 2010-12-20  Ian Lance Taylor  <iant@google.com>
5575
5576         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5577         second of two consecutive entries with same offset.
5578
5579 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5580
5581         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5582         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5583         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5584         to avoid unneeded links against $(LDADD).
5585         * testsuite/Makefile.in: Regenerate.
5586
5587 2010-12-15  Ian Lance Taylor  <iant@google.com>
5588
5589         PR gold/12324
5590         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5591         for R_X86_64_32 and R_X86_64_PC32.
5592         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5593         ver_matching_def_pic.o.
5594         (ver_matching_def_pic.o): New target.
5595
5596 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5597
5598         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5599         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5600         Move definition before File_read::View member definitions.
5601         (File_read::View::~View): Initialize and hold lock before
5602         updating current_mapped_bytes.
5603
5604 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5605
5606         * dwarf_reader.cc: Remove outdated comment.
5607         * gold-threads.cc: Fix typo in error message.
5608         * archive.cc: Fix typos in comments.
5609         * archive.h: Likewise.
5610         * arm-reloc-property.cc: Likewise.
5611         * arm-reloc-property.h: Likewise.
5612         * arm-reloc.def: Likewise.
5613         * arm.cc: Likewise.
5614         * attributes.h: Likewise.
5615         * cref.cc: Likewise.
5616         * ehframe.cc: Likewise.
5617         * fileread.h: Likewise.
5618         * gold.h: Likewise.
5619         * i386.cc: Likewise.
5620         * icf.cc: Likewise.
5621         * incremental.h: Likewise.
5622         * int_encoding.cc: Likewise.
5623         * layout.h: Likewise.
5624         * main.cc: Likewise.
5625         * merge.h: Likewise.
5626         * object.cc: Likewise.
5627         * object.h: Likewise.
5628         * options.cc: Likewise.
5629         * readsyms.cc: Likewise.
5630         * reduced_debug_output.cc: Likewise.
5631         * reloc.cc: Likewise.
5632         * script-sections.cc: Likewise.
5633         * sparc.cc: Likewise.
5634         * symtab.h: Likewise.
5635         * target-reloc.h: Likewise.
5636         * target.cc: Likewise.
5637         * target.h: Likewise.
5638         * timer.cc: Likewise.
5639         * timer.h: Likewise.
5640         * x86_64.cc: Likewise.
5641
5642 2010-12-09  Cary Coutant  <ccoutant@google.com>
5643
5644         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5645         stack.
5646         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5647         parameter; change all callers.
5648         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5649         * options.h (warn_execstack): New option.
5650
5651 2010-12-07  Doug Kwan  <dougkwan@google.com>
5652
5653         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5654         like function call relocations.
5655
5656 2010-12-07  Ian Lance Taylor  <iant@google.com>
5657
5658         * archive.cc (Archive::get_elf_object_for_member): Permit
5659         punconfigured to be NULL.
5660         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5661         (Archive::include_member): Pass NULL to get_elf_object_for_member
5662         if we searched for the archive and this is the first included
5663         object.
5664
5665 2010-12-01  Ian Lance Taylor  <iant@google.com>
5666
5667         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5668         track_relocs_type_ field.
5669         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5670         Set track_relocs_type_.
5671         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5672         contents when using RELA relocs.
5673         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5674         reloc_map_.
5675         * reloc.cc (Track_relocs::next_addend): New function.
5676         * reloc.h (class Track_relocs): Declare next_addend.
5677
5678 2010-12-01  Ian Lance Taylor  <iant@google.com>
5679
5680         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5681         virtual destructor.
5682
5683 2010-12-01  Ian Lance Taylor  <iant@google.com>
5684
5685         * README: Update compilers known to work and fail.
5686
5687 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5688
5689         * configure.in: For --enable-gold, handle value `default' instead of
5690         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5691         not the default.
5692         * configure: Regenerate.
5693
5694 2010-11-18  Doug Kwan  <dougkwan@google.com>
5695
5696         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5697         and right_alignment to be zero.  Store result alignment only if it is
5698         greater than existing alignment.
5699
5700 2010-11-16  Cary Coutant  <ccoutant@google.com>
5701
5702         PR gold/12220
5703         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5704         Check for ".zdebug_line".
5705
5706 2010-11-16  Doug Kwan  <dougkwan@google.com>
5707             Cary Coutant  <ccoutant@google.com>
5708
5709         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5710         by reference; adjust all callers.
5711         * output.cc (Output_segment::set_section_addresses): Adjust references
5712         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5713         list is empty.
5714         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5715         end at page boundary.
5716
5717 2010-11-16  Cary Coutant  <ccoutant@google.com>
5718
5719         PR gold/12220
5720         * layout.cc (Layout::choose_output_section): Transform names of
5721         compressed sections even when using a script with a SECTIONS clause.
5722         (Layout::output_section_name): Remove code to transform
5723         compressed debug section names.
5724         * output.cc (Output_section::add_input_section): Use uncompressed
5725         section size when tracking input sections.
5726
5727 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5728
5729         * symtab.h (Symbol::NON_PIC_REF): Remove.
5730         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5731         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5732         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5733         (Symbol::use_plt_offset): Take a flags argument and pass it
5734         directly to needs_dynamic_reloc.  Restrict check for undefined
5735         weak symbols to function calls.
5736         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5737         (Target_arm::Scan::global): Use it.
5738         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5739         (Target_arm::Relocate::relocate): Likewise.
5740         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5741         parameter with an r_type parameter.  Use get_reference_flags
5742         to get the flags.
5743         (Target_arm::Relocate::relocate): Update accordingly.
5744         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5745         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5746         (Target_i386::Scan::global): Likewise.
5747         (Target_i386::Relocate::relocate): Likewise.
5748         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5749         parameter with an r_type parameter.  Use get_reference_flags
5750         to get the flags.
5751         (Target_i386::Relocate::relocate): Update accordingly.
5752         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5753         (Target_powerpc::Scan::global): Use it.
5754         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5755         (Target_powerpc::Relocate::relocate): Likewise.
5756         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5757         (Target_sparc::Scan::global): Use it.
5758         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5759         (Target_sparc::Relocate::relocate): Likewise.
5760         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5761         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5762         (Target_x86_64::Scan::global): Likewise.
5763         (Target_x86_64::Relocate::relocate): Likewise.
5764
5765 2010-11-08  Doug Kwan  <dougkwan@google.com>
5766             Cary Coutant  <ccoutant@google.com>
5767
5768         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5769         (Arm_exidx_merge_section::section_contents_): New data member.
5770         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5771         (Arm_input_section::~Arm_input_section): De-allocate memory.
5772         (Arm_input_section::original_contents_): New data member.
5773         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5774         in parameters instead of calling Object::section_contents without
5775         locking.
5776         (Arm_output_section::group_section): New parameter TASK.  Pass it
5777         to callees that need locking objects.
5778         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5779         to lock EXIDX input sections.  Fix a formatting issue.  Call
5780         Arm_exidx_merged_section::build_contents to create merged section
5781         contents.
5782         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5783         to lock object of stub table owner.
5784         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5785         TEXT_SIZE to initialize data member TEXT_SIZE_.
5786         (Arm_exidx_input_section::addralign): Fix typo in comment.
5787         (Arm_exidx_input_section::text_size): New method.
5788         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5789         that require locking objects.  Lock objects before scanning for stubs
5790         and updating local symbols.
5791         (Arm_input_section<big_endian>::init): Copy contents of original
5792         input section.
5793         (Arm_input_section<big_endian>::do_write): Use saved contents of
5794         original input section instead of calling Object::section_contents
5795         without locking.
5796         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5797         size without calling Object::section_size().
5798         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5799         for size.  Allocate a buffer for merged EXIDX entries.
5800         (Arm_exidx_merged_section::build_contents): New method.
5801         (Arm_exidx_merged_section::do_write): Move merge section contents
5802         building code to Arm_exidx_merged_section::build_contetns.  Write
5803         out contetns in buffer instead of building it on the fly.
5804         (Arm_relobj::make_exidx_input_section): Also pass text section size
5805         to Arm_exidx_input_section constructor.
5806         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5807         (Arm_dynobj::do_read_symbols): Fix memory leak.
5808         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5809         * target.h: (class Task): Add forward declaration.
5810         (Target::relax): Add new parameter TASK and pass it to
5811         Target::do_relax().
5812         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5813
5814 2010-11-05  Cary Coutant  <ccoutant@google.com>
5815
5816         PR gold/10708
5817         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5818         object when reading from the file.
5819         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5820         second layout pass.
5821         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5822         when reading section contents.
5823         (get_section_contents): Likewise.
5824         (icf::find_identical_sections): Likewise.
5825         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5826         object when reading from the file.
5827         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5828         the object when doing deferred section layout.
5829
5830 2010-11-03  Nick Clifton  <nickc@redhat.com>
5831
5832         PR gold/12001
5833         * script.h (class Symbol_assignment: name): New member.  Returns
5834         the name of the symbol.
5835         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5836         Returns true if the given symbol name is on the list of
5837         assignments wating to be processed.
5838         * archive.cc (should_incldue_member): If the symbol is undefined,
5839         check to see if it is on the list of symbols pending assignment.
5840
5841 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5842
5843         * script-sections.cc (Script_sections::find_memory_region): Check
5844         for a NULL output section pointer.
5845
5846 2010-10-29  Doug Kwan  <dougkwan@google.com>
5847
5848         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5849         Output_section::add_relaxed_input_section.
5850         * output.cc (Output_section::add_relaxed_input_section): Add new
5851         arguments LAYOUT and NAME.  Set section order index.
5852         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5853         Copy section order index.
5854         * output.h (Output_section::add_relaxed_input_section): Add new
5855         arguments LAYOUT and NAME.
5856
5857 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5858
5859         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5860         NATIVE_OR_CROSS_LINKER.
5861         * testsuite/Makefile.in: Regenerate.
5862
5863 2010-10-20  Doug Kwan  <dougkwan@google.com>
5864
5865         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5866         without SHF_LINK_ORDER flags.
5867         * layout.cc (Layout::choose_output_section): Do not filter
5868         SHF_LINK_ORDER flag in a relocatable link.
5869
5870 2010-10-17  Cary Coutant  <ccoutant@google.com>
5871
5872         * output.h (Output_segment::set_section_addresses): Change function
5873         signature.  Update all callers.
5874         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5875         sections.
5876         (Output_segment::set_section_addresses): Align after last TLS
5877         section.  Add padding before last relro section instead of after.
5878
5879 2010-10-17  Doug Kwan  <dougkwan@google.com>
5880
5881         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5882         GOT output section to be writable.
5883
5884 2010-10-14  Cary Coutant  <ccoutant@google.com>
5885
5886         * debug.h (DEBUG_INCREMENTAL): New flag.
5887         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5888         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5889         mode.
5890         * incremental.cc (report_command_line): Ignore all forms of
5891         --incremental.
5892         * layout.cc (Layout::Layout): Check parameters for incremental link
5893         mode.
5894         * options.cc (General_options::parse_incremental): New function.
5895         (General_options::parse_no_incremental): New function.
5896         (General_options::parse_incremental_full): New function.
5897         (General_options::parse_incremental_update): New function.
5898         (General_options::incremental_mode_): New data member.
5899         (General_options::finalize): Check incremental_mode_.
5900         * options.h (General_options): Update help text for --incremental.
5901         Add --no-incremental, --incremental-full, --incremental-update.
5902         (General_options::Incremental_mode): New enum type.
5903         (General_options::incremental_mode): New function.
5904         (General_options::incremental_mode_): New data member.
5905         * parameters.cc (Parameters::incremental_mode_): New data member.
5906         (Parameters::set_options): Set incremental_mode_.
5907         (Parameters::set_incremental_full): New function.
5908         (Parameters::incremental): New function.
5909         (Parameters::incremental_update): New function.
5910         (set_parameters_incremental_full): New function.
5911         * parameters.h (Parameters::set_incremental_full): New function.
5912         (Parameters::incremental): New function.
5913         (Parameters::incremental_update): New function.
5914         (Parameters::incremental_mode_): New data member.
5915         (set_parameters_incremental_full): New function.
5916         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5917         incremental link mode.
5918         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5919         (Sized_relobj::do_relocate_sections): Likewise.
5920         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5921         option.
5922         * testsuite/Makefile.in: Regenerate.
5923         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5924
5925 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5926
5927         * script-sections.h (class Script_sections): Make
5928         Sections_elements typedef public.
5929         * script-sections.cc (class Sort_output_sections): Add elements_
5930         field.  Add constructor which sets it; change all callers.
5931         (Sort_output_sections::is_before): New function.
5932         (Sort_output_sections::operator()): Call is_before.
5933         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5934         conditional.
5935         * testsuite/script_test_10.sh: New test. Test script section
5936         order.
5937         * testsuite/script_test_10.t: Likewise.
5938         * testsuite/script_test_10.s: Likewise.
5939         * testsuite/Makefile.am: Wrap the cross linker tests and the
5940         common tests into NATIVE_OR_CROSS_LINKER.
5941         (check_SCRIPTS): Add script_test_10.sh.
5942         (check_DATA): Add script_test_10.stdout.
5943         (script_test_10.o, script_test_10): New targets.
5944         (script_test_10.stdout): New target.
5945         * configure, testsuite/Makefile.in: Regenerate.
5946
5947 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5948
5949         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5950         error for the deprecated relocations.
5951         (Target_arm::Scan::global): Likewise.
5952         (Target_arm::Relocate::relocate): Likewise.
5953
5954 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5955
5956         * fileread.cc (Input_file::find_file): Initialize *found_name
5957         and *namep when using the fallback search for case 4.
5958
5959 2010-10-11  Cary Coutant  <ccoutant@google.com>
5960
5961         * options.h (class General_options): Redefine -z lazy as an alias for
5962         the negation of -z now.
5963
5964 2010-10-11  Ian Lance Taylor  <iant@google.com>
5965
5966         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5967         binding.
5968
5969 2010-10-06  Nick Clifton  <nickc@redhat.com>
5970
5971         * script-sections.cc(class Memory_region): Remove
5972         current_lma_offset_ field.  Rename current_vma_offset_ to
5973         current_offset_.  Add last_section_ field.
5974         (Memory_region::get_current_vma_address): Rename to
5975         get_current_address.
5976         (Memory_region::get_current_lma_address): Delete.
5977         (Memory_region::increment_vma_offset): Rename to
5978         increment_offset.
5979         (Memory_region::increment_lma_offset): Delete.
5980         (Memory_region::attributes_compatible): New method.  Returns
5981         true if the provided section is compatible with the region.
5982         (Memory_region::get_last_section): New method.  Returns the last
5983         section to use the region.
5984         (Memory_region::set_last_section): New method.  Stores the last
5985         section to use the region.
5986         (Script_sections::block_in_region): New method.  Returns true if
5987         a block of memory is contained within a region.
5988         (Script_sections::find_memory_region): New method.  Locates a
5989         memory region to be used to set a VMA or LMA address.
5990         (Output_section_definition::set_section_addresses): Add code to
5991         check for addresses set by memory regions.
5992         (Output_segment::set_section_addresses): Remove memory region
5993         walking code.
5994         (Script_sections::create_segment): Add a warning if a header
5995         segment is created outside of any region.
5996         * script-sections.h (class Script_sections): Add prototypes for
5997         find_memory_region and block_in_region methods.
5998         * testsuite/memory_test.s: Use .long instead of .word.
5999         * testsuite/memory_test.t: Add some more output sections.
6000         * testsuite/memory_test.sh: Update expected output.
6001
6002 2010-10-02  Doug Kwan  <dougkwan@google.com>
6003
6004         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6005         defintion to symtab.h
6006         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6007         declaration to defintion.
6008
6009 2010-10-01  Nick Clifton  <nickc@redhat.com>
6010
6011         * expression.cc (eval): Replace dummy argument with NULL.
6012         (eval_maybe_dot): Check for a NULL result section pointer.
6013         (Symbol_expression::value): Likewise.
6014         (Dot_expression::value): Likewise.
6015         (BINARY_EXPRESSION): Likewise.
6016         (Max_expression::value): Likewise.
6017         (Min_expression::value): Likewise.
6018         (Absolute_expression::value): Likewise.
6019         (Addr_expression::value_from_output_section): Likewise.
6020         (Loaddddr_expression::value_from_output_section): Likewise.
6021         (Segment_start_expression::value): Likewise.
6022         * script-sections.cc
6023         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6024         argument with NULL.
6025         (Sections_elememt_dot_assignment::set_section_addresses):
6026         Likewise.
6027         (Output_data_expression::do_write_to_buffer): Likewise.
6028         (Output_section_definition::finalize_symbols): Likewise.
6029         (Output_section_definition::set_section_addresses): Likewise.
6030
6031 2010-09-30  Doug Kwan  <dougkwan@google.com>
6032
6033         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6034
6035 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6036
6037         * target.h (Target::can_icf_inline_merge_sections): New virtual
6038         function.
6039         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6040         virtual function.
6041         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6042         virtual function.
6043         * icf.cc (get_section_contents): Inline merge sections only when
6044         target allows it.
6045
6046 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6047
6048         * configure: Regenerate.
6049
6050 2010-09-17  Ian Lance Taylor  <iant@google.com>
6051
6052         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6053         * testsuite/Makefile.am (memory_test.o): New target.
6054         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6055         memory_test.t.
6056         * testsuite/Makefile.in: Rebuild.
6057
6058 2010-09-17  Doug Kwan  <dougkwan@google.com>
6059
6060         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6061         defintion if relocation uses GOT entries of the symbol.
6062         * testsuite/icf_safe_test.sh: Fix test.
6063         * testsuite/icf_safe_so_test.sh: Fix test.
6064
6065 2010-09-16  Cary Coutant  <ccoutant@google.com>
6066
6067         * script_sections.cc (class Memory_region): Remove "NULL" from
6068         vector initializations.
6069
6070 2010-09-15  Cary Coutant  <ccoutant@google.com>
6071
6072         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6073         Resolve forwarding symbols.
6074
6075 2010-09-15  Doug Kwan  <dougkwan@google.com>
6076
6077         * gold/testsuite/script_test_3.t: Add ARM special sections.
6078         * gold/testsuite/script_test_4.t: Same.
6079         * gold/testsuite/script_test_5.t: Same.
6080         * gold/testsuite/script_test_6.t: Same.
6081         * gold/testsuite/script_test_7.t: Same.
6082         * gold/testsuite/script_test_7.t: Same.
6083         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6084
6085 2010-09-14  Cary Coutant  <ccoutant@google.com>
6086
6087         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6088         (Target_x86_64::Relocate::relocate_tls): Replace check for
6089         saw_tls_block_reloc_ with test for executable section.
6090
6091 2010-09-12  Cary Coutant  <ccoutant@google.com>
6092
6093         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6094         position-independent executables to shared libraries need dynamic
6095         relocations.
6096         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6097         position-independent executables.
6098         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6099         * testsuite/Makefile.in: Regenerate.
6100
6101 2010-09-10  Nick Clifton  <nickc@redhat.com>
6102
6103         PR gold/11997
6104         * testsuite/memory_test.t: Discard any sections that are not
6105         needed.
6106
6107 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6108
6109         PR gold/11996
6110         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6111         "This::" to work around a bug in gcc 4.2.
6112
6113         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6114
6115 2010-09-09  Rafael Espindola  <espindola@google.com>
6116
6117         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6118         sections with different PF_X flags in the same segment.
6119         (Layout::find_first_load_seg): Search all segments to find the first
6120         one.
6121         * options.h (rosegment): New.
6122
6123 2010-09-08  Rafael Espindola  <espindola@google.com>
6124
6125         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6126
6127 2010-09-08  Doug Kwan  <dougkwan@google.com>
6128
6129         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6130         (Arm_relobj::do_relocate_sections): Add new parameter for output
6131         file to match the parent.
6132         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6133         of local symbols instead of input values.  Update code to track
6134         changes in gold::relocate_section.
6135         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6136         (Sized_relobj::compute_final_local_value_internal): New methods.
6137         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6138         body into private version of Sized_relobj::compute_final_local_value.
6139         Call the inline method.
6140         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6141         merged symbol value if there is one.
6142         (Symbol_value::has_output_value): New method defintiion.
6143         (Sized_relobj::Compute_final_local_value_status): New enum type.
6144         (Sized_relobj::compute_final_local_value): New methods.
6145         (Sized_relobj::compute_final_local_value_internal): New methods.
6146         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6147         and arm_cortex_a8.sh.
6148         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6149         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6150         New tests.
6151         * Makefile.in: Regenerate.
6152         * testsuite/arm_bl_out_of_range.s: Update test.
6153         * testsuite/thumb_bl_out_of_range.s: Ditto.
6154         * testsuite/thumb_blx_out_of_range.s: Ditto.
6155         * testsuite/arm_branch_out_of_range.sh: New file.
6156         * testsuite/arm_cortex_a8.sh: Ditto.
6157         * testsuite/arm_cortex_a8_b.s: Ditto.
6158         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6159         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6160         * testsuite/arm_cortex_a8_bl.s: Ditto.
6161         * testsuite/arm_cortex_a8_blx.s: Ditto.
6162         * testsuite/arm_cortex_a8_local.s: Ditto.
6163         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6164         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6165
6166 2010-09-08  Rafael Espindola  <espindola@google.com>
6167
6168         * Makefile.am (memory_test.stdout): Run readelf with -W.
6169         * Makefile.in: Regenerate.
6170         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6171         64 bit output.
6172
6173 2010-09-08  Rafael Espindola  <espindola@google.com>
6174
6175         * script-sections.cc (Script_sections::add_memory_region): Convert
6176         field precision to int.
6177         * script.cc (script_set_section_region, script_set_section_region):
6178         Convert field precision to int.
6179
6180 2010-09-08  Rafael Espindola  <espindola@google.com>
6181
6182         * arm.cc (do_finalize_sections): Create the __exidx_start and
6183         __exdix_end symbols even when the section is missing.
6184
6185 2010-09-08  Nick Clifton  <nickc@redhat.com>
6186
6187         * README: Remove claim that MEMORY is not supported.
6188         * expression.cc (script_exp_function_origin)
6189         (script_exp_function_length): Move from here to ...
6190         * script.cc: ... here.
6191         (script_set_section_region, script_add_memory)
6192         (script_parse_memory_attr, script_include_directive): New
6193         functions.
6194         * script-sections.cc
6195         (class Memory_region): New class.
6196         (class Output_section_definition): Add set_memory_region,
6197         set_section_vma, set_section_lma and get_section_name methods.
6198         (class Script_Sections): Add add_memory_region,
6199         find_memory_region, find_memory_region_origin,
6200         find_memory_region_length and set_memory_region methods.
6201         Have set_section_addresses method walk the list of set memory
6202         regions.
6203         Extend the print methos to display memory regions.
6204         * script-sections.h: Add prototypes for new methods.
6205         Add enum for MEMORY region attributes.
6206         * yyscript.y: Add support for parsing MEMORY regions.
6207         * script-c.h: Add prototypes for new functions.
6208         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6209         * testsuite/Makefile.in: Regenerate.
6210         * testsuite/memory_test.sh: New script.
6211         * testsuite/memory_test.s: New assembler source file.
6212         * testsuite/memory_test.t: New linker script.
6213
6214 2010-08-27  Doug Kwan  <dougkwan@google.com>
6215
6216         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6217         reference override an existing dynamic weak reference.
6218         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6219         * testsuite/Makefile.in: Regenerate.
6220         * testsuite/dyn_weak_ref.sh: New file.
6221         * testsuite/dyn_weak_ref_1.c: Ditto.
6222         * testsuite/dyn_weak_ref_2.c: Ditto.
6223
6224 2010-08-27  Ian Lance Taylor  <iant@google.com>
6225
6226         * incremental.h (class Incremental_input_entry): Add virtual
6227         destructor.
6228
6229 2010-08-27  Ian Lance Taylor  <iant@google.com>
6230
6231         * testsuite/start_lib_test_3.c: Mark t3 as used.
6232
6233 2010-08-27  Nick Clifton  <nickc@redhat.com>
6234
6235         * options.cc (version_script): Fix small typo in previous
6236         whitespace tidyup.
6237
6238 2010-08-25  Nick Clifton  <nickc@redhat.com>
6239
6240         * archive.cc: Formatting fixes: Remove whitespace between
6241         typename and following asterisk.  Remove whitespace between
6242         function name and opening parenthesis.
6243         * archive.h: Likewise.
6244         * arm.cc: Likewise.
6245         * attributes.cc: Likewise.
6246         * attributes.h: Likewise.
6247         * common.cc: Likewise.
6248         * copy-relocs.cc: Likewise.
6249         * dirsearch.h: Likewise.
6250         * dynobj.cc: Likewise.
6251         * ehframe.cc: Likewise.
6252         * ehframe.h: Likewise.
6253         * expression.cc: Likewise.
6254         * fileread.cc: Likewise.
6255         * fileread.h: Likewise.
6256         * gc.h: Likewise.
6257         * gold-threads.cc: Likewise.
6258         * gold.cc: Likewise.
6259         * i386.cc: Likewise.
6260         * icf.h: Likewise.
6261         * incremental-dump.cc: Likewise.
6262         * incremental.cc: Likewise.
6263         * layout.cc: Likewise.
6264         * layout.h: Likewise.
6265         * main.cc: Likewise.
6266         * merge.cc: Likewise.
6267         * merge.h: Likewise.
6268         * object.cc: Likewise.
6269         * object.h: Likewise.
6270         * options.cc: Likewise.
6271         * options.h: Likewise.
6272         * output.cc: Likewise.
6273         * output.h: Likewise.
6274         * plugin.cc: Likewise.
6275         * plugin.h: Likewise.
6276         * powerpc.cc: Likewise.
6277         * reloc.cc: Likewise.
6278         * script-c.h: Likewise.
6279         * script-sections.cc: Likewise.
6280         * script.cc: Likewise.
6281         * stringpool.cc: Likewise.
6282         * symtab.cc: Likewise.
6283         * symtab.h: Likewise.
6284         * target.cc: Likewise.
6285         * timer.cc: Likewise.
6286         * timer.h: Likewise.
6287         * version.cc: Likewise.
6288         * x86_64.cc: Likewise.
6289
6290 2010-08-24  Nick Clifton  <nickc@redhat.com>
6291
6292         PR 11899
6293         * layout.cc (segment_precedes): Sort segments by their physical
6294         addresses, if they have been set.
6295
6296 2010-08-23  Cary Coutant  <ccoutant@google.com>
6297
6298         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6299         symbols data.
6300         (Lib_group::include_member): Unlock object after deleting its
6301         symbols data.
6302         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6303         the bug fixed here.
6304
6305 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6306             Cary Coutant  <ccoutant@google.com>
6307
6308         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6309         constructor, and set_blocker.
6310         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6311         readsyms_blocker_.
6312         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6313         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6314         * testsuite/Makefile.am (start_lib_test): New test case.
6315         * testsuite/Makefile.in: Regenerate.
6316         * testsuite/start_lib_test_main.c: New file.
6317         * testsuite/start_lib_test_1.c: New file.
6318         * testsuite/start_lib_test_2.c: New file.
6319         * testsuite/start_lib_test_3.c: New file.
6320
6321 2010-08-19  Ian Lance Taylor  <iant@google.com>
6322
6323         * Makefile.in: Rebuild with automake 1.11.1.
6324         * aclocal.m4: Likewise.
6325         * testsuite/Makefile.in: Likewise.
6326
6327 2010-08-19  Ian Lance Taylor  <iant@google.com>
6328
6329         PR 10893
6330         * i386.cc (class Output_data_plt_i386): Update declarations.
6331         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6332         local_ifuncs_ fields.
6333         (Target_i386::do_plt_section_for_global): New function.
6334         (Target_i386::do_plt_section_for_local): New function.
6335         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6336         parameter; change all callers.  Initialize global_ifuncs_ and
6337         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6338         __rel_iplt_end.
6339         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6340         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6341         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6342         symbols.
6343         (Target_i386::make_plt_section): New function, broken out of
6344         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6345         (Target_i386::make_plt_entry): Call make_plt_section.
6346         (Target_i386::make_local_ifunc_plt_entry): New function.
6347         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6348         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6349         R_386_IRELATIVE to switch.
6350         (Target_i386::Scan::global): Likewise.
6351         (Target_i386::Relocate::relocate): Likewise.
6352         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6353         switch.
6354         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6355         (Target_x86_64::do_plt_section_for_global): New function.
6356         (Target_x86_64::do_plt_section_for_local): New function.
6357         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6358         parameter; change all callers.  If doing a static link define
6359         __rela_iplt_start and __rela_iplt_end.
6360         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6361         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6362         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6363         to point to .plt.
6364         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6365         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6366         switch.
6367         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6368         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6369         R_X86_64_IRELATIVE to switch.
6370         (Target_x86_64::Scan::global): Likewise.
6371         (Target_x86_64::Relocate::relocate): Likewise.
6372         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6373         switch.
6374         * target.h (class Target): Add plt_section_for_global and
6375         plt_section_for_local functions.  Add do_plt_section_for_global
6376         and do_plt_section_for_local virtual functions.
6377         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6378         clarifying comments.
6379         (Symbol::use_plt_offset): Handle IFUNC symbol.
6380         * object.cc (Sized_relobj::Sized_relobj): Initialize
6381         local_plt_offsets_.
6382         (Sized_relobj::local_has_plt_offset): New function.
6383         (Sized_relobj::local_plt_offset): New function.
6384         (Sized_relobj::set_local_plt_offset): New function.
6385         (Sized_relobj::do_count): Handle IFUNC symbol.
6386         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6387         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6388         is_ifunc_symbol functions.
6389         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6390         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6391         local_plt_offsets_ field.
6392         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6393         * output.h (class Output_section_data): Add non-const
6394         output_section function.
6395         (class Output_data_got): Update declarations.
6396         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6397         Add use_plt_offset parameter to global and local constructors.
6398         Change all callers.  Change local_sym_index_ field to 31 bits.
6399         Change GSYM_CODE and CONSTANT_CODE accordingly.
6400         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6401         doing a static link don't set sh_link field.
6402         (Output_data_got::Got_entry::write): Use PLT offset if
6403         appropriate.
6404         (Output_data_got::add_global_plt): New function.
6405         (Output_data_got::add_local_plt): New function.
6406         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6407         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6408         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6409         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6410         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6411         IFUNC conditional.
6412         * testsuite/ifunc-sel.h: New file.
6413         * testsuite/ifuncmain1.c: New file.
6414         * testsuite/ifuncmain1vis.c: New file.
6415         * testsuite/ifuncmod1.c: New file.
6416         * testsuite/ifuncdep2.c: New file.
6417         * testsuite/ifuncmain2.c: New file.
6418         * testsuite/ifuncmain3.c: New file.
6419         * testsuite/ifuncmod3.c: New file.
6420         * testsuite/ifuncmain4.c: New file.
6421         * testsuite/ifuncmain5.c: New file.
6422         * testsuite/ifuncmod5.c: New file.
6423         * testsuite/ifuncmain6pie.c: New file.
6424         * testsuite/ifuncmod6.c: New file.
6425         * testsuite/ifuncmain7.c: New file.
6426         * configure, testsuite/Makefile.in: Rebuild.
6427
6428 2010-08-18  Ian Lance Taylor  <iant@google.com>
6429
6430         * incremental.cc
6431         (Output_section_incremental_inputs::write_input_files): Add cast
6432         to avoid signed/unsigned comparison warning.
6433         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6434
6435 2010-08-12  Cary Coutant  <ccoutant@google.com>
6436
6437         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6438
6439 2010-08-13  Ian Lance Taylor  <iant@google.com>
6440
6441         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6442
6443 2010-08-12  Cary Coutant  <ccoutant@google.com>
6444             Doug Kwan  <dougkwan@google.com>
6445
6446         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6447         defintion overrides non-weak undef, remember that the original undef
6448         is not weak.
6449         * symtab.cc (Symbol_table::sized_write_global): For undef without
6450         an original weak binding, set binding to global in output.
6451         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6452         * testsuite/Makefile.in: Regenerate.
6453         * testsuite/strong_ref_weak_def.sh: New file.
6454         * testsuite/strong_ref_weak_def_1.c: Ditto.
6455         * testsuite/strong_ref_weak_def_2.c: Ditto.
6456
6457 2010-08-12  Cary Coutant  <ccoutant@google.com>
6458
6459         * testsuite/incremental_test.sh: Rewrite.
6460         * testsuite/incremental_test_1.c: Rewrite.
6461         * testsuite/incremental_test_2.c: Rewrite.
6462
6463 2010-08-12  Cary Coutant  <ccoutant@google.com>
6464
6465         * arm.cc (Target_arm::got_size): Add const.
6466         (Target_arm::got_entry_count): New function.
6467         (Target_arm::plt_entry_count): New function.
6468         (Target_arm::first_plt_entry_offset): New function.
6469         (Target_arm::plt_entry_size): New function.
6470         (Output_data_plt_arm::entry_count): New function.
6471         (Output_data_plt_arm::first_plt_entry_offset): New function.
6472         (Output_data_plt_arm::get_plt_entry_size): New function.
6473         * i386.cc (Target_i386::got_size): Add const.
6474         (Target_i386::got_entry_count): New function.
6475         (Target_i386::plt_entry_count): New function.
6476         (Target_i386::first_plt_entry_offset): New function.
6477         (Target_i386::plt_entry_size): New function.
6478         (Output_data_plt_i386::entry_count): New function.
6479         (Output_data_plt_i386::first_plt_entry_offset): New function.
6480         (Output_data_plt_i386::get_plt_entry_size): New function.
6481         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6482         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6483         * incremental.cc: Include target.h.
6484         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6485         parameter.  Adjust all callers.  Find incremental_got_plt section.
6486         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6487         section.
6488         (Output_section_incremental_inputs::set_final_data_size): Calculate
6489         size of incremental_got_plt section.
6490         (Output_section_incremental_inputs::do_write): Write the
6491         incremental_got_plt section.
6492         (Got_plt_view_info): New struct.
6493         (Local_got_offset_visitor): New class.
6494         (Global_got_offset_visitor): New class.
6495         (Global_symbol_visitor_got_plt): New class.
6496         (Output_section_incremental_inputs::write_got_plt): New function.
6497         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6498         Add parameter.  Adjust all callers.
6499         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6500         (Incremental_inputs::got_plt_section): New function.
6501         (Incremental_inputs::got_plt_section_): New data member.
6502         (Incremental_got_plt_reader): New class.
6503         * layout.cc (Layout::create_incremental_info_sections): Add the
6504         incremental_got_plt section.
6505         * object.h (Got_offset_list::get_list): New function.
6506         (Got offset_list::for_all_got_offsets): New function.
6507         (Sized_relobj::local_got_offset_list): New function.
6508         * powerpc.cc (Target_powerpc::got_size): Add const.
6509         (Target_powerpc::got_entry_count): New function.
6510         (Target_powerpc::plt_entry_count): New function.
6511         (Target_powerpc::first_plt_entry_offset): New function.
6512         (Target_powerpc::plt_entry_size): New function.
6513         (Output_data_plt_powerpc::entry_count): New function.
6514         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6515         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6516         * sparc.cc (Target_sparc::got_size): Add const.
6517         (Target_sparc::got_entry_count): New function.
6518         (Target_sparc::plt_entry_count): New function.
6519         (Target_sparc::first_plt_entry_offset): New function.
6520         (Target_sparc::plt_entry_size): New function.
6521         (Output_data_plt_sparc::entry_count): New function.
6522         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6523         (Output_data_plt_sparc::get_plt_entry_size): New function.
6524         * symtab.h (Symbol::got_offset_list): New function.
6525         (Symbol_table::for_all_symbols): New function.
6526         * target.h (Sized_target::got_entry_count): New function.
6527         (Sized_target::plt_entry_count): New function.
6528         (Sized_target::plt_entry_size): New function.
6529         * x86_64.cc (Target_x86_64::got_size): Add const.
6530         (Target_x86_64::got_entry_count): New function.
6531         (Target_x86_64::plt_entry_count): New function.
6532         (Target_x86_64::first_plt_entry_offset): New function.
6533         (Target_x86_64::plt_entry_size): New function.
6534         (Output_data_plt_x86_64::entry_count): New function.
6535         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6536         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6537
6538 2010-08-12  Cary Coutant  <ccoutant@google.com>
6539
6540         * archive.cc: Include incremental.h.
6541         (Archive::Archive): Initialize incremental_info_.
6542         (Archive::include_member): Record archive members in incremental info.
6543         (Add_archive_symbols::run): Record begin and end of an archive in
6544         incremental info.
6545         (Lib_group::include_member): Record objects in incremental info.
6546         * archive.h (Incremental_archive_entry): Forward declaration.
6547         (Archive::set_incremental_info): New member function.
6548         (Archive::incremental_info): New member function.
6549         (Archive::Unused_symbol_iterator): New class.
6550         (Archive::unused_symbols_begin): New member function.
6551         (Archive::unused_symbols_end): New member function.
6552         (Archive::incremental_info_): New data member.
6553         * incremental-dump.cc (find_input_containing_global): New function.
6554         (dump_incremental_inputs): Dump new incremental info sections.
6555         * incremental.cc: Include symtab.h.
6556         (Output_section_incremental_inputs): New class.
6557         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6558         new incremental info sections.
6559         (Sized_incremental_binary::do_check_inputs): Likewise.
6560         (Incremental_inputs::report_archive): Remove.
6561         (Incremental_inputs::report_archive_begin): New function.
6562         (Incremental_inputs::report_archive_end): New function.
6563         (Incremental_inputs::report_object): New function.
6564         (Incremental_inputs::finalize_inputs): Remove.
6565         (Incremental_inputs::report_input_section): New function.
6566         (Incremental_inputs::report_script): Rewrite.
6567         (Incremental_inputs::finalize): Do nothing but finalize string table.
6568         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6569         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6570         (Incremental_inputs::create_data_sections): New function.
6571         (Incremental_inputs::relocs_entsize): New function.
6572         (Output_section_incremental_inputs::set_final_data_size): New function.
6573         (Output_section_incremental_inputs::do_write): New function.
6574         (Output_section_incremental_inputs::write_header): New function.
6575         (Output_section_incremental_inputs::write_input_files): New function.
6576         (Output_section_incremental_inputs::write_info_blocks): New function.
6577         (Output_section_incremental_inputs::write_symtab): New function.
6578         * incremental.h (Incremental_script_entry): Forward declaration.
6579         (Incremental_object_entry): Forward declaration.
6580         (Incremental_archive_entry): Forward declaration.
6581         (Incremental_inputs): Forward declaration.
6582         (Incremental_inputs_header_data): Remove.
6583         (Incremental_inputs_header): Remove.
6584         (Incremental_inputs_header_write): Remove.
6585         (Incremental_inputs_entry_data): Remove.
6586         (Incremental_inputs_entry): Remove.
6587         (Incremental_inputs_entry_write): Remove.
6588         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6589         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6590         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6591         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6592         Likewise.
6593         (Incremental_input_entry): New class.
6594         (Incremental_script_entry): New class.
6595         (Incremental_object_entry): New class.
6596         (Incremental_archive_entry): New class.
6597         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6598         (Incremental_inputs::report_inputs): Remove.
6599         (Incremental_inputs::report_archive): Remove.
6600         (Incremental_inputs::report_archive_begin): New function.
6601         (Incremental_inputs::report_archive_end): New function.
6602         (Incremental_inputs::report_object): Change prototype.
6603         (Incremental_inputs::report_input_section): New function.
6604         (Incremental_inputs::report_script): Change prototype.
6605         (Incremental_inputs::get_reloc_count): New function.
6606         (Incremental_inputs::set_reloc_count): New function.
6607         (Incremental_inputs::create_data_sections): New function.
6608         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6609         (Incremental_inputs::inputs_section): New function.
6610         (Incremental_inputs::symtab_section): New function.
6611         (Incremental_inputs::relocs_section): New function.
6612         (Incremental_inputs::get_stringpool): Add const.
6613         (Incremental_inputs::command_line): Add const.
6614         (Incremental_inputs::inputs): Remove.
6615         (Incremental_inputs::command_line_key): New function.
6616         (Incremental_inputs::input_file_count): New function.
6617         (Incremental_inputs::input_files): New function.
6618         (Incremental_inputs::relocs_entsize): New function.
6619         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6620         (Incremental_inputs::finalize_inputs): Remove.
6621         (Incremental_inputs::Input_info): Remove.
6622         (Incremental_inputs::lock_): Remove.
6623         (Incremental_inputs::inputs_): Change type.
6624         (Incremental_inputs::inputs_map_): Remove.
6625         (Incremental_inputs::current_object_entry_): New data member.
6626         (Incremental_inputs::inputs_section_): New data member.
6627         (Incremental_inputs::symtab_section_): New data member.
6628         (Incremental_inputs::relocs_section_): New data member.
6629         (Incremental_inputs::reloc_count_): New data member.
6630         (Incremental_inputs_reader): New class.
6631         (Incremental_symtab_reader): New class.
6632         (Incremental_relocs_reader): New class.
6633         * layout.cc (Layout::finalize): Move finalization of incremental info
6634         and creation of incremental info sections to follow finalization of
6635         symbol table.  Set offsets for postprocessing sections.
6636         (Layout::create_incremental_info_sections): Call
6637         Incremental_inputs::create_data_sections.  Add incremental symtab
6638         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6639         sections to layout after input sections.
6640         * layout.h (struct Timespec): Forward declaration.
6641         (Layout::incremental_inputs): Add const.
6642         (Layout::create_incremental_info_sections): Add parameter.
6643         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6644         * object.cc: Include incremental.h.
6645         (Relobj::finalize_incremental_relocs): New function.
6646         (Sized_relobj::do_layout): Record input sections in incremental info.
6647         * object.h (Object::output_section): New function.
6648         (Object::output_section_offset): Moved from Relobj.
6649         (Object::get_incremental_reloc_base): New function.
6650         (Object::get_incremental_reloc_count): New function.
6651         (Object::do_output_section): New function.
6652         (Object::do_output_section_offset): Moved from Relobj.
6653         (Object::do_get_incremental_reloc_base): New function.
6654         (Object::do_get_incremental_reloc_count): New function.
6655         (Object::Object): Initialize new data members.
6656         (Relobj::output_section): Renamed do_output_section and moved to
6657         protected.
6658         (Relobj::output_section_offset): Moved to Object.
6659         (Relobj::do_get_incremental_reloc_base): New function.
6660         (Relobj::do_get_incremental_reloc_count): New function.
6661         (Relobj::allocate_incremental_reloc_counts): New function.
6662         (Relobj::count_incremental_reloc): New function.
6663         (Relobj::finalize_incremental_relocs): New function.
6664         (Relobj::next_incremental_reloc_index): New function.
6665         (Relobj::reloc_counts_): New data member.
6666         (Relobj::reloc_bases_): New data member.
6667         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6668         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6669         (Sized_relobj::incremental_relocs_scan): New function.
6670         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6671         (Sized_relobj::incremental_relocs_write): New function.
6672         (Sized_relobj::incremental_relocs_write_reltype): New function.
6673         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6674         incremental link.
6675         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6676         archives and object files elsewhere.
6677         (Add_symbols::run): Report object files here.
6678         (Finish_group::run): Report end of archive at end of group.
6679         * reloc.cc: Include layout.h, incremental.h.
6680         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6681         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6682         (Sized_relobj::incremental_relocs_scan): New function.
6683         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6684         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6685         (Sized_relobj::incremental_relocs_write): New function.
6686         (Sized_relobj::incremental_relocs_write_reltype): New function.
6687         * script.cc (read_input_script): Rewrite test for incremental link.
6688         Change call to Incremental_inputs::report_script.
6689         * symtab.h (Symbol_table::first_global_index): New function.
6690         (Symbol_table::output_count): New function.
6691
6692 2010-08-12  Doug Kwan  <dougkwan@google.com>
6693
6694         * arm.cc (Target_arm::merge_object_attributes): Check command line
6695         options --no-wchar-size-warning and --no-enum-size-warning.
6696         * options.h (General_options): Add ld-compatible options
6697         --no-enum-size-warning and --no-wchar-size-warning.
6698
6699 2010-08-04  Ian Lance Taylor  <iant@google.com>
6700
6701         * x86_64.cc (Target_x86_64::Scan::local): Use
6702         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6703         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6704         (Target_x86_64::Scan::global): Likewise.
6705         (Target_x86_64::Relocate::relocate): Likewise.
6706         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6707         Likewise.
6708
6709 2010-08-03  Cary Coutant  <ccoutant@google.com>
6710
6711         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6712         to reserve space in merged_strings vector. Keep total input size
6713         for stats.
6714         (Output_merge_string::do_print_merge_stats): Print total input size.
6715         * merge.h (Output_merge_string): Add input_size_ field.
6716         * stringpool.cc (Stringpool_template::string_length): Move
6717         implementations out of Stringpool_template class and place in
6718         stringpool.h.
6719         * stringpool.h (string_length): Move out of Stringpool_template.
6720
6721 2010-08-03  Ian Lance Taylor  <iant@google.com>
6722
6723         PR 11712
6724         * layout.cc (relaxation_loop_body): If address of load segment is
6725         set, adjust address to include headers if possible.
6726
6727 2010-08-03  Ian Lance Taylor  <iant@google.com>
6728
6729         * version.cc (version_string): Bump to 1.10.
6730
6731 2010-08-03  Ian Lance Taylor  <iant@google.com>
6732
6733         PR 11805
6734         * layout.h (enum Output_section_order): Define.
6735         (class Layout): Update declarations.
6736         * layout.cc (Layout::get_output_section): Add order parameter.
6737         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6738         is_first_non_relro parameters.  Change all callers.
6739         (Layout::choose_output_section): Likewise.
6740         (Layout::add_output_section_data): Likewise.
6741         (Layout::make_output_section): Likewise.  Set order.
6742         (Layout::default_section_order): New function.
6743         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6744         * output.cc (Output_section::Output_section): Initialize order_.
6745         Don't initialize deleted fields.
6746         (Output_segment::Output_segment): Don't initialize deleted
6747         fields.
6748         (Output_segment::add_output_section_to_load): New function
6749         replacing add_output_section.  Change all callers to call this or
6750         add_output_section_to_nonload.
6751         (Output_segment::add_output_section_to_nonload): New function.
6752         (Output_segment::remove_output_section): Rewrite.
6753         (Output_segment::add_initial_output_data): Likewise.
6754         (Output_segment::has_any_data_sections): Likewise.
6755         (Output_segment::is_first_section_relro): Likewise.
6756         (Output_segment::maximum_alignment): Likewise.
6757         (Output_segment::has_dynamic_reloc): New function replacing
6758         dynamic_reloc_count.  Change all callers.
6759         (Output_segment::has_dynamic_reloc_list): New function replacing
6760         dynamic_reloc_count_list.  Change all callers.
6761         (Output_segment::set_section_addresses): Rewrite.
6762         (Output_segment::set_offset): Rewrite.
6763         (Output_segment::find_first_and_last_list): Remove.
6764         (Output_segment::set_tls_offsets): Rewrite.
6765         (Output_segment::first_section_load_address): Likewise.
6766         (Output_segment::output_section_count): Likewise.
6767         (Output_segment::section_with_lowest_load_address): Likewise.
6768         (Output_segment::write_section_headers): Likewise.
6769         (Output_segment::print_sections_to_map): Likewise.
6770         * output.h (class Output_data): Remove dynamic_reloc_count_
6771         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6772         (Output_data::add_dynamic_reloc): Rewrite.
6773         (Output_data::has_dynamic_reloc): New function.
6774         (Output_data::dynamic_reloc_count): Remove.
6775         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6776         is_last_relro_, is_first_non_relro_, is_interp_,
6777         is_dynamic_linker_section_ fields.  Add order and set_order
6778         functions.  Remove is_relro_local, set_is_relro_local,
6779         is_last_relro, set_is_last_relro, is_first_non_relro,
6780         set_is_first_non_relro functions, is_interp, set_is_interp,
6781         is_dynamic_linker_section, and set_is_dynamic_linker_section
6782         functions.
6783         (class Output_segment): Change Output_data_list from std::list to
6784         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6785         output_bss_ fields.  Update declarations.
6786
6787 2010-08-02  Ian Lance Taylor  <iant@google.com>
6788
6789         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6790         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6791         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6792
6793 2010-08-02  Ian Lance Taylor  <iant@google.com>
6794
6795         PR 11855
6796         * script.cc (Script_options::Script_options): Initialize
6797         symbol_definitions_ and symbol_references_.
6798         (Script_options::add_symbol_assignment): Update
6799         symbol_definitions_ and symbol_references_.
6800         (Script_options::add_symbol_reference): New function.
6801         (script_symbol): New function.
6802         * script.h (class Script_options): Add symbol_definitions_ and
6803         symbol_references_ fields.
6804         (Script_options::referenced_const_iterator): New type.
6805         (Script_options::referenced_begin): New function.
6806         (Script_options::referenced_end): New function.
6807         (Script_options::is_referenced): New function.
6808         (Script_options::any_unreferenced): New function.
6809         * script-c.h (script_symbol): Declare.
6810         * yyscript.y (exp): Call script_symbol.
6811         * symtab.cc: Include "script.h".
6812         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6813         Change all callers.  Check symbols referenced by scripts.
6814         (Symbol_table::add_undefined_symbols_from_command_line): Add
6815         layout parameter.  Change all callers.
6816         (Symbol_table::do_add_undefined_symbols_from_command_line):
6817         Likewise.  Break out loop body.  Check symbols referenced by
6818         scripts.
6819         (Symbol_table::add_undefined_symbol_from_command_line): New
6820         function broken out of
6821         do_add_undefined_symbols_from_command_line.
6822         * symtab.h (class Symbol_table): Update declarations.
6823         * archive.cc: Include "layout.h".
6824         (Archive::should_include_member): Add layout parameter.  Change
6825         all callers.  Check for symbol mentioned in expression.
6826         * archive.h (class Archive): Update declaration.
6827         * object.cc (Sized_relobj::do_should_include_member): Add layout
6828         parameter.
6829         * object.h (Object::should_include_member): Add layout parameter.
6830         Change all callers.
6831         (Object::do_should_include_member): Add layout parameter.
6832         (class Sized_relobj): Update declaration.
6833         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6834         parameter.
6835         * dynobj.h (class Sized_dynobj): Update declaration.
6836         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6837         layout parameter.
6838         * plugin.h (class Sized_pluginobj): Update declaration.
6839
6840 2010-08-02  Ian Lance Taylor  <iant@google.com>
6841
6842         PR 11866
6843         * output.cc (Output_segment::set_offset): Search for the first and
6844         last sections rather than assuming that the list is in order.
6845         (Output_segment::find_first_and_last_list): New function.
6846         * output.h (class Output_segment): Update declarations.
6847         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6848         (relro_strip_test_SOURCES): New variable.
6849         (relro_strip_test_DEPENDENCIES): New variable.
6850         (relro_strip_test_LDFLAGS): New variable.
6851         (relro_strip_test_LDADD): New variable.
6852         (relro_strip_test.so): New target.
6853
6854 2010-08-02  Ian Lance Taylor  <iant@google.com>
6855
6856         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6857         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6858         (Target_i386::got_tlsdesc_section): New function.
6859         (Target_i386::got_section): Create space for GOT entries for
6860         TLSDESC relocations.
6861         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6862         R_386_TLS_GOTDESC.
6863         (Target_i386::Scan::global): Likewise.
6864         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6865         using TLSDESC GOT.
6866         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6867         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6868         (Target_x86_64::got_tlsdesc_section): New function.
6869         (Target_x86_64::got_section): Create space for GOT entries for
6870         TLSDESC relocations.
6871         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6872         R_386_TLS_GOTDESC.
6873         (Target_x86_64::Scan::global): Likewise.
6874         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6875         using TLSDESC GOT.
6876
6877 2010-08-02  Ian Lance Taylor  <iant@google.com>
6878
6879         * testsuite/final_layout.sh: Use dc to convert from hex to
6880         decimal.
6881
6882 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6883
6884         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6885         paramter to the call to gold::gc_process_relocs.
6886         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6887         paramter to the call to gold::gc_process_relocs.
6888         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6889         parameter to the call to gold::gc_process_relocs.
6890         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6891         template parameter to the call to gold::gc_process_relocs.
6892         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6893         paramter to the call to gold::gc_process_relocs.
6894         * gc.h (get_embedded_addend_size): New function.
6895         (gc_process_relocs): Save the size of the reloc for use by ICF.
6896         * icf.cc (get_section_contents): Get the addend from the text section
6897         for SHT_REL relocation sections.
6898         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6899         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6900         * int_encoding.h (read_from_pointer): New overloaded function.
6901         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6902         * testsuite/icf_sht_rel_addend_test.sh: New file.
6903         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6904         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6905
6906 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6907
6908         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6909         * Makefile.in: Regenerate.
6910         * testsuite/Makefile.in: Regenerate.
6911
6912 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6913
6914         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6915         * gold/testsuite/debug_msg.cc: Likewise.
6916         * gold/testsuite/odr_violation1.cc
6917         * gold/testsuite/odr_violation2.cc
6918
6919 2010-07-21  Cary Coutant  <ccoutant@google.com>
6920
6921         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6922         string, and length fields.
6923         (Output_merge_string::Merged_strings_list): New type.
6924         (Output_merge_string::Merged_strings_lists): New typedef.
6925         (Output_merge_string): Replace merged_strings_ with
6926         merged_strings_lists_.
6927         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6928         Merged_strings_list per input object and section.  Don't store pointer
6929         to the string.  Don't store length with each merged string entry.
6930         (Output_merge_string::finalize_merged_data): Loop over list of merged
6931         strings lists.  Recompute length of each merged string.
6932
6933 2010-07-15  Cary Coutant  <ccoutant@google.com>
6934
6935         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6936         here.
6937
6938 2010-07-14  Ian Lance Taylor  <iant@google.com>
6939
6940         * descriptors.cc (Descriptors::open): Report correct name in error
6941         message.
6942
6943 2010-07-13  Doug Kwan  <dougkwan@google.com>
6944
6945         * arm.cc (Arm_input_section::Arm_input_section): For a
6946         SHT_ARM_EXIDX section, always keeps the input sections.
6947         (Arm_input_section::set_exidx_section_link): New method.
6948         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6949         has_errors_ to false.
6950         (Arm_exidx_input_section::has_errors,
6951         Arm_exidx_input_section::set_has_errors): New methods.
6952         (Arm_exidx_input_section::has_errors_): New data member.
6953         (Arm_relobj::get_exidx_shndx_list): New method.
6954         (Arm_output_section::append_text_sections_to_list): Do not skip
6955         section without SHF_EXECINSTR.
6956         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6957         errors.
6958         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6959         section header.  Make error messages more verbose.  Check for
6960         a non-executable section linked to an EXIDX section.
6961         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6962         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6963         check that there is no deferred EXIDX section if we exit early.
6964         Instead of not making an EXIDX section in case of an error, make one
6965         and set the has_errors flag of it.
6966         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6967         in a relocatable link.
6968         (Target_arm::do_relax): Look for the EXIDX output section instead of
6969         assuming that it is called .ARM.exidx.
6970         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6971         section list.  Do not check for SHF_EXECINSTR section flags but
6972         skip any input section with errors.
6973         * output.cc (Output_section::Output_section): Initialize
6974         always_keeps_input_sections_ to false.
6975         (Output_section::add_input_section): Check for
6976         always_keeps_input_sections_.
6977         *  output.h (Output_section::always_keeps_input_sections,
6978         Output_section::set_always_keeps_input_sections): New methods.
6979         (Output_section::always_keeps_input_sections): New data member.
6980
6981 2010-07-13  Rafael Espindola  <espindola@google.com>
6982
6983         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6984         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6985
6986 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6987             Ian Lance Taylor  <iant@google.com>
6988
6989         * output.h (Output_section_lookup_maps::add_merge_section):
6990         Correct check of whether value was inserted.
6991         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6992         (Output_section_lookup_maps::add_relaxed_input_section):
6993         Likewise.
6994         * arm.cc (Target_arm::got_section): Remove used local os.
6995         * i386.cc (Target_i386::got_section): Likewise.
6996         * x86_64.cc (Target_x86_64::got_section): Likewise.
6997         * sparc.cc (Target_sparc::got_section): Likewise.
6998         (Target_sparc::relocate): Remove unused local have_got_offset.
6999         * powerpc.cc (Target_powerpc::relocate): Likewise.
7000
7001 2010-07-13  Ian Lance Taylor  <iant@google.com>
7002
7003         * compressed_output.cc (zlib_decompress): Fix signature in
7004         !HAVE_ZLIB_H case.
7005
7006         * archive.cc (Archive::include_member): Unlock an external member
7007         of a thin archive.  Don't bother to delete an object we know is
7008         NULL.
7009
7010 2010-07-12  Cary Coutant  <ccoutant@google.com>
7011
7012         * compressed_output.cc (zlib_decompress): New function.
7013         (get_uncompressed_size): New function.
7014         (decompress_input_section): New function.
7015         * compressed_output.h (get_uncompressed_size): New function.
7016         (decompress_input_section): New function.
7017         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7018         Handle compressed debug sections.
7019         * layout.cc (is_compressed_debug_section): New function.
7020         (Layout::output_section_name): Map compressed section names to
7021         canonical names.
7022         * layout.h (is_compressed_debug_section): New function.
7023         (is_debug_info_section): Recognize compressed debug sections.
7024         * merge.cc: Include compressed_output.h.
7025         (Output_merge_data::do_add_input_section): Handle compressed
7026         debug sections.
7027         (Output_merge_string::do_add_input_section): Handle compressed
7028         debug sections.
7029         * object.cc: Include compressed_output.h.
7030         (Sized_relobj::Sized_relobj): Initialize new data members.
7031         (build_compressed_section_map): New function.
7032         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7033         * object.h (Object::section_is_compressed): New method.
7034         (Object::do_section_is_compressed): New method.
7035         (Sized_relobj::Compressed_section_map): New type.
7036         (Sized_relobj::do_section_is_compressed): New method.
7037         (Sized_relobj::compressed_sections_): New data member.
7038         * output.cc (Output_section::add_input_section): Handle compressed
7039         debug sections.
7040         * reloc.cc: Include compressed_output.h.
7041         (Sized_relobj::write_sections): Handle compressed debug sections.
7042
7043 2010-07-08  Cary Coutant  <ccoutant@google.com>
7044
7045         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7046         weak when resolving to a dynamic def.
7047         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7048         for weak undef/dynamic def cases. Adjust callers.
7049         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7050         undef_binding_weak_.
7051         (Symbol_table::sized_write_globals): Adjust symbol binding.
7052         (Symbol_table::sized_write_symbol): Add binding parameter.
7053         * symtab.h (Symbol::set_undef_binding): New method.
7054         (Symbol::is_undef_binding_weak): New method.
7055         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7056         (Symbol_table::should_override): Add new parameter.
7057         (Symbol_table::sized_write_symbol): Add new parameter.
7058
7059         * testsuite/weak_undef_file1.cc: Add new test case.
7060         * testsuite/weak_undef_file2.cc: Fix header comment.
7061         * testsuite/weak_undef_test.cc: Add new test case.
7062
7063 2010-06-29  Doug Kwan  <dougkwan@google.com>
7064
7065         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7066         Initialize USE_SYMBOL_.
7067         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7068         definition.
7069         (Arm_reloc_property::uses_symbol_): New data member declaration.
7070         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7071         uses symbol value and symbol is undefined but not weakly undefined.
7072
7073 2010-06-28  Rafael Espindola  <espindola@google.com>
7074
7075         * plugin.cc (Plugin::load): Use dlerror.
7076
7077 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7078
7079         * symtab.cc (detect_odr_violations): When reporting an ODR
7080         violation, report an object where the symbol is defined.
7081
7082 2010-06-25  Doug Kwan  <dougkwan@google.com>
7083
7084         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7085         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7086         definition.
7087         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7088         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7089         target hook to detect function points.
7090         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7091         * icf.h (Icf::check_section_for_function_pointers): Change type of
7092         parameter SECTION_NAME to const reference to std::string.  Use
7093         target hook to determine if section may have unsafe pointers.
7094         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7095         method definition.
7096
7097 2010-06-21  Rafael Espindola  <espindola@google.com>
7098
7099         * fileread.cc (Input_file::find_fie): New
7100         (Input_file::open): Use Input_file::find_fie.
7101         * fileread.h (Input_file::find_fie): New
7102         * plugin.cc (set_extra_library_path): New.
7103         (Plugin::load): Add set_extra_library_path to the transfer vector.
7104         (Plugin_manager::set_extra_library_path): New.
7105         (Plugin_manager::add_input_file): Use the extra search path if set.
7106         (set_extra_library_path(): New.
7107         * plugin.h (Plugin_manager): Add set_extra_library_path and
7108         extra_search_path_.
7109
7110 2010-06-19  Cary Coutant  <ccoutant@google.com>
7111
7112         * layout.cc (gdb_sections): Add .debug_types.
7113         (lines_only_debug_sections): Likewise.
7114
7115 2010-06-18  Rafael Espindola  <espindola@google.com>
7116
7117         * plugin.cc (add_input_file,add_input_library)
7118         (Plugin_manager::add_input_file): Make filename arguments const.
7119         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7120         const.
7121
7122 2010-06-16  Doug Kwan  <dougkwan@google.com>
7123
7124         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7125         .ARM.attributes section if we have not merged any input
7126         attributes sections.
7127
7128 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7129
7130         * arm.cc: Allow combining objects with no EABI version
7131         information.
7132
7133 2010-06-15  Rafael Espindola  <espindola@google.com>
7134
7135         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7136
7137 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7138
7139         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7140         (struct iovec): Correct !HAVE_READV definition.
7141
7142 2010-06-10  Cary Coutant  <ccoutant@google.com>
7143
7144         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7145         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7146         reloc sections.
7147         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7148
7149         PR 11683
7150         * symtab.h (Symbol::is_placeholder): New member function.
7151         * target-reloc.h (relocate_section): Check for placeholder symbols.
7152
7153         * testsuite/Makefile.am (plugin_test_8): New test.
7154         (plugin_test_9): New test.
7155         * testsuite/Makefile.in: Regenerate.
7156
7157 2010-06-09  Nick Clifton  <nickc@redhat.com>
7158
7159         * yyscript.y (input_list_element): Allow strings prefixed with
7160         the '-' character.  Treat these as libraries.
7161         * script.cc (script_add_library): New function.  Adds a library
7162         specified by "-l<name>" found in an input script.
7163         * script-c.h: Add prototype for script_add_library.
7164
7165 2010-06-07  Doug Kwan  <dougkwan@google.com>
7166
7167         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7168         Restrict stub-group size to be within long conditional branch
7169         range when working around cortex-A8 erratum.
7170
7171 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7172
7173         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7174         #ifdef typo.
7175
7176 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7177
7178         PR gold/11658
7179         * output.cc
7180         (Output_section::Input_section_sort_entry::compare_section_ordering):
7181         Change to return non-zero correctly.
7182         (Output_section::Input_section_sort_section_order_index_compare
7183         ::operator()): Change to fix ambiguity in comparisons.
7184
7185 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7186
7187         * gold.h (is_wildcard_string): New function.
7188         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7189         (Layout::layout_eh_frame): Ditto.
7190         (Layout::find_section_order_index): New method.
7191         (Layout::read_layout_from_file): New method.
7192         * layout.h (Layout::find_section_order_index): New method.
7193         (Layout::read_layout_from_file): New method.
7194         (Layout::input_section_position_): New private member.
7195         (Layout::input_section_glob_): New private member.
7196         * main.cc (main): Call read_layout_from_file here.
7197         * options.h (--section-ordering-file): New option.
7198         * output.cc (Output_section::input_section_order_specified_): New
7199         member.
7200         (Output_section::Output_section): Initialize new member.
7201         (Output_section::add_input_section): Add new parameter.
7202         Keep input sections when --section-ordering-file is used.
7203         (Output_section::set_final_data_size): Sort input sections when
7204         section ordering file is specified.
7205         (Output_section::Input_section_sort_entry): Add new parameter.
7206         Check sorting type.
7207         (Output_section::Input_section_sort_entry::compare_section_ordering):
7208         New method.
7209         (Output_section::Input_section_sort_compare::operator()): Change to
7210         consider section_order_index.
7211         (Output_section::Input_section_sort_init_fini_compare::operator()):
7212         Change to consider section_order_index.
7213         (Output_section::Input_section_sort_section_order_index_compare
7214         ::operator()): New method.
7215         (Output_section::sort_attached_input_sections): Change to sort
7216         according to section order when specified.
7217         (Output_section::add_input_section<32, true>): Add new parameter.
7218         (Output_section::add_input_section<64, true>): Add new parameter.
7219         (Output_section::add_input_section<32, false>): Add new parameter.
7220         (Output_section::add_input_section<64, false>): Add new parameter.
7221         * output.h (Output_section::add_input_section): Add new parameter.
7222         (Output_section::input_section_order_specified): New
7223         method.
7224         (Output_section::set_input_section_order_specified): New method.
7225         (Input_section::Input_section): Initialize section_order_index_.
7226         (Input_section::section_order_index): New method.
7227         (Input_section::set_section_order_index): New method.
7228         (Input_section::section_order_index_): New member.
7229         (Input_section::Input_section_sort_section_order_index_compare): New
7230         struct.
7231         (Output_section::input_section_order_specified_): New member.
7232         * script-sections.cc (is_wildcard_string): Delete and move modified
7233         method to gold.h.
7234         (Output_section_element_input::Output_section_element_input): Modify
7235         call to is_wildcard_string.
7236         (Output_section_element_input::Input_section_pattern
7237         ::Input_section_pattern): Ditto.
7238         (Output_section_element_input::Output_section_element_input): Ditto.
7239         * testsuite/Makefile.am (final_layout): New test case.
7240         * testsuite/Makefile.in: Regenerate.
7241         * testsuite/final_layout.cc: New file.
7242         * testsuite/final_layout.sh: New file.
7243
7244 2010-06-01  Rafael Espindola  <espindola@google.com>
7245
7246         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7247
7248 2010-06-01  Rafael Espindola  <espindola@google.com>
7249
7250         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7251         visibility of symbols.
7252
7253 2010-05-27  Doug Kwan  <dougkwan@google.com>
7254
7255         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7256         from start of output section instead of address for a local symbol
7257         in a merged or relaxed section when doing a relocatable link.
7258
7259 2010-05-26  Rafael Espindola  <espindola@google.com>
7260
7261         PR 11604
7262         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7263         adding sections the garbage collector removed.
7264         * gold/testsuite/Makefile.am: Add test.
7265         * gold/testsuite/Makefile.in: Regenerate.
7266         * gold/testsuite/plugin_test_7.sh: New.
7267         * gold/testsuite/plugin_test_7_1.c: New.
7268         * gold/testsuite/plugin_test_7_2.c: New.
7269
7270 2010-05-26  Rafael Espindola  <espindola@google.com>
7271
7272         * script-sections.cc (Output_section_definition::set_section_addresses):
7273         Check for --section-start.
7274
7275 2010-05-26  Doug Kwan  <dougkwan@google.com>
7276
7277         * arm.cc (Arm_scan_relocatable_relocs): New class.
7278         (Target_arm::relocate_special_relocatable): New method.
7279         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7280         (Arm_relocate_functions::thumb_branch_common): Same.
7281         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7282         instead of Default_scan_relocatable_relocs.
7283         * target-reloc.h (relocate_for_relocatable): Let target handle
7284         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7285         * target.h (Sized_target::relocate_special_relocatable): New method.
7286
7287 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7288
7289         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7290
7291 2010-05-23  Doug Kwan  <dougkwan@google.com>
7292
7293         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7294         instead of a cast.
7295         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7296         with a direct branch, not a conditional branch, to a stub.
7297         * merge.cc (Output_merge_base::record_input_section): New method
7298         defintion.
7299         (Output_merge_data::do_add_input_section): Record input section if
7300         keeps-input-sections flag is set.
7301         (Output_merge_string::do_add_input_section): Ditto.
7302         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7303         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7304         INPUT_SECTIONS_.
7305         (Output_merge_base::keeps_input_sections,
7306         Output_merge_base::set_keeps_input_sections,
7307         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7308         method definitions.
7309         (Output_merge_base::Input_sections): New type declaration.
7310         (Output_merge_base::input_sections_begin,
7311         Output_merge_base::input_sections_end,
7312         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7313         (Output_merge_base::bool keeps_input_sections_,
7314         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7315         Output_merge_base::input_sections_): New data members.
7316         (Output_merge_data::do_set_keeps_input_sections): New method
7317         defintion.
7318         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7319         * output.cc (Output_section::Input_section::relobj): Move method
7320         defintion from class declaration to here and handle merge sections.
7321         (Output_section::Input_section::shndx): Ditto.
7322         (Output_section::Output_section): Remove initializations of removed
7323         data members and initialize new data member LOOKUP_MAPS_.
7324         (Output_section::add_input_section): Set keeps-input-sections flag
7325         for a newly created merge output section as appropriate.  Adjust code
7326         to use Output_section_lookup_maps class.
7327         (Output_section::add_relaxed_input_section): Adjst code for lookup
7328         maps code refactoring.
7329         (Output_section::add_merge_input_section): Add a new parameter
7330         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7331         class.  If adding input section to a newly created merge output
7332         section fails, remove the new merge section.
7333         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7334         Adjust code for use of the Output_section_lookup_maps class.
7335         (Output_section::find_merge_section): Ditto.
7336         (Output_section::build_lookup_maps): New method defintion.
7337         (Output_section::find_relaxed_input_section): Adjust code to use
7338         Output_section_lookup_maps class.
7339         (Output_section::get_input_sections): Export merge sections.  Adjust
7340         code to use Output_section_lookup_maps class.
7341         (Output_section:::add_script_input_section): Adjust code to use
7342         Output_section_lookup_maps class.  Update lookup maps for merge
7343         sections also.
7344         (Output_section::discard_states): Use Output_section_lookup_maps.
7345         (Output_section::restore_states): Same.
7346         * output.h (Merge_section_properties): Move class defintion out of
7347         Output_section.
7348         (Output_section_lookup_maps): New class.
7349         (Output_section::Input_section::is_merge_section): New method
7350         defintion.
7351         (Output_section::Input_section::relobj): Move defintion out of class
7352         defintion.  Declare method only.
7353         (Output_section::Input_section::shndx): Ditto.
7354         (Output_section::Input_section::output_merge_base): New method defintion.
7355         (Output_section::Input_section::u2_.pomb): New union field.
7356         (Output_section::Merge_section_by_properties_map,
7357         Output_section::Output_section_data_by_input_section_map,
7358         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7359         Remove types.
7360         (Output_section::add_merge_input_section): Add new parameter
7361         KEEPS_INPUT_SECTIONS.
7362         (Output_section::build_lookup_maps): New method declaration.
7363         (Output_section::merge_section_map_,
7364         Output_section::merge_section_by_properties_map_,
7365         Output_section::relaxed_input_section_map_,
7366         Output_section::is_relaxed_input_section_map_valid_): Remove data
7367         members.
7368         (Output_section::lookup_maps_): New data member.
7369
7370 2010-05-21  Doug Kwan  <dougkwan@google.com>
7371
7372         PR gold/11619
7373         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7374         avoid a compilation error.
7375
7376 2010-05-19  Rafael Espindola  <espindola@google.com>
7377
7378         * script-sections.cc (Output_section_definition::allocate_to_segment):
7379         Update the phdrs_list even when the output section is NULL.
7380         * testsuite/Makefile.am: Add test.
7381         * testsuite/Makefile.in: Regenerate.
7382         * testsuite/script_test_9.cc: New.
7383         * testsuite/script_test_9.sh: New.
7384         * testsuite/script_test_9.t: New.
7385
7386 2010-05-19  Doug Kwan  <dougkwan@google.com>
7387
7388         * arm.cc (Arm_input_section::original_size): New method.
7389         (Arm_input_section::do_addralign): Add a cast.
7390         (Arm_input_section::do_output_offset): Remove static cast.
7391         (Arm_input_section::original_addralign,
7392          Arm_input_section::original_size_): Change type to uint32_t.
7393         (Arm_input_section::init): Add safe casts for section alignment
7394         and size.
7395         (Arm_input_section::set_final_data_size): Do not set address and
7396         offset of stub table.
7397         (Arm_output_section::fix_exidx_coverage): Change use of of
7398         Output_section::Simple_input_section to that of
7399         Output_section::Input_section.
7400         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7401         except for the first pass.
7402         * output.cc (Output_section::get_input_sections): Change type of
7403         input_sections to std::list<Input_section>.
7404         (Output_section::add_script_input_section): Rename from
7405         Output_section::add_simple_input_section.  Change type of SIS
7406         parameter from Simple_input_section to Input_section.
7407         * output.h (Output_section::Simple_input_section): Remove class.
7408         (Output_section::Input_section): Change class visibility to public.
7409         (Output_section::Input_section::addralign): Use stored alignments
7410         for special input sections if set.
7411         (Output_section::Input_section::set_addralign): New method.
7412         (Output_section::get_input_sections): Change parameter type from
7413         list of Simple_input_section to list of Input_section.
7414         (Output_section::add_script_input_section): Rename from
7415         Output_section::add_simple_input_section. Change first parameter's
7416         type from Simple_input_section to Input_section and remove the
7417         second and third parameters.
7418         * script-sections.cc (Input_section::Input_section_list): Change
7419         type to list of Output_section::Input_section/
7420         (Input_section_info::Input_section_info): Change parameter type of
7421         INPUT_SECTION to Output_section::Input_section.
7422         (Input_section_info::input_section): Change return type.
7423         (Input_section_info::input_section_): Change type to
7424         Output_section::Input_section.
7425         (Output_section_element_input::set_section_addresses): Adjust code
7426         to use Output_section::Input_section instead of
7427         Output_section::Simple_input_section.  Adjust code for renaming
7428         of Output_section::add_simple_input_section.
7429         (Orphan_output_section::set_section_addresses): Ditto.
7430
7431 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7432
7433         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7434         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7435
7436 2010-05-18  Rafael Espindola  <espindola@google.com>
7437
7438         * options.cc (General_options::finalize): Handle -nostdlib.
7439         * options.h (nostdlib): New option.
7440         * script.cc (script_add_search_dir): Handle -nostdlib.
7441
7442 2010-05-12  Doug Kwan  <dougkwan@google.com>
7443
7444         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7445         attributes section only if there no attributes section after merging.
7446         (Target_arm::merge_object_attributes): Move value of
7447         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7448         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7449         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7450         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7451         and arm_attr_merge_7.stdout.
7452         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7453         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7454         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7455         arm_attr_merge_7b.o): New rules.
7456         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7457         arm_attr_merge_7
7458         * testsuite/Makefile.in: Regenerate.
7459         * testsuite/arm_attr_merge.sh: New file.
7460         * testsuite/arm_attr_merge_[67][ab].s: Same.
7461
7462 2010-05-05  Nick Clifton  <nickc@redhat.com>
7463
7464         * po/es.po: Updated Spanish translation.
7465
7466 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7467
7468         * Makefile.am (install-exec-local): Properly install gold as
7469         default cross linker.
7470         * Makefile.in: Regenerated.
7471
7472 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7473             Nick Clifton  <nickc@redhat.com>
7474
7475         * configure.ac (install_as_default): Define and set to false
7476         unless --enable-gold or --enable-gold=both/gold has been
7477         specified.
7478         * configure: Regenerate.
7479
7480         * Makefile.am (install-exec-local): Install the executable as
7481         'ld.gold'.  If install_as_default is true then also install it as
7482         'ld'.
7483         * Makefile.in: Regenerated.
7484
7485 2010-04-24  Ian Lance Taylor  <iant@google.com>
7486
7487         * layout.cc (Layout::layout_reloc): In relocatable link don't
7488         combine reloc sections for grouped sections.
7489
7490 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7491
7492         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7493         sections that are not ordinary to icf.
7494         * icf.cc (get_section_contents): Handle relocation pointing to section
7495         with no object or shndx information.
7496         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7497         * testsuite/Makefile.in: Regenerate.
7498         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7499         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7500
7501 2010-04-22  Ian Lance Taylor  <iant@google.com>
7502
7503         * expression.cc (Expression::Expression_eval_info): Add
7504         result_alignment_pointer field.
7505         (Expression::eval_with_dot): Add result_alignment_pointer
7506         parameter.  Change all callers.
7507         (Expression::eval_maybe_dot): Likewise.
7508         (class Binary_expression): Add alignment_pointer parameter to
7509         left_value and right_value.  Change all callers.
7510         (BINARY_EXPRESSION): Set result alignment.
7511         (class Trinary_expression): Add alignment_pointer parameter to
7512         arg2_value and arg3_value.  Change all callers.
7513         (Trinary_cond::value): Set result alignment.
7514         (Max_expression::value, Min_expression::value): Likewise.
7515         (Align_expression::value): Likewise.
7516         * script-sections.cc (class Sections_element): Add dot_alignment
7517         parameter to set_section_addresses virtual function.  Update
7518         instantiations.
7519         (class Output_section_element): Likewise.
7520         (Script_sections::create_segments): Add dot_alignment parameter.
7521         Change all callers.
7522         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7523         (Script_sections::set_phdrs_clause_addresses): Likewise.
7524         * script-sections.h: Update declarations.
7525         * script.h: Update declarations.
7526         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7527         min_p_align.
7528         * testsuite/script_test_3.t: Set large alignment.
7529         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7530         segment has expected alignment.
7531
7532 2010-04-22  Nick Clifton  <nickc@redhat.com>
7533
7534         * po/gold.pot: Updated by the Translation project.
7535         * po/vi.po: Updated Vietnamese translation.
7536
7537 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7538
7539         * testsuite/Makefile.am (check_PROGRAMS): Add
7540         icf_virtual_function_folding_test.
7541         * testsuite/Makefile.in: Regenerated.
7542
7543 2010-04-15  Andrew Haley  <aph@redhat.com>
7544
7545         * options.h (merge_exidx_entries): New option.
7546         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7547         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7548         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7549         (Target_arm::merge_exidx_entries): New function.
7550         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7551         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7552         to Arm_exidx_fixup constructor.
7553         Add new arg, merge_exidx_entries.
7554         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7555         Arm_output_section::fix_exidx_coverage.
7556
7557 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7558
7559         * icf.cc (get_section_contents): Check for preemptible functions.
7560         Ignore addend when appropriate.
7561         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7562         section folded.
7563         (add_from_relobj): Check for section folded.
7564         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7565         * symtab.h (should_add_dynsym_entry): Add new parameter.
7566         * target-reloc.h (scan_relocs): Check for section folded.
7567         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7568         Check reloc types for function pointers in shared objects.
7569         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7570         case.
7571         (icf_preemptible_functions_test): New test case.
7572         (icf_string_merge_test): New test case.
7573         * testsuite.Makefile.in: Regenerate.
7574         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7575         bar_glob.  Refactor code.
7576         * testsuite/icf_preemptible_functions_test.cc: New file.
7577         * testsuite/icf_preemptible_functions_test.sh: New file.
7578         * testsuite/icf_string_merge_test.cc: New file.
7579         * testsuite/icf_string_merge_test.sh: New file.
7580         * testsuite/icf_virtual_function_folding_test.cc: New file.
7581         * testsuite/icf_virtual_function_folding_test.sh: New file.
7582
7583 2010-04-14  Doug Kwan  <dougkwan@google.com>
7584
7585         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7586         for local symbol recounting if we remove a section due to ICF.
7587         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7588         there are no regular objects in input.
7589
7590 2010-04-13  Doug Kwan  <dougkwan@google.com>
7591
7592         * arm.cc (Arm_input_section::set_final_data_size): Compute
7593         accurate final data size instead of using current data size.
7594
7595 2010-04-09  Doug Kwan  <dougkwan@google.com>
7596
7597         * layout.cc (Layout::choose_output_section): Handle script section
7598         types.
7599         (Layout::make_output_section_for_script): Add section type parameter.
7600         Handle script section types.
7601         * layout.h (Layout::make_output_section_for_script): Add section
7602         type parameter.
7603         * output.cc (Output_section::Output_section): Initialize data member
7604         is_noload_.
7605         (Output_section::do_reset_address_and_file_offset): Do not set address
7606         to 0 if section is a NOLOAD section.
7607         * output.h (Output_section::is_noload): New method.
7608         (Output_section::set_is_noload): Ditto.
7609         (Output_section::is_noload_): New data member.
7610         * script-c.h (Script_section_type): New enum type.
7611         (struct Parser_output_section_header): Add new file section_type.
7612         * script-sections.cc (Sections_element::output_section_name): Add
7613         parameter for returning script section type.
7614         (Output_section_definition::output_section_name): Ditto.
7615         (Output_section_definition::section_type)P; New method.
7616         (Output_section_definiton::script_section_type_name): Ditto.
7617         (Output_section_definition::script_section_type_): New data member.
7618         (Output_section_definition::Output_section_definition): Initialize
7619         data member Output_section_definition::script_section_type_.
7620         (Output_section_definition::create_sections): Pass script section type
7621         to Layout::make_output_section_for_script.
7622         (Output_section_definition::output_section_name): Return script
7623         section type to caller.
7624         (Output_section_definition::set_section_address): Do not advance
7625         dot value and load address if section type is NOLOAD.  Set address
7626         of NOLOAD sections regardless of section flags.
7627         (Output_section_definition::print): Print section type if it is
7628         not SCRIPT_SECTION_TYPE_NONE.
7629         (Output_section_definition::section_type): New method.
7630         (Output_section_definition::script_section_type_name): Ditto.
7631         (Script_sections::output_section_name): Add new parameter
7632         PSECTION_TYPE for returning script section type.  Pass it to
7633         section elements.  Handle discard sections.
7634         (Sort_output_sections::operator()): Handle NOLOAD sections.
7635         * script-sections.h (Script_sections::Section_type): New enum type.
7636         (Script_sections::output_section_name): Add a new parameter for
7637         returning script section type.
7638         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7639         INFO and NOLOAD.
7640         * yyscript.y (union): Add new field SECTION_TYPE.
7641         (COPY, DSECT, INFO, NOLOAD): New tokens.
7642         (opt_address_and_section_type): Change type to output_section_header.
7643         (section_type): New non-terminal
7644         (section_header): Handle section type.
7645         (opt_address_and_section_type): Return section type value.
7646
7647 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7648
7649         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7650         * testsuite/plugin_common_test_2.c (foo): Likewise.
7651
7652 2010-04-08  Doug Kwan  <dougkwan@google.com>
7653
7654         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7655         Output_merge_data.
7656         * output.cc (Output_section::add_merge_input_section): Simplify
7657         code and return status of Output_merge_base::add_input_section.
7658         Update merge section map only if Output_merge_base::add_input_section
7659         returns true.
7660
7661 2010-04-07  Doug Kwan  <dougkwan@google.com>
7662
7663         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7664         if section is marked as containing instructions but has no mapping
7665         symbols.
7666         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7667         correct section index.
7668         (Arm_relobj::find_linked_text_section): Ditto.
7669
7670 2010-04-07  Cary Coutant  <ccoutant@google.com>
7671
7672         * archive.cc (include_member): Destroy Read_symbols_data object before
7673         releasing file.
7674         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7675         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7676         (Read_symbols_data::~Read_symbols_data) New destructor.
7677         (Section_relocs::Section_relocs) New constructor.
7678         (Section_relocs::~Section_relocs) New destructor.
7679         (Read_relocs_data::Read_relocs_data) New constructor.
7680         (Read_relocs_data::~Read_relocs_data) New destructor.
7681         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7682         pointers to NULL after deleting.
7683
7684 2010-04-07  Doug Kwan  <dougkwan@google.com>
7685
7686         * arm.cc: Replace "endianity" with "endianness" in comments.
7687         (Arm_exidx_cantunwind): Ditto.
7688         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7689         (Arm_relobj::merge_flags_and_attributes): New method.
7690         (Arm_relobj::merge_flags_and_attributes_): New data member.
7691         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7692         (Arm_relobj::scan_sections_for_stubs): Ditto.
7693         (Arm_relobj::do_read_symbols): Check to see if we really want to
7694         merge processor-specific flags and attributes.  Exit early if
7695         an object is empty except for section names and the undefined symbol.
7696         (Target_arm::do_finalize_sections): Move check for ELF format to
7697         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7698         attributes from a regular object only when we have determined that
7699         it is aapropriate.  Do not create an .ARM.attributes section in
7700         output if there is no regular input object.
7701         (Target_arm::merge_processor_specific_flags): Check
7702         --warn-mismatch before printing any error.
7703         (Target_arm::merge_object_attributes): Ditto.
7704         * gold.cc (queue_middle_tasks): Handle the case in which there is
7705         no regular object in input.
7706         * options.cc (General_options::parse_EB): New method.
7707         (General_options::parse_EL): Same.
7708         (General_options::General_options): Initialize endianness_.
7709         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7710         New options.
7711         (General_options::Endianness): New enum.
7712         (General_options::endianness): New method.
7713         (General_options::endianness_): New data member.
7714         * parameters.cc (Parameters::set_options): Check target endianness.
7715         (Parameters::set_target_once): Ditto.
7716         (Parameters::check_target_endianness): New method.
7717         (parameters_force_valid_target): If either -EL or -EB is specified,
7718         use it to define endianness of default target.
7719         * parameters.h (Parameters::check_target_endianness): New method
7720         declaration.
7721         * target.h (class Target): Change "endianity" to "endianness"
7722         in comments.
7723
7724 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7725
7726         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7727         * configure: Regenerate.
7728         * Makefile.in: Regenerate.
7729         * testsuite/Makefile.in: Regenerate.
7730
7731 2010-04-06  Cary Coutant  <ccoutant@google.com>
7732
7733         gcc PR lto/42757
7734         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7735         prevailing definitions of common symbols.
7736         * testsuite/plugin_test_6.sh: New test case.
7737         * testsuite/plugin_common_test_1.c: New test case.
7738         * testsuite/plugin_common_test_2.c: New test case.
7739         * testsuite/Makefile.am (plugin_test_6): New test case.
7740         * testsuite/Makefile.in: Regenerate.
7741
7742 2010-04-06  Nick Clifton  <nickc@redhat.com>
7743
7744         * po/vi.po: New Vietnamese translation.
7745
7746 2010-03-30  Doug Kwan  <dougkwan@google.com>
7747
7748         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7749
7750 2010-03-25  Doug Kwan  <dougkwan@google.com>
7751
7752         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7753         to avoid a conversion warning on a 32-bit host.
7754
7755 2010-03-24  Ian Lance Taylor  <iant@google.com>
7756
7757         * testsuite/script_test_3.t: Add a TLS segment.
7758         * testsuite/Makefile.am (check_PROGRAMS): Add
7759         tls_phdrs_script_test.
7760         (tls_phdrs_script_test_SOURCES): Define.
7761         (tls_phdrs_script_test_DEPENDENCIES): Define.
7762         (tls_phdrs_script_test_LDFLAGS): Define.
7763         (tls_phdrs_script_test_LDADD): Define.
7764         * testsuite/Makefile.in: Rebuild.
7765
7766 2010-03-23  Cary Coutant  <ccoutant@google.com>
7767
7768         * fileread.cc (find_or_make_view): Fix comment.
7769
7770 2010-03-23  Ian Lance Taylor  <iant@google.com>
7771
7772         * script-sections.cc (class Orphan_section_placement): Define
7773         PLACE_TLS and PLACE_TLS_BSS.
7774         (Orphan_section_placement::Orphan_section_placement): Initialize
7775         new places.
7776         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7777         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7778         (tls_script_test_SOURCES): Define.
7779         (tls_script_test_DEPENDENCIES): Define.
7780         (tls_script_test_LDFLAGS): Define.
7781         (tls_script_test_LDADD): Define.
7782         * testsuite/Makefile.in: Rebuild.
7783
7784 2010-03-22  Doug Kwan  <dougkwan@google.com>
7785
7786         * arm.cc (Arm_relocate_functions::abs8,
7787         Arm_relocate_functions::abs16): Use correct check for overflow
7788         specified in the ARM ELF specs.
7789         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7790         target of a BLX instruction specially.
7791         (Reloc_stub::stub_type_for_reloc): Ditto.
7792         (Relocate::relocate): Use symbolic names instead of numeric relocation
7793         codes to report error.
7794         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7795         workaround.
7796         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7797         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7798         thumb2_blx_out_of_range.stdout
7799         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7800         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7801         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7802         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7803         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7804         thumb2_blx_in_range, thumb2_blx_in_range.o,
7805         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7806         thumb2_blx_out_of_range.o): New rules.
7807         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7808         thumb2_blx_in_range and thumb2_blx_out_of_range.
7809         * testsuite/Makefile.in: Regenerate.
7810         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7811         * testsuite/thumb_blx_in_range.s: New file.
7812         * testsuite/thumb_blx_out_of_range.s: New file.
7813
7814 2010-03-22  Rafael Espindola  <espindola@google.com>
7815
7816         * archive.cc (Should_include): Move to archive.h.
7817         (should_include_member): Make it a member of Archive.
7818         (Lib_group): New.
7819         (Add_lib_group_symbols): New.
7820         * archive.h: Include options.h.
7821         (Archive_member): Moved from Archive.
7822         (Should_include): Moved from archive.cc.
7823         (Lib_group): New.
7824         (Add_lib_group_symbols): New.
7825         * dynobj.cc (do_should_include_member): New.
7826         * dynobj.h (do_should_include_member): New.
7827         * gold.cc (queue_initial_tasks): Update call to queue.
7828         * main.cc (main): Print lib group stats.
7829         * object.cc (do_should_include_member): New.
7830         * object.h: Include archive.h.
7831         (Object::should_include_member): New.
7832         (Object::do_should_include_member): New.
7833         (Sized_relobj::do_should_include_member): New.
7834         * options.cc (General_options::parse_start_lib): New.
7835         (General_options::parse_end_lib): New.
7836         (Input_arguments::add_file): Handle lib groups.
7837         (Input_arguments::start_group): Check we are not in a lib.
7838         (Input_arguments::start_lib): New.
7839         (Input_arguments::end_lib): New.
7840         * options.h (General_options): Add start_lib and end_lib.
7841         (Input_argument::lib_): New.
7842         (Input_argument::lib): New.
7843         (Input_argument::is_lib): New.
7844         (Input_file_lib): New.
7845         (Input_arguments::in_lib_): New.
7846         (Input_arguments::in_lib): New.
7847         (Input_arguments::start_lib): New.
7848         (Input_arguments::end_lib_): New.
7849         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7850         in unused members as preempted.
7851         (Sized_pluginobj::do_should_include_member): New.
7852         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7853         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7854         return the blocker.
7855         (Read_symbols::do_whole_lib_group): New.
7856         (Read_symbols::do_lib_group): New.
7857         (Read_symbols::do_read_symbols): Handle lib groups.
7858         (Read_symbols::get_name): Handle lib groups.
7859         * readsyms.h (Read_symbols): Add an archive member pointer.
7860         (Read_symbols::do_whole_lib_group): New.
7861         (Read_symbols::do_lib_group): New.
7862         (Read_symbols::member_): New.
7863         * script.cc (read_input_script): Update call to queue_soon.
7864
7865 2010-03-19  Doug Kwan  <dougkwan@google.com>
7866
7867         * arm.cc (Stub_table::Stub_table): Initialize new data members
7868         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7869         (Stub_table::add_reloc_stub): Assign stub offset and update
7870         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7871         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7872         New data members.
7873         (Stub_table::update_data_size_and_addralign): Use
7874         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7875         instead of going over all reloc stubs.
7876         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7877         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7878         Stringpool_template::offset_ to size of Stringpool_char.
7879         (Stringpool_template::new_key_offset): Remove code to initialize
7880         Stringpool_template::offset_.
7881         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7882         Stringpool_template::offset_ to zero.
7883
7884 2010-03-15  Doug Kwan  <dougkwan@google.com>
7885
7886         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7887         offset_.
7888         (Stringpool_template::new_key_offset): New method.
7889         (Stringpool_template::add_string): Assign offsets when adding new
7890         strings.
7891         (Stringpool_template::set_string_offsets): Do not set string offsets
7892         when not optimizing.
7893         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7894         member size_.
7895         (Chunked_vector::clear): Clear size_.
7896         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7897         (Chunked_vector::size): Return size_.
7898         (Chunked_vector::push_back): Use size_ to find insert position.
7899         (Chunked_vector::size_): New data member.
7900         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7901         (Stringpool_template::new_key_offset): New method declaration.
7902         (Stringpool_template::offset_): New data member.
7903
7904 2010-03-15   Rafael Espindola  <espindola@google.com>
7905
7906         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7907         Add_symbols' constructor.
7908         * readsyms.h (Add_symbols): Remove the input_group member.
7909
7910 2010-03-10  Ian Lance Taylor  <iant@google.com>
7911
7912         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7913         target to ask whether a reference to a symbol requires a stack
7914         split.
7915         * target.h (Target::is_call_to_non_split): New function.
7916         (Target::do_is_call_to_non_split): Declare virtual function.
7917         * target.cc: Include "symtab.h".
7918         (Target::do_is_call_to_non_split): New function.
7919         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7920
7921 2010-03-10  Cary Coutant  <ccoutant@google.com>
7922
7923         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7924         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7925         (File_read::open[2]): Add whole_file_view_ to list of views.
7926         (File_read::make_view): Remove test of whole_file_view_.
7927         (File_read::find_or_make_view): Create whole_file_view_ if
7928         necessary.
7929         (File_read::clear_views): Replace bool parameter with enum;
7930         adjust all callers.  Don't delete views with permanent data;
7931         do delete cached views and views from archives if
7932         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7933         if clearing the corresponding view.
7934         * fileread.h (File_read::Clear_views_mode): New enum.
7935         (File_read::View::is_permanent_view): New method.
7936         (File_read::clear_views): Replace bool parameter
7937         with enum; adjust all callers.
7938         * options.h (General_options): Change keep_files_mapped option;
7939         add map_whole_files.
7940         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7941         releasing the file.
7942         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7943         the file.
7944
7945 2010-03-10  David S. Miller  <davem@davemloft.net>
7946
7947         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7948
7949 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7950
7951         * icf.cc (get_section_contents): Add '@' marker after processing the
7952         merge reloc.
7953
7954 2010-03-08  Doug Kwan  <dougkwan@google.com>
7955
7956         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7957         due to a conversion warning.
7958         (Arm_relobj::update_output_local_symbol_count): Check for local
7959         symbol with unset output index.
7960
7961 2010-03-05  Ian Lance Taylor  <iant@google.com>
7962
7963         * options.h (class General_options): Add --spare-dynamic-tags.
7964         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7965         --spare-dynamic-tags.
7966
7967 2010-03-05  Ian Lance Taylor  <iant@google.com>
7968
7969         * incremental.cc: Include "libiberty.h".
7970
7971 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7972
7973         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7974         function, is_info_ member.
7975         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7976         (Versions::Versions): Update caller.
7977         (Versions::define_base_version): Likewise.
7978         (Versions::add_def): Likewise.
7979
7980 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7981
7982         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7983         (Scan::possible_function_pointer_reloc): New function.
7984         (Scan::local_reloc_may_be_function_pointer): Change to call
7985         possible_function_pointer_reloc.
7986         (Scan::global_reloc_may_be_function_pointer): Ditto.
7987         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7988         relocations in ".data.rel.ro._ZTV" section.
7989         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7990         * testsuite/icf_safe_so_test.cc: Ditto.
7991         * testsuite/icf_safe_test.cc: Ditto.
7992         * testsuite/icf_safe_test.sh: Ditto.
7993
7994 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7995             Ian Lance Taylor  <iant@google.com>
7996
7997         * target-reloc.h (relocate_section): Check the symbol table index
7998         for -1U before setting the local symbol index.
7999         (scan_relocatable_relocs): If copying the relocation, record that
8000         the local symbol is required.
8001         * object.h (Symbol_value::is_output_symtab_index_set): New
8002         function.
8003         (Symbol_value::may_be_discarded_from_output_symtab): New
8004         function.
8005         (Symbol_value::has_output_symtab_entry): New function.
8006         (Symbol_value::needs_output_symtab_entry): Remove.
8007         (Symbol_value::output_symtab_index): Make sure the symbol index is
8008         set.
8009         (Symbol_value::set_output_symtab_index): Make sure the symbol
8010         index is not set.  Make sure the new index is valid.
8011         (Symbol_value::set_must_have_output_symtab_entry): New function.
8012         (Symbol_value::has_output_dynsym_entry): New function.
8013         (Symbol_value::set_output_dynsym_index): Make sure the new index
8014         is valid.
8015         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8016         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8017         local symbol if permitted.
8018         (Sized_relobj::do_finalize_local_symbols): Call
8019         is_output_symtab_index_set rather than needs_output_symtab_entry.
8020         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8021         rather than needs_output_symtab_entry.  Call
8022         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8023         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8024         is_output_symtab_index_set rather than needs_output_symtab_entry.
8025         * testsuite/discard_locals_relocatable_test.c: New file.
8026         * testsuite/discard_locals_test.sh: Test -r.
8027         * testsuite/Makefile.am (check_DATA): Add
8028         discard_locals_relocatable_test1.syms,
8029         discard_local_relocatable_test2.syms.
8030         (MOSTLYCLEANFILES): Likewise.  Also add
8031         discard_locals_relocatable_test1.lout and
8032         discard_locals_relocatable_test2.out.
8033         (discard_locals_relocatable_test1.syms): New target.
8034         (discard_locals_relocatable_test.o): New target.
8035         (discard_locals_relocatable_test1.out): New target.
8036         (discard_locals_relocatable_test2.syms): New target.
8037         (discard_locals_relocatable_test2.out): New target.
8038         (various): Add missing ../ld-new dependencies.
8039         * testsuite/Makefile.in: Rebuild.
8040
8041 2010-03-03  Nick Clifton  <nickc@redhat.com>
8042
8043         * po/fi.po: New Finnish translation.
8044
8045 2010-03-01  Doug Kwan  <dougkwan@google.com>
8046
8047         * layout.cc (Layout::Layout): Force section types of .init_array*,
8048         .preinit_array* and .fini_array* sections.
8049         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8050         Fix check of return value of std::string::find.().
8051         (Output_section::Input_section_sort_compare::operator()): Remove
8052         comment about .init_array.
8053         (Output_section::Input_section_sort_init_fini_compare::operator()):
8054         New method.
8055         (Output_section::sort_attached_input_sections): Handle .init_array
8056         and .fini_array specially.
8057         * output.h (Output_section::Inut_section_sort_compare): Update
8058         comment.
8059         (Output_section::Input_section_sort_init_fini_compare): New struct.
8060
8061 2010-02-26  Doug Kwan  <dougkwan@google.com>
8062
8063         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8064         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8065         * testsuite/debug_msg.sh: Avoid matching source line number for
8066         use of global variable undef_int.
8067
8068 2010-02-26  Doug Kwan  <dougkwan@google.com>
8069
8070         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8071         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8072         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8073         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8074         * options.cc (General_options::General_options): Initialize member
8075         fix_v4bx_.
8076         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8077         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8078         and rm_no_fix_v4bx.stdout
8079         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8080         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8081         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8082         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8083         and arm_no_fix_v4bx.
8084         * Makefile.in: Regenerate.
8085         * testsuite/arm_fix_v4bx.s: New file.
8086         * testsuite/arm_fix_v4bx.sh: Ditto.
8087
8088 2010-02-24  Doug Kwan  <dougkwan@google.com>
8089
8090         * arm.cc (Target_arm::got_section): Make the .got section the first
8091         non RELRO section in the data segment.
8092         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8093         suffixes of section names.
8094
8095 2010-02-24  Doug Kwan  <dougkwan@google.com>
8096
8097         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8098         flags and attributes merging if an input file is a binary file.
8099         * fileread.cc (Input_file::open): Record format of original file.
8100         * fileread.h (Input_file::Format): New enum type.
8101         (Input_file::Input_file): Initialize data member format_.
8102         (Input_file::format): New method definition.
8103         (Input_file::format_):: New data member.
8104
8105 2010-02-24  Doug Kwan  <dougkwan@google.com>
8106
8107         * arm.cc (Arm_output_data_got): New class.
8108         (ARM_TCB_SIZE): New constant
8109         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8110         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8111         If user uses a script with a SECTIONS clause, issue only a warning
8112         for a misplaced EXIDX input section.  Otherwise, issue an error.
8113         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8114         garbage collection.
8115         (Target_arm::got_mode_index_entry): Handle static linking.
8116         (Target_arm::Scan::local): Ditto.
8117         (Target_arm::Scan::global): Ditto.
8118         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8119         all incorrectly implemented relocations.
8120         (Target_arm::fix_exidx_coverage): Pass layout to
8121         Arm_output_section::fix_exidx_coverage.
8122         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8123         from ".ARM.exidx." and ".ARM.extab.".
8124
8125 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8126
8127         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8128         section if it does not already exist.
8129         * attributes.cc (Attributes_section_data::Attributes_section_data):
8130         Don't crash if size is zero.
8131
8132 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8133             Ian Lance Taylor  <iant@google.com>
8134
8135         * gold.cc (queue_middle_tasks): If no input files were opened,
8136         exit.
8137         * workqueue.h (Task_function::Task_function): Assert that there is
8138         a blocker.
8139
8140 2010-02-22  Doug Kwan  <dougkwan@google.com>
8141
8142         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8143         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8144         types to avoid warnings due to different uint64_t implementations
8145         on different hosts.
8146
8147 2010-02-21  Doug Kwan  <dougkwan@google.com>
8148
8149         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8150         handling of the maximum backward branch offset.
8151         (Arm_relocate_functions::thumb_branch_common): Ditto.
8152         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8153         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8154         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8155         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8156         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8157         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8158         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8159         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8160         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8161         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8162         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8163         thumb2_bl_out_of_range.o): New rules.
8164         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8165         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8166         thumb2_bl_out_of_range
8167         * testsuite/Makefile.in: Regenerate.
8168         * testsuite/arm_bl_in_range.s: New file.
8169         * testsuite/arm_bl_out_of_range.s: Ditto.
8170         * testsuite/arm_branch_in_range.sh: Ditto.
8171         * testsuite/arm_branch_range.t: Ditto.
8172         * testsuite/thumb2_branch_range.t: Ditto.
8173         * testsuite/thumb_bl_in_range.s: Ditto.
8174         * testsuite/thumb_bl_out_of_range.s: Ditto.
8175         * testsuite/thumb_branch_range.t: Ditto.
8176
8177 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8178
8179         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8180         Add reloc offset information.
8181         * icf.cc (get_section_contents): Change iterators to point to the new
8182         vectors. Add reloc offset information to the contents.
8183         * icf.h (Icf::Sections_reachable_info): New typedef.
8184         (Icf::Sections_reachable_list): New typedef.
8185         (Icf::Offset_info): New typedef.
8186         (Icf::Reloc_info): New struct typedef.
8187         (Icf::Reloc_info_list): New typedef.
8188         (Icf::symbol_reloc_list): Delete method.
8189         (Icf::addend_reloc_list): Delete method.
8190         (Icf::section_reloc_list): Delete method.
8191         (Icf::reloc_info_list): New method.
8192         (Icf::reloc_info_list_): New member.
8193
8194 2010-02-19  Doug Kwan  <dougkwan@google.com>
8195
8196         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8197         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8198         * arm.cc (Arm_relocation_functions): New forward declaration.
8199         (Target_arm::Target_arm): Initialize new data members
8200         got_mod_index_offset_ and tls_base_symbol_defined_.
8201         (Target_arm::Relocate::relocate_tls): New method.
8202         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8203          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8204         New methods.
8205         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8206         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8207         (Target_arm::got_mod_index_offset_,
8208         Target_arm::tls_base_symbol_defined_): New data members.
8209         (Target_arm::Scan::local, Target::Scan::global,
8210         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8211         relocations.
8212
8213 2010-02-18  Doug Kwan  <dougkwan@google.com>
8214
8215         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8216         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8217         text section as a parameter becuase some broken tools may not set
8218         the link in section header.
8219         (Target_arm::has_got_section): New method.
8220         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8221         without any mapping symbol as data only.  Remove warning.
8222         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8223         link in its section header, try to discover the link by inspecting the
8224         REL31 relocation at the beginning of the section.
8225         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8226         in error message.
8227         (Target_arm::Scan::global): Treat any reference to the symbol
8228         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8229
8230 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8231
8232         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8233         (Scan::global_reloc_may_be_function_pointer): New function.
8234         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8235         (Scan::global_reloc_may_be_function_pointer): New function.
8236         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8237         (Scan::global_reloc_may_be_function_pointer): New function.
8238         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8239         (Scan::global_reloc_may_be_function_pointer): New function.
8240         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8241         (Scan::global_reloc_may_be_function_pointer): New function.
8242         (Scan::possible_function_pointer_reloc): New function.
8243         (Target_x86_64::can_check_for_function_pointers): New function.
8244         * gc.h (gc_process_relocs): Scan relocation types to determine if
8245         function pointers were taken for targets that support it.
8246         * icf.cc (Icf::find_identical_sections): Include functions for
8247         folding in safe ICF whose pointer is not taken.
8248         * icf.h (Secn_fptr_taken_set): New typedef.
8249         (fptr_section_id_): New member.
8250         (section_has_function_pointers): New function.
8251         (set_section_has_function_pointers): New function.
8252         (check_section_for_function_pointers): New function.
8253         * options.h: Fix comment for safe ICF option.
8254         * target.h (can_check_for_function_pointers): New function.
8255         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8256         Modify icf_safe_test for X86-64.
8257         * testsuite/Makefile.in: Regenerate.
8258         * testsuite/icf_safe_so_test.cc: New file.
8259         * testsuite/icf_safe_so_test.sh: New file.
8260         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8261         (main): Change to take pointer to function kept_func_3.
8262         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8263         folding is done correctly for X86-64.
8264
8265 2010-02-12  David S. Miller  <davem@davemloft.net>
8266
8267         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8268         is_symbolless parameter.
8269         (Output_reloc<SHT_REL>::is_symbolless): New.
8270         (Output_reloc<SHT_REL>::is_symbolless_): New.
8271         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8272         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8273         (Output_reloc<SHT_RELA>::is_symbolless): New.
8274         (Output_data_reloc::add_global): Handle is_symbolless.
8275         (Output_data_reloc::add_global_relative): Likewise.
8276         (Output_data_reloc::add_local): Likewise.
8277         (Output_data_reloc::add_local_relative): Likewise.
8278         (Output_data_reloc::add_symbolless_global_addend): New.
8279         (Output_data_reloc::add_symbolless_local_addend): New.
8280         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8281         is_symbolless.
8282         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8283         instead of ->is_relative_
8284         (Output_reloc::write): Likewise.
8285         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8286         (Output_reloc::write_rel): Simplify.
8287
8288         * sparc.cc (Target_sparc::Scan::local): Use
8289         ->add_symbolless_local_addend as needed.
8290         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8291         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8292         based upon relocation offset.
8293
8294 2010-02-11  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8297         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8298         beginning of function.
8299         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8300         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8301         parameter is_32bit in calls to should_apply_static_reloc.
8302         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8303         (check_DATA): Add arm_abs_global.stdout.
8304         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8305         arm_abs_global.stdout): New rules.
8306         (MOSTLLYCLEANFILES): Add arm_abs_global
8307         * Makefile.in: Regenerate.
8308         * testsuite/arm_abs_global.s: New file.
8309         * testsuite/arm_abs_global.sh: Ditto.
8310         * testsuite/arm_abs_lib.s: Ditto.
8311
8312 2010-02-11  Ian Lance Taylor  <iant@google.com>
8313
8314         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8315         Read_relocs task.
8316         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8317         Allocate_commons_task first.
8318         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8319         task, rather than symtab_lock_.
8320         (Gc_process_relocs::~Gc_process_relocs): New function.
8321         (Gc_process_relocs::is_runnable): Check this_blocker_.
8322         (Gc_process_relocs::locks): Use next_blocker_ rather than
8323         blocker_.
8324         (Scan_relocs::~Scan_relocs): New function.
8325         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8326         symtab_lock_.
8327         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8328         next_blocker_.
8329         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8330         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8331         constructor accordingly.
8332         (class Gc_process_relocs): Likewise.
8333         (class Scan_relocs): Likewise.
8334         * common.h (class Allocate_commons_task): Remove symtab_lock_
8335         field, and corresponding constructor parameter.
8336         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8337         symtab_lock_.
8338         (Allocate_commons_task::locks): Likewise.
8339
8340 2010-02-11  Ian Lance Taylor  <iant@google.com>
8341
8342         * gold-threads.h (class Once): Define.
8343         (class Initialize_lock): Rewrite as child of Once.
8344         * gold-threads.cc (class Once_initialize): Define.
8345         (once_pointer_control): New static variable.
8346         (once_pointer, once_arg): New static variables.
8347         (c_run_once): New static function.
8348         (Once::Once, Once::run_once, Once::internal_run): New functions.
8349         (class Initialize_lock_once): Remove.
8350         (initialize_lock_control): Remove.
8351         (initialize_lock_pointer): Remove.
8352         (initialize_lock_once): Remove.
8353         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8354         (Initialize_lock::initialize): Rewrite.
8355         (Initialize_lock::do_run_once): New function.
8356         * archive.cc (Archive::interpret_header): Only clear name if it is
8357         not already empty.
8358         * fileread.cc: Include "gold-threads.h"
8359         (file_counts_lock): New static variable.
8360         (file_counts_initialize_lock): Likewise.
8361         (File_read::release): Only increment counts when using --stats.
8362         Use a lock around the increment.
8363         * parameters.cc (class Set_parameters_target_once): Define.
8364         (set_parameters_target_once): New static variable.
8365         (Parameters::Parameters): Move here from parameters.h.
8366         (Parameters::set_target): Rewrite.
8367         (Parameters::set_target_once): New function.
8368         (Parameters::clear_target): Move here and rewrite.
8369         * parameters.h (class Parameters): Update declarations.  Add
8370         set_parameters_target_once_ field.
8371         (Parameters::Parameters): Move to parameters.cc.
8372         (Parameters::clear_target): Likewise.
8373         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8374         task.
8375         (Start_group::~Start_group): New function.
8376         (Start_group::is_runnable): New function.
8377         (Start_group::locks, Start_group::run): New functions.
8378         (Finish_group::run): Change saw_undefined to size_t.
8379         * readsyms.h (class Start_group): Define.
8380         (class Finish_group): Change saw_undefined_ field to size_t.
8381         (Finish_group::Finish_group): Remove saw_undefined and
8382         this_blocker parameters.  Change all callers.
8383         (Finish_group::set_saw_undefined): New function.
8384         (Finish_group::set_blocker): New function.
8385         * symtab.h (class Symbol_table): Change saw_undefined to return
8386         size_t.  Change saw_undefined_ field to size_t.
8387         * target-select.cc (Set_target_once::do_run_once): New function.
8388         (Target_selector::Target_selector): Initialize set_target_once_
8389         field.  Don't initialize lock_ and initialize_lock_ fields.
8390         (Target_selector::instantiate_target): Rewrite.
8391         (Target_selector::set_target): New function.
8392         * target-select.h (class Set_target_once): Define.
8393         (class Target_selector): Update declarations.  Make
8394         Set_target_once a friend.  Remove lock_ and initialize_lock_
8395         fields.  Add set_target_once_ field.
8396
8397 2010-02-10  Ian Lance Taylor  <iant@google.com>
8398
8399         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8400         queueing any tasks.
8401         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8402         (queue_middle_tasks): Add all blockers before queueing any tasks.
8403         (queue_final_tasks): Likewise.
8404         * token.h (Task_token::add_blockers): New function.
8405         * object.h (Input_objects::number_of_relobjs): New function.
8406
8407 2010-02-10  Ian Lance Taylor  <iant@google.com>
8408
8409         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8410         shared, not if not position independent.
8411         * x86_64.cc (Relocate::relocate_tls): Likewise.
8412         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8413         (tls_pie_pic_test): New target.
8414         * testsuite/Makefile.in: Rebuild.
8415
8416         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8417         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8418         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8419         * testsuite/Makefile.in: Rebuild.
8420
8421 2010-02-09  David S. Miller  <davem@davemloft.net>
8422
8423         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8424         R_SPARC_RELATIVE using ->add_local_relative().
8425         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8426
8427         * output.h (Output_data_dynamic::add_section_size): New method
8428         that takes two Output_data objects.
8429         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8430         entry param.  Handle it in initializers.
8431         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8432         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8433         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8434         arg.
8435         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8436         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8437         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8438         for dynrel_includes_plt.
8439         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8440         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8441         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8442         before .rela.plt
8443         (Target_sparc::do_finalize_sections): Update to pass true for
8444         dynrel_includes_plt.
8445         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8446         output before .rela.plt
8447         (Target_powerpc::do_finalize_sections): Update to pass true for
8448         dynrel_includes_plt when 32-bit.
8449
8450 2010-02-08  Doug Kwan  <dougkwan@google.com>
8451
8452         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8453         method.
8454         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8455         Arm_relobj::scan_section_for_cortex_a8_stubs,
8456         Arm_relobj::do_relocation_section): Instead of calling
8457         Output_section::output_address, use faster
8458         Arm_relobj::simple_input_section_output_address.
8459
8460 2010-02-08  David S. Miller  <davem@davemloft.net>
8461
8462         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8463         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8464         relocation helper function.
8465
8466         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8467         just like R_SPARC_GOT{10,13,22}.
8468         (Target_sparc::Scan::local): Likewise.
8469         (Target_sparc::Relocate:relocate): Likewise.
8470
8471 2010-02-06  Ian Lance Taylor  <iant@google.com>
8472
8473         * configure.ac: Rewrite targetobjs duplicate removal code to use
8474         only shell constructs.
8475         * configure: Rebuild.
8476
8477 2010-02-05  Doug Kwan  <dougkwan@google.com>
8478
8479         PR 11247
8480         * arm.cc (Arm_relobj::section_is_scannable): New method.
8481         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8482         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8483
8484 2010-02-04  Doug Kwan  <dougkwan@google.com>
8485
8486         PR 11247
8487         * arm-reloc-property.cc (cstdio): Include.
8488         * configure.ac (targetobjs): Remove duplicates.
8489         * configure: Regenerate.
8490         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8491         big and little endian version for a given address size.
8492
8493 2010-02-03  Doug Kwan  <dougkwan@google.com>
8494
8495         * arm-reloc-property.cc
8496         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8497         definition.
8498         * arm-reloc-property.h
8499         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8500         New method definition.
8501         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8502         declaration.
8503         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8504         overflow to N.
8505         (GOT_PREL): Change implemented to Y.
8506         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8507         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8508         (Arm_relocate_functions::movw_abs_nc): Remove method.
8509         (Arm_relocate_functions::movt_abs): Ditto.
8510         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8511         (Arm_relocate_functions::thm_movt_abs): Ditto.
8512         (Arm_relocate_functions::movw_rel_nc): Ditto.
8513         (Arm_relocate_functions::movw_rel): Ditto.
8514         (Arm_relocate_functions::movt_rel): Ditto.
8515         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8516         (Arm_relocate_functions:thm_movw_rel): Ditto.
8517         (Arm_relocate_functions:thm_movt_rel): Ditto.
8518         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8519         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8520         New method definitions.
8521         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8522         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8523         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8524         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8525         (Target_arm::Relocate::relocate): Check for non-static or
8526         unimplemented relocation code and exit early.  Change calls to
8527         Target_arm::reloc_uses_thumb_bit and
8528         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8529         instead.  Refactor code to handle similar relocations to increase
8530         code sharing.  Remove check for unsupported relocation code in switch
8531         statement.
8532         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8533         relocation property table to find out size.  Change error message to
8534         print out the name of a relocation code instead of the numeric value.
8535         (Target_arm::scan_reloc_for_stub): Use relocation property table
8536         instead of calling Target_arm::reloc_uses_thumb_bit().
8537
8538 2010-02-02  Doug Kwan  <dougkwan@google.com>
8539
8540         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8541         types of relaxed input section.
8542
8543 2010-02-02  Doug Kwan  <dougkwan@google.com>
8544
8545         * Makefile.am (HFILES): Add arm-reloc-property.h.
8546         (DEFFILES): New.
8547         (TARGETSOURCES): Add arm-reloc-property.cc
8548         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8549         (libgold_a_SOURCES): $(DEFFILES)
8550         * Makefile.in: Regenerate.
8551         * arm-reloc-property.cc: New file.
8552         * arm-reloc-property.h: New file.
8553         * arm-reloc.def: New file.
8554         * arm.cc: Update comments.
8555         (arm-reloc-property.h): New included header.
8556         (arm_reloc_property_table): New global variable.
8557         (Target_arm::do_select_as_default_target): New method definition.
8558         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8559         arm-reloc-property to targ_extra_obj.
8560         * parameters.cc (set_parameters_target): Call
8561         Target::select_as_default_target().
8562         * target.h (Target::select_as_default_target): New method definition.
8563         (Target::do_select_as_default_target): Same.
8564
8565 2010-02-01  Doug Kwan  <dougkwan@google.com>
8566
8567         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8568         first_output_text_section_.
8569         (Arm_exidx_fixup::first_output_text_section): New method definition.
8570         (Arm_exidx_fixup::first_output_text_section_): New data member.
8571         (Arm_exidx_fixup::process_exidx_section): Record the first text
8572         output section seen.
8573         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8574         and entsize in output section header.
8575
8576 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8577
8578         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8579         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8580         (Arm_relocate_functions::thm_alu11): New Method.
8581         (Arm_relocate_functions::thm_pc8): New Method.
8582         (Arm_relocate_functions::thm_pc12): New Method.
8583         (Target_arm::Scan::local): Handle the relocations.
8584         (Target_arm::Scan::global): Likewise.
8585         (Target_arm::Relocate::relocate): Likewise.
8586         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8587
8588 2010-01-29  Doug Kwan  <dougkwan@google.com>
8589
8590         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8591         of relocation types as ld.
8592
8593 2010-01-29  Doug Kwan  <dougkwan@google.com>
8594
8595         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8596         to public.
8597         (Arm_relocate_functions::thumb_branch_common): Ditto.
8598         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8599         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8600         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8601         Arm_relocate_functions::jump24): Remove.
8602         (Target_arm::Relocate::relocate): Adjust code to call
8603         Arm_relocation_functions::arm_branch_common and
8604         Arm_relocation_functions::thumb_branch_common instead of their removed
8605         wrappers.  Merge switch-cases together to reduce source code size.
8606
8607 2010-01-29  Doug Kwan  <dougkwan@google.com>
8608
8609         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8610         output_local_symbol_count_needs_update_.
8611         (Arm_relobj::output_local_symbol_count_needs_update,
8612          Arm_relobj::set_output_local_symbol_count_needs_update,
8613          Arm_relobj::update_output_local_symbol_count): New methods.
8614         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8615         member.
8616         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8617         of pointed function as in a R_ARM_PREL31 relocation.
8618         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8619         for output local symbol count updating.
8620         (Target_arm::do_relax): Update output local symbol counts in objects
8621         if necessary.
8622         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8623
8624 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8625
8626         * arm.cc: Added support for the ARM relocations:
8627         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8628         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8629         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8630         movw_prel_nc).
8631         (Arm_relocate_functions::movw_rel): New method.
8632         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8633         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8634         thm_movw_prel_nc).
8635         (Arm_relocate_functions::thm_movw_rel): New method.
8636         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8637         thm_movt_prel).
8638         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8639         relocations.
8640         (Target_arm::Scan::global): Likewise.
8641         (Target_arm::Relocate::relocate): Likewise.
8642         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8643         Likewise.
8644
8645 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8646
8647         * arm.cc: Added support for ARM group relocations.
8648         (Target_arm::reloc_needs_sym_origin): New method.
8649         (Arm_relocate_functions::calc_grp_kn): New method.
8650         (Arm_relocate_functions::calc_grp_residual): New method.
8651         (Arm_relocate_functions::calc_grp_gn): New method.
8652         (Arm_relocate_functions::arm_grp_alu): New Method.
8653         (Arm_relocate_functions::arm_grp_ldr): New Method.
8654         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8655         (Arm_relocate_functions::arm_grp_ldc): New Method.
8656         (Target_arm::Scan::local): Handle the ARM group relocations.
8657         (Target_arm::Scan::global): Likewise.
8658         (Target_arm::Relocate::relocate): Likewise.
8659         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8660         Likewise.
8661
8662 2010-01-26  Doug Kwan  <dougkwan@google.com>
8663
8664         * arm.cc (set): Include.
8665         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8666         pointer type.
8667         (Arm_output_section::Text_section_list): New type.
8668         (Arm_output_section::append_text_sections_to_list): New method.
8669         (Arm_output_section::fix_exidx_coverage): Ditto.
8670         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8671         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8672         Relobj::set_section_offset() instead of
8673         Sized_relobj::invalidate_section_offset().
8674         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8675         parameter for section headers. Ignore relocation sections for
8676         unallocated sections and EXIDX sections.
8677         (Target_arm::fix_exidx_coverage): New method.
8678         (Target_arm::output_section_address_less_than): New type.
8679         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8680         linked text section instead of the EXIDX section.
8681         (Arm_output_section::create_stub_group): Add an assertion to check
8682         that this is not an EXIDX output section.
8683         (Arm_output_section::append_text_sections_to_list): New method.
8684         (Arm_output_section::fix_exidx_coverage): Ditto.
8685         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8686         Arm_relobj::section_needs_reloc_stub_scanning.
8687         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8688         first pass.
8689         (Target_arm::fix_exidx_coverage): New method.
8690         * object.h (Relobj::set_output_section): New method.
8691         (Sized_relobj::invalidate_section_offset): Remove method.
8692         (Sized_relobj::do_invalidate_section_offset): Remove method.
8693         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8694
8695 2010-01-25  Doug Kwan  <dougkwan@google.com>
8696
8697         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8698         Fix warning due to signed and unsigned comparison on a 32-bit host.
8699
8700 2010-01-22  Doug Kwan  <dougkwan@google.com>
8701
8702         * arm.cc (Target_arm::do_relax): Record an output section for section
8703         offset adjustment it contains any stub table that has changed.
8704         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8705         offsets in an output section if necessary.
8706         * output.cc (Output_section::Output_section): Initialize
8707         section_offsets_need_adjustments_.
8708         (Output_section::add_input_section_for_script): Renamed to
8709         Output_section::add_simple_input_section.
8710         (Output_section::save_states): Add a comment.
8711         (Output_section::discard_states): New method defintion.
8712         (Output_section::adjust_section_offsets): Same.
8713         * output.h (Output_section::add_input_section_for_script): Renamed to
8714         Output_section::add_simple_input_section.
8715         (Output_section::discard_states): New method declaration.
8716         (Output_section::adjust_section_offsets): Same.
8717         (Output_section::section_offsets_need_adjustment,
8718         Output_section::set_section_offsets_need_adjustment): New method
8719         definitions.
8720         (Output_section::section_offsets_need_adjustment_): New data member.
8721         * script-sections.cc
8722         (Output_section_element_input::set_section_address): Adjust code for
8723         renaming of Output_section::add_input_section_for_script.
8724         (Orphan_output_section::set_section_address): Same.
8725
8726 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8727
8728         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8729         Fix_v4bx enum values .
8730         * gold/options.h (General_options): New option definitions.
8731         (General_options::fix_v4bx): New method.
8732         (General_options::Fix_v4bx): New enum.
8733         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8734         (General_options::parse_fix_v4bx_interworking): New method.
8735
8736 2010-01-22  Doug Kwan  <dougkwan@google.com>
8737
8738         * arm.cc (Arm_exidx_fixup): New class.
8739
8740 2010-01-21  Doug Kwan  <dougkwan@google.com>
8741
8742         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8743         classes.
8744         (Arm_exidx_section_offset_map): New type.
8745
8746 2010-01-21  Doug Kwan  <dougkwan@google.com>
8747
8748         * arm.cc (Arm_exidx_input_section): New class.
8749         (Arm_relobj::exidx_input_section_by_link,
8750         Arm_relobj::exidx_input_section_by_shndx,
8751         Arm_relobj::make_exidx_input_section): New methods.
8752         (read_arm_attributes_section): Remove.
8753         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8754         information about them.
8755         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8756         to here.
8757
8758 2010-01-20  Doug Kwan  <dougkwan@google.com>
8759
8760         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8761         Input_section_specifier to Section_id.
8762         (Target_arm::new_arm_input_section: Adjust code for change of key
8763         type.
8764         (Target_arm::find_arm_input_section): Ditto.
8765         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8766         (Section_id): Remove.
8767         (Garbage_collection::Section_id_hash): Remove.
8768         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8769         (Section_id): Remove.
8770         (Icf::Section_id_hash): Remove.
8771         * object.h (Section_id, Const_section_id, Section_id_hash,
8772         Const_section_id_hash): New type definitions.
8773         * output.cc (Output_section::add_relaxed_input_section): Change to
8774         use Const_section_id instead of Input_section_specifier as key type.
8775         (Output_section::add_merge_input_section): Ditto.
8776         (Output_section::build_relaxation_map): Change to use Section_id
8777         instead of Input_section_specifier as key type.
8778         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8779         Ditto.
8780         (Output_section::convert_input_sections_to_relaxed_sections): Change
8781         to use Const_section_id instead of Input_section_specifier as key type.
8782         (Output_section::find_merge_section): Ditto.
8783         (Output_section::find_relaxed_input_section): Ditto.
8784         * output.h (Input_section_specifier): Remove class.
8785         (Output_section::Output_section_data_by_input_section_map): Change
8786         key type to Const_section_id.
8787         (Output_section::Output_relaxed_input_section_by_input_section_map):
8788         Ditto.
8789         (Output_section::Relaxation_map): Change key type to Section_id.
8790
8791 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8792
8793         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8794         (class Arm_v4bx_stub): New class.
8795         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8796         (Stub_factory::make_arm_v4bx_stub): New method.
8797         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8798         (Stub_table::empty): Handle v4bx stubs.
8799         (Stub_table::add_arm_v4bx_stub): New method.
8800         (Stub_table::find_arm_v4bx_stub): New method.
8801         (Arm_relocate_functions::v4bx): New method.
8802         (Target_arm::fix_v4bx): New method.
8803         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8804         (Stub_table::relocate_stubs): Likewise.
8805         (Stub_table::do_write): Likewise.
8806         (Stub_table::update_data_size_and_addralign): Likewise.
8807         (Stub_table::finalize_stubs):  Likewise.
8808         (Target_arm::Scan::local): Likewise.
8809         (Target_arm::Scan::global): Likewise.
8810         (Target_arm::do_finalize_sections): Likewise.
8811         (Target_arm::Relocate::relocate): Likewise.
8812         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8813         Likewise.
8814         (Target_arm::scan_reloc_for_stub): Likewise.
8815         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8816
8817 2010-01-19  Ian Lance Taylor  <iant@google.com>
8818
8819         * output.cc (Output_section_headers::do_sized_write): Write large
8820         segment count to sh_info field.
8821         (Output_file_header::do_sized_write): For large segment count,
8822         write PN_XNUM to e_phnum field.
8823
8824 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8825
8826         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8827         (Arm_relocate_functions::thm_jump8): New function.
8828         (Arm_relocate_functions::thm_jump11): New function.
8829         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8830         R_ARM_THM_JUMP11.
8831         (Target_arm::Scan::global): Likewise.
8832         (Target_arm::Relocate::relocate): Likewise.
8833         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8834         Likewise.
8835
8836 2010-01-14  Doug Kwan  <dougkwan@google.com>
8837
8838         * arm.cc (map, utility): Include headers.
8839         (Target_arm::apply_cortex_a8_workaround): New method.
8840         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8841         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8842         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8843         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8844         the --[no-]fix-cortex-a8 command line options.
8845         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8846         (Target_arm::relocate_stub): Use addend in instruction template.
8847         * options.h (DEFINE_bool): Set the user-set flag.
8848         (General_options): Add --[no-]-fix-cortex options.
8849         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8850         : Update fast look-up map after conversion.
8851
8852 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8853
8854         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8855         in the first pass of do_layout.
8856
8857 2010-01-13  Doug Kwan  <dougkwan@google.com>
8858
8859         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8860         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8861         apparent compiler problem of not folding static constant integral
8862         data members of elfcpp::Elf_sizes<32>.
8863
8864 2010-01-13  Doug Kwan  <dougkwan@google.com>
8865
8866         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8867         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8868         Arm_relobj::scan_section_for_cortex_a8_erratum,
8869         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8870         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8871         sections to scan for relocation stubs into a new method
8872         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8873         relocation and Cortex-A8 stub scanning.
8874         (Target_arm::do_relax): Force stubs to be after stubbed sections
8875         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8876         the beginning of a new relaxation pass.  Update a comment.
8877         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8878
8879 2010-01-12  Ian Lance Taylor  <iant@google.com>
8880
8881         * target-reloc.h (visibility_error): New inline function.
8882         (relocate_section): Call visibility_error.
8883         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8884         (MOSTLYCLEANFILES): Likewise.
8885         (protected_4_pic.o, protected_3.err): New targets.
8886         * testsuite/protected_4.cc: New file.
8887
8888 2010-01-12  Doug Kwan  <dougkwan@google.com>
8889
8890         * arm.cc (Cortex_a8_reloc): New class.
8891         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8892         and cortex_a8_relocs_info_.
8893         (Target_arm::fix_cortex_a8): New method definition.
8894         (Target_arm::Cortex_a8_relocs_info): New type.
8895         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8896         New data member declarations.
8897         (Target_arm::scan_reloc_for_stub): Record information about
8898         relocations for THUMB branches that might be exempted from the
8899         Cortex-A8 workaround.
8900         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8901         at the beginning of a relaxation pass.
8902
8903 2010-01-12  Doug Kwan  <dougkwan@google.com>
8904
8905         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8906         (Arm_relobj::Mapping_symbol_position,
8907          Arm_reloj::Mapping_symbol_position_less,
8908          Arm_relobj::Mapping_symbols_info): New types.
8909         (Target_arm::is_mapping_symbol_name): New method definition.
8910         (Arm_relobj::do_count_local_symbols): Save information about mapping
8911         symbols.
8912
8913 2010-01-11  Doug Kwan  <dougkwan@google.com>
8914
8915         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8916         Arm_relocate_functions::thumb32_branch_upper,
8917         Arm_relocate_functions::thumb32_branch_lower,
8918         Arm_relocate_functions::thumb32_cond_branch_offset,
8919         Arm_relocate_functions::thumb32_cond_branch_upper,
8920         Arm_relocate_functions::thumb32_cond_branch_lower,
8921         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8922         branch offset encoding.
8923         (Arm_relocate_functions::thumb_branch_common): Use new branch
8924         offset encoding methods to avoid code duplication.
8925         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8926         (Stub_addend_reader::operator()): Use new branch encoding method
8927         to avoid code duplication.
8928
8929 2010-01-11  Doug Kwan  <dougkwan@google.com>
8930
8931         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8932         (Target_arm::do_finalize_sections): Define special EXIDX section
8933         symbols only if referenced.
8934         * gc.h (Garbage_collection::add_reference): New method.
8935         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8936         code duplication.
8937
8938 2010-01-11  Ian Lance Taylor  <iant@google.com>
8939
8940         * script.cc (Version_script_info::build_expression_list_lookup):
8941         Change complaing about duplicate wildcard match from error to
8942         warning.
8943
8944         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8945         of 2009-12-30.
8946         (Version_script_info::Version_script_info): Initialize globs_,
8947         default_version_, default_is_global_, and exact_.  Don't
8948         initialize globals_ or locals_.
8949         (Version_script_info::build_lookup_tables): Build local symbols
8950         first.
8951         (Version_script_info::unquote): New function.
8952         (Version_script_info::add_exact_match): New function.
8953         (Version_script_info::build_expression_list_lookup): Remove lookup
8954         parameter.  Add is_global parameter.  Change all callers.  Handle
8955         wildcard pattern specially.  Unquote pattern.  Call
8956         add_exact_match.
8957         (Version_script_info::get_name_to_match): New function.
8958         (Version_script_info::get_symbol_version): New function.
8959         (Version_script_info::get_symbol_version_helper): Remove.
8960         (Version_script_info::check_unmatched_names): Call unquote.
8961         * script.h (class Version_script_info): Change get_symbol_version
8962         to be non-inline and add is_global parameter; change all callers.
8963         Rewrite symbol_is_local.  Update declarations.  Define struct
8964         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8965         Remove globals_ and locals_ members.  Add exact_, globs_,
8966         default_version_, is_global_.
8967         (Version_script_info::Glob): Remove pattern, add expression and
8968         is_global.  Update constructor.  Change all callers.
8969         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8970         default version.
8971         (Versions::symbol_section_contents): If a symbol is undefined, or
8972         defined in a dynamic object, set the version index to
8973         VER_NDX_LOCAL.
8974         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8975         symbol_is_local.
8976         (Symbol_table::add_from_pluginobj): Likewise.
8977         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8978
8979 2010-01-11  Doug Kwan  <dougkwan@google.com>
8980
8981         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8982         (incremental_dump_LDADD): Add linking option for libintl.
8983         * Makefile.in: Regenerate.
8984
8985 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8986
8987         PR gold/11144
8988         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8989         instead of -Ds.
8990         * testsuite/Makefile.in: Regenerated.
8991
8992 2010-01-10  Doug Kwan  <dougkwan@google.com>
8993
8994         * options.h (DEFINE_var): Use parentheses around argument varname__
8995         in macro body to avoid any unintended subsequent substitutions.
8996
8997 2010-01-10  Ian Lance Taylor  <iant@google.com>
8998
8999         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9000         candidates before doing symbol resolution.
9001
9002         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9003         ODR candidates if only one is weak.
9004
9005 2010-01-08  Ian Lance Taylor  <iant@google.com>
9006
9007         * script.cc (Version_script_info::build_expression_list_lookup):
9008         Don't warn about ambiguous version, just record the ambiguity.
9009         (Version_script_info::get_symbol_version_helper): Give error if
9010         version is ambiguous.
9011
9012 2010-01-08  Doug Kwan  <dougkwan@google.com>
9013
9014         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9015         prev_data_size_ and prev_addralign_.  Remove initializer for
9016         deleted data member has_been_changed_.
9017         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9018         to determine if the table is empty.
9019         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9020         Remove.
9021         (Stub_table::add_reloc_stub): Define method in class definition
9022         instead of just declaring it there.
9023         (Stub_table::add_cortex_a8_stub): New method definition.
9024         (Stub_table::update_data_size_and_addralign): Ditto.
9025         (Stub_table::finalize_stubs): Ditto.
9026         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9027         (Stub_table::do_addralign_): Return address alignment in the
9028         (Stub_table::do_reset_address_and_file_offset): Define method in
9029         class definition instead of declaring it there.  Set current data
9030         size to be the data size of the previous pass.
9031         (Stub_table::set_final_data_size): Use current data size as the
9032         final data size.
9033         (Stub_table::relocate_stub): Change parameter type of stub from
9034         Reloc_stub pointer to Stub pointer.
9035         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9036         (Stub_table::Cortex_a8_stub_list): New typedef.
9037         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9038          Stub_table::prev_addralign_): New data member.
9039         (Arm_relobj::Arm_relobj): Initialize data member
9040         section_has_cortex_a8_workaround_.
9041         (Arm_relobj::section_has_cortex_a8_workaround,
9042          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9043          definitions.
9044         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9045         declarations.
9046         (Target_arm::relocate_stub): Change parameter type of stub from
9047         Reloc_stub pointer to Stub pointer.
9048         (Insn_template::size, Insn_template::alignment): Handle
9049         THUMB16_SPECIAL_TYPE.
9050         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9051          Stub_table::update_data_size_and_addralign,
9052          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9053         definitions.
9054         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9055         (Stub_table::do_write): Ditto.
9056         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9057
9058 2010-01-08  Ian Lance Taylor  <iant@google.com>
9059
9060         PR 11108
9061         * symtab.h (class Symbol): Remove fields is_target_special_ and
9062         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9063         (Symbol::is_defined_in_discarded_section): New function.
9064         (Symbol::set_is_defined_in_discarded_section): New function.
9065         (Symbol::has_plt_offset): Rewrite.
9066         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9067         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9068         Don't initialize is_target_special_ or has_plt_offset_.
9069         Initialize is_defined_in_discarded_section_.
9070         (Symbol_table::add_from_relobj): If appropriate, set
9071         is_defined_in_discarded_section.
9072         * resolve.cc (Symbol::override_base_with_special): Don't test
9073         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9074         * target-reloc.h (relocate_section): Do special handling for
9075         symbols defined in discarded sections for global symbols as well
9076         as local symbols.
9077
9078 2010-01-08  Ian Lance Taylor  <iant@google.com>
9079
9080         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9081         the SHT_SYMTAB case.
9082
9083 2010-01-08  Ian Lance Taylor  <iant@google.com>
9084
9085         * object.cc (Sized_relobj::do_layout): Don't get confused if
9086         layout_eh_frame returns NULL.
9087
9088 2010-01-08  Ian Lance Taylor  <iant@google.com>
9089
9090         PR 11084
9091         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9092         dynamic symbol table, use the normal symbol table.
9093         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9094         symbol table.
9095
9096 2010-01-08  Ian Lance Taylor  <iant@google.com>
9097
9098         PR 11072
9099         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9100         sections.
9101
9102 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9103
9104         * version.cc (print_version): Change to "Copyright 2010".
9105
9106 2010-01-08  Ian Lance Taylor  <iant@google.com>
9107
9108         PR 10287
9109         PR 11063
9110         * i386.cc (class Target_i386): Change return type of plt_section
9111         to be non-const.
9112         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9113         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9114         tls_desc_rel_ field.
9115         (Output_data_plt_i386::rel_tls_desc): New function.
9116         (Target_i386::rel_tls_desc_section): New function.
9117         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9118         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9119         R_386_TLS_DESC reloc in rel_tls_desc_section.
9120         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9121         Define struct Tlsdesc_info.
9122         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9123         (Target_x86_64::do_reloc_symbol_index): New function.
9124         (Target_x86_64::add_tlsdesc_info): New function.
9125         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9126         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9127         tlsdesc_rel_ field.
9128         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9129         all callers.
9130         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9131         (Target_x86_64::rela_tlsdesc_section): New function.
9132         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9133         handling.
9134         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9135         (Target_x86_64::do_reloc_addend): New function.
9136         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9137         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9138         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9139         (Output_reloc::type): New function.
9140         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9141         (Output_reloc::is_target_specific): New function.
9142         (Output_reloc::target_arg): New function.
9143         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9144         absolute relocs and target specific relocs.
9145         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9146         add_target_specific.
9147         (class Output_data_reloc) [SHT_RELA]: Likewise.
9148         * output.cc (Output_reloc::Output_reloc): Add four new versions
9149         for absolute relocs and target specific relocs.
9150         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9151         (Output_reloc::get_symbol_index): Likewise.
9152         (Output_reloc::local_section_offset): Check that local_sym_index_
9153         is not TARGET_CODE or 0.
9154         (Output_reloc::symbol_value): Likewise.
9155         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9156         reloc.
9157         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9158         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9159         functions.
9160         * layout.cc (add_target_dynamic_tags): Use output section for
9161         DT_PLTRELSZ and DT_JMPREL.
9162
9163 2010-01-07  Ian Lance Taylor  <iant@google.com>
9164
9165         PR 11061
9166         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9167         function.
9168         (class Output_data_reloc_generic): Define.
9169         (class Output_data_reloc_base): Change base class to
9170         Output_data_reloc_generic.  Change add() method to call
9171         bump_relative_reloc_count for a relative reloc.  Remove
9172         sort_relocs_ field.
9173         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9174         to sort_relocs().
9175         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9176         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9177         appropriate.
9178         * layout.h (class Layout): Update declaration.
9179
9180 2010-01-07  Ian Lance Taylor  <iant@google.com>
9181
9182         * output.h (class Output_data): Add const version of
9183         output_section and do_output_section.
9184         (class Output_section_data): Add const version of
9185         do_output_section.
9186         (class Output_section): Likewise.
9187         * layout.cc (Layout::add_target_dynamic_tags): New function.
9188         * layout.h (class Layout): Update declarations.
9189         * arm.cc (Target_arm::do_finalize_sections): Use
9190         add_target_dynamic_tags.
9191         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9192         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9193         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9194         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9195
9196 2010-01-07  Ian Lance Taylor  <iant@google.com>
9197
9198         PR 11042
9199         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9200         object as needed.
9201
9202 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9203             Ian Lance Taylor  <iant@google.com>
9204
9205         PR 11019
9206         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9207         Xindex::read_symtab_xindex.
9208
9209 2010-01-07  Doug Kwan  <dougkwan@google.com>
9210
9211         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9212         (Insn_template::thumb16_bcond_insn): New method declaration.
9213         (Insn_template): Fix spelling.
9214         (Stub::thumb16_special): New method declaration.
9215         (Stub::do_write): Define virtual method which was previously pure
9216         virtual.
9217         (Stub::do_thumb16_special): New method declaration.
9218         (Stub::do_fixed_endian_write): New template member.
9219         (Reloc_stub::do_write): Remove.
9220         (Reloc_stub::do_fixed_endian_write): Remove.
9221         (Cortex_a8_stub): New class definition.
9222         (Stub_factory::make_cortex_a8_stub): New method definition.
9223         (Stub_factory::Stub_factory): Add missing static storage class
9224         qualifier for elf32_arm_stub_a8_veneer_blx.
9225
9226 2010-01-07  Ian Lance Taylor  <iant@google.com>
9227
9228         PR 10980
9229         * options.h (class General_options): Add --warn-unresolved-symbols
9230         and --error-unresolved-symbols.
9231         * errors.cc (Errors::undefined_symbol): Implement
9232         --warn-unresolved-symbols.
9233
9234         * options.h (class General_options): Add -z text and -z textoff.
9235         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9236
9237 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9238
9239         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9240         (Garbage_collection::cident_sections): New function.
9241         (Garbage_collection::add_cident_section): New function.
9242         (Garbage_collection::cident_sections_): New member.
9243         (gc_process_relocs): Add references to sections whose names are C
9244         identifiers.
9245         * gold.h (cident_section_start_prefix): New constant.
9246         (cident_section_stop_prefix): New constant.
9247         (is_cident): New function.
9248         * layout.cc (Layout::define_section_symbols): Replace string constants
9249         with the newly defined constants.
9250         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9251         C identifiers.
9252         * testsuite/Makefile.am: Add gc_orphan_section_test.
9253         * testsuite/Makefile.in: Regenerate.
9254         * testsuite/gc_orphan_section_test.cc: New file.
9255         * testsuite/gc_orphan_section_test.sh: New file.
9256
9257 2010-01-06  Ian Lance Taylor  <iant@google.com>
9258
9259         PR 10980
9260         * options.h (class General_options): Add --warn-shared-textrel.
9261         * layout.cc (Layout::finish_dynamic_section): Implement
9262         --warn-shared-textrel.
9263
9264         PR 10980
9265         * options.h (class General_options): Add --warn-multiple-gp.
9266
9267 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9268
9269         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9270         $(THREADSLIB) and $(LIBDL).
9271         * Makefile.in: Rebuild.
9272
9273 2010-01-06  Ian Lance Taylor  <iant@google.com>
9274
9275         PR 10980
9276         * options.cc (General_options::parse_section_start): New function.
9277         (General_options::section_start): New function.
9278         (General_options::General_options): Initialize all members.
9279         * options.h: Include <map>
9280         (class General_options): Add --section-start.  Add section_starts_
9281         member.
9282         * layout.cc (Layout::attach_allocated_section_to_segment): If
9283         --section-start was used, set the address of the segment.  Remove
9284         local sort_sections.
9285         (Layout::relaxation_loop_body): If the address of the load segment
9286         has been set by --section-start, don't use it.
9287         * output.h (Output_segment::update_flags_for_output_section): New
9288         function.
9289         * output.cc (Output_segment::add_output_section): Call
9290         update_flags_for_output_section.
9291
9292 2010-01-05  Ian Lance Taylor  <iant@google.com>
9293
9294         PR 10980
9295         * options.h (class General_options): Add --undefined-version.
9296         * script.cc (struct Version_expression): Add was_matched_by_symbol
9297         field.
9298         (Version_script_info::matched_symbol): New function.
9299         (Version_script_info::get_symbol_version_helper): Call
9300         matched_symbol.
9301         (Version_script_info::check_unmatched_names): New function.
9302         * script.h (class Version_script_info): Update declarations.
9303         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9304
9305         * options.h (class General_options): Use DEFINE_bool_alias for
9306         allow_multiple_definition.
9307         * resolve.cc (Symbol_table::should_override): Don't test
9308         allow_multiple_definition.
9309
9310         PR 10980
9311         * options.h (class General_options): Add --cref.
9312         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9313         until after printing cref table.
9314         * cref.cc: Include "symtab.h".
9315         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9316         (Cref_table_compare::operator()): New function.
9317         (Cref_inputs::gather_cref): New function.
9318         (filecol): New static const.
9319         (Cref_inputs::print_cref): New function.
9320         (Cref::print_cref): New function.
9321         * cref.h: Include <cstdio>.
9322         (class Cref): Update declarations.
9323         * mapfile.h (Mapfile::file): New function.
9324         * object.h (class Object): Define Symbols.  Declare virtual
9325         do_get_global_symbols.
9326         (Object::get_global_symbols): New function.
9327         * object.cc (Input_objects::add_object): Pass object to cref_ if
9328         --cref.
9329         (Input_objects::archive_start): Likewise.
9330         (Input_objects::archive_stop): Likewise.
9331         (Input_objects::print_cref): New function.
9332         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9333         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9334         --cref.
9335         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9336         function.
9337         * plugin.h (class Sized_pluginobj): Update declarations.
9338
9339 2010-01-05  Ian Lance Taylor  <iant@google.com>
9340
9341         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9342         to is_default_version.  Rename insdef to insdefault.
9343         (Symbol_table::add_from_relobj): Rename def to is_default_version
9344         and local to is_forced_local.
9345         (Symbol_table::add_from_pluginobj): Likewise.
9346         (Symbol_table::add_from_dynobj): Likewise.
9347         (Symbol_table::define_special_symbol): Rename insdef to
9348         insdefault.
9349
9350 2010-01-04  Ian Lance Taylor  <iant@google.com>
9351
9352         PR 10980
9353         * options.h (class General_options): Add
9354         --allow-multiple-definition and -z muldefs.
9355         * resolve.cc (Symbol_table::should_override): Don't warn about a
9356         multiple symbol definition if --allow-multiple-definition or -z
9357         muldefs.
9358
9359         PR 10980
9360         * options.h (class General_options): Add --add-needed and
9361         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9362         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9363         error if --copy-dt-needed-entries aka --add-needed is used and
9364         would cause a change in behaviour.
9365
9366         PR 10980
9367         * options.h (class General_options): Add -G as a short version of
9368         --shared.  Add no-op options -assert, -g, and -i.
9369
9370 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9371
9372         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9373         check for .text or .gnu.linkonce.t sections.
9374         * icf.cc (Icf::find_identical_sections): Ditto.
9375         Change the detection for mangled function name within the section
9376         name.
9377         * icf.h (is_section_foldable_candidate): New function.
9378
9379 2009-12-30  Ian Lance Taylor  <iant@google.com>
9380
9381         PR 10980
9382         * options.h (class General_options): Permit two dashes with
9383         --retain-symbols-file.
9384
9385 2009-12-30  Ian Lance Taylor  <iant@google.com>
9386
9387         PR 10979
9388         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9389         don't put the file header and segment headers in the text
9390         segment.
9391
9392         PR 10979
9393         * common.cc (Sort_commons::operator()): Stabilize sort when both
9394         entries are NULL.
9395         (Symbol_table::do_allocate_commons_list): When allocating common
9396         symbols, skip a symbol which is no longer common.
9397         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9398         an object before checking its type.
9399         * testsuite/common_test_2.c: New file.
9400         * testsuite/common_test_3.c: New file.
9401         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9402         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9403         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9404         (common_test_2_pic.o, common_test_2.so): New targets.
9405         (common_test_3_pic.o, common_test_3.so): New targets.
9406         * testsuite/Makefile.in: Rebuild.
9407
9408         PR 10979
9409         * script.cc (read_input_script): If we see a new SECTIONS clause,
9410         and we have added an input section, give an error.
9411         * layout.h (class Layout): Add have_added_input_section function.
9412         Add have_added_input_section_ field.
9413         * layout.cc (Layout::Layout): Initialize
9414         have_added_input_section_.
9415         (Layout::layout): Set have_added_input_section_.
9416         (Layout::layout_eh_frame): Likewise.
9417
9418 2009-12-30  Ian Lance Taylor  <iant@google.com>
9419
9420         PR 10931
9421         * options.h (class General_options): Add --sort-common option.
9422         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9423         * common.cc (Sort_common): Add sort_order parameter to
9424         constructor.  Add sort_order_ field.
9425         (Sort_commons::operator): Check sort_order_.
9426         (Symbol_table::allocate_commons): Determine the sort order.
9427         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9428         Change all callers.
9429         (Symbol_table::do_allocate_commons_list): Likewise.
9430
9431 2009-12-30  Ian Lance Taylor  <iant@google.com>
9432
9433         PR 10916
9434         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9435         symbols from this object, don't change the visibility of an
9436         undefined symbol.
9437         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9438
9439 2009-12-30  Ian Lance Taylor  <iant@google.com>
9440
9441         PR 10861
9442         * script.h (class Version_script_info): Define Language enum.
9443         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9444         new fields globals_, locals_, and is_finalized_.
9445         * script.cc: Various formatting fixes.
9446         (class Parser_closure): Change language_stack_ from a vector of
9447         std::string to one of Version_script_info::Language.  Adjust all
9448         uses accordingly.
9449         (class Lazy_demangler): Remove.
9450         (struct Version_expression): Change language from std::string to
9451         Version_script_info::Language.
9452         (Version_script_info::Version_script_info): New function.
9453         (Version_script_info::~Version_script_info): Don't call clear.
9454         (Version_script_info::finalize): New function.
9455         (Version_script_info::build_lookup_tables): New function.
9456         (Version_script_info::build_expression_list_lookup): New
9457         function.
9458         (Version_script_info::get_symbol_version_helper): Rewrite to use
9459         lookup tables.
9460         (Version_script_info::print_expression_list): Adjust to use
9461         Version_script_info::Language.
9462         (script_push_lex_into_version_mode): Check that the version script
9463         has not been finalized.
9464         (version_script_push_lang): Change language string to
9465         Version_script_info::Language.
9466         * options.cc (Command_line::version_script): New function.
9467         * options.h (class General_options): Add finalize_dynamic_list
9468         function.  Change version_script from declaration to definition.
9469         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9470         * testsuite/version_script.map: Remove duplicate def of foo.
9471         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9472         version_script.map.
9473         * testsuite/Makefile.in: Rebuild.
9474
9475 2009-12-30  Ian Lance Taylor  <iant@google.com>
9476
9477         PR 10843
9478         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9479         if the input symbol index is 0, make the output symbol index 0.
9480
9481 2009-12-30  Ian Lance Taylor  <iant@google.com>
9482
9483         PR 10670
9484         * options.h (class General_options): Add -x/--discard-all.
9485         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9486         --discard-all.  If the local symbol needs a dynamic entry, check
9487         that before handling --discard-locals.
9488
9489 2009-12-30  Ian Lance Taylor  <iant@google.com>
9490
9491         PR 10450
9492         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9493         flags to PF_R.
9494         (Output_segment::add_output_section): Don't change the flags if
9495         the type is PT_TLS.
9496
9497         PR 10450
9498         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9499         GNU hash table if they need a dynamic value.  Otherwise, don't add
9500         them if they are defined in a dynamic object or are forced local.
9501
9502 2009-12-29  Ian Lance Taylor  <iant@google.com>
9503
9504         PR 10450
9505         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9506         .gnu.hash table for a 32-bit target.
9507
9508         PR 10450
9509         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9510         regular and a dynamic object only needs a dynamic symbol table
9511         entry if it is externally visible.
9512
9513         PR 10450
9514         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9515         constructor.  Add global_offset_table_ field.
9516         (Target_i386::got_section): Set global_offset_table_.
9517         (Target_i386::do_finalize_sections): Set global_offset_table_
9518         size.
9519         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9520         in constructor.  Add global_offset_table_ field.
9521         (Target_x86_64::got_section): Set global_offset_table_.
9522         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9523         size.
9524
9525         * layout.cc (Layout::Layout): Initialize increase_relro_.
9526         (Layout::get_output_section): Add is_relro, is_last_relro, and
9527         is_first_non_relro parameters.  Change all callers.
9528         (Layout::choose_output_section): Likewise.
9529         (Layout::add_output_section_data): Likewise.
9530         (Layout::make_output_section): Likewise.
9531         (Layout::set_segment_offsets): Clear increase_relro when using a
9532         linker script.
9533         * layout.h (class Layout): Add increase_relro method.  Add
9534         increase_relro_ field.  Update declarations.
9535         * output.cc (Output_section::Output_section): Initialize
9536         is_last_relro_ and is_first_non_relro_.
9537         (Output_segment::add_output_section): Group relro sections is
9538         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9539         (Output_segment::maximum_alignment): Remove relro handling.
9540         (Output_segment::set_section_addresses): Add increase_relro
9541         parameter.  Change all callers.  Add initial alignment to align
9542         relro sections on separate page.  Remove old relro handling.
9543         (Output_segment::set_section_list_addresses): Remove in_relro
9544         parameter.  Change all callers.
9545         (Output_segment::set_offset): Add increase parameter.  Change all
9546         callers.  Remove old relro handling.
9547         * output.h (class Output_section): Add new methods: is_last_relro,
9548         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9549         Add is_last_relro_ and is_first_non_relro_ fields.
9550         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9551         Create separate .got.plt section.  Call increase_relro.
9552         * x86_64.cc (Target_x86_64::got_section): Likewise.
9553         * testsuite/relro_script_test.t: Add .got.plt.
9554
9555         PR 10450
9556         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9557         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9558         (Layout::finalize): Call set_dynamic_symbol_size.
9559         (Layout::set_dynamic_symbol_size): New function.
9560         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9561         set_dynamic_symbol_size.
9562
9563         PR 10450
9564         * output.h (class Output_section): Add is_entsize_zero_ field.
9565         * output.cc (Output_section::Output_section): Initialize
9566         is_entsize_zero_.
9567         (Output_section::set_entsize): If two different entsizes are
9568         requested, force it to zero.
9569         (Output_section::add_input_section): Set flags for .debug_str
9570         before updating section flags.  Set entsize.
9571         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9572         and SHF_STRING if all input sections have those flags.
9573
9574 2009-12-29   Rafael Espindola  <espindola@google.com>
9575
9576         * main.cc (main): Fix the sys time reporting.
9577         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9578         reporting.
9579
9580 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9581
9582         * options.cc (General_options::parse_version): Allow -v to exit
9583         without an error if there is nothing to link.
9584
9585 2009-12-29  Ian Lance Taylor  <iant@google.com>
9586
9587         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9588         using a version of gcc before 4.1.
9589         * configure: Rebuild.
9590
9591 2009-12-28  Chris Demetriou  <cgd@google.com>
9592
9593         * attributes.cc (Output_attributes_section_data::do_write): Use
9594         std::vector::front rather than std::vector::data.
9595
9596 2009-12-28  Ian Lance Taylor  <iant@google.com>
9597
9598         * symtab.h (class Symbol_table): Add enum Defined.
9599         * resolve.cc (Symbol_table::should_override): Add defined
9600         parameter.  Change all callers.  Test whether object is NULL
9601         before calling a method on it.
9602         (Symbol_table::report_resolve_problem): Add defined parameter.
9603         Change all callers.
9604         (Symbol_table::should_override_with_special): Likewise.
9605         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9606         parameter.  Change all callers.
9607         (Symbol_table::do_define_in_output_data): Likewise.
9608         (Symbol_table::define_in_output_segment): Likewise.
9609         (Symbol_table::do_define_in_output_segment): Likewise.
9610         (Symbol_table::define_as_constant): Likewise.
9611         (Symbol_table::do_define_as_constant): Likewise.
9612         * script.h (class Symbol_assignment): Add is_defsym parameter to
9613         constructor; change all callers.
9614         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9615         parameter.  Change all callers.  Add is_defsym_ field.
9616         (class Parser_closure): Add parsing_defsym parameter to
9617         constructor; change all callers.  Add parsing_defsym accessor
9618         function.  Add parsing_defsym_ field.
9619
9620 2009-12-28  Ian Lance Taylor  <iant@google.com>
9621
9622         * gold.cc (queue_middle_tasks): Fix formatting.
9623         * object.cc (Relobj::is_section_name_included): Likewise.
9624
9625 2009-12-23  Ian Lance Taylor  <iant@google.com>
9626
9627         * i386.cc (Target_i386::do_calls_non_split): Recognize
9628         -fsplit-stack prologue for a function with a static chain.
9629         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9630         -fsplit-stack prologue when using %r11.
9631
9632 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9633
9634         * options.cc (General_options::parse_version): Make -v continue and do
9635         the link like GNU ld does.
9636
9637 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9638
9639         * Makefile.am (CCFILES): Add timer.cc.
9640         (HFILES): Add timer.h.
9641         * configure.ac: Check for sysconf and times.
9642         * main.cc: include timer.h.
9643         (main): Use Timer instead of get_run_time.
9644         * timer.cc: New.
9645         * timer.h: New.
9646         * workqueue.cc: include timer.h.
9647         (Workqueue::find_and_run_task):
9648         Report user, sys and wall time.
9649         * Makefile.in: Regenerate.
9650         * config.in: Regenerate.
9651         * configure: Regenerate.
9652
9653 2009-12-16  Doug Kwan  <dougkwan@google.com>
9654
9655         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9656         sections.
9657         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9658         relaxed input sections.
9659         * output.cc (Output_section::find_relaxed_input_section): Change
9660         return type to Output_relaxed_input_section pointer.  Adjust code
9661         for new type of relaxed_input_section_map_.
9662         * output.h (Output_section::find_relaxed_input_section): Change
9663         return type to Output_relaxed_input_section pointer.
9664         (Output_section::Output_relaxed_input_section_by_input_section_map):
9665         New type.
9666         (Output_section::relaxed_input_section_map_): Change type to
9667         Output_section::Output_relaxed_input_section_by_input_section_map.
9668         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9669         input section.
9670
9671 2009-12-15  Ian Lance Taylor  <iant@google.com>
9672
9673         * layout.cc (Layout::create_shstrtab): Only write out after input
9674         sections if we are compressing debug sections.
9675
9676 2009-12-15  Ian Lance Taylor  <iant@google.com>
9677
9678         * archive.cc (Archive::add_symbols): Only look up a symbol without
9679         a version if there is, in fact, a version.
9680
9681 2009-12-14  Ian Lance Taylor  <iant@google.com>
9682
9683         Revert -Wshadow changes, all changes from:
9684         2009-12-11  Doug Kwan  <dougkwan@google.com>
9685         2009-12-11  Nick Clifton  <nickc@redhat.com>
9686         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9687
9688 2009-12-11  Doug Kwan  <dougkwan@google.com>
9689
9690         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9691         due to -Wshadow.
9692         * attributes.cc (Object_attribute::size): Ditto.
9693         (Attributes_section_data::size): Ditto.
9694         (Attributes_section_data::Attributes_section_data): Ditto.
9695         (Output_attributes_section_data::do_write): Ditto.
9696         * attributes.h (Object_attribute::set_type): Ditto.
9697         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9698
9699 2009-12-11  Nick Clifton  <nickc@redhat.com>
9700
9701         * archive.cc: Fix shadowed variable warnings.
9702         * arm.cc: Likewise.
9703         * compressed_output.cc: Likewise.
9704         * compressed_output.h: Likewise.
9705         * configure: Likewise.
9706         * dwarf_reader.cc: Likewise.
9707         * dynobj.cc: Likewise.
9708         * dynobj.h: Likewise.
9709         * ehframe.cc: Likewise.
9710         * ehframe.h: Likewise.
9711         * errors.cc: Likewise.
9712         * expression.cc: Likewise.
9713         * fileread.cc: Likewise.
9714         * fileread.h: Likewise.
9715         * freebsd.h: Likewise.
9716         * i386.cc: Likewise.
9717         * icf.cc: Likewise.
9718         * incremental.h: Likewise.
9719         * layout.cc: Likewise.
9720         * layout.h: Likewise.
9721         * mapfile.cc: Likewise.
9722         * merge.cc: Likewise.
9723         * merge.h: Likewise.
9724         * object.cc: Likewise.
9725         * object.h: Likewise.
9726         * options.h: Likewise.
9727         * output.cc: Likewise.
9728         * output.h: Likewise.
9729         * parameters.cc: Likewise.
9730         * plugin.cc: Likewise.
9731         * powerpc.cc: Likewise.
9732         * reduced_debug_output.cc: Likewise.
9733         * reduced_debug_output.h: Likewise.
9734         * reloc.cc: Likewise.
9735         * reloc.h: Likewise.
9736         * resolve.cc: Likewise.
9737         * script-sections.cc: Likewise.
9738         * script.cc: Likewise.
9739         * script.h: Likewise.
9740         * sparc.cc: Likewise.
9741         * symtab.cc: Likewise.
9742         * symtab.h: Likewise.
9743         * target-select.cc: Likewise.
9744         * target-select.h: Likewise.
9745         * token.h: Likewise.
9746         * workqueue.cc: Likewise.
9747         * workqueue.h: Likewise.
9748         * x86_64.cc: Likewise.
9749
9750 2009-12-10  Doug Kwan  <dougkwan@google.com>
9751
9752         * arm.cc (attributes.h): New include.
9753         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9754         (Arm_relobj::~Arm_relobj): Delete object pointed by
9755         attributes_section_data_.
9756         (Arm_relobj::attributes_section_data): New method definition.
9757         (Arm_relobj::attributes_section_data_): New data member declaration.
9758         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9759         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9760         attributes_section_data_.
9761         (Arm_dynobj::attributes_section_data): New method definition.
9762         (Arm_dynobj::attributes_section_data_): New data member declaration.
9763         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9764         initialization value of may_use_blx_ to false.
9765         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9766         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9767         object attributes to compute results instead of hard-coding.
9768         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9769         Target_arm::get_secondary_compatible_arch,
9770         Target_arm::set_secondary_compatible_arch
9771         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9772         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9773         New method declarations.
9774         (Target_arm::get_aeabi_object_attribute): New method definition.
9775         (Target_arm::attributes_section_data_): New data member declaration.
9776         (read_arm_attributes_section): New template definition.
9777         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9778         (Arm_dynobj::do_read_symbols): Ditto.
9779         (Target_arm::do_finalize_sections): Merge attributes sections from
9780         input.  Check for BLX use after attributes section merging.
9781         Fix __exidx_start and __exidx_end visibility.  Create an
9782         .ARM.attributes section if necessary.
9783         (Target_arm::get_secondary_compatible_arch,
9784         Target_arm::set_secondary_compatible_arch,
9785         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9786         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9787         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9788         New method definitions.
9789
9790 2009-12-09  Ian Lance Taylor  <iant@google.com>
9791
9792         * plugin.cc (Plugin::load): Don't cast from void* to a function
9793         pointer.
9794
9795 2009-12-09  Ian Lance Taylor  <iant@google.com>
9796
9797         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9798         information fields.
9799
9800 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9801
9802         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9803         Replace two_file_shared_1.so with two_file_shared_2.so.
9804         * testsuite/Makefile.in: Regenerated.
9805
9806 2009-12-08  Doug Kwan  <dougkwan@google.com>
9807
9808         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9809         (HFILES): Add attributes.h and int_encoding.h.
9810         * Makefile.in: Regenerate.
9811         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9812         function definitions to int_encoding.cc
9813         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9814         prototypes to int_encoding.h
9815         * reduced_debug_output.cc (int_encoding.h): New include.
9816         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9817         function definitions to int_encoding.cc
9818         (insert_into_vector, read_from_pointer): Move template definitions to
9819         int_encoding.h
9820         * attributes.cc: New file.
9821         * attributes.h: New file.
9822         * int_encoding.cc: New file.
9823         * int_encoding.h: New file.
9824
9825 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9826
9827         PR gold/11055
9828         * incremental-dump.cc (dump_incremental_inputs): New.
9829         (main): Use dump_incremental_inputs.
9830
9831 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9832
9833         PR gold/10893
9834         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9835         checking elfcpp::STT_FUNC.
9836         (Target_i386::Relocate::relocate): Likewise.
9837         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9838
9839         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9840         symbols from shared libraries into normal FUNC symbols.
9841
9842         * symtab.h (Symbol): Add is_func and use it.
9843
9844 2009-12-05  Doug Kwan  <dougkwan@google.com>
9845
9846         * arm.cc (Target_arm::arm_info): Initialize new fields
9847         attributes_section and attributes_vendor.
9848         * i386.cc (Target_i386::i386_info): Same.
9849         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9850         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9851         fields attributes_section and attributes_vendor.
9852         * sparc.cc (Target_sparc::sparc_info): Same.
9853         * target.h (Target::attributes_section, Target::attributes_vendor,
9854         Target::is_attributes_section, Target::attribute_arg_type,
9855         Target::attributes_order): New method definitions.
9856         (Target::Target_info::attributes_section,
9857         Target::Target_info::attributes_vendor): New fields.
9858         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9859         virtual method definitions.
9860         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9861         attributes_section and attributes_vendor.
9862         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9863
9864 2009-12-05  Doug Kwan  <dougkwan@google.com>
9865
9866         * arm.cc: Update comments about interworking and stub generation.
9867         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9868         considered as non-PIC.
9869         (Arm_relocate_functions::base_abs): Fix formatting.
9870         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9871         of function to use GOT entry address instead of offset.
9872         (Target_arm::Scan::global): Issue an error if a symbol would need a
9873         PLT does not get one because it is untyped.  Remove code to create
9874         dynamic symbols for relative branches.
9875         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9876         takes unsigned integer instead of boolean.
9877
9878 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9879
9880         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9881         (two_file_test_LDADD): Likewise.
9882         (common_test_1_LDADD): Likewise.
9883         (exception_test_LDADD) Likewise.
9884         (weak_test_LDADD): Likewise.
9885         (many_sections_test_LDADD): Likewise.
9886         (initpri1_LDADD): Likewise.
9887         (script_test_1_LDADD): Likewise.
9888         (script_test_2_LDADD): Likewise.
9889         (justsyms_LDADD): Likewise.
9890         (binary_test_LDADD): Likewise.
9891         (large_LDADD): Likewise.
9892         * testsuite/Makefile.in: Regenerated.
9893
9894 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9895
9896         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9897         (Symbol_table::override_with_special): Likewise.
9898         (Symbol_table::add_from_object): Likewise.
9899
9900 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9901
9902         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9903         Don't set the data_offset twice.
9904
9905 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9906
9907         * testsuite/Makefile.in: Regenerate.
9908
9909 2009-12-03  Doug Kwan  <dougkwan@google.com>
9910
9911         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9912         (Target_arm::do_finalize_sections): Add parameter for symbol table
9913         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9914         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9915         parameter for symbol table pointer.
9916         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9917         an additional parameter for a pointer to symbol table.
9918         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9919         parameter for a symbol table pointer.
9920         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9921         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9922         Ditto.
9923         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9924         parameter for a symbol table pointer.
9925
9926 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9927
9928         * incremental.cc (Incremental_inputs_header)
9929         (Incremental_inputs_header_write, Incremental_inputs_entry)
9930         (Incremental_inputs_entry_write): Move ...
9931         * incremental.h (Incremental_inputs_header)
9932         (Incremental_inputs_header_write, Incremental_inputs_entry)
9933         (Incremental_inputs_entry_write): here.
9934
9935 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9936
9937         * incremental.cc (make_sized_incremental_binary): Set the target.
9938         Error if it is incompatible.
9939         * output.h (Output_file): Add filename method.
9940
9941 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9942
9943         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9944         from the get_* methods.
9945
9946 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9947
9948         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9949         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9950         Write 0 for the data_offset of scripts.
9951
9952 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9953
9954         * testsuite/Makefile.am: Add the incremental_test.sh test.
9955         * testsuite/incremental_test.sh: New.
9956         * testsuite/incremental_test_1.c: New.
9957         * testsuite/incremental_test_2.c: New.
9958
9959 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9960
9961         * incremental-dump.cc (main): Fix typos.
9962
9963 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9964
9965         PR gold/11025
9966         * incremental-dump.cc (main): Use llu to print 64 bit values.
9967
9968 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9969             H.J. Lu  <hongjiu.lu@intel.com>
9970
9971         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9972         $(LIBDL).
9973         (incremental_dump_LDADD): Likewise.
9974         * Makefile.in: Regenerated.
9975
9976 2009-11-25  Doug Kwan  <dougkwan@google.com>
9977
9978         Revert:
9979
9980         2009-11-25  Doug Kwan  <dougkwan@google.com>
9981
9982                 * arm.cc (Target_arm::Target_arm): Move method definition
9983                 outside of class definition.  Add code to handle
9984                 --target1-rel, --target1-abs and --target2= options.
9985                 (Target_arm::get_reloc_reloc_type): Change method to be
9986                 non-static and const.
9987                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9988                 New data member declaration.
9989                 (Target_arm::Scan::local, Target_arm::Scan::global,
9990                 Target_arm::Relocate::relocate,
9991                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9992                 Adjust call to Target_arm::get_real_reloc_type.
9993                 (Target_arm::get_real_reloc_type): Use command line options
9994                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9995                 * options.h (--target1-rel, --target1-abs, --target2): New
9996                 ARM-only options.
9997
9998 2009-11-25  Doug Kwan  <dougkwan@google.com>
9999
10000         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10001         class definition.  Add code to handle --target1-rel, --target1-abs
10002         and --target2= options.
10003         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10004         and const.
10005         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10006         member declaration.
10007         (Target_arm::Scan::local, Target_arm::Scan::global,
10008         Target_arm::Relocate::relocate,
10009         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10010         call to Target_arm::get_real_reloc_type.
10011         (Target_arm::get_real_reloc_type): Use command line options to
10012         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10013         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10014         options.
10015
10016 2009-11-25  Doug Kwan  <dougkwan@google.com>
10017
10018         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10019         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10020         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10021         formatting.
10022         (Arm_relocate_functions::thm_call): Replace body with a call to
10023         Arm_relocate_functions::thumb_branch_common.
10024         (Arm_relocate_functions::thm_jump24,
10025         Arm_relocate_functions::thm_xpc22): New method definitions.
10026         (Arm_relocate_functions::thumb_branch_common): New method definition.
10027         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10028         operator.
10029         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10030         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10031
10032 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10033
10034         * Makefile.am: Build incremental-dump
10035         * Makefile.in: Regenerate.
10036         * incremental-dump.cc: New.
10037         * incremental.cc (Incremental_inputs_header_data,
10038         Incremental_inputs_entry_data): Move to incremental.h
10039         * incremental.h: (Incremental_inputs_header_data,
10040         Incremental_inputs_entry_data): Move from incremental.cc
10041
10042 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10043
10044         * incremental.cc (Incremental_inputs_header,
10045         Incremental_inputs_header_write, Incremental_inputs_entry,
10046         Incremental_inputs_entry_write): Add a typedef with the data type.
10047
10048 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10049
10050         * incremental.cc (Incremental_inputs_header,
10051         Incremental_inputs_header_write, Incremental_inputs_entry,
10052         Incremental_inputs_entry_write): Update comment about which
10053         type has the filed descriptions.
10054
10055 2009-11-15  Doug Kwan  <dougkwan@google.com>
10056
10057         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10058         (Arm_relocate_functions::arm_branch_common): Change method defintion
10059         in class definition to a method declaration and update list of formal
10060         parameters.
10061         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10062         Arm_relocation_functions::jump24): Adjust call to
10063         Arm_relocate_functions::arm_branch_common.  Update list of formal
10064         parameters.
10065         (Arm_relocate_functions::xpc25): New method definition.
10066         (Arm_relocate_functions::arm_branch_common): Move method defintion
10067         out from class definition.  Use stubs for mode-switching and extending
10068         branch ranges.
10069         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10070         specially.  Change code to enable use of stubs in ARM branches.
10071
10072 2009-11-10  Doug Kwan  <dougkwan@google.com>
10073
10074         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10075         in method declaration.
10076         (Target_arm::relocate_stub): New method declaration.
10077         (Target_arm::default_target): Change to return a pointer instead of
10078         a const reference.
10079         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10080         Target_arm::default_target.
10081         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10082         method definition.
10083         (Target_arm::relocate_section): Adjust view.
10084         (Target_arm::relocate_stub): New method definition.
10085
10086 2009-11-10  Doug Kwan  <dougkwan@google.com>
10087
10088         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10089         a format warning.
10090         * incremental.cc (open_incremental_binary): Initialized local
10091         variables to avoid warnings.
10092         * object.cc (make_elf_object): Ditto.
10093         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10094         a format warning.
10095
10096 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10097
10098         PR gold/10930
10099         * testsuite/plugin_test.c: Include "config.h".
10100
10101 2009-11-09  Doug Kwan  <dougkwan@google.com>
10102
10103         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10104         (arm_symbol_value): Remove.
10105         (Arm_relocate_functions::arm_branch_common,
10106         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10107         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10108         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10109         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10110         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10111         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10112         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10113         Arm_relocate_functions::thm_mobw_abs_nc,
10114         Arm_relocate_functions::thm_mov_abs,
10115         Arm_relocate_functions::movw_prel_nc,
10116         Arm_relocate_functions::thm_movt_abs,
10117         Arm_relocate_functions::movt_prel,
10118         Arm_relocate_functions::thm_movw_prel_nc,
10119         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10120         (Target_arm::Relocate::relocate): Only decompose address into two
10121         parts if relocation type uses the thumb-bit and pass the actual
10122         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10123         calls to methods in Arm_relocate_functions for this change.
10124
10125 2009-11-08  Ian Lance Taylor  <iant@google.com>
10126
10127         PR 10925
10128         * reloc.cc: Instantiate
10129         Sized_relobj::initialize_input_to_output_maps and
10130         Sized_relobj:free_input_to_output_maps.
10131
10132 2009-11-06  Ian Lance Taylor  <iant@google.com>
10133
10134         PR 10876
10135         * defstd.cc (in_segment): Set only_if_ref true for "end".
10136
10137 2009-11-06  Doug Kwan  <dougkwan@google.com>
10138
10139         * arm.cc (class Reloc_stub): Correct a comment.
10140         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10141         (Target_arm::scan_section_for_stubs): New method declaration.
10142         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10143         Change methods from private to protected.
10144         (Target_arm::do_may_relax): New method definition.
10145         (Target_arm::do_relax, Target_arm::group_sections,
10146         Target_arm::scan_reloc_for_stub,
10147         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10148         (Target_arm::arm_input_section_map_): New data member declaration.
10149         (Target_arm::scan_reloc_for_stub,
10150         Target_arm::scan_reloc_section_for_stubs,
10151         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10152         Target_arm::do_relax): New method definitions.
10153
10154 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10155
10156         * configure.ac: Check for (struct stat)::st_mtim
10157         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10158         * config.in: Regenerate.
10159         * configure: Regenerate.
10160
10161 2009-11-05  Ian Lance Taylor  <iant@google.com>
10162
10163         PR 10910
10164         * output.cc (Output_segment::add_output_section): Add missing
10165         return statement.
10166
10167 2009-11-04  Ian Lance Taylor  <iant@google.com>
10168
10169         PR 10880
10170         * object.h (class Object): Add is_needed and set_is_needed
10171         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10172         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10173         defined in a dynamic object and referenced by a regular object,
10174         set is_needed for the dynamic object.
10175         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10176         if the file is marked with as_needed and it is not needed.
10177
10178 2009-11-04  Ian Lance Taylor  <iant@google.com>
10179
10180         PR 10887
10181         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10182         tags if data is discarded by linker script.
10183         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10184         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10185         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10186         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10187
10188 2009-11-04  Ian Lance Taylor  <iant@google.com>
10189
10190         * layout.cc (Layout::get_output_section): Add is_interp and
10191         is_dynamic_linker_section parameters.  Change all callers.
10192         (Layout::choose_output_section): Likewise.
10193         (Layout::make_output_section): Likewise.
10194         (Layout::add_output_section_data): Add is_dynamic_linker_section
10195         parameter.  Change all callers.
10196         * layout.h (class Layout): Update declarations.
10197         * output.h (class Output_section): Add is_interp, set_is_interp,
10198         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10199         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10200         generate_code_fills_at_write_ to a bitfield.
10201         * output.cc (Output_section::Output_sections): Initialize new
10202         fields.
10203         (Output_segment::add_output_section): Add do_sort parameter.
10204         Change all callers.
10205
10206 2009-11-03  Ian Lance Taylor  <iant@google.com>
10207
10208         PR 10860
10209         * options.h (class General_options): Add --warn-common.
10210         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10211         merging two common symbols.
10212         (Symbol_table::should_override): Handle --warn-common when merging
10213         a common symbol with a defined symbol.  Use report_resolve_problem
10214         for multiple definitions.
10215         (Symbol_table::report_resolve_problem): New function.
10216         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10217
10218 2009-11-03  Doug Kwan  <dougkwan@google.com>
10219
10220         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10221         stub_factory_.
10222         (Target_arm::stub_factory): New method definition.
10223         (Target_arm::new_arm_input_section,
10224         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10225         Target_arm::reloc_uses_thumb_bit): New method declarations.
10226         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10227         New type definitions.
10228         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10229         member declarations.
10230         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10231         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10232         New method definitions.
10233
10234 2009-11-03  Ian Lance Taylor  <iant@google.com>
10235
10236         * options.h (class General_options): Add --warn_constructors.
10237
10238 2009-11-03  Ian Lance Taylor  <iant@google.com>
10239
10240         PR 10893
10241         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10242         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10243
10244 2009-11-03  Ian Lance Taylor  <iant@google.com>
10245
10246         PR 10895
10247         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10248         --msgid-bugs-address.
10249         (install-pdf): New target.
10250         (install-data_yes): Look up one directory to find mkinstalldirs.
10251
10252 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10253
10254         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10255         tree.
10256
10257 2009-10-30  Doug Kwan  <dougkwan@google.com>
10258
10259         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10260
10261 2009-10-30  Doug Kwan  <dougkwan@google.com>
10262
10263         * arm.cc (Stub_addend_reader): New struct template definition
10264         and partial specializations.
10265         (Stub_addend_reader::operator()): New method definition for a
10266         partially specialized template.
10267
10268 2009-10-30  Doug Kwan  <dougkwan@google.com>
10269
10270         * arm.cc (Arm_relobj::processor_specific_flags): New method
10271         definition.
10272         (Arm_relobj::do_read_symbols): New method declaration.
10273         (Arm_relobj::processor_specific_flags_): New data member declaration.
10274         (Arm_dynobj): New class definition.
10275         (Target_arm::do_finalize_sections): Add input_objects parameter.
10276         (Target_arm::do_adjust_elf_header): New method declaration.
10277         (Target_arm::are_eabi_versions_compatible,
10278         (Target_arm::merge_processor_specific_flags): New method declaration.
10279         (Target_arm::do_make_elf_object): New overloaded method definitions
10280         and declaration.
10281         (Arm_relobj::do_read_symbols): New method definition.
10282         (Arm_dynobj::do_read_symbols): Ditto.
10283         (Target_arm::do_finalize_sections): Add input_objects parameters.
10284         Merge processor-specific flags from all input objects.
10285         (Target_arm::are_eabi_versions_compatible,
10286         Target_arm::merge_processor_specific_flags,
10287         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10288         New method definitions.
10289         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10290         Input_objects pointer type parameter.
10291         * layout.cc (Layout::finalize): Pass input objects to target's.
10292         finalize_sections function.
10293         * output.cc (Output_file_header::do_sized_write): Set ELF file
10294         header's processor-specific flags.
10295         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10296         Input_objects pointer type parameter.
10297         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10298         * target.h (Input_objects): New forward class declaration.
10299         (Target::processor_specific_flags,
10300         Target::are_processor_specific_flags_sect): New method definitions.
10301         (Target::finalize_sections): Add input_objects parameter.
10302         (Target::Target): Initialize processor_specific_flags_ and
10303         are_processor_specific_flags_set_.
10304         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10305         parameter.
10306         (Target::set_processor_specific_flags): New method definition.
10307         (Target::processor_specific_flags_,
10308         Target::are_processor_specific_flags_set_): New data member
10309         declarations.
10310         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10311         Input_objects pointer type parameter.
10312
10313 2009-10-30  Doug Kwan  <dougkwan@google.com>
10314
10315         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10316
10317 2009-10-28  Ian Lance Taylor  <iant@google.com>
10318
10319         * object.h (class Relobj): Drop options parameter from
10320         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10321         do_scan_relocs, do_relocate.  Change all callers.
10322         (class Sized_relobj): Drop options parameters from
10323         do_gc_process_relocs, do_scan_relocs, do_relocate,
10324         do_relocate_sections, relocate_sections, emit_relocs_scan,
10325         emit_relocs_scan_reltype.  Change all callers.
10326         (struct Relocate_info): Remove options field and all references to
10327         it.
10328         * reloc.h (class Read_relocs): Remove options constructor
10329         parameter and options_ field.  Change all callers.
10330         (class Gc_process_relocs, class Scan_relocs): Likewise.
10331         (class Relocate_task): Likewise.
10332         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10333         all callers.
10334         (scan_relocatable_relocs): Likewise.
10335         * target.h (class Sized_target): Remove options parameter from
10336         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10337         all callers.
10338         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10339         callers.
10340         * arm.cc: Update functions to remove options parameters.
10341         * i386.cc: Likewise.
10342         * powerpc.cc: Likewise.
10343         * sparc.cc: Likewise.
10344         * x86_64.cc: Likewise.
10345         * testsuite/testfile.cc: Likewise.
10346
10347 2009-10-28  Doug Kwan  <dougkwan@google.com>
10348
10349         * arm.cc (Arm_relobj): New class definition.
10350         (Arm_relobj::scan_sections_for_stubs,
10351         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10352         New method definitions.
10353
10354 2009-10-28  Cary Coutant  <ccoutant@google.com>
10355
10356         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10357         (Plugin::cleanup_done_): New member.
10358         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10359         (Plugin_manager::cleanup_done_): Remove.
10360         (Plugin_manager::add_input_file): Edit error message.
10361         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10362         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10363
10364 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10365
10366         * fileread.cc: (File_read::View::~View): Use the new
10367         data_ownership_ filed.
10368         (File_read::~File_read): Dispose the new whole_file_view_.
10369         (File_read::open): Mmap the whole file if needed.
10370         (File_read::open): Use whole_file_view_ instead of contents_.
10371         (File_read::find_view): Use whole_file_view_ if applicable.
10372         (File_read::do_read): Use whole_file_view_ instead of contents_.
10373         (File_read::make_view): Use whole_file_view_ instead of contents_,
10374         update File_read::View::View call.
10375         (File_read::find_or_make_view): Update File_read::View::View
10376         call.
10377         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10378         remove contents_
10379         (File_read::View::Data_ownership): New enum.
10380         (File_read::View::View): Replace bool mapped_ with Data_ownership
10381         argument.
10382         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10383         (File_read::View::data_ownership_): New field.
10384         (File_read::contents_): Remove (replaced by whole_file_view_).
10385         (File_read::whole_file_view_): New field.
10386         * options.h (class General_options): Add --keep-files-mapped.
10387
10388 2009-10-27  Cary Coutant  <ccoutant@google.com>
10389
10390         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10391         * testsuite/Makefile.am (plugin_test_5): New test case.
10392         * testsuite/Makefile.in: Regenerate.
10393
10394 2009-10-25  Doug Kwan  <dougkwan@google.com>
10395
10396         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10397         from private to protected to allow access by child class.
10398         (Sized_relobj::do_relocate_sections): New method declaration.
10399         (Sized_relobj::relocate_sections): Virtualize.
10400         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10401         Sized_relobj::relocate_sections.  Instantiate template explicitly
10402         for different target sizes and endianity.
10403
10404 2009-10-24  Doug Kwan  <dougkwan@google.com>
10405
10406         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10407         (Arm_input_section::as_arm_input_section): New method.
10408         (Arm_output_section): New class definition.
10409         (Arm_output_section::create_stub_group,
10410         Arm_output_section::group_sections): New method definitions.
10411
10412 2009-10-22  Doug Kwan  <dougkwan@google.com>
10413
10414         * arm.cc (Arm_input_section): New class definition.
10415         (Arm_input_section::init, Arm_input_section:do_write,
10416         Arm_input_section::set_final_data_size,
10417         Arm_input_section::do_reset_address_and_file_offset): New method
10418         definitions.
10419
10420 2009-10-21  Doug Kwan  <dougkwan@google.com>
10421
10422         * arm.cc (Stub_table, Arm_input_section): New forward class
10423         declarations.
10424         (Stub_table): New class defintion.
10425         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10426         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10427         New method definition.
10428
10429 2009-10-21  Doug Kwan  <dougkwan@google.com>
10430
10431         * arm.cc: Update copyright comments.
10432         (Target_arm): New forward class template declaration.
10433         (Arm_address): New type.
10434         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10435         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10436         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10437         constants.
10438         (Insn_template): Same.
10439         (DEF_STUBS): New macro.
10440         (Stub_type): New enum type.
10441         (Stub_template): New class definition.
10442         (Stub): Same.
10443         (Reloc_stub): Same.
10444         (Stub_factory): Same.
10445         (Target_arm::Target_arm): Initialize may_use_blx_ and
10446         should_force_pic_veneer_.
10447         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10448         Target_arm::should_force_pic_veneer,
10449         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10450         Target_arm::using_thumb_only, Target_arm:;default_target): New
10451         method defintions.
10452         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10453         New data member declarations.
10454         (Insn_template::size, Insn_template::alignment): New method defintions.
10455         (Stub_template::Stub_template): New method definition.
10456         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10457         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10458         (Stub_factory::Stub_factory): New method definition.
10459         * gold.h (string_hash): New template.
10460         * output.h (Input_section_specifier::hash_value): Use
10461         gold::string_hash.
10462         (Input_section_specifier::string_hash): Remove.
10463         * stringpool.cc (Stringpool_template::string_hash): Use
10464         gold::string_hash.
10465
10466 2009-10-20  Doug Kwan  <dougkwan@google.com>
10467
10468         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10469         symbols of relaxed input sections.
10470         * output.h (Output_section::find_relaxed_input_section): Make
10471         method public.
10472
10473 2009-10-16  Doug Kwan  <dougkwan@google.com>
10474
10475         * dynobj.cc (Versions::Versions): Initialize version_script_.
10476         Only insert base version symbol definition for a shared object
10477         if version script defines any version versions.
10478         (Versions::define_base_version): New method definition.
10479         (Versions::add_def): Check that base version is not needed.
10480         (Versions::add_need): Define base version lazily.
10481         * dynobj.h (Versions::define_base_version): New method declaration.
10482         (Versions::needs_base_version_): New data member declaration.
10483         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10484         (check_DATA): Add no_version_test.stdout.
10485         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10486         New make rules.
10487         * testsuite/Makefile.in: Regenerate.
10488         * testsuite/no_version_test.c: New file.
10489         * testsuite/no_version_test.sh: Ditto.
10490
10491 2009-10-16  Doug Kwan  <dougkwan@google.com>
10492
10493         * expression.cc (class Segment_start_expression): New class definition.
10494         (Segment_start_expression::value): New method definition.
10495         (script_exp_function_segment_start): Return a new
10496         Segment_start_expression.
10497         * gold/script-c.h (script_saw_segment_start_expression): New function
10498         prototype.
10499         * script-sections.cc (Script_sections::Script_sections): Initialize
10500         SAW_SEGMENT_START_EXPRESSION_ to false.
10501         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10502         and -Tbbs options to specify section addresses if given in
10503         command line and no SEGMENT_START expression is seen in a script.
10504         * script-sections.h (Script_sections::saw_segment_start_expression,
10505         Script_sections::set_saw_segment_start_expression): New method
10506         definition.
10507         (Script_sections::saw_segment_start_expression_): New data member
10508         declaration.
10509         * script.cc (script_saw_segment_start_expression): New function.
10510         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10511         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10512         script_test_7.sh and script_test_8.sh.
10513         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10514         script_test_8.stdout.
10515         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10516         (script_test_6, script_test_6.stdout, script_test_7,
10517         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10518         * Makefile.in: Regenerate.
10519         * testsuite/script_test_6.sh: New file.
10520         * testsuite/script_test_6.t: Same.
10521         * testsuite/script_test_7.sh: Same.
10522         * testsuite/script_test_7.t: Same.
10523         * testsuite/script_test_8.sh: Same.
10524
10525 2009-10-16  Doug Kwan  <dougkwan@google.com>
10526
10527         * output.cc (Output_segment::set_section_list_address): Cast
10528         expressions to unsigned long long type to avoid format warnings.
10529
10530 2009-10-15  Ian Lance Taylor  <iant@google.com>
10531
10532         * script.cc (Script_options::add_symbol_assignment): Always add a
10533         dot assignment to script_sections_.
10534         * script-sections.cc (Script_sections::add_dot_assignment):
10535         Initialize if necessary.
10536
10537         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10538         program headers with no load segment if there is a linker script.
10539
10540         * layout.cc (Layout::set_segment_offsets): Align the file offset
10541         to the segment aligment for -N or -n with no load segment.
10542         * output.cc (Output_segment::add_output_section): Don't crash if
10543         the first section is a TLS section.
10544         (Output_segment::set_section_list_addresses): Print an error
10545         message if the address moves backward in a linker script.
10546         * script-sections.cc
10547         (Output_section_element_input::set_section_addresses): Don't
10548         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10549         (Orphan_output_section::set_section_addresses): Likewise.
10550
10551 2009-10-15  Doug Kwan  <dougkwan@google.com>
10552
10553         * layout.cc (Layout::finish_dynamic_section): Generate tags
10554         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10555         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10556         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10557
10558 2009-10-14  Ian Lance Taylor  <iant@google.com>
10559
10560         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10561         fields.
10562         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10563         data_shdr fields of relinfo.
10564         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10565         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10566         R_386_TLS_LDO_32, adjust based on section flags.
10567         (Target_i386::Relocate::fix_up_ldo): Remove.
10568
10569 2009-10-13  Ian Lance Taylor  <iant@google.com>
10570
10571         Add support for -pie.
10572         * options.h (class General_options): Add -pie and
10573         --pic-executable.
10574         (General_options::output_is_position_independent): Test -pie.
10575         (General_options::output_is_executable): Return true if not shared
10576         and not relocatable.
10577         (General_options::output_is_pie): Remove.
10578         * options.cc (General_options::finalize): Reject incompatible uses
10579         of -pie.
10580         * gold.cc (queue_middle_tasks): A -pie link is not static.
10581         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10582         * symtab.cc (Symbol::final_value_is_known): Return false if
10583         output_is_position_independent.
10584         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10585         output_is_position_independent.
10586         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10587         output_is_position_independent.
10588         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10589         output_is_position_independent.
10590         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10591         two_file_pie_test.
10592         (basic_pie_test.o, basic_pie_test): New targets.
10593         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10594         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10595         (two_file_pie_test): New target.
10596         * testsuite/Makefile.in: Rebuild.
10597         * README: Remove note saying that -pie is not supported.
10598
10599 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10600
10601         * options.h (class General_options): Add -init and -fini.
10602         * layout.cc (Layout::finish_dynamic_section): Emit
10603         given init and fini functions.
10604
10605 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10606
10607         * gc.h (gc_process_relocs): Check if icf is enabled using new
10608         function.
10609         * gold.cc (queue_initial_tasks): Likewise.
10610         (queue_middle_tasks): Likewise.
10611         * object.cc (do_layout): Likewise.
10612         * symtab.cc (is_section_folded): Likewise.
10613         * main.cc (main): Likewise.
10614         * reloc.cc (Read_relocs::run): Likewise.
10615         (Sized_relobj::do_scan_relocs): Likewise.
10616         * icf.cc (is_function_ctor_or_dtor): New function.
10617         (Icf::find_identical_sections): Check if function is ctor or dtor when
10618         safe icf is chosen.
10619         * options.h (General_options::icf): Change option to be an enum.
10620         (Icf_status): New enum.
10621         (icf_enabled): New method.
10622         (icf_safe_folding): New method.
10623         (set_icf_status): New method.
10624         (icf_status_): New variable.
10625         * (options.cc) (General_options::finalize): Set icf_status_.
10626         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10627         icf_test and icf_keep_unique_test to use the --icf enum flag.
10628         * testsuite/icf_safe_test.sh: New file.
10629         * testsuite/icf_safe_test.cc: New file.
10630
10631 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10632
10633         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10634         includes to gc.h and icf.h.
10635         * arm.cc: Include gc.h.
10636         * gold.cc: Likewise.
10637         * i386.cc: Likewise.
10638         * powerpc.cc: Likewise.
10639         * sparc.cc: Likewise.
10640         * x86_64.cc: Likewise.
10641         * gc.h: Include icf.h.
10642
10643 2009-10-11  Ian Lance Taylor  <iant@google.com>
10644
10645         * plugin.cc: Include "gold.h" before other header files.
10646
10647 2009-10-10  Chris Demetriou  <cgd@google.com>
10648
10649         * options.h (Input_file_argument::Input_file_type): New enum.
10650         (Input_file_argument::is_lib_): Replace with...
10651         (Input_file_argument::type_): New member.
10652         (Input_file_argument::Input_file_argument): Take Input_file_type
10653         'type' rather than boolean 'is_lib' as second argument.
10654         (Input_file_argument::is_lib): Use type_.
10655         (Input_file_argument::is_searched_file): New function.
10656         (Input_file_argument::may_need_search): Handle is_searched_file.
10657         * options.cc (General_options::parse_library): Support -l:filename.
10658         (General_options::parse_just_symbols): Update for Input_file_argument
10659         changes.
10660         (Command_line::process): Likewise.
10661         * archive.cc (Archive::get_file_and_offset): Likewise.
10662         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10663         * script.cc (read_script_file, script_add_file): Likewise.
10664         * fileread.cc (Input_file::Input_file): Likewise.
10665         (Input_file::will_search_for): Handle is_searched_file.
10666         (Input_file::open): Likewise.
10667         * readsyms.cc (Read_symbols::get_name): Likewise.
10668         * testsuite/Makefile.am (searched_file_test): New test.
10669         * testsuite/Makefile.in: Regenerate.
10670         * testsuite/searched_file_test.cc: New file.
10671         * testsuite/searched_file_test_lib.cc: New file.
10672
10673 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10674             Ian Lance Taylor  <iant@google.com>
10675
10676         * descriptor.cc: Include <cstdio> and "binary-io.h".
10677         (Descriptors::open): Open the files in binary mode always.
10678         * script.cc (Lex::get_token): Treat \r as whitespace.
10679
10680 2009-10-09  Ian Lance Taylor  <iant@google.com>
10681
10682         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10683
10684 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10685             Ian Lance Taylor  <iant@google.com>
10686
10687         * configure.ac: Check for readv function also.
10688         * fileread.cc (readv): Define if not HAVE_READV.
10689         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10690         does not exist.
10691         * config.in: Regenerate.
10692         * configure: Regenerate.
10693
10694 2009-10-09  Doug Kwan  <dougkwan@google.com>
10695
10696         * layout.cc (Layout::make_output_section): Call target hook to make
10697         ordinary output section.
10698         (Layout::finalize): Adjust parameter list of call the
10699         Target::may_relax().
10700         * layout.h (class Layout::section_list): New method.
10701         * merge.h (Output_merge_base::entsize): Change visibility to public.
10702         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10703         New methods.
10704         (Output_merge_string::do_is_string): New method.
10705         * object.cc (Sized_relobj::do_setup): renamed from
10706         Sized_relobj::set_up.
10707         * object.h (Sized_relobj::adjust_shndx,
10708         Sized_relobj::initializ_input_to_output_maps,
10709         Sized_relobj::free_input_to_output_maps): Change visibilities to
10710         protected.
10711         (Sized_relobj::setup): Virtualize.
10712         (Sized_relobj::do_setup): New method declaration.
10713         (Sized_relobj::invalidate_section_offset,
10714         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10715         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10716         * options.cc (parse_int): New function.
10717         * options.h (parse_int): New declaration.
10718         (DEFINE_int): New macro.
10719         (stub_group_size): New option.
10720         * output.cc (Output_section::Output_section): Initialize memebers
10721         merge_section_map_, merge_section_by_properties_map_,
10722         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10723         (Output_section::add_input_section): Handled deferred code-fill
10724         generation and remove an old comment.
10725         (Output_section::add_relaxed_input_section): New method definition.
10726         (Output_section::add_merge_input_section): Use merge section by
10727         properties map to speed to search.  Update merge section maps
10728         as appropriate.
10729         (Output_section::build_relaxation_map): New method definition.
10730         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10731         Same.
10732         (Output_section::relax_input_section): Renamed to
10733         Output_section::convert_input_sections_to_relaxed_sections and change
10734         interface to take a vector of pointers to relaxed sections.
10735         (Output_section::find_merge_section,
10736         Output_section::find_relaxed_input_section): New method definitions.
10737         (Output_section::is_input_address_mapped,
10738         Output_section::output_offset, Output_section::output_address):
10739         Use output section data maps to speed up searching.
10740         (Output_section::find_starting_output_address): Add comments.
10741         (Output_section::do_write,
10742         Output_section::write_to_postprocessing_buffer): Do code-fill
10743         generation as appropriate.
10744         (Output_section::get_input_sections): Invalidate relaxed input section
10745         map.
10746         (Output_section::restore_states): Adjust type of checkpoint .
10747         Invalidate relaxed input section map.
10748         * output.h (Output_merge_base): New class declaration.
10749         (Input_section_specifier): New class defintion.
10750         (class Output_relaxed_input_section) Change base class to
10751         Output_section_data_build.
10752         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10753         base class initializer.
10754         (Output_section::add_relaxed_input_section): New method declaration.
10755         (Output_section::Input_section): Change visibility to protected.
10756         (Output_section::Input_section::relobj,
10757         Output_section::Input_section::shndx): Handle relaxed input sections.
10758         Output_section::input_sections) Change visibility to protected.  Also
10759         define overload to return a non-const pointer.
10760         (Output_section::Merge_section_properties): New class defintion.
10761         (Output_section::Merge_section_by_properties_map,
10762         Output_section::Output_section_data_by_input_section_map,
10763         Output_section::Relaxation_map): New types.
10764         (Output_section::relax_input_section): Rename method to
10765         Output_section::convert_input_sections_to_relaxed_sections and change
10766         interface to take a vector of relaxed section pointers.
10767         (Output_section::find_merge_section,
10768         Output_section::find_relaxed_input_section,
10769         Output_section::build_relaxation_map,
10770         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10771         New method declarations.
10772         (Output_section::merge_section_map_
10773         Output_section::merge_section_by_properties_map_,
10774         Output_section::relaxed_input_section_map_,
10775         Output_section::is_relaxed_input_section_map_valid_,
10776         Output_section::generate_code_fills_at_write_): New data members.
10777         * script-sections.cc
10778         (Output_section_element_input::set_section_addresses): Call
10779         current_data_size and addralign methods of relaxed input sections.
10780         (Orphan_output_section::set_section_addresses): Call current_data_size
10781         and addralign methods of relaxed input sections.
10782         * symtab.cc (Symbol_table::compute_final_value): Extract template
10783         from the body of Symbol_table::sized_finalize_symbol.
10784         (Symbol_table::sized_finalized_symbol): Call
10785         Symbol_table::compute_final_value.
10786         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10787         (Symbol_table::compute_final_value): New templated method declaration.
10788         * target.cc (Target::do_make_output_section): New method defintion.
10789         * target.h (Target::make_output_section): New method declaration.
10790         (Target::relax): Add more parameters for input objects, symbol table
10791         and layout.  Adjust call to do_relax.
10792         (Target::do_make_output_section): New method declaration.
10793         (Target::do_relax): Add parameters for input objects, symbol table
10794         and layout.
10795
10796 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10797
10798         * pread.c: Include stdio.h.
10799
10800 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10801
10802         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10803         defined.
10804
10805 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10806
10807         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10808         Change read_shndx type to unsigned int.
10809         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10810         int.
10811         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10812         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10813         Change read_shndx type to unsigned int.
10814         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10815         int.
10816         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10817         * layout.cc (Layout::create_symtab_sections): Cast the result of
10818         local_symcount * symsize to off_t in the gold_assert.
10819
10820 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10821
10822         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10823         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10824         R_ARM_BASE_ABS.
10825         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10826         (Arm_relocate_functions::thm_abs5): New function.
10827         (Arm_relocate_functions::abs12): New function.
10828         (Arm_relocate_functions::abs16): New function.
10829         (Arm_relocate_functions::base_abs): New function.
10830         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10831         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10832         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10833         R_ARM_BASE_ABS.
10834         (Scan::global): Likewise.
10835         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10836         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10837         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10838         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10839         R_ARM_BASE_ABS.
10840
10841 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10842
10843         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10844         (Arm_relocate_functions::movt_prel): New function.
10845         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10846         (Arm_relocate_functions::thm_movt_prel): New function.
10847         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10848         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10849         (Scan::global, Relocate::relocate): Likewise.
10850         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10851
10852 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10853
10854         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10855         Incremental_checker.
10856         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10857         unsigned int.
10858         (class Incremental_inputs_header): New class.
10859         (Incremental_inputs_header_writer): Edit comment.
10860         (Incremental_inputs_entry): New class.
10861         (Incremental_inputs_entry_writer): Edit comment.
10862         (Sized_incremental_binary::do_find_incremental_inputs_section):
10863         Add *strtab_shndx parameter, fill it.
10864         (Sized_incremental_binary::do_check_inputs): New method.
10865         (Incremental_checker::can_incrementally_link_output_file): Use
10866         Sized_incremental_binary::check_inputs.
10867         (Incremental_inputs::report_command_line): Save command line in
10868         command_line_.
10869         * incremental.h:
10870         (Incremental_binary::find_incremental_inputs_section): New
10871         method.
10872         (Incremental_binary::do_find_incremental_inputs_section): Add
10873         strtab_shndx parameter.
10874         (Incremental_binary::do_check_inputs): New pure virtual method.
10875         (Sized_incremental_binary::do_check_inputs): Declare.
10876         (Incremental_checker::Incremental_checker): Add incremental_inputs
10877         parameter, use it to initialize incremental_inputs_.
10878         (Incremental_checker::incremental_inputs_): New field.
10879         (Incremental_checker::command_line): New method.
10880         (Incremental_checker::inputs): New method.
10881         (Incremental_checker::command_line_): New field.
10882
10883 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10884
10885         * incremental.cc: Include <cstdarg> and "target-select.h".
10886         (vexplain_no_incremental): New function.
10887         (explain_no_incremental): New function.
10888         (Incremental_binary::error): New method.
10889         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10890         method.
10891         (make_sized_incremental_binary): New function.
10892         (open_incremental_binary): New function.
10893         (can_incrementally_link_file): Add checks if output is ELF and has
10894         inputs section.
10895         * incremental.h: Include "elfcpp_file.h" and "output.h".
10896         (Incremental_binary): New class.
10897         (Sized_incremental_binary): New class.
10898         (open_incremental_binary): Declare.
10899         * object.cc (is_elf_object): Use
10900         elfcpp::Elf_recognizer::is_elf_file.
10901         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10902         * output.h (Output_file::filesize): New method.
10903
10904 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10905
10906         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10907         New function.
10908         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10909         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10910         function.
10911         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10912         function.
10913         (Arm_relocate_functions::movw_abs_nc): New function.
10914         (Arm_relocate_functions::movt_abs): New function.
10915         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10916         (Arm_relocate_functions::thm_movt_abs): New function.
10917         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10918         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10919         (Scan::global): Likewise.
10920         (Relocate::relocate): Likewise.
10921         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10922
10923 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10924
10925         * arm.cc (Arm_relocate_functions::got_prel) New function.
10926         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10927         (Relocate::relocate): Likewise.
10928         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10929
10930 2009-10-06  Ian Lance Taylor  <iant@google.com>
10931
10932         * options.h (class General_options): Define
10933         split_stack_adjust_size parameter.
10934         * object.h (class Object): Add uses_split_stack_ and
10935         has_no_split_stack_ fields.  Add uses_split_stack and
10936         has_no_split_stack accessor functions.  Declare
10937         handle_split_stack_section.
10938         (class Reloc_symbol_changes): Define.
10939         (class Sized_relobj): Define Function_offsets.  Declare
10940         split_stack_adjust, split_stack_adjust_reltype, and
10941         find_functions.
10942         * object.cc (Object::handle_split_stack_section): New function.
10943         (Sized_relobj::do_layout): Call handle_split_stack_section.
10944         * dynobj.cc (Sized_dynobj::do_layout): Call
10945         handle_split_stack_section.
10946         * reloc.cc (Sized_relobj::relocate_sections): Call
10947         split_stack_adjust for executable sections in split_stack
10948         objects.  Pass reloc_map to relocate_section.
10949         (Sized_relobj::split_stack_adjust): New function.
10950         (Sized_relobj::split_stack_adjust_reltype): New function.
10951         (Sized_relobj::find_functions): New function.
10952         * target-reloc.h: Include "object.h".
10953         (relocate_section): Add reloc_symbol_changes parameter.  Change
10954         all callers.
10955         * target.h (class Target): Add calls_non_split method.  Declare
10956         do_calls_non_split virtual method.  Declare match_view and
10957         set_view_to_nop.
10958         * target.cc: Include "elfcpp.h".
10959         (Target::do_calls_non_split): New function.
10960         (Target::match_view): New function.
10961         (Target::set_view_to_nop): New function.
10962         * gold.cc (queue_middle_tasks): Give an error if mixing
10963         split-stack and non-split-stack objects with -r.
10964         * i386.cc (Target_i386::relocate_section): Add
10965         reloc_symbol_changes parameter.
10966         (Target_i386::do_calls_non_split): New function.
10967         * x86_64.cc (Target_x86_64::relocate_section): Add
10968         reloc_symbol_changes parameter.
10969         (Target_x86_64::do_calls_non_split): New function.
10970         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10971         parameter.
10972         * powerpc.cc (Target_powerpc::relocate_section): Add
10973         reloc_symbol_changes parameter.
10974         * sparc.cc (Target_sparc::relocate_section): Add
10975         reloc_symbol_changes parameter.
10976         * configure.ac: Call AM_CONDITIONAL for the default target.
10977         * configure: Rebuild.
10978         * testsuite/Makefile.am (TEST_AS): New variable.
10979         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10980         (check_DATA): Add split_i386 and split_x86_64 files.
10981         (SPLIT_DEFSYMS): Define.
10982         (split_i386_[1234n].o): New targets.
10983         (split_i386_[124]): New targets.
10984         (split_i386_[1234r].stdout): New targets.
10985         (split_x86_64_[1234n].o): New targets.
10986         (split_x86_64_[124]): New targets.
10987         (split_x86_64_[1234r].stdout): New targets.
10988         (MOSTLYCLEANFILES): Add new executables.
10989         * testsuite/split_i386.sh: New file.
10990         * testsuite/split_x86_64.sh: New file.
10991         * testsuite/split_i386_1.s: New file.
10992         * testsuite/split_i386_2.s: New file.
10993         * testsuite/split_i386_3.s: New file.
10994         * testsuite/split_i386_4.s: New file.
10995         * testsuite/split_i386_n.s: New file.
10996         * testsuite/split_x86_64_1.s: New file.
10997         * testsuite/split_x86_64_2.s: New file.
10998         * testsuite/split_x86_64_3.s: New file.
10999         * testsuite/split_x86_64_4.s: New file.
11000         * testsuite/split_x86_64_n.s: New file.
11001         * testsuite/testfile.cc (Target_test): Update relocation_section
11002         function.
11003         * testsuite/Makefile.in: Rebuild.
11004
11005 2009-10-06  Ian Lance Taylor  <iant@google.com>
11006
11007         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11008         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11009         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11010         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11011         the address on ldo_addrs_.
11012         (Target_i386::Relocate::fix_up_ldo): New function.
11013
11014 2009-10-06   Rafael Espindola  <espindola@google.com>
11015
11016         * plugin.cc (add_input_library): New.
11017         (Plugin::load): Add add_input_library to tv.
11018         (Plugin_manager::add_input_file): Add the is_lib argument.
11019         (add_input_file): Update call to Plugin_manager::add_input_file.
11020         (add_input_library): New.
11021         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11022
11023 2009-09-30  Doug Kwan  <dougkwan@google.com>
11024
11025         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11026         symbol and call Symbol::may_need_copy_reloc to determine if
11027         a copy reloc is needed.
11028         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11029         nocopyreloc is given in command line.
11030         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11031         given in command line.
11032         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11033         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11034         of the removed Target_i386::may_need_copy_reloc.
11035         * options.h (copyreloc): New option with default value false.
11036         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11037         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11038         instead of the removed Target_powerpc::may_need_copy_reloc.
11039         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11040         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11041         instead of the removed Target_sparc::may_need_copy_reloc.
11042         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11043         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11044         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11045         instead of the removed Target_x86_64::may_need_copy_reloc.
11046
11047 2009-09-30  Ian Lance Taylor  <iant@google.com>
11048
11049         * object.h (class Object): Remove target_ field, and target,
11050         sized_target, and set_target methods.
11051         (Object::sized_target): Remove.
11052         (class Sized_relobj): Update declarations.  Remove sized_target.
11053         * object.cc (Sized_relobj::setup): Remove target parameter.
11054         Change all callers.
11055         (Input_objects::add_object): Don't do anything with the target.
11056         (make_elf_sized_object): Add punconfigured parameter.  Change all
11057         callers.  Set or test parameter target.
11058         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11059         Change all callers.
11060         * parameters.cc (Parameters::set_target): Change parameter type to
11061         be non-const.
11062         (Parameters::default_target): Remove.
11063         (set_parameters_target): Change parameter type to be non-const.
11064         (parameters_force_valid_target): New function.
11065         (parameters_clear_target): New function.
11066         * parameters.h (class Parameters): Update declarations.  Remove
11067         default_target method.  Add sized_target and clear_target
11068         methods.  Change target_ to be non-const.
11069         (set_parameters_target): Update declaration.
11070         (parameters_force_valid_target): Declare.
11071         (parameters_clear_target): Declare.
11072         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11073         as NULL if we aren't searching.
11074         (Add_symbols::run): Don't check for compatible target.
11075         * fileread.cc (Input_file::open_binary): Call
11076         parameters_force_valid_target.
11077         * gold.cc (queue_middle_tasks): Likewise.
11078         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11079         set_target on object.
11080         * dynobj.h (class Sized_dynobj): Update declarations.
11081         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11082         make_elf_object returns NULL.
11083         (Archive::include_member): Don't check whether object target is
11084         compatible.
11085         * output.cc (Output_section::add_input_section): Get target from
11086         parameters.
11087         (Output_section::relax_input_section): Likewise.
11088         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11089         parameters.
11090         (Sized_relobj::do_scan_relocs): Likewise.
11091         (Sized_relobj::relocate_sections): Likewise.
11092         * resolve.cc (Symbol_table::resolve): Likewise.
11093         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11094         parameter.  Change all callers.
11095         (Symbol_table::add_from_object): Get target from parameters.
11096         (Symbol_table::add_from_relobj): Don't check object target.
11097         (Symbol_table::add_from_dynobj): Likewise.
11098         (Symbol_table::define_special_symbol): Get target from
11099         parameters.
11100         * symtab.h (class Symbol_table): Update declaration.
11101         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11102         parameter.  Change all callers.  Clear parameter target.
11103         (Binary_test): Test target here.
11104         * testsuite/object_unittest.cc (gold_testsuite): Remove
11105         target_test_pointer parameter.  Change all callers.
11106         (Object_test): Test target here.
11107
11108 2009-09-26  Ian Lance Taylor  <iant@google.com>
11109
11110         * testsuite/initpri1.c: Don't try to use constructor priorities if
11111         compiling with gcc before 4.3.
11112
11113 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11114
11115         * testsuite/retain_symbols_file_test.sh (check_present): Change
11116         output file name to retain_symbols_file_test.stdout.
11117         (check_absent): Likewise.
11118
11119 2009-09-18  Craig Silverstein  <csilvers@google.com>
11120
11121         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11122         * options.cc: Include <cerrno> and <fstream>.
11123         (General_options::finalize): Parse -retain-symbols-file tag.
11124         * options.h: New flag.
11125         (General_options): New method should_retain_symbol, new
11126         variable symbols_to_retain.
11127         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11128         should_retain_symbol map.
11129         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11130         * testsuite/Makefile.in: Regenerate.
11131         * testsuite/retain_symbols_file_test.sh: New file.
11132
11133 2009-09-18  Nick Clifton  <nickc@redhat.com>
11134
11135         * po/es.po: Updated Spanish translation.
11136
11137 2009-09-17  Doug Kwan  <dougkwan@google.com>
11138
11139         * debug.h (DEBUG_RELAXATION): New constant.
11140         (DEBUG_ALL): Add DEBUG_RELAXATION.
11141         (debug_string_to_enum): Add relaxation debug option.
11142         * layout.cc
11143         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11144         Layout::Relaxation_debug_check::read_sections,
11145         Layout::Relaxation_debug_check::read_sections): New method definitions.
11146         (Layout::Layout): Initialize data members
11147         record_output_section_data_from_scrips_,
11148         script_output_section_data_list_ and relaxation_debug_check_.
11149         (Layout::save_segments, Layout::restore_segments,
11150         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11151         Layout::relaxation_loop_body): New method definitions.
11152         (Layout::finalize): Support relaxation.  Move section layout code to
11153         Layout::relaxation_loop_body.
11154         (Layout::set_asection_address_from_script): Move code for orphan
11155         section placement out.
11156         (Layout::place_orphan_sections_in_script): New method definition.
11157         * layout.h (Output_segment_headers, Output_file_header):
11158         New forward class declarations.
11159         (Layout::~Layout): Define.
11160         (Layout::new_output_section_data_from_script): New method definition.
11161         (Layout::place_orphan_sections_in_script): New method declaration.
11162         (Layout::Segment_states): New type declaration.
11163         (Layout::save_segments, Layout::restore_segments,
11164         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11165         Layout::relaxation_loop_body): New method declarations.
11166         (Layout::Output_section_data_list): New type declaration.
11167         (Layout::Relaxation_debug_check): New class definition.
11168         (Layout::record_output_section_data_from_script_,
11169         Layout::script_output_section_data_list_, Layout::segment_states_,
11170         Layout::relaxation_debug_check_): New data members.
11171         * output.cc: (Output_section_headers::do_size): New method definition.
11172         (Output_section_headers::Output_section_headers): Move size
11173         computation to Output_section_headers::do_size.
11174         (Output_segment_headers::do_size): New method definition.
11175         (Output_file_header::Output_file_header): Move size computation to
11176         Output_file_header::do_size and call it.
11177         (Output_file_header::do_size): New method definition.
11178         (Output_data_group::Output_data_group): Adjust call to
11179         Output_section_data.
11180         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11181         (Output_symtab_xindex::do_write): Add array bound check.
11182         (Output_section::Input_section::print_to_mapfile): Handle
11183         RELAXED_INPUT_SECTION_CODE.
11184         (Output_section::Output_section): Initialize data member checkpoint_.
11185         (Output_section::~Output_section): Delete checkpoint object pointed
11186         by checkpoint_.
11187         (Output_section::add_input_section): Always add an Input_section if
11188         relaxing.
11189         (Output_section::add_merge_input_section): Add assert.
11190         (Output_section::relax_input_section): New method definition.
11191         (Output_section::set_final_data_size): Set load address to zero for
11192         an unallocated section.
11193         (Output_section::do_address_and_file_offset_have_reset_values):
11194         New method definition.
11195         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11196         Handle relaxed input section.
11197         (Output_section::sort_attached_input_sections): Checkpoint input
11198         section list lazily.
11199         (Output_section::get_input_sections): Change type of input_sections to
11200         list of Simple_input_section pointers.  Checkpoint input section list
11201         lazily.  Also handle relaxed input sections.
11202         (Output_section::add_input_section_for_script): Take a reference to
11203         a Simple_input_section object instead of Relobj pointer and section
11204         index as parameter.  Handle relaxed input sections.
11205         (Output_section::save_states, Output_section::restore_states): New
11206         method definitions.
11207         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11208         (Output_data::is_data_size_fixed): New method definition.
11209         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11210         if it is fixed.
11211         (Output_data::address_and_file_offset_have_reset_values): New method
11212         definition.
11213         (Output_data::do_address_and_file_offset_have_reset_values): New method
11214         definition.
11215         (Output_data::set_data_size): Check that data size is not fixed.
11216         (Output_data::fix_data_size): New method definition.
11217         (Output_data::is_data_size_fixed_): New data member.
11218         (Output_section_headers::set_final_data_size): New method definition.
11219         (Output_section_headers::do_size): New method declaration.
11220         (Output_segment_headers::set_final_data_size): New method definition.
11221         (Output_segment_headers::do_size): New method declaration.
11222         (Output_file_header::set_final_data_size)::New method definition.
11223         (Output_file_header::do_size)::New method declaration.
11224         (Output_section_data::Output_section_data): Add new parameter
11225         is_data_size_fixed and use it to fix data size.
11226         (Output_data_const::Output_data_const): Adjust call to base class
11227         constructor and fix data size.
11228         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11229         base class constructor and fix data size.
11230         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11231         base class constructor and fix data size.
11232         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11233         class constructor and fix data size.
11234         (Output_data_group::set_final_data_size): New method definition.
11235         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11236         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11237         class constructor and fix data size.
11238         (Output_relaxed_input_section): New class definition.
11239         (Output_section::Simple_input_section): New class definition.
11240         (Output_section::get_input_sections): Adjust parameter list.
11241         (Output_section::add_input_section_for_script): Same.
11242         (Output_section::save_states, Output_section::restore_states,
11243         Output_section::do_address_and_file_offset_have_reset_values,
11244         (Output_section::Input_section::Input_section): Handle
11245         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11246         Output_relaxed_input_section.
11247         (Output_section::Input_section::is_input_section,
11248         Output_section::Input_section::set_output_section): Handle relaxed
11249         input section.
11250         (Output_section::Input_section::is_relaxed_input_section,
11251         Output_section::Input_section::output_section_data,
11252         Output_section::Input_section::relaxed_input_section): New method
11253         definitions.
11254         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11255         value.
11256         (Output_section::Input_section::u1_): Update comments.
11257         (Output_section::Input_section::u2_): Add new union member poris.
11258         (Output_section::Checkpoint_output_section): New classs definition.
11259         (Output_section::relax_input_section): New method declaration.
11260         (Output_section::checkpoint_): New data member.
11261         (Output_segment): Update comments.
11262         (Output_segment::Output_segment): Un-privatize copy constructor.
11263         (Output_segment::operator=): Un-privatize.
11264         * script-sections.cc (Output_section_element::Input_section_list):
11265         Change element type to Output_section::Simple_input_section.
11266         (Output_section_element_dot_assignment::set_section_addresses):
11267         Register output section data for relaxation clean up.
11268         (Output_data_exression::Output_data_expression): Adjust call to base
11269         constructor to fix data size.
11270         (Output_section_element_data::set_section_addresses): Register
11271         Output_data_expression object for relaxation clean up.
11272         (struct Input_section_info): Replace Relobj pointer and section index
11273         pair with Output_section::Simple_input_section and Convert struct to a
11274         class.
11275         (Input_section_sorter::operator()): Adjust access to
11276         Input_section_info data member to use accessors.
11277         (Output_section_element_input::set_section_addresses): Use layout
11278         parameter.  Adjust code to use Output_section::Simple_input_section
11279         and Input_secction_info classes.  Register filler for relaxation
11280         clean up.
11281         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11282         and section index pair with Output_section::Simple_input_section
11283         class.  Adjust code accordingly.
11284         (Phdrs_element::release_segment): New method definition.
11285         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11286         segment list.
11287         (Script_sections::release_segments): New method definition.
11288         * gold/script-sections.h (Script_sections::release_segments): New
11289         method declaration.
11290         * gold/target.h (Target::may_relax, Target::relax,
11291         Target::do_may_relax, Target::do_relax): New method definitions.
11292
11293 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11294
11295         * arm.cc (has_signed_unsigned_overflow): New function.
11296         (Arm_relocate_functions::abs8): New function.
11297         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11298         (Target_arm::Scan::global): Likewise.
11299         (Target_arm::relocate::relocate): Likewise.
11300         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11301         Likewise.
11302
11303 2009-09-16  Cary Coutant  <ccoutant@google.com>
11304
11305         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11306         * testsuite/Makefile.in: Regenerate.
11307
11308 2009-09-11  Nick Clifton  <nickc@redhat.com>
11309
11310         * po/gold.pot: Updated by the Translation project.
11311
11312 2009-09-08  Cary Coutant  <ccoutant@google.com>
11313
11314         * output.cc (Output_file::open): Add execute permission to empty file.
11315         * testsuite/Makefile.am (permission_test): New test.
11316         * testsuite/Makefile.in: Regenerate.
11317
11318 2009-09-02  Ian Lance Taylor  <iant@google.com>
11319
11320         * output.cc (Output_file::resize): Call map_no_anonymous rather
11321         than map.
11322
11323 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11324
11325         * gold.cc: Include "incremental.h".
11326         (queue_initial_tasks): Call Incremental_checker methods.
11327         * incremental.cc: Include "output.h".
11328         (Incremental_checker::can_incrementally_link_output_file): New
11329         method.
11330         * incremental.h (Incremental_checker): New class.
11331
11332         * output.cc (Output_file::open_for_modification): New method.
11333         (Output_file::map_anonymous): Changed return type to bool.  Record
11334         map in base_ field.
11335         (Output_file::map_no_anonymous): New method, broken out of map.
11336         (Output_file::map): Use map_no_anonymous and map_anonymous.
11337         * output.h (class Output_file): Update declarations.
11338
11339 2009-08-24  Cary Coutant  <ccoutant@google.com>
11340
11341         * options.h (Command_line::Pre_options): New class.
11342         (Command_line::pre_options): New member.
11343         * options.cc (gold::options::ready_to_register): New variable.
11344         (One_option::register_option): Do nothing if not registering options.
11345         Assert if same short option registered twice.
11346         (General_options::General_options): Turn off option registration when
11347         done constructing.
11348         (Command_line::Pre_options::Pre_options): New constructor.
11349
11350 2009-08-24  Cary Coutant  <ccoutant@google.com>
11351
11352         * options.h (General_options::no_keep_memory): Remove incorrect
11353         short option.
11354
11355 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11356
11357         * Makefile.am (am__skiplex, am__skipyacc): New.
11358         * Makefile.in: Regenerate.
11359
11360 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11361
11362         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11363         (INCLUDES): ... this.
11364         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11365         (AM_CPPFLAGS): Renamed from ...
11366         (INCLUDE): ... this.
11367         * Makefile.in, testsuite/Makefile.in: Regenerate.
11368
11369         * Makefile.in: Regenerate.
11370         * aclocal.m4: Likewise.
11371         * config.in: Likewise.
11372         * configure: Likewise.
11373         * testsuite/Makefile.in: Likewise.
11374
11375         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11376         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11377         * Makefile.in: Regenerate.
11378         * testsuite/Makefile.in: Regenerate.
11379
11380 2009-08-19  Cary Coutant  <ccoutant@google.com>
11381
11382         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11383         symbols in shared libraries overridden by hidden or internal symbols
11384         in the main program.
11385
11386 2009-08-19  Chris Demetriou  <cgd@google.com>
11387
11388         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11389         checking source file names in error messages.
11390
11391 2009-08-18  Doug Kwan  <dougkwan@google.com>
11392
11393         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11394         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11395         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11396         an elfcpp::Ehdr as parameter.
11397         * object.cc (Object::set_target): Remove the version that looks up
11398         a target and sets it.
11399         (Sized_relobj::setup): Take a Target object instead of
11400         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11401         (make_elf_sized_object): Find target and ask target to
11402         make an ELF object.
11403         * object.h: (Object::set_target): Remove the version that looks up
11404         a target and sets it.
11405         (Sized_relobj::setup): Take a Target object instead of
11406         an elfcpp:Ehdr as parameter.
11407         * target.cc: Include dynobj.h.
11408         (Target::do_make_elf_object_implementation): New.
11409         (Target::do_make_elf_object): New.
11410         * target.h (Target::make_elf_object): New template declaration.
11411         (Target::do_make_elf_object): New method declarations.
11412         (Target::do_make_elf_object_implementation): New template declaration.
11413
11414 2009-08-14  Ian Lance Taylor  <iant@google.com>
11415
11416         * gold.h (FUNCTION_NAME): Define.
11417         (gold_unreachable): Use FUNCTION_NAME.
11418
11419 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11420
11421         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11422         symbol in the --keep-unique list is not found.
11423
11424 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11425
11426         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11427         been maked as --keep-unique.
11428         (Icf::unfold_section): New function.
11429         * icf.h (Icf::unfold_section): New function.
11430         * options.h (General_options::keep_unique): New option.
11431         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11432         * testsuite/Makefile.in: Regenerate.
11433         * testsuite/icf_keep_unique_test.sh: New file.
11434         * testsuite/icf_keep_unique_test.cc: New file.
11435
11436 2009-08-12  Cary Coutant  <ccoutant@google.com>
11437
11438         PR 10471
11439         * resolve.cc (Symbol_table::resolve): Check for references from
11440         dynamic objects to hidden and internal symbols.
11441         * testsuite/Makefile.am (hidden_test.sh): New test.
11442         * testsuite/Makefile.in: Regenerate.
11443         * testsuite/hidden_test.sh: New script.
11444         * testsuite/hidden_test_1.c: New test source.
11445         * testsuite/hidden_test_main.c: New test source.
11446
11447 2009-08-11  Doug Kwan  <dougkwan@google.com>
11448
11449         * arm.cc: Update comments.
11450         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11451         segment to locate the .ARM.exidx section if present.
11452
11453 2009-08-09  Doug Kwan  <dougkwan@google.com>
11454
11455         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11456         patch.
11457
11458 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11459         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11460         compiler warnings.
11461
11462 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11463
11464         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11465         valid tls_segment only for non-debug-section relocations.
11466         * testsuite/Makefile.am: Add gc_tls_test.
11467         * testsuite/Makefile.in: Regenerate.
11468         * testsuite/gc_tls_test.cc: New file.
11469         * testsuite/gc_tls_test.sh: New file.
11470
11471 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11472
11473         * icf.cc: New file.
11474         * icf.h: New file.
11475         * Makefile.am (CCFILES): Add icf.cc.
11476         (HFILES): Add icf.h
11477         * Makefile.in: Regenerate.
11478         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11479         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11480         section, symbol and addend information for the relocs.
11481         * gold.cc (queue_middle_tasks): Call identical code folding.
11482         * gold.h: Add defines for multimap.
11483         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11484         to the call of finalize_local_symbols.
11485         * main.cc (main): Create object of class Icf.
11486         * object.cc (Sized_relobj::do_layout): Allow this function to be
11487         called twice during icf.
11488         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11489         to sections marked as identical by icf.
11490         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11491         when available.
11492         (Sized_relobj::do_section_entsize): New function.
11493         * object.h (Object::section_entsize): New function.
11494         (Object::do_section_entsize): New pure virtual function.
11495         (Relobj::finalize_local_symbols): Add new parameter.
11496         (Relobj::do_section_entsize): New function.
11497         * options.h (General_options::icf): New option.
11498         (General_options::icf_iterations): New option.
11499         (General_options::print_icf_sections): New option.
11500         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11501         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11502         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11503         icf.
11504         * symtab.cc (Symbol_table::is_section_folded): New function.
11505         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11506         to sections marked as identical by icf.
11507         * symtab.h (Symbol_table::set_icf): New function.
11508         (Symbol_table::icf): New function.
11509         (Symbol_table::is_section_folded): New function.
11510         (Symbol_table::icf_): New data member.
11511         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11512         * testsuite/Makefile.am: Add commands to build icf_test.
11513         * testsuite/Makefile.in: Regenerate.
11514         * testsuite/icf_test.sh: New file.
11515         * testsuite/icf_test.cc: New file.
11516
11517 2009-07-24  Chris Demetriou  <cgd@google.com>
11518
11519         * layout.cc (is_compressible_debug_section): Fix incorrect
11520         comment about compressed section names.
11521
11522 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11523
11524         PR 10419
11525         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11526
11527 2009-07-16  Ian Lance Taylor  <iant@google.com>
11528
11529         PR 10400
11530         * layout.h: #include <map>.
11531         (class Kept_section): Change from struct to class.  Add accessors
11532         and setters.  Add section size to Comdat_group mapping.  Change
11533         Comdat_group to std::map.  Add is_comdat_ field.  Add
11534         linkonce_size field in union.
11535         (class Layout): Update declaration of find_or_add_kept_section.
11536         Don't declare find_kept_object.
11537         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11538         parameter.  Add object, shndx, is_comdat, and is_group_name
11539         parameters.  Change all callers.  Adjust for new Kept_section.
11540         (Layout::find_kept_object): Remove.
11541         * object.cc (Sized_relobj::include_section_group): Update use of
11542         Kept_section.  Rename secnum to shndx.  Only record
11543         Kept_comdat_section if sections are the same size.
11544         (Sized_relobj::include_linkonce_section): Update use of
11545         Kept_section.  Only record Kept_comdat_section if sections are the
11546         same size.  Set size of linkonce section.
11547         (Sized_relobj::map_to_kept_section): Update call to
11548         get_kept_comdat_section.
11549         * object.h (class Sized_relobj): Rename fields in
11550         Kept_comdat_section to drop trailing underscores; change object
11551         field to Relobj*.  Change Kept_comdat_section_table to store
11552         struct rather than pointer.
11553         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11554         Add kept_object and kept_shndx parameters.  Change all callers.
11555         (Sized_relobj::get_kept_comdat_section): Change return type to
11556         bool.  Add kept_object and kept_shndx parameters.  Change all
11557         callers.
11558         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11559         Layout::find_or_add_kept_section.
11560
11561 2009-07-09  Ian Lance Taylor  <iant@google.com>
11562
11563         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11564         Reserve space in the hash table.
11565
11566 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11567
11568         * fileread.cc (File_read::get_mtime): New method.
11569         * fileread.h (Timespec): New structure.
11570         (File_read::get_mtime): New method.
11571         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11572         Renamed from timestamp_nsec.
11573         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11574         Elf_Xword.
11575         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11576         timestamp_nsec.
11577         (Incremental_inputs::report_archive): Save mtime; style fix.
11578         (Incremental_inputs::report_obejct): Save mtime; style fix.
11579         (Incremental_inputs::report_script): Save mtime; style fix.
11580         (Incremental_inputs::finalize_inputs): Style fix.
11581         (Incremental_inputs::finalize): Style fix.
11582         (Incremental_inputs::create_input_section_data): Store inputs
11583         mtime.
11584         * incremental.h (Incremental_inputs::report_script): Add mtime
11585         argument.
11586         (Incremental_inputs::Input_info::Input_info): Intialize only one
11587         union member.
11588         (Incremental_inputs::Input_info::archive): Move to nameless
11589         union.
11590         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11591         (Incremental_inputs::Input_info::script): Move to nameless union.
11592         (Incremental_inputs::mtime): New field.
11593         * script.cc (read_input_script): Pass file mtime to
11594         Incremental_input.
11595         * script.h (Script_info::inputs): Style fix.
11596
11597 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11598
11599         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11600         instead of 32.
11601
11602 2009-06-24  Ian Lance Taylor  <iant@google.com>
11603
11604         PR 10156
11605         * layout.cc (Layout::choose_output_section): If we find an
11606         existing section, update the flags.
11607         (Layout::create_notes): New function, broken out of
11608         Layout::finalize.
11609         (Layout::finalize): Don't create note sections.
11610         (Layout::create_note): Don't crash if linker script discards
11611         section.
11612         (Layout::create_gold_note): Likewise.
11613         (Layout::create_build_id): Likewise.  Don't set
11614         after_input_sections on the section.
11615         (Layout::create_executable_stack_info): Remove target parameter.
11616         Change caller.
11617         * layout.h (class Layout): Declare create_notes.  Update
11618         declaration of create_executable_stack_info.
11619         * gold.cc (queue_middle_tasks): Call create_notes.
11620         * output.cc (Output_section::update_flags_for_input_section): Move
11621         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11622         invalid.
11623         * output.h (Output_data::mark_address_invalid): New function.
11624         (class Output_section): Only declare, not define,
11625         update_flags_for_input_section.  Remove set_flags.
11626
11627 2009-06-24  Ian Lance Taylor  <iant@google.com>
11628
11629         * script-sections.cc (Output_section_definition::
11630         set_section_addresses): Rename shadowing local load_address to
11631         laddr.
11632
11633 2009-06-24  Ian Lance Taylor  <iant@google.com>
11634
11635         PR 10244
11636         * reloc.cc (relocate_sections): Skip empty relocation sections.
11637
11638 2009-06-23  Ian Lance Taylor  <iant@google.com>
11639
11640         PR 10156
11641         * layout.cc (Layout::create_note): Use choose_output_section
11642         rather than make_output_section.
11643
11644 2009-06-23  Ian Lance Taylor  <iant@google.com>
11645
11646         PR 10237
11647         * options.cc (General_options::parse_V): Set printed_version_.
11648         (General_options::General_options): Initialize printed_version_.
11649         * options.h (class General_options): Add printed_version_ field.
11650         * gold.cc (queue_initial_tasks): If there are no input files,
11651         don't give a fatal error if we printed the version information.
11652         (queue_middle_tasks): If using -r with a shared object, give a
11653         fatal error rather than an ordinary error.
11654
11655 2009-06-23  Ian Lance Taylor  <iant@google.com>
11656
11657         PR 10219
11658         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11659         (Layout::make_output_section): Set have_stabstr_section_ if we see
11660         a .stab*str section.
11661         (Layout::finalize): Call link_stabs_sections.
11662         (Layout::link_stabs_sections): New file.
11663         * layout.h (class Layout): Add have_stabstr_section_ field.
11664         Declare link_stabs_sections.
11665
11666 2009-06-23  Doug Kwan  <dougkwan@google.com>
11667
11668         * Makefile.am (libgold_a_LIBADD): New.
11669         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11670         * Makefile.in: Regenerate.
11671         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11672         * configure: Regenerate.
11673         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11674         * fileread.cc: Include sys/state.h
11675         * gold.h: Declare memmem and strndup if found missing.
11676         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11677
11678 2009-06-23  Ian Lance Taylor  <iant@google.com>
11679
11680         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11681         * configure: Rebuild.
11682
11683 2009-06-23  Ian Lance Taylor  <iant@google.com>
11684
11685         PR 10147
11686         * object.cc (Object::section_contents): Don't try to get a view if
11687         the section has length zero.
11688         (Object::handle_gnu_warning_section): If the section is empty, use
11689         the name of the section as the warning.
11690
11691 2009-06-23  Ian Lance Taylor  <iant@google.com>
11692
11693         PR 10133
11694         * stringpool.h (class Stringpool_template): Add optimize_ field.
11695         (Stringpool_template::set_optimize): New function.
11696         * stringpool.cc (Stringpool_template::Stringpool_template):
11697         Initialize optimize_ field.
11698         (Stringpool_template::set_string_offsets): Test local optimize
11699         fild rather than parameter.
11700         * layout.cc (Layout::Layout): Call set_optimize on the section
11701         name stringpool.
11702
11703 2009-06-22  Ian Lance Taylor  <iant@google.com>
11704
11705         PR 10030
11706         * yyscript.y: Parse TARGET.
11707         * script.cc (script_set_target): New function.
11708         * script-c.h (script_set_target): Declare.
11709         * options.cc (General_options::string_to_object_format): Rename
11710         from string_to_object_format in anonymous namespace.  Change
11711         callers.
11712         * options.h (class General_options): Declare
11713         string_to_object_format.
11714
11715 2009-06-22  Ian Lance Taylor  <iant@google.com>
11716
11717         * script-sections.cc (Script_sections::create_segments): Don't put
11718         program headers in a PT_LOAD segment if -n or -N.
11719
11720 2009-06-22  Ian Lance Taylor  <iant@google.com>
11721
11722         PR 10141
11723         * options.h (class General_options): Add -z lazy and -z now.  Sort
11724         -z options into alphabetical order.
11725         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11726
11727 2009-06-21  Ian Lance Taylor  <iant@google.com>
11728
11729         * layout.cc (Layout::make_output_section): Call
11730         Target::new_output_section.
11731         (Layout::attach_allocated_section_to_segment): Put large section
11732         sections in a separate load segment with the large segment flag
11733         set.
11734         (Layout::segment_precedes): Sort large data segments after other
11735         load segments.
11736         (align_file_offset): New static function.
11737         (Layout::set_segment_offsets): Use align_file_offset.
11738         * output.h (class Output_section): Add is_small_section_ and
11739         is_large_section_ fields.
11740         (Output_section::is_small_section): New function.
11741         (Output_section::set_is_small_section):  New function.
11742         (Output_section::is_large_section): New function.
11743         (Output_section::set_is_large_section): New function.
11744         (Output_section::is_large_data_section): New function.
11745         (class Output_segment): Add is_large_data_segment_ field.
11746         (Output_segment::is_large_data_segment): New function.
11747         (Output_segment::set_is_large_data_segment): New function.
11748         * output.cc (Output_section::Output_section): Initialize new
11749         fields.
11750         (Output_segment::Output_segment): Likewise.
11751         (Output_segment::add_output_section): Add assertion that large
11752         data sections always go in large data segments.  Force small data
11753         sections to the end of the list of data sections.  Force small BSS
11754         sections to the start of the list of BSS sections.  For large BSS
11755         sections to the end of the list of BSS sections.
11756         * symtab.h (class Symbol): Declare is_common_shndx.
11757         (Symbol::is_defined): Check Symbol::is_common_shndx.
11758         (Symbol::is_common): Likewise.
11759         (class Symbol_table): Define enum Commons_section_type.  Update
11760         declarations.  Add small_commons_ and large_commons_ fields.
11761         * symtab.cc (Symbol::is_common_shndx): New function.
11762         (Symbol_table::Symbol_table): Initialize new fields.
11763         (Symbol_table::add_from_object): Put small and large common
11764         symbols in the right list.
11765         (Symbol_table::sized_finalized_symbol): Check
11766         Symbol::is_common_shndx.
11767         (Symbol_table::sized_write_globals): Likewise.
11768         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11769         common symbol lists.  Don't call do_allocate_commons_list if the
11770         list is empty.
11771         (Symbol_table::do_allocate_commons_list): Remove is_tls
11772         parameter.  Add comons_section_type parameter.  Change all
11773         callers.  Handle small and large common symbols.
11774         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11775         Symbol::is_common_shndx.
11776         * resolve.cc (symbol_to_bits): Likewise.
11777         * target.h (Target::small_common_shndx): New function.
11778         (Target::small_common_section_flags): New function.
11779         (Target::large_common_shndx): New function.
11780         (Target::large_common_section_flags): New function.
11781         (Target::new_output_section): New function.
11782         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11783         small_common_section_flags, and large_common_section_flags
11784         fields.
11785         (Target::do_new_output_section): New virtual function.
11786         * arm.cc (Target_arm::arm_info): Initialize new fields.
11787         * i386.cc (Target_i386::i386_info): Likewise.
11788         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11789         Likewise.
11790         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11791         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11792         (Target_x86_64::do_new_output_section): New function.
11793         * configure.ac: Define conditional MCMODEL_MEDIUM.
11794         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11795         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11796         (large_LDFLAGS): Define.
11797         * testsuite/large.c: New file.
11798         * testsuite/testfile.cc (Target_test::test_target_info):
11799         Initialize new fields.
11800         * configure, testsuite/Makefile.in: Rebuild.
11801
11802 2009-06-05  Doug Kwan  <dougkwan@google.com>
11803
11804         * Makefile.am (CCFILES): Add target.cc.
11805         * Makefile.in: Regenerate.
11806         * i386.cc (class Target_i386): Define new virtual method to
11807         override do_is_local_label_name in parent.
11808         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11809         local symbols if --discard-locals or -X is given.
11810         * options.h (class General_options): Declare new options
11811         '--discard-locals' and '-X' for discarding locals.
11812         * target.h (class Target): Define new methods is_local_label_name.
11813         Declare new virtual method do_is_local_label_name.
11814         * target.cc: New file.
11815         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11816         (check_SCRIPTS): Add discard_locals_test.sh.
11817         (check_DATA): Add discard_local_tests.syms.
11818         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11819         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11820         * testsuite/Makefile.in: Regenerate.
11821         * testsuite/discard_locals_test.c: New file.
11822         * testsuite/discard_locals_test.sh: Same.
11823
11824 2009-06-05  Doug Kwan  <dougkwan@google.com>
11825
11826         * object.cc (Sized_relobj::Sized_relobj): Initialize
11827         discarded_eh_frame_shndx_ to -1U.
11828         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11829         section.
11830         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11831         a discarded .eh_frame section.
11832         (Sized_relobj::do_finalize_local_symbols): Ditto.
11833         * object.h (class Sized_relobj): Declare new member
11834         discarded_eh_frame_shndx_.
11835         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11836         (local_labels_test.o, local_labels_test): New rules.
11837         * testsuite/Makefile.in: Regenerate.
11838
11839 2009-06-04  Doug Kwan  <dougkwan@google.com>
11840
11841         * layout.cc (Layout::section_name_mapping): Add mapping for
11842         special ARM sections.
11843
11844 2009-06-03  Doug Kwan  <dougkwan@google.com>
11845
11846         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11847         (utils::has_overflow): Same.
11848
11849 2009-06-03  Ian Lance Taylor  <iant@google.com>
11850
11851         * layout.cc (Layout::section_name_mapping): New array, replacing
11852         Layout::linkonce_mapping.
11853         (Layout::section_name_mapping_count): New variable, replacing
11854         Layout::linkonce_mapping_count.
11855         (Layout::linkonce_output_name): Remove.
11856         (Layout::output_section_name): Rewrite.
11857         * layout.h (class Layout): Rename Linkonce_mapping to
11858         Section_name_mapping, linkonce_mapping to section_name_mapping,
11859         linkonce_mapping_count to section_name_mapping_count.  Don't
11860         declare linkonce_output_name.
11861
11862 2009-06-03  Doug Kwan  <dougkwan@google.com>
11863
11864         * gold/arm.cc (namespace utils): New.
11865         (Target_arm::reloc_is_non_pic): Define new method.
11866         (class Arm_relocate_functions): New.
11867         (Target_arm::Relocate::relocate): Handle relocation types used by
11868         Android.
11869
11870 2009-06-03  Ian Lance Taylor  <iant@google.com>
11871
11872         * arm.cc (Target_arm::scan::global): Use || instead of |.
11873
11874 2009-06-02  Doug Kwan  <dougkwan@google.com>
11875
11876         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11877         issued_non_pic_error_.
11878         (class Target_arm::Scan): Declare new method check_non_pic.
11879         Define new method symbol_needs_plt_entry.
11880         Declare new data member issued_non_pic_error_.
11881         (class Target_arm::Relocate): Declare new method
11882         should_apply_static_reloc.
11883         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11884         (Target_arm::Scan::check_non_pic): Define new method.
11885         (Target_arm::Scan::local): Handle a small subset of reloc types used
11886         by Android.
11887         (Target_arm::Scan::local): Same.
11888         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11889
11890 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11891
11892         * incremental.cc (Incremental_inputs::report_command_line): Filter
11893         out --incremental-* options.
11894
11895 2009-05-29  Doug Kwan  <dougkwan@google.com>
11896
11897         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11898         template class.
11899         (class Target_arm): Update comment.
11900         (Target_arm::Target_arm): Initialize new data members GOT_,
11901         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11902         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11903         and Target_arm::rel_dyn_section.
11904         Declare new_enum Target_arm::Got_type.
11905         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11906         and DYNBSS_.
11907         Update commments for member do_dynsym_value.
11908         (Target_arm::got_size, Target_arm::plt_section,
11909         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11910         new methods inside class defintion.
11911         (Target_arm::got_section): Define new method.
11912         (Target_arm::rel_dyn_section): Same.
11913         (Output_data_plt_arm): New template class.
11914         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11915         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11916         (Output_data_plt_arm::add_entry): Same.
11917         (Output_data_plt_arm::first_plt_entry): Define new
11918         static data member for PLT instruction template.
11919         (Output_data_plt_arm::plt_entry): Same.
11920         (Output_data_plt_arm::do_write): Define new method.
11921         (Target_arm::make_plt_entry): Same.
11922         (Target_arm::do_finalize_sections): Same.
11923         (Target_arm::do_dynsym_value): Same.
11924
11925 2009-05-28  Doug Kwan  <dougkwan@google.com>
11926
11927         * Makefile.am (TARGETSOURCES): Add arm.cc.
11928         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11929         * Makefile.in: Regenerate.
11930         * arm.cc: New file.
11931         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11932
11933 2009-05-26  Doug Kwan  <dougkwan@google.com>
11934
11935         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11936         (General_options::check_excluded_libs): Strip off directories in
11937         archive name before matching like GNU ld does.
11938         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11939         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11940         (exclude_libs_test_LDFLAGS): Add linker option
11941         -Wl,--exclude-libs,libexclude_libs_test_3
11942         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11943         an explicit archive without using -l.
11944         (alt/libexclude_libs_test_3.a): New make rule.
11945         * testsuite/Makefile.in: Regenerate.
11946         * testsuite/exclude_libs_test.c : Declare lib3_default().
11947         (main): Call it.
11948         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11949         * exclude_libs_test_3.c: New file.
11950
11951 2009-05-26  Nick Clifton  <nickc@redhat.com>
11952
11953         * po/id.po: New Indonesian translation.
11954         * po/gold.pot: Updated template file.
11955
11956 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11957
11958         * testsuite/Makefile.am: Add -ffunction-sections to compile
11959         gc_comdat_test files.  Add -Wl,--gc-sections to build
11960         gc_comdat_test.
11961         * testsuite/Makefile.in: Regenerate.
11962         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11963
11964 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11965
11966         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11967         kept comdat section was garbage collected.
11968         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11969         * testsuite/Makefile.in: Regenerate.
11970         * testsuite/gc_comdat_test.sh: New file.
11971         * testsuite/gc_comdat_test_1.cc: New file.
11972         * testsuite/gc_comdat_test_2.cc: New file.
11973
11974 2009-05-19  Doug Kwan  <dougkwan@google.com>
11975
11976         * archive.cc (Archive::Archive): Move constructor from archive.h
11977         to here.  Initialize no_export_.
11978         (Archive::get_elf_object_for_member): Set no_export flag of object.
11979         * archive.h (Archive::Archive): Move constructor body to
11980         archive.cc.
11981         (Archive::no_export): New method.
11982         (Archive::no_export_): New field.
11983         * object.h (Object::Object): Initialize no_export_ to false.
11984         (Object::no_export, Object::set_no_export): New methods.
11985         (Object::no_export_): New field.
11986         * options.cc (General_options::parse_exclude_libs): New method.
11987         (General_options::check_excluded_libs) Same.
11988         * options.h (exclude_libs): New option.
11989         (General_options::check_excluded_libs): New method declaration.
11990         (General_options::excluded_libs_): New field.
11991         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11992         default or protected visibility if an object has no-export flag set.
11993         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11994         (check_SCRIPTS): Add exclude_libs_test.sh.
11995         (check_DATA): Add exclude_libs_test.syms.
11996         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11997         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11998         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11999         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12000         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12001         libexclude_libs_test_2.a): New rules.
12002         * testsuite/Makefile.in: Regenerate.
12003         * testsuite/exclude_libs_test.c: New file.
12004         * testsuite/exclude_libs_test.sh: Ditto.
12005         * testsuite/exclude_libs_test_1.c: Ditto.
12006         * testsuite/exclude_libs_test_2.c: Ditto.
12007
12008 2009-05-15  Ian Lance Taylor  <iant@google.com>
12009
12010         * configure.ac: Check for declarations for cases where libiberty.h
12011         checks HAVE_DECL_xxx.
12012         * configure, config.in: Rebuild.
12013
12014 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12015
12016         * gold.h (Incremental_argument_list): Remove (invalid) forward
12017         declaration.
12018         * incremental.cc (Incremental_inputs::report_achive): New method.
12019         (Incremental_inputs::report_object): New method.
12020         (Incremental_inputs::report_script): New method.
12021         (Incremental_inputs::finalize_inputs): New method.
12022         (Incremental_inputs::finalize): Call finalize_inputs().
12023         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12024         Create inputs entries.
12025         * incremental.h (Incremental_input_type): New enum.
12026         (Incremental_inputs::Incremental_input): Initialize new fields.
12027         (Incremental_inputs::report_inputs): New method.
12028         (Incremental_inputs::report_achive): New method.
12029         (Incremental_inputs::report_object): New method.
12030         (Incremental_inputs::report_script): New method.
12031         (Incremental_inputs::finalize_inputs): New method.
12032         (Incremental_inputs::Input_info): New struct.
12033         (Incremental_inputs::Input_info_map): New typedef.
12034         (Incremental_inputs::lock_): New field.
12035         (Incremental_inputs::Inputs_): New field.
12036         (Incremental_inputs::Inputs_map): New field.
12037         * main.cc (main): Call Incremental_input::report_inputs.
12038         * options.h (Input_argument_list): Typedef moved from
12039         Input_arguments.
12040         (Input_file_group::Files): Remove, use ::Input_argument_list.
12041         (Input_file_group::Input_argument_list): Remove, use
12042         ::Input_argument_list.
12043         * plugin.cc (Plugin_manager::add_input_file): Add error in
12044         incremental build.
12045         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12046         functions.
12047         * script.cc (read_input_script): Call
12048         Incremental_input::report_script.
12049         * script.h (Script_info): New class.
12050
12051 2009-04-27  Ian Lance Taylor  <iant@google.com>
12052
12053         * x86_64.cc (do_adjust_output_section): Set entsize to
12054         plt_entry_size.
12055
12056 2009-04-23  Elliott Hughes  <enh@google.com>
12057
12058         * output.cc (Output_file::close): After short writes, continue
12059         writing from the correct offset in the buffer being written.
12060
12061 2009-04-23  Chris Demetriou  <cgd@google.com>
12062
12063         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12064         * configure: Regenerate.
12065         * config.in: Regenerate.
12066         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12067         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12068
12069 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12070
12071         * incremental.cc (Incremental_inputs_header_data): Renamed from
12072         Incremental_input_header_data.
12073         (Incremental_inputs_header_data::data_size): New field.
12074         (Incremental_inputs_header_data::put_input_file_count): Renamed
12075         from input_file_count.
12076         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12077         from command_line_offset.
12078         (Incremental_inputs_header_data::put_reserved): Renamed from
12079         put_reserved.
12080         (Incremental_inputs_entry_data): Renamed from
12081         Incremental_input_entry_data.
12082         (Incremental_inputs_entry_data::data_size): New field.
12083         (Incremental_inputs::report_command_line): New method.
12084         (Incremental_inputs::finalize): New method.
12085         (Incremental_inputs::create_incremental_inputs_data): New method.
12086         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12087         * incremental.h: New file.
12088         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12089         (Layout::finalize): Create incremental inputs section in
12090         incremental builds.
12091         (Layout::create_incremental_info_sections): New method.
12092         * layout.h (Layout::incremental_inputs): New method.
12093         (Layout::create_incremental_info_sections): New method.
12094         (Layout::incremental_inputs_): New field.
12095         * main.cc (main): Notify Incremental_input of the command line.
12096
12097 2009-04-01  Ian Lance Taylor  <iant@google.com>
12098             Mikolaj Zalewski  <mikolajz@google.com>
12099
12100         * gold.h (reserve_unordered_map): Define, three versions, one for
12101         each version of Unordered_map.
12102         * layout.cc (Layout::Layout): Remove options parameter.  Add
12103         number_of_input_files parameter.  Don't initialize options_.
12104         Initialize number_of_input_files_ and resized_signatures_.  Move
12105         sections_are_attached_.
12106         (Layout::layout_group): Reserve space for group_signatures_.
12107         (Layout::find_or_add_kept_section): Change name parameter to be a
12108         reference.  Resize signatures_ map when it gets large enough.
12109         (Layout::layout_eh_frame): Use parameters->options() instead of
12110         this->options_.
12111         (Layout::make_output_section): Likewise.
12112         (Layout::attach_allocated_section_to_segment): Likewise.
12113         (Layout::finalize, Layout::create_executable_stack): Likewise.
12114         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12115         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12116         * layout.h (class Layout): Update declarations.  Remove options_
12117         field.  Add number_of_input_files_ and resized_signatures_
12118         fields.  Move sections_are_attached_ field.
12119         * main.cc (main): Pass number of input files to Layout
12120         constructor.  Don't pass options.
12121
12122 2009-03-30  Ian Lance Taylor  <iant@google.com>
12123
12124         * ffsll.c (ffsll): Correct implementation.
12125
12126 2009-03-27  Ian Lance Taylor  <iant@google.com>
12127
12128         * ffsll.c: New file.
12129         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12130         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12131         * ftruncate.c (ftruncate): Declare before definition.
12132         * mremap.c (mremap): Likewise.
12133         * pread.c (pread): Likewise.
12134         * configure, Makefile.in, config.in: Rebuild.
12135
12136         * mremap.c: New file.
12137         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12138         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12139         (mremap): Declare if HAVE_MREMAP is not defined.
12140         * configure, Makefile.in, config.in: Rebuild.
12141
12142 2009-03-27  Cary Coutant  <ccoutant@google.com>
12143
12144         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12145         position independent.
12146         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12147         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12148
12149 2009-03-24  Cary Coutant  <ccoutant@google.com>
12150
12151         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12152         an executable.
12153         (needs_dynamic_reloc): Likewise.
12154
12155 2009-03-24  Ian Lance Taylor  <iant@google.com>
12156
12157         * yyscript.y (file_cmd): Recognize EXTERN.
12158         (extern_name_list, extern_name_list_body): New nonterminals.
12159         * script.cc (script_add_extern): Define.
12160         * script-c.h (script_add_extern): Declare.
12161
12162 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12163
12164         * object.cc (is_elf_object): Define.
12165         * object.h (is_elf_object): Declare.
12166         * archive.cc (Archive::get_elf_object_for_member): Call
12167         is_elf_object.
12168         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12169
12170 2009-03-24  Elliott Hughes  <enh@google.com>
12171
12172         * output.cc (Output_file::map_anonymous): Define.
12173         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12174         try an anonymous one.  Report the size if the mmap fails.
12175         * output.h (class Output_file): Declare map_anonymous.
12176
12177 2009-03-24  Ian Lance Taylor  <iant@google.com>
12178
12179         * target-select.cc (instantiate_target): Don't acquire the lock if
12180         the instantiated_target_ field has already been set.
12181
12182 2009-03-23  Ian Lance Taylor  <iant@google.com>
12183
12184         * gold-threads.h (class Initialize_lock): Define.
12185         * gold-threads.cc (class Initialize_lock_once): Define.
12186         (initialize_lock_control): New static variable.
12187         (initialize_lock_pointer): New static variable.
12188         (initialize_lock_once): New static function.
12189         (Initialize_lock::Initialize_lock): Define.
12190         (Initialize_lock::initialize): Define.
12191         * target-select.h: Include "gold-threads.h".
12192         (class Target_selector): Add lock_ and initialize_lock_ fields.
12193         Don't define instantiate_target, just declare it.
12194         * target-select.cc (Target_selector::Target_selector): Initialize
12195         new fields.
12196         (Target_selector::instantiate_target): Define.
12197         * descriptors.h: Include "gold-threads.h".
12198         (class Descriptors): Add initialize_lock_ field.
12199         * descriptors.cc (Descriptors::Descriptors): Initialize new
12200         field.
12201         (Descriptors::open): Use initialize_lock_ field
12202         * errors.h (class Errors): Add initialize_lock_ field.
12203         * errors.cc (Errors::Errors): Initialize new field.
12204         (Errors::initialize_lock): Use initialize_lock_ field.
12205         * powerpc.cc (class Target_selector_powerpc): Remove
12206         instantiated_target_ field.  In do_recognize call
12207         instantiate_target rather than do_instantiate_target.  In
12208         do_instantiate_target just allocate a new target.
12209         * sparc.cc (class Target_selector_sparc): Likewise.
12210
12211         * freebsd.h: New file.
12212         * i386.cc: Include "freebsd.h".
12213         (Target_i386): Derive from Target_freebsd rather than
12214         Sized_target.
12215         (Target_selector_i386): Derive from Target_selector_freebsd rather
12216         than Target_selector.
12217         * x86_64.cc: Include "freebsd.h".
12218         (Target_x86_64): Derive from Target_freebsd rather than
12219         Sized_target.
12220         (Target_selector_x86_64): Derive from Target_selector_freebsd
12221         rather than Target_selector.
12222         * target.h (class Target): Add adjust_elf_header and
12223         do_adjust_elf_header.
12224         * output.cc (Output_file_header:: do_sized_write): Call target
12225         adjust_elf_header routine.
12226         * configure.tgt: Set targ_osabi.
12227         * configure.ac: Define GOLD_DEFAULT_OSABI.
12228         * parameters.cc (Parameters::default_target): Pass
12229         GOLD_DEFAULT_OSABI to select_target.
12230         * target-select.h (class Target_selector): Make instantiate_target
12231         protected rather than private.
12232         * Makefile.am (HFILES): Add freebsd.h.
12233         * configure, Makefile.in, config.in: Rebuild.
12234
12235         * merge.cc (do_add_input_section): Correct pend value.  Change
12236         message about last entry not being null terminated from error to
12237         warning.
12238
12239 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12240
12241         * incremental.cc: New file.
12242         * Makefile.am (CCFILES): Add incremental.cc.
12243         * Makefile.in: Rebuild.
12244
12245 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12246
12247         * layout.cc (Layout::output_section_name): Preserve names
12248         of '.note.' sections.
12249
12250 2009-03-19  Ian Lance Taylor  <iant@google.com>
12251
12252         * descriptors.cc (Descriptors::open): Check that the options are
12253         valid before using them.
12254
12255 2009-03-18  Ian Lance Taylor  <iant@google.com>
12256
12257         * script-sections.h: Include <list>.
12258         (class Script_sections): Change Sections_elements from std::vector
12259         to std::list.  Typedef public Elements_iterator.  Add
12260         orphan_section_placement_, data_segment_align_start_, and
12261         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12262         field.
12263         * script-sections.cc (class Orphan_section_placement): New class.
12264         (class Sections_element): Add virtual functions is_relro and
12265         orphan_section_init.  Remove virtual function place_orphan_here.
12266         (class Output_section_definition): Add is_relro and
12267         orphan_section_init.  Remove place_orphan_here.
12268         (class Orphan_output_section): Likewise.
12269         (Script_sections::Script_sections): Update for field changes.
12270         (Script_sections::data_segment_align): Set saw_data_segment_align_
12271         and data_segment_align_start_, not data_segment_align_index.
12272         (Script_sections::data_segment_relro_end): Check
12273         saw_data_segment_align_.  Use data_segment_align_start_ rather
12274         than data_segment_align_index_.
12275         (Script_sections::place_orphan): Rewrite to use
12276         Orphan_section_placement.
12277
12278 2009-03-17  Ian Lance Taylor  <iant@google.com>
12279
12280         * archive.cc (Archive::add_symbols): Check for a version attached
12281         to the symbol name in the archive map.
12282         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12283         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12284         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12285         (ver_test_11.a): New target.
12286         * testsuite/Makefile.in: Rebuild.
12287
12288         * configure.ac: Check for chsize and posix_fallocate.  Replace
12289         ftruncate.
12290         * ftruncate.c: New file, from gnulib.
12291         * output.cc (posix_fallocate): Define dummy version if not
12292         HAVE_POSIX_FALLOCATE.
12293         (Output_file::map): Call posix_fallocate rather than lseek and
12294         write.
12295         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12296         * configure, Makefile.in, config.in: Rebuild.
12297
12298 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12299
12300         * layout.h (Layout::create_note): Add section_name parameter.
12301         * layout.cc (Layout::create_note): Likewise.
12302         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12303
12304 2009-03-17  Ian Lance Taylor  <iant@google.com>
12305
12306         * descriptors.cc: Include "options.h".
12307         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12308         (Descriptors::open): Always use O_CLOEXEC when opening a new
12309         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12310         then set FD_CLOEXEC.
12311
12312         * sparc.cc (class Target_sparc): Add has_got_section.
12313         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12314         make sure we have a GOT section.
12315
12316         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12317         (Target_sparc::Scan::local): Likewise.
12318         (Target_sparc::Scan::global): Likewise.
12319         (Target_sparc::Relocate::relocate): Likewise.
12320         (Target_sparc::Relocate::relocate_tls): Likewise.
12321
12322         * symtab.cc (Symbol_table::define_default_version): New function,
12323         broken out of add_from_object.
12324         (Symbol_table::add_from_object): Call define_default_version.
12325         (Symbol_table::define_special_symbol): Add resolve_oldsym
12326         parameter.  Change all callers.  If the version for a symbol comes
12327         from a version script, resolve it with the symbol with the same
12328         name with no version.  Also add the symbol without a version if
12329         appropriate.
12330         (do_define_in_output_data): If resolving with oldsym, don't delete
12331         sym.
12332         (do_define_in_output_segment): Likewise.
12333         (do_define_as_constant): Likewise.
12334         * symtab.h (class Symbol_table): Update declarations.
12335
12336 2009-03-13  Ian Lance Taylor  <iant@google.com>
12337
12338         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12339         (Read_symbols::requeue): New function.
12340         (Read_symbols::do_read_symbols): If make_elf_object fails because
12341         the target type is not configured, and the file was searched for,
12342         issue a warning and retry with the next directory.
12343         (Add_symbols::run): If the file has an incompatible format, and
12344         it was searched for, requeue the Read_symbols task.  On error,
12345         release the object.
12346         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12347         dirindex parameter to constructor.  Change all callers.  Declare
12348         incompatible_warning and requeue.
12349         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12350         input_argument_ and input_group_ fields.  Add them to
12351         constructor.  Change all callers.
12352         (class Read_script): Add dirindex_ field.  Add it to constructor.
12353         Change all callers.
12354         * archive.cc (Archive::setup): Remove input_objects parameter.
12355         Change all callers.
12356         (Archive::get_file_and_offset): Likewise.
12357         (Archive::read_all_symbols): Likewise.
12358         (Archive::read_symbols): Likewise.
12359         (Archive::get_elf_object_for_member): Remove input_objects
12360         parameter.  Add punconfigured parameter.  Change all callers.
12361         (Archive::add_symbols): Change return type to bool.  Check return
12362         value of include_member.
12363         (Archive::include_all_members): Likewise.
12364         (Archive::include_member): Change return type to bool.  Return
12365         false if first included object has incompatible target.  Set
12366         included_member_ field.
12367         (Add_archive_symbols::run): If add_symbols returns false, requeue
12368         Read_symbols task.
12369         * archive.h (class Archive): Add included_member_ field.
12370         Initialize it in constructor.  Add input_file and searched_for
12371         methods.  Update declarations.
12372         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12373         input_argument_ fields.  Add them to constructor.  Change all
12374         callers.
12375         * script.cc: Include "target-select.h".
12376         (class Parser_closure): Add skip_on_incompatible_target_ and
12377         found_incompatible_target_ fields.  Add
12378         skip_on_incompatible_target parameter to constructor.  Change all
12379         callers.  Add methods skip_on_incompatible_target,
12380         clear_skip_on_incompatible_target, found_incompatible_target, and
12381         set_found_incompatible_target.
12382         (read_input_script): Add dirindex parameter.  Change all callers.
12383         If parser finds an incompatible target, requeue Read_symbols
12384         task.
12385         (script_set_symbol): Clear skip_on_incompatible_target in
12386         closure.
12387         (script_add_assertion, script_parse_option): Likewise.
12388         (script_start_sections, script_add_phdr): Likewise.
12389         (script_check_output_format): New function.
12390         * script.h (read_input_script): Update declaration.
12391         * script-c.h (script_check_output_format): Declare.
12392         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12393         (ignore_cmd): Remove OUTPUT_FORMAT.
12394         * fileread.cc (Input_file::Input_file): Add explicit this.
12395         (Input_file::will_search_for): New function.
12396         (Input_file::open): Add pindex parameter.  Change all callers.
12397         * fileread.h (class Input_file): Add input_file_argument method.
12398         Declare will_search_for.  Update declarations.
12399         * object.cc (make_elf_object): Add punconfigured parameter.
12400         Change all callers.
12401         * object.h (class Object): Make input_file public.  Add
12402         searched_for method.
12403         (make_elf_object): Update declaration.
12404         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12405         restart search.
12406         * dirsearch.h (class Dirsearch): Update declaration.
12407         * options.h (class General_options): Add --warn-search-mismatch.
12408         * parameters.cc (Parameters::is_compatible_target): New function.
12409         * parameters.h (class Parameters): Declare is_compatible_target.
12410         * workqueue.cc (Workqueue::add_blocker): New function.
12411         * workqueue.h (class Workqueue): Declare add_blocker.
12412
12413         * fileread.cc (Input_file::open): Remove options parameter.
12414         Change all callers.
12415         (Input_file::open_binary): Likewise.
12416         * script.cc (read_input_script): Likewise.
12417         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12418         options parameter from constructor.  Change all callers.
12419         (class Read_script): Likewise.
12420         * fileread.h (class Input_file): Update declarations.
12421         * script.h (read_input_script): Update declaration.
12422
12423 2009-03-10  Nick Clifton  <nickc@redhat.com>
12424
12425         * po/es.po: New Spanish translation.
12426
12427 2009-03-06  Cary Coutant  <ccoutant@google.com>
12428
12429         * options.cc (parse_short_option): Keep dash_z from registering itself.
12430
12431 2009-03-03  Ian Lance Taylor  <iant@google.com>
12432
12433         PR 9918
12434         * target-reloc.h (relocate_section): Pass output_section to
12435         relocate.
12436         * i386.cc (Target_i386::should_apply_static_reloc): Add
12437         output_section parameter.  Change all callers.
12438         (Target_i386::Relocate::relocate): Add output_section parameter.
12439         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12440         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12441         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12442         * testsuite/two_file_shared.sh: New script.
12443         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12444         (check_DATA): Add two_file_shared.dbg.
12445         (two_file_shared.dbg): New target.
12446         * testsuite/Makefile.in: Rebuild.
12447
12448 2009-03-01  Ian Lance Taylor  <iant@google.com>
12449
12450         * configure.ac: Check for byteswap.h.
12451         * configure: Rebuild.
12452         * config.in: Rebuild.
12453
12454 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12455
12456         * layout.cc (Layout::find_or_add_kept_section): New function.
12457         (Layout::add_comdat): Removed.
12458         * layout.h (struct Kept_section): Move out of class Layout.
12459         Remove trailing underscores from field names.  Add group_sections
12460         field.  Rename group_ field to is_group.  Change all uses.
12461         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12462         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12463         comdat_groups_ field.
12464         (Sized_relobj::include_section_group): Use
12465         find_or_add_kept_section and Kept_section::group_sections.
12466         (Sized_relobj::include_linkonce_section): Likewise.
12467         * object.cc (class Sized_relobj): Don't define Comdat_group or
12468         Comdat_group_table.  Remove find_comdat_group and
12469         add_comdat_group.  Remove comdat_groups_ field.
12470         * plugin.cc (include_comdat_group): Use
12471         Layout::find_or_add_kept_section.
12472
12473 2009-02-28  Ian Lance Taylor  <iant@google.com>
12474
12475         * README: --gc-sections and map files are now supported.  Document
12476         some build requirements.
12477
12478         PR 6992
12479         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12480         relocatable link set the value of the section symbol to zero.
12481         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12482         relocatable link don't include the section address in the local
12483         symbol value.
12484
12485 2009-02-27  Ian Lance Taylor  <iant@google.com>
12486
12487         PR 6811
12488         * options.h (class Search_directory): Add is_system_directory.
12489         (class General_options): Declare is_in_system_directory.
12490         * options.cc (get_relative_sysroot): Make static.
12491         (get_default_sysroot): Make static.
12492         (General_optoins::is_in_system_directory): New function.
12493         * fileread.cc (Input_file::is_in_system_directory): New function.
12494         * fileread.h (class Input_file): Declare is_in_system_directory.
12495         * object.h (class Object): Add is_in_system_directory.
12496         (class Input_objects): Remove system_library_directory_ field.
12497         * object.cc (Input_objects::add_object): Don't set
12498         system_library_directory_.
12499         (input_objects::found_in_system_library_directory): Remove.
12500         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12501         parameter.  Change all callers.
12502         (Symbol_table::sized_write_globals): Likewise.
12503         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12504         Call Object::is_in_system_directory.
12505         * symtab.h (class Symbol_table): Update declarations.
12506
12507         PR 5990
12508         * descriptors.h (Open_descriptor): Add is_on_stack field.
12509         * descriptors.cc (Descriptors::open): If the descriptor is on the
12510         top of the stack, remove it.  Initialize is_on_stack field.
12511         (Descriptors::release): Only add pod to stack if it is not on the
12512         stack already.
12513         (Descriptors::close_some_descriptor): Clear stack_next and
12514         is_on_stack fields.
12515
12516         PR 7091
12517         * output.cc (Output_section::find_starting_output_address): Rename
12518         from starting_output_address; add PADDR parameter; change return
12519         type.
12520         * output.h (class Output_section): Declare
12521         find_starting_output_address instead of starting_output_address.
12522         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12523         section symbol for which we can't find a merge section.
12524
12525         PR 9836
12526         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12527         hidden or internal, force the symbol to be local.
12528         * resolve.cc (Symbol::override_visibility): Define.
12529         (Symbol::override_base): Use override_visibility.
12530         (Symbol_table::resolve): Likewise.
12531         (Symbol::override_base_with_special): Likewise.
12532         (Symbol_table::override_with_special): If the visibility is hidden
12533         or internal, force the symbol to be local.
12534         * symtab.h (class Symbol): Add set_visibility and
12535         override_visibility.
12536         * testsuite/ver_test_1.sh: New file.
12537         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12538         (check_DATA): Add ver_test_1.syms.
12539         (ver_test_1.syms): New target.
12540         * testsuite/Makefile.in: Rebuild.
12541
12542 2009-02-25  Cary Coutant  <ccoutant@google.com>
12543
12544         * layout.cc (Layout::choose_output_section): Don't rename sections
12545         when using a linker script that has a SECTIONS clause.
12546         * Makefile.in: Regenerate.
12547
12548         * testsuite/Makefile.am (script_test_5.sh): New test case.
12549         * testsuite/Makefile.in: Regenerate.
12550         * testsuite/script_test_5.cc: New file.
12551         * testsuite/script_test_5.sh: New file.
12552         * testsuite/script_test_5.t: New file.
12553
12554 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12555
12556         * archive.cc (Archive::include_member): Update calls to add_symbols.
12557         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12558         the Layout argument.
12559         * dynobj.h (do_add_symbols): Add the Layout argument.
12560         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12561         Layout argument.
12562         * object.h (Object::add_symbols): Add the Layout argument.
12563         (Object::do_add_symbols): Add the Layout argument.
12564         (Sized_relobj::do_add_symbols): Add the Layout argument.
12565         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12566         Unify the two versions.
12567         (Add_plugin_symbols): Remove.
12568         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12569         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12570         (Add_plugin_symbols): Remove.
12571         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12572         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12573         (Add_symbols::run): Make it work with Pulginobj.
12574
12575 2009-02-06  Ian Lance Taylor  <iant@google.com>
12576
12577         * object.cc (Sized_relobj::do_layout): Make info message start
12578         with lower case letter.
12579
12580 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12581
12582         * binary.cc: Fix file comment.
12583
12584         * options.h (enum Incremental_disposition): Define.
12585         (class General_options): Add new options: --incremental,
12586         --incremental_changed, --incremental_unchanged,
12587         --incremental_unknown.  Add incremental_disposition_ and
12588         implicit_incremental_ fields.
12589         (General_options::incremental_disposition): New function.
12590         (class Position_dependent_options): Add incremental_disposition
12591         option.
12592         (Position_dependent_options::copy_from_options): Set incremental
12593         dispositions.
12594         * options.cc (General_options::parse_incremental_changed): New
12595         function.
12596         (General_options::parse_incremental_unchanged): New function.
12597         (General_options::parse_incremental_unknown): New function.
12598         (General_options::General_options): Initialize new fields
12599         incremental_disposition_ and implicit_incremental_.
12600         (General_options::finalize): Check for uasge of --incremental-*
12601         without --incremental.
12602
12603 2009-02-06  Chris Demetriou  <cgd@google.com>
12604
12605         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12606         pointer and to report location as the file name associated with
12607         the symbol.
12608         (gold_undefined_symbol_at_location): New function to replace the
12609         old gold_undefined_symbol functionality.
12610         * target-reloc.h (relocate_section): Update to use
12611         gold_undefined_symbol_at_location.
12612         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12613         Call gold_undefined_symbol function rather than gold_error.
12614         * errors.h (Errors::undefined_symbol): Take location as a
12615         string, rather than calculating it from a relocation.
12616         * errors.cc (Errors::fatal): Print "fatal error:" before the
12617         formatted message.
12618         (Errors::error, Errors::error_at_location): Print "error: "
12619         before the formatted message.
12620         (Errors::undefined_symbol): Take location as a string, rather
12621         than calculating it from a relocation.
12622         (gold_undefined_symbol_at_location): New function akin to
12623         old gold_undefined_symbol, calculates location from relocation.
12624         (gold_undefined_symbol): Change to take only a Symbol pointer
12625         and to report location as the file name associated with the symbol.
12626         * testsuite/debug_msg.sh: Update for changed error messages.
12627         * testsuite/undef_symbol.sh: Likewise.
12628
12629 2009-02-04  Duncan Sands  <baldrick@free.fr>
12630
12631         PR 9812
12632         * reduced_debug_output.h
12633         (Output_reduced_debug_abbrev_section::failed): Use format for
12634         gold_warning.
12635         (Output_reduced_debug_info_section::faild): Likewise.
12636
12637 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12638
12639         * script.cc (Lazy_demangler): New class.
12640         (Version_script_info::get_symbol_version_helper): Demangle a
12641         symbol only once.
12642
12643 2009-01-29  Cary Coutant  <ccoutant@google.com>
12644
12645         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12646         to __tls_get_addr.
12647         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12648
12649 2009-01-28  Ian Lance Taylor  <iant@google.com>
12650
12651         * version.cc (version_string): Bump to 1.9.
12652
12653         * gold.h: Include <cstring> and <stdint.h>.
12654         * version.cc: Include <cstdio>.
12655         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12656         warning.
12657         * reduced_debug_output.cc (insert_into_vector): Rename from
12658         Insert_into_vector; change all callers.  Use Swap_unaligned to
12659         avoid aliasing issue; remove union since it is unnecessary.
12660
12661 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12662
12663         * Makefile.am (CCFILES): Add gc.cc.
12664         (HFILES): Add gc.h.
12665         * Makefile.in: Regenerate.
12666         * gold.cc (Gc_runner): New class.
12667         (queue_initial_tasks): Call garbage collection related tasks
12668         when corresponding options are invoked.
12669         (queue_middle_gc_tasks): New function.
12670         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12671         processed early before laying out sections during garbage collection.
12672         * gold.h (queue_middle_gc_tasks): New function.
12673         (is_prefix_of): Move from "layout.cc".
12674         * i386.cc (Target_i386::gc_process_relocs): New function.
12675         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12676         * main.cc (main): Create object of class "Garbage_collection".
12677         * object.cc (Relobj::copy_symbols_data): New function.
12678         (Relobj::is_section_name_included): New function.
12679         (Sized_relobj::do_layout): Allow this function to be called twice
12680         during garbage collection and defer layout of section during the
12681         first call.
12682         * object.h (Relobj::get_symbols_data): New function.
12683         (Relobj::is_section_name_included): New function.
12684         (Relobj::copy_symbols_data): New function.
12685         (Relobj::set_symbols_data): New function.
12686         (Relobj::get_relocs_data): New function.
12687         (Relobj::set_relocs_data): New function.
12688         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12689         (Relobj::gc_process_relocs): New function.
12690         (Relobj::do_gc_process_relocs): New pure virtual function.
12691         (Relobj::sd_): New data member.
12692         (Sized_relobj::is_output_section_offset_invalid): New function.
12693         (Sized_relobj::do_gc_process_relocs): New function.
12694         * options.h (General_options::gc_sections): Modify to not be a no-op.
12695         (General_options::print_gc_sections): New option.
12696         * plugin.cc (Plugin_finish::run): Remove function call to
12697         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12698         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12699         * reloc.cc (Read_relocs::run): Add task to process relocs and
12700         determine unreferenced sections when doing garbage collection.
12701         (Gc_process_relocs): New class.
12702         (Sized_relobj::do_gc_process_relocs): New function.
12703         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12704         sections that are garbage collected.
12705         * reloc.h (Gc_process_relocs): New class.
12706         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12707         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12708         symbols whose corresponding sections are garbage collected.
12709         (Symbol_table::Symbol_table): Add new parameter for the garbage
12710         collection object.
12711         (Symbol_table::gc_mark_undef_symbols): New function.
12712         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12713         (Symbol_table::gc_mark_dyn_syms): New function.
12714         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12715         as garbage.
12716         (Symbol_table::add_from_object): Likewise.
12717         (Symbol_table::add_from_relobj): When building shared objects, do not
12718         treat externally visible symbols as garbage.
12719         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12720         table information for static and relocatable links.
12721         * symtab.h (Symbol_table::set_gc): New function.
12722         (Symbol_table::gc): New function.
12723         (Symbol_table::gc_mark_undef_symbols): New function.
12724         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12725         (Symbol_table::gc_mark_dyn_syms): New function.
12726         (Symbol_table::gc_): New data member.
12727         * target.h (Sized_target::gc_process_relocs): New pure virtual
12728         function.
12729         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12730         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12731
12732 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12733
12734         * options.h (General_options::gc_sections): Define as a no-op for now.
12735         (General_options::no_keep_memory): Ditto.
12736         (General_options::Bshareable): Define.
12737         * options.cc (General_options::finalize): Honor -Bshareable.
12738
12739 2009-01-20  Andreas Schwab  <schwab@suse.de>
12740
12741         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12742         read the value in the contents, since we don't use it.  Use the
12743         template endianness when writing.
12744         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12745
12746 2009-01-19  Andreas Schwab  <schwab@suse.de>
12747
12748         * configure.tgt (powerpc64-*): Fix targ_obj.
12749
12750 2009-01-15  Ian Lance Taylor  <iant@google.com>
12751
12752         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12753         local symbols when stripping all symbols.
12754
12755 2009-01-14  Cary Coutant  <ccoutant@google.com>
12756
12757         * output.cc (Output_reloc): Add explicit instantiations.
12758
12759 2009-01-14  Cary Coutant  <ccoutant@google.com>
12760
12761         * archive.cc (Archive::get_elf_object_for_member): Remove call
12762         to File_read::claim_for_plugin.
12763         * descriptors.cc (Descriptors::open): Remove reference to
12764         is_claimed.
12765         (Descriptors::claim_for_plugin): Remove.
12766         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12767         (Descriptors::is_claimed): Remove.
12768         (claim_descriptor_for_plugin): Remove.
12769         * fileread.cc (File_read::claim_for_plugin): Remove.
12770         * fileread.h (File_read::claim_for_plugin): Remove.
12771         (File_read::descriptor): Reopen descriptor if necessary.
12772         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12773         (Plugin_manager::all_symbols_read): Add task parameter. Change
12774         all callers.
12775         (Plugin_manager::get_input_file): New function.
12776         (Plugin_manager::release_input_file): New function.
12777         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12778         corresponding data member.
12779         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12780         and pass to base constructor. Change all callers.
12781         (get_input_file, release_input_file): New functions.
12782         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12783         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12784         (Plugin_manager::all_symbols_read): Add task parameter.
12785         (Plugin_manager::get_input_file): New function.
12786         (Plugin_manager::release_input_file): New function.
12787         (Plugin_manager::task_): New data member.
12788         (Pluginobj::Pluginobj): Add filesize parameter.
12789         (Pluginobj::filename): New function.
12790         (Pluginobj::descriptor): New function.
12791         (Pluginobj::filesize): New function.
12792         (Pluginobj::filesize_): New data member.
12793         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12794         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12795         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12796
12797         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12798         with archive libraries.
12799         * testsuite/Makefile.in: Regenerate.
12800         * testsuite/plugin_test.c (struct sym_info): New type.
12801         (get_input_file, release_input_file): New static variables.
12802         (onload): Capture new transfer vector entries.
12803         (claim_file_hook): Stop reading at end of file according to filesize.
12804         Factor out parsing of readelf output into separate function.
12805         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12806         APIs and get the source file name from the symbol table.  Convert
12807         source file name to corresponding object file name.  Print info
12808         message when adding new input files.
12809         (parse_readelf_line): New function.
12810         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12811         * testsuite/plugin_test_2.sh: Likewise.
12812         * testsuite/plugin_test_3.sh: Likewise.
12813         * testsuite/plugin_test_4.sh: New test case.
12814
12815 2009-01-07  Ian Lance Taylor  <iant@google.com>
12816
12817         * version.cc (version_string): Bump to 1.8.
12818
12819 2008-12-23  Cary Coutant  <ccoutant@google.com>
12820
12821         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12822         * plugin.cc (Plugin_manager::finish): Rename as
12823         layout_deferred_objects.  Move cleanup to separate function.
12824         (Plugin_manager::cleanup): New function.
12825         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12826         separately.
12827         * plugin.h (Plugin_manager::finish): Rename as
12828         layout_deferred_objects.
12829         (Plugin_manager::cleanup): New function.
12830         (Plugin_manager::cleanup_done): New field.
12831
12832 2008-12-23  Cary Coutant  <ccoutant@google.com>
12833
12834         * plugin.cc (is_visible_from_outside): New function.
12835         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12836         so we don't return "IR only" status for exported symbols or -r links.
12837
12838         * testsuite/Makefile.am (plugin_test_3): New test case.
12839         * testsuite/Makefile.in: Regenerate.
12840         * testsuite/plugin_test_3.sh: New file.
12841
12842 2008-12-22  Cary Coutant  <ccoutant@google.com>
12843
12844         * object.cc (Sized_relobj::layout_section): New function.
12845         (Sized_relobj::do_layout): Defer layout of input sections until after
12846         plugin has provided replacement files.
12847         (Sized_relobj::do_layout_deferred_sections): New function.
12848         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12849         (Relobj::layout_deferred_sections): New function.
12850         (Relobj::do_layout_deferred_sections): New function.
12851         (Sized_relobj::do_layout_deferred_sections): New function.
12852         (Sized_relobj::layout_section): New function.
12853         (Sized_relobj::Deferred_layout): New structure.
12854         (Sized_relobj::deferred_layout_): New field.
12855         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12856         Change all callers.  Layout deferred sections.
12857         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12858         references.
12859         (Plugin_hook::run): Move code from do_plugin_hook inline.
12860         (Plugin_hook::do_plugin_hook): Remove.
12861         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12862         (Plugin_manager::finish): Renamed, was cleanup.
12863         (Plugin_manager::should_defer_layout): New function.
12864         (Plugin_manager::add_deferred_layout_object): New function.
12865         (Plugin_manager::Deferred_layout_list): New type.
12866         (Plugin_manager::deferred_layout_objects_): New field.
12867         (Plugin_hook::do_plugin_hook): Remove.
12868
12869 2008-12-17  Ian Lance Taylor  <iant@google.com>
12870
12871         * options.h (class General_options): Add --no case for
12872         --export-dynamic.
12873
12874 2008-12-16  Cary Coutant  <ccoutant@google.com>
12875
12876         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12877         vector.
12878         (Plugin_manager::claim_file): Create plugin object even if
12879         plugin did not call the add_symbols callback.
12880         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12881         asking for more symbols than were added.
12882         * testsuite/Makefile.am (plugin_test_1): Add test case with
12883         no global symbols.
12884         (empty.syms): New target.
12885         * testsuite/Makefile.in: Regenerate.
12886         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12887         message. Don't call add_symbols if no globals.
12888         (all_symbols_read_hook): Don't provide replacement for empty
12889         claimed file.
12890
12891 2008-12-12  Ian Lance Taylor  <iant@google.com>
12892
12893         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12894         r_type == 0 for a local symbol with r_sym == 0.
12895         (scan_relocatable_relocs): Pass r_sym to
12896         local_non_section_strategy.
12897         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12898         r_sym parameter.
12899
12900         * configure.ac: Update test for TLS descriptors: they are
12901         supported as of glibc 2.9.
12902         * configure: Rebuild.
12903
12904 2008-12-11  Ian Lance Taylor  <iant@google.com>
12905
12906         PR 7091
12907         * target-reloc.h (Default_scan_relocatable_relocs): For each
12908         function, map r_type == 0 to RELOC_DISCARD.
12909
12910 2008-12-10  Cary Coutant  <ccoutant@google.com>
12911
12912         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12913         object to override a kept COMDAT group from a plugin object.
12914
12915 2008-12-09  Ian Lance Taylor  <iant@google.com>
12916
12917         PR 7088
12918         * yyscript.y (file_cmd): Handle INPUT.
12919
12920         * testsuite/initpri1.c: Change all declarations to be full
12921         prototypes by adding void, to avoid compiler warnings.
12922
12923 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12924
12925         * options.cc (General_options::parse_plugin_opt): New.
12926         (General_options::add_plugin): The argument now is just the filename.
12927         (General_options::add_plugin_option): New.
12928         * options.h (plugin_opt): New.
12929         (add_plugin): Change argument name.
12930         (add_plugin_option): New.
12931         * plugin.cc (Plugin::load): Don't parse the plugin option.
12932         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12933         (Plugin::add_option): New.
12934         (Plugin::args_): Change type.
12935         (Plugin::filename_): New.
12936         (Plugin_manager::add_plugin_option): New.
12937         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12938         * testsuite/Makefile.in: Regenerate.
12939
12940 2008-12-05  Cary Coutant  <ccoutant@google.com>
12941
12942         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12943         Handle --strip-lto-sections option.
12944         * options.h (strip_lto_sections): New option.
12945
12946 2008-12-01  Cary Coutant  <ccoutant@google.com>
12947
12948         * plugin.cc (ld_plugin_message): Change format parameter to const.
12949         Fix mismatch between new[] and delete.
12950
12951 2008-11-14  Cary Coutant  <ccoutant@google.com>
12952
12953         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12954         instead of -1U.
12955
12956 2008-11-05  Craig Silverstein  <csilvers@google.com>
12957
12958         * options.cc (General_options::parse_dynamic_list): New function.
12959         * options.h (General_options): New flags dynamic_list,
12960         dynamic_list_data, dynamic_list_cpp_new, and
12961         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12962         (General_options::in_dynamic_list): New function.
12963         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12964         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12965         (Lex::can_continue_name): Likewise.
12966         (yylex): Likewise.
12967         (read_script_file): New parameter script_options.
12968         (read_dynamic_list): New function.
12969         (Script_options::define_dynamic_list): New function.
12970         (dynamic_list_keyword_parsecodes): New variable.
12971         (dynamic_list_keywords): New variable.
12972         * script.h (Script_options::define_dynamic_list): New function
12973         prototype.
12974         (read_dynamic_list): New function prototype.
12975         * symtab.cc (strprefix): New macro.
12976         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12977         dynamic_list_data, dynamic_list_cpp_new, and
12978         dynamic_list_cpp_typeinfo.
12979         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12980         (dynamic_list_expr): New rule.
12981         (dynamic_list_nodes): Likewise.
12982         (dynamic_list_node): Likewise.
12983         * testsuite/Makefile.am (dynamic_list): New test.
12984         * testsuite/Makefile.in: Regenerated.
12985         * testsuite/dynamic_list.t: New file.
12986         * testsuite/dynamic_list.sh: New file.
12987
12988 2008-11-05  Craig Silverstein  <csilvers@google.com>
12989
12990         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12991         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12992         (t11_last): Likewise.
12993         * testsuite/ver_test_6.c (main): Likewise.
12994
12995 2008-10-07  Cary Coutant  <ccoutant@google.com>
12996
12997         * options.c (General_options::finalize): Add check for -static and
12998         -shared.
12999         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13000         is not empty.
13001
13002 2008-10-02  Cary Coutant  <ccoutant@google.com>
13003
13004         * plugin.cc (make_sized_plugin_object): Fix conditional
13005         compilation to work when not all targets are enabled.
13006
13007 2008-09-29  Cary Coutant  <ccoutant@google.com>
13008
13009         * archive.cc (Archive::get_file_and_offset): Use filename instead
13010         of name to get library path.
13011         (Archive::include_member): Unlock external member of a thin archive.
13012
13013         * testsuite/Makefile.am (TEST_AR): New variable.
13014         (thin_archive_test_1): New test.
13015         (thin_archive_test_2): New test.
13016         * testsuite/Makefile.in: Regenerate.
13017         * testsuite/thin_archive_main.cc: New file.
13018         * testsuite/thin_archive_test_1.cc: New file.
13019         * testsuite/thin_archive_test_2.cc: New file.
13020         * testsuite/thin_archive_test_3.cc: New file.
13021         * testsuite/thin_archive_test_4.cc: New file.
13022
13023 2008-09-29  Cary Coutant  <ccoutant@google.com>
13024
13025         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13026         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13027         instead of -1U.
13028         (Sized_relobj::do_finalize_local_symbols): Likewise.
13029         (Sized_relobj::map_to_kept_section): Likewise.
13030         * object.h (Sized_relobj::invalid_address): New constant.
13031         (Sized_relobj::do_output_section_offset): Check for invalid_address
13032         and return -1ULL.
13033         * output.cc (Output_reloc::local_section_offset): Use constant
13034         invalid_address instead of -1U.
13035         (Output_reloc::get_address): Likewise.
13036         (Output_section::output_address): Change -1U to -1ULL.
13037         * output.h (Output_reloc::invalid_address): New constant.
13038         * reloc.cc (Sized_relobj::write_sections): Use constant
13039         invalid_address instead of -1U.
13040         (Sized_relobj::relocate_sections): Likewise.
13041         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13042         values for merge sections.
13043         * target-reloc.h (relocate_for_relocatable): Use constant
13044         invalid_address instead of -1U.
13045
13046 2008-09-19  Cary Coutant  <ccoutant@google.com>
13047
13048         Add plugin functionality for link-time optimization (LTO).
13049         * configure.ac (plugins): Add --enable-plugins option.
13050         * configure: Regenerate.
13051         * config.in: Regenerate.
13052         * Makefile.am (LIBDL): New variable.
13053         (CCFILES): Add plugin.cc.
13054         (HFILES): Add plugin.h.
13055         (ldadd_var): Add LIBDL.
13056         * Makefile.in: Regenerate.
13057
13058         * archive.cc: Include "plugin.h".
13059         (Archive::setup): Don't preread archive symbols when using a plugin.
13060         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13061         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13062         files.
13063         (Archive::include_member): Add symbols from plugin objects.
13064         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13065         * descriptors.cc (Descriptors::open): Check for file descriptors
13066         abandoned by plugins.
13067         (Descriptors::claim_for_plugin): New function.
13068         * descriptors.h (Descriptors::claim_for_plugin): New function.
13069         (Open_descriptor::is_claimed): New field.
13070         (claim_descriptor_for_plugin): New function.
13071         * fileread.cc (File_read::claim_for_plugin): New function.
13072         * fileread.h (File_read::claim_for_plugin): New function.
13073         (File_read::descriptor): New function.
13074         * gold.cc: Include "plugin.h".
13075         (queue_initial_tasks): Add task to call plugin hooks for generating
13076         new object files.
13077         * main.cc: Include "plugin.h".
13078         (main): Load plugin libraries.
13079         * object.h (Pluginobj): Declare.
13080         (Object::pluginobj): New function.
13081         (Object::do_pluginobj): New function.
13082         (Object::set_target): New function.
13083         * options.cc: Include "plugin.h".
13084         (General_options::parse_plugin): New function.
13085         (General_options::General_options): Initialize plugins_ field.
13086         (General_options::add_plugin): New function.
13087         * options.h (Plugin_manager): Declare.
13088         (General_options): Add --plugin option.
13089         (General_options::has_plugins): New function.
13090         (General_options::plugins): New function.
13091         (General_options::add_plugin): New function.
13092         (General_options::plugins_): New field.
13093         * plugin.cc: New file.
13094         * plugin.h: New file.
13095         * readsyms.cc: Include "plugin.h".
13096         (Read_symbols::do_read_symbols): Check for archive before checking
13097         for ELF file.  Call plugin hooks to claim files.
13098         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13099         from a real object file; force override when processing replacement
13100         files.
13101         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13102         (Symbol::init_base_object): Likewise.
13103         (Symbol::init_base_output_data): Likewise.
13104         (Symbol::init_base_output_segment): Likewise.
13105         (Symbol::init_base_constant): Likewise.
13106         (Symbol::init_base_undefined): Likewise.
13107         (Symbol::output_section): Assert that object is not a plugin.
13108         (Symbol_table::add_from_pluginobj): New function.
13109         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13110         undefined.
13111         (Symbol_table::sized_write_globals): Likewise.
13112         (Symbol_table::add_from_pluginobj): Instantiate template.
13113         * symtab.h (Sized_pluginobj): Declare.
13114         (Symbol::in_real_elf): New function.
13115         (Symbol::set_in_real_elf): New function.
13116         (Symbol::in_real_elf_): New field.
13117         (Symbol_table::add_from_pluginobj): New function.
13118
13119         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13120         (LIBDL): New variable.
13121         (LDADD): Add LIBDL.
13122         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13123         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13124         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13125         (MOSTLYCLEANFILES): Likewise.
13126         * testsuite/Makefile.in: Regenerate.
13127         * testsuite/plugin_test.c: New file.
13128         * testsuite/plugin_test_1.sh: New file.
13129         * testsuite/plugin_test_2.sh: New file.
13130
13131 2008-09-16  Ian Lance Taylor  <iant@google.com>
13132
13133         * target-reloc.h (relocate_section): Check whether a symbol is
13134         defined by the ABI before reporting an undefined symbol error.
13135         * target.h (Target::is_defined_by_abi): Make parameter const.
13136         (Target::do_is_defined_by_abi): Likewise.
13137         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13138         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13139         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13140         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13141         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13142         * testsuite/Makefile.in: Rebuild.
13143
13144         * fileread.cc (make_view): Add casts to avoid warning.
13145
13146 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13147
13148         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13149         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13150
13151 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13152
13153         * options.h (General_options::output_is_executable): New.
13154         (General_options::output_is_pie): New.
13155         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13156         for shared libraries.
13157         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13158
13159 2008-09-11  Chris Demetriou  <cgd@google.com>
13160
13161         * options.h (origin): New -z option.
13162         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13163         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13164         in DT_FLAGS_1.
13165
13166 2008-09-05  Cary Coutant  <ccoutant@google.com>
13167
13168         * fileread.cc (File_read::make_view): Add check for attempt to map
13169         beyond end of file.
13170
13171 2008-09-05  Cary Coutant  <ccoutant@google.com>
13172
13173         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13174         explicit instantiations.
13175
13176 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13177
13178         PR gold/6858
13179         * options.cc (General_options::finalize): Allow undefined symbols
13180         in shlibs if linking -shared.
13181
13182         PR gold/6859
13183         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13184         symbols as not needing a dynsym entry.
13185
13186 2008-08-20  Craig Silverstein  <csilvers@google.com>
13187
13188         * fileread.cc (File_read::open): Do not lock the file unless it
13189         was successfully opened.
13190
13191 2008-08-14  Cary Coutant  <ccoutant@google.com>
13192
13193         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13194         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13195         * testsuite/tls_test.cc (struct int128): 128-bit struct
13196         for testing TLS relocs with non-zero addend.
13197         (v12): New TLS variable.
13198         (t12): New test.
13199         (t_last): Add check for v12.
13200         * testsuite/tls_test.h (t12): New function.
13201         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13202
13203 2008-08-13  Ian Lance Taylor  <iant@google.com>
13204
13205         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13206         set tls_segment_ or relro_segment_.
13207         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13208         when appropriate.
13209         * output.h (Output_section::clear_is_relro): New function.
13210         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13211         sections specially even when output_data_ is empty.
13212         (Output_segment::maximum_alignment): When first section is relro,
13213         only force alignment for PT_LOAD segments.
13214         * script.cc (script_data_segment_align): New function.
13215         (script_data_segment_relro_end): New function.
13216         * script-c.h (script_data_segment_align): Declare.
13217         (script_data_segment_relro_end): Declare.
13218         * script-sections.h (class Script_sections): Declare
13219         data_segment_align and data_segment_relro_end.  Add fields
13220         segment_align_index_ and saw_relro_end_.
13221         * script-sections.cc (class Sections_element): Add set_is_relro
13222         virtual function.  Add new bool* parameter to place_orphan_here.
13223         Add get_output_section virtual function.
13224         (class Output_section_definition): Add set_is_relro.  Add new
13225         bool* parameter to place_orphan_here.  Add get_output_section.
13226         Add is_relro_ field.
13227         (Output_section_definition::Output_section_definition): Initialize
13228         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13229         and is_relro_ fields.
13230         (Output_section_definition::place_orphan_here): Add is_relro
13231         parameter.
13232         (Output_section_definition::set_section_addresses): Set relro for
13233         output section.
13234         (Output_section_definition::alternate_constraint): Likewise.
13235         (class Orphan_output_section): Add new bool* parameter to
13236         place_orphan_here.  Add get_output_section.
13237         (Orphan_output_section::place_orphan_here): Add is_relro
13238         parameter.
13239         (Script_sections::Script_sections): Initialize
13240         data_segment_align_index_ and saw_relro_end_.
13241         (Script_sections::data_segment_align): New function.
13242         (Script_sections::data_segment_relro_end): New function.
13243         (Script_sections::place_orphan): Set or clear is_relro.
13244         (Script_sections::set_section_addresses): Force alignment of first
13245         TLS section.
13246         * yyscript.y (exp): Call script_data_segment_align and
13247         script_data_segment_relro_end.
13248         * testsuite/relro_script_test.t: New file.
13249         * testsuite/relro_test.cc (using_script): Declare.
13250         (t1, t2): Test using_script.
13251         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13252         (relro_script_test_SOURCES): Define.
13253         (relro_script_test_DEPENDENCIES): Define.
13254         (relro_script_test_LDFLAGS): Define.
13255         (relro_script_test_LDADD): Define.
13256         (relro_script_test.so): New target.
13257         * testsuite/Makefile.in: Rebuild.
13258
13259 2008-08-06  Cary Coutant <ccoutant@google.com>
13260
13261         * archive.cc (Archive::total_archives, Archive::total_members)
13262         (Archive::total_members_loaded): New variables.
13263         (Archive::setup): Add parameter.  Add option to preread
13264         archive symbols.
13265         (Archive::read_armap): Add counter.
13266         (Archive::get_file_and_offset): New function.
13267         (Archive::get_elf_object_for_member): New function.
13268         (Archive::read_all_symbols): New function.
13269         (Archive::read_symbols): New function.
13270         (Archive::add_symbols): Add counters.
13271         (Archive::include_all_members): Use armap to find members if it's
13272         already built.
13273         (Archive::include_member): Skip reading symbols if already read.
13274         Factored code into Archive::get_file_and_offset and
13275         Archive::get_elf_object_for_member.  Changed call to
13276         Mapfile::report_include_archive_member.
13277         (Archive::print_stats): New function.
13278         * archive.h: Declare Object and Read_symbols_data classes.
13279         (Archive::Archive): Add initializers for new members.
13280         (Archive::setup): Add parameter.
13281         (Archive::print_stats): New function.
13282         (Archive::total_archives, Archive::total_members)
13283         (Archive::total_members_loaded): New variables.
13284         (Archive::get_file_and_offset): New function.
13285         (Archive::get_elf_object_for_member): New function.
13286         (Archive::read_all_symbols): New function.
13287         (Archive::read_symbols): New function.
13288         (Archive::Archive_member): New class.
13289         (Archive::members_): New member.
13290         (Archive::num_members_): New member.
13291         * main.cc: Include archive.h.
13292         (main): Call Archive::print_stats.
13293         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13294         archive parameter; member_name is now the fully-decorated name.
13295         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13296         * options.h: (General_options): Add --preread-archive-symbols option.
13297         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13298         Archive::setup.
13299
13300 2008-08-04  Ian Lance Taylor  <iant@google.com>
13301
13302         * symtab.h (Symbol::use_plt_offset): New function.
13303         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13304         * powerpc.cc (Relocate::relocate): Likewise.
13305         * sparc.cc (Relocate::relocate): Likewise.
13306         * x86_64.cc (Relocate::relocate): Likewise.
13307         * testsuite/weak_plt.sh: New test.
13308         * testsuite/weak_plt_main.cc: New test.
13309         * testsuite/weak_plt_shared.cc: New test.
13310         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13311         (check_PROGRAMS): Add weak_plt.
13312         (check_DATA): Add weak_plt_shared.so.
13313         (weak_plt_main_pic.o, weak_plt): New targets.
13314         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13315         * testsuite/Makefile.in: Rebuild.
13316
13317         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13318         gcctestdir/ld.
13319         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13320         * testsuite/Makefile.in: Rebuild.
13321
13322 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13323
13324         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13325         * Makefile.in: Regenerate.
13326         * po/POTFILES.in: Regenerate.
13327
13328 2008-07-29  Ian Lance Taylor  <iant@google.com>
13329
13330         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13331         symbols before other symbols.
13332         * testsuite/script_test_2.cc (test_addr): Declare.
13333         (test_addr_alias): Declare.
13334         (main): Check that test_addr and test_addr_alias have the right
13335         values.
13336         * testsuite/script_test_2.t: Define test_addr_alias and
13337         test_addr.
13338
13339 2008-07-24  Ian Lance Taylor  <iant@google.com>
13340
13341         PR 5990
13342         * descriptors.cc: New file.
13343         * descriptors.h: New file.
13344         * gold-threads.h (class Hold_optional_lock): New class.
13345         * fileread.cc: Include "descriptors.h".
13346         (File_read::~File_read): Release descriptor rather than closing
13347         it.
13348         (File_read::open) [file]: Call open_descriptor rather than open.
13349         Set is_descriptor_opened_.
13350         (File_read::open) [memory]: Assert that descriptor is not open.
13351         (File_read::reopen_descriptor): New function.
13352         (File_read::release): Release descriptor.
13353         (File_read::do_read): Make non-const.  Reopen descriptor.
13354         (File_read::read): Make non-const.
13355         (File_read::make_view): Reopen descriptor.
13356         (File_read::do_readv): Likewise.
13357         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13358         Update declarations.
13359         * layout.cc: Include "descriptors.h".
13360         (Layout::create_build_id): Use open_descriptor rather than open.
13361         * output.cc: Include "descriptors.h".
13362         (Output_file::open): Use open_descriptor rather than open.
13363         * archive.cc (Archive::const_iterator): Change Archive to be
13364         non-const.
13365         (Archive::begin, Archive::end): Make non-const.
13366         (Archive::count_members): Likewise.
13367         * archive.h (class Archive): Update declarations.
13368         * object.h (Object::read): Make non-const.
13369         * Makefile.am (CCFILES): Add descriptors.cc.
13370         (HFILES): Add descriptors.h.
13371         * Makefile.in: Rebuild.
13372
13373         PR 6716
13374         * gold.h: Always include <clocale>.  Add Solaris workarounds
13375         following code in binutils/sysdep.h.
13376
13377         PR 6048
13378         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13379         this->eh_frame_hdr_ is NULL before using it.
13380
13381         * dynobj.cc (Versions::Versions): Update comment.
13382
13383         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13384         the base version name.
13385
13386         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13387         array size plus one.
13388         (Stringpool_template::set_string_offsets): Subtract one from key
13389         before using it as an array index.
13390         (Stringpool_template::get_offset_with_length): Likewise.
13391         (Stringpool_template::write_to_buffer): Likewise.
13392         * stringpool.h (Stringpool_template::get_offset_from_key):
13393         Likewise.
13394
13395 2008-07-23  Ian Lance Taylor  <iant@google.com>
13396
13397         PR 6658
13398         * object.h (Merged_symbol_value::value): Do our best to handle a
13399         negative addend.
13400
13401         PR 6647
13402         * script.cc (Version_script_info::get_versions): Don't add empty
13403         version tag to return value.
13404         (Version_script_info::get_symbol_version_helper): Change return
13405         type to bool.  Add pversion parameter.  Change all callers.
13406         (script_register_vers_node): Don't require a non-NULL tag.
13407         * script.h (class Version_script_info): Update declarations.
13408         (Version_script_info::get_symbol_version): Change return type to
13409         bool.  Add version parameter.  Change all callers.
13410         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13411         handling.  Handle an empty version from a version script.
13412         (Symbol_table::define_special_symbol): Likewise.
13413         * testsuite/ver_test_10.script: New file.
13414         * testsuite/ver_test_10.sh: New file.
13415         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13416         (check_DATA): Add ver_test_10.syms.
13417         (ver_test_10.syms, ver_test_10.so): New target.
13418         * testsuite/Makefile.in: Rebuild.
13419
13420 2008-07-23  Simon Baldwin  <simonb@google.com>
13421
13422         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13423         to zero for undefined symbols from dynamic libraries.
13424
13425 2008-07-23  Ian Lance Taylor  <iant@google.com>
13426
13427         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13428         Change all callers.
13429         * symtab.h (class Symbol_table): Update declaration.
13430         * testsuite/ver_test_9.cc: New file.
13431         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13432         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13433         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13434         (ver_test_9.so, ver_test_9.o): New targets.
13435         * testsuite/Makefile.in: Rebuild.
13436
13437 2008-07-22  Ian Lance Taylor  <iant@google.com>
13438
13439         * options.h (class General_options): Define --check-sections.
13440         * layout.cc (Layout::set_segment_offsets): Handle
13441         --check-sections.
13442
13443         * options.h (class General_options): Define -n/--nmagic and
13444         -N/--omagic.
13445         * options.cc (General_options::finalize): For -n/--nmagic or
13446         -N/--omagic, set -static.
13447         * layout.cc (Layout::attach_allocated_section_to_segment): If
13448         -N/--omagic, don't put read-only and read-write sections in
13449         different segments.
13450         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13451         finding a read-only segment.
13452         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13453         don't set the minimum segment alignment to the common page size,
13454         and don't set the file offset to the address modulo the page size.
13455         * script-sections.cc (Script_sections::create_segments): If
13456         -n/--omagic, don't put read-only and read-write sections in
13457         different segments.
13458
13459         * cref.cc: New file.
13460         * cref.h: New file.
13461         * options.h (class General_options): Add --print-symbol-counts.
13462         * main.cc (main): Issue defined symbol report if requested.
13463         * archive.cc (Archive::interpret_header): Make into a const member
13464         function.
13465         (Archive::add_symbols): Call Input_objects::archive_start and
13466         archive_stop.
13467         (Archive::const_iterator): Define new class.
13468         (Archive::begin, Archive::end): New functions.
13469         (Archive::include_all_members): Rewrite to use iterator.
13470         (Archive::count_members): New function.
13471         * archive.h (class Archive): Update declarations.
13472         (Archive::filename): New function.
13473         * object.cc: Include "cref.h".
13474         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13475         (Sized_relobj::do_get_global_symbol_counts): New function.
13476         (Input_objects::add_object): Add object to cross-referencer.
13477         (Input_objects::archive_start): New function.
13478         (Input_objects::archive_stop): New function.
13479         (Input_objects::print_symbol_counts): New function.
13480         * object.h: Declare Cref and Archive.
13481         (Object::get_global_symbol_counts): New function.
13482         (Object::do_get_global_symbol_counts): New pure virtual function.
13483         (class Sized_relobj): Add defined_count_ field.  Update
13484         declarations.
13485         (class Input_objects): Add cref_ field.  Update constructor.
13486         Update declarations.
13487         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13488         defined_count_.
13489         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13490         symbol counts.
13491         (Sized_dynobj::do_get_global_symbol_counts): New function.
13492         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13493         defined_count_.  Update declarations.  Define Symbols typedef.
13494         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13495         parameter.  Change all callers.
13496         (Symbol_table::add_from_dynobj): Add sympointers and defined
13497         parameters.  Change all callers.
13498         * symtab.h (class Symbol_table): Update declarations.
13499         * Makefile.am (CCFILES): Add cref.cc.
13500         (HFILES): Add cref.h.
13501         * Makefile.in: Rebuild.
13502
13503 2008-07-22  Simon Baldwin  <simonb@google.com>
13504
13505         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13506         to zero when writing undefined symbols.
13507
13508 2008-07-22  Ian Lance Taylor  <iant@google.com>
13509
13510         * output.cc (Output_section::add_input_section): Don't try to
13511         merge empty merge sections.
13512
13513 2008-07-21  Craig Silverstein  <csilvers@google.com>
13514
13515         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13516         Include symbol version in error message.
13517
13518 2008-07-20  Chris Demetriou  <cgd@google.com>
13519
13520         * configure.ac (gold_cv_c_random_seed): New configured variable.
13521         (RANDOM_SEED_CFLAGS): New substituted variable.
13522         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13523         * configure: Rebuild.
13524         * Makefile.in: Likewise.
13525         * testsuite/Makefile.in: Likewise.
13526
13527 2008-07-18  Ian Lance Taylor  <iant@google.com>
13528
13529         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13530         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13531         * testsuite/ver_test_main.cc (main): Call t4.
13532         (t4, t4_2a): Define.
13533         * testsuite/ver_test_2.cc (t4_2): Define.
13534         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13535         * testsuite/ver_test_4.cc (t4_2a): Define.
13536         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13537         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13538
13539 2008-07-17  Ian Lance Taylor  <iant@google.com>
13540
13541         * dynobj.cc (Versions::add_def): If we give an error about a
13542         missing version, go ahead and create the version anyhow.
13543
13544 2008-07-10  Ian Lance Taylor  <iant@google.com>
13545
13546         Handle output sections with more than 0x7fffffff bytes.
13547         * object.h (class Relobj): Change map_to_output_ to
13548         output_sections_, and just keep a section pointer.  Change all
13549         uses.  Move comdat group support to Sized_relobj.
13550         (Relobj::is_section_specially_mapped): Remove.
13551         (Relobj::output_section): Remove poff parameter.  Change all
13552         callers.
13553         (Relobj::output_section_offset): New function.
13554         (Relobj::set_section_offset): Rewrite.
13555         (Relobj::map_to_output): Remove.
13556         (Relobj::output_sections): New function.
13557         (Relobj::do_output_section_offset): New pure virtual function.
13558         (Relobj::do_set_section_offset): Likewise.
13559         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13560         group support from Relobj.  Update declarations.
13561         (Sized_relobj::get_output_section_offset): New function.
13562         (Sized_relobj::do_output_section_offset): New function.
13563         (Sized_relobj::do_set_section_offset): New function.
13564         * object.cc (Relobj::output_section_address): Remove.
13565         (Sized_relobj::Sized_relobj): Initialize new fields.
13566         (Sized_relobj::include_section_group): Cast find_kept_object to
13567         Sized_relobj.
13568         (Sized_relobj::include_linkonce_section): Likewise.
13569         (Sized_relobj::do_layout): Use separate arrays for output section
13570         and output offset.
13571         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13572         output_sections.
13573         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13574         output_sections and section_offsets.
13575         (Sized_relobj::write_local_symbols): Likewise.
13576         (map_to_kept_section): Compute output address directly.
13577         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13578         output_sections and section_offsets.
13579         (Sized_relobj::write_sections): Likewise.
13580         (Sized_relobj::relocate_sections): Likewise.
13581         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13582         * output.h (class Output_reloc): Update declarations.  Change
13583         u2_.relobj to Sized_relobj*.
13584         (class Output_data_reloc): Change add functions to use
13585         Sized_relobj*.
13586         * output.cc (Output_reloc::Output_reloc): Change relobj to
13587         Sized_relobj*.
13588         (Output_reloc::local_section_offset): Change return type to
13589         Elf_Addr.  Use get_output_section_offset.
13590         (Output_reloc::get_address): Likewise.
13591         (Output_section::is_input_address_mapped): Don't call
13592         is_section_specially_mapped.
13593         (Output_section::output_offset): Likewise.
13594         (Output_section::output_address): Likewise.
13595         (Output_section::starting_output_address): Likewise.
13596         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13597         parameter to Sized_relobj*.
13598         (Copy_relocs::need_copy_reloc): Likewise.
13599         (Copy_relocs::save): Likewise.
13600         * copy-relocs.h (class Copy_relocs): Update declarations.
13601         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13602         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13603         * target-reloc.h (relocate_for_relocatable): Change
13604         offset_in_output_section type to Elf_Addr.  Change code that uses
13605         it as well.
13606         * layout.cc (Layout::layout): Always set *off.
13607         * mapfile.cc (Mapfile::print_input_section): Use
13608         output_section_offset.
13609         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13610         Sized_relobj*.
13611         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13612         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13613         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13614
13615 2008-07-03  Ian Lance Taylor  <iant@google.com>
13616
13617         * layout.cc (Layout::include_section): Do not discard unrecognized
13618         SHT_STRTAB sections.
13619
13620 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13621
13622         * script.cc (Lex::can_continue_name): Make '?' allowable in
13623         version-script names.
13624         * testsuite/version_script.map: Change glob pattern to use '?'
13625
13626 2008-06-30  Manish Singh  <yosh@gimp.org>
13627
13628         PR 6585
13629         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13630         Correct typo.
13631
13632 2008-06-30  Ian Lance Taylor  <iant@google.com>
13633
13634         PR 6660
13635         PR 6682
13636         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13637         versions]: Don't try to read the value in the contents, since we
13638         don't use it.  Use the template endianness when writing.
13639
13640 2008-06-25  Cary Coutant  <ccoutant@google.com>
13641
13642         * fileread.cc (File_read::make_view): Assert on zero-length view.
13643         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13644         symbol table when there are no symbols to read.
13645
13646 2008-06-23  Craig Silverstein  <csilvers@google.com>
13647
13648         * version.cc (version_string): Bump to 1.7
13649
13650 2008-06-18  Craig Silverstein  <csilvers@google.com>
13651
13652         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13653         constant 0xFFFF to type Valtype.
13654         (Powerpc_relocate_functions::rel16_ha): Likewise.
13655
13656 2008-06-17  Ian Lance Taylor  <iant@google.com>
13657
13658         * output.h (Output_section::Input_section): Initialize p2align_ to
13659         zero for Output_section_data constructors.
13660         (Output_section::Input_section::addralign): If not an input
13661         section, return the alignment of the Output_section_data.
13662         * testsuite/copy_test.cc: New file.
13663         * testsuite/copy_test_1.cc: New file.
13664         * testsuite/copy_test_2.cc: New file.
13665         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13666         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13667         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13668         (copy_test_1_pic.o, copy_test_1.so): New targets.
13669         (copy_test_2_pic.o, copy_test_2.so): New targets.
13670         * testsuite/Makefile.in: Rebuild.
13671
13672         * script-sections.cc (Script_sections::place_orphan): Initialize
13673         local variable exact.
13674
13675 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13676
13677         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13678
13679 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13680             David S. Miller  <davem@davemloft.net>
13681
13682         * powerpc.cc: New file.
13683         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13684         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13685         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13686         * Makefile.in: Rebuild.
13687
13688 2008-06-09  Ian Lance Taylor  <iant@google.com>
13689
13690         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13691         <exception>.
13692         (throwing, orig_terminate): New static variables.
13693         (terminate_handler): New static function.
13694         (t2): Set terminate handler.
13695
13696 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13697
13698         PR 6584
13699         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13700         alignment.
13701
13702 2008-05-30  Cary Coutant  <ccoutant@google.com>
13703
13704         * archive.cc (Archive::include_all_members) Correct to step
13705         over symbol table and extended name table in thin archives.
13706
13707 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13708
13709         PR 6407
13710         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13711         calculation.
13712
13713 2008-05-28  Caleb Howe  <cshowe@google.com>
13714
13715         * reduced_debug_output.cc: New file.
13716         * reduced_debug_output.h: New file.
13717         * options.h (class General_options): Add --strip-debug-non-line.
13718         * options.cc (General_options::finalize): Add strip_debug_non_line
13719         to the strip heirarchy.
13720         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13721         fields.
13722         * layout.cc: Include "reduced_debug_output.h".
13723         (Layout::Layout): Initialize new fields.
13724         (line_only_debug_sections): New static array.
13725         (is_lines_only_debug_sections): New static inline function.
13726         (Layout::include_section): Handle --strip-debug-non-line.
13727         (Layout::make_output_section): If --strip-debug-non-line, build
13728         new output sections for .debug_abbrev and .debug_info.
13729         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13730         gold.  Warn about possible overflow.
13731         (read_signed_LEB_128): Likewise.
13732         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13733         (read_signed_LEB_128): Declare.
13734         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13735         (HFILES): Add reduced_debug_output.h.
13736         * Makefile.in: Rebuild.
13737
13738 2008-05-21  Ian Lance Taylor  <iant@google.com>
13739
13740         * mapfile.cc: New file.
13741         * mapfile.h: New file.
13742         * options.h (class General_options): Add -M/--print-map and -Map.
13743         * options.cc (General_options::finalize): Make -M equivalent to
13744         -Map -.
13745         * main.cc: Include <cstdio> and "mapfile.h".
13746         (main): Open mapfile if requested.
13747         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13748         constructor.  Change caller.
13749         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13750         (queue_middle_tasks): Likewise.
13751         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13752         declarations.
13753         * archive.cc: Include "mapfile.h".
13754         (Archive::add_symbols): Add mapfile parameter.  Change all
13755         callers.  Pass mapfile, symbol, and reason to include_member.
13756         (Archive::include_all_members): Add mapfile parameter.  Change all
13757         callers.
13758         (Archive::include_member): Add mapfile, sym, and why parameters.
13759         Change all callers.  Report inclusion to map file.
13760         * archive.h: Include "fileread.h".
13761         (class Archive): Update declarations.
13762         (Archive::file): New const method.
13763         (class Add_archive_symbols): Add mapfile_ field.  Update
13764         constructor.  Change all callers.
13765         * readsyms.h (class Read_symbols): Likewise.
13766         (class Finish_group): Likewise.
13767         (class Read_script): Likewise.
13768         * common.cc: Include "mapfile.h".
13769         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13770         all callers.
13771         (Symbol_table::do_allocate_commons): Likewise.
13772         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13773         symbol allocation to mapfile.
13774         * common.h (class Allocate_commons_task): Add mapfile_ field.
13775         Update constructor.  Change all callers.
13776         * symtab.h (class Symbol_table): Update declarations.
13777         * layout.cc: Include "mapfile.h".
13778         (Layout_task_runner::run): Print information to mapfile.
13779         (Layout::create_gold_note): Change Output_data_fixed_space to
13780         Output_data_zero_fill.
13781         (Layout::create_build_id): Likewise.
13782         (Layout::print_to_mapfile): New function.
13783         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13784         constructor.  Change caller.
13785         (class Layout): Declare print_to_mapfile.
13786         * output.cc (Output_section::Input_section::print_to_mapfile): New
13787         function.
13788         (Output_section::add_input_section): If producing a map, always
13789         add to input_sections_ list.
13790         (Output_section::do_print_to_mapfile): New function.
13791         (Output_segment::print_sections_to_mapfile): New function.
13792         (Output_segment::print_section_list_to_mapfile): New function.
13793         * output.h: Include "mapfile.h".
13794         (Output_data::print_to_mapfile): New function.
13795         (Output_data::do_print_to_mapfile): New virtual function.
13796         (Output_segment_headers::do_print_to_mapfile): New function.
13797         (Output_file_header::do_print_to_mapfile): New function.
13798         (Output_data_const::do_print_to_mapfile): New function.
13799         (class Output_data_const_buffer): Add map_name_ field.  Update
13800         constructor.  Change all callers.  Add do_print_to_mapfile
13801         function.
13802         (class Output_data_fixed_space): Likewise.
13803         (class Output_data_space): Likewise.
13804         (class Output_data_zero_fill): New class.
13805         (Output_data_strtab::do_print_to_mapfile): New function.
13806         (Output_data_reloc_base::do_print_to_mapfile): New function.
13807         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13808         (Output_data_group::do_print_to_mapfile): New function.
13809         (Output_data_got::do_print_to_mapfile): New function.
13810         (Output_data_dynamic::do_print_to_mapfile): New function.
13811         (Output_symtab_xindex::do_print_to_mapfile): New function.
13812         (class Output_section): Declare do_print_to_mapflie.  Declare
13813         print_to_mapfile in Input_section.
13814         (class Output_segment): Declare new functions.
13815         * object.h (Sized_relobj::symbol_count): New function.
13816         * script-sections.cc
13817         (Output_section_element_dot_assignment::set_section_addresses):
13818         Change Output_data_fixed_space to Output_data_zero_fill.
13819         (Output_data_expression::do_print_to_mapfile): New function.
13820         * script.cc (read_input_script): Add mapfile parameter.  Change
13821         all callers.
13822         * script.h (read_input_script): Update declaration.
13823         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13824         (Eh_frame::do_print_to_mapfile): New function.
13825         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13826         (Output_merge_string::do_print_to_mapfile): New function.
13827         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13828         function.
13829         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13830         function.
13831         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13832         function.
13833         * Makefile.am (CCFILES): Add mapfile.cc.
13834         (HFILES): Add mapfile.h.
13835         * Makefile.in: Rebuild.
13836
13837 2008-05-19  Ian Lance Taylor  <iant@google.com>
13838
13839         * options.h (class General_options): Add -z relro.
13840         * layout.cc (Layout::Layout): Initialize relro_segment_.
13841         (Layout::add_output_section_data): Return the output section.
13842         (Layout::make_output_section): Rcognize relro sections and mark
13843         them appropriately.
13844         (Layout::attach_allocated_section_to_segment): Put relro sections
13845         in a PT_GNU_RELRO segment.
13846         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13847         section as relro.
13848         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13849         PT_TLS segments.
13850         (Layout::linkonce_mapping): Map d.rel.ro.local to
13851         .data.rel.ro.local.
13852         (Layout::output_section_name): Us .data.rel.ro.local for any
13853         section which begins with that.
13854         * layout.h (class Layout): Update add_output_section_data
13855         declaration.  Add relro_segment_ field.
13856         * output.cc (Output_section::Output_section): Initialize is_relro_
13857         and is_relro_local_ fields.
13858         (Output_segment::add_output_section): Group relro sections.
13859         (Output_segment::is_first_section_relro): New function.
13860         (Output_segment::maximum_alignment): If there is a relro section,
13861         align the segment to the common page size.
13862         (Output_segment::set_section_addresses): Track whether we are
13863         looking at relro sections.  If the last section is a relro
13864         section, align to the common page size.
13865         (Output_segment::set_section_list_addresses): Add in_relro
13866         parameter.  Change all callers.  Align to the page size when
13867         moving from relro to non-relro section.
13868         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13869         segment.
13870         * output.h (class Output_section): Add is_relro_ and
13871         is_relro_local_ fields.
13872         (Output_section::is_relro): New function.
13873         (Output_section::set_is_relro): New function.
13874         (Output_section::is_relro_local): New function.
13875         (Output_section::set_is_relro_local): New function.
13876         (class Output_segment): Update declarations.
13877         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13878         * sparc.cc (Target_sparc::got_section): Likewise.
13879         * x86_64.cc (Target_x86_64::got_section): Likewise.
13880         * testsuite/relro_test_main.cc: New file.
13881         * testsuite/relro_test.cc: New file.
13882         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13883         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13884         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13885         (relro_test.so, relro_test_pic.o): New targets.
13886         * testsuite/Makefile.in: Rebuild.
13887
13888 2008-05-16  Ian Lance Taylor  <iant@google.com>
13889
13890         * output.cc (Output_segment::add_output_section): Remove front
13891         parameter.
13892         * output.h (class Output_segment): Remove
13893         add_initial_output_section and overloaded add_output_section.
13894         Update declaration of remaining add_output_section.
13895         * layout.cc (Layout::create_interp): Call add_output_section
13896         rather than add_initial_output_section.
13897         (Layout::finish_dynamic_section): Likewise.
13898
13899         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13900         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13901         know the dynamic type.
13902         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13903         field.  Initialize it in constructor.
13904         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13905         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13906         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13907         reloc.
13908
13909         * output.cc (Output_reloc::get_address): Change return type to
13910         Elf_Addr.
13911         * output.h (class Output_reloc): Update get_address declaration.
13912         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13913         for section addresses.
13914
13915 2008-05-09  Ian Lance Taylor  <iant@google.com>
13916
13917         PR 6493
13918         * gold.cc (gold_nomem): Use return value of write.
13919
13920 2008-05-08  Ian Lance Taylor  <iant@google.com>
13921
13922         * symtab.c (Symbol::init_base_output_data): Add version
13923         parameter.  Change all callers.
13924         (Symbol::init_base_output_segment): Likewise.
13925         (Symbol::init_base_constant): Likewise.
13926         (Symbol::init_base_undefined): Likewise.
13927         (Sized_symbol::init_output_data): Likewise.
13928         (Sized_symbol::init_output_segment): Likewise.
13929         (Sized_symbol::init_constant): Likewise.
13930         (Sized_symbol::init_undefined): Likewise.
13931         (Symbol_table::do_define_in_output_data): If the new symbol has a
13932         version, mark it as the default.
13933         (Symbol_table::do_define_in_output_segment): Likewise.
13934         (Symbol_table::do_define_as_constant): Likewise.
13935         * symtab.h (class Symbol): Update declarations.
13936         (class Sized_symbol): Likewise.
13937         * resolve.cc (Symbol::override_version): New function.
13938         (Symbol::override_base): Call override_version.
13939         (Symbol::override_base_with_special): Likewise.
13940         * testsuite/ver_script_8.script: New file.
13941         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13942         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13943         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13944         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13945
13946 2008-05-06  Ian Lance Taylor  <iant@google.com>
13947
13948         PR 6049
13949         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13950         functions.
13951         (class General_options): Remove existing --undefined, and add
13952         --no-undefined instead.  Add new --undefined as synonym for -u.
13953         * archive.cc (Archive::add_symbols): Check whether symbol was
13954         named with -u.
13955         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13956         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13957         all uses.  Add IS_UNDEFINED.  Update declarations to split
13958         different versions of init_base.  Declare init_base_undefined.
13959         (Symbol::is_defined): Handle IS_UNDEFINED.
13960         (Symbol::is_undefined): Likewise.
13961         (Symbol::is_weak_undefined): Call is_undefined.
13962         (Symbol::is_absolute): Handle IS_CONSTANT.
13963         (class Sized_symbol): Update declarations to split different
13964         versions of init.  Declare init_undefined.
13965         (class Symbol_table): Declare new functions.
13966         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13967         Change all callers.
13968         (Symbol::init_base_output_data): Likewise.
13969         (Symbol::init_base_output_segment): Likewise.
13970         (Symbol::init_base_constant): Likewise.
13971         (Symbol::init_base_undefined): New function.
13972         (Sized_symbol::init_object): Rename from init.  Change all
13973         callers.
13974         (Sized_symbol::init_output_data): Likewise.
13975         (Sized_symbol::init_output_segment): Likewise.
13976         (Sized_symbol::init_constant): Likewise.
13977         (Sized_symbol::init_undefined): New function.
13978         (Symbol_table::add_undefined_symbols_from_command_line): New
13979         function.
13980         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13981         function.
13982         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13983         (Symbol::output_section): Likewise.
13984         (Symbol::set_output_section): Likewise.
13985         (Symbol_table::sized_finalize_symbol): Likewise.
13986         (Symbol_table::sized_write_globals): Likewise.
13987         * resolve.cc (Symbol_table::should_override): Likewise.
13988         (Symbol::override_base_with_special): Likewise.
13989
13990         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13991         symbol, change it to have default visibility.
13992         * testsuite/protected_1.cc: New file.
13993         * testsuite/protected_2.cc: New file.
13994         * testsuite/protected_3.cc: New file.
13995         * testsuite/protected_main_1.cc: New file.
13996         * testsuite/protected_main_2.cc: New file.
13997         * testsuite/protected_main_3.cc: New file.
13998         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13999         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14000         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14001         (protected_1.so): New target.
14002         (protected_1_pic.o, protected_2_pic.o): New targets.
14003         (protected_3_pic.o): New target.
14004         (check_PROGRAMS): Add protected_2.
14005         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14006         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14007         * testsuite/Makefile.in: Rebuild.
14008
14009         * options.h (DEFINE_var): Add set_user_set_##varname__.
14010         (DEFINE_bool_alias): New macro.
14011         (class General_options): Define -Bstatic using DEFINE_bool_alias
14012         rather than DEFINE_special.  Add --undefined as an alias for -z
14013         defs.
14014         * options.cc (General_options::parse_Bstatic): Remove.
14015
14016         * options.h (class General_options): Add --fatal-warnings.
14017         * main.cc (main): Implement --fatal-warnings.
14018         * errors.h (Errors::warning_count): New function.
14019
14020         * options.h (class General_options): Add -Bsymbolic-functions.
14021         * symtab.h (Symbol::is_preemptible): Check for
14022         -Bsymbolic-functions.
14023
14024 2008-05-05  Ian Lance Taylor  <iant@google.com>
14025
14026         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14027         as noVARNAME rather than no-VARNAME.
14028         (class General_options): Add option -z combreloc.
14029         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14030         get_address.
14031         (Output_reloc::sort_before) [SHT_REL]: New function.
14032         (Output_reloc::sort_before) [SHT_RELA]: New function.
14033         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14034         Sort_relocs_comparison.
14035         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14036         parameter.  Change all callers.
14037         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14038         sort_relocs parameter.  Change all callers.
14039         * output.cc (Output_reloc::get_address): New function, broken out
14040         of write_rel.
14041         (Output_reloc::write_rel): Call it.
14042         (Output_reloc::compare): New function.
14043         (Output_data_reloc_base::do_write): Optionally sort relocs.
14044
14045         * configure.ac: If targ_extra_obj is set, link it in.
14046         * configure.tgt: Initialize all variables.
14047         (x86_64*): Set targ_extra_obj and targ_extra_size.
14048         * configure: Rebuild.
14049
14050         * object.cc (Sized_relobj::include_section_group): Adjust section
14051         indexes read from group data.  Build vector to pass to
14052         layout_group.
14053         * layout.cc (Layout::layout_group): Add flags and shndxes
14054         parameters.  Remove contents parameter.  Change caller.  Update
14055         explicit instantiations.
14056         * layout.h (class Layout): Update layout_group declaration.
14057         * output.cc (Output_data_group::Output_data_group): Add flags and
14058         input_shndxes parameters.  Remove contents parameter.  Change
14059         caller.
14060         (Output_data_group::do_write): Change input_sections_ to
14061         input_shndxes_.
14062         * output.h (class Output_data_group): Update constructor
14063         declaration.  Rename input_sections_ to input_shndxes_.
14064         * testsuite/many_sections_test.cc: Add template.
14065
14066 2008-04-30  Cary Coutant  <ccoutant@google.com>
14067
14068         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14069
14070         * layout.cc (Layout::include_section): Refactored check for debug
14071         info section.
14072         (Layout::add_comdat): Add new parameters.  Change type
14073         of signature parameter.  Add object and shndx to signatures table.
14074         (Layout::find_kept_object): New function.
14075         * layout.h: Include <cstring>.
14076         (Layout::is_debug_info_section): New function.
14077         (Layout::add_comdat): Add new parameters.
14078         (Layout::find_kept_object): New function.
14079         (Layout::Kept_section): New struct.
14080         (Layout::Signatures): Change type of map range.
14081         * object.cc (Relobj::output_section_address): New function.
14082         (Sized_relobj::include_section_group): Add new parameters.  Change
14083         calls to Layout::add_comdat.  Change to build table of kept comdat
14084         groups and table mapping discarded sections to kept sections.
14085         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14086         (Sized_relobj::do_layout): Change calls to include_section_group and
14087         include_linkonce_section.
14088         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14089         value to zero when section is discarded.
14090         (Sized_relobj::map_to_kept_section): New function.
14091         * object.h (Relobj::output_section_address): New function.
14092         (Relobj::Comdat_group): New type.
14093         (Relobj::find_comdat_group): New function.
14094         (Relobj::Comdat_group_table): New type.
14095         (Relobj::Kept_comdat_section): New type.
14096         (Relobj::Kept_comdat_section_table): New type.
14097         (Relobj::add_comdat_group): New function.
14098         (Relobj::set_kept_comdat_section): New function.
14099         (Relobj::get_kept_comdat_section): New function.
14100         (Relobj::comdat_groups_): New field.
14101         (Relobj::kept_comdat_sections_): New field.
14102         (Symbol_value::input_value): Update comment.
14103         (Sized_relobj::map_to_kept_section) New function.
14104         (Sized_relobj::include_linkonce_section): Add new parameter.
14105         * target-reloc.h (Comdat_behavior): New type.
14106         (get_comdat_behavior): New function.
14107         (relocate_section): Add code to map a discarded section to the
14108         corresponding kept section when applying a relocation.
14109
14110 2008-04-30  Craig Silverstein  <csilvers@google.com>
14111
14112         * dwarf_reader.cc (next_generation_count): New static var.
14113         (Addr2line_cache_entry): New struct.
14114         (addr2line_cache): New static var.
14115         (Dwarf_line_info::one_addr2line): Added caching.
14116         (Dwarf_line_info::clear_addr2line_cache): New function.
14117         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14118         cache-size parameter.
14119         (Dwarf_line_info::one_addr2line_cache): New function.
14120         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14121         new cache-size argument to one_addr2line(), and clear cache.
14122
14123 2008-04-28  Cary Coutant  <ccoutant@google.com>
14124
14125         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14126         R_386_PC8 relocations.
14127
14128 2008-04-23  Ian Lance Taylor  <iant@google.com>
14129
14130         * object.cc (Sized_relobj::include_section_group): Check for
14131         invalid section group.
14132
14133         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14134         header size.
14135
14136         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14137         than read for file header.
14138         * archive.cc (Archive::include_member): Likewise.
14139
14140 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14141
14142         * aclocal.m4: Regenerate.
14143         * configure: Regenerate.
14144
14145 2008-04-19  Ian Lance Taylor  <iant@google.com>
14146
14147         * version.cc (version_string): Bump to 1.6.
14148
14149         * testsuite/Makefile.am (many_sections_r_test): New target.
14150         (many_sections_r_test_SOURCES): Remove.
14151         (many_sections_r_test_DEPENDENCIES): Remove.
14152         (many_sections_r_test_LDFLAGS): Remove.
14153         (many_sections_r_test_LDADD): Remove.
14154
14155         * object.cc (Sized_relobj::do_add_symbols): Always pass
14156         local_symbol_count_ to add_from_relobj.
14157
14158         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14159         every thousand variables.
14160         * testsuite/Makefile.in: Rebuild.
14161
14162         * object.cc (Xindex::initialize_symtab_xindex): New function.
14163         (Xindex::read_symtab_xindex): New function.
14164         (Xindex::sym_xindex_to_shndx): New function.
14165         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14166         available.
14167         (Sized_relobj::do_initialize_xindex): New function.
14168         (Sized_relobj::do_read_symbols): Adjust section links.
14169         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14170         parameter.  Change all callers.
14171         (Sized_relobj::include_section_group): Adjust section links and
14172         symbol section indexes.
14173         (Sized_relobj::do_layout): Adjust section links.
14174         (Sized_relobj::do_count_local_symbols): Adjust section links and
14175         symbol section indexes.
14176         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14177         ordinary and special symbols.
14178         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14179         dynsym_xindex parameters.  Change all callers.  Adjust section
14180         links.  Use SHN_XINDEX when needed.
14181         (Sized_relobj::get_symbol_location_info): Adjust section links.
14182         Don't get fooled by special symbols.
14183         * object.h (class Xindex): Define.
14184         (class Object): Add xindex_ parameter.  Declare virtual functoin
14185         do_initialize_xindex.
14186         (Object::adjust_sym_shndx): New function.
14187         (Object::set_xindex): New protected function.
14188         (class Symbol_value): Add is_ordinary_shndx_ field.
14189         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14190         (Symbol_value::value): Assert ordinary section.
14191         (Symbol_value::initialize_input_to_output_map): Likewise.
14192         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14193         Change all callers.
14194         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14195         all callers.
14196         (class Sized_relobj): Update declarations.
14197         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14198         parameter.  Change all callers.
14199         (Sized_relobj::adjust_shndx): New function.
14200         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14201         field.
14202         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14203         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14204         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14205         (Sized_dynobj::read_dynsym_section): Adjust section links.
14206         (Sized_dynobj::read_dynamic): Likewise.
14207         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14208         section links.
14209         (Sized_dynobj::do_initialize_xindex): New function.
14210         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14211         do_initialize_xindex.
14212         (Sized_dynobj::adjust_shndx): New function.
14213         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14214         dynsym_xindex_ fields.
14215         (Layout::finalize): Add a call to set_section_indexes before
14216         creating the symtab sections.
14217         (Layout::set_section_indexes): Don't do anything if the section
14218         already has a section index.
14219         (Layout::create_symtab_sections): Add shnum parameter.  Change
14220         caller.  Create .symtab_shndx section if needed.
14221         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14222         caller.
14223         (Layout::allocated_output_section_count): New function.
14224         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14225         needed.
14226         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14227         fields.  Update declarations.
14228         (Layout::symtab_xindex): New function.
14229         (Layout::dynsym_xindex): New function.
14230         (class Write_symbols_task): Add layout_ field.
14231         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14232         Change caller.
14233         * output.cc (Output_section_headers::Output_section_headers): Add
14234         shstrtab_section parameter.  Change all callers.
14235         (Output_section_headers::do_sized_write): Store overflow values
14236         for section count and section string table section index in
14237         section header zero.
14238         (Output_file_header::do_sized_write): Check for overflow of
14239         section count and section string table section index.
14240         (Output_symtab_xindex::do_write): New function.
14241         (Output_symtab_xindex::endian_do_write): New function.
14242         * output.h (class Output_section_headers): Add shstrtab_section_.
14243         Update declarations.
14244         (class Output_symtab_xindex): Define.
14245         (Output_section::has_out_shndx): New function.
14246         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14247         field.
14248         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14249         Change all callers.
14250         (Sized_symbol::init): Likewise.
14251         (Symbol::output_section): Check for ordinary symbol.
14252         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14253         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14254         callers.
14255         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14256         Change all callers.  Simplify handling of symbols from sections
14257         not included in the link.
14258         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14259         distinction.
14260         (Weak_alias_sorter::operator()): Assert that symbols are
14261         ordinary.
14262         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14263         distinction.
14264         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14265         parameters.  Change all callers.
14266         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14267         symbol distinction.  Use SHN_XINDEX when needed.
14268         (Symbol_table::write_section_symbol): Add symtab_xindex
14269         parameter.  Change all callers.
14270         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14271         SHN_XINDEX when needed.
14272         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14273         declarations.
14274         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14275         (Symbol::is_defined): Check is_ordinary.
14276         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14277         (Symbol::is_absolute, Symbol::is_common): Likewise.
14278         (class Sized_symbol): Update declarations.
14279         (class Symbol_table): Update declarations.
14280         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14281         parameters.  Change all callers.
14282         (Sized_symbol::override): Likewise.
14283         (Symbol_table::override): Likewise.
14284         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14285         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14286         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14287         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14288         to be in an ordinary section.
14289         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14290         object and is_ordinary parameters.  Change all callers.
14291         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14292         Change all callers.  Don't add undefined or non-ordinary symbols
14293         to reloc_map_.
14294         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14295         Change all callers.
14296         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14297         declarations.
14298         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14299         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14300         (Sized_relobj::relocate_sections): Likewise.
14301         * target-reloc.h (scan_relocs): Adjust section symbol index.
14302         (scan_relocatable_relocs): Likewise.
14303         * i386.cc (Scan::local): Check for ordinary symbols.
14304         * sparc.cc (Scan::local): Likewise.
14305         * x86_64.cc (Scan::local): Likewise.
14306         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14307         to symbol_section_and_value.
14308         * testsuite/many_sections_test.cc: New file.
14309         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14310         (check_PROGRAMS): Add many_sections_test.
14311         (many_sections_test_SOURCES): Define.
14312         (many_sections_test_DEPENDENCIES): Define.
14313         (many_sections_test_LDFLAGS): Define.
14314         (BUILT_SOURCES): Add many_sections_define.h.
14315         (many_sections_define.h): New target.
14316         (BUILT_SOURCES): Add many_sections_check.h.
14317         (many_sections_check.h): New target.
14318         (check_PROGRAMS): Add many_sections_r_test.
14319         (many_sections_r_test_SOURCES): Define.
14320         (many_sections_r_test_DEPENDENCIES): Define.
14321         (many_sections_r_test_LDFLAGS): Define.
14322         (many_sections_r_test_LDADD): Define.
14323         (many_sections_r_test.o): New target.
14324         * testsuite/Makefile.in: Rebuild.
14325
14326 2008-04-17  Cary Coutant  <ccoutant@google.com>
14327
14328         * errors.cc (Errors::info): New function.
14329         (gold_info): New function.
14330         * errors.h (Errors::info): New function.
14331         * gold.h (gold_info): New function.
14332         * object.cc (Input_objects::add_object): Print trace output.
14333         * options.cc (options::parse_set): New function.
14334         (General_options::parse_wrap): Deleted.
14335         (General_options::General_options): Deleted initializer.
14336         * options.h (options::String_set): New typedef.
14337         (options::parse_set): New function.
14338         (DEFINE_set): New macro.
14339         (General_options::wrap): Changed to use DEFINE_set. Changed
14340         callers of any_wrap_symbols and is_wrap_symbol.
14341         (General_options::trace, General_options::trace_symbol):
14342         New options.
14343         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14344         (General_options::wrap_symbols_): Deleted.
14345         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14346
14347 2008-04-17  David S. Miller  <davem@davemloft.net>
14348
14349         * options.cc (General_options::parse_V): New function.
14350         * options.h: Add entries for -V and -Qy.
14351
14352 2008-04-17  Ian Lance Taylor  <iant@google.com>
14353
14354         * common.cc (Symbol_table::allocate_commons): Remove options
14355         parameter.  Change caller.
14356         (Symbol_table::do_allocate_commons): Remove options parameter.
14357         Change caller.  Just call do_allocate_commons_list twice.
14358         (Symbol_table::do_allocate_commons_list): New function, broken out
14359         of do_allocate_commons.
14360         * common.h (class Allocate_commons_task): Remove options_ field.
14361         Update constructor.
14362         * symtab.cc (Symbol_table::Symbol_table): Initialize
14363         tls_commons_.
14364         (Symbol_table::add_from_object): Put TLS common symbols on
14365         tls_commons_ list.
14366         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14367         which are IN_OUTPUT_DATA.
14368         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14369         allocate_commons and do_allocate_commons declarations.  Declare
14370         do_allocate_commons_list.
14371         * gold.cc (queue_middle_tasks): Update creation of
14372         Allocate_commons_task to not pass options.
14373         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14374         (TLS_TEST_C_FLAGS): New variable.
14375         (tls_test_c_pic.o): New target.
14376         (tls_test_shared.so): Link in tls_test_c_pic.o.
14377         (tls_test_c_pic_ie.o): New target.
14378         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14379         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14380         (tls_test_c.o): New target.
14381         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14382         (tls_pic_test_LDADD): Likewise.
14383         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14384         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14385         (tls_test_c_gnu2.o): New target.
14386         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14387         tls_test_c_gnu2.o.
14388         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14389         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14390         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14391         * testsuite/tls_test.cc: Include "config.h".
14392         (t_last): Call t11_last.
14393         * testsuite/tls_test.h (t11, t11_last): Declare.
14394         * testsuite/tls_test_c.c: New file.
14395         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14396         * configure.ac: Check for OpenMP support.
14397         * configure, config.in, Makefile.in: Rebuild.
14398         * testsuite/Makefile.in: Rebuild.
14399
14400 2008-04-16  Cary Coutant  <ccoutant@google.com>
14401
14402         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14403         (Target_i386::tls_base_symbol_defined_): New field.
14404         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14405         (Target_i386::Scan::global): Likewise.
14406         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14407         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14408         (Target_x86_64::tls_base_symbol_defined_): New field.
14409         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14410         (Target_x86_64::Scan::global): Likewise.
14411
14412 2008-04-16  Cary Coutant  <ccoutant@google.com>
14413
14414         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14415         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14416         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14417         building shared libraries.
14418         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14419         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14420         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14421         * testsuite/Makefile.in: Rebuild.
14422         * testsuite/weak_undef.h: New file.
14423         * testsuite/weak_undef_file1.cc: Add extra test cases.
14424         * testsuite/weak_undef_file2.cc: Likewise.
14425         * testsuite/weak_undef_test.cc: Likewise.
14426
14427 2008-04-16  David S. Miller  <davem@davemloft.net>
14428
14429         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14430         Add issued_non_pic_error_ field.  Declare check_non_pic.
14431         (Target_sparc::Scan::check_non_pic): New function.
14432         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14433         (Target_sparc::Scan::global): Likewise.
14434
14435         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14436         * configure: Rebuild.
14437
14438         * options.h (DEFINE_enable): New macro.
14439         (new_dtags): New enable option.
14440         (initfirst, interpose, loadfltr, nodefaultlib,
14441         nodelete, nodlopen, nodump): New -z options.
14442         * layout.cc (Layout:finish_dynamic_section): If new
14443         dtags enabled, emit DT_RUNPATH.  Also, emit a
14444         DT_FLAGS_1 containing any specified -z flags.
14445
14446 2008-04-16  Ian Lance Taylor  <iant@google.com>
14447
14448         * copy-relocs.cc: New file.
14449         * copy-relocs.h: New file.
14450         * reloc.cc: Remove Copy_relocs code.
14451         * reloc.h: Likewise.
14452         * reloc-types.h (struct Reloc_types) [both versions]: Add
14453         get_reloc_addend_noerror.
14454         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14455         variants of add_global which take an addend which must be zero.
14456         * i386.cc: Include "copy-relocs.h".
14457         (class Target_i386): Change type of copy_relocs_ to variable,
14458         update initializer.
14459         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14460         Change all callers.
14461         (Target_i386::do_finalize_sections): Change handling of
14462         copy_relocs_.
14463         * sparc.cc: Include "copy-relocs.h".
14464         (class Target_sparc): Change type of copy_relocs_ to variable,
14465         update initializer.
14466         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14467         Change all callers.
14468         (Target_sparc::do_finalize_sections): Change handling of
14469         copy_relocs_.
14470         * x86_64.cc: Include "copy-relocs.h".
14471         (class Target_x86_64): Change type of copy_relocs_ to variable,
14472         update initializer.
14473         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14474         class.  Change all callers.
14475         (Target_x86_64::do_finalize_sections): Change handling of
14476         copy_relocs_.
14477         * Makefile.am (CCFILES): Add copy-relocs.cc.
14478         (HFILES): Add copy-relocs.h.
14479
14480         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14481
14482         * testsuite/script_test_4.sh: Permit leading zeroes.
14483
14484 2008-04-15  Ian Lance Taylor  <iant@google.com>
14485
14486         * script-sections.cc (Script_sections::create_segments): Use
14487         header_size_adjustment even when there is enough room for the
14488         headers.
14489         * testsuite/script_test_4.sh: New file.
14490         * testsuite/script_test_4.t: New file.
14491         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14492         (check_DATA): Add script_test_4.stdout.
14493         (MOSTLYCLEANFILES): Likewise.
14494         (script_test_4): New target.
14495         (script_test_4.stdout): New target.
14496         * testsuite/Makefile.in: Rebuild.
14497
14498         * sparc.cc: Add definitions for Output_data_plt_sparc class
14499         constants.
14500
14501 2008-04-14  David S. Miller  <davem@davemloft.net>
14502
14503         * sparc.cc: New file.
14504         * Makefile.am (TARGETSOURCES): Add sparc.cc
14505         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14506         * configure.tgt: Document targ_extra_size and
14507         targ_extra_big_endian.  Add entries for sparc-* and
14508         sparc64-*.
14509         * configure.ac: Handle targ_extra_size and
14510         targ_extra_big_endian.
14511         * Makefile.in: Rebuild.
14512         * configure: Likewise.
14513         * po/POTFILES.in: Likewise.
14514         * po/gold.pot: Likewise.
14515
14516 2008-04-14  Ian Lance Taylor  <iant@google.com>
14517
14518         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14519         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14520         in the name/type/flags to section mapping.  Don't call
14521         allocate_output_section.
14522         (Layout::choose_output_section): Change parameter from adjust_name
14523         to is_input_section.  Don't permit input sections after sections
14524         are attached to segments.  Don't call allocate_output_section.
14525         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14526         not write_enable_output_section.
14527         (Layout::make_output_section): Don't push to
14528         unattached_section_list_ nor call attach_to_segment.  Call
14529         attach_section_to_segment if sections are attached.
14530         (Layout::attach_sections_to_segments): New function.
14531         (Layout::attach_section_to_segment): New function.
14532         (Layout::attach_allocated_section_to_segment): Rename from
14533         attach_to_segment.  Remove flags parameter.
14534         (Layout::allocate_output_section): Remove function.
14535         (Layout::write_enable_output_section): Remove function.
14536         * layout.h (class Layout): Update for above changes.  Add new
14537         field sections_are_attached_.
14538         * output.h (Output_section::update_flags_for_input_section): New
14539         function.
14540         * output.cc (Output_section::add_input_section): Call
14541         update_flags_for_input_section.
14542         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14543
14544 2008-04-11  Cary Coutant  <ccoutant@google.com>
14545
14546         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14547         thought unnecessary.
14548         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14549
14550 2008-04-11  Ian Lance Taylor  <iant@google.com>
14551
14552         * output.h (class Output_section_data): Remove inline definition
14553         of set_addralign.
14554         * output.cc (Output_section_data::set_addralign): New function.
14555
14556 2008-04-11  Cary Coutant  <ccoutant@google.com>
14557
14558         Add support for TLS descriptors for i386 and x86_64.
14559         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14560         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14561         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14562         GOT_TYPE_TLS_DESC.
14563         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14564         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14565         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14566         relocations.
14567         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14568         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14569         Fix problem with initial-exec relocations.
14570         (Target_i386::Relocate::relocate_tls): Likewise.
14571         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14572         relaxation.
14573         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14574         support for section-plus-offset dynamic table entries.
14575         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14576         (Output_data_dynamic::Dynamic_entry): Add support for
14577         section-plus-offset dynamic table entries.
14578         (Output_data_dynamic::Classification): Likewise.
14579         (Output_data_dynamic::classification_): Renamed offset_.
14580         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14581         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14582         (Target_x86_64::make_plt_section): New function.
14583         (Target_x86_64::reserve_tlsdesc_entries): New function.
14584         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14585         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14586         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14587         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14588         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14589         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14590         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14591         add extra PLT entry for TLS descriptors.
14592         (Output_data_plt_x86_64::got_): New field.
14593         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14594         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14595         fields.
14596         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14597         descriptors.
14598         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14599         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14600         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14601         R_386_TLS_DESC_CALL relocations.
14602         (Target_x86_64::Scan::global): Likewise.
14603         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14604         for TLS descriptors.
14605         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14606         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14607         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14608         GD-to-IE relaxation.
14609         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14610         and TLS_DESCRIPTORS.
14611         * Makefile.in: Rebuild.
14612         * configure: Rebuild.
14613         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14614         (tls_test_shared2.so): New target.
14615         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14616         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14617         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14618         (tls_shared_gd_to_ie_test_LDADD): New variable.
14619         (tls_shared_gnu2_gd_to_ie_test): New target.
14620         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14621         New targets.
14622         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14623         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14624         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14625         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14626         (tls_shared_gnu2_test): New target.
14627         (tls_test_gnu2_shared.so): New target.
14628         (tls_shared_gnu2_test_SOURCES): New variable.
14629         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14630         (tls_shared_gnu2_test_LDFLAGS): New variable.
14631         (tls_shared_gnu2_test_LDADD): New variable.
14632         * testsuite/Makefile.in: Rebuild.
14633         * testsuite/Makefile.
14634
14635 2008-04-11  Ian Lance Taylor  <iant@google.com>
14636
14637         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14638         justsyms.t.
14639         * testsuite/Makefile.in: Rebuild.
14640
14641         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14642         long.
14643         * testsuite/script_test_2.cc (main): Adjust test.
14644
14645 2008-04-11  David S. Miller  <davem@davemloft.net>
14646             Ian Lance Taylor  <iant@google.com>
14647
14648         * options.h (General_options): Add entries for '-Y' and
14649         '-relax'.
14650         * options.cc (General_options:finalize): If -Y was used, add those
14651         entries to the library path instead of the default "/lib" and
14652         "/usr/lib".
14653
14654 2008-04-11  David S. Miller  <davem@davemloft.net>
14655
14656         * testsuite/justsyms.t: Start at 0x100.
14657         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14658         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14659         long.
14660         * testsuite/script_test_2.cc: Adjust string and section length
14661         checks.
14662
14663 2008-04-09  Ian Lance Taylor  <iant@google.com>
14664
14665         PR gold/5996
14666         * script-sections.cc (Sections_element::allocate_to_segment): Add
14667         orphan parameter.
14668         (Output_section_definition::allocate_to_segment): Likewise.
14669         (Orphan_output_section::allocate_to_segment): Likewise.
14670         (Script_sections::attach_sections_using_phdrs_clause): Don't
14671         propagate non-PT_LOAD segments to orphan sections.
14672         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14673         readelf rather than objdump.
14674         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14675         .interp section and PT_INTERP segment are the same size.
14676         * testsuite/Makefile.in: Rebuild.
14677
14678         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14679         aliases for symbols defined in the same object.
14680         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14681         (weak_alias_test_SOURCES): New variable.
14682         (weak_alias_test_DEPENDENCIES): New variable.
14683         (weak_alias_test_LDFLAGS): New variable.
14684         (weak_alias_test_LDADD): New variable.
14685         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14686         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14687         (weak_alias_test_3.o): New target.
14688         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14689         * testsuite/weak_alias_test_main.cc: New file.
14690         * testsuite/weak_alias_test_1.cc: New file.
14691         * testsuite/weak_alias_test_2.cc: New file.
14692         * testsuite/weak_alias_test_3.cc: New file.
14693
14694 2008-04-08  Ian Lance Taylor  <iant@google.com>
14695
14696         * options.h (class General_options): Add --noinhibit-exec option.
14697         * main.cc (main): Check --noinhibit-exec.
14698
14699         * options.h (class General_options): Define --wrap as a special
14700         option.  Add wrap_symbols_ field.
14701         (General_options::any_wrap_symbols): New function.
14702         (General_options::is_wrap_symbol): New function.
14703         * options.cc (General_options::parse_wrap): New function.
14704         (General_options::General_options): Initialize wrap_symbols_.
14705         * symtab.cc (Symbol_table::wrap_symbol): New function.
14706         (Symbol_table::add_from_object): Handle --wrap.
14707         * symtab.h (class Symbol_table): Declare wrap_symbol.
14708         * target.h (Target::wrap_char): New function.
14709         (Target::Target_info): Add wrap_char field.
14710         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14711         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14712         * testsuite/testfile.cc (Target_test::test_target_info):
14713         Likewise.
14714
14715         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14716         there is one.
14717
14718         * layout.h (class Layout): Add added_eh_frame_data_ field.
14719         * layout.cc (Layout::Layout): Initialize new field.
14720         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14721         output section until we find a section we merged successfully.
14722         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14723         that the size be non-zero.
14724
14725         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14726         qualifier.
14727
14728 2008-04-08  Craig Silverstein  <csilvers@google.com>
14729
14730         * configure.ac: Export new conditional variable HAVE_ZLIB.
14731         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14732         on HAVE_ZLIB.
14733         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14734         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14735
14736 2008-04-07  Ian Lance Taylor  <iant@google.com>
14737
14738         * version.cc (version_string): Set to "1.5".
14739
14740         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14741         Add issued_non_pic_error_ field.  Declare check_non_pic.
14742         (Target_x86_64::Scan::check_non_pic): New function.
14743         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14744         (Target_x86_64::Scan::global): Likewise.
14745
14746         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14747         addend parameter.  Change caller.  Handle merge sections.
14748         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14749         Address to Addend.  Don't add in the result of
14750         local_section_offset, pass down the addend and use the returned
14751         value.
14752         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14753         Update declarations of local_section_offset and symbol_value.
14754         * testsuite/two_file_test_1.cc (t18): New function.
14755         * testsuite/two_file_test_2.cc (f18): New function.
14756         * testsuite/two_file_test_main.cc (main): Call t18.
14757         * testsuite/two_file_test.h (t18, f18): Declare.
14758
14759         * configure.ac: Don't test for objdump, c++filt, or readelf.
14760         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14761         conditionals.
14762         (TEST_READELF): New variable.
14763         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14764         (check_PROGRAMS): Add two_file_strip_test.
14765         (two_file_strip_test): New target.
14766         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14767         (two_file_same_shared_strip_test_SOURCES): New variable.
14768         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14769         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14770         (two_file_same_shared_strip_test_LDADD): New variable.
14771         (two_file_shared_strip.so): New target.
14772         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14773         (ver_test_5.syms, ver_test_7.syms): Likewise.
14774         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14775         (strip_test_3.stdout): Use TEST_OBJDUMP.
14776         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14777
14778 2008-04-04  Cary Coutant  <ccoutant@google.com>
14779
14780         * symtab.h (Symbol::is_weak_undefined): New function.
14781         (Symbol::is_strong_undefined): New function.
14782         (Symbol::is_absolute): New function.
14783         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14784         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14785         absolute symbols.
14786         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14787         (weak_undef_test): New target.
14788         * testsuite/Makefile.in: Rebuild.
14789         * testsuite/weak_undef_file1.cc: New file.
14790         * testsuite/weak_undef_file2.cc: New file.
14791         * testsuite/weak_undef_test.cc: New file.
14792
14793 2008-04-03  Craig Silverstein  <csilvers@google.com>
14794
14795         * compressed_output.h (class Output_compressed_section): Use
14796         unsigned buffer.
14797         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14798         add zlib header.
14799         (zlib_compressed_suffix): Removed.
14800         (Output_compressed_section::set_final_data_size): Use unsigned
14801         buffers.
14802         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14803         Fix linker invocation.
14804         (flagstest_o_specialfile_and_compress_debug_sections):
14805         Likewise.
14806         * testsuite/Makefile.in: Regenerated.
14807
14808 2008-04-02  David S. Miller  <davem@davemloft.net>
14809
14810         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14811         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14812
14813 2008-04-02  Craig Silverstein  <csilvers@google.com>
14814
14815         * TODO: New file.
14816
14817 2008-04-02  Ian Lance Taylor  <iant@google.com>
14818
14819         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14820         parameters.  Update for new key type to views_.  Change all
14821         callers.
14822         (File_read::read): Adjust for byteshift in returned view.
14823         (File_read::add_view): New function, broken out of
14824         find_and_make_view.
14825         (File_read::make_view): New function, broken out of
14826         find_and_make_view.
14827         (File_read::find_or_make_view): Add offset and aligned
14828         parameters.  Rewrite accordingly.  Change all callers.
14829         (File_read::get_view): Add offset and aligned parameters.  Adjust
14830         for byteshift in return value.
14831         (File_read::get_lasting_view): Likewise.
14832         * fileread.h (class File_read): Update declarations.
14833         (class File_read::View): Add byteshift_ field.  Add byteshift to
14834         constructor.  Add byteshift method.
14835         * archive.h (Archive::clear_uncached_views): New function.
14836         (Archive::get_view): Add aligned parameter.  Change all callers.
14837         * object.h (Object::get_view): Add aligned parameter.  Change all
14838         callers.
14839         (Object::get_lasting_view): Likewise.
14840
14841         * fileread.cc (File_read::release): Don't call clear_views if
14842         there are multiple objects.
14843         * fileread.h (File_read::clear_uncached_views): New function.
14844         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14845         on the archive.
14846
14847 2008-03-31  Cary Coutant  <ccoutant@google.com>
14848
14849         Add thin archive support.
14850         * archive.cc (Archive::armagt): New const.
14851         (Archive::setup): Remove task parameter and calls to unlock.
14852         (Archive::unlock_nested_archives): New function.
14853         (Archive::read_header): Add nested_off parameter. Change
14854         all callers.
14855         (Archive::interpret_header): Likewise.
14856         (Archive::include_all_members): Change to handle thin
14857         archives.
14858         (Archive::include_member): Likewise.
14859         * archive.h (Archive::Archive): Add new parameters and
14860         initializers.
14861         (Archive::armagt): New const.
14862         (Archive::setup): Remove task parameter.
14863         (Archive::unlock_nested_archives): New function.
14864         (Archive::read_header): Add nested_off parameter.
14865         (Archive::interpret_header): Likewise.
14866         (Archive::Nested_archive_table): New typedef.
14867         (Archive::is_thin_archive_): New field.
14868         (Archive::nested_archives_): New field.
14869         (Archive::options_): New field.
14870         (Archive::dirpath_): New field.
14871         (Archive::task_): New field.
14872         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14873         for thin archives.  Pass additional parameters to
14874         Archive::Archive.  Unlock the archive file after calling
14875         Archive::setup.
14876
14877 2008-03-29  Ian Lance Taylor  <iant@google.com>
14878
14879         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14880         version symbol to be local.
14881         * testsuite/ver_test_4.sh: New file.
14882         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14883         (check_DATA): Add ver_test_4.syms.
14884         (ver_test_4.syms): New target.
14885         * testsuite/Makefile.in: Rebuild.
14886
14887         * output.cc
14888         (Output_section::Input_section_sort_entry::has_priority): New
14889         function.
14890         (Output_section::Input_section_sort_entry::match_file_name): New
14891         function.
14892         (Output_section::Input_section_sort_entry::match_section_name):
14893         Remove.
14894         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14895         Remove.
14896         (Output_section::Input_section_sort_entry::match_section_file):
14897         Remove.
14898         (Output_section::Input_section_sort_compare::operator()): Rewrite
14899         using new Input_section_sort_entry functions.  Sort crtbegin and
14900         crtend first.  Sort sections with no priority before sections with
14901         a priority.
14902         * testsuite/initpri1.c (d3): Check j != 4.
14903         (cd5): New constructor/destructor function.
14904         (main): Check j != 2.
14905
14906         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14907         new symbol when resolving, don't call set_is_default.
14908         * testsuite/ver_test_7.cc: New file.
14909         * testsuite/ver_test_7.sh: New file.
14910         * testsuite/Makefile.am (ver_test_7.so): New target.
14911         (ver_test_7.o): New target.
14912         (check_SCRIPTS): Add ver_test_7.sh.
14913         (check_DATA): Add ver_test_7.syms.
14914         (ver_test_7.syms): New target.
14915
14916 2008-03-28  Ian Lance Taylor  <iant@google.com>
14917
14918         * layout.cc (Layout::layout): If we see an input section with a
14919         name that needs sorting, set the must_sort flag for the output
14920         section.
14921         (Layout::make_output_section): If the name of the output section
14922         indicates that it might require sorting, set the may_sort flag.
14923         * output.h (Output_section::may_sort_attached_input_sections): New
14924         function.
14925         (Output_section::set_may_sort_attached_input_sections): New
14926         function.
14927         (Output_section::must_sort_attached_input_sections): New
14928         function.
14929         (Output_section::set_must_sort_attached_input_sections): New
14930         function.
14931         (class Output_section): Declare Input_section_sort_entry.  Define
14932         Input_section_sort_compare.  Declare
14933         sort_attached_input_sections.  Add new fields:
14934         may_sort_attached_input_sections_,
14935         must_sort_attached_input_sections_,
14936         attached_input_sections_are_sorted_.
14937         * output.cc (Output_section::Output_section): Initialize new
14938         fields.
14939         (Output_section::add_input_section): Add an entry to
14940         input_sections_ if may_sort or must_sort are true.
14941         (Output_section::set_final_data_size): Call
14942         sort_attached_input_sections if necessary.
14943         (Output_section::Input_section_sort_entry): Define new class.
14944         (Output_section::Input_section_sort_compare::operator()): New
14945         function.
14946         (Output_section::sort_attached_input_sections): New function.
14947         * configure.ac: Check whether the compiler supports constructor
14948         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14949         * testsuite/initpri1.c: New file.
14950         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14951         CONSTRUCTOR_PRIORITY.
14952         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14953         (initpri1_LDFLAGS): New variable.
14954         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14955
14956 2008-03-27  Ian Lance Taylor  <iant@google.com>
14957
14958         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14959         * testsuite/common_test_1.c: New file.
14960         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14961         (common_test_1_SOURCES): New variable.
14962         (common_test_1_DEPENDENCIES): New variable.
14963         (common_test_1_LDFLAGS): New variable.
14964
14965         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14966         and commons_ correctly when NAME/VERSION does not override
14967         NAME/NULL.
14968         * testsuite/ver_test_6.c: New file.
14969         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14970         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14971         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14972
14973 2008-03-26  Ian Lance Taylor  <iant@google.com>
14974
14975         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14976         of an undefined symbol from a version script.
14977         * testsuite/Makefile.am (ver_test_5.so): New target.
14978         (ver_test_5.o): New target.
14979         (check_SCRIPTS): Add ver_test_5.sh.
14980         (check_DATA): Add ver_test_5.syms.
14981         (ver_test_5.syms): New target.
14982         * testsuite/ver_test_5.cc: New file.
14983         * testsuite/ver_test_5.script: New file.
14984         * testsuite/ver_test_5.sh: New file.
14985         * Makefile.in, testsuite/Makefile.in: Rebuild.
14986
14987         PR gold/5986
14988         Fix problems building gold with gcc 4.3.0.
14989         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14990         (gold_error_at_location, gold_warning_at_location): Use it.
14991         * configure.ac: Check whether we can compile and use a template
14992         function with a printf attribute.
14993         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14994         when jumping over bytes.
14995         * object.cc: Instantiate Object::read_section_data.
14996         * debug.h: Include <cstring>
14997         * dwarf_reader.cc: Include <algorithm>
14998         * main.cc: Include <cstring>.
14999         * options.cc: Include <cstring>.
15000         * output.cc: Include <cstring>.
15001         * script.cc: Include <cstring>.
15002         * script.h: Include <string>.
15003         * symtab.cc: Include <cstring> and <algorithm>.
15004         * target-select.cc: Include <cstring>.
15005         * version.cc: Include <string>.
15006         * testsuite/testmain.cc: Include <cstdlib>.
15007         * configure, config.in: Rebuild.
15008
15009 2008-03-25  Ian Lance Taylor  <iant@google.com>
15010
15011         * options.cc: Include "../bfd/bfdver.h".
15012         (options::help): Print bug reporting address.
15013
15014         * version.cc (print_version): Adjust output for current value of
15015         BFD_VERSION_STRING.
15016
15017         * NEWS: New file.
15018
15019         * options.cc (options::help): Print list of supported targets.
15020         * target-select.h: Include <vector>.
15021         (class Target_selector): Make machine_, size_, and is_big_endian_
15022         fields const.  Add bfd_name_ and instantiated_target_ fields.
15023         (Target_selector::Target_selector): Add bfd_name parameter.
15024         (Target_selector::recognize): Make non-virtual, call
15025         do_recognize.
15026         (Target_selector::recognize_by_name): Make non-virtual, call
15027         do_recognize_by_name.
15028         (Target_selector::supported_names): New function.
15029         (Target_selector::bfd_name): New function.
15030         (Target_selector::do_instantiate_target): New pure virtual
15031         function.
15032         (Target_selector::do_recognize): New virtual function.
15033         (Target_selector::do_recognize_by_name): New virtual function.
15034         (Target_selector::instantiate_target): New private function.
15035         (supported_target_names): Declare.
15036         * target-select.cc (Target_selector::Target_selector): Update for
15037         new parameter and fields.
15038         (select_target_by_name): Check that the name matches before
15039         calling recognize_by_name.
15040         (supported_target_names): New function.
15041         * i386.cc (class Target_selector_i386): Update Target_selector
15042         constructor call.  Remove recognize and recognize_by_name.  Add
15043         do_instantiate_target.
15044         * x86_64.cc (class Target_selector_x86_64): Likewise.
15045         * testsuite/testfile.cc (class Target_selector_test): Update for
15046         changes to Target_selector.
15047
15048         * README: Rewrite, with some notes on unsupported features.
15049
15050 2008-03-24  Cary Coutant  <ccoutant@google.com>
15051
15052         * i386.cc (Target_i386::Got_type): New enum declaration.
15053         (Target_i386::Scan::local): Updated callers of Output_data_got
15054         member functions.
15055         (Target_i386::Scan::global): Likewise.
15056         (Target_i386::Relocate::relocate): Likewise.
15057         (Target_i386::Relocate::relocate_tls): Likewise.
15058         * object.h (Got_offset_list): New class.
15059         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15060         (Sized_relobj::local_got_offset): Likewise.
15061         (Sized_relobj::set_local_got_offset): Likewise.
15062         (Sized_relobj::local_has_tls_got_offset): Removed.
15063         (Sized_relobj::local_tls_got_offset): Removed.
15064         (Sized_relobj::set_local_tls_got_offset): Removed.
15065         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15066         * output.cc (Output_data_got::add_global): Added got_type parameter.
15067         (Output_data_got::add_global_with_rel): Likewise.
15068         (Output_data_got::add_global_with_rela): Likewise.
15069         (Output_data_got::add_global_pair_with_rel): New function.
15070         (Output_data_got::add_global_pair_with_rela): New function.
15071         (Output_data_got::add_local): Added got_type parameter.
15072         (Output_data_got::add_local_with_rel): Likewise.
15073         (Output_data_got::add_local_with_rela): Likewise.
15074         (Output_data_got::add_local_pair_with_rel): New function.
15075         (Output_data_got::add_local_pair_with_rela): New function.
15076         (Output_data_got::add_global_tls): Removed.
15077         (Output_data_got::add_global_tls_with_rel): Removed.
15078         (Output_data_got::add_global_tls_with_rela): Removed.
15079         (Output_data_got::add_local_tls): Removed.
15080         (Output_data_got::add_local_tls_with_rel): Removed.
15081         (Output_data_got::add_local_tls_with_rela): Removed.
15082         * output.h (Output_data_got::add_global): Added got_type parameter.
15083         (Output_data_got::add_global_with_rel): Likewise.
15084         (Output_data_got::add_global_with_rela): Likewise.
15085         (Output_data_got::add_global_pair_with_rel): New function.
15086         (Output_data_got::add_global_pair_with_rela): New function.
15087         (Output_data_got::add_local): Added got_type parameter.
15088         (Output_data_got::add_local_with_rel): Likewise.
15089         (Output_data_got::add_local_with_rela): Likewise.
15090         (Output_data_got::add_local_pair_with_rel): New function.
15091         (Output_data_got::add_local_pair_with_rela): New function.
15092         (Output_data_got::add_global_tls): Removed.
15093         (Output_data_got::add_global_tls_with_rel): Removed.
15094         (Output_data_got::add_global_tls_with_rela): Removed.
15095         (Output_data_got::add_local_tls): Removed.
15096         (Output_data_got::add_local_tls_with_rel): Removed.
15097         (Output_data_got::add_local_tls_with_rela): Removed.
15098         * resolve.cc (Symbol::override_base_with_special): Removed
15099         reference to has_got_offset_ field.
15100         * symtab.cc (Symbol::init_fields): Replaced initialization
15101         of got_offset_ with got_offsets_.  Removed initialization
15102         of has_got_offset_
15103         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15104         (Symbol::got_offset): Likewise.
15105         (Symbol::set_got_offset): Likewise.
15106         (Symbol::has_tls_got_offset): Removed.
15107         (Symbol::tls_got_offset): Removed.
15108         (Symbol::set_tls_got_offset): Removed.
15109         (Symbol::got_offset_): Removed.
15110         (Symbol::tls_mod_got_offset_): Removed.
15111         (Symbol::tls_pair_got_offset_): Removed.
15112         (Symbol::got_offsets_): New field.
15113         (Symbol::has_got_offset): Removed.
15114         (Symbol::has_tls_mod_got_offset): Removed.
15115         (Symbol::has_tls_pair_got_offset): Removed.
15116         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15117         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15118         member functions.
15119         (Target_x86_64::Scan::global): Likewise.
15120         (Target_x86_64::Relocate::relocate): Likewise.
15121         (Target_x86_64::Relocate::relocate_tls): Likewise.
15122
15123 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15124
15125         * yyscript.y: Fix spelling error in comment.
15126
15127 2008-03-24  Ian Lance Taylor  <iant@google.com>
15128
15129         * options.h (class General_options): Define build_id option.
15130         * layout.h (class Layout): Declare write_build_id, create_note,
15131         create_build_id.  Add build_id_note_ member.
15132         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15133         "libiberty.h", "md5.h", "sha1.h".
15134         (Layout::Layout): Initialize eh_frame_data_,
15135         eh_frame_hdr_section_, and build_id_note_.
15136         (Layout::finalize): Call create_build_id.
15137         (Layout::create_note): New function, broken out of
15138         Layout::create_gold_note.
15139         (Layout::create_gold_note): Call create_note.
15140         (Layout::create_build_id): New function.
15141         (Layout::write_build_id): New function.
15142         (Close_task_runner::run): Call write_build_id.
15143
15144         * x86_64.cc: Correct license to GPLv3.
15145
15146 2008-03-23  Ian Lance Taylor  <iant@google.com>
15147
15148         * options.cc: Include "demangle.h".
15149         (parse_optional_string): New function.
15150         (parse_long_option): Handle takes_optional_argument.
15151         (parse_short_option): Update dash_z initializer.  Handle
15152         takes_optional_argument.
15153         (General_options::General_options): Initialize do_demangle_.
15154         (General_options::finalize): Set do_demangle_.  Handle demangling
15155         style.
15156         * options.h (parse_optional_string): Declare.
15157         (struct One_option): Add optional_arg field.  Update constructor.
15158         Update call constructor calls.  Add takes_optional_argument
15159         function.
15160         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15161         (DEFINE_optional_string): Define.
15162         (General_options::demangle): Change from DEFINE_bool to
15163         DEFINE_optional_string.
15164         (General_options::no_demangle): New function.
15165         (General_options::do_demangle): New function.
15166         (General_options::set_do_demangle): New function.
15167         (General_options::execstack_status_): Move definition to end of
15168         class definition.
15169         (General_options::static_): Likewise.
15170         (General_options::do_demangle_): New field.
15171         * object.cc (big_endian>::get_symbol_location_info): Call
15172         Options::do_demangle, not Options::demangle.
15173         * symtab.cc (demangle): Likewise.
15174
15175 2008-03-22  Ian Lance Taylor  <iant@google.com>
15176
15177         * gold.h: Include <cstddef> and <sys/types.h>
15178         * options.h: Include <cstring>.
15179
15180 2008-03-21  Ian Lance Taylor  <iant@google.com>
15181
15182         * Added source code to GNU binutils.
15183 \f
15184 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15185
15186 Copying and distribution of this file, with or without modification,
15187 are permitted in any medium without royalty provided the copyright
15188 notice and this notice are preserved.
15189
15190 Local Variables:
15191 mode: change-log
15192 left-margin: 8
15193 fill-column: 74
15194 version-control: never
15195 End: