gold/
[external/binutils.git] / gold / ChangeLog
1 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2
3         * i386.cc (Target_i386): Remove unused member dynbss_.
4         * arm.cc (Target_arm): Likewise.
5         * powerpc.cc (Target_powerpc): Likewise.
6         * sparc.cc (Target_sparc): Likewise.
7         * tilegx.cc (Target_tilegx): Likewise.
8         * x86_64.cc (Target_x86_64): Likewise.
9         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
10         type_signature_, type_offset_.
11         * plugin.h (Plugin_hook): Remove unused member layout_.
12         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
13         mapfile_.
14         (Read_member): Remove unused members input_objects_, symtab_,
15         mapfile_, layout_.
16         (Check_library): Remove unused member symtab_.
17         * archive.h (Lib_group): Remove unused member lib_.
18         * archive.cc (Lib_group::Lib_group): Update initializer.
19         * incremental.h (Incremental_binary): Remove unused member target_.
20         (Incremental_script_entry): Removed unused member script_.
21         * layout.h (Write_symbols_task): Remove unused member input_objects_.
22         * icf.h (Icf): Remove unused member num_tracked_relocs.
23
24         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
25         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
26         its only use.
27         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
28
29         * archive.h: Use struct rather than class for forward declaration
30         of Read_symbols_data.
31
32 2013-10-07  Cary Coutant  <ccoutant@google.com>
33
34         PR gold/16010
35         * testsuite/Makefile.am (icf_test): Fix dependencies.
36         (icf_safe_test): Likewise.
37         (icf_safe_so_test): Likewise.
38         (large_symbol_alignment): Add empty _LDADD rule.
39         * testsuite/Makefile.in: Regenerate.
40
41 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
42
43         PR gold/15927
44         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
45         relocation for R_X86_64_32 on x32.
46
47 2013-08-27  Roland McGrath  <mcgrathr@google.com>
48
49         * output.cc (Output_segment::set_section_addresses): Take new
50         Target* argument.  If target->isolate_execinstr() and the segment
51         is executable and starts at a target->abi_pagesize() boundary,
52         pad its end out to a target->abi_pagesize() boundary with code fill.
53         * output.h (Output_segment::set_section_addresses): Update decl.
54         * layout.h (Layout::check_output_data_for_reset_values): Take new
55         argument RELAX_OUTPUTS.
56         (Layout): New member relax_output_list_.
57         (Layout::add_relax_output): New method.
58         * layout.cc (Layout::Layout): Update constructor.
59         (Layout::reset_relax_output): New method.
60         (Layout::clean_up_after_relaxation): Call it.
61         (Layout::prepare_for_relaxation): Update caller.
62         (Layout::set_segment_offsets): Update callers of set_section_addresses.
63         Call reset_relax_output before re-processing segments for
64         isolate_execinstr case.
65         (Layout::write_data): Handle relax_output_list_.
66         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
67         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
68
69 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
70
71         PR binutils/15834
72         * object.h: Fix typos.
73
74 2013-08-16  Roland McGrath  <mcgrathr@google.com>
75
76         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
77         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
78
79 2013-08-07  Cary Coutant  <ccoutant@google.com>
80
81         Revert support for v2 DWP files:
82
83         2013-03-01  Cary Coutant  <ccoutant@google.com>
84
85             Add dwp support for v2 DWARF package file format.
86             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
87             tu_length parameter.  Adjust all callers.
88             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
89             * dwp.cc: Include dwarf.h.
90             (Section_bounds): New struct type.
91             (Unit_set): New struct type.
92             (Dwo_file::Dwo_file): Initialize new data member.
93             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
94             Combine and rename to...
95             (Dwo_file::read_unit_index): ...this.
96             (Dwo_file::sized_read_compunit_index)
97             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
98             (Dwo_file::sized_read_unit_index): ...this.
99             (Dwo_file::copy_section): Remove section_name, is_str_offsets
100             parameters; add section_id parameter.
101             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
102             (Dwo_file::add_unit_set): ...this.
103             (Dwo_file::shndx_map_): Remove.
104             (Dwo_file::sect_offsets_): New data member.
105             (Dwp_output_file::Dwp_output_file): Initialize new data members.
106             (Dwp_output_file::add_section): Rename to...
107             (Dwp_output_file::add_contribution): ...this.
108             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
109             (Dwp_output_file::add_tu_set): Likewise.
110             (Dwp_output_file::Contribution): New type.
111             (Dwp_output_file::Section::contributions): New data member.
112             (Dwp_output_file::Cu_or_tu_set): Remove.
113             (Dwp_output_file::Section::Section): New ctor.
114             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
115             (Dwp_output_file::Dwp_index::Section_table): New type.
116             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
117             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
118             parameter.
119             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
120             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
121             (Dwp_output_file::Dwp_index::section_table): New member function.
122             (Dwp_output_file::Dwp_index::section_table_end): New member function.
123             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
124             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
125             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
126             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
127             (Dwp_output_file::Dwp_index::section_table_): New data member.
128             (Dwp_output_file::Dwp_index::section_mask_): New data member.
129             (Dwp_output_file::add_output_section): New member function.
130             (Dwp_output_file::write_new_section): New member function.
131             (Dwp_output_file::write_contributions): New member function.
132             (Dwp_output_file::section_id_map_): New data member.
133             (class Dwo_id_info_reader): Remove.
134             (class Unit_reader): New class.
135             (get_dwarf_section_name): New function.
136             (Dwo_file::read_executable): Adjust initializations of class data.
137             (Dwo_file::read): Add support for v2 package file format.
138             (Dwo_file::read_unit_index): Likewise.
139             (Dwo_file::sized_read_unit_index): Likewise.
140             (Dwo_file::copy_section): Likewise.
141             (Dwo_file::add_unit_set): Likewise.
142             (Dwp_output_file::add_output_section): Likewise.
143             (Dwp_output_file::add_contribution): Likewise.
144             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
145             for empty slot.
146             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
147             file format.
148             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
149             slot.
150             (Dwp_output_file::initialize): Remove unused function.
151             (Dwp_output_file::finalize): Add support for v2 package file format.
152             (Dwp_output_file::write_index): Likewise.
153             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
154             function prototype.
155
156 2013-07-31  Cary Coutant  <ccoutant@google.com>
157
158         * object.cc (Sized_relobj::do_output_section_address): New function.
159         (Sized_relobj): Instantiate explicitly.
160         * object.h (Object::output_section_address): New function.
161         (Object::do_output_section_address): New function.
162         (Sized_relobj::do_output_section_address): New function.
163         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
164
165 2013-07-30  Cary Coutant  <ccoutant@google.com>
166             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
167
168         * parameters.cc (Parameters::entry): Return target-specific entry
169         symbol name.
170         * target.h (Target::entry_symbol_name): New function.
171         (Target_info::entry_symbol_name): New data member.
172
173         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
174         * i386.cc (Target_i386::i386_info): Likewise.
175         (Target_i386_nacl::i386_nacl_info): Likewise.
176         * sparc.cc (Target_sparc::sparc_info): Likewise.
177         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
178         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
179         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
180         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
181
182 2013-07-22  Sterling Augustine  <saugustine@google.com>
183
184         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
185         Convert parameter shndx to local variable. Add parameters symtab
186         and symtab_size.  Scan over section names.  Find relocation
187         section corresponding to current section.  Create and initialize
188         reloc_mapper_ and reloc_type_.
189         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
190         unit_length to off_t.  Initialize member unit_length_.  Fill in field
191         cu_offset_.
192         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
193         Initialize new fields unit_length_ and cu_offset_.
194         (Dwarf_pubnames_table::read_section): Update prototype.
195         (Dwarf_pubnames_table::cu_offset): New member function.
196         (Dwarf_pubnames_table::subsection_size): Likewise.
197         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
198         New fields.
199         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
200         member functions public.
201         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
202         Update comment.  Rework logic.  Move repeated parts to...
203         (Gdb_index_info_reader::read_pubtable): ...here. New function.
204         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
205         pubtypes_table_, and stmt_list_offset.
206         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
207         Gdb_index::find_pubtype_offset,
208         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
209         (Gdb_index::pubnames_read): Update prototype and rework logic.
210         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
211         Forward declare.
212         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
213         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
214         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
215         Gdb_index::map_pubtable_to_dies):
216         Declare functions.
217         (Gdb_index::pubnames_read): Update declaration.
218         (Gdb_index::Pubname_offset_map): New type.
219         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
220         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
221         Gdb_index::stmt_list_offset): Declare.
222         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
223         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
224         Gdb_index::pubtypes_offset_): Remove.
225
226 2013-07-19  Roland McGrath  <mcgrathr@google.com>
227
228         * options.h (General_options): Add -Trodata-segment option.
229         * parameters.cc (Parameters::check_rodata_segment): New function.
230         (Parameters::set_target_once): Call it.
231         * parameters.h (Parameters): Declare it (private member function).
232         * layout.cc (load_seg_unusable_for_headers): New function, broken
233         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
234         then validate rodata segment rather than text segment.
235         (relaxation_loop_body): Call that.
236         (is_text_segment): New function.  Don't admit a non-executable
237         segment if TARGET->isolate_execinstr().
238         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
239
240 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
241
242         PR gold/15070
243         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
244         * nacl.h (Sniff_file::View::View): Request aligned view.
245
246 2013-07-11  Cary Coutant  <ccoutant@google.com>
247
248         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
249         correct BRLT entry size.
250
251 2013-07-03  Alan Modra  <amodra@gmail.com>
252
253         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
254         comment.
255
256 2013-07-01  Cary Coutant  <ccoutant@google.com>
257
258         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
259         reloc_type_.
260         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
261         (Dwarf_ranges_table::lookup_reloc): New function.
262         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
263         reloc_type_.
264         (Dwarf_ranges_table::lookup_reloc): New function.
265         (Dwarf_ranges_table::reloc_type_): New data member.
266
267 2013-06-27  Jing Yu  <jingyu@google.com>
268
269         PR gold/15662
270         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
271         function.
272         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
273         (Target_powerpc::do_relax): Call the above.
274
275 2013-06-27  Cary Coutant  <ccoutant@google.com>
276
277         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
278         on garbage collected .opd section.
279
280 2013-06-27  Alan Modra  <amodra@gmail.com>
281
282         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
283         is non-zero.
284         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
285         (Target_powerpc::do_function_location): Likewise for loc->shndx.
286
287 2013-06-14  Cary Coutant  <ccoutant@google.com>
288
289         * resolve.cc (Symbol::override_base): Don't override st_type
290         from plugin placeholder symbols.
291         (Symbol_table::resolve): Likewise.
292         (Symbol_table::should_override): Don't complain about TLS mismatch
293         if the TO symbol is a plugin placeholder.
294         * testsuite/Makefile.am (plugin_test_tls): New test.
295         * testsuite/Makefile.in: Regenerate.
296         * testsuite/plugin_test_tls.sh: New test script.
297         * testsuite/two_file_test_2_tls.cc: New test source.
298         * testsuite/two_file_test_tls.cc: New test source.
299
300 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
301
302         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
303         the maximum segment alignment is larger than the page size.
304         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
305         correctly aligns the symbols with large alignemnt.
306         * testsuite/Makefile.in: Regenerate.
307         * testsuite/large_symbol_alignment.cc: New file.
308
309 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
310             Sriraman Tallam  <tmsriram@google.com>
311
312         * options.h (sort_section): New option.
313         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
314         Rename from Input_section_sort_section_name_special_ordering_compare.
315         (Input_section_sort_section_name_compare): New struct.
316         * output.cc (Output_section::Input_section_sort_section_name_compare::
317         operator()): New function.
318         (Output_section::sort_attached_input_sections): Use new sort function
319         for .text if --sort-section=name is specified.
320         * layout.cc (Layout::make_output_section):
321         Add sorting by name when --sort-section=name is specified.
322         * testsuite/Makefile.am (text_section_grouping): Test option
323         --sort-section=name.
324         * testsuite/Makefile.in: Regenerate.
325         * testsuite/section_sorting_name.cc: New file.
326         * testsuite/section_sorting_name.sh: New file.
327
328 2013-05-21  Cary Coutant  <ccoutant@google.com>
329
330         * symtab.h (Symbol::is_cxx_vtable): New function.
331         * target-reloc.h (relocate_section): Check for vtable symbol.
332         * testsuite/Makefile.am (missing_key_func.sh): New test case.
333         * testsuite/Makefile.in: Regenerate.
334         * testsuite/missing_key_func.cc: New test source.
335         * testsuite/missing_key_func.sh: New test script.
336
337 2013-05-21  Cary Coutant  <ccoutant@google.com>
338
339         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
340         type of enclosing symbol.
341         (Relocate_info::location): Check symbol type when describing symbol.
342         * object.h (Symbol_location_info): Remove unused line_number;
343         add enclosing_symbol_type.
344         * testsuite/debug_msg.sh: Adjust expected output.
345
346 2013-05-13  Cary Coutant  <ccoutant@google.com>
347
348         * configure.ac: Export DEFAULT_TARGET.
349         * configure: Regenerate.
350         * Makefile.in: Regenerate.
351         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
352         * testsuite/Makefile.in: Regenerate.
353         * testsuite/debug_msg.sh: Delete duplicate tests.
354         Don't check undef_int error message match for powerpc where the
355         source file and line number aren't available.
356
357 2013-05-10  Roland McGrath  <mcgrathr@google.com>
358
359         * options.h (General_options): Add --rosegment-gap option.
360         * options.cc (finalize): --rosegment-gap implies --rosegment.
361         * layout.cc (set_segment_offsets): Let user option override
362         target->rosegment_gap().
363
364 2013-05-10  Roland McGrath  <mcgrathr@google.com>
365
366         * options.h (General_options): Remove leading space from help
367         messages for -nostdlib and --rosegment.
368
369 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
370
371         PR ld/15365
372         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
373
374 2013-05-03  Alan Modra  <amodra@gmail.com>
375
376         * merge.cc (Output_merge_string::do_add_input_section): Correct
377         scan for number of strings.  Rename vars to avoid shadowing.
378         Include missing terminator in input_size_.
379
380 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
381
382         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
383         Restore empty string handling.
384
385 2013-05-01  Cary Coutant  <ccoutant@google.com>
386
387         * stringpool.cc (Stringpool_template::new_key_offset): Fix
388         uninitialized warning.
389
390 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
391
392         * output.cc (Output_section::add_merge_input_section): Allow
393         to merge sections if the alignment is more than character size.
394         * merge.h (Output_merge_string::Output_merge_string): Remove
395         assert.
396         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
397         only not-null strings. Check the alignment of strings.
398         * stringpool.h
399         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
400         alignment as the argument.
401         (Stringpool_template<Stringpool_char>::addralign_): New class member.
402         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
403         Align non-zero length strings according to the addralign_.
404         (Stringpool_template<Stringpool_char>::set_string_offsets):
405         Updating offsets according to the given alignment.
406         * testsuite/Makefile.am (text_section_grouping): Test if string
407         literals are getting merged.
408         * testsuite/Makefile.in: Regenerate.
409         * testsuite/merge_string_literals_1.c: New file.
410         * testsuite/merge_string_literals_2.c: Ditto.
411         * testsuite/merge_string_literals.sh: Ditto.
412
413 2013-04-26  Ian Lance Taylor  <iant@google.com>
414
415         * target-reloc.h (relocate_section): If the reloc offset is out of
416         range, pass VIEW as NULL to relocate.relocate.
417         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
418         * i386.cc (Target_i386::Relocate::relocate): Likewise.
419         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
420         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
421         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
422         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
423
424 2013-04-26  Geoff Pike  <gpike@chromium.org>
425
426         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
427         * layout.cc (Hash_task): New class.
428         (Layout::queue_build_id_tasks): New function.
429         (Layout::write_build_id): Handle single-thread portion of build ID
430         computation.  (In some cases, all of it is single-threaded.)  Replace
431         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
432         functionality in fewer lines of code.
433         * layout.h (Layout::queue_build_id_tasks): New function declaration.
434         * options.h (General_options): make "--build-id" default to tree
435         rather than sha1.  Add two new options related to --build-id=tree:
436         --build-id-chunk-size-for-treehash and
437         --build-id-min-file-size-for-treehash.
438         * Makefile.am: add testing of --build-id=tree and related new options
439         (these tests will be invoked by "make check").
440         * Makefile.in: Regenerate.
441
442 2013-04-25  Alan Modra  <amodra@gmail.com>
443
444         * configure.tgt: Add powerpcle and powerpc64le.
445
446 2013-04-22  Alan Modra  <amodra@gmail.com>
447
448         PR gold/15355
449         * layout.cc (Layout::segment_precedes): Allow more than one
450         segment with the same type and flags.
451
452 2013-04-15  Cary Coutant  <ccoutant@google.com>
453
454         * layout.cc (Layout::set_relocatable_section_offsets): Don't
455         allocate space in file for BSS sections.
456
457 2013-04-15  Cary Coutant  <ccoutant@google.com>
458
459         * script-sections.cc (Orphan_output_section): Reset address
460         to zero after each orphaned section for relocatable links.
461
462 2013-04-15  Cary Coutant  <ccoutant@google.com>
463
464         * symtab.cc (Symbol_table::sized_write_globals): Subtract
465         section starting address for relocatable link.
466         * testsuite/Makefile.am (script_test_11): New test.
467         * testsuite/Makefile.in: Regenerate.
468         * testsuite/script_test_11.c: New source file.
469         * testsuite/script_test_11.t: New linker script.
470
471 2013-04-13  Alan Modra  <amodra@gmail.com>
472
473         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
474         owner when sections are not adjacent and exceed group size.
475         (Target_powerpc::group_sections): Handle corner case.
476         (Target_powerpc::Branch_info::make_stub): Handle case where
477         stub table doesn't exist due to branches in non-exec sections.
478         (Target_powerpc::Relocate::relocate): Likewise.
479
480 2013-04-11  Alan Modra  <amodra@gmail.com>
481
482         PR gold/15354
483         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
484         .branch_lt to match bfd ld.  Adjust comments throughout file.
485
486 2013-04-04  Ian Lance Taylor  <iant@google.com>
487
488         GCC PR c++/56840
489         * object.cc (do_layout_deferred_sections): Handle .eh_frame
490         sections before checking whether they are included in the link.
491
492 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
493
494         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
495         object before calling the plugin claim_file handler.  Pass the elf
496         object of the archive to the plugin. Delete the elf object if the
497         plugin claims the file.
498
499 2013-03-21  Alan Modra  <amodra@gmail.com>
500
501         * layout.cc (Layout::set_segment_offsets): Accept writable .text
502         segment when omagic.
503
504 2013-03-21  Alan Modra  <amodra@gmail.com>
505
506         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
507         comparison warning.
508         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
509         uninitialized" warning.
510
511 2013-03-20  Alan Modra  <amodra@gmail.com>
512
513         * symtab.h (Symbol::clear_version): New function.
514         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
515         is_needed by weak references.  Clear version for symbols defined
516         in as-needed objects that are not needed.
517
518 2013-03-15  Alan Modra  <amodra@gmail.com>
519
520         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
521         static and public.  Add report_err param.  Return false for data refs.
522         (Target_powerpc::rela_dyn_section): New overloaded function.
523         (Target_powerpc::plt_, iplt_): Elucidate.
524         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
525         (Output_data_plt_powerpc::do_write): Don't write .iplt.
526         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
527         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
528         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
529         push_branch and make_plt_entry for ifunc syms when
530         reloc_needs_plt_for_ifunc.
531         (Target_powerpc::Relocate::relocate): Don't use plt entry value
532         for ifunc unless reloc_needs_plt_for_ifunc.
533
534 2013-03-15  Alan Modra  <amodra@gmail.com>
535
536         * gc.h (gc_process_relocs): Don't look through function descriptors.
537         * icf.cc (get_section_contents): Do so here instead.
538
539 2013-03-13  Alan Modra  <amodra@gmail.com>
540
541         * powerpc.cc (is_branch_reloc): Forward declare.
542         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
543         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
544         false for 64-bit, true for 32-bit non-branch relocs.
545         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
546         * testsuite/Makefile.am (icf_test): Use linker map file instead of
547         nm output.
548         (icf_safe_test): Generate linker map file as well as nm output.
549         (icf_safe_so_test): Likewise.
550         * testsuite/Makefile.in: Regenerate.
551         * testsuite/icf_test.sh: Parse linker map file to determine
552         section folding.
553         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
554         * testsuite/icf_safe_so_test.sh: Likewise.
555         (X86_32_or_ARM_specific_safe_fold): Merge into..
556         (arch_specific_safe_fold): ..this.
557         (X86_64_specific_safe_fold): Delete unused function.
558
559 2013-03-12  Alan Modra  <amodra@gmail.com>
560
561         * gc.h (gc_process_relocs): Look through function descriptors
562         to determine shndx, symvalue and addend used by ICF.  Tidy
563         variable duplication.
564
565 2013-03-11  Alan Modra  <amodra@gmail.com>
566
567         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
568         * layout.cc (Layout_task_runner::run): ..to here.
569         * symtab.h (struct Symbol_location): Extract from..
570         (class Symbol_table): ..here.
571         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
572         * target.h (class Target): Add function_location and
573         do_function_location functions.
574         (class Sized_target): Add do_function_location.
575         * object.h (class Sized_relobj_file): Move find_shdr..
576         (class Object): ..to here.
577         * object.cc: Likewise.  Update to suit.  Instantiate.
578         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
579         * powerpc.cc (class Powerpc_dynobj): New.
580         (Target_powerpc::do_function_location): New function.
581         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
582         (Powerpc_dynobj::do_read_symbols): New function.
583         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
584
585 2013-03-08  Ian Lance Taylor  <iant@google.com>
586
587         * options.cc (General_options::string_to_object_format): Accept
588         "default".
589
590 2013-03-08  Alan Modra  <amodra@gmail.com>
591
592         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
593         pointer to Post_fde.
594         (struct Post_fde): Move definition to here..
595         * ehframe.cc (struct Post_fde): ..from here.
596         (Cie::write): Don't alloc Post_fde.
597         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
598
599 2013-03-07  Alan Modra  <amodra@gmail.com>
600
601         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
602         relocation referencing .LC0.
603         * testsuite/discard_locals_test.sh: Remove FIXMEs.
604
605 2013-03-07  Alan Modra  <amodra@gmail.com>
606
607         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
608         always_inline.  Add assembly for powerpc to avoid GOT.
609
610 2013-03-07  Alan Modra  <amodra@gmail.com>
611
612         * testsuite/script_test_10.sh: Don't test .bss section
613         header number.
614
615 2013-03-06  Alan Modra  <amodra@gmail.com>
616
617         * powerpc.cc (class Powerpc_relobj): Move some member functions.
618         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
619         all callers.  Handle folded sections.
620         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
621         to Powerpc_relobj.
622         (Global_symbol_visitor_opd::operator()): Likewise.
623
624 2013-03-04  Alan Modra  <amodra@gmail.com>
625
626         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
627         * testsuite/Makefile.in: Regenerate.
628
629 2013-03-01  Cary Coutant  <ccoutant@google.com>
630
631         Add dwp support for v2 DWARF package file format.
632         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
633         tu_length parameter.  Adjust all callers.
634         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
635         * dwp.cc: Include dwarf.h.
636         (Section_bounds): New struct type.
637         (Unit_set): New struct type.
638         (Dwo_file::Dwo_file): Initialize new data member.
639         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
640         Combine and rename to...
641         (Dwo_file::read_unit_index): ...this.
642         (Dwo_file::sized_read_compunit_index)
643         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
644         (Dwo_file::sized_read_unit_index): ...this.
645         (Dwo_file::copy_section): Remove section_name, is_str_offsets
646         parameters; add section_id parameter.
647         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
648         (Dwo_file::add_unit_set): ...this.
649         (Dwo_file::shndx_map_): Remove.
650         (Dwo_file::sect_offsets_): New data member.
651         (Dwp_output_file::Dwp_output_file): Initialize new data members.
652         (Dwp_output_file::add_section): Rename to...
653         (Dwp_output_file::add_contribution): ...this.
654         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
655         (Dwp_output_file::add_tu_set): Likewise.
656         (Dwp_output_file::Contribution): New type.
657         (Dwp_output_file::Section::contributions): New data member.
658         (Dwp_output_file::Cu_or_tu_set): Remove.
659         (Dwp_output_file::Section::Section): New ctor.
660         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
661         (Dwp_output_file::Dwp_index::Section_table): New type.
662         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
663         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
664         parameter.
665         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
666         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
667         (Dwp_output_file::Dwp_index::section_table): New member function.
668         (Dwp_output_file::Dwp_index::section_table_end): New member function.
669         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
670         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
671         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
672         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
673         (Dwp_output_file::Dwp_index::section_table_): New data member.
674         (Dwp_output_file::Dwp_index::section_mask_): New data member.
675         (Dwp_output_file::add_output_section): New member function.
676         (Dwp_output_file::write_new_section): New member function.
677         (Dwp_output_file::write_contributions): New member function.
678         (Dwp_output_file::section_id_map_): New data member.
679         (class Dwo_id_info_reader): Remove.
680         (class Unit_reader): New class.
681         (get_dwarf_section_name): New function.
682         (Dwo_file::read_executable): Adjust initializations of class data.
683         (Dwo_file::read): Add support for v2 package file format.
684         (Dwo_file::read_unit_index): Likewise.
685         (Dwo_file::sized_read_unit_index): Likewise.
686         (Dwo_file::copy_section): Likewise.
687         (Dwo_file::add_unit_set): Likewise.
688         (Dwp_output_file::add_output_section): Likewise.
689         (Dwp_output_file::add_contribution): Likewise.
690         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
691         for empty slot.
692         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
693         file format.
694         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
695         slot.
696         (Dwp_output_file::initialize): Remove unused function.
697         (Dwp_output_file::finalize): Add support for v2 package file format.
698         (Dwp_output_file::write_index): Likewise.
699         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
700         function prototype.
701
702 2013-03-01  Cary Coutant  <ccoutant@google.com>
703
704         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
705         function into class definition in header file.
706         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
707         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
708         New function.
709         (Dwarf_info_reader::check_buffer): Move here from .cc file.
710
711 2013-02-28  Alan Modra  <amodra@gmail.com>
712
713         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
714         * target.cc (Target::do_plt_fde_location): New function.
715         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
716         accessor function, and constructor param.
717         (struct Post_fde, Post_fdes): Declare.
718         (Cie::write): Add post_fdes param.
719         * ehframe.cc (Fde::write): Use plt_fde_location.
720         (struct Post_fde): Define.
721         (Cie::write): Stash FDEs added post merge mapping.
722         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
723         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
724         (Eh_frame::do_sized_write): Arrange to write post map FDES after
725         other FDEs.
726         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
727         (Target_powerpc::has_glink): New function.
728         (Target_powerpc::do_relax): Add eh_frame info for stubs.
729         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
730         glink_eh_frame_fde_32, default_fde): New data.
731         (Stub_table::eh_frame_added_): New var.
732         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
733         Make const.
734         (Stub_table::add_eh_frame): New function.
735         (Output_data_glink::add_eh_frame): New function.
736         (Target_powerpc::make_glink_section): Call add_eh_frame.
737
738 2013-02-15  Ian Lance Taylor  <iant@google.com>
739
740         * options.h (DEFINE_uint64_alias): Define.
741         (class General_options): Add -Ttext-segment as an alias for
742         -Ttext.
743
744 2013-02-15  Alan Modra  <amodra@gmail.com>
745
746         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
747         (Stub_table::do_write): ..here, two places.
748         (Stub_table::plt_call_size): Use it here too.
749
750 2013-02-11  Ian Lance Taylor  <iant@google.com>
751
752         * descriptors.cc (Descriptors::close_all): New function.
753         * descriptors.h (class Descriptors): Declare close_all.
754         (close_all_descriptors): New inline function.
755         * plugin.cc: Include "descriptors.h".
756         (Plugin_manager::cleanup): Call close_all_descriptors.
757
758 2013-02-06  Alan Modra  <amodra@gmail.com>
759
760         * README: Update coding style link.
761
762 2013-01-28  Cary Coutant  <ccoutant@google.com>
763
764         * dwp.cc (File_list): New typedef.
765         (Dwo_name_info_reader): New class.
766         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
767         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
768         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
769         (Dwo_file::read_executable): New function.
770         (Dwo_file::read): Move common setup code to ...
771         (Dwo_file::make_object): ... here.
772         (dwp_options): Add --exec/-e.
773         (usage): Likewise.
774         (main): Likewise.
775
776 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
777
778         * layout.cc (Layout::layout): Check for option text_reorder.
779         (Layout::make_output_section): Ditto.
780         * options.h (text_reorder): New option.
781         * output.cc (Input_section_sort_compare): Remove special ordering
782         of section names.
783         (Output_section::
784          Input_section_sort_section_name_special_ordering_compare::
785          operator()): New function.
786         (Output_section::sort_attached_input_sections): Use new sort function
787         for .text.
788         * output.h (Input_section_sort_section_name_special_ordering_compare):
789         New struct.
790         * testsuite/Makefile.am (text_section_grouping): Test option
791         --no-text-reorder
792         * testsuite/Makefile.in: Regenerate.
793         * testsuite/text_section_grouping.sh: Check order of functions without
794         default text reordering.
795
796 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
797
798         * options.h (General_options): Change default to true for new_dtags.
799
800 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
801
802         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
803         when enable_new_dtags is false.  Only add DT_RUNPATH when
804         enable_new_dtags is true.
805
806 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
807
808         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
809         used in declaration and definition consistent.
810         (Target_powerpc::symval_for_branch): Ditto.
811
812 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
813
814         * testsuite/plugin_final_layout.cc: Fix comment.
815
816 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
817
818         * layout.cc (Layout::layout): Do not do default sorting for
819         text sections when section ordering is specified.
820         (make_output_section): Ditto.
821         * testsuite/plugin_final_layout.cc: Name the function sections
822         to catch reordering issues.
823
824 2013-01-15  Alan Modra  <amodra@gmail.com>
825
826         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
827         plt-thread-safe.
828
829 2013-01-15  Alan Modra  <amodra@gmail.com>
830
831         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
832         * testsuite/Makefile.in: Regenerate.
833
834 2013-01-14  Alan Modra  <amodra@gmail.com>
835
836         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
837         * testsuite/Makefile.in: Regenerate.
838
839 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
840
841         PR bfd/14430
842         Fix mingw gold build with plugins enabled
843         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
844         * configure.ac: Export DLOPEN_LIBS and add headers check.
845         * plugin.cc: Handle non-dlfcn case.
846         * Makefile.in: Regenerate.
847         * config.in: Regenerate.
848         * configure: Regenerate.
849         * testsuite/Makefile.in: Regenerate.
850
851 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
852
853         * output.h (sort_attached_input_sections): Change to be public.
854         * script-sections.cc
855         (Output_section_definition::set_section_addresses): Sort
856         attached input sections according to section order before linker
857         script assigns section addresses.
858         (Orphan_output_section::set_section_addresses): Sort
859         attached input sections according to section order before linker
860         script assigns section addresses.
861         * Makefile.am (final_layout.sh): Use a simple linker script to
862         check if section ordering still works.
863         * Makefile.in: Regenerate.
864
865 2013-01-09  Ben Cheng  <bccheng@google.com>
866
867         * arm.cc (Target_arm::attributes_accept_div): New function.
868         (Target_arm::attributes_forbid_div): New function.
869         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
870         attribute using the same new functions as what bfd/elf32_arm.c
871         does.
872
873 2013-01-07  Cary Coutant  <ccoutant@google.com>
874
875         PR gold/14993
876         * output.cc (Output_section::add_input_section): For incremental
877         updates, don't track input sections that are allocated from patch
878         space.
879
880 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
881             Ian Lance Taylor  <iant@google.com>
882
883         PR gold/14897
884         * configure.ac (--enable-ld): Removed.
885         (install_as_default): Set to yes only for --enable-gold=default
886         or --disable-ld.
887         * configure: Regenerated.
888
889 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
890
891         * options.h (General_options): Add -fuse-ld= for GCC linker
892         option compatibility.
893
894 2013-01-04  Cary Coutant  <ccoutant@google.com>
895
896         * configure.ac: Fix typo restoring CXXFLAGS.
897         * configure: Regenerate.
898
899 2013-01-04  Cary Coutant  <ccoutant@google.com>
900
901         * testsuite/Makefile.am (CXXLINK_S): New macro.
902         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
903         * testsuite/Makefile.in: Regenerate.
904
905 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
906
907         * version.cc (print_version): Update copyright year to 2013.
908
909 2012-12-20  Ian Lance Taylor  <iant@google.com>
910
911         * layout.cc (Layout::special_ordering_of_input_section): New
912         function.
913         (Layout::layout): If input section requires special ordering, must
914         sort input sections.
915         (Layout::make_output_section): May sort .text input sections.
916         (Layout::is_section_name_prefix_grouped): Remove.
917         * layout.h (class Layout): Declare
918         special_ordering_of_input_section.  Don't declare
919         is_section_name_prefix_grouped.
920         * output.cc (Output_section::add_input_section): Revert last
921         change.
922         (Output_section::Input_section_sort::match_file_name): Don't crash
923         if called on output section data.
924         (Output_section::Input_section_sort_compare): Sort based on
925         special ordering.
926         (Output_section::Input_section_sort_section_order_index_compare):
927         Revert last patch.
928         (Output_section::sort_attached_input_sections): Likewise.
929
930 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
931
932         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
933         * layout.h (Layout::is_section_name_prefix_grouped): New function.
934         * output.cc (Output_section::add_input_section): Check if section
935         name contains special prefix.  Keep input sections to sort such
936         sections.
937         (Output_section::Input_section_sort_section_order_index_compare
938          ::operator()): Group sections according to prefixes.
939         (Output_section::sort_attached_input_sections): Add condition to
940         Input_section_entry constructor call.
941         * testsuite/Makefile.am (text_section_grouping): New test.
942         * testsuite/Makefile.in: Regenerate.
943         * testsuite/text_section_grouping.cc: New file.
944         * testsuite/text_section_grouping.sh: New file.
945
946 2012-12-17  Nick Clifton  <nickc@redhat.com>
947
948         * Makefile.am: Add copyright notice.
949         * NEWS: Likewise.
950         * README: Likewise.
951         * configure.ac: Likewise.
952         * ftruncate.c: Likewise.
953         * Makefile.in: Regenerate.
954
955 2012-12-14  Cary Coutant  <ccoutant@google.com>
956
957         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
958         --no-as-needed flag.
959         (exception_separate_shared_12_test): Likewise.
960         (incremental_copy_test): Likewise.
961         * testsuite/Makefile.in: Regenerate.
962
963 2012-12-14  Cary Coutant  <ccoutant@google.com>
964
965         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
966         (Dwp_output_file::Dwp_index::enter_set): Add assert.
967
968 2012-12-12  Alan Modra  <amodra@gmail.com>
969
970         * powerpc.cc (class Track_tls): New.
971         (class Relocate, class Scan): Inherit Track_tls.
972         (Target_powerpc::Scan::local, global): Track tls optimization
973         and avoid creating plt entry for __tls_get_addr if all uses
974         are optimized away.
975         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
976
977 2012-12-12  Alan Modra  <amodra@gmail.com>
978
979         * options.h (General_options): Add --toc-sort/--no-toc-sort.
980         Replace no_toc_optimize with toc_optimize.
981         * output.h (Output_section::input_sections): Provide non-const variant.
982         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
983         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
984         accessors.
985         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
986         (class Sort_toc_sections): New.
987         (Target_powerpc::do_finalize_sections): Sort toc sections.
988         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
989
990 2012-12-10  Roland McGrath  <mcgrathr@google.com>
991
992         * testsuite/binary_unittest.cc (read_all): New function.
993         (Sized_binary_test): Use it instead of ::read.
994         * fileread.cc (do_read): Don't assume pread always reads the whole
995         amount in a single call.
996
997 2012-12-10  Alan Modra  <amodra@gmail.com>
998
999         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1000         Set EM_PPC64 or EM_PPC here.
1001         (Target_selector_powerpc::do_recognize): Delete.
1002
1003 2012-12-10  Alan Modra  <amodra@gmail.com>
1004
1005         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1006         stub_table_.
1007         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1008
1009 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1010
1011         * testsuite/binary_unittest.cc (Sized_binary_test):
1012         Use open_descriptor rather than ::open.
1013
1014 2012-12-07  Alan Modra  <amodra@gmail.com>
1015
1016         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1017         typedef and invalid_address constant.
1018         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1019         instantiate constants.
1020
1021 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1022
1023         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1024         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1025         * aclocal.m4: Regenerate.
1026         * configure: Regenerate.
1027         * Makefile.in: Regenerate.
1028         * testsuite/Makefile.in: Regenerate.
1029
1030 2012-12-07  Alan Modra  <amodra@gmail.com>
1031
1032         * options.h (General_options): Add no_toc_optimize.
1033         * powerpc.cc (ok_lo_toc_insn): New function.
1034         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1035
1036 2012-12-06  Alan Modra  <amodra@gmail.com>
1037
1038         * options.h (General_options): Add plt_align, plt_static_chain,
1039         plt_thread_safe.  Update stub_group_size help text.
1040         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1041         for new plt_thread_safe_ var.
1042         (use_plt_offset): Correct comments.
1043         (Target_powerpc::do_relax): Look for thread creation symbols to
1044         determine default plt_thread_safe value.  Clear plt call stubs
1045         as well as branch stubs each iteration.
1046         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1047         insn constants.
1048         (l, hi, ha, write_insn): Move earlier.
1049         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1050         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1051         plt stubs too.
1052         (Stub_table::update_size): Adjust.
1053         (Stub_table::prev_size, set_prev_size): Delete.
1054         (Stub_table::stub_align): Let --plt-align affect result.
1055         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1056         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1057         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1058         (Stub_table::do_write): Support more stub variants.
1059
1060 2012-12-04  Alan Modra  <amodra@gmail.com>
1061
1062         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1063         (Target_powerpc::do_define_standard_symbols): New function.
1064
1065 2012-12-03  Alan Modra  <amodra@gmail.com>
1066
1067         * output.h: Formatting, whitespace.
1068
1069 2012-12-03  Alan Modra  <amodra@gmail.com>
1070
1071         * layout.h (Layout::get_executable_sections): Declare.
1072         * layout.cc (Layout::get_executable_sections): New function.
1073         * arm.cc (Target_arm::group_sections): Use it.
1074         (Arm_output_section::group_sections): Delete now redundant test.
1075         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1076         param to handle relative relocs.
1077         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1078         (Output_data_reloc::add_absolute): Adjust.
1079         (Output_data_reloc::add_relative): New function.
1080         (Output_data::reset_data_size): New function.
1081         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1082         (Output_section::set_addralign): New function.
1083         (Output_section::checkpoint_set_addralign): New function.
1084         (Output_section::clear_section_offsets_need_adjustment): New function.
1085         (Output_section::input_sections): Make public.
1086         * powerpc.cc (class Output_data_brlt_powerpc): New.
1087         (class Stub_table, class Stub_control): New.
1088         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1089         stub_table_, set_stub_table, stub_table): New vectors and accessor
1090         functions.
1091         (Target_powerpc::do_may_relax, do_relax, push_branch,
1092         new_stub_table, stub_tables, brlt_section, group_sections,
1093         add_branch_lookup_table, find_branch_lookup_table,
1094         write_branch_lookup_table, make_brlt_section): New functions.
1095         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1096         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1097         branch_info_): New vars.
1098         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1099         make call stubs here.
1100         (Output_data_glink): Remove all call stub handling from this class.
1101         (Target_powerpc::Scan::local, global): Save interesting branch
1102         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1103         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1104         functions on final link.
1105         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1106         Handle long branch destinations too.
1107         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1108         do_plt_address_for_local): Adjust lookup of plt call stubs.
1109
1110 2012-11-30  Alan Modra  <amodra@gmail.com>
1111
1112         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1113         relocs against protected symbols when building 32-bit shared libs.
1114
1115 2012-11-30  Alan Modra  <amodra@gmail.com>
1116
1117         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1118         param.  Call got_section() to make .got.  Update all callers
1119         and their callers and so on.
1120
1121 2012-11-30  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1124         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1125         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1126         value if it already exists.
1127
1128 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1129
1130         PR gold/14858
1131         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1132
1133 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1134
1135         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1136         than bfc instruction for data sandboxing.
1137
1138 2012-11-08  Alan Modra  <amodra@gmail.com>
1139
1140         * po/POTFILES.in: Regenerate.
1141
1142 2012-11-05  Alan Modra  <amodra@gmail.com>
1143
1144         * configure.ac: Apply 2012-09-10 change to config.in here.
1145         * configure: Regenerate.
1146
1147 2012-11-05  Alan Modra  <amodra@gmail.com>
1148
1149         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1150         (struct Opd_ent): Use "Address" rather than "Offset".
1151         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1152         (Target_powerpc::got_section): Make public.
1153         (Target_powerpc::scan_relocs): Move code setting symbols..
1154         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1155         Create _SDA_BASE_ only when referenced.
1156
1157 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1158
1159         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1160         from last change.
1161
1162 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1163
1164         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1165         for offset_in_output_section parameter.
1166         (Sized_target::relocate_special_relocatable): Likewise.
1167         * arm.cc (Target_arm::relocate_relocs): Likewise.
1168         (Target_arm::relocate_special_relocatable): Likewise.
1169         * i386.cc (Target_i386::relocate_relocs): Likewise.
1170         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1171         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1172         * target-reloc.h (relocate_relocs): Likewise.
1173         * testsuite/testfile.cc (Target_test): Likewise.
1174         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1175         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1176
1177         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1178         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1179
1180         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1181         parameter, which is unused in the [!F_SETFD] case.
1182
1183         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1184         SYMNDX to off_t before comparing it to this->data_size().
1185         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1186         * incremental.cc (Output_section_incremental_inputs::do_write):
1187         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1188
1189         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1190
1191 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1192
1193         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1194         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1195         in EABI_VER5.
1196
1197 2012-10-29  Cary Coutant  <ccoutant@google.com>
1198
1199         * dwp.cc (usage): Add file and exit status parameters;
1200         add --help and --version options.
1201         (print_version): New function.
1202         (main): Add --help and --version options.
1203
1204 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1205
1206         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1207         final_layout_sequence.txt.
1208         * testsuite/Makefile.in: Regenerated.
1209
1210 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1211
1212         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1213         COMPILE generated by automake.
1214         (LINK1): Likewise.
1215         (CXXCOMPILE1): Likewise.
1216         (CXXLINK1): Likewise.
1217         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1218         (LINK): Likewise.
1219         (CXXCOMPILE): Likewise.
1220         (CXXLINK): Likewise.
1221         * testsuite/Makefile.in: Regenerated.
1222
1223 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1224
1225         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1226         on bad fwrite return.
1227
1228 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1229
1230         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1231         on val.
1232
1233 2012-10-23  Cary Coutant  <ccoutant@google.com>
1234
1235         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1236         * testsuite/Makefile.in: Regenerate.
1237         * testsuite/dwp_test.h: New source file.
1238         * testsuite/dwp_test_1.cc: New source file.
1239         * testsuite/dwp_test_1.s: New source file.
1240         * testsuite/dwp_test_1.sh: New source file.
1241         * testsuite/dwp_test_1b.cc: New source file.
1242         * testsuite/dwp_test_1b.s: New source file.
1243         * testsuite/dwp_test_2.cc: New source file.
1244         * testsuite/dwp_test_2.s: New source file.
1245         * testsuite/dwp_test_2.sh: New source file.
1246         * testsuite/dwp_test_main.cc: New source file.
1247         * testsuite/dwp_test_main.s: New source file.
1248
1249 2012-10-23  Cary Coutant  <ccoutant@google.com>
1250
1251         * dwp.h: New header file.
1252         * dwp.cc: New source file.
1253         * gold.h: Move shared declarations to system.h.
1254         * system.h: New header file.
1255         * Makefile.am: Add dwp.
1256         * Makefile.in: Regenerate.
1257
1258 2012-10-23  Cary Coutant  <ccoutant@google.com>
1259
1260         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1261         Dwarf_info_reader::read_from_pointer.
1262         (Dwarf_pubnames_table::read_header): Likewise.
1263         (Dwarf_pubnames_table::next_name): Likewise.
1264         (Dwarf_die::read_attributes): Likewise.
1265         (Dwarf_die::skip_attributes): Likewise.
1266         (Dwarf_info_reader::read_from_pointer): New function template.
1267         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1268         (Dwarf_pubnames_table): Likewise.
1269         (Dwarf_info_reader::read_from_pointer): New function template.
1270         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1271         Dwarf_pubnames_table ctor.
1272
1273 2012-10-23  Cary Coutant  <ccoutant@google.com>
1274
1275         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1276         abbrev_shndx.
1277         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1278         abbrev_shndx_.
1279         (Dwarf_info_reader::set_abbrev_shndx): New method.
1280         (Dwarf_info_reader::abbrev_shndx_): New data member.
1281
1282 2012-10-23  Cary Coutant  <ccoutant@google.com>
1283
1284         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1285         from object, not parameters.
1286         (Dwarf_info_reader::parse): Likewise.
1287         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1288         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1289         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1290         methods.
1291
1292 2012-10-23  Cary Coutant  <ccoutant@google.com>
1293
1294         * fileread.cc (Input_file::Input_file): New constructor.
1295         * fileread.h (class Input_file): Add new constructor.
1296
1297 2012-10-18  Alan Modra  <amodra@gmail.com>
1298
1299         PR gold/14727
1300         * object.cc (Relobj::is_section_name_included): Also match
1301         .sdata personality section.
1302
1303 2012-10-18  Alan Modra  <amodra@gmail.com>
1304
1305         * target-reloc.h (class Default_comdat_behavior): New, package up..
1306         (get_comdat_behaviour): ..this.
1307         (relocate_section): Add Relocate_comdat_behavior template arg,
1308         adjust code to suit.
1309         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1310         (Target_arm::scan_reloc_section): Likewise.
1311         * i386.cc (Target_i386::relocate_section): Likewise.
1312         * sparc.cc (Target_sparc::relocate_section): Likewise.
1313         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1314         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1315         * powerpc.cc (class Relocate_comdat_behavior): New.
1316         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1317         gold::relocate_section with new template arg.
1318
1319 2012-10-18  Alan Modra  <amodra@gmail.com>
1320
1321         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1322         dynamic relocs for GOT_TPREL got entries, without symbol if
1323         resolving locally.
1324         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1325         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1326         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1327
1328 2012-10-17  Alan Modra  <amodra@gmail.com>
1329
1330         PR gold/14726
1331         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1332
1333 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1334
1335         * layout.cc (Layout::include_section): Keep sections marked
1336         SHF_EXCLUDE when doing relocatable links.
1337
1338 2012-10-16  Alan Modra  <amodra@gmail.com>
1339
1340         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1341         (Target_powerpc::do_finalize_sections): Call it.
1342         (Output_data_save_res): New class and supporting functions.
1343         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1344         normal symbols defined in object files.
1345
1346 2012-10-12  Alan Modra  <amodra@gmail.com>
1347
1348         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1349         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1350         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1351         section if scan_opd_relocs not yet called.
1352         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1353
1354 2012-10-12  Alan Modra  <amodra@gmail.com>
1355
1356         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1357         add_local_ifunc_entry): Revert last change.
1358         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1359
1360 2012-10-05  Alan Modra  <amodra@gmail.com>
1361
1362         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1363         do_plt_address_for_global): New functions.
1364         (Output_data_got_powerpc::do_write): Don't segfault when linking
1365         statically.
1366         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1367         add_local_ifunc_entry): Return true on adding entry..
1368         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1369         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1370         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1371         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1372         set up symbols here.
1373         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1374         syms here.  Do so even when no .iplt.  Don't segfault when linking
1375         statically.
1376         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1377         new variants without reloc param.
1378         (Glink_sym_ent::Glink_sym_ent): Likewise.
1379         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1380         reloc when refs will resolve to plt call stub.
1381         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1382         R_PPC_PLTREL24 to resolve locally.
1383         (Target_powerpc::Scan::global): Correct ifunc handling.
1384         (Target_powerpc::Relocate::relocate): Correct local sym glink
1385         lookup.  Don't destroy "value" when we have a plt call stub,
1386         and when checking plt call validity.
1387         (Target_powerpc::do_dynsym_value): Simplify.
1388
1389 2012-10-05  Alan Modra  <amodra@gmail.com>
1390
1391         * i386.cc (Output_data_plt_i386::address_for_global,
1392         address_for_local): Add plt offset to returned value.  Adjust uses.
1393         * sparc.cc (Output_data_plt_sparc::address_for_global,
1394         address_for_local): Likewise.
1395         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1396         address_for_local): Likewise.
1397         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1398         address_for_local): Likewise.
1399         * target.h (Target::plt_address_for_global, plt_address_for_local):
1400         Update comment.
1401         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1402         (Output_data_got::Got_entry::write): Nor here.
1403         * output.h: Comment fix.
1404
1405 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1406
1407         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1408         global_offset_table_ value for larget got.
1409         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1410
1411 2012-09-29  Alan Modra  <amodra@gmail.com>
1412
1413         * powerpc.cc (Target_powerpc::iplt_): New output section.
1414         (Target_powerpc::iplt_section, make_iplt_section,
1415         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1416         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1417         Target_powerpc::plt_entry_count): Count iplt entries too.
1418         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1419         reloc section in constructor.  New params.
1420         (Target_powerpc::make_plt_section): Create reloc section here instead.
1421         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1422         functions.
1423         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1424         (Output_data_glink::add_entry, find_entry): New functions to
1425         deal with local syms.
1426         (Glink_sym_ent): Add support for local syms.
1427         (Output_data_glink::do_write): Handle ifunc plt entries.
1428         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1429         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1430         (Target_powerpc::Relocate::relocate): Likewise.
1431         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1432
1433 2012-09-25  Alan Modra  <amodra@gmail.com>
1434
1435         * object.h (Sized_relobj_file::adjust_local_symbol,
1436         do_adjust_local_symbol): New functions.
1437         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1438         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1439         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1440         and irregular opd entry spacing.
1441         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1442         (Global_symbol_visitor_opd): New functor.
1443         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1444         on deleted opd entries.
1445
1446 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1447
1448         * tilegx.cc: New file.
1449         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1450         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1451         * configure.tgt: Add entries for tilegx*.
1452         * configure.ac: Likewise.
1453         * Makefile.in: Rebuild.
1454         * configure: Likewise.
1455         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1456         tilegx.
1457
1458 2012-09-13  Alan Modra  <amodra@gmail.com>
1459
1460         * target-reloc.h (scan_relocs): Call scan.local for relocs
1461         against symbols in discarded sections.  Pass is_discarded
1462         param.
1463         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1464         Add is_discarded param.
1465         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1466         is_discarded to flag opd entry as discarded.  Don't emit dyn
1467         relocs on such entries.
1468         (Target_powerpc::Scan::global): Similarly detect and handle
1469         such opd entries.
1470         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1471         opd_ent_.  Update all uses.
1472         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1473         (Target_powerpc::relocate_section): Zero out discarded opd
1474         entry relocs.
1475
1476 2012-09-12  Ian Lance Taylor  <iant@google.com>
1477
1478         PR gold/14570
1479         * output.cc: Rename Output_data_got template parameter from size
1480         to got_size for all functions.  Compile all variants of
1481         Output_data_got.
1482         (Output_data_got::Got_entry::write): Correct use of size for
1483         symbol value.  Use local_is_tls rather than casting to
1484         Sized_relobj_file.
1485         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1486         (class Sized_relobj_file): Add do_local_is_tls.
1487         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1488
1489 2012-09-11  Alan Modra  <amodra@gmail.com>
1490
1491         PR gold/14566
1492         * layout.cc (Layout::set_segment_offsets): When using
1493         common-page-size alignment, ensure we are on a new max-page-size
1494         page.
1495         * output.cc (Output_segment::set_section_addresses): Use
1496         abi_pagesize, not common_pagesize for relro boundary.
1497         (Output_segment::set_offset): Likewise.
1498
1499 2012-09-11  Alan Modra  <amodra@gmail.com>
1500
1501         * output.h (Output_data_got::add_global_tls, add_local_tls,
1502         add_local_tls_pair): New functions.
1503         (Output_data_got::add_local_pair_with_rel): Remove second
1504         reloc param.  Expand comment.
1505         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1506         use_plt_or_tls_offset_, similarly for constructor param.
1507         (Output_data_got::Got_entry::write): Add got_index param.
1508         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1509         add_local_tls_pair): New functions.
1510         (Output_data_got::Got_entry::write): Handle tls symbols
1511         with use_plt_or_tls_offset_ set specially.
1512         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1513         (Output_data_got::do_write): Replace iterator with index, pass
1514         index to entry write function.
1515         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1516         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1517         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1518         call.
1519         * i386.cc (Target_i386::Scan::local): Likewise.
1520         * sparc.cc (Target_sparc::Scan::local): Likewise.
1521         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1522         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1523         do_tls_offset_for_global): New functions.
1524         (Target_powerpc::Scan::local): Correct TLS relocations and got
1525         entry values.
1526         (Target_powerpc::Scan::global): Don't emit unnecessary
1527         dynamic relocations on TLS GOT entries.
1528
1529 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1530
1531         * config.in: Disable sanity check for kfreebsd.
1532
1533 2012-09-10  Sterling Augustine  <saugustine@google.com>
1534
1535         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1536         (Gdb_index::pubtypes_read): New parameter.
1537         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1538         to calls.
1539         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1540         pubtypes_object_.
1541
1542 2012-09-09  Alan Modra  <amodra@gmail.com>
1543
1544         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1545         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1546         * gc.h (gc_process_relocs): Call target gc_add_reference.
1547         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1548         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1549         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1550         unnecessary cast.
1551         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1552         to cater for when we don't need code offset.  Update use.
1553         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1554         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1555         set_opd_valid): New functions.
1556         (Target_powerpc::do_gc_add_reference): New function.
1557         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1558         stashed refs.
1559         (Target_powerpc::do_gc_mark_symbol): New function.
1560
1561 2012-09-06  Cary Coutant  <ccoutant@google.com>
1562
1563         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1564         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1565         (Dwarf_die::skip_attributes): Likewise.
1566         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1567         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1568         (main): Call it.
1569         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1570
1571 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1572
1573         * testsuite/script_test_3.t: Add .got.plt output section
1574         statement.
1575         * testsuite/script_test_4.t: Likewise.
1576
1577 2012-09-05  Alan Modra  <amodra@gmail.com>
1578
1579         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1580         update all uses and lose "enum" when using type.
1581
1582 2012-09-05  Alan Modra  <amodra@gmail.com>
1583
1584         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1585         * configure: Regenerate.
1586         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1587         (plugin_final_layout.stdout): Likewise.
1588         (memory_test): Set page sizes to 0x1000.
1589         * testsuite/Makefile.in: Regenerate.
1590         * testsuite/discard_locals_test.sh: Add FIXME comment.
1591         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1592         * testsuite/pr14265.t: Add .got output section statement.
1593         * testsuite/script_test_2.t: Likewise.
1594         * testsuite/script_test_3.t: Likewise.
1595         * testsuite/script_test_4.t: Likewise.
1596         * testsuite/script_test_5.t: Likewise.
1597         * testsuite/script_test_6.t: Likewise.
1598         * testsuite/script_test_7.t: Likewise.
1599         * testsuite/script_test_9.t: Likewise.
1600
1601 2012-09-05  Alan Modra  <amodra@gmail.com>
1602
1603         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1604         (Powerpc_relocate_functions::Status): New typedef.
1605         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1606         (Target_powerpc::Scan::local): Handle REL64.
1607         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1608         for REL32 and REL64.
1609         (Target_powerpc::symval_for_branch): New function, extracted from..
1610         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1611         checks.  Report overflow errors.
1612
1613 2012-09-05  Alan Modra  <amodra@gmail.com>
1614
1615         * object.h (Sized_relobj_file::emit_relocs): Delete.
1616         (Sized_relobj_file::emit_relocs_reltype): Delete.
1617         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1618         relocate_relocs for --emit-relocs.
1619         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1620         * output.h: Update comment.
1621         (Output_segment::first_section): New function.
1622         (Output_segment::first_section_load_address): Use first_section.
1623         * output.cc (Output_segment::first_section): New function extracted..
1624         (Output_segment::first_section_load_address): ..from here.  Delete.
1625         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1626         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1627         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1628         adjust call to target.h function.
1629         * i386.cc (Target_i386): Likewise.
1630         * sparc.cc (Target_sparc): Likewise.
1631         * x86_64.cc (Target_x86_64): Likewise.
1632         * powerpc.cc (Target_powerpc): Likewise.
1633         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1634         first tls section has section symbol for optimised local dynamic
1635         output relocs.
1636         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1637         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1638         optimised tls code.
1639         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1640         Rename to relocate_relocs.  Update error message.
1641
1642 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1643
1644         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1645         --just-symbols.
1646
1647 2012-08-31  Alan Modra  <amodra@gmail.com>
1648
1649         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1650         (Powerpc_relobj::toc_base_offset): New stub function.
1651         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1652         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1653         (Target_powerpc::Relocate::enum skip_tls): New.
1654         (Target_powerpc::call_tls_get_addr_): New var.
1655         (Target_powerpc::is_branch_reloc): Move to file scope.
1656         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1657         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1658         New functions.
1659         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1660         (powerpc_info): Correct common_pagesize for ppc64.
1661         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1662         (Powerpc_relocate_functions): Add overflow check enums and functions.
1663         Add non-shift version of rela, rela_ua.  Delete all rel public
1664         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1665         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1666         addr16_ha3, addr14 functions.
1667         (Output_data_got_powerpc::add_constant_pair): New function.
1668         (Output_data_got_powerpc::got_base_offset): Likewise.
1669         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1670         (instruction constants): Sort, add some more.
1671         (Output_data_glink::do_write): Add and use Address typedef.  Use
1672         object->toc_base_offset() stub for 64-bit.
1673         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1674         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1675         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1676         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1677         Always treat .opd relocs as against locally defined symbol.
1678         Correct condition for RELATIVE relocs.
1679         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1680         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1681         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1682         calculations.  Handle TLS relocs, and more.  Add overflow
1683         checking and adjust for Powerpc_relocate_functions changes.
1684         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1685         Reinstate --emit-relocs code with FIXME.
1686
1687 2012-08-30  Alan Modra  <amodra@gmail.com>
1688
1689         * layout.cc (Layout::set_segment_offsets): Set p_align to
1690         abi_pagesize, not common_pagesize.
1691         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1692         to determine whether file header can go in segment.
1693
1694 2012-08-30  Alan Modra  <amodra@gmail.com>
1695
1696         * output.h (Output_reloc::Output_reloc <output section>): Add
1697         is_relative param.  Adjust calls.
1698         (Output_reloc::add_output_section_relative): New functions.
1699         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1700         is_relative.
1701         (Output_reloc::symbol_value): Handle SECTION_CODE.
1702
1703 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1704
1705         * gold.cc (queue_middle_tasks): Call layout again when unique
1706         segments for sections is desired.
1707         * layout.cc (Layout::Layout): Initialize new members.
1708         (Layout::get_output_section_flags): New function.
1709         (Layout::choose_output_section): Call get_output_section_flags.
1710         (Layout::layout): Make output section for mapping to a unique segment.
1711         (Layout::insert_section_segment_map): New function.
1712         (Layout::attach_allocated_section_to_segment): Make unique segment for
1713         output sections marked so.
1714         (Layout::segment_precedes): Check for unique segments when sorting.
1715         * layout.h (Layout::Unique_segment_info): New struct.
1716         (Layout::Section_segment_map): New typedef.
1717         (Layout::insert_section_segment_map): New function.
1718         (Layout::get_output_section_flags): New function.
1719         (Layout::is_unique_segment_for_sections_specified): New function.
1720         (Layout::set_unique_segment_for_sections_specified): New function.
1721         (Layout::unique_segment_for_sections_specified_): New member.
1722         (Layout::section_segment_map_): New member.
1723         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1724         Rename is_gc_pass_one to is_pass_one.
1725         Rename is_gc_pass_two to is_pass_two.
1726         Rename is_gc_or_icf to is_two_pass.
1727         Check for which pass based on whether symbols data is present.
1728         Make it two pass when unique segments for sections is desired.
1729         * output.cc (Output_section::Output_section): Initialize new
1730         members.
1731         * output.h (Output_section::is_unique_segment): New function.
1732         (Output_section::set_is_unique_segment): New function.
1733         (Output_section::is_unique_segment_): New member.
1734         (Output_section::extra_segment_flags): New function.
1735         (Output_section::set_extra_segment_flags): New function.
1736         (Output_section::extra_segment_flags_): New member.
1737         (Output_section::segment_alignment): New function.
1738         (Output_section::set_segment_alignment): New function.
1739         (Output_section::segment_alignment_): New member.
1740         (Output_segment::Output_segment): Initialize is_unique_segment_.
1741         (Output_segment::is_unique_segment): New function.
1742         (Output_segment::set_is_unique_segment): New function.
1743         (Output_segment::is_unique_segment_): New member.
1744         * plugin.cc (allow_unique_segment_for_sections): New function.
1745         (unique_segment_for_sections): New function.
1746         (Plugin::load): Add new functions to transfer vector.
1747         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1748         * Makefile.in: Regenerate.
1749         * testsuite/plugin_final_layout.sh: Check if unique segment
1750         functionality works.
1751         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1752         are available.
1753         (allow_unique_segment_for_sections): New global.
1754         (unique_segment_for_sections): New global.
1755         (claim_file_hook): Call allow_unique_segment_for_sections.
1756         (all_symbols_read_hook): Call unique_segment_for_sections.
1757
1758 2012-08-22  Cary Coutant  <ccoutant@google.com>
1759
1760         * layout.cc (Layout::include_section): Don't assert on GROUP
1761         sections with --emit-relocs.
1762
1763 2012-08-21  Cary Coutant  <ccoutant@google.com>
1764
1765         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1766         if --export-dynamic-symbol names an undef symbol.
1767
1768 2012-08-18  Alan Modra  <amodra@gmail.com>
1769
1770         * powerpc.cc: Formatting and white space.
1771         (Powerpc_relobj): Rename got2_section_ to special_.
1772         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1773         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1774         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1775         (Target_powerpc): Add Address typedef and invalid_address.  Use
1776         throughout.
1777         (Target_powerpc::is_branch_reloc): New function.
1778         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1779         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1780         for dst_mask, value and addend.
1781         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1782         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1783         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1784         uint16_t for 24-bit offset.  Use get_output_section_offset and
1785         check return.
1786         (Target_powerpc::Scan::local): Handle more relocs.
1787         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1788         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1789         Plug in toc restoring insn after plt calls.  Translate branches
1790         to function descriptor symbols to corresponding entry point.
1791         (Target_powerpc::relocate_for_relocatable): Check return from
1792         get_output_section_offset.
1793         * symtab.h: Comment typo.
1794
1795 2012-08-14  Ian Lance Taylor  <iant@google.com>
1796
1797         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1798         unsupported_relocal_local to call unsupported_reloc_global.
1799
1800 2012-08-14  Nick Clifton  <nickc@redhat.com>
1801
1802         PR ld/14265
1803         * script-sections.cc (Sections_element::output_section_name): Add
1804         keep return parameter.
1805         (Output_section_element::match_name): Add keep return parameter.
1806         Return the value of the keep_ member.
1807         * script-sections.h (class Output_section): Update
1808         output_section_name prototype.
1809         * layout.cc (Layout::keep_input_section): New public member
1810         function.
1811         (Layout::choose_output_section): Pass keep parameter to
1812         output_section_name.
1813         * layout.h (class Layout): Add keep_input_section.
1814         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1815         sections.
1816         * testsuite/Makefile.am: Add a test.
1817         * testsuite/Makefile.in: Regenerate.
1818         * testsuite/pr14265.c: Source file for the test.
1819         * testsuite/pr14265.t: Linker script for the test.
1820         * testsuite/pr14265.sh: Shell script for the test.
1821
1822 2012-08-14  Alan Modra  <amodra@gmail.com>
1823
1824         * target.h (Target::output_section_name): New function.
1825         (Target::do_output_section_name): New function.
1826         * layout.cc (Layout::choose_output_section): Call the above.
1827         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1828
1829 2012-08-14  Alan Modra  <amodra@gmail.com>
1830
1831         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1832         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1833         for replace_constant call.
1834         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1835         (Output_data_glink::do_print_to_mapfile): New function.
1836         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1837         (Target_powerpc::Relocate::relocate): Likewise.
1838
1839 2012-08-14  Alan Modra  <amodra@gmail.com>
1840
1841         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1842         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1843         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1844         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1845         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1846         here.
1847         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1848         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1849         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1850         here.
1851         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1852         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1853
1854 2012-08-12  Alan Modra  <amodra@gmail.com>
1855
1856         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1857         (glink insn constants): Use uint32_t.
1858         (Output_data_glink::add_entry): Use insert, not [] operator.
1859
1860 2012-08-11  Alan Modra  <amodra@gmail.com>
1861
1862         * object.h (Sized_relobj_file::find_shdr): New function.
1863         (Sized_relobj_file::find_special_sections): New function.
1864         * object.cc (Sized_relobj_file::find_shdr): New function.
1865         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1866         (Sized_relobj_file::find_special_sections): New function, split out..
1867         (Sized_relobj_file::do_read_symbols): ..from here.
1868         * output.h (Output_data_got::replace_constant): New function.
1869         (Output_data_got::num_entries): New function.
1870         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1871         (Output_data_got::got_offset): Protected rather than private.
1872         (Output_data_got::replace_got_entry): New function.
1873         * output.cc (Output_data_got::replace_got_entry): New function.
1874         * powerpc.cc (class Powerpc_relobj): New.
1875         (class Powerpc_relocate_functions): Delete all psymval variants or
1876         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1877         Implement _ha functions using corresponding _hi function.
1878         (Powerpc_relobj::find_special_sections): New function.
1879         (Target_powerpc::do_make_elf_object): New function.
1880         (class Output_data_got_powerpc): New.
1881         (class Output_data_glink): New.
1882         (class Powerpc_scan_relocatable_reloc): New.
1883         Many more changes througout file.
1884
1885 2012-08-09  Nick Clifton  <nickc@redhat.com>
1886
1887         * po/vi.po: Updated Vietnamese translation.
1888
1889 2012-08-07  Ian Lance Taylor  <iant@google.com>
1890
1891         * layout.cc (Layout::add_target_dynamic_tags): If
1892         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1893         plt_rel.
1894
1895 2012-07-30  Nick Clifton  <nickc@redhat.com>
1896
1897         * po/gold.pot: Updated template.
1898         * po/es.po: Updated Spanish translation.
1899
1900 2012-07-18  Cary Coutant  <ccoutant@google.com>
1901
1902         PR gold/14344
1903         * configure.ac: Add check for -gpubnames support.
1904         * configure: Regenerate.
1905         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1906         support; force -gno-pubnames.
1907         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1908         support.
1909         (gdb_index_test_4): New test.
1910         * testsuite/Makefile.in: Regenerate.
1911         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1912         * testsuite/gdb_index_test_2.sh: Likewise.
1913         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1914         * testsuite/gdb_index_test_4.sh: New script.
1915         * testsuite/gdb_index_test_comm.sh: New script with common code;
1916         don't look for space after colon.
1917
1918 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1919
1920         * gold.cc (queue_middle_tasks): Update function order only after
1921         deferred objects due to plugins are processed.
1922
1923 2012-07-11  Ian Lance Taylor  <iant@google.com>
1924
1925         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1926         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1927         (Target_arm::scan_reloc_for_stub): Likewise.
1928         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1929         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1930         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1931         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1932         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1933
1934 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1935             Ian Lance Taylor  <iant@google.com>
1936
1937         PR gold/14309
1938         * configure.ac: Test whether std::tr1::hash<off_t> works.
1939         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1940         needed.
1941         * output.h (class Output_fill): Add virtual destructor.
1942         * configure, config.in: Rebuild.
1943
1944 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1945
1946         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1947
1948 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1949
1950         * plugin.cc (Plugin::load): Handle position independent executables.
1951
1952 2012-06-06  Cary Coutant  <ccoutant@google.com>
1953
1954         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1955         add .debug_macro.
1956         (lines_only_debug_sections): Likewise.
1957         (gdb_fast_lookup_sections): New static array.
1958         (is_gdb_debug_section): Rename formal parameter.
1959         (is_lines_only_debug_section): Likewise.
1960         (is_gdb_fast_lookup_section): New function.
1961         (Layout::include_section): Check for ".zdebug_" prefix; pass
1962         section name suffix to is_gdb_debug_section, et al.; check for
1963         fast-lookup sections when building .gdb_index.
1964         * options.h (--strip-debug-gdb): Update GDB version number.
1965
1966 2012-06-06  Cary Coutant  <ccoutant@google.com>
1967
1968         * configure.ac: Add check for fallocate.
1969         * configure: Regenerate.
1970         * config.in: Regenerate.
1971
1972         * options.h (class General_options): Add --mmap-output-file and
1973         --posix-fallocate options.
1974         * output.cc: (posix_fallocate): Remove; replace with...
1975         (gold_fallocate): New function.
1976         (Output_file::map_no_anonymous): Call gold_fallocate.
1977         (Output_file::map): Check --mmap-output-file option.
1978
1979 2012-06-05  Jing Yu  <jingyu@google.com>
1980
1981         * gold.h (textdomain): Add do {} to empty while(0).
1982         (bindtextdomain): Likewise.
1983
1984 2012-06-04  Cary Coutant  <ccoutant@google.com>
1985
1986         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1987         has_dynsym_index.
1988
1989 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1990
1991         * symtab.cc (Symbol_table::define_special_symbol):
1992         Initialize *poldsym to prevent uninitialized variable errors.
1993
1994 2012-05-23  Cary Coutant  <ccoutant@google.com>
1995
1996         * layout.cc (Layout::section_name_mapping): Add rules to handle
1997         exact match on .data.rel.ro.local or .data.rel.ro.
1998         (Layout::output_section_name): Check for exact matches.
1999
2000 2012-05-23  Cary Coutant  <ccoutant@google.com>
2001
2002         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2003         more carefully.
2004
2005 2012-05-22  Cary Coutant  <ccoutant@google.com>
2006
2007         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2008         object before exporting symbol.
2009
2010 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2011
2012         * testsuite/tls_test.cc: Include "config.h" first.
2013         * testsuite/tls_test_c.c: Likewise.
2014
2015 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2016             Nick Clifton  <nickc@redhat.com>
2017
2018         PR 14072
2019         * configure.in: Add check that sysdep.h has been included before
2020         any system header files.
2021         * configure: Regenerate.
2022         * config.in: Regenerate.
2023
2024 2012-05-14  Cary Coutant  <ccoutant@google.com>
2025
2026         * layout.cc (Layout::make_output_section): Mark .tdata section
2027         as RELRO.
2028         * testsuite/relro_test.cc: Add a TLS variable.
2029
2030 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2031
2032         PR gold/14091
2033         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2034         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2035         R_X86_64_64.
2036
2037 2012-05-08  Cary Coutant  <ccoutant@google.com>
2038
2039         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2040         (lines_only_debug_sections): Likewise.
2041
2042 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2043
2044         * nacl.cc: New file.
2045         * nacl.h: New file.
2046         * Makefile.am (CCFILES, HFILES): Add them.
2047         * Makefile.in: Regenerate.
2048         * i386.cc (Output_data_plt_i386_nacl): New class.
2049         (Output_data_plt_i386_nacl_exec): New class.
2050         (Output_data_plt_i386_nacl_dyn): New class.
2051         (Target_i386_nacl): New class.
2052         (Target_selector_i386_nacl): New class.
2053         (target_selector_i386): Use it instead of Target_selector_i386.
2054         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2055         (Target_x86_64_nacl): New class.
2056         (Target_selector_x86_64_nacl): New class.
2057         (target_selector_x86_64, target_selector_x32): Use it instead of
2058         Target_selector_x86_64.
2059         * arm.cc (Output_data_plt_arm_nacl): New class.
2060         (Target_arm_nacl): New class.
2061         (Target_selector_arm_nacl): New class.
2062         (target_selector_arm, target_selector_armbe): Use it instead of
2063         Target_selector_arm.
2064
2065         * target-select.cc (select_target): Take new Input_file* and off_t
2066         arguments, pass them on to recognize method of selector.
2067         * object.cc (make_elf_sized_object): Update caller.
2068         * parameters.cc (parameters_force_valid_target): Likewise.
2069         * incremental.cc (make_sized_incremental_binary): Likewise.
2070         * target-select.h: Update decl.
2071         (Target_selector::recognize): Take new Input_file* argument,
2072         pass it on to do_recognize.
2073         (Target_selector::do_recognize): Take new Input_file* argument.
2074         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2075         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2076         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2077         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2078
2079         * target.h (Target::Target_info): New members isolate_execinstr
2080         and rosegment_gap.
2081         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2082         * arm.cc (Target_arm::arm_info): Update initializer.
2083         * i386.cc (Target_i386::i386_info): Likewise.
2084         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2085         * sparc.cc (Target_sparc::sparc_info): Likewise.
2086         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2087         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2088         * layout.cc (Layout::attach_allocated_section_to_segment):
2089         Take new const Target* argument.  If target->isolate_execinstr(), act
2090         like --rosegment.
2091         (Layout::find_first_load_seg): Take new const Target* argument;
2092         if target->isolate_execinstr(), reject PF_X segments.
2093         (Layout::relaxation_loop_body): Update caller.
2094         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2095         reset file offset to zero when we hit LOAD_SEG, and then do a second
2096         loop over the segments before LOAD_SEG to reassign offsets after
2097         addresses have been determined.  Handle target->rosegment_gap().
2098         (Layout::attach_section_to_segment): Take new const Target* argument;
2099         pass it to attach_allocated_section_to_segment.
2100         (Layout::make_output_section): Update caller.
2101         (Layout::attach_sections_to_segments): Take new const Target* argument;
2102         pass it to attach_section_to_segment.
2103         * gold.cc (queue_middle_tasks): Update caller.
2104         * layout.h (Layout): Update method decls with new arguments.
2105
2106         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2107         Target_info pointer to use.
2108         (Target_arm::do_make_data_plt): New virtual method.
2109         (Target_arm::make_data_plt): New method that calls it.
2110         (Target_arm::make_plt_entry): Use it.
2111         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2112         for the section alignment.
2113         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2114         method.
2115         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2116         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2117         method.
2118         (Output_data_plt_arm::get_plt_entry_size): Call it.
2119         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2120         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2121         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2122         method.
2123         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2124         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2125         method instead of sizeof(plt_entry).
2126         (Output_data_plt_arm::add_entry): Likewise.
2127         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2128         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2129         than static method.
2130         (Target_arm::plt_entry_size): Likewise.
2131         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2132         Move to ...
2133         (Output_data_plt_arm_standard): ... here, new class.
2134         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2135         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2136         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2137
2138         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2139         Take additional argument for the PLT entry size.
2140         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2141         Use get_plt_entry_size method rather than plt_entry_size variable.
2142         (Output_data_plt_x86_64::reserve_slot): Likewise.
2143         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2144         (Output_data_plt_x86_64::add_entry): Likewise.
2145         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2146         (Output_data_plt_x86_64::address_for_global): Likewise.
2147         (Output_data_plt_x86_64::address_for_local): Likewise.
2148         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2149         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2150         Make method non-static.
2151         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2152         method.
2153         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2154         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2155         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2156         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2157         virtual method.
2158         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2159         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2160         virtual method.
2161         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2162         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2163         virtual method.
2164         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2165         (Output_data_plt_x86_64::plt_entry_size)
2166         (Output_data_plt_x86_64::first_plt_entry)
2167         (Output_data_plt_x86_64::plt_entry)
2168         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2169         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2170         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2171         (Output_data_plt_x86_64_standard): ... here, new class.
2172         (Target_x86_64::Target_x86_64): Take optional argument for the
2173         Target_info pointer to use.
2174         (Target_x86_64::do_make_data_plt): New virtual method.
2175         (Target_x86_64::make_data_plt): New method to call it.
2176         (Target_x86_64::init_got_plt_for_update): Use that.
2177         Call this->plt_->add_eh_frame method here.
2178         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2179         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2180         rather than static method.
2181         (Target_x86_64::plt_entry_size): Likewise.
2182         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2183         rather than plt_entry_size variable.  Move guts of PLT filling to...
2184         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2185         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2186         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2187
2188         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2189         additional argument for the section alignment.
2190         Don't do add_eh_frame_for_plt here.
2191         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2192         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2193         variable.
2194         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2195         method.
2196         (Output_data_plt_i386::get_plt_entry_size): Call it.
2197         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2198         (Output_data_plt_i386::add_eh_frame): New method to call it.
2199         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2200         method.
2201         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2202         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2203         method.
2204         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2205         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2206         method instead of plt_entry_size.
2207         (Output_data_plt_i386::plt_entry_size)
2208         (Output_data_plt_i386::plt_eh_frame_fde_size)
2209         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2210         (Output_data_plt_i386_standard): ... here, new class.
2211         (Output_data_plt_i386_exec): New class.
2212         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2213         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2214         (Output_data_plt_i386::exec_plt_entry): Move to ...
2215         (Output_data_plt_i386_exec::plt_entry): ... here.
2216         (Output_data_plt_i386_dyn): New class.
2217         (Output_data_plt_i386::first_plt_entry): Move to ...
2218         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2219         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2220         (Output_data_plt_i386_dyn::plt_entry): ... here.
2221         (Target_i386::Target_i386): Take optional argument for the Target_info
2222         pointer to use.
2223         (Target_i386::do_make_data_plt): New virtual method.
2224         (Target_i386::make_data_plt): New method to call it.
2225         (Target_i386::make_plt_section): Use that.
2226         Call this->plt_->add_eh_frame method here.
2227         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2228         rather than plt_entry_size variable.
2229         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2230         (Output_data_plt_i386::address_for_local): Likewise.
2231         (Output_data_plt_i386::do_write): Likewise.
2232         Move guts of PLT filling to...
2233         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2234         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2235         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2236         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2237
2238 2012-05-01  Cary Coutant  <ccoutant@google.com>
2239
2240         * dwarf_reader.cc (Dwarf_die::read_attributes)
2241         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2242         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2243         * reduced_debug_output.cc
2244         (Output_reduced_debug_info_section::get_die_end): Remove
2245         DW_FORM_GNU_ref_index.  Add default case.
2246
2247 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2248
2249         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2250         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2251         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2252         DW_AT_high_pc as offset from DW_AT_low_pc.
2253
2254         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2255         * testsuite/Makefile.in: Regenerate.
2256         * testsuite/gdb_index_test_3.c: New test source file.
2257         * testsuite/gdb_index_test_3.sh: New test source file.
2258
2259 2012-04-25  Ian Lance Taylor  <iant@google.com>
2260
2261         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2262         pointer.
2263         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2264         as a class, not a struct.
2265         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2266         (Target_arm::apply_cortex_a8_workaround): Likewise.
2267         * gc.h: Declare Reloc_types as a struct, not a class.
2268         * object.h: Declare Symbols_data as a struct.
2269         * reloc.h: Declare Read_relocs_data as a struct.
2270         * target.h: Declare Relocate_info as a struct.
2271
2272 2012-04-24  David S. Miller  <davem@davemloft.net>
2273
2274         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2275         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2276         and R_SPARC_WPLT30.
2277
2278 2012-04-24  Cary Coutant  <ccoutant@google.com>
2279
2280         * incremental-dump.cc (find_input_containing_global): Replace
2281         magic number with symbolic constant.
2282         (dump_incremental_inputs): Update version number.
2283         * incremental.cc (Output_section_incremental_inputs): Update version
2284         number; import symbolic constants from Incremental_inputs_reader.
2285         (Incremental_inputs::create_data_sections): Align relocations
2286         section correctly for 64-bit targets.
2287         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2288         constants; add padding.
2289         (Output_section_incremental_inputs::write_header): Add assert for
2290         header_size.
2291         (Output_section_incremental_inputs::write_input_files): Add assert
2292         for input_entry_size.
2293         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2294         add assert for object_info_size, input_section_entry_size,
2295         global_sym_entry_size.
2296         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2297         for data structure sizes; use them.
2298         (Incremental_input_entry_reader): Import symbolic constants from
2299         Incremental_inputs_reader; use them.
2300
2301 2012-04-23  David S. Miller  <davem@davemloft.net>
2302
2303         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2304         and elf_flags_set_.
2305         (Target_sparc::Target_sparc): Initialize new fields.
2306         (Target_sparc::do_make_elf_object): New function.
2307         (Target_sparc::do_adjust_elf_header): New function.
2308
2309 2012-04-23  Cary Coutant  <ccoutant@google.com>
2310
2311         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2312         CU range table of gdb index.
2313
2314 2012-04-20  David S. Miller  <davem@davemloft.net>
2315
2316         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2317         instead of false.
2318
2319 2012-04-16  David S. Miller  <davem@davemloft.net>
2320
2321         * sparc.cc (Target_sparc::got_address): New function.
2322         (Sparc_relocate_functions::gdop_hix22): New function.
2323         (Sparc_relocate_functions::gdop_lox10): New function.
2324         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2325         relocs.
2326         (Target_sparc::Scan::local): Likewise if the global symbol is not
2327         preemptible and is not IFUNC.
2328         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2329         transformations for local and non-preemptible non-IFUNC global
2330         symbols.
2331
2332         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2333         writing out 64-bit part of ranges.
2334
2335         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2336         -fpic and -fpie respectively.
2337         * Makefile.in: Regenerate.
2338
2339         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2340         (Target_sparc::Target_sparc): Initialize new field.
2341         (Target_sparc::do_plt_section_for_global): New function.
2342         (Target_sparc::do_plt_section_for_local): New function.
2343         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2344         (Target_sparc::make_plt_section): New function, broken out of
2345         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2346         (Target_sparc::make_plt_entry): Call make_plt_section.
2347         (Target_sparc::make_local_ifunc_plt_entry): New function.
2348         (Target_sparc::rela_ifunc_section): New function.
2349         (Target_sparc::plt_section): Remove const.
2350         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2351         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2352         and ifunc_count_ fields.
2353         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2354         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2355         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2356         (Output_data_plt_sparc::rela_ifunc): New function.
2357         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2358         (Output_data_plt_sparc::has_ifunc_section): New function.
2359         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2360         (Output_data_plt_sparc::address_for_global): New function.
2361         (Output_data_plt_sparc::address_for_local): New function.
2362         (Output_data_plt_sparc::plt_index_to_offset): New function.
2363         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2364         and entry_count.
2365         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2366         entry_count.
2367         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2368         R_SPARC_JMP_IREL to switch.
2369         (Target_sparc::Scan::check_non_pic): Likewise.
2370         (Target_sparc::Scan::local): Handle IFUNC symbols.
2371         (Target_sparc::Scan::local): Likewise.
2372         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2373         and plt_address_for_local.
2374         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2375         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2376
2377         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2378         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2379         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2380         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2381         global relocs too.
2382         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2383         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2384         calls.
2385         * sparc.cc (Target_sparc::Scan::global): Likewise.
2386         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2387
2388 2012-04-16  Cary Coutant  <ccoutant@google.com>
2389
2390         * archive.cc (Library_base::should_include_member): Check for
2391         --export-dynamic-symbol.
2392         * options.h (class General_options): Add --export-dynamic-symbol.
2393         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2394         --export-dynamic-symbol.
2395         (Symbol_table::gc_mark_undef_symbols): Likewise.
2396         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2397
2398 2012-04-12  David S. Miller  <davem@davemloft.net>
2399
2400         * sparc.cc (Reloc::wdisp10): New relocation method.
2401         (Reloc::h34): Likewise.
2402         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2403         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2404         R_SPARC_WDISP10.
2405         (Target_sparc::Scan::local): Likewise.
2406         (Target_sparc::Scan::global): Likewise.
2407         (Target_sparc::Relocate::relocate): Likewise.
2408
2409 2012-04-09  Cary Coutant  <ccoutant@google.com>
2410
2411         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2412         low_pc == 0.
2413
2414 2012-04-06  Ian Lance Taylor  <iant@google.com>
2415
2416         * timer.cc: #include <unistd.h>.
2417
2418 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2419
2420         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2421         * config.in: Regenerate.
2422         * configure: Regenerate.
2423
2424 2012-04-05  Nick Clifton  <nickc@redhat.com>
2425
2426         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2427         (AM_LC_MESSAGES): Add.
2428         * aclocal.m4: Regenerate.
2429         * config.in: Regenerate.
2430         * configure: Regenerate.
2431
2432 2012-03-21  Cary Coutant  <ccoutant@google.com>
2433
2434         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2435         * Makefile.in: Regenerate.
2436         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2437         (Sized_elf_reloc_mapper::symbol_section): New function.
2438         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2439         (make_elf_reloc_mapper): New function.
2440         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2441         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2442         (Dwarf_abbrev_table::do_get_abbrev): New function.
2443         (Dwarf_ranges_table::read_ranges_table): New function.
2444         (Dwarf_ranges_table::read_range_list): New function.
2445         (Dwarf_pubnames_table::read_section): New function.
2446         (Dwarf_pubnames_table::read_header): New function.
2447         (Dwarf_pubnames_table::next_name): New function.
2448         (Dwarf_die::Dwarf_die): New function.
2449         (Dwarf_die::read_attributes): New function.
2450         (Dwarf_die::skip_attributes): New function.
2451         (Dwarf_die::set_name): New function.
2452         (Dwarf_die::set_linkage_name): New function.
2453         (Dwarf_die::attribute): New function.
2454         (Dwarf_die::string_attribute): New function.
2455         (Dwarf_die::int_attribute): New function.
2456         (Dwarf_die::uint_attribute): New function.
2457         (Dwarf_die::ref_attribute): New function.
2458         (Dwarf_die::child_offset): New function.
2459         (Dwarf_die::sibling_offset): New function.
2460         (Dwarf_info_reader::check_buffer): New function.
2461         (Dwarf_info_reader::parse): New function.
2462         (Dwarf_info_reader::do_parse): New function.
2463         (Dwarf_info_reader::do_read_string_table): New function.
2464         (Dwarf_info_reader::lookup_reloc): New function.
2465         (Dwarf_info_reader::get_string): New function.
2466         (Dwarf_info_reader::visit_compilation_unit): New function.
2467         (Dwarf_info_reader::visit_type_unit): New function.
2468         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2469         Sized_elf_reloc_mapper.
2470         (Sized_dwarf_line_info::symbol_section): Remove function.
2471         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2472         (Sized_dwarf_line_info::read_line_mappings): Remove object
2473         parameter, adjust callers.
2474         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2475         * dwarf_reader.h: Include <sys/types.h>.
2476         (class Track_relocs): Remove forward declaration.
2477         (class Elf_reloc_mapper): New class.
2478         (class Sized_elf_reloc_mapper): New class.
2479         (class Dwarf_abbrev_table): New class.
2480         (class Dwarf_range_list): New class.
2481         (class Dwarf_ranges_table): New class.
2482         (class Dwarf_pubnames_table): New class.
2483         (class Dwarf_die): New class.
2484         (class Dwarf_info_reader): New class.
2485         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2486         (Sized_dwarf_line_info::symbol_section): Remove member function.
2487         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2488         base class.
2489         * gdb-index.cc: New source file.
2490         * gdb-index.h: New source file.
2491         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2492         and .debug_types sections, call Layout::add_to_gdb_index.
2493         (Sized_relobj_incr::do_section_name): Implement.
2494         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2495         return type; Implement.
2496         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2497         return type.
2498         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2499         parameter list and return type.
2500         (Sized_incr_dynobj::do_section_contents): Likewise.
2501         * layout.cc: Include gdb-index.h.
2502         (Layout::Layout): Initialize gdb_index_data_.
2503         (Layout::init_fixed_output_section): Check for .gdb_index section.
2504         (Layout::add_to_gdb_index): New function. Instantiate.
2505         * layout.h: Add forward declaration for class Gdb_index.
2506         (Layout::add_to_gdb_index): New member function.
2507         (Layout::gdb_index_data_): New data member.
2508         * main.cc: Include gdb-index.h.
2509         (main): Print statistics for gdb index.
2510         * object.cc (Object::section_contents): Move code into
2511         do_section_contents.
2512         (need_decompressed_section): Check for sections needed when building
2513         gdb index.
2514         (build_compressed_section_map): Likewise.
2515         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2516         gdb index.
2517         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2518         sections; call Layout::add_to_gdb_index.
2519         (Sized_relobj_file::do_decompressed_section_contents): Call
2520         do_section_contents directly.
2521         * object.h (Object::do_section_contents): Adjust parameter list and
2522         return type.
2523         (Object::do_decompressed_section_contents): Call do_section_contents
2524         directly.
2525         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2526         return type.
2527         * options.h (class General_options): Add --gdb-index option.
2528         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2529         list and return type.
2530         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2531         * reloc.h (Track_relocs::checkpoint): New function.
2532         (Track_relocs::reset): New function.
2533
2534         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2535         New test cases.
2536         * testsuite/Makefile.in: Regenerate.
2537         * testsuite/gdb_index_test.cc: New test source file.
2538         * testsuite/gdb_index_test_1.sh: New test source file.
2539         * testsuite/gdb_index_test_2.sh: New test source file.
2540
2541 2012-03-19  Doug Kwan  <dougkwan@google.com>
2542
2543         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2544         (Target_arm::do_finalize_sections): Remove code which defines
2545         __exidx_start and __exidx_end.  Make symbol table parameter
2546         anonymous as it is not used.
2547         * gold.cc (queue_middle_tasks): Call target hook to define any
2548         target-specific symbols.
2549         * target.h (Target::define_standard_symbols): New method.
2550         (Target::do_define_standard_symbols): Same.
2551         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2552         * testsuite/Makefile.in: Regenerate.
2553         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2554         and __exidx_end.
2555         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2556         relocations are generated for __exidx_start and __exidx_end.
2557
2558 2012-03-16  Doug Kwan  <dougkwan@google.com>
2559
2560         * testsuite/Makefile.am: Disable test initpri3b.
2561         * testsuite/Makefile.in: Regenerate.
2562
2563 2012-03-15  Doug Kwan  <dougkwan@google.com>
2564
2565         * arm.cc (Target_arm::got_section): Make .got section read-only
2566         if -z now is given.
2567
2568 2012-03-15  Ian Lance Taylor  <iant@google.com>
2569
2570         PR gold/13850
2571         * layout.cc (Layout::make_output_section): Correctly mark
2572         SHT_INIT_ARRAY, et. al., as relro.
2573
2574 2012-03-14  Doug Kwan  <dougkwan@google.com>
2575
2576         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2577         dynamic relocations for protected symbols in shared objects.
2578
2579 2012-03-13  Ian Lance Taylor  <iant@google.com>
2580
2581         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2582         keep the larger alignment.
2583
2584 2012-03-12  Cary Coutant  <ccoutant@google.com>
2585
2586         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2587         handling of DW_LNE_define_file.
2588
2589 2012-03-12  Cary Coutant  <ccoutant@google.com>
2590
2591         * reduced_debug_output.cc
2592         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2593         codes to switch.
2594
2595 2012-02-29  Cary Coutant  <ccoutant@google.com>
2596
2597         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2598
2599 2012-02-29  Cary Coutant  <ccoutant@google.com>
2600
2601         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2602         Call Object::decompressed_section_contents.
2603         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2604         New dtor.
2605         (Sized_dwarf_line_info::buffer_start_): New data member.
2606         * merge.cc (Output_merge_data::do_add_input_section): Call
2607         Object::decompressed_section_contents.
2608         (Output_merge_string::do_add_input_section): Likewise.
2609         * object.cc (need_decompressed_section): New function.
2610         (build_compressed_section_map): Decompress sections needed later.
2611         (Sized_relobj_file::do_decompressed_section_contents): New function.
2612         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2613         * object.h (Object::decompressed_section_contents): New function.
2614         (Object::discard_decompressed_sections): New function.
2615         (Object::do_decompressed_section_contents): New function.
2616         (Object::do_discard_decompressed_sections): New function.
2617         (Compressed_section_info): New type.
2618         (Compressed_section_map): Include decompressed section contents.
2619         (Sized_relobj_file::do_decompressed_section_contents): New function.
2620         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2621
2622 2012-02-16  Cary Coutant  <ccoutant@google.com>
2623
2624         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2625         * testsuite/Makefile.in: Regenerate.
2626
2627 2012-02-14  Cary Coutant  <ccoutant@google.com>
2628
2629         * options.cc (General_options::finalize): Disallow -pie and -static.
2630
2631 2012-02-03  Doug Kwan  <dougkwan@google.com>
2632
2633         * arm.cc (Arm_relocate_functions::abs8,
2634         Arm_relocate_functions::abs16): Use
2635         Bits::has_signed_unsigned_overflow32.
2636         (Arm_relocate_functions::thm_abs8): Correct range of
2637         overflow check.
2638         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2639         in assertions.
2640
2641 2012-02-02  Doug Kwan  <dougkwan@google.com>
2642
2643         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2644         position independent outputs, not just shared objects.
2645
2646 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2647
2648         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2649         * configure: Regenerated.
2650
2651 2012-01-27  Ian Lance Taylor  <iant@google.com>
2652
2653         * reloc.h (Bits): New class with static functions, copied from
2654         namespace utils in arm.cc.
2655         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2656         instead.
2657
2658 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2659
2660         * incremental.cc (write_info_blocks): Correct relocation offset.
2661
2662 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2663
2664         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2665         (Relocate::tls_gd_to_le): Likewise.
2666
2667 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2668
2669         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2670
2671 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2672
2673         * configure.ac: Check if -mcmodel=medium works.
2674         * configure: Regenerated.
2675
2676 2012-01-24  Cary Coutant  <ccoutant@google.com>
2677
2678         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2679         definition and ...
2680         (read_unsigned_LEB_128_x): ... this new function.
2681         (read_signed_LEB_128): Replaced with inline definition and ...
2682         (read_signed_LEB_128_x): ... this new function.
2683         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2684         (read_unsigned_LEB_128): Add inline definition.
2685         (read_signed_LEB_128_x): New function.
2686         (read_signed_LEB_128): Add inline definition.
2687         * testsuite/Makefile.am (leb128_unittest): New unit test.
2688         * testsuite/Makefile.in: Regenerate.
2689         * testsuite/leb128_unittest.cc: New unit test.
2690
2691 2012-01-23  Ian Lance Taylor  <iant@google.com>
2692
2693         PR gold/13617
2694         * i386.cc (Target_i386::do_code_fill): When using a jmp
2695         instruction, pad with nop instructions.
2696         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2697
2698 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2699
2700         * x86_64.cc (gc_process_relocs): Add typename on types used in
2701         template.
2702         (scan_relocs): Likewise.
2703         (relocate_section): Likewise.
2704         (apply_relocation): Likewise.
2705
2706 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2707
2708         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2709         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2710         under x32.
2711
2712 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2713
2714         * x86_64.cc: Initial support for x32.
2715
2716 2012-01-03  Cary Coutant  <ccoutant@google.com>
2717
2718         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2719         Use abstract base class for GOT.
2720         * gold/output.h (class Output_data_got_base): New abstract base class.
2721         (class Output_data_got): Derive from new base class, adjust ctors.
2722         (Output_data_got::reserve_slot): Make virtual; rename to
2723         do_reserve_slot; Adjust callers.
2724         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2725         pointer to abstract base class.
2726         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2727
2728 2011-12-18  Ian Lance Taylor  <iant@google.com>
2729
2730         * object.h (Relobj::local_symbol_value): New function.
2731         (Relobj::local_plt_offset): New function.
2732         (Relobj::local_has_got_offset): New function.
2733         (Relobj::local_got_offset): New function.
2734         (Relobj::set_local_got_offset): New function.
2735         (Relobj::do_local_symbol_value): New pure virtual function.
2736         (Relobj::do_local_plt_offset): Likewise.
2737         (Relobj::do_local_has_got_offset): Likewise.
2738         (Relobj::do_local_got_offset): Likewise.
2739         (Relobj::do_set_local_got_offset): Likewise.
2740         (Sized_relobj::do_local_has_got_offset): Rename from
2741         local_has_got_offset.
2742         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2743         (Sized_relobj::do_set_local_got_offset): Rename from
2744         set_local_got_offset.
2745         (Sized_relobj_file::do_local_plt_offset): Rename from
2746         local_plt_offset.
2747         (Sized_relobj_file::do_local_symbol_value): New function.
2748         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2749         local_plt_offset.
2750         * output.cc (Output_data_got::Got_entry::write): Change object to
2751         Relobj.  Use local_symbol_value.
2752         (Output_data_got::add_global_with_rel): Change rel_dyn to
2753         Output_data_reloc_generic*.  Use add_global_generic.
2754         (Output_data_got::add_global_with_rela): Remove.  Change all
2755         callers to use add_global_with_rel.
2756         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2757         Output_data_reloc_generic*.  Use add_global_generic.
2758         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2759         callers to use add_global_pair_with_rel.
2760         (Output_data_got::add_local): Change object to Relobj*.
2761         (Output_data_got::add_local_plt): Likewise.
2762         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2763         change rel_dyn to Output_data_reloc_generic*.  Use
2764         add_local_generic.
2765         (Output_data_got::add_local_with_rela): Remove.  Change all
2766         callers to use all_local_with_rel.
2767         (Output_data_got::add_local_pair_with_rel): Change object to
2768         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2769         add_output_section_generic.
2770         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2771         callers to use add_local_pair_with_rel.
2772         (Output_data_got::reserve_local): Change object to Relobj*.
2773         * output.h: (class Output_data_reloc_generic): Add pure virtual
2774         declarations for add_global_generic, add_local_generic,
2775         add_output_section_generic.
2776         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2777         functions for Output_data_reloc_generic.  Update declarations for
2778         changes listed in output.cc.
2779         (class Output_data_got): Change template parameter to got_size.
2780         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2781         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2782         function.
2783         (Sized_relobj_incr::do_local_plt_offset): New function.
2784         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2785         add_global_generic.
2786
2787 2011-12-17  Cary Coutant  <ccoutant@google.com>
2788
2789         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2790         * resolve.cc (Symbol_table::resolve): Likewise.
2791         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2792         arrays.
2793         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2794
2795 2011-12-16  Ian Lance Taylor  <iant@google.com>
2796
2797         * output.h (Output_data_reloc_generic::add): Only call
2798         add_dynamic_reloc if this is a dynamic reloc section.
2799
2800 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2801
2802         PR gold/13505
2803         * target-reloc.h (apply_relocation): Replace <64, false> with
2804         <size, big_endian>.
2805
2806 2011-11-25  Nick Clifton  <nickc@redhat.com>
2807
2808         * po/it.po: New Italian translation.
2809
2810 2011-11-17  Sterling Augustine  <saugustine@google.com>
2811
2812         * script.cc (script_include_directive): Implement.
2813         (read_script_file): New local variables name and search_path. Update
2814         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2815         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2816         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2817
2818 2011-11-11  Sterling Augustine  <saugustine@google.com>
2819
2820         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2821         (file_or_sections_cmd): Likewise.
2822
2823 2011-11-11  Doug Kwan  <dougkwan@google.com>
2824
2825         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2826         if --just-symbols is given.
2827
2828 2011-11-10  Doug Kwan  <dougkwan@google.com>
2829
2830         PR gold/13362
2831         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2832         when processing data relocs.
2833         * reloc.h (Relocate_functions::rel_unaligned): New method.
2834         (Relocate_functions::pcrel_unaligned): Ditto.
2835         (Relocate_functions::rel32_unaligned): Ditto.
2836         (Relocate_functions::pcrel32_unaligned): Ditto.
2837
2838 2011-11-09  Doug Kwan  <dougkwan@google.com>
2839
2840         PR gold/13362
2841         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2842         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2843         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2844         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2845         (Relocate_functions::rel_unaligned): New.
2846         (Relocate_functions::rel32_unaligned): New.
2847         * target-reloc.h (relocate_for_relocatable): Add code to handle
2848         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2849         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2850         arm_unaligned_reloc_r): New targets.
2851         * testsuite/Makefile.in: Regenerate.
2852         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2853         linking.
2854
2855 2011-11-02  Ian Lance Taylor  <iant@google.com>
2856
2857         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2858         NATIVE_LINKER.
2859         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2860         * options.cc (General_options::finalize): Use library search path
2861         from configure script if specified.  If not native and no sysroot,
2862         only search TOOLLIBDIR.
2863         * options.h (Search_directory::Search_directory): Change name to
2864         const std::string&.
2865         (General_options::add_to_library_path_with_sysroot): Change arg to
2866         const std::string&.
2867         * configure, Makefile.in, config.in: Rebuild.
2868
2869 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2870
2871         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2872         we are working around the ARM1176 Erratum.
2873         * options.h (General_options::fix_arm1176): Add option.
2874         * testsuite/Makefile.am: Add testcases, and keep current ones
2875         working.
2876         * testsuite/Makefile.in: Regenerate.
2877         * testsuite/arm_fix_1176.s: New file.
2878         * testsuite/arm_fix_1176.sh: Likewise.
2879
2880 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2881
2882         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2883         may_use_blx_.
2884         (Target_arm::may_use_blx): Remove method.
2885         (Target_arm::set_may_use_blx): Likewise.
2886         (Target_arm::may_use_v4t_interworking): New method.
2887         (Target_arm::may_use_v5t_interworking): Likewise.
2888         (Target_arm::may_use_blx_): Remove member variable.
2889         (Arm_relocate_functions::arm_branch_common): Check for v5T
2890         interworking.
2891         (Arm_relocate_functions::thumb_branch_common): Likewise.
2892         (Reloc_stub::stub_type_for_reloc): Likewise.
2893         (Target_arm::do_finalize_sections): Correct interworking checks.
2894         * testsuite/Makefile.am: Add new tests.
2895         * testsuite/Makefile.in: Regenerate.
2896         * testsuite/arm_farcall_arm_arm.s: New test.
2897         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2898         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2899         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2900         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2901         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2902         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2903         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2904
2905 2011-10-31  Cary Coutant  <ccoutant@google.com>
2906
2907         PR gold/13023
2908         * expression.cc (Expression::eval_with_dot): Add
2909         is_section_dot_assignment parameter.
2910         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2911         absolute and assigning to dot within a section.
2912         * script-sections.cc
2913         (Output_section_element_assignment::set_section_addresses): Pass
2914         dot_section to set_if_absolute.
2915         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2916         as is_section_dot_assignment flag to eval_with_dot.
2917         (Output_section_element_dot_assignment::set_section_addresses):
2918         Likewise.
2919         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2920         parameter.  Also set value if relative to dot_section; set the
2921         symbol's output_section.
2922         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2923         parameter.  Adjust all callers.
2924         (Expression::eval_maybe_dot): Likewise.
2925         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2926         Adjust all callers.
2927         * testsuite/script_test_2.t: Test assignment of an absolute value
2928         to dot within an output section element.
2929
2930 2011-10-31  Cary Coutant  <ccoutant@google.com>
2931
2932         * options.h (class General_options): Add --[no-]gnu-unique options.
2933         * symtab.cc (Symbol_table::sized_write_globals): Convert
2934         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2935
2936 2011-10-31  Cary Coutant  <ccoutant@google.com>
2937
2938         PR gold/13359
2939         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2940         unnecessary assertion.
2941         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2942
2943 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2944
2945         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2946         gc_mark_symbol.
2947         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2948         gc_mark_symbol.
2949         Change to just keep the section associated with symbol.
2950         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2951         they are externally visible and --export-dynamic is turned on.
2952         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2953
2954 2011-10-19  Ian Lance Taylor  <iant@google.com>
2955
2956         PR gold/13163
2957         * script-sections.cc
2958         (Output_section_element_dot_assignment::needs_output_section): New
2959         function.
2960
2961 2011-10-19  Ian Lance Taylor  <iant@google.com>
2962
2963         PR gold/13204
2964         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2965         --section-start option was seen.
2966         * options.h (General_options::any_section_start): New function.
2967
2968 2011-10-18  David S. Miller  <davem@davemloft.net>
2969
2970         PR binutils/13301
2971         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2972         member to track relocation locations that have moved during TLS
2973         reloc optimizations.
2974         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2975         (Target_sparc::Relocate::relocate): Adjust view down by 4
2976         bytes if it matches reloc_adjust_addr_.
2977         (Target_sparc::Relocate::relocate_tls): Always move the
2978         __tls_get_addr call delay slot instruction forward 4 bytes when
2979         performing relaxation.
2980
2981 2011-10-18  Cary Coutant  <ccoutant@google.com>
2982
2983         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2984         (Output_file::map_no_anonymous): Check for non-zero
2985         return code from posix_fallocate.
2986
2987 2011-10-17  Cary Coutant  <ccoutant@google.com>
2988
2989         PR gold/13245
2990         * plugin.cc (is_visible_from_outside): Check for symbols
2991         referenced from dynamic objects.
2992         * resolve.cc (Symbol_table::resolve): Don't count references
2993         from dynamic objects as references from real ELF files.
2994         * testsuite/plugin_test_2.sh: Adjust expected result.
2995
2996 2011-10-17  Cary Coutant  <ccoutant@google.com>
2997
2998         * gold.cc: Include timer.h.
2999         (queue_middle_tasks): Stamp time.
3000         (queue_final_tasks): Likewise.
3001         * main.cc (main): Store timer in parameters.  Print timers
3002         for each pass.
3003         * parameters.cc (Parameters::Parameters): Initialize timer_.
3004         (Parameters::set_timer): New function.
3005         (set_parameters_timer): New function.
3006         * parameters.h (Parameters::set_timer): New function.
3007         (Parameters::timer): New function.
3008         (Parameters::timer_): New data member.
3009         (set_parameters_timer): New function.
3010         * timer.cc (Timer::stamp): New function.
3011         (Timer::get_pass_time): New function.
3012         * timer.h (Timer::stamp): New function.
3013         (Timer::get_pass_time): New function.
3014         (Timer::pass_times_): New data member.
3015
3016 2011-10-17  Cary Coutant  <ccoutant@google.com>
3017
3018         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3019         task for members of lib groups.
3020
3021 2011-10-17  Cary Coutant  <ccoutant@google.com>
3022
3023         PR gold/13288
3024         * fileread.cc (File_read::find_view): Add assert.
3025         (File_read::make_view): Move bounds check (replace with assert)...
3026         (File_read::find_or_make_view): ... to here.
3027
3028 2011-10-12  Cary Coutant  <ccoutant@google.com>
3029
3030         * output.cc (Output_file::open_base_file): Handle case where
3031         ::read returns less than requested size.
3032
3033 2011-10-10  Cary Coutant  <ccoutant@google.com>
3034
3035         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3036         Initialize defined_count_.
3037         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3038         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3039         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3040         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3041         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3042         * incremental.h (Sized_relobj_incr::defined_count_): New data
3043         member.
3044         (Sized_incr_dynobj::defined_count_): New data member.
3045         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3046         Return zeroes instead of internal error.
3047
3048 2011-10-10  Cary Coutant  <ccoutant@google.com>
3049
3050         PR gold/13249
3051         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3052         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3053         * output.h (class Output_reloc): Add use_plt_offset flag.
3054         (Output_reloc::type_): Adjust size of bit field.
3055         (Output_reloc::use_plt_offset_): New bit field.
3056         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3057         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3058         flag.  Adjust all callers.
3059         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3060         creating RELATIVE relocations.
3061
3062 2011-10-10  Nick Clifton  <nickc@redhat.com>
3063
3064         * po/es.po: Updated Spanish translation.
3065         * po/fi.po: Updated Finnish translation.
3066
3067 2011-10-03   Diego Novillo  <dnovillo@google.com>
3068
3069         * options.cc (parse_uint): Fix dereference of RETVAL.
3070
3071 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3072
3073         * layout.h (section_order_map_): New member.
3074         (get_section_order_map): New member function.
3075         * output.cc (Output_section::add_input_section): Check for patterns
3076         only when --section-ordering-file is specified.
3077         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3078         output_sections have been formed.
3079         * layout.cc (Layout_Layout): Initialize section_order_map_.
3080         * plugin.cc (update_section_order): Store order in order_map. Do not
3081         update the order.
3082         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3083         * testsuite/Makefile.in: Regenerate.
3084         * testsuite/plugin_section_order.c: New file.
3085         * testsuite/plugin_final_layout.cc: New file.
3086         * testsuite/plugin_final_layout.sh: New file.
3087
3088 2011-09-29  Cary Coutant  <ccoutant@google.com>
3089
3090         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3091         Check for NULL.
3092         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3093         symbols during incremental update.
3094         (Symbol_table::add_from_dynobj): Likewise.
3095
3096 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3097             Ian Lance Taylor  <iant@google.com>
3098
3099         * symtab.cc (Symbol_table::define_special_symbol): Always
3100         canonicalize version string.
3101
3102 2011-09-26  Cary Coutant  <ccoutant@google.com>
3103
3104         * gold.cc (queue_initial_tasks): Move option checks ...
3105         * options.cc (General_options::finalize): ... to here. Disable
3106         some options; make others fatal.
3107
3108 2011-09-26  Cary Coutant  <ccoutant@google.com>
3109
3110         gcc PR lto/47247
3111         * plugin.cc (get_symbols_v2): New function.
3112         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3113         (is_referenced_from_outside): New function.
3114         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3115         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3116         (get_symbols): Pass version parameter.
3117         (get_symbols_v2): New function.
3118         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3119         parameter.
3120         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3121         (onload): Add LDPT_GET_SYMBOLS_V2.
3122         (all_symbols_read_hook): Use get_symbols_v2; check for
3123         LDPR_PREVAILING_DEF_IRONLY_EXP.
3124         * testsuite/plugin_test_3.sh: Update expected results.
3125
3126 2011-09-23  Simon Baldwin  <simonb@google.com>
3127
3128         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3129         configuration options.
3130         * configure: Regenerate.
3131         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3132         * Makefile.in: Regenerate.
3133         * testsuite/Makefile.in: Regenerate.
3134
3135 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3136
3137         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3138
3139 2011-09-19  Cary Coutant  <ccoutant@google.com>
3140
3141         * incremental.cc (can_incremental_update): Fix typo in comment.
3142         * incremental.h (can_incremental_update): Likewise.
3143
3144 2011-09-18  Cary Coutant  <ccoutant@google.com>
3145
3146         * incremental.cc (can_incremental_update): New function.
3147         * incremental.h (can_incremental_update): New function.
3148         * layout.cc (Layout::init_fixed_output_section): Call it.
3149         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3150         * object.cc (Sized_relobj_file::do_layout): Call
3151         can_incremental_update.
3152
3153 2011-09-13  Cary Coutant  <ccoutant@google.com>
3154
3155         * configure.ac: Check for glibc support for gnu_indirect_function
3156         support with static linking, setting automake conditional
3157         IFUNC_STATIC.
3158         * Makefile.in: Regenerate.
3159         * configure: Regenerate.
3160
3161         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3162         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3163         for IFUNC_STATIC.
3164         * testsuite/Makefile.in: Regenerate.
3165
3166 2011-09-13  Cary Coutant  <ccoutant@google.com>
3167
3168         * incremental.cc (Sized_relobj_incr::do_layout): Call
3169         report_comdat_group for kept comdat sections.
3170         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3171         * testsuite/Makefile.in: Regenerate.
3172         * testsuite/incr_comdat_test_1.cc: New source file.
3173         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3174         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3175         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3176
3177 2011-09-13  Ian Lance Taylor  <iant@google.com>
3178
3179         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3180         variable external_symbols_offset.
3181
3182 2011-09-12  Ian Lance Taylor  <iant@google.com>
3183
3184         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3185         triggered if object has no symbols.
3186
3187 2011-09-09  David S. Miller  <davem@davemloft.net>
3188
3189         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3190         (Output_fill_debug_line::do_write): Likewise.
3191
3192 2011-08-29  Cary Coutant  <ccoutant@google.com>
3193
3194         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3195         casts to match formatting specs.
3196         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3197
3198 2011-08-26  Cary Coutant  <ccoutant@google.com>
3199
3200         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3201         remaining hole size when allocating.
3202         (Layout::make_output_section): Set fill methods for debug sections.
3203         * layout.h (Free_list::Free_list_node): Move from private to
3204         public.
3205         (Free_list::set_min_hole_size): New function.
3206         (Free_list::begin, Free_list::end): New functions.
3207         (Free_list::min_hole_): New data member.
3208         * output.cc: Include dwarf.h.
3209         (Output_fill_debug_info::do_minimum_hole_size): New function.
3210         (Output_fill_debug_info::do_write): New function.
3211         (Output_fill_debug_line::do_minimum_hole_size): New function.
3212         (Output_fill_debug_line::do_write): New function.
3213         (Output_section::Output_section): Initialize new data member.
3214         (Output_section::set_final_data_size): Ensure patch space is larger
3215         than minimum hole size.
3216         (Output_section::do_write): Fill holes in debug sections.
3217         * output.h (Output_fill): New class.
3218         (Output_fill_debug_info): New class.
3219         (Output_fill_debug_line): New class.
3220         (Output_section::set_free_space_fill): New function.
3221         (Output_section::free_space_fill_): New data member.
3222         * testsuite/Makefile.am (incremental_test_3): Add
3223         --incremental-patch option.
3224         (incremental_test_4): Likewise.
3225         (incremental_test_5): Likewise.
3226         (incremental_test_6): Likewise.
3227         (incremental_copy_test): Likewise.
3228         (incremental_common_test_1): Likewise.
3229         * testsuite/Makefile.in: Regenerate.
3230
3231 2011-08-26  Nick Clifton  <nickc@redhat.com>
3232
3233         * po/es.po: Updated Spanish translation.
3234
3235 2011-08-01  Cary Coutant  <ccoutant@google.com>
3236
3237         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3238         * gold/testsuite/Makefile.in: Regenerate.
3239         * gold/testsuite/justsyms_exec.c: New source file.
3240         * gold/testsuite/justsyms_lib.c: New source file.
3241
3242 2011-08-01  Cary Coutant  <ccoutant@google.com>
3243
3244         * layout.cc (Layout::set_segment_offsets): Don't realign text
3245         segment if -Ttext was specified.
3246         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3247         file type.
3248         * object.h (Sized_relobj_file::e_type): New function.
3249         (Sized_relobj_file::e_type_): New data member.
3250         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3251         base address for ET_EXEC files.
3252         * target.cc (Target::do_make_elf_object_implementation): Allow
3253         ET_EXEC files with --just-symbols option.
3254
3255 2011-07-28  Cary Coutant  <ccoutant@google.com>
3256
3257         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3258         Add thread_number parameter.
3259         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3260         * workqueue-threads.cc
3261         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3262         current thread if its thread number is greater than desired thread
3263         count.
3264         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3265         Add thread_number parameter.
3266         (Workqueue::should_cancel_thread): Likewise.
3267         (Workqueue::find_runnable_or_wait): Pass thread_number to
3268         should_cancel_thread.
3269         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3270         parameter.
3271
3272 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3273
3274         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3275         only after checking if it cannot be forced local.
3276         * symtab.h (is_externally_visible): Check if the symbol is not forced
3277         local.
3278
3279 2011-07-15  Ian Lance Taylor  <iant@google.com>
3280
3281         * options.h (class General_options): Add --print-output-format.
3282         Move -EL next to -EB, for  better --help output.
3283         * target-select.cc: Include <cstdio>, "options.h", and
3284         "parameters.h".
3285         (Target_selector::do_target_bfd_name): New function.
3286         (print_output_format): New function.
3287         * target-select.h (class Target_selector): Update declarations.
3288         (Target_selector::target_bfd_name): New function.
3289         (print_output_format): Declare.
3290         * main.cc: Include "target-select.h".
3291         (main): Handle --print-output-format.
3292         * gold.cc: Include "target-select.h".
3293         (queue_initial_tasks): Handle --print-output-format when there are
3294         no input files.
3295         * parameters.cc (parameters_force_valid_target): Give a better
3296         error message if -EB/-EL does not match target.
3297         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3298         function.
3299
3300 2011-07-15  Ian Lance Taylor  <iant@google.com>
3301
3302         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3303         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3304         (Output_data_plt_i386::do_write): Write address of .dynamic
3305         section to first entry in .got.plt section.
3306         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3307         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3308         Initialize layout_.
3309         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3310         section to first entry in .got.plt section.
3311         * layout.h (Layout::dynamic_section): New function.
3312
3313 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3314
3315         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3316         to claim_file call.
3317         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3318         input_section_position_, and input_section_glob_.
3319         (read_layout_from_file): Call function section_ordering_specified.
3320         * layout.h (is_section_ordering_specified): New function.
3321         (section_ordering_specified): New function.
3322         (section_ordering_specified_): New boolean member.
3323         * main.cc(main): Call load_plugins after layout object is defined.
3324         * output.cc (Output_section::add_input_section): Use
3325         function section_ordering_specified to check if section ordering is
3326         needed.
3327         * output.cc (Output_section::add_relaxed_input_section): Use
3328         function section_ordering_specified to check if section ordering is
3329         needed.
3330         (Output_section::update_section_layout): New function.
3331         (Output_section::sort_attached_input_sections): Check if input section
3332         must be reordered.
3333         * output.h (Output_section::update_section_layout): New function.
3334         * plugin.cc (get_section_count): New function.
3335         (get_section_type): New function.
3336         (get_section_name): New function.
3337         (get_section_contents): New function.
3338         (update_section_order): New function.
3339         (allow_section_ordering): New function.
3340         (Plugin::load): Add the new interfaces to the transfer vector.
3341         (Plugin_manager::load_plugins): New parameter.
3342         (Plugin_manager::all_symbols_read): New parameter.
3343         (Plugin_manager::claim_file): New parameter. Save the elf object for
3344         unclaimed objects.
3345         (Plugin_manager::get_elf_object): New function.
3346         (Plugin_manager::get_view): Change to directly use the bool to check
3347         if get_view is called from claim_file_hook.
3348         * plugin.h (input_objects): New function
3349         (Plugin__manager::load_plugins): New parameter.
3350         (Plugin_manager::claim_file): New parameter.
3351         (Plugin_manager::get_elf_object): New function.
3352         (Plugin_manager::in_claim_file_handler): New function.
3353         (Plugin_manager::in_claim_file_handler_): New member.
3354         (layout): New function.
3355         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3356         handler with an extra parameter. Make the elf object before calling
3357         claim_file handler.
3358         * testsuite/plugin_test.c (get_section_count): New function pointer.
3359         (get_section_type): New function pointer.
3360         (get_section_name): New function pointer.
3361         (get_section_contents): New function pointer.
3362         (update_section_order): New function pointer.
3363         (allow_section_ordering): New function pointer.
3364         (onload): Check if the new interfaces exist.
3365
3366 2011-07-13  Ian Lance Taylor  <iant@google.com>
3367
3368         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3369         relro section.
3370         * x86_64.cc (Target_x86_64::got_section): Likewise.
3371         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3372         (relro_now_test_SOURCES): New variable.
3373         (relro_now_test_DEPENDENCIES): New variable.
3374         (relro_now_test_LDFLAGS): New variable.
3375         (relro_now_test_LDADD): New variable.
3376         (relro_now_test.so): New target.
3377         * testsuite/Makefile.in: Rebuild.
3378
3379 2011-07-12  Ian Lance Taylor  <iant@google.com>
3380
3381         PR gold/12980
3382         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3383         GLOB_DAT relocation rather than a RELATIVE relocation for a
3384         protected symbol when creating a shared library.
3385         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3386         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3387         * testsuite/protected_main_1.cc (main): Test that protected
3388         function has same address.
3389
3390 2011-07-11  Ian Lance Taylor  <iant@google.com>
3391
3392         PR gold/12979
3393         * options.h (class General_options): Add -Bgroup.
3394         * options.cc (General_options::finalize): If -Bgroup is set,
3395         default to --unresolved-symbols=report-all.
3396         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3397         * target-reloc.h (issue_undefined_symbol_error): Handle
3398         --unresolved-symbols=report-all.
3399
3400 2011-07-08  Ian Lance Taylor  <iant@google.com>
3401
3402         PR gold/11985
3403         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3404         if linker script discards key sections.
3405         (Layout::create_dynamic_symtab): Likewise.
3406         (Layout::assign_local_dynsym_offsets): Likewise.
3407         (Layout::sized_create_version_sections): Likewise.
3408         (Layout::create_interp): Likewise.
3409         (Layout::finish_dynamic_section): Likewise.
3410         (Layout::set_dynamic_symbol_size): Likewise.
3411
3412 2011-07-08  Ian Lance Taylor  <iant@google.com>
3413
3414         PR gold/12386
3415         * options.h (class General_options): Add --unresolved-symbols.
3416         * target-reloc.h (issue_undefined_symbol_error): Check
3417         --unresolved-symbols.  Add comments.
3418
3419 2011-07-08  Ian Lance Taylor  <iant@google.com>
3420
3421         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3422         expression more complex.
3423
3424 2011-07-08  Ian Lance Taylor  <iant@google.com>
3425
3426         PR gold/11317
3427         * target-reloc.h (issue_undefined_symbol_error): New inline
3428         function, broken out of relocate_section.
3429         (relocate_section): Call issue_undefined_symbol_error.
3430         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3431         there is no TLS segment if we are about to issue an undefined
3432         symbol error.
3433         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3434
3435 2011-07-08  Ian Lance Taylor  <iant@google.com>
3436
3437         PR gold/12279
3438         * resolve.cc (Symbol_table::should_override): Add fromtype
3439         parameter.  Change all callers.  Give error when linking together
3440         TLS and non-TLS symbol.
3441         (Symbol_table::should_override_with_special): Add fromtype
3442         parameter.  Change all callers.
3443         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3444         there is no TLS segment if we have reported some errors.
3445         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3446
3447 2011-07-08  Ian Lance Taylor  <iant@google.com>
3448
3449         PR gold/12372
3450         * target.h (Target::plt_address_for_global): New function.
3451         (Target::plt_address_for_local): New function.
3452         (Target::plt_section_for_global): Remove.
3453         (Target::plt_section_for_local): Remove.
3454         (Target::do_plt_address_for_global): New virtual function.
3455         (Target::do_plt_address_for_local): New virtual function.
3456         (Target::do_plt_section_for_global): Remove.
3457         (Target::do_plt_section_for_local): Remove.
3458         (Target::register_global_plt_entry): Add Symbol_table and Layout
3459         parameters.
3460         * output.cc (Output_data_got::Got_entry::write): Use
3461         plt_address_for_global and plt_address_for_local.
3462         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3463         address of output section.
3464         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3465         got_irelative_, and irelative_count_ fields.  Update
3466         declarations.
3467         (Output_data_plt_i386::has_irelative_section): New function.
3468         (Output_data_plt_i386::entry_count): Add irelative_count_.
3469         (Output_data_plt_i386::set_final_data_size): Likewise.
3470         (class Target_i386): Add got_irelative_ and rel_irelative_
3471         fields.  Update declarations.
3472         (Target_i386::Target_i386): Initialize new fields.
3473         (Target_i386::do_plt_address_for_global): New function replacing
3474         do_plt_section_for_global.
3475         (Target_i386::do_plt_address_for_local): New function replacing
3476         do_plt_section_for_local.
3477         (Target_i386::got_section): Create got_irelative_.
3478         (Target_i386::rel_irelative_section): New function.
3479         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3480         fields.  Don't define __rel_iplt_{start,end}.
3481         (Output_data_plt_i386::add_entry): Add symtab and layout
3482         parameters.  Change all callers.  Use different PLT and GOT for
3483         IFUNC symbols.
3484         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3485         layout parameters.  Change all callers.  Use different PLT and
3486         GOT.
3487         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3488         (Output_data_plt_i386::rel_irelative): New function.
3489         (Output_data_plt_i386::address_for_global): New function.
3490         (Output_data_plt_i386::address_for_local): New function.
3491         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3492         IRELATIVE GOT when changing IFUNC GOT entries.
3493         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3494         reloc.
3495         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3496         if we didn't create an IRELATIVE GOT.
3497         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3498         plt_address_for_local.
3499         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3500         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3501         got_irelative_, and irelative_count_ fields.  Update
3502         declarations.
3503         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3504         Initialize new fields.  Remove symtab parameter.  Change all
3505         callers.
3506         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3507         irelative_count_.
3508         (Output_data_plt_x86_64::has_irelative_section): New function.
3509         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3510         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3511         fields.  Update declarations.
3512         (Target_x86_64::Target_x86_64): Initialize new fields.
3513         (Target_x86_64::do_plt_address_for_global): New function replacing
3514         do_plt_section_for_global.
3515         (Target_x86_64::do_plt_address_for_local): New function replacing
3516         do_plt_section_for_local.
3517         (Target_x86_64::got_section): Create got_irelative_.
3518         (Target_x86_64::rela_irelative_section): New function.
3519         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3520         all callers.  Don't create __rel_iplt_{start,end}.
3521         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3522         parameters.  Change all callers.  Use different PLT and GOT for
3523         IFUNC symbols.
3524         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3525         layout parameters.  Change all callers.  Use different PLT and
3526         GOT.
3527         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3528         parameters.  Change all callers.  Use different PLT and GOT for
3529         IFUNC symbols.
3530         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3531         (Output_data_plt_x86_64::rela_irelative): New function.
3532         (Output_data_plt_x86_64::address_for_global): New function.
3533         (Output_data_plt_x86_64::address_for_local): New function.
3534         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3535         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3536         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3537         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3538         parameters.
3539         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3540         reloc.
3541         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3542         symbols if we didn't create an IRELATIVE GOT.
3543         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3544         plt_address_for_local.
3545         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3546         * testsuite/ifuncvar1.c: New test file.
3547         * testsuite/ifuncvar2.c: New test file.
3548         * testsuite/ifuncvar3.c: New test file.
3549         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3550         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3551         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3552         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3553         * testsuite/Makefile.in: Rebuild.
3554
3555 2011-07-07  Cary Coutant  <ccoutant@google.com>
3556
3557         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3558         (two_file_test_1_ndebug.o): Likewise.
3559         (two_file_test_1b_ndebug.o): Likewise.
3560         (two_file_test_2_ndebug.o): Likewise.
3561         (two_file_test_main_ndebug.o): Likewise.
3562         (incremental_test_2): Link with no-debug versions.
3563
3564 2011-07-06  Cary Coutant  <ccoutant@google.com>
3565
3566         * gold/incremental.cc
3567         (Output_section_incremental_inputs::write_info_blocks): Check for
3568         hidden and internal symbols.
3569
3570 2011-07-06  Cary Coutant  <ccoutant@google.com>
3571
3572         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3573         Check disposition for startup file.
3574         (Incremental_inputs::report_command_line): Ignore
3575         --incremental-startup-unchanged option.
3576         * options.cc (General_options::parse_incremental_startup_unchanged):
3577         New function.
3578         (General_options::General_options): Initialize new data member.
3579         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3580         (General_options): Add --incremental-startup-unchanged option.
3581         (General_options::incremental_startup_disposition): New function.
3582         (General_options::incremental_startup_disposition_): New data member.
3583
3584 2011-07-06  Cary Coutant  <ccoutant@google.com>
3585
3586         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3587         input file index to Script_info ctor.
3588         (Sized_incremental_binary::do_file_has_changed): Find the
3589         command-line argument for files named in scripts.
3590         * incremental.h (Script_info::Script_info): New ctor
3591         with input file index.
3592         (Script_info::input_file_index): New function.
3593         (Script_info::input_file_index_): New data member.
3594         (Incremental_binary::get_library): Add const.
3595         (Incremental_binary::get_script_info): Add const.
3596         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3597         * testsuite/Makefile.am (incremental_test_5): New test case.
3598         (incremental_test_6): New test case.
3599         * testsuite/Makefile.in: Regenerate.
3600
3601 2011-07-06  Cary Coutant  <ccoutant@google.com>
3602
3603         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3604         debug output when command lines differ.
3605
3606 2011-07-06  Cary Coutant  <ccoutant@google.com>
3607
3608         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3609         --incremental-patch option.
3610         * layout.cc (Free_list::allocate): Extend allocation beyond original
3611         end if enabled.
3612         (Layout::make_output_section): Mark sections that should get
3613         patch space.
3614         * options.cc (parse_percent): New function.
3615         * options.h (parse_percent): New function.
3616         (DEFINE_percent): New macro.
3617         (General_options): Add --incremental-patch option.
3618         * output.cc (Output_section::Output_section): Initialize new data
3619         members.
3620         (Output_section::add_input_section): Print section name when out
3621         of patch space.
3622         (Output_section::add_output_section_data): Likewise.
3623         (Output_section::set_final_data_size): Add patch space when
3624         doing --incremental-full.
3625         (Output_section::do_reset_address_and_file_offset): Remove patch
3626         space.
3627         (Output_segment::set_section_list_addresses): Print debug output
3628         only if --incremental-update.
3629         * output.h (Output_section::set_is_patch_space_allowed): New function.
3630         (Output_section::is_patch_space_allowed_): New data member.
3631         (Output_section::patch_space_): New data member.
3632         * parameters.cc (Parameters::incremental_full): New function.
3633         * parameters.h (Parameters::incremental_full): New function
3634         * testsuite/Makefile.am (incremental_test_2): Add test for
3635         --incremental-patch option.
3636         * testsuite/Makefile.in: Regenerate.
3637         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3638         (t18): Remove function body.
3639
3640 2011-07-05  Doug Kwan  <dougkwan@google.com>
3641
3642         PR gold/12771
3643         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3644         Arm_Address type for relocation result.
3645         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3646         overflow check.
3647         (Arm_relocate_functions::abs32): Use unaligned access.
3648         (Arm_relocate_functions::rel32): Ditto.
3649         (Arm_relocate_functions::prel31): Ditto.
3650         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3651         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3652         static data relocations.
3653         * testsuite/Makefile.in: Regnerate.
3654         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3655
3656 2011-07-05  Ian Lance Taylor  <iant@google.com>
3657
3658         PR gold/12392
3659         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3660         symbols if necessary.
3661         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3662
3663 2011-07-05  Ian Lance Taylor  <iant@google.com>
3664
3665         PR gold/12952
3666         * resolve.cc (Symbol::override_base_with_special): Simply override
3667         version with special symbol version, ignoring previous version.
3668
3669 2011-07-05  Ian Lance Taylor  <iant@google.com>
3670
3671         * object.cc (Sized_relobj_file::include_section_group): Add
3672         information to comment about signature location.
3673
3674 2011-07-02  Ian Lance Taylor  <iant@google.com>
3675
3676         PR gold/12957
3677         * options.h (class General_options): Add -f and -F.
3678         * options.cc (General_options::finalize): Fatal error if -f/-F
3679         are used without -shared.
3680         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3681
3682 2011-07-02  Ian Lance Taylor  <iant@google.com>
3683
3684         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3685
3686 2011-07-01  Ian Lance Taylor  <iant@google.com>
3687
3688         PR gold/12525
3689         PR gold/12952
3690         * resolve.cc (Symbol::override_base_with_special): Don't override
3691         the version if the overriding symbol has a different name.
3692         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3693         all callers.  If we give an error about an undefined version,
3694         define the base version if necessary.
3695         * dynobj.h (class Versions): Update declaration.
3696         * testsuite/weak_alias_test_5.cc: New file.
3697         * testsuite/weak_alias_test.script: New file.
3698         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3699         and versioned_alias have the right value, and call t2.
3700         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3701         weak_alias_test_5.so.
3702         (weak_alias_test_LDADD): Likewise.
3703         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3704         * testsuite/Makefile.in: Rebuild.
3705
3706 2011-07-01  Ian Lance Taylor  <iant@google.com>
3707
3708         PR gold/12525
3709         * options.h (class General_options): Support -z notext.
3710         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3711         -Wl,-z,notext.
3712         (two_file_shared_nonpic.so): Likewise.
3713         (two_file_shared_mixed.so): Likewise.
3714         (two_file_shared_mixed_1.so): Likewise.
3715         (weak_undef_lib_nonpic.so): Likewise.
3716         (alt/weak_undef_lib_nonpic.so): Likewise.
3717         (tls_test_shared_nonpic.so): Likewise.
3718         * testsuite/Makefile.in: Rebuild.
3719
3720 2011-07-01  Ian Lance Taylor  <iant@google.com>
3721
3722         PR gold/12525
3723         * configure.ac: Test whether static linking works, setting
3724         the automake conditional HAVE_STATIC.
3725         * testsuite/Makefile.am: Disable tests using -static if
3726         HAVE_STATIC is not true.
3727         * configure, testsuite/Makefile.in: Rebuild.
3728
3729 2011-07-01  Ian Lance Taylor  <iant@google.com>
3730
3731         PR gold/12525
3732         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3733         Assert if we see DW_EH_PE_indirect.
3734         * target.h (Target::ehframe_datarel_base): New function.
3735         (Target::do_ehframe_datarel_base): New target function.
3736         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3737         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3738         function.
3739
3740 2011-07-01  Ian Lance Taylor  <iant@google.com>
3741
3742         PR gold/12571
3743         * options.h (class General_options): Add
3744         --ld-generated-unwind-info.
3745         * ehframe.cc (Fde::write): Add address parameter.  Change all
3746         callers.  If associated with PLT, fill in address and size.
3747         (Cie::set_output_offset): Only add merge mapping if there is an
3748         object.
3749         (Cie::write): Add address parameter.  Change all callers.
3750         (Eh_frame::add_ehframe_for_plt): New function.
3751         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3752         input_offset_ fields into union u_, with new plt field.
3753         (Fde::Fde): Adjust for new union field.
3754         (Fde::Fde) [Output_data version]: New constructor.
3755         (Fde::add_mapping): Only add merge mapping if there is an object.
3756         (class Cie): Update declarations.
3757         (class Eh_frame): Declare add_ehframe_for_plt.
3758         * layout.cc (Layout::layout_eh_frame): Break out code into
3759         make_eh_frame_section, and call it.
3760         (Layout::make_eh_frame_section): New function.
3761         (Layout::add_eh_frame_for_plt): New function.
3762         * layout.h (class Layout): Update declarations.
3763         * merge.cc (Merge_map::add_mapping): Add assertion.
3764         * i386.cc: Include "dwarf.h".
3765         (class Output_data_plt_i386): Make first_plt_entry,
3766         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3767         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3768         and plt_eh_frame_fde.
3769         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3770         boundary.  Call add_eh_frame_for_plt if appropriate.
3771         * x86_64.cc: Include "dwarf.h".
3772         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3773         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3774         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3775         and plt_eh_frame_fde.
3776         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3777         appropriate.
3778
3779 2011-06-29  Ian Lance Taylor  <iant@google.com>
3780
3781         PR gold/12629
3782         * object.cc (Sized_relobj_file::layout_section): Change shdr
3783         parameter to be const.
3784         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3785         out of do_layout.
3786         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3787         appropriate.  Call layout_eh_frame_section.
3788         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3789         sections.
3790         * object.h (class Sized_relobj_file): Update declarations.
3791
3792 2011-06-29  Ian Lance Taylor  <iant@google.com>
3793
3794         PR gold/12652
3795         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3796         modifier.
3797         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3798
3799 2011-06-29  Ian Lance Taylor  <iant@google.com>
3800
3801         PR gold/12675
3802         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3803         SHT_X86_64_UNWIND.
3804         * layout.cc (Layout::layout_eh_frame): Likewise.
3805
3806 2011-06-29  Ian Lance Taylor  <iant@google.com>
3807
3808         PR gold/12695
3809         * layout.cc (Layout::symtab_section_shndx): New function.
3810         * layout.h (class Layout): Declare symtab_section_shndx.
3811         * output.cc (Output_section::write_header): Call it.
3812
3813 2011-06-29  Ian Lance Taylor  <iant@google.com>
3814
3815         PR gold/12818
3816         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3817         symbols which are not used in a relocation.
3818
3819 2011-06-28  Ian Lance Taylor  <iant@google.com>
3820
3821         PR gold/12898
3822         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3823         script create indistinguishable segments.
3824         (Layout::set_segment_offsets): Use stable_sort when sorting
3825         segments.  Pass this to Compare_segments constructor.
3826         * layout.h (class Layout): Make segment_precedes non-static.
3827         (class Compare_segments): Change from struct to class.  Add
3828         layout_ field.  Add constructor.
3829         * script-sections.cc
3830         (Script_sections::attach_sections_using_phdrs_clause): Rename
3831         local orphan to is_orphan.  Don't report failure to put empty
3832         section in segment.  On attachment failure, report name of
3833         section, and attach to first PT_LOAD segment.
3834
3835 2011-06-28  Ian Lance Taylor  <iant@google.com>
3836
3837         PR gold/12934
3838         * target-select.cc (Target_selector::Target_selector): Add
3839         emulation parameter.  Change all callers.
3840         (select_target_by_bfd_name): Rename from select_target_by_name.
3841         Change all callers.
3842         (select_target_by_emulation): New function.
3843         (supported_emulation_names): New function.
3844         * target-select.h (class Target_selector): Add emulation_ field.
3845         Update declarations.
3846         (Target_selector::recognize_by_bfd_name): Rename from
3847         recognize_by_name.  Change all callers.
3848         (Target_selector::supported_bfd_names): Rename from
3849         supported_names.  Change all callers.
3850         (Target_selector::recognize_by_emulation): New function.
3851         (Target_selector::supported_emulations): New function.
3852         (Target_selector::emulation): New function.
3853         (Target_selector::do_recognize_by_bfd_name): Rename from
3854         do_recognize_by_name.  Change all callers.
3855         (Target_selector::do_supported_bfd_names): Rename from
3856         do_supported_names.  Change all callers.
3857         (Target_selector::do_recognize_by_emulation): New function.
3858         (Target_selector::do_supported_emulations): New function.
3859         (select_target_by_bfd_name): Change name in declaration.
3860         (select_target_by_emulation): Declare.
3861         (supported_emulation_names): Declare.
3862         * parameters.cc (parameters_force_valid_target): Try to find
3863         target based on emulation from -m option.
3864         * options.h (class General_options): Change doc string for -m.
3865         * options.cc (help): Print emulations.
3866         (General_options::parse_V): Likewise.
3867         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3868         Add emulation parameter.  Change all callers.
3869
3870 2011-06-28  Ian Lance Taylor  <iant@google.com>
3871
3872         * target.h (class Target): Add osabi_ field.
3873         (Target::osabi): New function.
3874         (Target::set_osabi): New function.
3875         (Target::Target): Initialize osabi_.
3876         (Target::do_adjust_elf_header): Make pure virtual.
3877         (Sized_target::do_adjust_elf_header): Declare.
3878         * target.cc (Sized_target::do_adjust_elf_header): New function.
3879         (class Sized_target): Instantiate all versions.
3880         * freebsd.h (class Target_freebsd): Remove.
3881         (Target_selector_freebsd::do_recognize): Call set_osabi on
3882         Target.
3883         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3884         (Target_selector_freebsd::set_osabi): Remove.
3885         * i386.cc (class Target_i386): Inherit from Sized_target rather
3886         than Target_freebsd.
3887         * x86_64.cc (class Target_x86_64): Likewise.
3888
3889 2011-06-28  Ian Lance Taylor  <iant@google.com>
3890
3891         * target.h (Target::can_check_for_function_pointers): Rewrite.
3892         Make non-virtual.
3893         (Target::can_icf_inline_merge_sections): Likewise.
3894         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3895         (Target::Target_info): Add can_icf_inline_merge_sections field.
3896         (Target::do_can_check_for_function_pointers): New virtual
3897         function.
3898         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3899         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3900         from can_check_for_function_pointers, move in file.
3901         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3902         section_may_have_icf_unsafe_poineters, move in file.
3903         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3904         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3905         Rename from can_check_for_function_pointers, move in file.
3906         (Target_i386::can_icf_inline_merge_sections): Remove.
3907         (Target_i386::i386_info): Initialize
3908         can_icf_inline_merge_sections.
3909         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3910         Initialize can_icf_inline_merge_sections.
3911         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3912         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3913         Rename from can_check_for_function_pointers, move in file.
3914         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3915         (Target_x86_64::x86_64_info): Initialize
3916         can_icf_inline_merge_sections.
3917         * testsuite/testfile.cc (Target_test::test_target_info):
3918         Likewise.
3919         * icf.cc (get_section_contents): Correct formatting.
3920
3921 2011-06-27  Ian Lance Taylor  <iant@google.com>
3922
3923         * symtab.cc (Symbol::versioned_name): New function.
3924         (Symbol_table::add_to_final_symtab): Use versioned_name when
3925         appropriate.
3926         (Symbol_table::sized_write_symbol): Likewise.
3927         * symtab.h (class Symbol): Declare versioned_name.
3928         * stringpool.h (class Stringpool_template): Add variant of add
3929         which takes a std::basic_string.
3930         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3931         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3932         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3933         (ver_test_12.o): New target.
3934         * testsuite/Makefile.in: Rebuild.
3935
3936 2011-06-27  Doug Kwan  <dougkwan@google.com>
3937
3938         * arm.cc (Arm_relocate_functions::thm_jump8,
3939         Arm_relocate_functions::thm_jump11): Use a wider signed
3940         type to compute offset.
3941         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3942         arm_thm_jump8.
3943         * testsuite/Makefile.in: Regenerate.
3944         * testsuite/arm_branch_in_range.sh: Check test results of
3945         arm_thm_jump11 and arm_thm_jump8.
3946         * testsuite/arm_thm_jump11.s: New test source file.
3947         * testsuite/arm_thm_jump11.t: New linker script.
3948         * testsuite/arm_thm_jump8.s: New test source file.
3949         * testsuite/arm_thm_jump8.t: New linker script.
3950
3951 2011-06-24  Ian Lance Taylor  <iant@google.com>
3952
3953         * layout.cc: Include "object.h".
3954         (ctors_sections_in_init_array): New static variable.
3955         (Layout::is_ctors_in_init_array): New function.
3956         (Layout::layout): Add entry to ctors_sections_in_init_array if
3957         appropriate.
3958         * layout.h (class Layout): Declare is_ctors_in_init_array.
3959         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3960         is_ctors_reverse_view is set.
3961         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3962         all callers.  Set is_ctors_reverse_view field of View_size.
3963         (Sized_relobj_file::reverse_words): New function.
3964         * object.h (Sized_relobj_file::View_size): Add
3965         is_ctors_reverse_view field.
3966         (class Sized_relobj_file): Update declarations.
3967         * testsuite/initpri3.c: New test.
3968         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3969         initpri3b.
3970         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3971         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3972         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3973         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3974         * testsuite/Makefile.in: Rebuild.
3975
3976 2011-06-24  Cary Coutant  <ccoutant@google.com>
3977
3978         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3979         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3980         (debug_msg_cdebug.err): New targets.
3981         * testsuite/Makefile.in: Regenerate.
3982         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3983         Fix checks for link with shared library.
3984
3985 2011-06-24  Doug Kwan  <dougkwan@google.com>
3986
3987         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3988         skip empty text sections.
3989         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3990
3991 2011-06-22  Ian Lance Taylor  <iant@google.com>
3992
3993         PR gold/12910
3994         * options.h (class General_options): Add --ctors-in-init-array.
3995         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3996         friends as SHT_PROGBITS for merging sections.
3997         (Layout::layout): Remove special handling of .init_array and
3998         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3999         and .dtors if ctors_in_init_array.
4000         (Layout::make_output_section): Force correct section types for
4001         .init_array and friends.  Don't sort if doing relocatable link,
4002         Don't sort .ctors and .dtors if ctors_in_init_array.
4003         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4004         (Layout::output_section_name): Add relobj parameter.  Change all
4005         callers.  Handle .ctors. and .dtors. in code rather than table.
4006         Handle .ctors and .dtors if ctors_in_init_array.
4007         (Layout::match_file_name): New function, moved from output.cc.
4008         * layout.h (class Layout): Update declarations.
4009         * output.cc: Include "layout.h".
4010         (Input_section_sort_entry::get_priority): New function.
4011         (Input_section_sort_entry::match_file_name): Just call
4012         Layout::match_file_name.
4013         (Output_section::Input_section_sort_init_fini_compare::operator()):
4014         Handle .ctors and .dtors.  Sort by explicit priority rather than
4015         by name.
4016         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4017         * testsuite/initpri2.c: New test.
4018         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4019         (check_PROGRAMS): Add initpri2.
4020         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4021         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4022         * configure, testsuite/Makefile.in: Rebuild.
4023
4024 2011-06-19  Ian Lance Taylor  <iant@google.com>
4025
4026         PR gold/12880
4027         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4028         .interp section to a PT_INTERP segment even if we have seen a
4029         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4030         clause in a linker script.
4031         (Layout::finalize): Don't create a .interp section if we've
4032         already create a PT_INTERP segment.
4033         (Layout::create_interp): Always call choose_output_section (revert
4034         patch of 2011-06-17).  Don't create PT_INTERP segment.
4035         * script-sections.cc
4036         (Script_sections::create_note_and_tls_segments): Add a .interp
4037         section to a PT_INTERP segment even if we have seen a
4038         --dynamic-linker option.
4039
4040 2011-06-18  Ian Lance Taylor  <iant@google.com>
4041
4042         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4043         merely because a non-PT_LOAD segment has a dynamic reloc.
4044
4045 2011-06-18  Ian Lance Taylor  <iant@google.com>
4046
4047         * layout.cc (Layout::finish_dynamic_section): Don't create
4048         DT_FLAGS entry if not needed.
4049
4050 2011-06-18  Ian Lance Taylor  <iant@google.com>
4051
4052         PR gold/12745
4053         * layout.cc (Layout::layout_eh_frame): Correct handling of
4054         writable .eh_frame section.
4055
4056 2011-06-17  Ian Lance Taylor  <iant@google.com>
4057
4058         PR gold/12893
4059         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4060         symbol is redefined with the exact same object and value.
4061
4062 2011-06-17  Ian Lance Taylor  <iant@google.com>
4063
4064         PR gold/12880
4065         * layout.h (class Layout): Add interp_segment_ field.
4066         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4067         (Layout::attach_allocated_section_to_segment): If making shared
4068         library, put .interp section in PT_INTERP segment.
4069         (Layout::finalize): Also call create_interp if -dynamic-linker
4070         option was used.
4071         (Layout::create_interp): Assert that there is no PT_INTERP
4072         segment.  If not using a SECTIONS clause, use make_output_section.
4073         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4074         * script-sections.cc
4075         (Script_sections::create_note_and_tls_segments): If making shared
4076         library, put .interp section in PT_INTERP segment.
4077
4078 2011-06-17  Ian Lance Taylor  <iant@google.com>
4079
4080         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4081         when making a shared library.
4082
4083 2011-06-17  Ian Lance Taylor  <iant@google.com>
4084
4085         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4086         parameter.  Change all callers.  Don't issue warning about PC32
4087         against locally defined symbol.
4088
4089 2011-06-16  Ian Lance Taylor  <iant@google.com>
4090
4091         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4092         occurs in same object.
4093
4094 2011-06-14  Alan Modra  <amodra@gmail.com>
4095
4096         * po/POTFILES.in: Regenerate.
4097
4098 2011-06-09  Ian Lance Taylor  <iant@google.com>
4099
4100         * script-sections.cc
4101         (Orphan_output_section::set_section_addresses): For a relocatable
4102         link set address to 0.
4103
4104 2011-06-09  Cary Coutant  <ccoutant@google.com>
4105
4106         PR gold/12804
4107         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4108         used with --compress-debug-sections.
4109         * gold/object.cc (Sized_relobj_file::do_layout): Report
4110         uncompressed size of compressed input sections.
4111
4112 2011-06-08  Cary Coutant  <ccoutant@google.com>
4113
4114         PR gold/12804
4115         * testsuite/two_file_test_2_v1.cc: Change initialization of
4116         v2 to keep it in .data.
4117
4118 2011-06-07  Cary Coutant  <ccoutant@google.com>
4119
4120         * common.cc (Symbol_table::do_allocate_commons_list): Call
4121         gold_fallback.
4122         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4123         (Errors::fallback): New function.
4124         (gold_fallback): New function.
4125         * errors.h (Errors::fallback): New function.
4126         * gold.cc (gold_exit): Change status parameter to enum; adjust
4127         all callers.
4128         (queue_initial_tasks): Call gold_fallback.
4129         * gold.h: Include cstdlib.
4130         (Exit_status): New enum type.
4131         (gold_exit): Change status parameter to enum.
4132         (gold_fallback): New function.
4133         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4134         (Layout::create_symtab_sections): Likewise.
4135         (Layout::create_shdrs): Likewise.
4136         * main.cc (main): Adjust call to gold_exit.
4137         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4138         (Output_data_got::add_got_entry_pair): Likewise.
4139         (Output_section::add_input_section): Likewise.
4140         (Output_section::add_output_section_data): Likewise.
4141         (Output_segment::set_section_list_addresses): Likewise.
4142         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4143
4144 2011-06-07  Cary Coutant  <ccoutant@google.com>
4145
4146         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4147         for incremental links.
4148         * output.cc (Output_segment::set_section_list_addresses): Remove
4149         FIXME and test for TLS or BSS.
4150
4151 2011-06-07  Cary Coutant  <ccoutant@google.com>
4152
4153         * testsuite/Makefile.am: Add incremental_copy_test,
4154         incremental_common_test_1.
4155         * testsuite/Makefile.in: Regenerate.
4156         * testsuite/common_test_1_v1.c: New source file.
4157         * testsuite/common_test_1_v2.c: New source file.
4158         * testsuite/copy_test_v1.cc: New source file.
4159
4160 2011-06-07  Cary Coutant  <ccoutant@google.com>
4161
4162         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4163         update, allocate common from bss section's free list.
4164         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4165         linker-defined symbols.
4166         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4167         Skip GOT and PLT entries that are no longer referenced.
4168         (Output_section_incremental_inputs::write_info_blocks): Mark
4169         linker-defined symbols.
4170         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4171         * output.cc (Output_section::allocate): New function.
4172         * output.h (Output_section::allocate): New function.
4173         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4174         linker-defined symbols.
4175         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4176         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4177         (Symbol::init_base_output_data): Likewise.
4178         (Symbol::init_base_output_segment): Likewise.
4179         (Symbol::init_base_constant): Likewise.
4180         (Sized_symbol::init_output_data): Likewise.
4181         (Sized_symbol::init_output_segment): Likewise.
4182         (Sized_symbol::init_constant): Likewise.
4183         (Symbol_table::do_define_in_output_data): Likewise.
4184         (Symbol_table::do_define_in_output_segment): Likewise.
4185         (Symbol_table::do_define_as_constant): Likewise.
4186         * symtab.h (Symbol::is_predefined): New function.
4187         (Symbol::init_base_output_data): Add is_predefined parameter.
4188         (Symbol::init_base_output_segment): Likewise.
4189         (Symbol::init_base_constant): Likewise.
4190         (Symbol::is_predefined_): New data member.
4191         (Sized_symbol::init_output_data): Add is_predefined parameter.
4192         (Sized_symbol::init_output_segment): Likewise.
4193         (Sized_symbol::init_constant): Likewise.
4194         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4195
4196 2011-06-07  Cary Coutant  <ccoutant@google.com>
4197
4198         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4199         instead of emit_copy_reloc.
4200         (Copy_relocs::emit_copy_reloc): Refactor.
4201         (Copy_relocs::make_copy_reloc): New function.
4202         (Copy_relocs::add_copy_reloc): Remove.
4203         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4204         section.
4205         (Copy_relocs::make_copy_reloc): New function.
4206         (Copy_relocs::add_copy_reloc): Remove.
4207         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4208         unchanged input files.
4209         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4210         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4211         Reserve BSS space for COPY relocations.
4212         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4213         (Output_section_incremental_inputs::write_info_blocks): Record
4214         whether a symbol is copied from a shared object.
4215         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4216         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4217         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4218         (Incremental_input_entry_reader::get_output_symbol_index): Add
4219         is_copy parameter.
4220         (Incremental_binary::emit_copy_relocs): New function.
4221         (Incremental_binary::do_emit_copy_relocs): New function.
4222         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4223         new data member.
4224         (Sized_incremental_binary::add_copy_reloc): New function.
4225         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4226         (Sized_incremental_binary::Copy_reloc): New struct.
4227         (Sized_incremental_binary::Copy_relocs): New typedef.
4228         (Sized_incremental_binary::copy_relocs_): New data member.
4229         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4230         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4231         * target.h (Sized_target::emit_copy_reloc): New function.
4232         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4233
4234 2011-06-02  Cary Coutant  <ccoutant@google.com>
4235
4236         PR gold/12163
4237         * gold/archive.cc (Archive::Archive): Initialize new data member.
4238         (Archive::include_all_members): Return if archive has already been
4239         included.
4240         * gold/archive.h (Archive::include_all_members_): New data member.
4241
4242 2011-06-02  Nick Clifton  <nickc@redhat.com>
4243
4244         * dynobj.h: Fix spelling mistake in comment.
4245         * output.cc: Likewise.
4246
4247 2011-05-31  Doug Kwan  <dougkwan@google.com>
4248             Asier Llano
4249
4250         PR gold/12826
4251         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4252         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4253         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4254         redundant arm_exidx_test.so.
4255         * testsuite/Makefile.in: Regenerate.
4256         (check_SCRIPTS): Add pr12826.sh
4257         (check_DATA): Add pr12826.stdout
4258         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4259         * testsuite/pr12826.sh: New file.
4260         * testsuite/pr12826_1.s: Ditto.
4261         * testsuite/pr12826_1.s: Ditto.
4262
4263 2011-05-30  Ian Lance Taylor  <iant@google.com>
4264
4265         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4266         sections.
4267
4268 2011-05-29  Ian Lance Taylor  <iant@google.com>
4269
4270         PR gold/12804
4271         * testsuite/Makefile.am: Use different file name for two_file_test
4272         temporary file for each incremental test.
4273         * testsuite/Makefile.in: Rebuild.
4274
4275 2011-05-29  Ian Lance Taylor  <iant@google.com>
4276
4277         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4278         binary input file is empty.
4279
4280 2011-05-27  Ian Lance Taylor  <iant@google.com>
4281
4282         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4283         (ver_test_9.so): Likewise.
4284         * testsuite/Makefile.in: Rebuild.
4285
4286 2011-05-26 Cary Coutant  <ccoutant@google.com>
4287
4288         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4289         * incremental.cc (Incremental_inputs::report_input_section): Fix
4290         comment, indentation.
4291         (Incremental_inputs::report_comdat_group): New function.
4292         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4293         of data for incremental input file entry.
4294         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4295         group count, COMDAT group signatures.
4296         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4297         an unchanged input file.
4298         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4299         Initialize new data member.
4300         (Incremental_object_entry::add_comdat_group): New function.
4301         (Incremental_object_entry::get_comdat_group_count): New function.
4302         (Incremental_object_entry::get_comdat_signature_key): New function.
4303         (Incremental_object_entry::groups_): New data member.
4304         (Incremental_inputs::report_comdat_group): New function.
4305         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4306         data for incremental input file entry.
4307         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4308         (Incremental_input_entry_reader::get_input_section): Adjust size of
4309         data for incremental input file entry.
4310         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4311         (Incremental_input_entry_reader::get_comdat_group_signature): New
4312         function.
4313         * object.cc (Sized_relobj::include_section_group): Report kept
4314         COMDAT groups for incremental links.
4315
4316 2011-05-24  David Meyer  <pdox@google.com>
4317
4318         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4319         with name parameter.  Add found_name parameter.
4320         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4321         * dirsearch.h (class Dirsearch): Update declaration.
4322
4323 2011-05-24  Ian Lance Taylor  <iant@google.com>
4324
4325         * archive.cc (Library_base::should_include_member): Pull in object
4326         from archive if it defines the entry symbol.
4327         * parameters.cc (Parameters::entry): New function.
4328         * parameters.h (class Parameters): Declare entry.
4329         * output.h (class Output_file_header): Remove entry_ field.
4330         * output.cc (Output_file_header::Output_file_header): Remove entry
4331         parameter.  Change all callers.
4332         (Output_file_header::entry): Use parameters->entry.
4333         * gold.cc (queue_middle_tasks): Likewise.
4334         * plugin.cc (Plugin_hook::run): Likewise.
4335
4336 2011-05-24 Cary Coutant  <ccoutant@google.com>
4337
4338         * gold.cc (queue_initial_tasks): Pass incremental base filename
4339         to Output_file::open_base_file; don't print error message.
4340         * incremental-dump.cc (main): Adjust call to
4341         Output_file::open_for_modification.
4342         * incremental-dump.cc (main): Likewise.
4343         * incremental.cc (Incremental_inputs::report_command_line):
4344         Ignore --incremental-base option when comparing command lines.
4345         Ignore parameter when given as separate argument.
4346         * options.h (class General_options): Add --incremental-base.
4347         * output.cc (Output_file::Output_file):
4348         (Output_file::open_base_file): Add base_name and writable parameters;
4349         read base file into new file; print error message here.
4350         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4351         callers.
4352         * output.h (Output_file::open_for_modification): Rename to...
4353         (Output_file::open_base_file): ...this; add base_name and
4354         writable parameters; adjust all callers.
4355         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4356         callers.
4357         * testsuite/Makefile.am (incremental_test_4): Test
4358         --incremental-base.
4359         * testsuite/Makefile.in: Regenerate.
4360
4361 2011-05-24 Cary Coutant  <ccoutant@google.com>
4362
4363         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4364         incremental_test_4.
4365         * testsuite/Makefile.in: Regenerate.
4366         * testsuite/two_file_test_1_v1.cc: New test source file.
4367         * testsuite/two_file_test_1b_v1.cc: New test source file.
4368         * testsuite/two_file_test_2_v1.cc: New test source file.
4369
4370 2011-05-24 Cary Coutant  <ccoutant@google.com>
4371
4372         * dynobj.h (Dynobj::do_dynobj): New function.
4373         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4374         flag and soname for shared objects.
4375         * incremental.cc (Incremental_inputs::report_object): Make
4376         either Incremental_object_entry or Incremental_dynobj_entry; add
4377         soname to string table.
4378         (Incremental_inputs::report_input_section): Add assertion.
4379         (Output_section_incremental_inputs::set_final_data_size): Adjust
4380         type of input file entry for shared libraries; adjust size of
4381         shared library info entry.
4382         (Output_section_incremental_inputs::write_input_files): Write
4383         as_needed flag for shared libraries.
4384         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4385         of input file entry for shared libraries; write soname.
4386         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4387         soname from incremental info.
4388         * incremental.h (enum Incremental_input_flags): Add
4389         INCREMENTAL_INPUT_AS_NEEDED.
4390         (Incremental_input_entry::Incremental_input_entry): Initialize new
4391         data member.
4392         (Incremental_input_entry::set_as_needed): New function.
4393         (Incremental_input_entry::as_needed): New function.
4394         (Incremental_input_entry::do_dynobj_entry): New function.
4395         (Incremental_input_entry::as_needed_): New data member.
4396         (Incremental_object_entry::Incremental_object_entry): Don't check
4397         for shared library.
4398         (Incremental_object_entry::do_type): Likewise.
4399         (class Incremental_dynobj_entry): New class.
4400         (Incremental_input_entry_reader::as_needed): New function.
4401         (Incremental_input_entry_reader::get_soname): New function.
4402         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4403         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4404         size of shared library info entry.
4405         * layout.cc (Layout::finish_dynamic_section): Don't test for
4406         incremental link when adding DT_NEEDED entries.
4407         * object.h (Object::Object): Initialize new data member.
4408         (Object::dynobj): New function.
4409         (Object::set_as_needed): New function.
4410         (Object::as_needed): New function.
4411         (Object::do_dynobj): New function.
4412         (Object::as_needed_): New data member.
4413
4414 2011-05-24 Cary Coutant  <ccoutant@google.com>
4415
4416         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4417         info; adjust display of GOT entries.
4418         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4419         vector of input objects; remove file_status_.
4420         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4421         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4422         got_plt reader; call target hooks to reserve GOT entries.
4423         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4424         of input file info header and GOT info entry.
4425         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4426         relocation info.
4427         (Got_plt_view_info::got_descriptor): Remove.
4428         (Got_plt_view_info::sym_index): New data member.
4429         (Got_plt_view_info::input_index): New data member.
4430         (Local_got_offset_visitor::visit): Write input file index.
4431         (Global_got_offset_visitor::visit): Write 0 for input file index.
4432         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4433         with sym_index and input_index.
4434         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4435         incremental info GOT entry; replace got_descriptor with input_index.
4436         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4437         map from input file index to object.
4438         (Sized_relobj_incr::do_layout): Replace direct data member reference
4439         with accessor function.
4440         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4441         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4442         Adjust size of input file info header.
4443         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4444         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4445         (Incremental_input_entry_reader::get_input_section): Adjust size of
4446         input file info header.
4447         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4448         of incremental info GOT entry.
4449         (Incremental_got_plt_reader::get_got_desc): Remove.
4450         (Incremental_got_plt_reader::get_got_symndx): New function.
4451         (Incremental_got_plt_reader::get_got_input_index): New function.
4452         (Sized_incremental_binary::Sized_incremental_binary): Remove
4453         file_status_; add input_objects_.
4454         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4455         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4456         (Sized_incremental_binary::file_is_unchanged): Remove.
4457         (Sized_incremental_binary::set_input_object): New function.
4458         (Sized_incremental_binary::input_object): New function.
4459         (Sized_incremental_binary::file_status_): Remove.
4460         (Sized_incremental_binary::input_objects_): New data member.
4461         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4462         references.
4463         (Sized_relobj_incr::invalid_address): Move to base class.
4464         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4465         class.
4466         (Sized_relobj_incr::do_output_section_offset): Likewise.
4467         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4468         (Sized_relobj_incr::section_offsets_): Likewise.
4469         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4470         function.
4471         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4472         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4473         with accessor function.
4474         (Sized_relobj_file::do_layout): Likewise.
4475         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4476         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4477         (Sized_relobj_file::compute_final_local_value): Replace refs to
4478         section_offsets_ with accessor function.
4479         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4480         * object.h (Relobj::Relobj): Initialize new data members.
4481         (Relobj::add_dyn_reloc): New function.
4482         (Relobj::first_dyn_reloc): New function.
4483         (Relobj::dyn_reloc_count): New function.
4484         (Relobj::first_dyn_reloc_): New data member.
4485         (Relobj::dyn_reloc_count_): New data member.
4486         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4487         references.
4488         (Sized_relobj::Address): New typedef.
4489         (Sized_relobj::invalid_address): Move here from child class.
4490         (Sized_relobj::Sized_relobj): Initialize new data members.
4491         (Sized_relobj::sized_relobj): New function.
4492         (Sized_relobj::is_output_section_offset_invalid): Move here from
4493         child class.
4494         (Sized_relobj::get_output_section_offset): Likewise.
4495         (Sized_relobj::local_has_got_offset): Likewise.
4496         (Sized_relobj::local_got_offset): Likewise.
4497         (Sized_relobj::set_local_got_offset): Likewise.
4498         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4499         (Sized_relobj::clear_got_offsets): New function.
4500         (Sized_relobj::section_offsets): Move here from child class.
4501         (Sized_relobj::do_output_section_offset): Likewise.
4502         (Sized_relobj::do_set_section_offset): Likewise.
4503         (Sized_relobj::Local_got_offsets): Likewise.
4504         (Sized_relobj::local_got_offsets_): Likewise.
4505         (Sized_relobj::section_offsets_): Likewise.
4506         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4507         references.
4508         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4509         class.
4510         (Sized_relobj_file::sized_relobj): New function
4511         (Sized_relobj_file::local_has_got_offset): Move to base class.
4512         (Sized_relobj_file::local_got_offset): Likewise.
4513         (Sized_relobj_file::set_local_got_offset): Likewise.
4514         (Sized_relobj_file::get_output_section_offset): Likewise.
4515         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4516         (Sized_relobj_file::do_output_section_offset): Likewise.
4517         (Sized_relobj_file::do_set_section_offset): Likewise.
4518         (Sized_relobj_file::Local_got_offsets): Likewise.
4519         (Sized_relobj_file::local_got_offsets_): Likewise.
4520         (Sized_relobj_file::section_offsets_): Likewise.
4521         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4522         (all constructors).
4523         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4524         (Output_reloc::get_symbol_index): Likewise.
4525         (Output_reloc::local_section_offset): Likewise.
4526         (Output_reloc::get_address): Likewise.
4527         (Output_reloc::symbol_value): Likewise.
4528         (Output_data_got::reserve_slot): Move to class definition.
4529         (Output_data_got::reserve_local): New function.
4530         (Output_data_got::reserve_slot_for_global): Remove.
4531         (Output_data_got::reserve_global): New function.
4532         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4533         (all constructors, two instantiations).
4534         (Output_reloc::get_relobj): New function (two instantiations).
4535         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4536         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4537         (Output_data_reloc::add_global): Adjust type of relobj.
4538         (Output_data_reloc::add_global_relative): Likewise.
4539         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4540         (Output_data_reloc::add_local): Likewise.
4541         (Output_data_reloc::add_local_relative): Likewise.
4542         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4543         (Output_data_reloc::add_local_section): Likewise.
4544         (Output_data_reloc::add_output_section): Likewise.
4545         (Output_data_reloc::add_absolute): Likewise.
4546         (Output_data_reloc::add_target_specific): Likewise.
4547         (Output_data_got::reserve_slot): Move definition here.
4548         (Output_data_got::reserve_local): New function.
4549         (Output_data_got::reserve_global): New function.
4550         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4551         section_offsets_ with accessor function.
4552         (Sized_relobj_file::write_sections): Likewise.
4553         (Sized_relobj_file::do_relocate_sections): Likewise.
4554         * target.h (Sized_target::reserve_local_got_entry): New function.
4555         (Sized_target::reserve_global_got_entry): New function.
4556         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4557         (Target_x86_64::reserve_global_got_entry): New function.
4558         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4559
4560 2011-05-23 Cary Coutant  <ccoutant@google.com>
4561
4562         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4563         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4564         bit when checking got_type.
4565         * incremental.cc (Sized_incremental_binary::setup_readers):
4566         Store symbol table and string table locations; initialize bit vector
4567         of file status flags.
4568         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4569         unchanged files.
4570         (Sized_incremental_binary::do_process_got_plt): New function.
4571         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4572         (Output_section_incremental_inputs::set_final_data_size): Record
4573         file index for each input file.
4574         (Output_section_incremental_inputs::write_got_plt): Store file index
4575         instead of input entry offset for each GOT entry.
4576         * incremental.h
4577         (Incremental_input_entry::Incremental_input_entry): Initialize new
4578         data member.
4579         (Incremental_input_entry::set_offset): Store file index.
4580         (Incremental_input_entry::get_file_index): New function.
4581         (Incremental_input_entry::file_index_): New data member.
4582         (Incremental_binary::process_got_plt): New function.
4583         (Incremental_binary::do_process_got_plt): New function.
4584         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4585         data members.
4586         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4587         (Sized_incremental_binary::set_file_is_unchanged): New function.
4588         (Sized_incremental_binary::file_is_unchanged): New function.
4589         (Sized_incremental_binary::do_process_got_plt): New function.
4590         (Sized_incremental_binary::file_status_): New data member.
4591         (Sized_incremental_binary::main_symtab_loc_): New data member.
4592         (Sized_incremental_binary::main_strtab_loc_): New data member.
4593         * output.cc (Output_data_got::Got_entry::write): Add case
4594         RESERVED_CODE.
4595         (Output_data_got::add_global): Call add_got_entry.
4596         (Output_data_got::add_global_plt): Likewise.
4597         (Output_data_got::add_global_with_rel): Likewise.
4598         (Output_data_got::add_global_with_rela): Likewise.
4599         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4600         (Output_data_got::add_global_pair_with_rela): Likewise.
4601         (Output_data_got::add_local): Call add_got_entry.
4602         (Output_data_got::add_local_plt): Likewise.
4603         (Output_data_got::add_local_with_rel): Likewise.
4604         (Output_data_got::add_local_with_rela): Likewise.
4605         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4606         (Output_data_got::add_local_pair_with_rela): Likewise.
4607         (Output_data_got::reserve_slot): New function.
4608         (Output_data_got::reserve_slot_for_global): New function.
4609         (Output_data_got::add_got_entry): New function.
4610         (Output_data_got::add_got_entry_pair): New function.
4611         (Output_section::add_output_section_data): Edit FIXME.
4612         * output.h
4613         (Output_section_data_build::Output_section_data_build): New
4614         constructor with size parameter.
4615         (Output_data_space::Output_data_space): Likewise.
4616         (Output_data_got::Output_data_got): Initialize new data member; new
4617         constructor with size parameter.
4618         (Output_data_got::add_constant): Call add_got_entry.
4619         (Output_data_got::reserve_slot): New function.
4620         (Output_data_got::reserve_slot_for_global): New function.
4621         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4622         (Output_data_got::add_got_entry): New function.
4623         (Output_data_got::add_got_entry_pair): New function.
4624         (Output_data_got::free_list_): New data member.
4625         * target.h (Sized_target::init_got_plt_for_update): New function.
4626         (Sized_target::register_global_plt_entry): New function.
4627         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4628         Initialize new data member; call init; add constructor with PLT count.
4629         (Output_data_plt_x86_64::init): New function.
4630         (Output_data_plt_x86_64::add_relocation): New function.
4631         (Output_data_plt_x86_64::reserve_slot): New function.
4632         (Output_data_plt_x86_64::free_list_): New data member.
4633         (Target_x86_64::init_got_plt_for_update): New function.
4634         (Target_x86_64::register_global_plt_entry): New function.
4635         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4636         incremental updates.
4637         (Output_data_plt_x86_64::add_relocation): New function.
4638         * testsuite/object_unittest.cc (Object_test): Set default options.
4639
4640 2011-05-16  Ian Lance Taylor  <iant@google.com>
4641
4642         * options.h (class General_options): Make -i a synonym for -r.
4643
4644 2011-05-16  Ian Lance Taylor  <iant@google.com>
4645
4646         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4647
4648 2011-05-10 Cary Coutant  <ccoutant@google.com>
4649
4650         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4651         strip_all (-s).
4652
4653 2011-05-06  Ian Lance Taylor  <iant@google.com>
4654
4655         * layout.cc (Layout::layout): If the output section flags change,
4656         update the ordering.
4657
4658 2011-04-25 Cary Coutant  <ccoutant@google.com>
4659
4660         * incremental-dump.cc (dump_incremental_inputs): Print local
4661         symbol info for each input file.
4662         * incremental.cc
4663         (Output_section_incremental_inputs::set_final_data_size): Add local
4664         symbol info to input file entries in incremental info.
4665         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4666         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4667         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4668         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4669         implementation.
4670         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4671         (Sized_incr_relobj::do_relocate): Write the local symbols.
4672         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4673         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4674         Adjust size of input file header.
4675         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4676         (Incremental_inputs_reader::get_local_symbol_count): New function.
4677         (Incremental_inputs_reader::get_input_section): Adjust size of input
4678         file header.
4679         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4680         (Sized_incr_relobj::This): New typedef.
4681         (Sized_incr_relobj::sym_size): New const data member.
4682         (Sized_incr_relobj::Local_symbol): New struct.
4683         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4684         (Sized_incr_relobj::do_local_symbol_offset): New function.
4685         (Sized_incr_relobj::local_symbol_count_): New data member.
4686         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4687         (Sized_incr_relobj::local_symbol_index_): New data member.
4688         (Sized_incr_relobj::local_symbol_offset_): New data member.
4689         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4690         (Sized_incr_relobj::local_symbols_): New data member.
4691         * object.h (Relobj::output_local_symbol_count): New function.
4692         (Relobj::local_symbol_offset): New function.
4693         (Relobj::do_output_local_symbol_count): New function.
4694         (Relobj::do_local_symbol_offset): New function.
4695         (Sized_relobj::do_output_local_symbol_count): New function.
4696         (Sized_relobj::do_local_symbol_offset): New function.
4697
4698 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4699
4700         * descriptors.cc (set_close_on_exec): New function.
4701         (Descriptors::open): Use set_close_on_exec.
4702         * output.cc (S_ISLNK): Define if not defined.
4703
4704 2011-04-22 Cary Coutant  <ccoutant@google.com>
4705
4706         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4707         global symbol map.
4708         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4709         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4710         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4711         relocations.
4712         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4713         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4714         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4715         * incremental.h
4716         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4717         function.
4718         (Incremental_binary::apply_incremental_relocs): New function.
4719         (Incremental_binary::do_apply_incremental_relocs): New function.
4720         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4721         data member.
4722         (Sized_incremental_binary::add_global_symbol): New function.
4723         (Sized_incremental_binary::global_symbol): New function.
4724         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4725         (Sized_incremental_binary::symbol_map_): New data member.
4726         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4727         * target.h (Sized_target::apply_relocation): New function.
4728         * target-reloc.h (apply_relocation): New function.
4729         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4730
4731 2011-04-22  Doug Kwan  <dougkwan@google.com>
4732
4733         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4734         flag of a SHT_ARM_EXIDX section.
4735         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4736         * testsuite/Makefile.in: Regenerate.
4737         * testsuite/arm_exidx_test.s: New file.
4738         * testsuite/arm_exidx_test.sh: Same.
4739
4740 2011-04-20 Cary Coutant  <ccoutant@google.com>
4741
4742         PR gold/12689
4743         * archive.h (Incremental_archive_entry::Archive_member):
4744         Initialize arg_serial_ (second constructor).
4745
4746 2011-04-17  Ian Lance Taylor  <iant@google.com>
4747
4748         * object.cc (Relocate_info::location): Simplify location string.
4749         * errors.cc (Errors::error_at_location): Don't print program
4750         name.
4751         (Errors::warning_at_location): Likewise.
4752         (Errors::undefined_symbol): Likewise.
4753         * testsuite/debug_msg.sh: Update accordingly.
4754
4755 2011-04-14 Cary Coutant  <ccoutant@google.com>
4756
4757         * gold/layout.cc (Layout::symtab_section_offset): New function.
4758         * gold/layout.h (Layout::symtab_section_offset): New function.
4759         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4760
4761 2011-04-12  Ian Lance Taylor  <iant@google.com>
4762
4763         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4764         with MREMAP_MAYMOVE.
4765         * output.h (class Output_file): Add map_is_allocated_ field.
4766         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4767         not available, provide stubs.  If mremap is not available, #define
4768         it to gold_mremap.
4769         (MREMAP_MAYMOVE): Define if not defined.
4770         (Output_file::Output_file): Initialize map_is_allocated_.
4771         (Output_file::resize): Check map_is_allocated_.
4772         (Output_file::map_anonymous): If mmap fails, use malloc.
4773         (Output_file::unmap): Don't do anything for an anonymous map.
4774         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4775         is not available, provide stubs.
4776         (File_read::View::~View): Use free rather than delete[].
4777         (File_read::make_view): Use malloc rather than new[].  If mmap
4778         fails, use malloc.
4779         (File_read::find_or_make_view): Use malloc rather than new[].
4780         * gold.h: Remove HAVE_REMAP code.
4781         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4782         exists.  Rename mremap to gold_mremap.  If mmap is not available
4783         don't do anything.
4784         * configure, config.in: Rebuild.
4785
4786 2011-04-11  Ian Lance Taylor  <iant@google.com>
4787
4788         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4789         initialize local variable v.
4790
4791 2011-04-11  Cary Coutant  <ccoutant@google.com>
4792
4793         * archive.cc (Archive::include_member): Adjust call to
4794         report_object.
4795         (Add_archive_symbols::run): Track argument serial numbers.
4796         (Lib_group::include_member): Likewise.
4797         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4798         * archive.h (Incremental_archive_entry::Archive_member):
4799         Initialize arg_serial_.
4800         (Archive_member::arg_serial_): New data member.
4801         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4802         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4803         incremental link.
4804         (Sized_dynobj::do_for_all_local_got_entries): New function.
4805         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4806         function.
4807         * fileread.cc (get_mtime): New function.
4808         * fileread.h (get_mtime): New function.
4809         * gold.cc (queue_initial_tasks): Check for incremental update.
4810         (process_incremental_input): New function.
4811         (queue_middle_tasks): Don't force valid target for incremental
4812         update.
4813         * incremental-dump.cc (find_input_containing_global): Adjust
4814         size of symbol info entry.
4815         (dump_incremental_inputs): Dump argument serial number and
4816         in_system_directory flag; bias shndx by 1; print symbol names
4817         when dumping per-file symbol lists; use new symbol info readers.
4818         * incremental.cc
4819         (Output_section_incremental_inputs:update_data_size): New function.
4820         (Sized_incremental_binary::setup_readers): Setup input readers
4821         for each input file; build maps for files added from libraries
4822         and scripts.
4823         (Sized_incremental_binary::check_input_args): New function.
4824         (Sized_incremental_binary::do_check_inputs): Build map of argument
4825         serial numbers to input arguments.
4826         (Sized_incremental_binary::do_file_has_changed): Rename
4827         do_file_is_unchanged to this; compare file modification times.
4828         (Sized_incremental_binary::do_init_layout): New function.
4829         (Sized_incremental_binary::do_reserve_layout): New function.
4830         (Sized_incremental_binary::do_get_input_reader): Remove.
4831         (Sized_incremental_binary::get_symtab_view): New function.
4832         (Incremental_checker::can_incrementally_link_output_file): Remove.
4833         (Incremental_inputs::report_command_line): Exclude --debug options.
4834         (Incremental_inputs::report_archive_begin): Add parameter; track
4835         argument serial numbers; don't put input file entry for archive
4836         before archive members.
4837         (Incremental_inputs::report_archive_end): Put input file entry
4838         for archive after archive members.
4839         (Incremental_inputs::report_object): Add parameter; track argument
4840         serial numbers and in_system_directory flag.
4841         (Incremental_inputs::report_script): Add parameter; track argument
4842         serial numbers.
4843         (Output_section_incremental_inputs::set_final_data_size): Adjust
4844         size of symbol info entry; check for forwarding symbols.
4845         (Output_section_incremental_inputs::write_input_files): Write
4846         in_system_directory flag and argument serial number.
4847         (Output_section_incremental_inputs::write_info_blocks): Map section
4848         indices between incremental info and original input file; store
4849         input section index for each symbol.
4850         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4851         change operator() to visit().
4852         (class Global_got_offset_visitor): Likewise.
4853         (class Global_symbol_visitor_got_plt):
4854         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4855         classes.
4856         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4857         (Sized_incr_relobj::do_read_symbols): New function.
4858         (Sized_incr_relobj::do_layout): New function.
4859         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4860         (Sized_incr_relobj::do_add_symbols): New function.
4861         (Sized_incr_relobj::do_should_include_member): New function.
4862         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4863         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4864         (Sized_incr_relobj::do_section_size): New function.
4865         (Sized_incr_relobj::do_section_name): New function.
4866         (Sized_incr_relobj::do_section_contents): New function.
4867         (Sized_incr_relobj::do_section_flags): New function.
4868         (Sized_incr_relobj::do_section_entsize): New function.
4869         (Sized_incr_relobj::do_section_address): New function.
4870         (Sized_incr_relobj::do_section_type): New function.
4871         (Sized_incr_relobj::do_section_link): New function.
4872         (Sized_incr_relobj::do_section_info): New function.
4873         (Sized_incr_relobj::do_section_addralign): New function.
4874         (Sized_incr_relobj::do_initialize_xindex): New function.
4875         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4876         (Sized_incr_relobj::do_read_relocs): New function.
4877         (Sized_incr_relobj::do_gc_process_relocs): New function.
4878         (Sized_incr_relobj::do_scan_relocs): New function.
4879         (Sized_incr_relobj::do_count_local_symbols): New function.
4880         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4881         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4882         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4883         (Sized_incr_relobj::do_relocate): New function.
4884         (Sized_incr_relobj::do_set_section_offset): New function.
4885         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4886         (Sized_incr_dynobj::do_read_symbols): New function.
4887         (Sized_incr_dynobj::do_layout): New function.
4888         (Sized_incr_dynobj::do_add_symbols): New function.
4889         (Sized_incr_dynobj::do_should_include_member): New function.
4890         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4891         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4892         (Sized_incr_dynobj::do_section_size): New function.
4893         (Sized_incr_dynobj::do_section_name): New function.
4894         (Sized_incr_dynobj::do_section_contents): New function.
4895         (Sized_incr_dynobj::do_section_flags): New function.
4896         (Sized_incr_dynobj::do_section_entsize): New function.
4897         (Sized_incr_dynobj::do_section_address): New function.
4898         (Sized_incr_dynobj::do_section_type): New function.
4899         (Sized_incr_dynobj::do_section_link): New function.
4900         (Sized_incr_dynobj::do_section_info): New function.
4901         (Sized_incr_dynobj::do_section_addralign): New function.
4902         (Sized_incr_dynobj::do_initialize_xindex): New function.
4903         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4904         (make_sized_incremental_object): New function.
4905         (Incremental_library::copy_unused_symbols): New function.
4906         (Incremental_library::do_for_all_unused_symbols): New function.
4907         * incremental.h (enum Incremental_input_flags): New type.
4908         (class Incremental_checker): Remove.
4909         (Incremental_input_entry::Incremental_input_entry): Add argument
4910         serial number.
4911         (Incremental_input_entry::arg_serial): New function.
4912         (Incremental_input_entry::set_is_in_system_directory): New function.
4913         (Incremental_input_entry::is_in_system_directory): New function.
4914         (Incremental_input_entry::arg_serial_): New data member.
4915         (Incremental_input_entry::is_in_system_directory_): New data member.
4916         (class Script_info): Move here from script.h.
4917         (Script_info::Script_info): Add filename parameter.
4918         (Script_info::filename): New function.
4919         (Script_info::filename_): New data member.
4920         (Incremental_script_entry::Incremental_script_entry): Add argument
4921         serial number.
4922         (Incremental_object_entry::Incremental_object_entry): Likewise.
4923         (Incremental_object_entry::add_input_section): Build list of input
4924         sections with map to original shndx.
4925         (Incremental_object_entry::get_input_section_index): New function.
4926         (Incremental_object_entry::shndx_): New data member.
4927         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4928         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4929         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4930         serial number.
4931         (Incremental_inputs::report_archive_begin): Likewise.
4932         (Incremental_inputs::report_object): Likewise.
4933         (Incremental_inputs::report_script): Likewise.
4934         (class Incremental_global_symbol_reader): New class.
4935         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4936         and store flags and input file type.
4937         (Incremental_input_entry_reader::arg_serial): New function.
4938         (Incremental_input_entry_reader::type): Extract type from flags.
4939         (Incremental_input_entry_reader::is_in_system_directory): New function.
4940         (Incremental_input_entry_reader::get_input_section_count): Call
4941         accessor function for type.
4942         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4943         function for type; adjust size of global symbol entry.
4944         (Incremental_input_entry_reader::get_global_symbol_count): Call
4945         accessor function for type.
4946         (Incremental_input_entry_reader::get_object_count): Likewise.
4947         (Incremental_input_entry_reader::get_object_offset): Likewise.
4948         (Incremental_input_entry_reader::get_member_count): Likewise.
4949         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4950         (Incremental_input_entry_reader::get_member_offset): Likewise.
4951         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4952         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4953         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4954         (Incremental_input_entry_reader::get_global_symbol_reader): New
4955         function.
4956         (Incremental_input_entry_reader::get_output_symbol_index): New
4957         function.
4958         (Incremental_input_entry_reader::type_): Remove.
4959         (Incremental_input_entry_reader::flags_): New data member.
4960         (Incremental_inputs_reader::input_file_offset): New function.
4961         (Incremental_inputs_reader::input_file_index): New function.
4962         (Incremental_inputs_reader::input_file): Call input_file_offset.
4963         (Incremental_inputs_reader::input_file_at_offset): New function.
4964         (Incremental_relocs_reader::get_r_type): Reformat.
4965         (Incremental_relocs_reader::get_r_shndx): Reformat.
4966         (Incremental_relocs_reader::get_r_offset): Reformat.
4967         (Incremental_relocs_reader::data): New function.
4968         (Incremental_binary::Incremental_binary): Initialize new data members.
4969         (Incremental_binary::check_inputs): Add cmdline parameter.
4970         (Incremental_binary::file_is_unchanged): Remove.
4971         (Input_reader::arg_serial): New function.
4972         (Input_reader::get_unused_symbol_count): New function.
4973         (Input_reader::get_unused_symbol): New function.
4974         (Input_reader::do_arg_serial): New function.
4975         (Input_reader::do_get_unused_symbol_count): New function.
4976         (Input_reader::do_get_unused_symbol): New function.
4977         (Incremental_binary::input_file_count): New function.
4978         (Incremental_binary::get_input_reader): Change signature to use
4979         index instead of filename.
4980         (Incremental_binary::file_has_changed): New function.
4981         (Incremental_binary::get_input_argument): New function.
4982         (Incremental_binary::get_library): New function.
4983         (Incremental_binary::get_script_info): New function.
4984         (Incremental_binary::init_layout): New function.
4985         (Incremental_binary::reserve_layout): New function.
4986         (Incremental_binary::output_file): New function.
4987         (Incremental_binary::do_check_inputs): New function.
4988         (Incremental_binary::do_file_is_unchanged): Remove.
4989         (Incremental_binary::do_file_has_changed): New function.
4990         (Incremental_binary::do_init_layout): New function.
4991         (Incremental_binary::do_reserve_layout): New function.
4992         (Incremental_binary::do_input_file_count): New function.
4993         (Incremental_binary::do_get_input_reader): Change signature.
4994         (Incremental_binary::input_args_map_): New data member.
4995         (Incremental_binary::library_map_): New data member.
4996         (Incremental_binary::script_map_): New data member.
4997         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4998         new data members.
4999         (Sized_incremental_binary::output_section): New function.
5000         (Sized_incremental_binary::inputs_reader): Add const.
5001         (Sized_incremental_binary::symtab_reader): Add const.
5002         (Sized_incremental_binary::relocs_reader): Add const.
5003         (Sized_incremental_binary::got_plt_reader): Add const.
5004         (Sized_incremental_binary::get_symtab_view): New function.
5005         (Sized_incremental_binary::Inputs_reader): New typedef.
5006         (Sized_incremental_binary::Input_entry_reader): New typedef.
5007         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5008         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5009         (Sized_incremental_binary::do_file_has_changed): New function.
5010         (Sized_incremental_binary::do_init_layout): New function.
5011         (Sized_incremental_binary::do_reserve_layout): New function.
5012         (Sized_input_reader::Inputs_reader): Remove.
5013         (Sized_input_reader::Input_entry_reader): Remove.
5014         (Sized_input_reader::do_arg_serial): New function.
5015         (Sized_input_reader::do_get_unused_symbol_count): New function.
5016         (Sized_input_reader::do_get_unused_symbol): New function.
5017         (Sized_incremental_binary::do_input_file_count): New function.
5018         (Sized_incremental_binary::do_get_input_reader): Change signature;
5019         use index instead of filename.
5020         (Sized_incremental_binary::section_map_): New data member.
5021         (Sized_incremental_binary::input_entry_readers_): New data member.
5022         (class Sized_incr_relobj): New class.
5023         (class Sized_incr_dynobj): New class.
5024         (make_sized_incremental_object): New function.
5025         (class Incremental_library): New class.
5026         * layout.cc (Free_list::num_lists): New static data member.
5027         (Free_list::num_nodes): New static data member.
5028         (Free_list::num_removes): New static data member.
5029         (Free_list::num_remove_visits): New static data member.
5030         (Free_list::num_allocates): New static data member.
5031         (Free_list::num_allocate_visits): New static data member.
5032         (Free_list::init): New function.
5033         (Free_list::remove): New function.
5034         (Free_list::allocate): New function.
5035         (Free_list::dump): New function.
5036         (Free_list::print_stats): New function.
5037         (Layout_task_runner::run): Resize output file for incremental updates.
5038         (Layout::Layout): Initialize new data members.
5039         (Layout::set_incremental_base): New function.
5040         (Layout::init_fixed_output_section): New function.
5041         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5042         incremental updates.
5043         (Layout::create_gold_note): Do not create gold note section for
5044         incremental updates.
5045         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5046         for incremental updates.
5047         (Layout::set_section_offsets): For incremental updates, allocate space
5048         from free list.
5049         (Layout::create_symtab_sections): Layout with offsets relative to
5050         start of section; for incremental updates, allocate space from free
5051         list.
5052         (Layout::create_shdrs): For incremental updates, allocate space from
5053         free list.
5054         (Layout::finish_dynamic_section): For incremental updates, do not
5055         check --as-needed (fixed in subsequent patch).
5056         * layout.h (class Free_list): New class.
5057         (Layout::set_incremental_base): New function.
5058         (Layout::incremental_base): New function.
5059         (Layout::init_fixed_output_section): New function.
5060         (Layout::allocate): New function.
5061         (Layout::incremental_base_): New data member.
5062         (Layout::free_list_): New data member.
5063         * main.cc (main): Print Free_list statistics.
5064         * object.cc (Relobj::finalize_incremental_relocs): Add
5065         clear_counts parameter; clear counts only when clear_counts is set.
5066         (Sized_relobj::Sized_relobj): Initialize new base class.
5067         (Sized_relobj::do_layout): Don't report special sections.
5068         (Sized_relobj::do_for_all_local_got_entries): New function.
5069         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5070         symtab_off to all symbol table offsets.
5071         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5072         * object.h (class Got_offset_list): Move to top of file.
5073         (Object::Object): Allow case where input_file == NULL.
5074         (Object::~Object): Likewise.
5075         (Object::input_file): Assert that input_file != NULL.
5076         (Object::lock): Allow case where input_file == NULL.
5077         (Object::unlock): Likewise.
5078         (Object::is_locked): Likewise.
5079         (Object::token): Likewise.
5080         (Object::release): Likewise.
5081         (Object::is_incremental): New function.
5082         (Object::get_mtime): New function.
5083         (Object::for_all_local_got_entries): New function.
5084         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5085         (Object::set_is_in_system_directory): New function.
5086         (Object::is_in_system_directory): New function.
5087         (Object::do_is_incremental): New function.
5088         (Object::do_get_mtime): New function.
5089         (Object::do_for_all_local_got_entries): New function.
5090         (Object::is_in_system_directory_): New data member.
5091         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5092         (class Sized_relobj_base): New class.
5093         (class Sized_relobj): Derive from Sized_relobj_base.
5094         (class Sized_relobj::Symbols): Redeclare from base class.
5095         (class Sized_relobj::local_got_offset_list): Remove.
5096         (class Sized_relobj::Output_sections): Redeclare from base class.
5097         (class Sized_relobj::do_for_all_local_got_entries): New function.
5098         (class Sized_relobj::write_local_symbols): Add offset parameter.
5099         (class Sized_relobj::local_symbol_offset_): Update comment.
5100         (class Sized_relobj::local_dynsym_offset_): Update comment.
5101         * options.cc (Input_arguments::add_file): Remove const.
5102         * options.h (Input_file_argument::Input_file_argument):
5103         Initialize arg_serial_ (all constructors).
5104         (Input_file_argument::set_arg_serial): New function.
5105         (Input_file_argument::arg_serial): New function.
5106         (Input_file_argument::arg_serial_): New data member.
5107         (Input_arguments::Input_arguments): Initialize file_count_.
5108         (Input_arguments::add_file): Remove const.
5109         (Input_arguments::number_of_input_files): New function.
5110         (Input_arguments::file_count_): New data member.
5111         (Command_line::number_of_input_files): Call
5112         Input_arguments::number_of_input_files.
5113         * output.cc (Output_segment_headers::Output_segment_headers):
5114         Set current size.
5115         (Output_section::Input_section::current_data_size): New function.
5116         (Output_section::Output_section): Initialize new data members.
5117         (Output_section::add_input_section): Don't do merge sections for
5118         an incremental link; allocate space from free list for an
5119         incremental update.
5120         (Output_section::add_output_section_data): Allocate space from
5121         free list for an incremental update.
5122         (Output_section::update_data_size): New function.
5123         (Output_section::set_fixed_layout): New function.
5124         (Output_section::reserve): New function.
5125         (Output_segment::set_section_addresses): Remove const.
5126         (Output_segment::set_section_list_addresses): Remove const; allocate
5127         space from free list for an incremental update.
5128         (Output_segment::set_offset): Adjust size of RELRO segment for an
5129         incremental update.
5130         * output.h (Output_data::current_data_size): Move here from
5131         child classes.
5132         (Output_data::pre_finalize_data_size): New function.
5133         (Output_data::update_data_size): New function.
5134         (Output_section_headers::update_data_size): new function.
5135         (Output_section_data_build::current_data_size): Move to Output_data.
5136         (Output_data_strtab::update_data_size): New function.
5137         (Output_section::current_data_size): Move to Output_data.
5138         (Output_section::set_fixed_layout): New function.
5139         (Output_section::has_fixed_layout): New function.
5140         (Output_section::reserve): New function.
5141         (Output_section::update_data_size): New function.
5142         (Output_section::has_fixed_layout_): New data member.
5143         (Output_section::free_list_): New data member.
5144         (Output_segment::set_section_addresses): Remove const.
5145         (Output_segment::set_section_list_addresses): Remove const.
5146         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5147         New function.
5148         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5149         New function.
5150         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5151         parameter when calling Add_symbols constructor; store argument
5152         serial number for members of a lib group.
5153         (Add_symbols::locks): Allow case where token == NULL.
5154         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5155         (Read_member::~Read_member): New function.
5156         (Read_member::is_runnable): New function.
5157         (Read_member::locks): New function.
5158         (Read_member::run): New function.
5159         (Check_script::~Check_script): New function.
5160         (Check_script::is_runnable): New function.
5161         (Check_script::locks): New function.
5162         (Check_script::run): New function.
5163         (Check_library::~Check_library): New function.
5164         (Check_library::is_runnable): New function.
5165         (Check_library::locks): New function.
5166         (Check_library::run): New function.
5167         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5168         (Add_symbols::library_): New data member.
5169         (class Read_member): New class.
5170         (class Check_script): New class.
5171         (class Check_library): New class.
5172         * reloc.cc (Read_relocs::is_runnable): Allow case where
5173         token == NULL.
5174         (Read_relocs::locks): Likewise.
5175         (Scan_relocs::locks): Likewise.
5176         (Relocate_task::locks): Likewise.
5177         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5178         to clear counters.
5179         (Sized_relobj::incremental_relocs_scan): Fix comment.
5180         (Sized_relobj::do_relocate): Pass output file offset to
5181         write_local_symbols.
5182         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5183         from class declaration.
5184         * script.cc (read_input_script): Allocate Script_info; pass
5185         argument serial number to report_script.
5186         * script.h (class Script_info): Move to incremental.h.
5187         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5188         * symtab.h (Symbol_table::add_from_incrobj): New function.
5189         (Symbol_table::set_file_offset): New function.
5190
5191 2011-04-05  Cary Coutant  <ccoutant@google.com>
5192
5193         * incremental-dump.cc (dump_incremental_inputs): Change signature
5194         to take a Sized_incremental_binary; change caller.  Use readers
5195         in Sized_incremental_binary.
5196         * incremental.cc
5197         (Sized_incremental_binary::find_incremental_inputs_sections):
5198         Rename do_find_incremental_inputs_sections to this.
5199         (Sized_incremental_binary::setup_readers): New function.
5200         (Sized_incremental_binary::do_check_inputs): Check
5201         has_incremental_info_ flag; move setup code to setup_readers;
5202         use input readers.
5203         (Sized_incremental_binary::do_file_is_unchanged): New function.
5204         (Sized_incremental_binary::do_get_input_reader): New function.
5205         * incremental.h (class Incremental_binary): Move to end of file.
5206         (Incremental_binary::file_is_unchanged): New function.
5207         (Incremental_binary::do_file_is_unchanged): New function.
5208         (Incremental_binary::Input_reader): New class.
5209         (Incremental_binary::get_input_reader): New function.
5210         (class Sized_incremental_binary): Move to end of file.
5211         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5212         input section reader classes.
5213         (Sized_incremental_binary::has_incremental_info): New function.
5214         (Sized_incremental_binary::inputs_reader): New function.
5215         (Sized_incremental_binary::symtab_reader): New function.
5216         (Sized_incremental_binary::relocs_reader): New function.
5217         (Sized_incremental_binary::got_plt_reader): New function.
5218         (Sized_incremental_binary::do_file_is_unchanged): New function.
5219         (Sized_incremental_binary::Sized_input_reader): New class.
5220         (Sized_incremental_binary::get_input_reader): New function.
5221         (Sized_incremental_binary::find_incremental_inputs_sections):
5222         Rename do_find_incremental_inputs_sections to this.
5223         (Sized_incremental_binary::setup_readers): New function.
5224         (Sized_incremental_binary::has_incremental_info_): New data member.
5225         (Sized_incremental_binary::inputs_reader_): New data member.
5226         (Sized_incremental_binary::symtab_reader_): New data member.
5227         (Sized_incremental_binary::relocs_reader_): New data member.
5228         (Sized_incremental_binary::got_plt_reader_): New data member.
5229         (Sized_incremental_binary::current_input_file_): New data member.
5230
5231 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5232
5233         PR gold/12640
5234         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5235         violation.
5236
5237 2011-03-30  Cary Coutant  <ccoutant@google.com>
5238
5239         * archive.cc (Archive::include_member): Adjust call to report_object.
5240         (Add_archive_symbols::run): Add script_info to call to
5241         report_archive_begin.
5242         (Lib_group::include_member): Adjust call to report_object.
5243         (Add_lib_group_symbols::run): Adjust call to report_object.
5244         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5245         blocks.  Add object count for script input files.
5246         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5247         script_info parameter; change all callers.
5248         (Incremental_inputs::report_object): Add script_info parameter;
5249         change all callers.
5250         (Incremental_inputs::report_script): Store backpointer to
5251         incremental info entry.
5252         (Output_section_incremental_inputs::set_final_data_size): Record
5253         additional information for scripts.
5254         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5255         * incremental.h (Incremental_script_entry::add_object): New function.
5256         (Incremental_script_entry::get_object_count): New function.
5257         (Incremental_script_entry::get_object): New function.
5258         (Incremental_script_entry::objects_): New data member; adjust
5259         constructor.
5260         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5261         (Incremental_inputs::report_object): Add script_info parameter.
5262         (Incremental_inputs_reader::get_object_count): New function.
5263         (Incremental_inputs_reader::get_object_offset): New function.
5264         * options.cc (Input_arguments::add_file): Return reference to
5265         new input argument.
5266         * options.h (Input_argument::set_script_info): New function.
5267         (Input_argument::script_info): New function.
5268         (Input_argument::script_info_): New data member; adjust all
5269         constructors.
5270         (Input_file_group::add_file): Return reference to new input argument.
5271         (Input_file_lib::add_file): Likewise.
5272         (Input_arguments::add_file): Likewise.
5273         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5274         * script.cc (Parser_closure::Parser_closure): Add script_info
5275         parameter; adjust all callers.
5276         (Parser_closure::script_info): New function.
5277         (Parser_closure::script_info_): New data member.
5278         (read_input_script): Report scripts earlier to incremental info.
5279         (script_add_file): Set script_info in Input_argument.
5280         (script_add_library): Likewise.
5281         * script.h (Script_options::Script_info): Rewrite class.
5282
5283 2011-03-29  Cary Coutant  <ccoutant@google.com>
5284
5285         * archive.cc (Library_base::should_include_member): Move
5286         method here from class Archive.
5287         (Archive::Archive): Initialize base class.
5288         (Archive::should_include_member): Move to base class.
5289         (Archive::do_for_all_unused_symbols): New function.
5290         (Add_archive_symbols::run): Remove redundant access to
5291         incremental_inputs.
5292         (Lib_group::Lib_group): Initialize base class.
5293         (Lib_group::do_filename): New function.
5294         (Lib_group::include_member): Pass pointer to Lib_group to
5295         report_object.
5296         (Lib_group::do_for_all_unused_symbols): New function.
5297         (Add_lib_group_symbols::run): Report archive information for
5298         incremental links.
5299         * archive.h (class Library_base): New base class.
5300         (class Archive): Derive from Library_base.
5301         (Archive::filename): Move to base class.
5302         (Archive::set_incremental_info): Likewise.
5303         (Archive::incremental_info): Likewise.
5304         (Archive::Should_include): Likewise.
5305         (Archive::should_include_member): Likewise.
5306         (Archive::Armap_entry): Remove.
5307         (Archive::Unused_symbol_iterator): Remove.
5308         (Archive::unused_symbols_begin): Remove.
5309         (Archive::unused_symbols_end): Remove.
5310         (Archive::do_filename): New function.
5311         (Archive::do_get_mtime): New function.
5312         (Archive::do_for_all_unused_symbols): New function.
5313         (Archive::task_): Move to base class.
5314         (Archive::incremental_info_): Likewise.
5315         (class Lib_group): Derive from Library_base.
5316         (Lib_group::do_filename): New function.
5317         (Lib_group::do_get_mtime): New function.
5318         (Lib_group::do_for_all_unused_symbols): New function.
5319         (Lib_group::task_): Move to base class.
5320         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5321         function.
5322         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5323         function.
5324         * incremental.cc (Incremental_inputs::report_archive_begin):
5325         Use Library_base; call library's get_mtime; add incremental inputs
5326         entry before members.
5327         (class Unused_symbol_visitor): New class.
5328         (Incremental_inputs::report_archive_end): Use Library_base; use
5329         visitor class to record unused symbols; don't add incremental inputs
5330         entry after members.
5331         (Incremental_inputs::report_object): Use Library_base.
5332         * incremental.h
5333         (Incremental_archive_entry::Incremental_archive_entry): Remove
5334         unused Archive parameter.
5335         (Incremental_inputs::report_archive_begin): Use Library_base.
5336         (Incremental_inputs::report_archive_end): Likewise.
5337         (Incremental_inputs::report_object): Likewise.
5338         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5339         function.
5340         * object.h (Object::for_all_global_symbols): New function.
5341         (Object::do_for_all_global_symbols): New function.
5342         (Sized_relobj::do_for_all_global_symbols): New function.
5343         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5344         function.
5345         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5346         function.
5347
5348 2011-03-27  Ian Lance Taylor  <iant@google.com>
5349
5350         * archive.cc (Archive::interpret_header): Return -1 if something
5351         goes wrong.  Change callers accordingly.
5352
5353 2011-03-25  Cary Coutant  <ccoutant@google.com>
5354
5355         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5356         * testsuite/Makefile.in: Regenerate.
5357
5358 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5359
5360         * plugin.cc (get_view): New.
5361         (Plugin::load): Pass get_view to the plugin.
5362         (Plugin_manager::get_view): New.
5363
5364 2011-03-21  Ian Lance Taylor  <iant@google.com>
5365
5366         * testsuite/final_layout.sh: Rewrite to not use dc.
5367         * testsuite/relro_test.sh: Fail if dc is not present.
5368
5369 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5370
5371         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5372         Change == to -eq.
5373         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5374         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5375         Change == to -eq.
5376         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5377         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5378
5379 2011-03-14  Ian Lance Taylor  <iant@google.com>
5380
5381         * script-sections.cc (Sort_output_sections::script_compare):
5382         Rename from is_before, change return type.
5383         (Sort_output_sections::operator()): Adjust accordingly.
5384
5385 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5386
5387         PR gold/12572
5388         * testsuite/odr_violation2.cc: Add comment to make all error line
5389         numbers double digits.
5390         * testsuite/debug_msg.sh: Adjust expected errors.
5391
5392 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5393
5394         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5395         but mark earlier ones as non-canonical
5396         (offset_to_iterator): Update search target and example
5397         (do_addr2line): Return extra lines in a vector*
5398         (format_file_lineno): Extract from do_addr2line
5399         (one_addr2line): Add vector* out-param
5400         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5401         when a lineno entry appeared last for its instruction
5402         (Dwarf_line_info): Add vector* out-param
5403         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5404         * symtab.cc (Odr_violation_compare): Include the lineno in the
5405         comparison again.
5406         (linenos_from_loc): New. Combine the canonical line for an
5407         address with its other lines.
5408         (True_if_intersect): New. Helper functor to make
5409         std::set_intersection a query.
5410         (detect_odr_violations): Compare sets of lines instead of just
5411         one line for each function. This became less deterministic, but
5412         has fewer false positives.
5413         * symtab.h: Declarations.
5414         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5415         mix an optimized and non-optimized object in the same binary
5416         (odr_violation2.so): Same.
5417         * testsuite/Makefile.in: Regenerate from Makefile.am.
5418         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5419         * testsuite/debug_msg.sh: Update line numbers and add
5420         assertions.
5421         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5422         non-optimized context.
5423         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5424         isn't inlined, and use OdrDerived in an optimized context.
5425         * testsuite/odr_header1.h: Defines OdrDerived, where
5426         optimization will change the
5427         first-instruction-in-the-destructor's file and line number.
5428         * testsuite/odr_header2.h: Defines OdrBase.
5429
5430 2011-03-09  Ian Lance Taylor  <iant@google.com>
5431
5432         * fileread.cc (File_read::clear_views): Don't delete the whole
5433         file view.
5434
5435 2011-03-08  Ian Lance Taylor  <iant@google.com>
5436
5437         PR gold/12525
5438         * fileread.cc: #include <climits>.
5439         (GOLD_IOV_MAX): Define.
5440         (File_read::read_multiple): Limit number of entries by iov_max.
5441         * fileread.h (class File_read): Always set max_readv_entries to
5442         128.
5443
5444 2011-03-07  Ian Lance Taylor  <iant@google.com>
5445
5446         PR gold/12525
5447         * options.h (class General_options): Add -dy and -dn.
5448
5449 2011-03-02  Cary Coutant  <ccoutant@google.com>
5450
5451         * testsuite/script_test_9.t: Add TLS segment.
5452
5453 2011-03-02  Simon Baldwin  <simonb@google.com>
5454
5455         * configure.ac: Add check for gnu_indirect_function support in
5456         the toolchain building binutils.
5457         * configure: Rebuild.
5458
5459 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5460
5461         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5462         plugin only symbols.
5463         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5464         in plugin files as not needed in the symbol table.
5465
5466 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5467
5468         * output.cc (Output_section::add_input_section): Delay fill
5469         generation for section ordering.
5470
5471 2011-02-09  Ian Lance Taylor  <iant@google.com>
5472
5473         PR gold/12316
5474         * object.h (class Sized_relobj): Remove clear_local_symbols.
5475         * reloc.cc (Sized_relobj::do_relocate): Don't call
5476         clear_local_symbols.
5477
5478 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5479
5480         * plugin.cc (is_visible_from_outside): Return true for symbols
5481         in the -u option.
5482
5483 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5484
5485         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5486         filename.
5487
5488 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5489
5490         * icf.h (is_section_foldable_candidate): Change type of parameter
5491         to std::string.
5492         * icf.cc (Icf::find_identical_sections): Change type of local variable
5493         section_name to be std::string.
5494         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5495
5496 2011-01-25  Ian Lance Taylor  <iant@google.com>
5497
5498         * script.cc (script_add_extern): Rewrite to use
5499         add_symbol_reference.
5500
5501 2011-01-25  Doug Kwan  <dougkwan@google.com>
5502
5503         * icf.cc (get_section_contents): Always lock section's object.
5504
5505 2011-01-24  Ian Lance Taylor  <iant@google.com>
5506
5507         * options.h (class General_options): Accept
5508         --no-detect-odr-violations.
5509
5510 2011-01-24  Ian Lance Taylor  <iant@google.com>
5511
5512         * version.cc (version_string): Bump to 1.11.
5513
5514 2011-01-24  Ian Lance Taylor  <iant@google.com>
5515
5516         * plugin.cc (class Plugin_rescan): Define new class.
5517         (Plugin_manager::claim_file): Set any_claimed_.
5518         (Plugin_manager::save_archive): New function.
5519         (Plugin_manager::save_input_group): New function.
5520         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5521         necessary.
5522         (Plugin_manager::new_undefined_symbol): New function.
5523         (Plugin_manager::rescan): New function.
5524         (Plugin_manager::rescannable_defines): New function.
5525         (Plugin_manager::add_input_file): Set any_added_.
5526         * plugin.h (class Plugin_manager): define new fields rescannable_,
5527         undefined_symbols_, any_claimed_, and any_added_.  Declare
5528         Plugin_rescan as friend.  Declare new functions.
5529         (Plugin_manager::Rescannable): Define type.
5530         (Plugin_manager::Rescannable_list): Define type.
5531         (Plugin_manager::Undefined_symbol_list): Define type.
5532         (Plugin_manager::Plugin_manager): Initialize new fields.
5533         * archive.cc (Archive::defines_symbol): New function.
5534         (Add_archive_symbols::run): Pass archive to plugins if any.
5535         * archive.h (class Archive): Declare defines_symbol.
5536         * readsyms.cc (Input_group::~Input_group): New function.
5537         (Finish_group::run): Pass input_group to plugins if any.
5538         * readsyms.h (class Input_group): Declare destructor.
5539         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5540         any.
5541
5542 2011-01-10  Ian Lance Taylor  <iant@google.com>
5543
5544         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5545         section as relro.
5546         (Layout::set_segment_offsets): Reset increase_relro before calling
5547         set_section_addresses a second time.
5548
5549 2011-01-04  Cary Coutant  <ccoutant@google.com>
5550
5551         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5552         sections before NOBITS sections.
5553
5554 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5555
5556         * version.cc (print_version): Update copyright to 2011.
5557
5558 2010-12-23  Cary Coutant  <ccoutant@google.com>
5559
5560         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5561         of OS to this->add.  Add OD parameter to second form of the function.
5562
5563 2010-12-20  Ian Lance Taylor  <iant@google.com>
5564
5565         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5566         second of two consecutive entries with same offset.
5567
5568 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5569
5570         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5571         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5572         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5573         to avoid unneeded links against $(LDADD).
5574         * testsuite/Makefile.in: Regenerate.
5575
5576 2010-12-15  Ian Lance Taylor  <iant@google.com>
5577
5578         PR gold/12324
5579         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5580         for R_X86_64_32 and R_X86_64_PC32.
5581         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5582         ver_matching_def_pic.o.
5583         (ver_matching_def_pic.o): New target.
5584
5585 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5586
5587         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5588         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5589         Move definition before File_read::View member definitions.
5590         (File_read::View::~View): Initialize and hold lock before
5591         updating current_mapped_bytes.
5592
5593 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5594
5595         * dwarf_reader.cc: Remove outdated comment.
5596         * gold-threads.cc: Fix typo in error message.
5597         * archive.cc: Fix typos in comments.
5598         * archive.h: Likewise.
5599         * arm-reloc-property.cc: Likewise.
5600         * arm-reloc-property.h: Likewise.
5601         * arm-reloc.def: Likewise.
5602         * arm.cc: Likewise.
5603         * attributes.h: Likewise.
5604         * cref.cc: Likewise.
5605         * ehframe.cc: Likewise.
5606         * fileread.h: Likewise.
5607         * gold.h: Likewise.
5608         * i386.cc: Likewise.
5609         * icf.cc: Likewise.
5610         * incremental.h: Likewise.
5611         * int_encoding.cc: Likewise.
5612         * layout.h: Likewise.
5613         * main.cc: Likewise.
5614         * merge.h: Likewise.
5615         * object.cc: Likewise.
5616         * object.h: Likewise.
5617         * options.cc: Likewise.
5618         * readsyms.cc: Likewise.
5619         * reduced_debug_output.cc: Likewise.
5620         * reloc.cc: Likewise.
5621         * script-sections.cc: Likewise.
5622         * sparc.cc: Likewise.
5623         * symtab.h: Likewise.
5624         * target-reloc.h: Likewise.
5625         * target.cc: Likewise.
5626         * target.h: Likewise.
5627         * timer.cc: Likewise.
5628         * timer.h: Likewise.
5629         * x86_64.cc: Likewise.
5630
5631 2010-12-09  Cary Coutant  <ccoutant@google.com>
5632
5633         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5634         stack.
5635         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5636         parameter; change all callers.
5637         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5638         * options.h (warn_execstack): New option.
5639
5640 2010-12-07  Doug Kwan  <dougkwan@google.com>
5641
5642         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5643         like function call relocations.
5644
5645 2010-12-07  Ian Lance Taylor  <iant@google.com>
5646
5647         * archive.cc (Archive::get_elf_object_for_member): Permit
5648         punconfigured to be NULL.
5649         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5650         (Archive::include_member): Pass NULL to get_elf_object_for_member
5651         if we searched for the archive and this is the first included
5652         object.
5653
5654 2010-12-01  Ian Lance Taylor  <iant@google.com>
5655
5656         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5657         track_relocs_type_ field.
5658         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5659         Set track_relocs_type_.
5660         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5661         contents when using RELA relocs.
5662         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5663         reloc_map_.
5664         * reloc.cc (Track_relocs::next_addend): New function.
5665         * reloc.h (class Track_relocs): Declare next_addend.
5666
5667 2010-12-01  Ian Lance Taylor  <iant@google.com>
5668
5669         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5670         virtual destructor.
5671
5672 2010-12-01  Ian Lance Taylor  <iant@google.com>
5673
5674         * README: Update compilers known to work and fail.
5675
5676 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5677
5678         * configure.in: For --enable-gold, handle value `default' instead of
5679         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5680         not the default.
5681         * configure: Regenerate.
5682
5683 2010-11-18  Doug Kwan  <dougkwan@google.com>
5684
5685         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5686         and right_alignment to be zero.  Store result alignment only if it is
5687         greater than existing alignment.
5688
5689 2010-11-16  Cary Coutant  <ccoutant@google.com>
5690
5691         PR gold/12220
5692         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5693         Check for ".zdebug_line".
5694
5695 2010-11-16  Doug Kwan  <dougkwan@google.com>
5696             Cary Coutant  <ccoutant@google.com>
5697
5698         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5699         by reference; adjust all callers.
5700         * output.cc (Output_segment::set_section_addresses): Adjust references
5701         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5702         list is empty.
5703         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5704         end at page boundary.
5705
5706 2010-11-16  Cary Coutant  <ccoutant@google.com>
5707
5708         PR gold/12220
5709         * layout.cc (Layout::choose_output_section): Transform names of
5710         compressed sections even when using a script with a SECTIONS clause.
5711         (Layout::output_section_name): Remove code to transform
5712         compressed debug section names.
5713         * output.cc (Output_section::add_input_section): Use uncompressed
5714         section size when tracking input sections.
5715
5716 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5717
5718         * symtab.h (Symbol::NON_PIC_REF): Remove.
5719         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5720         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5721         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5722         (Symbol::use_plt_offset): Take a flags argument and pass it
5723         directly to needs_dynamic_reloc.  Restrict check for undefined
5724         weak symbols to function calls.
5725         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5726         (Target_arm::Scan::global): Use it.
5727         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5728         (Target_arm::Relocate::relocate): Likewise.
5729         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5730         parameter with an r_type parameter.  Use get_reference_flags
5731         to get the flags.
5732         (Target_arm::Relocate::relocate): Update accordingly.
5733         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5734         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5735         (Target_i386::Scan::global): Likewise.
5736         (Target_i386::Relocate::relocate): Likewise.
5737         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5738         parameter with an r_type parameter.  Use get_reference_flags
5739         to get the flags.
5740         (Target_i386::Relocate::relocate): Update accordingly.
5741         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5742         (Target_powerpc::Scan::global): Use it.
5743         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5744         (Target_powerpc::Relocate::relocate): Likewise.
5745         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5746         (Target_sparc::Scan::global): Use it.
5747         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5748         (Target_sparc::Relocate::relocate): Likewise.
5749         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5750         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5751         (Target_x86_64::Scan::global): Likewise.
5752         (Target_x86_64::Relocate::relocate): Likewise.
5753
5754 2010-11-08  Doug Kwan  <dougkwan@google.com>
5755             Cary Coutant  <ccoutant@google.com>
5756
5757         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5758         (Arm_exidx_merge_section::section_contents_): New data member.
5759         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5760         (Arm_input_section::~Arm_input_section): De-allocate memory.
5761         (Arm_input_section::original_contents_): New data member.
5762         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5763         in parameters instead of calling Object::section_contents without
5764         locking.
5765         (Arm_output_section::group_section): New parameter TASK.  Pass it
5766         to callees that need locking objects.
5767         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5768         to lock EXIDX input sections.  Fix a formatting issue.  Call
5769         Arm_exidx_merged_section::build_contents to create merged section
5770         contents.
5771         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5772         to lock object of stub table owner.
5773         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5774         TEXT_SIZE to initialize data member TEXT_SIZE_.
5775         (Arm_exidx_input_section::addralign): Fix typo in comment.
5776         (Arm_exidx_input_section::text_size): New method.
5777         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5778         that require locking objects.  Lock objects before scanning for stubs
5779         and updating local symbols.
5780         (Arm_input_section<big_endian>::init): Copy contents of original
5781         input section.
5782         (Arm_input_section<big_endian>::do_write): Use saved contents of
5783         original input section instead of calling Object::section_contents
5784         without locking.
5785         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5786         size without calling Object::section_size().
5787         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5788         for size.  Allocate a buffer for merged EXIDX entries.
5789         (Arm_exidx_merged_section::build_contents): New method.
5790         (Arm_exidx_merged_section::do_write): Move merge section contents
5791         building code to Arm_exidx_merged_section::build_contetns.  Write
5792         out contetns in buffer instead of building it on the fly.
5793         (Arm_relobj::make_exidx_input_section): Also pass text section size
5794         to Arm_exidx_input_section constructor.
5795         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5796         (Arm_dynobj::do_read_symbols): Fix memory leak.
5797         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5798         * target.h: (class Task): Add forward declaration.
5799         (Target::relax): Add new parameter TASK and pass it to
5800         Target::do_relax().
5801         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5802
5803 2010-11-05  Cary Coutant  <ccoutant@google.com>
5804
5805         PR gold/10708
5806         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5807         object when reading from the file.
5808         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5809         second layout pass.
5810         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5811         when reading section contents.
5812         (get_section_contents): Likewise.
5813         (icf::find_identical_sections): Likewise.
5814         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5815         object when reading from the file.
5816         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5817         the object when doing deferred section layout.
5818
5819 2010-11-03  Nick Clifton  <nickc@redhat.com>
5820
5821         PR gold/12001
5822         * script.h (class Symbol_assignment: name): New member.  Returns
5823         the name of the symbol.
5824         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5825         Returns true if the given symbol name is on the list of
5826         assignments wating to be processed.
5827         * archive.cc (should_incldue_member): If the symbol is undefined,
5828         check to see if it is on the list of symbols pending assignment.
5829
5830 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5831
5832         * script-sections.cc (Script_sections::find_memory_region): Check
5833         for a NULL output section pointer.
5834
5835 2010-10-29  Doug Kwan  <dougkwan@google.com>
5836
5837         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5838         Output_section::add_relaxed_input_section.
5839         * output.cc (Output_section::add_relaxed_input_section): Add new
5840         arguments LAYOUT and NAME.  Set section order index.
5841         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5842         Copy section order index.
5843         * output.h (Output_section::add_relaxed_input_section): Add new
5844         arguments LAYOUT and NAME.
5845
5846 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5847
5848         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5849         NATIVE_OR_CROSS_LINKER.
5850         * testsuite/Makefile.in: Regenerate.
5851
5852 2010-10-20  Doug Kwan  <dougkwan@google.com>
5853
5854         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5855         without SHF_LINK_ORDER flags.
5856         * layout.cc (Layout::choose_output_section): Do not filter
5857         SHF_LINK_ORDER flag in a relocatable link.
5858
5859 2010-10-17  Cary Coutant  <ccoutant@google.com>
5860
5861         * output.h (Output_segment::set_section_addresses): Change function
5862         signature.  Update all callers.
5863         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5864         sections.
5865         (Output_segment::set_section_addresses): Align after last TLS
5866         section.  Add padding before last relro section instead of after.
5867
5868 2010-10-17  Doug Kwan  <dougkwan@google.com>
5869
5870         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5871         GOT output section to be writable.
5872
5873 2010-10-14  Cary Coutant  <ccoutant@google.com>
5874
5875         * debug.h (DEBUG_INCREMENTAL): New flag.
5876         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5877         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5878         mode.
5879         * incremental.cc (report_command_line): Ignore all forms of
5880         --incremental.
5881         * layout.cc (Layout::Layout): Check parameters for incremental link
5882         mode.
5883         * options.cc (General_options::parse_incremental): New function.
5884         (General_options::parse_no_incremental): New function.
5885         (General_options::parse_incremental_full): New function.
5886         (General_options::parse_incremental_update): New function.
5887         (General_options::incremental_mode_): New data member.
5888         (General_options::finalize): Check incremental_mode_.
5889         * options.h (General_options): Update help text for --incremental.
5890         Add --no-incremental, --incremental-full, --incremental-update.
5891         (General_options::Incremental_mode): New enum type.
5892         (General_options::incremental_mode): New function.
5893         (General_options::incremental_mode_): New data member.
5894         * parameters.cc (Parameters::incremental_mode_): New data member.
5895         (Parameters::set_options): Set incremental_mode_.
5896         (Parameters::set_incremental_full): New function.
5897         (Parameters::incremental): New function.
5898         (Parameters::incremental_update): New function.
5899         (set_parameters_incremental_full): New function.
5900         * parameters.h (Parameters::set_incremental_full): New function.
5901         (Parameters::incremental): New function.
5902         (Parameters::incremental_update): New function.
5903         (Parameters::incremental_mode_): New data member.
5904         (set_parameters_incremental_full): New function.
5905         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5906         incremental link mode.
5907         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5908         (Sized_relobj::do_relocate_sections): Likewise.
5909         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5910         option.
5911         * testsuite/Makefile.in: Regenerate.
5912         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5913
5914 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5915
5916         * script-sections.h (class Script_sections): Make
5917         Sections_elements typedef public.
5918         * script-sections.cc (class Sort_output_sections): Add elements_
5919         field.  Add constructor which sets it; change all callers.
5920         (Sort_output_sections::is_before): New function.
5921         (Sort_output_sections::operator()): Call is_before.
5922         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5923         conditional.
5924         * testsuite/script_test_10.sh: New test. Test script section
5925         order.
5926         * testsuite/script_test_10.t: Likewise.
5927         * testsuite/script_test_10.s: Likewise.
5928         * testsuite/Makefile.am: Wrap the cross linker tests and the
5929         common tests into NATIVE_OR_CROSS_LINKER.
5930         (check_SCRIPTS): Add script_test_10.sh.
5931         (check_DATA): Add script_test_10.stdout.
5932         (script_test_10.o, script_test_10): New targets.
5933         (script_test_10.stdout): New target.
5934         * configure, testsuite/Makefile.in: Regenerate.
5935
5936 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5937
5938         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5939         error for the deprecated relocations.
5940         (Target_arm::Scan::global): Likewise.
5941         (Target_arm::Relocate::relocate): Likewise.
5942
5943 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5944
5945         * fileread.cc (Input_file::find_file): Initialize *found_name
5946         and *namep when using the fallback search for case 4.
5947
5948 2010-10-11  Cary Coutant  <ccoutant@google.com>
5949
5950         * options.h (class General_options): Redefine -z lazy as an alias for
5951         the negation of -z now.
5952
5953 2010-10-11  Ian Lance Taylor  <iant@google.com>
5954
5955         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5956         binding.
5957
5958 2010-10-06  Nick Clifton  <nickc@redhat.com>
5959
5960         * script-sections.cc(class Memory_region): Remove
5961         current_lma_offset_ field.  Rename current_vma_offset_ to
5962         current_offset_.  Add last_section_ field.
5963         (Memory_region::get_current_vma_address): Rename to
5964         get_current_address.
5965         (Memory_region::get_current_lma_address): Delete.
5966         (Memory_region::increment_vma_offset): Rename to
5967         increment_offset.
5968         (Memory_region::increment_lma_offset): Delete.
5969         (Memory_region::attributes_compatible): New method.  Returns
5970         true if the provided section is compatible with the region.
5971         (Memory_region::get_last_section): New method.  Returns the last
5972         section to use the region.
5973         (Memory_region::set_last_section): New method.  Stores the last
5974         section to use the region.
5975         (Script_sections::block_in_region): New method.  Returns true if
5976         a block of memory is contained within a region.
5977         (Script_sections::find_memory_region): New method.  Locates a
5978         memory region to be used to set a VMA or LMA address.
5979         (Output_section_definition::set_section_addresses): Add code to
5980         check for addresses set by memory regions.
5981         (Output_segment::set_section_addresses): Remove memory region
5982         walking code.
5983         (Script_sections::create_segment): Add a warning if a header
5984         segment is created outside of any region.
5985         * script-sections.h (class Script_sections): Add prototypes for
5986         find_memory_region and block_in_region methods.
5987         * testsuite/memory_test.s: Use .long instead of .word.
5988         * testsuite/memory_test.t: Add some more output sections.
5989         * testsuite/memory_test.sh: Update expected output.
5990
5991 2010-10-02  Doug Kwan  <dougkwan@google.com>
5992
5993         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5994         defintion to symtab.h
5995         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5996         declaration to defintion.
5997
5998 2010-10-01  Nick Clifton  <nickc@redhat.com>
5999
6000         * expression.cc (eval): Replace dummy argument with NULL.
6001         (eval_maybe_dot): Check for a NULL result section pointer.
6002         (Symbol_expression::value): Likewise.
6003         (Dot_expression::value): Likewise.
6004         (BINARY_EXPRESSION): Likewise.
6005         (Max_expression::value): Likewise.
6006         (Min_expression::value): Likewise.
6007         (Absolute_expression::value): Likewise.
6008         (Addr_expression::value_from_output_section): Likewise.
6009         (Loaddddr_expression::value_from_output_section): Likewise.
6010         (Segment_start_expression::value): Likewise.
6011         * script-sections.cc
6012         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6013         argument with NULL.
6014         (Sections_elememt_dot_assignment::set_section_addresses):
6015         Likewise.
6016         (Output_data_expression::do_write_to_buffer): Likewise.
6017         (Output_section_definition::finalize_symbols): Likewise.
6018         (Output_section_definition::set_section_addresses): Likewise.
6019
6020 2010-09-30  Doug Kwan  <dougkwan@google.com>
6021
6022         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6023
6024 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6025
6026         * target.h (Target::can_icf_inline_merge_sections): New virtual
6027         function.
6028         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6029         virtual function.
6030         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6031         virtual function.
6032         * icf.cc (get_section_contents): Inline merge sections only when
6033         target allows it.
6034
6035 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6036
6037         * configure: Regenerate.
6038
6039 2010-09-17  Ian Lance Taylor  <iant@google.com>
6040
6041         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6042         * testsuite/Makefile.am (memory_test.o): New target.
6043         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6044         memory_test.t.
6045         * testsuite/Makefile.in: Rebuild.
6046
6047 2010-09-17  Doug Kwan  <dougkwan@google.com>
6048
6049         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6050         defintion if relocation uses GOT entries of the symbol.
6051         * testsuite/icf_safe_test.sh: Fix test.
6052         * testsuite/icf_safe_so_test.sh: Fix test.
6053
6054 2010-09-16  Cary Coutant  <ccoutant@google.com>
6055
6056         * script_sections.cc (class Memory_region): Remove "NULL" from
6057         vector initializations.
6058
6059 2010-09-15  Cary Coutant  <ccoutant@google.com>
6060
6061         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6062         Resolve forwarding symbols.
6063
6064 2010-09-15  Doug Kwan  <dougkwan@google.com>
6065
6066         * gold/testsuite/script_test_3.t: Add ARM special sections.
6067         * gold/testsuite/script_test_4.t: Same.
6068         * gold/testsuite/script_test_5.t: Same.
6069         * gold/testsuite/script_test_6.t: Same.
6070         * gold/testsuite/script_test_7.t: Same.
6071         * gold/testsuite/script_test_7.t: Same.
6072         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6073
6074 2010-09-14  Cary Coutant  <ccoutant@google.com>
6075
6076         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6077         (Target_x86_64::Relocate::relocate_tls): Replace check for
6078         saw_tls_block_reloc_ with test for executable section.
6079
6080 2010-09-12  Cary Coutant  <ccoutant@google.com>
6081
6082         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6083         position-independent executables to shared libraries need dynamic
6084         relocations.
6085         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6086         position-independent executables.
6087         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6088         * testsuite/Makefile.in: Regenerate.
6089
6090 2010-09-10  Nick Clifton  <nickc@redhat.com>
6091
6092         PR gold/11997
6093         * testsuite/memory_test.t: Discard any sections that are not
6094         needed.
6095
6096 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6097
6098         PR gold/11996
6099         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6100         "This::" to work around a bug in gcc 4.2.
6101
6102         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6103
6104 2010-09-09  Rafael Espindola  <espindola@google.com>
6105
6106         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6107         sections with different PF_X flags in the same segment.
6108         (Layout::find_first_load_seg): Search all segments to find the first
6109         one.
6110         * options.h (rosegment): New.
6111
6112 2010-09-08  Rafael Espindola  <espindola@google.com>
6113
6114         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6115
6116 2010-09-08  Doug Kwan  <dougkwan@google.com>
6117
6118         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6119         (Arm_relobj::do_relocate_sections): Add new parameter for output
6120         file to match the parent.
6121         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6122         of local symbols instead of input values.  Update code to track
6123         changes in gold::relocate_section.
6124         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6125         (Sized_relobj::compute_final_local_value_internal): New methods.
6126         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6127         body into private version of Sized_relobj::compute_final_local_value.
6128         Call the inline method.
6129         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6130         merged symbol value if there is one.
6131         (Symbol_value::has_output_value): New method defintiion.
6132         (Sized_relobj::Compute_final_local_value_status): New enum type.
6133         (Sized_relobj::compute_final_local_value): New methods.
6134         (Sized_relobj::compute_final_local_value_internal): New methods.
6135         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6136         and arm_cortex_a8.sh.
6137         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6138         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6139         New tests.
6140         * Makefile.in: Regenerate.
6141         * testsuite/arm_bl_out_of_range.s: Update test.
6142         * testsuite/thumb_bl_out_of_range.s: Ditto.
6143         * testsuite/thumb_blx_out_of_range.s: Ditto.
6144         * testsuite/arm_branch_out_of_range.sh: New file.
6145         * testsuite/arm_cortex_a8.sh: Ditto.
6146         * testsuite/arm_cortex_a8_b.s: Ditto.
6147         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6148         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6149         * testsuite/arm_cortex_a8_bl.s: Ditto.
6150         * testsuite/arm_cortex_a8_blx.s: Ditto.
6151         * testsuite/arm_cortex_a8_local.s: Ditto.
6152         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6153         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6154
6155 2010-09-08  Rafael Espindola  <espindola@google.com>
6156
6157         * Makefile.am (memory_test.stdout): Run readelf with -W.
6158         * Makefile.in: Regenerate.
6159         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6160         64 bit output.
6161
6162 2010-09-08  Rafael Espindola  <espindola@google.com>
6163
6164         * script-sections.cc (Script_sections::add_memory_region): Convert
6165         field precision to int.
6166         * script.cc (script_set_section_region, script_set_section_region):
6167         Convert field precision to int.
6168
6169 2010-09-08  Rafael Espindola  <espindola@google.com>
6170
6171         * arm.cc (do_finalize_sections): Create the __exidx_start and
6172         __exdix_end symbols even when the section is missing.
6173
6174 2010-09-08  Nick Clifton  <nickc@redhat.com>
6175
6176         * README: Remove claim that MEMORY is not supported.
6177         * expression.cc (script_exp_function_origin)
6178         (script_exp_function_length): Move from here to ...
6179         * script.cc: ... here.
6180         (script_set_section_region, script_add_memory)
6181         (script_parse_memory_attr, script_include_directive): New
6182         functions.
6183         * script-sections.cc
6184         (class Memory_region): New class.
6185         (class Output_section_definition): Add set_memory_region,
6186         set_section_vma, set_section_lma and get_section_name methods.
6187         (class Script_Sections): Add add_memory_region,
6188         find_memory_region, find_memory_region_origin,
6189         find_memory_region_length and set_memory_region methods.
6190         Have set_section_addresses method walk the list of set memory
6191         regions.
6192         Extend the print methos to display memory regions.
6193         * script-sections.h: Add prototypes for new methods.
6194         Add enum for MEMORY region attributes.
6195         * yyscript.y: Add support for parsing MEMORY regions.
6196         * script-c.h: Add prototypes for new functions.
6197         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6198         * testsuite/Makefile.in: Regenerate.
6199         * testsuite/memory_test.sh: New script.
6200         * testsuite/memory_test.s: New assembler source file.
6201         * testsuite/memory_test.t: New linker script.
6202
6203 2010-08-27  Doug Kwan  <dougkwan@google.com>
6204
6205         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6206         reference override an existing dynamic weak reference.
6207         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6208         * testsuite/Makefile.in: Regenerate.
6209         * testsuite/dyn_weak_ref.sh: New file.
6210         * testsuite/dyn_weak_ref_1.c: Ditto.
6211         * testsuite/dyn_weak_ref_2.c: Ditto.
6212
6213 2010-08-27  Ian Lance Taylor  <iant@google.com>
6214
6215         * incremental.h (class Incremental_input_entry): Add virtual
6216         destructor.
6217
6218 2010-08-27  Ian Lance Taylor  <iant@google.com>
6219
6220         * testsuite/start_lib_test_3.c: Mark t3 as used.
6221
6222 2010-08-27  Nick Clifton  <nickc@redhat.com>
6223
6224         * options.cc (version_script): Fix small typo in previous
6225         whitespace tidyup.
6226
6227 2010-08-25  Nick Clifton  <nickc@redhat.com>
6228
6229         * archive.cc: Formatting fixes: Remove whitespace between
6230         typename and following asterisk.  Remove whitespace between
6231         function name and opening parenthesis.
6232         * archive.h: Likewise.
6233         * arm.cc: Likewise.
6234         * attributes.cc: Likewise.
6235         * attributes.h: Likewise.
6236         * common.cc: Likewise.
6237         * copy-relocs.cc: Likewise.
6238         * dirsearch.h: Likewise.
6239         * dynobj.cc: Likewise.
6240         * ehframe.cc: Likewise.
6241         * ehframe.h: Likewise.
6242         * expression.cc: Likewise.
6243         * fileread.cc: Likewise.
6244         * fileread.h: Likewise.
6245         * gc.h: Likewise.
6246         * gold-threads.cc: Likewise.
6247         * gold.cc: Likewise.
6248         * i386.cc: Likewise.
6249         * icf.h: Likewise.
6250         * incremental-dump.cc: Likewise.
6251         * incremental.cc: Likewise.
6252         * layout.cc: Likewise.
6253         * layout.h: Likewise.
6254         * main.cc: Likewise.
6255         * merge.cc: Likewise.
6256         * merge.h: Likewise.
6257         * object.cc: Likewise.
6258         * object.h: Likewise.
6259         * options.cc: Likewise.
6260         * options.h: Likewise.
6261         * output.cc: Likewise.
6262         * output.h: Likewise.
6263         * plugin.cc: Likewise.
6264         * plugin.h: Likewise.
6265         * powerpc.cc: Likewise.
6266         * reloc.cc: Likewise.
6267         * script-c.h: Likewise.
6268         * script-sections.cc: Likewise.
6269         * script.cc: Likewise.
6270         * stringpool.cc: Likewise.
6271         * symtab.cc: Likewise.
6272         * symtab.h: Likewise.
6273         * target.cc: Likewise.
6274         * timer.cc: Likewise.
6275         * timer.h: Likewise.
6276         * version.cc: Likewise.
6277         * x86_64.cc: Likewise.
6278
6279 2010-08-24  Nick Clifton  <nickc@redhat.com>
6280
6281         PR 11899
6282         * layout.cc (segment_precedes): Sort segments by their physical
6283         addresses, if they have been set.
6284
6285 2010-08-23  Cary Coutant  <ccoutant@google.com>
6286
6287         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6288         symbols data.
6289         (Lib_group::include_member): Unlock object after deleting its
6290         symbols data.
6291         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6292         the bug fixed here.
6293
6294 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6295             Cary Coutant  <ccoutant@google.com>
6296
6297         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6298         constructor, and set_blocker.
6299         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6300         readsyms_blocker_.
6301         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6302         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6303         * testsuite/Makefile.am (start_lib_test): New test case.
6304         * testsuite/Makefile.in: Regenerate.
6305         * testsuite/start_lib_test_main.c: New file.
6306         * testsuite/start_lib_test_1.c: New file.
6307         * testsuite/start_lib_test_2.c: New file.
6308         * testsuite/start_lib_test_3.c: New file.
6309
6310 2010-08-19  Ian Lance Taylor  <iant@google.com>
6311
6312         * Makefile.in: Rebuild with automake 1.11.1.
6313         * aclocal.m4: Likewise.
6314         * testsuite/Makefile.in: Likewise.
6315
6316 2010-08-19  Ian Lance Taylor  <iant@google.com>
6317
6318         PR 10893
6319         * i386.cc (class Output_data_plt_i386): Update declarations.
6320         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6321         local_ifuncs_ fields.
6322         (Target_i386::do_plt_section_for_global): New function.
6323         (Target_i386::do_plt_section_for_local): New function.
6324         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6325         parameter; change all callers.  Initialize global_ifuncs_ and
6326         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6327         __rel_iplt_end.
6328         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6329         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6330         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6331         symbols.
6332         (Target_i386::make_plt_section): New function, broken out of
6333         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6334         (Target_i386::make_plt_entry): Call make_plt_section.
6335         (Target_i386::make_local_ifunc_plt_entry): New function.
6336         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6337         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6338         R_386_IRELATIVE to switch.
6339         (Target_i386::Scan::global): Likewise.
6340         (Target_i386::Relocate::relocate): Likewise.
6341         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6342         switch.
6343         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6344         (Target_x86_64::do_plt_section_for_global): New function.
6345         (Target_x86_64::do_plt_section_for_local): New function.
6346         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6347         parameter; change all callers.  If doing a static link define
6348         __rela_iplt_start and __rela_iplt_end.
6349         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6350         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6351         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6352         to point to .plt.
6353         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6354         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6355         switch.
6356         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6357         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6358         R_X86_64_IRELATIVE to switch.
6359         (Target_x86_64::Scan::global): Likewise.
6360         (Target_x86_64::Relocate::relocate): Likewise.
6361         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6362         switch.
6363         * target.h (class Target): Add plt_section_for_global and
6364         plt_section_for_local functions.  Add do_plt_section_for_global
6365         and do_plt_section_for_local virtual functions.
6366         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6367         clarifying comments.
6368         (Symbol::use_plt_offset): Handle IFUNC symbol.
6369         * object.cc (Sized_relobj::Sized_relobj): Initialize
6370         local_plt_offsets_.
6371         (Sized_relobj::local_has_plt_offset): New function.
6372         (Sized_relobj::local_plt_offset): New function.
6373         (Sized_relobj::set_local_plt_offset): New function.
6374         (Sized_relobj::do_count): Handle IFUNC symbol.
6375         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6376         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6377         is_ifunc_symbol functions.
6378         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6379         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6380         local_plt_offsets_ field.
6381         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6382         * output.h (class Output_section_data): Add non-const
6383         output_section function.
6384         (class Output_data_got): Update declarations.
6385         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6386         Add use_plt_offset parameter to global and local constructors.
6387         Change all callers.  Change local_sym_index_ field to 31 bits.
6388         Change GSYM_CODE and CONSTANT_CODE accordingly.
6389         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6390         doing a static link don't set sh_link field.
6391         (Output_data_got::Got_entry::write): Use PLT offset if
6392         appropriate.
6393         (Output_data_got::add_global_plt): New function.
6394         (Output_data_got::add_local_plt): New function.
6395         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6396         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6397         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6398         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6399         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6400         IFUNC conditional.
6401         * testsuite/ifunc-sel.h: New file.
6402         * testsuite/ifuncmain1.c: New file.
6403         * testsuite/ifuncmain1vis.c: New file.
6404         * testsuite/ifuncmod1.c: New file.
6405         * testsuite/ifuncdep2.c: New file.
6406         * testsuite/ifuncmain2.c: New file.
6407         * testsuite/ifuncmain3.c: New file.
6408         * testsuite/ifuncmod3.c: New file.
6409         * testsuite/ifuncmain4.c: New file.
6410         * testsuite/ifuncmain5.c: New file.
6411         * testsuite/ifuncmod5.c: New file.
6412         * testsuite/ifuncmain6pie.c: New file.
6413         * testsuite/ifuncmod6.c: New file.
6414         * testsuite/ifuncmain7.c: New file.
6415         * configure, testsuite/Makefile.in: Rebuild.
6416
6417 2010-08-18  Ian Lance Taylor  <iant@google.com>
6418
6419         * incremental.cc
6420         (Output_section_incremental_inputs::write_input_files): Add cast
6421         to avoid signed/unsigned comparison warning.
6422         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6423
6424 2010-08-12  Cary Coutant  <ccoutant@google.com>
6425
6426         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6427
6428 2010-08-13  Ian Lance Taylor  <iant@google.com>
6429
6430         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6431
6432 2010-08-12  Cary Coutant  <ccoutant@google.com>
6433             Doug Kwan  <dougkwan@google.com>
6434
6435         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6436         defintion overrides non-weak undef, remember that the original undef
6437         is not weak.
6438         * symtab.cc (Symbol_table::sized_write_global): For undef without
6439         an original weak binding, set binding to global in output.
6440         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6441         * testsuite/Makefile.in: Regenerate.
6442         * testsuite/strong_ref_weak_def.sh: New file.
6443         * testsuite/strong_ref_weak_def_1.c: Ditto.
6444         * testsuite/strong_ref_weak_def_2.c: Ditto.
6445
6446 2010-08-12  Cary Coutant  <ccoutant@google.com>
6447
6448         * testsuite/incremental_test.sh: Rewrite.
6449         * testsuite/incremental_test_1.c: Rewrite.
6450         * testsuite/incremental_test_2.c: Rewrite.
6451
6452 2010-08-12  Cary Coutant  <ccoutant@google.com>
6453
6454         * arm.cc (Target_arm::got_size): Add const.
6455         (Target_arm::got_entry_count): New function.
6456         (Target_arm::plt_entry_count): New function.
6457         (Target_arm::first_plt_entry_offset): New function.
6458         (Target_arm::plt_entry_size): New function.
6459         (Output_data_plt_arm::entry_count): New function.
6460         (Output_data_plt_arm::first_plt_entry_offset): New function.
6461         (Output_data_plt_arm::get_plt_entry_size): New function.
6462         * i386.cc (Target_i386::got_size): Add const.
6463         (Target_i386::got_entry_count): New function.
6464         (Target_i386::plt_entry_count): New function.
6465         (Target_i386::first_plt_entry_offset): New function.
6466         (Target_i386::plt_entry_size): New function.
6467         (Output_data_plt_i386::entry_count): New function.
6468         (Output_data_plt_i386::first_plt_entry_offset): New function.
6469         (Output_data_plt_i386::get_plt_entry_size): New function.
6470         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6471         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6472         * incremental.cc: Include target.h.
6473         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6474         parameter.  Adjust all callers.  Find incremental_got_plt section.
6475         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6476         section.
6477         (Output_section_incremental_inputs::set_final_data_size): Calculate
6478         size of incremental_got_plt section.
6479         (Output_section_incremental_inputs::do_write): Write the
6480         incremental_got_plt section.
6481         (Got_plt_view_info): New struct.
6482         (Local_got_offset_visitor): New class.
6483         (Global_got_offset_visitor): New class.
6484         (Global_symbol_visitor_got_plt): New class.
6485         (Output_section_incremental_inputs::write_got_plt): New function.
6486         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6487         Add parameter.  Adjust all callers.
6488         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6489         (Incremental_inputs::got_plt_section): New function.
6490         (Incremental_inputs::got_plt_section_): New data member.
6491         (Incremental_got_plt_reader): New class.
6492         * layout.cc (Layout::create_incremental_info_sections): Add the
6493         incremental_got_plt section.
6494         * object.h (Got_offset_list::get_list): New function.
6495         (Got offset_list::for_all_got_offsets): New function.
6496         (Sized_relobj::local_got_offset_list): New function.
6497         * powerpc.cc (Target_powerpc::got_size): Add const.
6498         (Target_powerpc::got_entry_count): New function.
6499         (Target_powerpc::plt_entry_count): New function.
6500         (Target_powerpc::first_plt_entry_offset): New function.
6501         (Target_powerpc::plt_entry_size): New function.
6502         (Output_data_plt_powerpc::entry_count): New function.
6503         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6504         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6505         * sparc.cc (Target_sparc::got_size): Add const.
6506         (Target_sparc::got_entry_count): New function.
6507         (Target_sparc::plt_entry_count): New function.
6508         (Target_sparc::first_plt_entry_offset): New function.
6509         (Target_sparc::plt_entry_size): New function.
6510         (Output_data_plt_sparc::entry_count): New function.
6511         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6512         (Output_data_plt_sparc::get_plt_entry_size): New function.
6513         * symtab.h (Symbol::got_offset_list): New function.
6514         (Symbol_table::for_all_symbols): New function.
6515         * target.h (Sized_target::got_entry_count): New function.
6516         (Sized_target::plt_entry_count): New function.
6517         (Sized_target::plt_entry_size): New function.
6518         * x86_64.cc (Target_x86_64::got_size): Add const.
6519         (Target_x86_64::got_entry_count): New function.
6520         (Target_x86_64::plt_entry_count): New function.
6521         (Target_x86_64::first_plt_entry_offset): New function.
6522         (Target_x86_64::plt_entry_size): New function.
6523         (Output_data_plt_x86_64::entry_count): New function.
6524         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6525         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6526
6527 2010-08-12  Cary Coutant  <ccoutant@google.com>
6528
6529         * archive.cc: Include incremental.h.
6530         (Archive::Archive): Initialize incremental_info_.
6531         (Archive::include_member): Record archive members in incremental info.
6532         (Add_archive_symbols::run): Record begin and end of an archive in
6533         incremental info.
6534         (Lib_group::include_member): Record objects in incremental info.
6535         * archive.h (Incremental_archive_entry): Forward declaration.
6536         (Archive::set_incremental_info): New member function.
6537         (Archive::incremental_info): New member function.
6538         (Archive::Unused_symbol_iterator): New class.
6539         (Archive::unused_symbols_begin): New member function.
6540         (Archive::unused_symbols_end): New member function.
6541         (Archive::incremental_info_): New data member.
6542         * incremental-dump.cc (find_input_containing_global): New function.
6543         (dump_incremental_inputs): Dump new incremental info sections.
6544         * incremental.cc: Include symtab.h.
6545         (Output_section_incremental_inputs): New class.
6546         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6547         new incremental info sections.
6548         (Sized_incremental_binary::do_check_inputs): Likewise.
6549         (Incremental_inputs::report_archive): Remove.
6550         (Incremental_inputs::report_archive_begin): New function.
6551         (Incremental_inputs::report_archive_end): New function.
6552         (Incremental_inputs::report_object): New function.
6553         (Incremental_inputs::finalize_inputs): Remove.
6554         (Incremental_inputs::report_input_section): New function.
6555         (Incremental_inputs::report_script): Rewrite.
6556         (Incremental_inputs::finalize): Do nothing but finalize string table.
6557         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6558         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6559         (Incremental_inputs::create_data_sections): New function.
6560         (Incremental_inputs::relocs_entsize): New function.
6561         (Output_section_incremental_inputs::set_final_data_size): New function.
6562         (Output_section_incremental_inputs::do_write): New function.
6563         (Output_section_incremental_inputs::write_header): New function.
6564         (Output_section_incremental_inputs::write_input_files): New function.
6565         (Output_section_incremental_inputs::write_info_blocks): New function.
6566         (Output_section_incremental_inputs::write_symtab): New function.
6567         * incremental.h (Incremental_script_entry): Forward declaration.
6568         (Incremental_object_entry): Forward declaration.
6569         (Incremental_archive_entry): Forward declaration.
6570         (Incremental_inputs): Forward declaration.
6571         (Incremental_inputs_header_data): Remove.
6572         (Incremental_inputs_header): Remove.
6573         (Incremental_inputs_header_write): Remove.
6574         (Incremental_inputs_entry_data): Remove.
6575         (Incremental_inputs_entry): Remove.
6576         (Incremental_inputs_entry_write): Remove.
6577         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6578         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6579         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6580         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6581         Likewise.
6582         (Incremental_input_entry): New class.
6583         (Incremental_script_entry): New class.
6584         (Incremental_object_entry): New class.
6585         (Incremental_archive_entry): New class.
6586         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6587         (Incremental_inputs::report_inputs): Remove.
6588         (Incremental_inputs::report_archive): Remove.
6589         (Incremental_inputs::report_archive_begin): New function.
6590         (Incremental_inputs::report_archive_end): New function.
6591         (Incremental_inputs::report_object): Change prototype.
6592         (Incremental_inputs::report_input_section): New function.
6593         (Incremental_inputs::report_script): Change prototype.
6594         (Incremental_inputs::get_reloc_count): New function.
6595         (Incremental_inputs::set_reloc_count): New function.
6596         (Incremental_inputs::create_data_sections): New function.
6597         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6598         (Incremental_inputs::inputs_section): New function.
6599         (Incremental_inputs::symtab_section): New function.
6600         (Incremental_inputs::relocs_section): New function.
6601         (Incremental_inputs::get_stringpool): Add const.
6602         (Incremental_inputs::command_line): Add const.
6603         (Incremental_inputs::inputs): Remove.
6604         (Incremental_inputs::command_line_key): New function.
6605         (Incremental_inputs::input_file_count): New function.
6606         (Incremental_inputs::input_files): New function.
6607         (Incremental_inputs::relocs_entsize): New function.
6608         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6609         (Incremental_inputs::finalize_inputs): Remove.
6610         (Incremental_inputs::Input_info): Remove.
6611         (Incremental_inputs::lock_): Remove.
6612         (Incremental_inputs::inputs_): Change type.
6613         (Incremental_inputs::inputs_map_): Remove.
6614         (Incremental_inputs::current_object_entry_): New data member.
6615         (Incremental_inputs::inputs_section_): New data member.
6616         (Incremental_inputs::symtab_section_): New data member.
6617         (Incremental_inputs::relocs_section_): New data member.
6618         (Incremental_inputs::reloc_count_): New data member.
6619         (Incremental_inputs_reader): New class.
6620         (Incremental_symtab_reader): New class.
6621         (Incremental_relocs_reader): New class.
6622         * layout.cc (Layout::finalize): Move finalization of incremental info
6623         and creation of incremental info sections to follow finalization of
6624         symbol table.  Set offsets for postprocessing sections.
6625         (Layout::create_incremental_info_sections): Call
6626         Incremental_inputs::create_data_sections.  Add incremental symtab
6627         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6628         sections to layout after input sections.
6629         * layout.h (struct Timespec): Forward declaration.
6630         (Layout::incremental_inputs): Add const.
6631         (Layout::create_incremental_info_sections): Add parameter.
6632         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6633         * object.cc: Include incremental.h.
6634         (Relobj::finalize_incremental_relocs): New function.
6635         (Sized_relobj::do_layout): Record input sections in incremental info.
6636         * object.h (Object::output_section): New function.
6637         (Object::output_section_offset): Moved from Relobj.
6638         (Object::get_incremental_reloc_base): New function.
6639         (Object::get_incremental_reloc_count): New function.
6640         (Object::do_output_section): New function.
6641         (Object::do_output_section_offset): Moved from Relobj.
6642         (Object::do_get_incremental_reloc_base): New function.
6643         (Object::do_get_incremental_reloc_count): New function.
6644         (Object::Object): Initialize new data members.
6645         (Relobj::output_section): Renamed do_output_section and moved to
6646         protected.
6647         (Relobj::output_section_offset): Moved to Object.
6648         (Relobj::do_get_incremental_reloc_base): New function.
6649         (Relobj::do_get_incremental_reloc_count): New function.
6650         (Relobj::allocate_incremental_reloc_counts): New function.
6651         (Relobj::count_incremental_reloc): New function.
6652         (Relobj::finalize_incremental_relocs): New function.
6653         (Relobj::next_incremental_reloc_index): New function.
6654         (Relobj::reloc_counts_): New data member.
6655         (Relobj::reloc_bases_): New data member.
6656         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6657         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6658         (Sized_relobj::incremental_relocs_scan): New function.
6659         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6660         (Sized_relobj::incremental_relocs_write): New function.
6661         (Sized_relobj::incremental_relocs_write_reltype): New function.
6662         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6663         incremental link.
6664         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6665         archives and object files elsewhere.
6666         (Add_symbols::run): Report object files here.
6667         (Finish_group::run): Report end of archive at end of group.
6668         * reloc.cc: Include layout.h, incremental.h.
6669         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6670         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6671         (Sized_relobj::incremental_relocs_scan): New function.
6672         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6673         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6674         (Sized_relobj::incremental_relocs_write): New function.
6675         (Sized_relobj::incremental_relocs_write_reltype): New function.
6676         * script.cc (read_input_script): Rewrite test for incremental link.
6677         Change call to Incremental_inputs::report_script.
6678         * symtab.h (Symbol_table::first_global_index): New function.
6679         (Symbol_table::output_count): New function.
6680
6681 2010-08-12  Doug Kwan  <dougkwan@google.com>
6682
6683         * arm.cc (Target_arm::merge_object_attributes): Check command line
6684         options --no-wchar-size-warning and --no-enum-size-warning.
6685         * options.h (General_options): Add ld-compatible options
6686         --no-enum-size-warning and --no-wchar-size-warning.
6687
6688 2010-08-04  Ian Lance Taylor  <iant@google.com>
6689
6690         * x86_64.cc (Target_x86_64::Scan::local): Use
6691         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6692         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6693         (Target_x86_64::Scan::global): Likewise.
6694         (Target_x86_64::Relocate::relocate): Likewise.
6695         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6696         Likewise.
6697
6698 2010-08-03  Cary Coutant  <ccoutant@google.com>
6699
6700         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6701         to reserve space in merged_strings vector. Keep total input size
6702         for stats.
6703         (Output_merge_string::do_print_merge_stats): Print total input size.
6704         * merge.h (Output_merge_string): Add input_size_ field.
6705         * stringpool.cc (Stringpool_template::string_length): Move
6706         implementations out of Stringpool_template class and place in
6707         stringpool.h.
6708         * stringpool.h (string_length): Move out of Stringpool_template.
6709
6710 2010-08-03  Ian Lance Taylor  <iant@google.com>
6711
6712         PR 11712
6713         * layout.cc (relaxation_loop_body): If address of load segment is
6714         set, adjust address to include headers if possible.
6715
6716 2010-08-03  Ian Lance Taylor  <iant@google.com>
6717
6718         * version.cc (version_string): Bump to 1.10.
6719
6720 2010-08-03  Ian Lance Taylor  <iant@google.com>
6721
6722         PR 11805
6723         * layout.h (enum Output_section_order): Define.
6724         (class Layout): Update declarations.
6725         * layout.cc (Layout::get_output_section): Add order parameter.
6726         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6727         is_first_non_relro parameters.  Change all callers.
6728         (Layout::choose_output_section): Likewise.
6729         (Layout::add_output_section_data): Likewise.
6730         (Layout::make_output_section): Likewise.  Set order.
6731         (Layout::default_section_order): New function.
6732         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6733         * output.cc (Output_section::Output_section): Initialize order_.
6734         Don't initialize deleted fields.
6735         (Output_segment::Output_segment): Don't initialize deleted
6736         fields.
6737         (Output_segment::add_output_section_to_load): New function
6738         replacing add_output_section.  Change all callers to call this or
6739         add_output_section_to_nonload.
6740         (Output_segment::add_output_section_to_nonload): New function.
6741         (Output_segment::remove_output_section): Rewrite.
6742         (Output_segment::add_initial_output_data): Likewise.
6743         (Output_segment::has_any_data_sections): Likewise.
6744         (Output_segment::is_first_section_relro): Likewise.
6745         (Output_segment::maximum_alignment): Likewise.
6746         (Output_segment::has_dynamic_reloc): New function replacing
6747         dynamic_reloc_count.  Change all callers.
6748         (Output_segment::has_dynamic_reloc_list): New function replacing
6749         dynamic_reloc_count_list.  Change all callers.
6750         (Output_segment::set_section_addresses): Rewrite.
6751         (Output_segment::set_offset): Rewrite.
6752         (Output_segment::find_first_and_last_list): Remove.
6753         (Output_segment::set_tls_offsets): Rewrite.
6754         (Output_segment::first_section_load_address): Likewise.
6755         (Output_segment::output_section_count): Likewise.
6756         (Output_segment::section_with_lowest_load_address): Likewise.
6757         (Output_segment::write_section_headers): Likewise.
6758         (Output_segment::print_sections_to_map): Likewise.
6759         * output.h (class Output_data): Remove dynamic_reloc_count_
6760         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6761         (Output_data::add_dynamic_reloc): Rewrite.
6762         (Output_data::has_dynamic_reloc): New function.
6763         (Output_data::dynamic_reloc_count): Remove.
6764         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6765         is_last_relro_, is_first_non_relro_, is_interp_,
6766         is_dynamic_linker_section_ fields.  Add order and set_order
6767         functions.  Remove is_relro_local, set_is_relro_local,
6768         is_last_relro, set_is_last_relro, is_first_non_relro,
6769         set_is_first_non_relro functions, is_interp, set_is_interp,
6770         is_dynamic_linker_section, and set_is_dynamic_linker_section
6771         functions.
6772         (class Output_segment): Change Output_data_list from std::list to
6773         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6774         output_bss_ fields.  Update declarations.
6775
6776 2010-08-02  Ian Lance Taylor  <iant@google.com>
6777
6778         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6779         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6780         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6781
6782 2010-08-02  Ian Lance Taylor  <iant@google.com>
6783
6784         PR 11855
6785         * script.cc (Script_options::Script_options): Initialize
6786         symbol_definitions_ and symbol_references_.
6787         (Script_options::add_symbol_assignment): Update
6788         symbol_definitions_ and symbol_references_.
6789         (Script_options::add_symbol_reference): New function.
6790         (script_symbol): New function.
6791         * script.h (class Script_options): Add symbol_definitions_ and
6792         symbol_references_ fields.
6793         (Script_options::referenced_const_iterator): New type.
6794         (Script_options::referenced_begin): New function.
6795         (Script_options::referenced_end): New function.
6796         (Script_options::is_referenced): New function.
6797         (Script_options::any_unreferenced): New function.
6798         * script-c.h (script_symbol): Declare.
6799         * yyscript.y (exp): Call script_symbol.
6800         * symtab.cc: Include "script.h".
6801         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6802         Change all callers.  Check symbols referenced by scripts.
6803         (Symbol_table::add_undefined_symbols_from_command_line): Add
6804         layout parameter.  Change all callers.
6805         (Symbol_table::do_add_undefined_symbols_from_command_line):
6806         Likewise.  Break out loop body.  Check symbols referenced by
6807         scripts.
6808         (Symbol_table::add_undefined_symbol_from_command_line): New
6809         function broken out of
6810         do_add_undefined_symbols_from_command_line.
6811         * symtab.h (class Symbol_table): Update declarations.
6812         * archive.cc: Include "layout.h".
6813         (Archive::should_include_member): Add layout parameter.  Change
6814         all callers.  Check for symbol mentioned in expression.
6815         * archive.h (class Archive): Update declaration.
6816         * object.cc (Sized_relobj::do_should_include_member): Add layout
6817         parameter.
6818         * object.h (Object::should_include_member): Add layout parameter.
6819         Change all callers.
6820         (Object::do_should_include_member): Add layout parameter.
6821         (class Sized_relobj): Update declaration.
6822         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6823         parameter.
6824         * dynobj.h (class Sized_dynobj): Update declaration.
6825         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6826         layout parameter.
6827         * plugin.h (class Sized_pluginobj): Update declaration.
6828
6829 2010-08-02  Ian Lance Taylor  <iant@google.com>
6830
6831         PR 11866
6832         * output.cc (Output_segment::set_offset): Search for the first and
6833         last sections rather than assuming that the list is in order.
6834         (Output_segment::find_first_and_last_list): New function.
6835         * output.h (class Output_segment): Update declarations.
6836         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6837         (relro_strip_test_SOURCES): New variable.
6838         (relro_strip_test_DEPENDENCIES): New variable.
6839         (relro_strip_test_LDFLAGS): New variable.
6840         (relro_strip_test_LDADD): New variable.
6841         (relro_strip_test.so): New target.
6842
6843 2010-08-02  Ian Lance Taylor  <iant@google.com>
6844
6845         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6846         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6847         (Target_i386::got_tlsdesc_section): New function.
6848         (Target_i386::got_section): Create space for GOT entries for
6849         TLSDESC relocations.
6850         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6851         R_386_TLS_GOTDESC.
6852         (Target_i386::Scan::global): Likewise.
6853         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6854         using TLSDESC GOT.
6855         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6856         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6857         (Target_x86_64::got_tlsdesc_section): New function.
6858         (Target_x86_64::got_section): Create space for GOT entries for
6859         TLSDESC relocations.
6860         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6861         R_386_TLS_GOTDESC.
6862         (Target_x86_64::Scan::global): Likewise.
6863         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6864         using TLSDESC GOT.
6865
6866 2010-08-02  Ian Lance Taylor  <iant@google.com>
6867
6868         * testsuite/final_layout.sh: Use dc to convert from hex to
6869         decimal.
6870
6871 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6872
6873         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6874         paramter to the call to gold::gc_process_relocs.
6875         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6876         paramter to the call to gold::gc_process_relocs.
6877         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6878         parameter to the call to gold::gc_process_relocs.
6879         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6880         template parameter to the call to gold::gc_process_relocs.
6881         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6882         paramter to the call to gold::gc_process_relocs.
6883         * gc.h (get_embedded_addend_size): New function.
6884         (gc_process_relocs): Save the size of the reloc for use by ICF.
6885         * icf.cc (get_section_contents): Get the addend from the text section
6886         for SHT_REL relocation sections.
6887         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6888         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6889         * int_encoding.h (read_from_pointer): New overloaded function.
6890         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6891         * testsuite/icf_sht_rel_addend_test.sh: New file.
6892         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6893         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6894
6895 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6896
6897         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6898         * Makefile.in: Regenerate.
6899         * testsuite/Makefile.in: Regenerate.
6900
6901 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6902
6903         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6904         * gold/testsuite/debug_msg.cc: Likewise.
6905         * gold/testsuite/odr_violation1.cc
6906         * gold/testsuite/odr_violation2.cc
6907
6908 2010-07-21  Cary Coutant  <ccoutant@google.com>
6909
6910         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6911         string, and length fields.
6912         (Output_merge_string::Merged_strings_list): New type.
6913         (Output_merge_string::Merged_strings_lists): New typedef.
6914         (Output_merge_string): Replace merged_strings_ with
6915         merged_strings_lists_.
6916         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6917         Merged_strings_list per input object and section.  Don't store pointer
6918         to the string.  Don't store length with each merged string entry.
6919         (Output_merge_string::finalize_merged_data): Loop over list of merged
6920         strings lists.  Recompute length of each merged string.
6921
6922 2010-07-15  Cary Coutant  <ccoutant@google.com>
6923
6924         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6925         here.
6926
6927 2010-07-14  Ian Lance Taylor  <iant@google.com>
6928
6929         * descriptors.cc (Descriptors::open): Report correct name in error
6930         message.
6931
6932 2010-07-13  Doug Kwan  <dougkwan@google.com>
6933
6934         * arm.cc (Arm_input_section::Arm_input_section): For a
6935         SHT_ARM_EXIDX section, always keeps the input sections.
6936         (Arm_input_section::set_exidx_section_link): New method.
6937         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6938         has_errors_ to false.
6939         (Arm_exidx_input_section::has_errors,
6940         Arm_exidx_input_section::set_has_errors): New methods.
6941         (Arm_exidx_input_section::has_errors_): New data member.
6942         (Arm_relobj::get_exidx_shndx_list): New method.
6943         (Arm_output_section::append_text_sections_to_list): Do not skip
6944         section without SHF_EXECINSTR.
6945         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6946         errors.
6947         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6948         section header.  Make error messages more verbose.  Check for
6949         a non-executable section linked to an EXIDX section.
6950         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6951         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6952         check that there is no deferred EXIDX section if we exit early.
6953         Instead of not making an EXIDX section in case of an error, make one
6954         and set the has_errors flag of it.
6955         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6956         in a relocatable link.
6957         (Target_arm::do_relax): Look for the EXIDX output section instead of
6958         assuming that it is called .ARM.exidx.
6959         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6960         section list.  Do not check for SHF_EXECINSTR section flags but
6961         skip any input section with errors.
6962         * output.cc (Output_section::Output_section): Initialize
6963         always_keeps_input_sections_ to false.
6964         (Output_section::add_input_section): Check for
6965         always_keeps_input_sections_.
6966         *  output.h (Output_section::always_keeps_input_sections,
6967         Output_section::set_always_keeps_input_sections): New methods.
6968         (Output_section::always_keeps_input_sections): New data member.
6969
6970 2010-07-13  Rafael Espindola  <espindola@google.com>
6971
6972         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6973         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6974
6975 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6976             Ian Lance Taylor  <iant@google.com>
6977
6978         * output.h (Output_section_lookup_maps::add_merge_section):
6979         Correct check of whether value was inserted.
6980         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6981         (Output_section_lookup_maps::add_relaxed_input_section):
6982         Likewise.
6983         * arm.cc (Target_arm::got_section): Remove used local os.
6984         * i386.cc (Target_i386::got_section): Likewise.
6985         * x86_64.cc (Target_x86_64::got_section): Likewise.
6986         * sparc.cc (Target_sparc::got_section): Likewise.
6987         (Target_sparc::relocate): Remove unused local have_got_offset.
6988         * powerpc.cc (Target_powerpc::relocate): Likewise.
6989
6990 2010-07-13  Ian Lance Taylor  <iant@google.com>
6991
6992         * compressed_output.cc (zlib_decompress): Fix signature in
6993         !HAVE_ZLIB_H case.
6994
6995         * archive.cc (Archive::include_member): Unlock an external member
6996         of a thin archive.  Don't bother to delete an object we know is
6997         NULL.
6998
6999 2010-07-12  Cary Coutant  <ccoutant@google.com>
7000
7001         * compressed_output.cc (zlib_decompress): New function.
7002         (get_uncompressed_size): New function.
7003         (decompress_input_section): New function.
7004         * compressed_output.h (get_uncompressed_size): New function.
7005         (decompress_input_section): New function.
7006         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7007         Handle compressed debug sections.
7008         * layout.cc (is_compressed_debug_section): New function.
7009         (Layout::output_section_name): Map compressed section names to
7010         canonical names.
7011         * layout.h (is_compressed_debug_section): New function.
7012         (is_debug_info_section): Recognize compressed debug sections.
7013         * merge.cc: Include compressed_output.h.
7014         (Output_merge_data::do_add_input_section): Handle compressed
7015         debug sections.
7016         (Output_merge_string::do_add_input_section): Handle compressed
7017         debug sections.
7018         * object.cc: Include compressed_output.h.
7019         (Sized_relobj::Sized_relobj): Initialize new data members.
7020         (build_compressed_section_map): New function.
7021         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7022         * object.h (Object::section_is_compressed): New method.
7023         (Object::do_section_is_compressed): New method.
7024         (Sized_relobj::Compressed_section_map): New type.
7025         (Sized_relobj::do_section_is_compressed): New method.
7026         (Sized_relobj::compressed_sections_): New data member.
7027         * output.cc (Output_section::add_input_section): Handle compressed
7028         debug sections.
7029         * reloc.cc: Include compressed_output.h.
7030         (Sized_relobj::write_sections): Handle compressed debug sections.
7031
7032 2010-07-08  Cary Coutant  <ccoutant@google.com>
7033
7034         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7035         weak when resolving to a dynamic def.
7036         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7037         for weak undef/dynamic def cases. Adjust callers.
7038         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7039         undef_binding_weak_.
7040         (Symbol_table::sized_write_globals): Adjust symbol binding.
7041         (Symbol_table::sized_write_symbol): Add binding parameter.
7042         * symtab.h (Symbol::set_undef_binding): New method.
7043         (Symbol::is_undef_binding_weak): New method.
7044         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7045         (Symbol_table::should_override): Add new parameter.
7046         (Symbol_table::sized_write_symbol): Add new parameter.
7047
7048         * testsuite/weak_undef_file1.cc: Add new test case.
7049         * testsuite/weak_undef_file2.cc: Fix header comment.
7050         * testsuite/weak_undef_test.cc: Add new test case.
7051
7052 2010-06-29  Doug Kwan  <dougkwan@google.com>
7053
7054         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7055         Initialize USE_SYMBOL_.
7056         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7057         definition.
7058         (Arm_reloc_property::uses_symbol_): New data member declaration.
7059         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7060         uses symbol value and symbol is undefined but not weakly undefined.
7061
7062 2010-06-28  Rafael Espindola  <espindola@google.com>
7063
7064         * plugin.cc (Plugin::load): Use dlerror.
7065
7066 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7067
7068         * symtab.cc (detect_odr_violations): When reporting an ODR
7069         violation, report an object where the symbol is defined.
7070
7071 2010-06-25  Doug Kwan  <dougkwan@google.com>
7072
7073         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7074         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7075         definition.
7076         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7077         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7078         target hook to detect function points.
7079         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7080         * icf.h (Icf::check_section_for_function_pointers): Change type of
7081         parameter SECTION_NAME to const reference to std::string.  Use
7082         target hook to determine if section may have unsafe pointers.
7083         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7084         method definition.
7085
7086 2010-06-21  Rafael Espindola  <espindola@google.com>
7087
7088         * fileread.cc (Input_file::find_fie): New
7089         (Input_file::open): Use Input_file::find_fie.
7090         * fileread.h (Input_file::find_fie): New
7091         * plugin.cc (set_extra_library_path): New.
7092         (Plugin::load): Add set_extra_library_path to the transfer vector.
7093         (Plugin_manager::set_extra_library_path): New.
7094         (Plugin_manager::add_input_file): Use the extra search path if set.
7095         (set_extra_library_path(): New.
7096         * plugin.h (Plugin_manager): Add set_extra_library_path and
7097         extra_search_path_.
7098
7099 2010-06-19  Cary Coutant  <ccoutant@google.com>
7100
7101         * layout.cc (gdb_sections): Add .debug_types.
7102         (lines_only_debug_sections): Likewise.
7103
7104 2010-06-18  Rafael Espindola  <espindola@google.com>
7105
7106         * plugin.cc (add_input_file,add_input_library)
7107         (Plugin_manager::add_input_file): Make filename arguments const.
7108         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7109         const.
7110
7111 2010-06-16  Doug Kwan  <dougkwan@google.com>
7112
7113         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7114         .ARM.attributes section if we have not merged any input
7115         attributes sections.
7116
7117 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7118
7119         * arm.cc: Allow combining objects with no EABI version
7120         information.
7121
7122 2010-06-15  Rafael Espindola  <espindola@google.com>
7123
7124         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7125
7126 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7127
7128         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7129         (struct iovec): Correct !HAVE_READV definition.
7130
7131 2010-06-10  Cary Coutant  <ccoutant@google.com>
7132
7133         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7134         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7135         reloc sections.
7136         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7137
7138         PR 11683
7139         * symtab.h (Symbol::is_placeholder): New member function.
7140         * target-reloc.h (relocate_section): Check for placeholder symbols.
7141
7142         * testsuite/Makefile.am (plugin_test_8): New test.
7143         (plugin_test_9): New test.
7144         * testsuite/Makefile.in: Regenerate.
7145
7146 2010-06-09  Nick Clifton  <nickc@redhat.com>
7147
7148         * yyscript.y (input_list_element): Allow strings prefixed with
7149         the '-' character.  Treat these as libraries.
7150         * script.cc (script_add_library): New function.  Adds a library
7151         specified by "-l<name>" found in an input script.
7152         * script-c.h: Add prototype for script_add_library.
7153
7154 2010-06-07  Doug Kwan  <dougkwan@google.com>
7155
7156         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7157         Restrict stub-group size to be within long conditional branch
7158         range when working around cortex-A8 erratum.
7159
7160 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7161
7162         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7163         #ifdef typo.
7164
7165 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7166
7167         PR gold/11658
7168         * output.cc
7169         (Output_section::Input_section_sort_entry::compare_section_ordering):
7170         Change to return non-zero correctly.
7171         (Output_section::Input_section_sort_section_order_index_compare
7172         ::operator()): Change to fix ambiguity in comparisons.
7173
7174 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7175
7176         * gold.h (is_wildcard_string): New function.
7177         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7178         (Layout::layout_eh_frame): Ditto.
7179         (Layout::find_section_order_index): New method.
7180         (Layout::read_layout_from_file): New method.
7181         * layout.h (Layout::find_section_order_index): New method.
7182         (Layout::read_layout_from_file): New method.
7183         (Layout::input_section_position_): New private member.
7184         (Layout::input_section_glob_): New private member.
7185         * main.cc (main): Call read_layout_from_file here.
7186         * options.h (--section-ordering-file): New option.
7187         * output.cc (Output_section::input_section_order_specified_): New
7188         member.
7189         (Output_section::Output_section): Initialize new member.
7190         (Output_section::add_input_section): Add new parameter.
7191         Keep input sections when --section-ordering-file is used.
7192         (Output_section::set_final_data_size): Sort input sections when
7193         section ordering file is specified.
7194         (Output_section::Input_section_sort_entry): Add new parameter.
7195         Check sorting type.
7196         (Output_section::Input_section_sort_entry::compare_section_ordering):
7197         New method.
7198         (Output_section::Input_section_sort_compare::operator()): Change to
7199         consider section_order_index.
7200         (Output_section::Input_section_sort_init_fini_compare::operator()):
7201         Change to consider section_order_index.
7202         (Output_section::Input_section_sort_section_order_index_compare
7203         ::operator()): New method.
7204         (Output_section::sort_attached_input_sections): Change to sort
7205         according to section order when specified.
7206         (Output_section::add_input_section<32, true>): Add new parameter.
7207         (Output_section::add_input_section<64, true>): Add new parameter.
7208         (Output_section::add_input_section<32, false>): Add new parameter.
7209         (Output_section::add_input_section<64, false>): Add new parameter.
7210         * output.h (Output_section::add_input_section): Add new parameter.
7211         (Output_section::input_section_order_specified): New
7212         method.
7213         (Output_section::set_input_section_order_specified): New method.
7214         (Input_section::Input_section): Initialize section_order_index_.
7215         (Input_section::section_order_index): New method.
7216         (Input_section::set_section_order_index): New method.
7217         (Input_section::section_order_index_): New member.
7218         (Input_section::Input_section_sort_section_order_index_compare): New
7219         struct.
7220         (Output_section::input_section_order_specified_): New member.
7221         * script-sections.cc (is_wildcard_string): Delete and move modified
7222         method to gold.h.
7223         (Output_section_element_input::Output_section_element_input): Modify
7224         call to is_wildcard_string.
7225         (Output_section_element_input::Input_section_pattern
7226         ::Input_section_pattern): Ditto.
7227         (Output_section_element_input::Output_section_element_input): Ditto.
7228         * testsuite/Makefile.am (final_layout): New test case.
7229         * testsuite/Makefile.in: Regenerate.
7230         * testsuite/final_layout.cc: New file.
7231         * testsuite/final_layout.sh: New file.
7232
7233 2010-06-01  Rafael Espindola  <espindola@google.com>
7234
7235         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7236
7237 2010-06-01  Rafael Espindola  <espindola@google.com>
7238
7239         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7240         visibility of symbols.
7241
7242 2010-05-27  Doug Kwan  <dougkwan@google.com>
7243
7244         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7245         from start of output section instead of address for a local symbol
7246         in a merged or relaxed section when doing a relocatable link.
7247
7248 2010-05-26  Rafael Espindola  <espindola@google.com>
7249
7250         PR 11604
7251         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7252         adding sections the garbage collector removed.
7253         * gold/testsuite/Makefile.am: Add test.
7254         * gold/testsuite/Makefile.in: Regenerate.
7255         * gold/testsuite/plugin_test_7.sh: New.
7256         * gold/testsuite/plugin_test_7_1.c: New.
7257         * gold/testsuite/plugin_test_7_2.c: New.
7258
7259 2010-05-26  Rafael Espindola  <espindola@google.com>
7260
7261         * script-sections.cc (Output_section_definition::set_section_addresses):
7262         Check for --section-start.
7263
7264 2010-05-26  Doug Kwan  <dougkwan@google.com>
7265
7266         * arm.cc (Arm_scan_relocatable_relocs): New class.
7267         (Target_arm::relocate_special_relocatable): New method.
7268         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7269         (Arm_relocate_functions::thumb_branch_common): Same.
7270         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7271         instead of Default_scan_relocatable_relocs.
7272         * target-reloc.h (relocate_for_relocatable): Let target handle
7273         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7274         * target.h (Sized_target::relocate_special_relocatable): New method.
7275
7276 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7277
7278         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7279
7280 2010-05-23  Doug Kwan  <dougkwan@google.com>
7281
7282         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7283         instead of a cast.
7284         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7285         with a direct branch, not a conditional branch, to a stub.
7286         * merge.cc (Output_merge_base::record_input_section): New method
7287         defintion.
7288         (Output_merge_data::do_add_input_section): Record input section if
7289         keeps-input-sections flag is set.
7290         (Output_merge_string::do_add_input_section): Ditto.
7291         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7292         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7293         INPUT_SECTIONS_.
7294         (Output_merge_base::keeps_input_sections,
7295         Output_merge_base::set_keeps_input_sections,
7296         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7297         method definitions.
7298         (Output_merge_base::Input_sections): New type declaration.
7299         (Output_merge_base::input_sections_begin,
7300         Output_merge_base::input_sections_end,
7301         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7302         (Output_merge_base::bool keeps_input_sections_,
7303         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7304         Output_merge_base::input_sections_): New data members.
7305         (Output_merge_data::do_set_keeps_input_sections): New method
7306         defintion.
7307         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7308         * output.cc (Output_section::Input_section::relobj): Move method
7309         defintion from class declaration to here and handle merge sections.
7310         (Output_section::Input_section::shndx): Ditto.
7311         (Output_section::Output_section): Remove initializations of removed
7312         data members and initialize new data member LOOKUP_MAPS_.
7313         (Output_section::add_input_section): Set keeps-input-sections flag
7314         for a newly created merge output section as appropriate.  Adjust code
7315         to use Output_section_lookup_maps class.
7316         (Output_section::add_relaxed_input_section): Adjst code for lookup
7317         maps code refactoring.
7318         (Output_section::add_merge_input_section): Add a new parameter
7319         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7320         class.  If adding input section to a newly created merge output
7321         section fails, remove the new merge section.
7322         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7323         Adjust code for use of the Output_section_lookup_maps class.
7324         (Output_section::find_merge_section): Ditto.
7325         (Output_section::build_lookup_maps): New method defintion.
7326         (Output_section::find_relaxed_input_section): Adjust code to use
7327         Output_section_lookup_maps class.
7328         (Output_section::get_input_sections): Export merge sections.  Adjust
7329         code to use Output_section_lookup_maps class.
7330         (Output_section:::add_script_input_section): Adjust code to use
7331         Output_section_lookup_maps class.  Update lookup maps for merge
7332         sections also.
7333         (Output_section::discard_states): Use Output_section_lookup_maps.
7334         (Output_section::restore_states): Same.
7335         * output.h (Merge_section_properties): Move class defintion out of
7336         Output_section.
7337         (Output_section_lookup_maps): New class.
7338         (Output_section::Input_section::is_merge_section): New method
7339         defintion.
7340         (Output_section::Input_section::relobj): Move defintion out of class
7341         defintion.  Declare method only.
7342         (Output_section::Input_section::shndx): Ditto.
7343         (Output_section::Input_section::output_merge_base): New method defintion.
7344         (Output_section::Input_section::u2_.pomb): New union field.
7345         (Output_section::Merge_section_by_properties_map,
7346         Output_section::Output_section_data_by_input_section_map,
7347         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7348         Remove types.
7349         (Output_section::add_merge_input_section): Add new parameter
7350         KEEPS_INPUT_SECTIONS.
7351         (Output_section::build_lookup_maps): New method declaration.
7352         (Output_section::merge_section_map_,
7353         Output_section::merge_section_by_properties_map_,
7354         Output_section::relaxed_input_section_map_,
7355         Output_section::is_relaxed_input_section_map_valid_): Remove data
7356         members.
7357         (Output_section::lookup_maps_): New data member.
7358
7359 2010-05-21  Doug Kwan  <dougkwan@google.com>
7360
7361         PR gold/11619
7362         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7363         avoid a compilation error.
7364
7365 2010-05-19  Rafael Espindola  <espindola@google.com>
7366
7367         * script-sections.cc (Output_section_definition::allocate_to_segment):
7368         Update the phdrs_list even when the output section is NULL.
7369         * testsuite/Makefile.am: Add test.
7370         * testsuite/Makefile.in: Regenerate.
7371         * testsuite/script_test_9.cc: New.
7372         * testsuite/script_test_9.sh: New.
7373         * testsuite/script_test_9.t: New.
7374
7375 2010-05-19  Doug Kwan  <dougkwan@google.com>
7376
7377         * arm.cc (Arm_input_section::original_size): New method.
7378         (Arm_input_section::do_addralign): Add a cast.
7379         (Arm_input_section::do_output_offset): Remove static cast.
7380         (Arm_input_section::original_addralign,
7381          Arm_input_section::original_size_): Change type to uint32_t.
7382         (Arm_input_section::init): Add safe casts for section alignment
7383         and size.
7384         (Arm_input_section::set_final_data_size): Do not set address and
7385         offset of stub table.
7386         (Arm_output_section::fix_exidx_coverage): Change use of of
7387         Output_section::Simple_input_section to that of
7388         Output_section::Input_section.
7389         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7390         except for the first pass.
7391         * output.cc (Output_section::get_input_sections): Change type of
7392         input_sections to std::list<Input_section>.
7393         (Output_section::add_script_input_section): Rename from
7394         Output_section::add_simple_input_section.  Change type of SIS
7395         parameter from Simple_input_section to Input_section.
7396         * output.h (Output_section::Simple_input_section): Remove class.
7397         (Output_section::Input_section): Change class visibility to public.
7398         (Output_section::Input_section::addralign): Use stored alignments
7399         for special input sections if set.
7400         (Output_section::Input_section::set_addralign): New method.
7401         (Output_section::get_input_sections): Change parameter type from
7402         list of Simple_input_section to list of Input_section.
7403         (Output_section::add_script_input_section): Rename from
7404         Output_section::add_simple_input_section. Change first parameter's
7405         type from Simple_input_section to Input_section and remove the
7406         second and third parameters.
7407         * script-sections.cc (Input_section::Input_section_list): Change
7408         type to list of Output_section::Input_section/
7409         (Input_section_info::Input_section_info): Change parameter type of
7410         INPUT_SECTION to Output_section::Input_section.
7411         (Input_section_info::input_section): Change return type.
7412         (Input_section_info::input_section_): Change type to
7413         Output_section::Input_section.
7414         (Output_section_element_input::set_section_addresses): Adjust code
7415         to use Output_section::Input_section instead of
7416         Output_section::Simple_input_section.  Adjust code for renaming
7417         of Output_section::add_simple_input_section.
7418         (Orphan_output_section::set_section_addresses): Ditto.
7419
7420 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7421
7422         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7423         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7424
7425 2010-05-18  Rafael Espindola  <espindola@google.com>
7426
7427         * options.cc (General_options::finalize): Handle -nostdlib.
7428         * options.h (nostdlib): New option.
7429         * script.cc (script_add_search_dir): Handle -nostdlib.
7430
7431 2010-05-12  Doug Kwan  <dougkwan@google.com>
7432
7433         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7434         attributes section only if there no attributes section after merging.
7435         (Target_arm::merge_object_attributes): Move value of
7436         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7437         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7438         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7439         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7440         and arm_attr_merge_7.stdout.
7441         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7442         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7443         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7444         arm_attr_merge_7b.o): New rules.
7445         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7446         arm_attr_merge_7
7447         * testsuite/Makefile.in: Regenerate.
7448         * testsuite/arm_attr_merge.sh: New file.
7449         * testsuite/arm_attr_merge_[67][ab].s: Same.
7450
7451 2010-05-05  Nick Clifton  <nickc@redhat.com>
7452
7453         * po/es.po: Updated Spanish translation.
7454
7455 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7456
7457         * Makefile.am (install-exec-local): Properly install gold as
7458         default cross linker.
7459         * Makefile.in: Regenerated.
7460
7461 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7462             Nick Clifton  <nickc@redhat.com>
7463
7464         * configure.ac (install_as_default): Define and set to false
7465         unless --enable-gold or --enable-gold=both/gold has been
7466         specified.
7467         * configure: Regenerate.
7468
7469         * Makefile.am (install-exec-local): Install the executable as
7470         'ld.gold'.  If install_as_default is true then also install it as
7471         'ld'.
7472         * Makefile.in: Regenerated.
7473
7474 2010-04-24  Ian Lance Taylor  <iant@google.com>
7475
7476         * layout.cc (Layout::layout_reloc): In relocatable link don't
7477         combine reloc sections for grouped sections.
7478
7479 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7480
7481         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7482         sections that are not ordinary to icf.
7483         * icf.cc (get_section_contents): Handle relocation pointing to section
7484         with no object or shndx information.
7485         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7486         * testsuite/Makefile.in: Regenerate.
7487         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7488         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7489
7490 2010-04-22  Ian Lance Taylor  <iant@google.com>
7491
7492         * expression.cc (Expression::Expression_eval_info): Add
7493         result_alignment_pointer field.
7494         (Expression::eval_with_dot): Add result_alignment_pointer
7495         parameter.  Change all callers.
7496         (Expression::eval_maybe_dot): Likewise.
7497         (class Binary_expression): Add alignment_pointer parameter to
7498         left_value and right_value.  Change all callers.
7499         (BINARY_EXPRESSION): Set result alignment.
7500         (class Trinary_expression): Add alignment_pointer parameter to
7501         arg2_value and arg3_value.  Change all callers.
7502         (Trinary_cond::value): Set result alignment.
7503         (Max_expression::value, Min_expression::value): Likewise.
7504         (Align_expression::value): Likewise.
7505         * script-sections.cc (class Sections_element): Add dot_alignment
7506         parameter to set_section_addresses virtual function.  Update
7507         instantiations.
7508         (class Output_section_element): Likewise.
7509         (Script_sections::create_segments): Add dot_alignment parameter.
7510         Change all callers.
7511         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7512         (Script_sections::set_phdrs_clause_addresses): Likewise.
7513         * script-sections.h: Update declarations.
7514         * script.h: Update declarations.
7515         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7516         min_p_align.
7517         * testsuite/script_test_3.t: Set large alignment.
7518         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7519         segment has expected alignment.
7520
7521 2010-04-22  Nick Clifton  <nickc@redhat.com>
7522
7523         * po/gold.pot: Updated by the Translation project.
7524         * po/vi.po: Updated Vietnamese translation.
7525
7526 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7527
7528         * testsuite/Makefile.am (check_PROGRAMS): Add
7529         icf_virtual_function_folding_test.
7530         * testsuite/Makefile.in: Regenerated.
7531
7532 2010-04-15  Andrew Haley  <aph@redhat.com>
7533
7534         * options.h (merge_exidx_entries): New option.
7535         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7536         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7537         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7538         (Target_arm::merge_exidx_entries): New function.
7539         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7540         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7541         to Arm_exidx_fixup constructor.
7542         Add new arg, merge_exidx_entries.
7543         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7544         Arm_output_section::fix_exidx_coverage.
7545
7546 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7547
7548         * icf.cc (get_section_contents): Check for preemptible functions.
7549         Ignore addend when appropriate.
7550         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7551         section folded.
7552         (add_from_relobj): Check for section folded.
7553         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7554         * symtab.h (should_add_dynsym_entry): Add new parameter.
7555         * target-reloc.h (scan_relocs): Check for section folded.
7556         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7557         Check reloc types for function pointers in shared objects.
7558         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7559         case.
7560         (icf_preemptible_functions_test): New test case.
7561         (icf_string_merge_test): New test case.
7562         * testsuite.Makefile.in: Regenerate.
7563         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7564         bar_glob.  Refactor code.
7565         * testsuite/icf_preemptible_functions_test.cc: New file.
7566         * testsuite/icf_preemptible_functions_test.sh: New file.
7567         * testsuite/icf_string_merge_test.cc: New file.
7568         * testsuite/icf_string_merge_test.sh: New file.
7569         * testsuite/icf_virtual_function_folding_test.cc: New file.
7570         * testsuite/icf_virtual_function_folding_test.sh: New file.
7571
7572 2010-04-14  Doug Kwan  <dougkwan@google.com>
7573
7574         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7575         for local symbol recounting if we remove a section due to ICF.
7576         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7577         there are no regular objects in input.
7578
7579 2010-04-13  Doug Kwan  <dougkwan@google.com>
7580
7581         * arm.cc (Arm_input_section::set_final_data_size): Compute
7582         accurate final data size instead of using current data size.
7583
7584 2010-04-09  Doug Kwan  <dougkwan@google.com>
7585
7586         * layout.cc (Layout::choose_output_section): Handle script section
7587         types.
7588         (Layout::make_output_section_for_script): Add section type parameter.
7589         Handle script section types.
7590         * layout.h (Layout::make_output_section_for_script): Add section
7591         type parameter.
7592         * output.cc (Output_section::Output_section): Initialize data member
7593         is_noload_.
7594         (Output_section::do_reset_address_and_file_offset): Do not set address
7595         to 0 if section is a NOLOAD section.
7596         * output.h (Output_section::is_noload): New method.
7597         (Output_section::set_is_noload): Ditto.
7598         (Output_section::is_noload_): New data member.
7599         * script-c.h (Script_section_type): New enum type.
7600         (struct Parser_output_section_header): Add new file section_type.
7601         * script-sections.cc (Sections_element::output_section_name): Add
7602         parameter for returning script section type.
7603         (Output_section_definition::output_section_name): Ditto.
7604         (Output_section_definition::section_type)P; New method.
7605         (Output_section_definiton::script_section_type_name): Ditto.
7606         (Output_section_definition::script_section_type_): New data member.
7607         (Output_section_definition::Output_section_definition): Initialize
7608         data member Output_section_definition::script_section_type_.
7609         (Output_section_definition::create_sections): Pass script section type
7610         to Layout::make_output_section_for_script.
7611         (Output_section_definition::output_section_name): Return script
7612         section type to caller.
7613         (Output_section_definition::set_section_address): Do not advance
7614         dot value and load address if section type is NOLOAD.  Set address
7615         of NOLOAD sections regardless of section flags.
7616         (Output_section_definition::print): Print section type if it is
7617         not SCRIPT_SECTION_TYPE_NONE.
7618         (Output_section_definition::section_type): New method.
7619         (Output_section_definition::script_section_type_name): Ditto.
7620         (Script_sections::output_section_name): Add new parameter
7621         PSECTION_TYPE for returning script section type.  Pass it to
7622         section elements.  Handle discard sections.
7623         (Sort_output_sections::operator()): Handle NOLOAD sections.
7624         * script-sections.h (Script_sections::Section_type): New enum type.
7625         (Script_sections::output_section_name): Add a new parameter for
7626         returning script section type.
7627         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7628         INFO and NOLOAD.
7629         * yyscript.y (union): Add new field SECTION_TYPE.
7630         (COPY, DSECT, INFO, NOLOAD): New tokens.
7631         (opt_address_and_section_type): Change type to output_section_header.
7632         (section_type): New non-terminal
7633         (section_header): Handle section type.
7634         (opt_address_and_section_type): Return section type value.
7635
7636 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7637
7638         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7639         * testsuite/plugin_common_test_2.c (foo): Likewise.
7640
7641 2010-04-08  Doug Kwan  <dougkwan@google.com>
7642
7643         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7644         Output_merge_data.
7645         * output.cc (Output_section::add_merge_input_section): Simplify
7646         code and return status of Output_merge_base::add_input_section.
7647         Update merge section map only if Output_merge_base::add_input_section
7648         returns true.
7649
7650 2010-04-07  Doug Kwan  <dougkwan@google.com>
7651
7652         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7653         if section is marked as containing instructions but has no mapping
7654         symbols.
7655         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7656         correct section index.
7657         (Arm_relobj::find_linked_text_section): Ditto.
7658
7659 2010-04-07  Cary Coutant  <ccoutant@google.com>
7660
7661         * archive.cc (include_member): Destroy Read_symbols_data object before
7662         releasing file.
7663         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7664         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7665         (Read_symbols_data::~Read_symbols_data) New destructor.
7666         (Section_relocs::Section_relocs) New constructor.
7667         (Section_relocs::~Section_relocs) New destructor.
7668         (Read_relocs_data::Read_relocs_data) New constructor.
7669         (Read_relocs_data::~Read_relocs_data) New destructor.
7670         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7671         pointers to NULL after deleting.
7672
7673 2010-04-07  Doug Kwan  <dougkwan@google.com>
7674
7675         * arm.cc: Replace "endianity" with "endianness" in comments.
7676         (Arm_exidx_cantunwind): Ditto.
7677         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7678         (Arm_relobj::merge_flags_and_attributes): New method.
7679         (Arm_relobj::merge_flags_and_attributes_): New data member.
7680         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7681         (Arm_relobj::scan_sections_for_stubs): Ditto.
7682         (Arm_relobj::do_read_symbols): Check to see if we really want to
7683         merge processor-specific flags and attributes.  Exit early if
7684         an object is empty except for section names and the undefined symbol.
7685         (Target_arm::do_finalize_sections): Move check for ELF format to
7686         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7687         attributes from a regular object only when we have determined that
7688         it is aapropriate.  Do not create an .ARM.attributes section in
7689         output if there is no regular input object.
7690         (Target_arm::merge_processor_specific_flags): Check
7691         --warn-mismatch before printing any error.
7692         (Target_arm::merge_object_attributes): Ditto.
7693         * gold.cc (queue_middle_tasks): Handle the case in which there is
7694         no regular object in input.
7695         * options.cc (General_options::parse_EB): New method.
7696         (General_options::parse_EL): Same.
7697         (General_options::General_options): Initialize endianness_.
7698         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7699         New options.
7700         (General_options::Endianness): New enum.
7701         (General_options::endianness): New method.
7702         (General_options::endianness_): New data member.
7703         * parameters.cc (Parameters::set_options): Check target endianness.
7704         (Parameters::set_target_once): Ditto.
7705         (Parameters::check_target_endianness): New method.
7706         (parameters_force_valid_target): If either -EL or -EB is specified,
7707         use it to define endianness of default target.
7708         * parameters.h (Parameters::check_target_endianness): New method
7709         declaration.
7710         * target.h (class Target): Change "endianity" to "endianness"
7711         in comments.
7712
7713 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7714
7715         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7716         * configure: Regenerate.
7717         * Makefile.in: Regenerate.
7718         * testsuite/Makefile.in: Regenerate.
7719
7720 2010-04-06  Cary Coutant  <ccoutant@google.com>
7721
7722         gcc PR lto/42757
7723         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7724         prevailing definitions of common symbols.
7725         * testsuite/plugin_test_6.sh: New test case.
7726         * testsuite/plugin_common_test_1.c: New test case.
7727         * testsuite/plugin_common_test_2.c: New test case.
7728         * testsuite/Makefile.am (plugin_test_6): New test case.
7729         * testsuite/Makefile.in: Regenerate.
7730
7731 2010-04-06  Nick Clifton  <nickc@redhat.com>
7732
7733         * po/vi.po: New Vietnamese translation.
7734
7735 2010-03-30  Doug Kwan  <dougkwan@google.com>
7736
7737         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7738
7739 2010-03-25  Doug Kwan  <dougkwan@google.com>
7740
7741         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7742         to avoid a conversion warning on a 32-bit host.
7743
7744 2010-03-24  Ian Lance Taylor  <iant@google.com>
7745
7746         * testsuite/script_test_3.t: Add a TLS segment.
7747         * testsuite/Makefile.am (check_PROGRAMS): Add
7748         tls_phdrs_script_test.
7749         (tls_phdrs_script_test_SOURCES): Define.
7750         (tls_phdrs_script_test_DEPENDENCIES): Define.
7751         (tls_phdrs_script_test_LDFLAGS): Define.
7752         (tls_phdrs_script_test_LDADD): Define.
7753         * testsuite/Makefile.in: Rebuild.
7754
7755 2010-03-23  Cary Coutant  <ccoutant@google.com>
7756
7757         * fileread.cc (find_or_make_view): Fix comment.
7758
7759 2010-03-23  Ian Lance Taylor  <iant@google.com>
7760
7761         * script-sections.cc (class Orphan_section_placement): Define
7762         PLACE_TLS and PLACE_TLS_BSS.
7763         (Orphan_section_placement::Orphan_section_placement): Initialize
7764         new places.
7765         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7766         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7767         (tls_script_test_SOURCES): Define.
7768         (tls_script_test_DEPENDENCIES): Define.
7769         (tls_script_test_LDFLAGS): Define.
7770         (tls_script_test_LDADD): Define.
7771         * testsuite/Makefile.in: Rebuild.
7772
7773 2010-03-22  Doug Kwan  <dougkwan@google.com>
7774
7775         * arm.cc (Arm_relocate_functions::abs8,
7776         Arm_relocate_functions::abs16): Use correct check for overflow
7777         specified in the ARM ELF specs.
7778         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7779         target of a BLX instruction specially.
7780         (Reloc_stub::stub_type_for_reloc): Ditto.
7781         (Relocate::relocate): Use symbolic names instead of numeric relocation
7782         codes to report error.
7783         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7784         workaround.
7785         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7786         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7787         thumb2_blx_out_of_range.stdout
7788         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7789         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7790         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7791         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7792         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7793         thumb2_blx_in_range, thumb2_blx_in_range.o,
7794         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7795         thumb2_blx_out_of_range.o): New rules.
7796         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7797         thumb2_blx_in_range and thumb2_blx_out_of_range.
7798         * testsuite/Makefile.in: Regenerate.
7799         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7800         * testsuite/thumb_blx_in_range.s: New file.
7801         * testsuite/thumb_blx_out_of_range.s: New file.
7802
7803 2010-03-22  Rafael Espindola  <espindola@google.com>
7804
7805         * archive.cc (Should_include): Move to archive.h.
7806         (should_include_member): Make it a member of Archive.
7807         (Lib_group): New.
7808         (Add_lib_group_symbols): New.
7809         * archive.h: Include options.h.
7810         (Archive_member): Moved from Archive.
7811         (Should_include): Moved from archive.cc.
7812         (Lib_group): New.
7813         (Add_lib_group_symbols): New.
7814         * dynobj.cc (do_should_include_member): New.
7815         * dynobj.h (do_should_include_member): New.
7816         * gold.cc (queue_initial_tasks): Update call to queue.
7817         * main.cc (main): Print lib group stats.
7818         * object.cc (do_should_include_member): New.
7819         * object.h: Include archive.h.
7820         (Object::should_include_member): New.
7821         (Object::do_should_include_member): New.
7822         (Sized_relobj::do_should_include_member): New.
7823         * options.cc (General_options::parse_start_lib): New.
7824         (General_options::parse_end_lib): New.
7825         (Input_arguments::add_file): Handle lib groups.
7826         (Input_arguments::start_group): Check we are not in a lib.
7827         (Input_arguments::start_lib): New.
7828         (Input_arguments::end_lib): New.
7829         * options.h (General_options): Add start_lib and end_lib.
7830         (Input_argument::lib_): New.
7831         (Input_argument::lib): New.
7832         (Input_argument::is_lib): New.
7833         (Input_file_lib): New.
7834         (Input_arguments::in_lib_): New.
7835         (Input_arguments::in_lib): New.
7836         (Input_arguments::start_lib): New.
7837         (Input_arguments::end_lib_): New.
7838         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7839         in unused members as preempted.
7840         (Sized_pluginobj::do_should_include_member): New.
7841         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7842         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7843         return the blocker.
7844         (Read_symbols::do_whole_lib_group): New.
7845         (Read_symbols::do_lib_group): New.
7846         (Read_symbols::do_read_symbols): Handle lib groups.
7847         (Read_symbols::get_name): Handle lib groups.
7848         * readsyms.h (Read_symbols): Add an archive member pointer.
7849         (Read_symbols::do_whole_lib_group): New.
7850         (Read_symbols::do_lib_group): New.
7851         (Read_symbols::member_): New.
7852         * script.cc (read_input_script): Update call to queue_soon.
7853
7854 2010-03-19  Doug Kwan  <dougkwan@google.com>
7855
7856         * arm.cc (Stub_table::Stub_table): Initialize new data members
7857         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7858         (Stub_table::add_reloc_stub): Assign stub offset and update
7859         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7860         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7861         New data members.
7862         (Stub_table::update_data_size_and_addralign): Use
7863         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7864         instead of going over all reloc stubs.
7865         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7866         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7867         Stringpool_template::offset_ to size of Stringpool_char.
7868         (Stringpool_template::new_key_offset): Remove code to initialize
7869         Stringpool_template::offset_.
7870         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7871         Stringpool_template::offset_ to zero.
7872
7873 2010-03-15  Doug Kwan  <dougkwan@google.com>
7874
7875         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7876         offset_.
7877         (Stringpool_template::new_key_offset): New method.
7878         (Stringpool_template::add_string): Assign offsets when adding new
7879         strings.
7880         (Stringpool_template::set_string_offsets): Do not set string offsets
7881         when not optimizing.
7882         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7883         member size_.
7884         (Chunked_vector::clear): Clear size_.
7885         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7886         (Chunked_vector::size): Return size_.
7887         (Chunked_vector::push_back): Use size_ to find insert position.
7888         (Chunked_vector::size_): New data member.
7889         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7890         (Stringpool_template::new_key_offset): New method declaration.
7891         (Stringpool_template::offset_): New data member.
7892
7893 2010-03-15   Rafael Espindola  <espindola@google.com>
7894
7895         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7896         Add_symbols' constructor.
7897         * readsyms.h (Add_symbols): Remove the input_group member.
7898
7899 2010-03-10  Ian Lance Taylor  <iant@google.com>
7900
7901         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7902         target to ask whether a reference to a symbol requires a stack
7903         split.
7904         * target.h (Target::is_call_to_non_split): New function.
7905         (Target::do_is_call_to_non_split): Declare virtual function.
7906         * target.cc: Include "symtab.h".
7907         (Target::do_is_call_to_non_split): New function.
7908         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7909
7910 2010-03-10  Cary Coutant  <ccoutant@google.com>
7911
7912         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7913         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7914         (File_read::open[2]): Add whole_file_view_ to list of views.
7915         (File_read::make_view): Remove test of whole_file_view_.
7916         (File_read::find_or_make_view): Create whole_file_view_ if
7917         necessary.
7918         (File_read::clear_views): Replace bool parameter with enum;
7919         adjust all callers.  Don't delete views with permanent data;
7920         do delete cached views and views from archives if
7921         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7922         if clearing the corresponding view.
7923         * fileread.h (File_read::Clear_views_mode): New enum.
7924         (File_read::View::is_permanent_view): New method.
7925         (File_read::clear_views): Replace bool parameter
7926         with enum; adjust all callers.
7927         * options.h (General_options): Change keep_files_mapped option;
7928         add map_whole_files.
7929         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7930         releasing the file.
7931         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7932         the file.
7933
7934 2010-03-10  David S. Miller  <davem@davemloft.net>
7935
7936         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7937
7938 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7939
7940         * icf.cc (get_section_contents): Add '@' marker after processing the
7941         merge reloc.
7942
7943 2010-03-08  Doug Kwan  <dougkwan@google.com>
7944
7945         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7946         due to a conversion warning.
7947         (Arm_relobj::update_output_local_symbol_count): Check for local
7948         symbol with unset output index.
7949
7950 2010-03-05  Ian Lance Taylor  <iant@google.com>
7951
7952         * options.h (class General_options): Add --spare-dynamic-tags.
7953         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7954         --spare-dynamic-tags.
7955
7956 2010-03-05  Ian Lance Taylor  <iant@google.com>
7957
7958         * incremental.cc: Include "libiberty.h".
7959
7960 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7961
7962         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7963         function, is_info_ member.
7964         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7965         (Versions::Versions): Update caller.
7966         (Versions::define_base_version): Likewise.
7967         (Versions::add_def): Likewise.
7968
7969 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7970
7971         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7972         (Scan::possible_function_pointer_reloc): New function.
7973         (Scan::local_reloc_may_be_function_pointer): Change to call
7974         possible_function_pointer_reloc.
7975         (Scan::global_reloc_may_be_function_pointer): Ditto.
7976         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7977         relocations in ".data.rel.ro._ZTV" section.
7978         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7979         * testsuite/icf_safe_so_test.cc: Ditto.
7980         * testsuite/icf_safe_test.cc: Ditto.
7981         * testsuite/icf_safe_test.sh: Ditto.
7982
7983 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7984             Ian Lance Taylor  <iant@google.com>
7985
7986         * target-reloc.h (relocate_section): Check the symbol table index
7987         for -1U before setting the local symbol index.
7988         (scan_relocatable_relocs): If copying the relocation, record that
7989         the local symbol is required.
7990         * object.h (Symbol_value::is_output_symtab_index_set): New
7991         function.
7992         (Symbol_value::may_be_discarded_from_output_symtab): New
7993         function.
7994         (Symbol_value::has_output_symtab_entry): New function.
7995         (Symbol_value::needs_output_symtab_entry): Remove.
7996         (Symbol_value::output_symtab_index): Make sure the symbol index is
7997         set.
7998         (Symbol_value::set_output_symtab_index): Make sure the symbol
7999         index is not set.  Make sure the new index is valid.
8000         (Symbol_value::set_must_have_output_symtab_entry): New function.
8001         (Symbol_value::has_output_dynsym_entry): New function.
8002         (Symbol_value::set_output_dynsym_index): Make sure the new index
8003         is valid.
8004         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8005         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8006         local symbol if permitted.
8007         (Sized_relobj::do_finalize_local_symbols): Call
8008         is_output_symtab_index_set rather than needs_output_symtab_entry.
8009         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8010         rather than needs_output_symtab_entry.  Call
8011         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8012         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8013         is_output_symtab_index_set rather than needs_output_symtab_entry.
8014         * testsuite/discard_locals_relocatable_test.c: New file.
8015         * testsuite/discard_locals_test.sh: Test -r.
8016         * testsuite/Makefile.am (check_DATA): Add
8017         discard_locals_relocatable_test1.syms,
8018         discard_local_relocatable_test2.syms.
8019         (MOSTLYCLEANFILES): Likewise.  Also add
8020         discard_locals_relocatable_test1.lout and
8021         discard_locals_relocatable_test2.out.
8022         (discard_locals_relocatable_test1.syms): New target.
8023         (discard_locals_relocatable_test.o): New target.
8024         (discard_locals_relocatable_test1.out): New target.
8025         (discard_locals_relocatable_test2.syms): New target.
8026         (discard_locals_relocatable_test2.out): New target.
8027         (various): Add missing ../ld-new dependencies.
8028         * testsuite/Makefile.in: Rebuild.
8029
8030 2010-03-03  Nick Clifton  <nickc@redhat.com>
8031
8032         * po/fi.po: New Finnish translation.
8033
8034 2010-03-01  Doug Kwan  <dougkwan@google.com>
8035
8036         * layout.cc (Layout::Layout): Force section types of .init_array*,
8037         .preinit_array* and .fini_array* sections.
8038         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8039         Fix check of return value of std::string::find.().
8040         (Output_section::Input_section_sort_compare::operator()): Remove
8041         comment about .init_array.
8042         (Output_section::Input_section_sort_init_fini_compare::operator()):
8043         New method.
8044         (Output_section::sort_attached_input_sections): Handle .init_array
8045         and .fini_array specially.
8046         * output.h (Output_section::Inut_section_sort_compare): Update
8047         comment.
8048         (Output_section::Input_section_sort_init_fini_compare): New struct.
8049
8050 2010-02-26  Doug Kwan  <dougkwan@google.com>
8051
8052         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8053         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8054         * testsuite/debug_msg.sh: Avoid matching source line number for
8055         use of global variable undef_int.
8056
8057 2010-02-26  Doug Kwan  <dougkwan@google.com>
8058
8059         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8060         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8061         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8062         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8063         * options.cc (General_options::General_options): Initialize member
8064         fix_v4bx_.
8065         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8066         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8067         and rm_no_fix_v4bx.stdout
8068         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8069         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8070         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8071         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8072         and arm_no_fix_v4bx.
8073         * Makefile.in: Regenerate.
8074         * testsuite/arm_fix_v4bx.s: New file.
8075         * testsuite/arm_fix_v4bx.sh: Ditto.
8076
8077 2010-02-24  Doug Kwan  <dougkwan@google.com>
8078
8079         * arm.cc (Target_arm::got_section): Make the .got section the first
8080         non RELRO section in the data segment.
8081         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8082         suffixes of section names.
8083
8084 2010-02-24  Doug Kwan  <dougkwan@google.com>
8085
8086         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8087         flags and attributes merging if an input file is a binary file.
8088         * fileread.cc (Input_file::open): Record format of original file.
8089         * fileread.h (Input_file::Format): New enum type.
8090         (Input_file::Input_file): Initialize data member format_.
8091         (Input_file::format): New method definition.
8092         (Input_file::format_):: New data member.
8093
8094 2010-02-24  Doug Kwan  <dougkwan@google.com>
8095
8096         * arm.cc (Arm_output_data_got): New class.
8097         (ARM_TCB_SIZE): New constant
8098         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8099         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8100         If user uses a script with a SECTIONS clause, issue only a warning
8101         for a misplaced EXIDX input section.  Otherwise, issue an error.
8102         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8103         garbage collection.
8104         (Target_arm::got_mode_index_entry): Handle static linking.
8105         (Target_arm::Scan::local): Ditto.
8106         (Target_arm::Scan::global): Ditto.
8107         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8108         all incorrectly implemented relocations.
8109         (Target_arm::fix_exidx_coverage): Pass layout to
8110         Arm_output_section::fix_exidx_coverage.
8111         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8112         from ".ARM.exidx." and ".ARM.extab.".
8113
8114 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8115
8116         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8117         section if it does not already exist.
8118         * attributes.cc (Attributes_section_data::Attributes_section_data):
8119         Don't crash if size is zero.
8120
8121 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8122             Ian Lance Taylor  <iant@google.com>
8123
8124         * gold.cc (queue_middle_tasks): If no input files were opened,
8125         exit.
8126         * workqueue.h (Task_function::Task_function): Assert that there is
8127         a blocker.
8128
8129 2010-02-22  Doug Kwan  <dougkwan@google.com>
8130
8131         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8132         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8133         types to avoid warnings due to different uint64_t implementations
8134         on different hosts.
8135
8136 2010-02-21  Doug Kwan  <dougkwan@google.com>
8137
8138         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8139         handling of the maximum backward branch offset.
8140         (Arm_relocate_functions::thumb_branch_common): Ditto.
8141         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8142         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8143         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8144         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8145         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8146         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8147         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8148         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8149         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8150         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8151         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8152         thumb2_bl_out_of_range.o): New rules.
8153         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8154         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8155         thumb2_bl_out_of_range
8156         * testsuite/Makefile.in: Regenerate.
8157         * testsuite/arm_bl_in_range.s: New file.
8158         * testsuite/arm_bl_out_of_range.s: Ditto.
8159         * testsuite/arm_branch_in_range.sh: Ditto.
8160         * testsuite/arm_branch_range.t: Ditto.
8161         * testsuite/thumb2_branch_range.t: Ditto.
8162         * testsuite/thumb_bl_in_range.s: Ditto.
8163         * testsuite/thumb_bl_out_of_range.s: Ditto.
8164         * testsuite/thumb_branch_range.t: Ditto.
8165
8166 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8167
8168         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8169         Add reloc offset information.
8170         * icf.cc (get_section_contents): Change iterators to point to the new
8171         vectors. Add reloc offset information to the contents.
8172         * icf.h (Icf::Sections_reachable_info): New typedef.
8173         (Icf::Sections_reachable_list): New typedef.
8174         (Icf::Offset_info): New typedef.
8175         (Icf::Reloc_info): New struct typedef.
8176         (Icf::Reloc_info_list): New typedef.
8177         (Icf::symbol_reloc_list): Delete method.
8178         (Icf::addend_reloc_list): Delete method.
8179         (Icf::section_reloc_list): Delete method.
8180         (Icf::reloc_info_list): New method.
8181         (Icf::reloc_info_list_): New member.
8182
8183 2010-02-19  Doug Kwan  <dougkwan@google.com>
8184
8185         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8186         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8187         * arm.cc (Arm_relocation_functions): New forward declaration.
8188         (Target_arm::Target_arm): Initialize new data members
8189         got_mod_index_offset_ and tls_base_symbol_defined_.
8190         (Target_arm::Relocate::relocate_tls): New method.
8191         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8192          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8193         New methods.
8194         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8195         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8196         (Target_arm::got_mod_index_offset_,
8197         Target_arm::tls_base_symbol_defined_): New data members.
8198         (Target_arm::Scan::local, Target::Scan::global,
8199         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8200         relocations.
8201
8202 2010-02-18  Doug Kwan  <dougkwan@google.com>
8203
8204         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8205         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8206         text section as a parameter becuase some broken tools may not set
8207         the link in section header.
8208         (Target_arm::has_got_section): New method.
8209         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8210         without any mapping symbol as data only.  Remove warning.
8211         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8212         link in its section header, try to discover the link by inspecting the
8213         REL31 relocation at the beginning of the section.
8214         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8215         in error message.
8216         (Target_arm::Scan::global): Treat any reference to the symbol
8217         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8218
8219 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8220
8221         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8222         (Scan::global_reloc_may_be_function_pointer): New function.
8223         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8224         (Scan::global_reloc_may_be_function_pointer): New function.
8225         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8226         (Scan::global_reloc_may_be_function_pointer): New function.
8227         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8228         (Scan::global_reloc_may_be_function_pointer): New function.
8229         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8230         (Scan::global_reloc_may_be_function_pointer): New function.
8231         (Scan::possible_function_pointer_reloc): New function.
8232         (Target_x86_64::can_check_for_function_pointers): New function.
8233         * gc.h (gc_process_relocs): Scan relocation types to determine if
8234         function pointers were taken for targets that support it.
8235         * icf.cc (Icf::find_identical_sections): Include functions for
8236         folding in safe ICF whose pointer is not taken.
8237         * icf.h (Secn_fptr_taken_set): New typedef.
8238         (fptr_section_id_): New member.
8239         (section_has_function_pointers): New function.
8240         (set_section_has_function_pointers): New function.
8241         (check_section_for_function_pointers): New function.
8242         * options.h: Fix comment for safe ICF option.
8243         * target.h (can_check_for_function_pointers): New function.
8244         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8245         Modify icf_safe_test for X86-64.
8246         * testsuite/Makefile.in: Regenerate.
8247         * testsuite/icf_safe_so_test.cc: New file.
8248         * testsuite/icf_safe_so_test.sh: New file.
8249         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8250         (main): Change to take pointer to function kept_func_3.
8251         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8252         folding is done correctly for X86-64.
8253
8254 2010-02-12  David S. Miller  <davem@davemloft.net>
8255
8256         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8257         is_symbolless parameter.
8258         (Output_reloc<SHT_REL>::is_symbolless): New.
8259         (Output_reloc<SHT_REL>::is_symbolless_): New.
8260         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8261         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8262         (Output_reloc<SHT_RELA>::is_symbolless): New.
8263         (Output_data_reloc::add_global): Handle is_symbolless.
8264         (Output_data_reloc::add_global_relative): Likewise.
8265         (Output_data_reloc::add_local): Likewise.
8266         (Output_data_reloc::add_local_relative): Likewise.
8267         (Output_data_reloc::add_symbolless_global_addend): New.
8268         (Output_data_reloc::add_symbolless_local_addend): New.
8269         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8270         is_symbolless.
8271         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8272         instead of ->is_relative_
8273         (Output_reloc::write): Likewise.
8274         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8275         (Output_reloc::write_rel): Simplify.
8276
8277         * sparc.cc (Target_sparc::Scan::local): Use
8278         ->add_symbolless_local_addend as needed.
8279         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8280         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8281         based upon relocation offset.
8282
8283 2010-02-11  Doug Kwan  <dougkwan@google.com>
8284
8285         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8286         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8287         beginning of function.
8288         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8289         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8290         parameter is_32bit in calls to should_apply_static_reloc.
8291         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8292         (check_DATA): Add arm_abs_global.stdout.
8293         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8294         arm_abs_global.stdout): New rules.
8295         (MOSTLLYCLEANFILES): Add arm_abs_global
8296         * Makefile.in: Regenerate.
8297         * testsuite/arm_abs_global.s: New file.
8298         * testsuite/arm_abs_global.sh: Ditto.
8299         * testsuite/arm_abs_lib.s: Ditto.
8300
8301 2010-02-11  Ian Lance Taylor  <iant@google.com>
8302
8303         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8304         Read_relocs task.
8305         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8306         Allocate_commons_task first.
8307         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8308         task, rather than symtab_lock_.
8309         (Gc_process_relocs::~Gc_process_relocs): New function.
8310         (Gc_process_relocs::is_runnable): Check this_blocker_.
8311         (Gc_process_relocs::locks): Use next_blocker_ rather than
8312         blocker_.
8313         (Scan_relocs::~Scan_relocs): New function.
8314         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8315         symtab_lock_.
8316         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8317         next_blocker_.
8318         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8319         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8320         constructor accordingly.
8321         (class Gc_process_relocs): Likewise.
8322         (class Scan_relocs): Likewise.
8323         * common.h (class Allocate_commons_task): Remove symtab_lock_
8324         field, and corresponding constructor parameter.
8325         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8326         symtab_lock_.
8327         (Allocate_commons_task::locks): Likewise.
8328
8329 2010-02-11  Ian Lance Taylor  <iant@google.com>
8330
8331         * gold-threads.h (class Once): Define.
8332         (class Initialize_lock): Rewrite as child of Once.
8333         * gold-threads.cc (class Once_initialize): Define.
8334         (once_pointer_control): New static variable.
8335         (once_pointer, once_arg): New static variables.
8336         (c_run_once): New static function.
8337         (Once::Once, Once::run_once, Once::internal_run): New functions.
8338         (class Initialize_lock_once): Remove.
8339         (initialize_lock_control): Remove.
8340         (initialize_lock_pointer): Remove.
8341         (initialize_lock_once): Remove.
8342         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8343         (Initialize_lock::initialize): Rewrite.
8344         (Initialize_lock::do_run_once): New function.
8345         * archive.cc (Archive::interpret_header): Only clear name if it is
8346         not already empty.
8347         * fileread.cc: Include "gold-threads.h"
8348         (file_counts_lock): New static variable.
8349         (file_counts_initialize_lock): Likewise.
8350         (File_read::release): Only increment counts when using --stats.
8351         Use a lock around the increment.
8352         * parameters.cc (class Set_parameters_target_once): Define.
8353         (set_parameters_target_once): New static variable.
8354         (Parameters::Parameters): Move here from parameters.h.
8355         (Parameters::set_target): Rewrite.
8356         (Parameters::set_target_once): New function.
8357         (Parameters::clear_target): Move here and rewrite.
8358         * parameters.h (class Parameters): Update declarations.  Add
8359         set_parameters_target_once_ field.
8360         (Parameters::Parameters): Move to parameters.cc.
8361         (Parameters::clear_target): Likewise.
8362         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8363         task.
8364         (Start_group::~Start_group): New function.
8365         (Start_group::is_runnable): New function.
8366         (Start_group::locks, Start_group::run): New functions.
8367         (Finish_group::run): Change saw_undefined to size_t.
8368         * readsyms.h (class Start_group): Define.
8369         (class Finish_group): Change saw_undefined_ field to size_t.
8370         (Finish_group::Finish_group): Remove saw_undefined and
8371         this_blocker parameters.  Change all callers.
8372         (Finish_group::set_saw_undefined): New function.
8373         (Finish_group::set_blocker): New function.
8374         * symtab.h (class Symbol_table): Change saw_undefined to return
8375         size_t.  Change saw_undefined_ field to size_t.
8376         * target-select.cc (Set_target_once::do_run_once): New function.
8377         (Target_selector::Target_selector): Initialize set_target_once_
8378         field.  Don't initialize lock_ and initialize_lock_ fields.
8379         (Target_selector::instantiate_target): Rewrite.
8380         (Target_selector::set_target): New function.
8381         * target-select.h (class Set_target_once): Define.
8382         (class Target_selector): Update declarations.  Make
8383         Set_target_once a friend.  Remove lock_ and initialize_lock_
8384         fields.  Add set_target_once_ field.
8385
8386 2010-02-10  Ian Lance Taylor  <iant@google.com>
8387
8388         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8389         queueing any tasks.
8390         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8391         (queue_middle_tasks): Add all blockers before queueing any tasks.
8392         (queue_final_tasks): Likewise.
8393         * token.h (Task_token::add_blockers): New function.
8394         * object.h (Input_objects::number_of_relobjs): New function.
8395
8396 2010-02-10  Ian Lance Taylor  <iant@google.com>
8397
8398         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8399         shared, not if not position independent.
8400         * x86_64.cc (Relocate::relocate_tls): Likewise.
8401         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8402         (tls_pie_pic_test): New target.
8403         * testsuite/Makefile.in: Rebuild.
8404
8405         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8406         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8407         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8408         * testsuite/Makefile.in: Rebuild.
8409
8410 2010-02-09  David S. Miller  <davem@davemloft.net>
8411
8412         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8413         R_SPARC_RELATIVE using ->add_local_relative().
8414         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8415
8416         * output.h (Output_data_dynamic::add_section_size): New method
8417         that takes two Output_data objects.
8418         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8419         entry param.  Handle it in initializers.
8420         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8421         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8422         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8423         arg.
8424         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8425         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8426         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8427         for dynrel_includes_plt.
8428         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8429         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8430         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8431         before .rela.plt
8432         (Target_sparc::do_finalize_sections): Update to pass true for
8433         dynrel_includes_plt.
8434         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8435         output before .rela.plt
8436         (Target_powerpc::do_finalize_sections): Update to pass true for
8437         dynrel_includes_plt when 32-bit.
8438
8439 2010-02-08  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8442         method.
8443         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8444         Arm_relobj::scan_section_for_cortex_a8_stubs,
8445         Arm_relobj::do_relocation_section): Instead of calling
8446         Output_section::output_address, use faster
8447         Arm_relobj::simple_input_section_output_address.
8448
8449 2010-02-08  David S. Miller  <davem@davemloft.net>
8450
8451         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8452         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8453         relocation helper function.
8454
8455         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8456         just like R_SPARC_GOT{10,13,22}.
8457         (Target_sparc::Scan::local): Likewise.
8458         (Target_sparc::Relocate:relocate): Likewise.
8459
8460 2010-02-06  Ian Lance Taylor  <iant@google.com>
8461
8462         * configure.ac: Rewrite targetobjs duplicate removal code to use
8463         only shell constructs.
8464         * configure: Rebuild.
8465
8466 2010-02-05  Doug Kwan  <dougkwan@google.com>
8467
8468         PR 11247
8469         * arm.cc (Arm_relobj::section_is_scannable): New method.
8470         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8471         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8472
8473 2010-02-04  Doug Kwan  <dougkwan@google.com>
8474
8475         PR 11247
8476         * arm-reloc-property.cc (cstdio): Include.
8477         * configure.ac (targetobjs): Remove duplicates.
8478         * configure: Regenerate.
8479         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8480         big and little endian version for a given address size.
8481
8482 2010-02-03  Doug Kwan  <dougkwan@google.com>
8483
8484         * arm-reloc-property.cc
8485         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8486         definition.
8487         * arm-reloc-property.h
8488         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8489         New method definition.
8490         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8491         declaration.
8492         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8493         overflow to N.
8494         (GOT_PREL): Change implemented to Y.
8495         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8496         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8497         (Arm_relocate_functions::movw_abs_nc): Remove method.
8498         (Arm_relocate_functions::movt_abs): Ditto.
8499         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8500         (Arm_relocate_functions::thm_movt_abs): Ditto.
8501         (Arm_relocate_functions::movw_rel_nc): Ditto.
8502         (Arm_relocate_functions::movw_rel): Ditto.
8503         (Arm_relocate_functions::movt_rel): Ditto.
8504         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8505         (Arm_relocate_functions:thm_movw_rel): Ditto.
8506         (Arm_relocate_functions:thm_movt_rel): Ditto.
8507         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8508         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8509         New method definitions.
8510         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8511         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8512         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8513         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8514         (Target_arm::Relocate::relocate): Check for non-static or
8515         unimplemented relocation code and exit early.  Change calls to
8516         Target_arm::reloc_uses_thumb_bit and
8517         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8518         instead.  Refactor code to handle similar relocations to increase
8519         code sharing.  Remove check for unsupported relocation code in switch
8520         statement.
8521         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8522         relocation property table to find out size.  Change error message to
8523         print out the name of a relocation code instead of the numeric value.
8524         (Target_arm::scan_reloc_for_stub): Use relocation property table
8525         instead of calling Target_arm::reloc_uses_thumb_bit().
8526
8527 2010-02-02  Doug Kwan  <dougkwan@google.com>
8528
8529         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8530         types of relaxed input section.
8531
8532 2010-02-02  Doug Kwan  <dougkwan@google.com>
8533
8534         * Makefile.am (HFILES): Add arm-reloc-property.h.
8535         (DEFFILES): New.
8536         (TARGETSOURCES): Add arm-reloc-property.cc
8537         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8538         (libgold_a_SOURCES): $(DEFFILES)
8539         * Makefile.in: Regenerate.
8540         * arm-reloc-property.cc: New file.
8541         * arm-reloc-property.h: New file.
8542         * arm-reloc.def: New file.
8543         * arm.cc: Update comments.
8544         (arm-reloc-property.h): New included header.
8545         (arm_reloc_property_table): New global variable.
8546         (Target_arm::do_select_as_default_target): New method definition.
8547         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8548         arm-reloc-property to targ_extra_obj.
8549         * parameters.cc (set_parameters_target): Call
8550         Target::select_as_default_target().
8551         * target.h (Target::select_as_default_target): New method definition.
8552         (Target::do_select_as_default_target): Same.
8553
8554 2010-02-01  Doug Kwan  <dougkwan@google.com>
8555
8556         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8557         first_output_text_section_.
8558         (Arm_exidx_fixup::first_output_text_section): New method definition.
8559         (Arm_exidx_fixup::first_output_text_section_): New data member.
8560         (Arm_exidx_fixup::process_exidx_section): Record the first text
8561         output section seen.
8562         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8563         and entsize in output section header.
8564
8565 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8566
8567         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8568         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8569         (Arm_relocate_functions::thm_alu11): New Method.
8570         (Arm_relocate_functions::thm_pc8): New Method.
8571         (Arm_relocate_functions::thm_pc12): New Method.
8572         (Target_arm::Scan::local): Handle the relocations.
8573         (Target_arm::Scan::global): Likewise.
8574         (Target_arm::Relocate::relocate): Likewise.
8575         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8576
8577 2010-01-29  Doug Kwan  <dougkwan@google.com>
8578
8579         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8580         of relocation types as ld.
8581
8582 2010-01-29  Doug Kwan  <dougkwan@google.com>
8583
8584         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8585         to public.
8586         (Arm_relocate_functions::thumb_branch_common): Ditto.
8587         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8588         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8589         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8590         Arm_relocate_functions::jump24): Remove.
8591         (Target_arm::Relocate::relocate): Adjust code to call
8592         Arm_relocation_functions::arm_branch_common and
8593         Arm_relocation_functions::thumb_branch_common instead of their removed
8594         wrappers.  Merge switch-cases together to reduce source code size.
8595
8596 2010-01-29  Doug Kwan  <dougkwan@google.com>
8597
8598         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8599         output_local_symbol_count_needs_update_.
8600         (Arm_relobj::output_local_symbol_count_needs_update,
8601          Arm_relobj::set_output_local_symbol_count_needs_update,
8602          Arm_relobj::update_output_local_symbol_count): New methods.
8603         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8604         member.
8605         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8606         of pointed function as in a R_ARM_PREL31 relocation.
8607         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8608         for output local symbol count updating.
8609         (Target_arm::do_relax): Update output local symbol counts in objects
8610         if necessary.
8611         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8612
8613 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8614
8615         * arm.cc: Added support for the ARM relocations:
8616         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8617         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8618         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8619         movw_prel_nc).
8620         (Arm_relocate_functions::movw_rel): New method.
8621         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8622         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8623         thm_movw_prel_nc).
8624         (Arm_relocate_functions::thm_movw_rel): New method.
8625         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8626         thm_movt_prel).
8627         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8628         relocations.
8629         (Target_arm::Scan::global): Likewise.
8630         (Target_arm::Relocate::relocate): Likewise.
8631         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8632         Likewise.
8633
8634 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8635
8636         * arm.cc: Added support for ARM group relocations.
8637         (Target_arm::reloc_needs_sym_origin): New method.
8638         (Arm_relocate_functions::calc_grp_kn): New method.
8639         (Arm_relocate_functions::calc_grp_residual): New method.
8640         (Arm_relocate_functions::calc_grp_gn): New method.
8641         (Arm_relocate_functions::arm_grp_alu): New Method.
8642         (Arm_relocate_functions::arm_grp_ldr): New Method.
8643         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8644         (Arm_relocate_functions::arm_grp_ldc): New Method.
8645         (Target_arm::Scan::local): Handle the ARM group relocations.
8646         (Target_arm::Scan::global): Likewise.
8647         (Target_arm::Relocate::relocate): Likewise.
8648         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8649         Likewise.
8650
8651 2010-01-26  Doug Kwan  <dougkwan@google.com>
8652
8653         * arm.cc (set): Include.
8654         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8655         pointer type.
8656         (Arm_output_section::Text_section_list): New type.
8657         (Arm_output_section::append_text_sections_to_list): New method.
8658         (Arm_output_section::fix_exidx_coverage): Ditto.
8659         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8660         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8661         Relobj::set_section_offset() instead of
8662         Sized_relobj::invalidate_section_offset().
8663         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8664         parameter for section headers. Ignore relocation sections for
8665         unallocated sections and EXIDX sections.
8666         (Target_arm::fix_exidx_coverage): New method.
8667         (Target_arm::output_section_address_less_than): New type.
8668         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8669         linked text section instead of the EXIDX section.
8670         (Arm_output_section::create_stub_group): Add an assertion to check
8671         that this is not an EXIDX output section.
8672         (Arm_output_section::append_text_sections_to_list): New method.
8673         (Arm_output_section::fix_exidx_coverage): Ditto.
8674         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8675         Arm_relobj::section_needs_reloc_stub_scanning.
8676         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8677         first pass.
8678         (Target_arm::fix_exidx_coverage): New method.
8679         * object.h (Relobj::set_output_section): New method.
8680         (Sized_relobj::invalidate_section_offset): Remove method.
8681         (Sized_relobj::do_invalidate_section_offset): Remove method.
8682         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8683
8684 2010-01-25  Doug Kwan  <dougkwan@google.com>
8685
8686         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8687         Fix warning due to signed and unsigned comparison on a 32-bit host.
8688
8689 2010-01-22  Doug Kwan  <dougkwan@google.com>
8690
8691         * arm.cc (Target_arm::do_relax): Record an output section for section
8692         offset adjustment it contains any stub table that has changed.
8693         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8694         offsets in an output section if necessary.
8695         * output.cc (Output_section::Output_section): Initialize
8696         section_offsets_need_adjustments_.
8697         (Output_section::add_input_section_for_script): Renamed to
8698         Output_section::add_simple_input_section.
8699         (Output_section::save_states): Add a comment.
8700         (Output_section::discard_states): New method defintion.
8701         (Output_section::adjust_section_offsets): Same.
8702         * output.h (Output_section::add_input_section_for_script): Renamed to
8703         Output_section::add_simple_input_section.
8704         (Output_section::discard_states): New method declaration.
8705         (Output_section::adjust_section_offsets): Same.
8706         (Output_section::section_offsets_need_adjustment,
8707         Output_section::set_section_offsets_need_adjustment): New method
8708         definitions.
8709         (Output_section::section_offsets_need_adjustment_): New data member.
8710         * script-sections.cc
8711         (Output_section_element_input::set_section_address): Adjust code for
8712         renaming of Output_section::add_input_section_for_script.
8713         (Orphan_output_section::set_section_address): Same.
8714
8715 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8716
8717         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8718         Fix_v4bx enum values .
8719         * gold/options.h (General_options): New option definitions.
8720         (General_options::fix_v4bx): New method.
8721         (General_options::Fix_v4bx): New enum.
8722         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8723         (General_options::parse_fix_v4bx_interworking): New method.
8724
8725 2010-01-22  Doug Kwan  <dougkwan@google.com>
8726
8727         * arm.cc (Arm_exidx_fixup): New class.
8728
8729 2010-01-21  Doug Kwan  <dougkwan@google.com>
8730
8731         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8732         classes.
8733         (Arm_exidx_section_offset_map): New type.
8734
8735 2010-01-21  Doug Kwan  <dougkwan@google.com>
8736
8737         * arm.cc (Arm_exidx_input_section): New class.
8738         (Arm_relobj::exidx_input_section_by_link,
8739         Arm_relobj::exidx_input_section_by_shndx,
8740         Arm_relobj::make_exidx_input_section): New methods.
8741         (read_arm_attributes_section): Remove.
8742         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8743         information about them.
8744         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8745         to here.
8746
8747 2010-01-20  Doug Kwan  <dougkwan@google.com>
8748
8749         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8750         Input_section_specifier to Section_id.
8751         (Target_arm::new_arm_input_section: Adjust code for change of key
8752         type.
8753         (Target_arm::find_arm_input_section): Ditto.
8754         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8755         (Section_id): Remove.
8756         (Garbage_collection::Section_id_hash): Remove.
8757         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8758         (Section_id): Remove.
8759         (Icf::Section_id_hash): Remove.
8760         * object.h (Section_id, Const_section_id, Section_id_hash,
8761         Const_section_id_hash): New type definitions.
8762         * output.cc (Output_section::add_relaxed_input_section): Change to
8763         use Const_section_id instead of Input_section_specifier as key type.
8764         (Output_section::add_merge_input_section): Ditto.
8765         (Output_section::build_relaxation_map): Change to use Section_id
8766         instead of Input_section_specifier as key type.
8767         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8768         Ditto.
8769         (Output_section::convert_input_sections_to_relaxed_sections): Change
8770         to use Const_section_id instead of Input_section_specifier as key type.
8771         (Output_section::find_merge_section): Ditto.
8772         (Output_section::find_relaxed_input_section): Ditto.
8773         * output.h (Input_section_specifier): Remove class.
8774         (Output_section::Output_section_data_by_input_section_map): Change
8775         key type to Const_section_id.
8776         (Output_section::Output_relaxed_input_section_by_input_section_map):
8777         Ditto.
8778         (Output_section::Relaxation_map): Change key type to Section_id.
8779
8780 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8781
8782         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8783         (class Arm_v4bx_stub): New class.
8784         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8785         (Stub_factory::make_arm_v4bx_stub): New method.
8786         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8787         (Stub_table::empty): Handle v4bx stubs.
8788         (Stub_table::add_arm_v4bx_stub): New method.
8789         (Stub_table::find_arm_v4bx_stub): New method.
8790         (Arm_relocate_functions::v4bx): New method.
8791         (Target_arm::fix_v4bx): New method.
8792         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8793         (Stub_table::relocate_stubs): Likewise.
8794         (Stub_table::do_write): Likewise.
8795         (Stub_table::update_data_size_and_addralign): Likewise.
8796         (Stub_table::finalize_stubs):  Likewise.
8797         (Target_arm::Scan::local): Likewise.
8798         (Target_arm::Scan::global): Likewise.
8799         (Target_arm::do_finalize_sections): Likewise.
8800         (Target_arm::Relocate::relocate): Likewise.
8801         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8802         Likewise.
8803         (Target_arm::scan_reloc_for_stub): Likewise.
8804         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8805
8806 2010-01-19  Ian Lance Taylor  <iant@google.com>
8807
8808         * output.cc (Output_section_headers::do_sized_write): Write large
8809         segment count to sh_info field.
8810         (Output_file_header::do_sized_write): For large segment count,
8811         write PN_XNUM to e_phnum field.
8812
8813 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8814
8815         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8816         (Arm_relocate_functions::thm_jump8): New function.
8817         (Arm_relocate_functions::thm_jump11): New function.
8818         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8819         R_ARM_THM_JUMP11.
8820         (Target_arm::Scan::global): Likewise.
8821         (Target_arm::Relocate::relocate): Likewise.
8822         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8823         Likewise.
8824
8825 2010-01-14  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (map, utility): Include headers.
8828         (Target_arm::apply_cortex_a8_workaround): New method.
8829         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8830         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8831         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8832         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8833         the --[no-]fix-cortex-a8 command line options.
8834         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8835         (Target_arm::relocate_stub): Use addend in instruction template.
8836         * options.h (DEFINE_bool): Set the user-set flag.
8837         (General_options): Add --[no-]-fix-cortex options.
8838         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8839         : Update fast look-up map after conversion.
8840
8841 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8842
8843         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8844         in the first pass of do_layout.
8845
8846 2010-01-13  Doug Kwan  <dougkwan@google.com>
8847
8848         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8849         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8850         apparent compiler problem of not folding static constant integral
8851         data members of elfcpp::Elf_sizes<32>.
8852
8853 2010-01-13  Doug Kwan  <dougkwan@google.com>
8854
8855         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8856         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8857         Arm_relobj::scan_section_for_cortex_a8_erratum,
8858         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8859         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8860         sections to scan for relocation stubs into a new method
8861         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8862         relocation and Cortex-A8 stub scanning.
8863         (Target_arm::do_relax): Force stubs to be after stubbed sections
8864         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8865         the beginning of a new relaxation pass.  Update a comment.
8866         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8867
8868 2010-01-12  Ian Lance Taylor  <iant@google.com>
8869
8870         * target-reloc.h (visibility_error): New inline function.
8871         (relocate_section): Call visibility_error.
8872         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8873         (MOSTLYCLEANFILES): Likewise.
8874         (protected_4_pic.o, protected_3.err): New targets.
8875         * testsuite/protected_4.cc: New file.
8876
8877 2010-01-12  Doug Kwan  <dougkwan@google.com>
8878
8879         * arm.cc (Cortex_a8_reloc): New class.
8880         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8881         and cortex_a8_relocs_info_.
8882         (Target_arm::fix_cortex_a8): New method definition.
8883         (Target_arm::Cortex_a8_relocs_info): New type.
8884         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8885         New data member declarations.
8886         (Target_arm::scan_reloc_for_stub): Record information about
8887         relocations for THUMB branches that might be exempted from the
8888         Cortex-A8 workaround.
8889         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8890         at the beginning of a relaxation pass.
8891
8892 2010-01-12  Doug Kwan  <dougkwan@google.com>
8893
8894         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8895         (Arm_relobj::Mapping_symbol_position,
8896          Arm_reloj::Mapping_symbol_position_less,
8897          Arm_relobj::Mapping_symbols_info): New types.
8898         (Target_arm::is_mapping_symbol_name): New method definition.
8899         (Arm_relobj::do_count_local_symbols): Save information about mapping
8900         symbols.
8901
8902 2010-01-11  Doug Kwan  <dougkwan@google.com>
8903
8904         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8905         Arm_relocate_functions::thumb32_branch_upper,
8906         Arm_relocate_functions::thumb32_branch_lower,
8907         Arm_relocate_functions::thumb32_cond_branch_offset,
8908         Arm_relocate_functions::thumb32_cond_branch_upper,
8909         Arm_relocate_functions::thumb32_cond_branch_lower,
8910         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8911         branch offset encoding.
8912         (Arm_relocate_functions::thumb_branch_common): Use new branch
8913         offset encoding methods to avoid code duplication.
8914         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8915         (Stub_addend_reader::operator()): Use new branch encoding method
8916         to avoid code duplication.
8917
8918 2010-01-11  Doug Kwan  <dougkwan@google.com>
8919
8920         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8921         (Target_arm::do_finalize_sections): Define special EXIDX section
8922         symbols only if referenced.
8923         * gc.h (Garbage_collection::add_reference): New method.
8924         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8925         code duplication.
8926
8927 2010-01-11  Ian Lance Taylor  <iant@google.com>
8928
8929         * script.cc (Version_script_info::build_expression_list_lookup):
8930         Change complaing about duplicate wildcard match from error to
8931         warning.
8932
8933         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8934         of 2009-12-30.
8935         (Version_script_info::Version_script_info): Initialize globs_,
8936         default_version_, default_is_global_, and exact_.  Don't
8937         initialize globals_ or locals_.
8938         (Version_script_info::build_lookup_tables): Build local symbols
8939         first.
8940         (Version_script_info::unquote): New function.
8941         (Version_script_info::add_exact_match): New function.
8942         (Version_script_info::build_expression_list_lookup): Remove lookup
8943         parameter.  Add is_global parameter.  Change all callers.  Handle
8944         wildcard pattern specially.  Unquote pattern.  Call
8945         add_exact_match.
8946         (Version_script_info::get_name_to_match): New function.
8947         (Version_script_info::get_symbol_version): New function.
8948         (Version_script_info::get_symbol_version_helper): Remove.
8949         (Version_script_info::check_unmatched_names): Call unquote.
8950         * script.h (class Version_script_info): Change get_symbol_version
8951         to be non-inline and add is_global parameter; change all callers.
8952         Rewrite symbol_is_local.  Update declarations.  Define struct
8953         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8954         Remove globals_ and locals_ members.  Add exact_, globs_,
8955         default_version_, is_global_.
8956         (Version_script_info::Glob): Remove pattern, add expression and
8957         is_global.  Update constructor.  Change all callers.
8958         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8959         default version.
8960         (Versions::symbol_section_contents): If a symbol is undefined, or
8961         defined in a dynamic object, set the version index to
8962         VER_NDX_LOCAL.
8963         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8964         symbol_is_local.
8965         (Symbol_table::add_from_pluginobj): Likewise.
8966         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8967
8968 2010-01-11  Doug Kwan  <dougkwan@google.com>
8969
8970         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8971         (incremental_dump_LDADD): Add linking option for libintl.
8972         * Makefile.in: Regenerate.
8973
8974 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8975
8976         PR gold/11144
8977         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8978         instead of -Ds.
8979         * testsuite/Makefile.in: Regenerated.
8980
8981 2010-01-10  Doug Kwan  <dougkwan@google.com>
8982
8983         * options.h (DEFINE_var): Use parentheses around argument varname__
8984         in macro body to avoid any unintended subsequent substitutions.
8985
8986 2010-01-10  Ian Lance Taylor  <iant@google.com>
8987
8988         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8989         candidates before doing symbol resolution.
8990
8991         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8992         ODR candidates if only one is weak.
8993
8994 2010-01-08  Ian Lance Taylor  <iant@google.com>
8995
8996         * script.cc (Version_script_info::build_expression_list_lookup):
8997         Don't warn about ambiguous version, just record the ambiguity.
8998         (Version_script_info::get_symbol_version_helper): Give error if
8999         version is ambiguous.
9000
9001 2010-01-08  Doug Kwan  <dougkwan@google.com>
9002
9003         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9004         prev_data_size_ and prev_addralign_.  Remove initializer for
9005         deleted data member has_been_changed_.
9006         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9007         to determine if the table is empty.
9008         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9009         Remove.
9010         (Stub_table::add_reloc_stub): Define method in class definition
9011         instead of just declaring it there.
9012         (Stub_table::add_cortex_a8_stub): New method definition.
9013         (Stub_table::update_data_size_and_addralign): Ditto.
9014         (Stub_table::finalize_stubs): Ditto.
9015         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9016         (Stub_table::do_addralign_): Return address alignment in the
9017         (Stub_table::do_reset_address_and_file_offset): Define method in
9018         class definition instead of declaring it there.  Set current data
9019         size to be the data size of the previous pass.
9020         (Stub_table::set_final_data_size): Use current data size as the
9021         final data size.
9022         (Stub_table::relocate_stub): Change parameter type of stub from
9023         Reloc_stub pointer to Stub pointer.
9024         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9025         (Stub_table::Cortex_a8_stub_list): New typedef.
9026         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9027          Stub_table::prev_addralign_): New data member.
9028         (Arm_relobj::Arm_relobj): Initialize data member
9029         section_has_cortex_a8_workaround_.
9030         (Arm_relobj::section_has_cortex_a8_workaround,
9031          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9032          definitions.
9033         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9034         declarations.
9035         (Target_arm::relocate_stub): Change parameter type of stub from
9036         Reloc_stub pointer to Stub pointer.
9037         (Insn_template::size, Insn_template::alignment): Handle
9038         THUMB16_SPECIAL_TYPE.
9039         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9040          Stub_table::update_data_size_and_addralign,
9041          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9042         definitions.
9043         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9044         (Stub_table::do_write): Ditto.
9045         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9046
9047 2010-01-08  Ian Lance Taylor  <iant@google.com>
9048
9049         PR 11108
9050         * symtab.h (class Symbol): Remove fields is_target_special_ and
9051         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9052         (Symbol::is_defined_in_discarded_section): New function.
9053         (Symbol::set_is_defined_in_discarded_section): New function.
9054         (Symbol::has_plt_offset): Rewrite.
9055         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9056         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9057         Don't initialize is_target_special_ or has_plt_offset_.
9058         Initialize is_defined_in_discarded_section_.
9059         (Symbol_table::add_from_relobj): If appropriate, set
9060         is_defined_in_discarded_section.
9061         * resolve.cc (Symbol::override_base_with_special): Don't test
9062         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9063         * target-reloc.h (relocate_section): Do special handling for
9064         symbols defined in discarded sections for global symbols as well
9065         as local symbols.
9066
9067 2010-01-08  Ian Lance Taylor  <iant@google.com>
9068
9069         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9070         the SHT_SYMTAB case.
9071
9072 2010-01-08  Ian Lance Taylor  <iant@google.com>
9073
9074         * object.cc (Sized_relobj::do_layout): Don't get confused if
9075         layout_eh_frame returns NULL.
9076
9077 2010-01-08  Ian Lance Taylor  <iant@google.com>
9078
9079         PR 11084
9080         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9081         dynamic symbol table, use the normal symbol table.
9082         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9083         symbol table.
9084
9085 2010-01-08  Ian Lance Taylor  <iant@google.com>
9086
9087         PR 11072
9088         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9089         sections.
9090
9091 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9092
9093         * version.cc (print_version): Change to "Copyright 2010".
9094
9095 2010-01-08  Ian Lance Taylor  <iant@google.com>
9096
9097         PR 10287
9098         PR 11063
9099         * i386.cc (class Target_i386): Change return type of plt_section
9100         to be non-const.
9101         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9102         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9103         tls_desc_rel_ field.
9104         (Output_data_plt_i386::rel_tls_desc): New function.
9105         (Target_i386::rel_tls_desc_section): New function.
9106         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9107         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9108         R_386_TLS_DESC reloc in rel_tls_desc_section.
9109         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9110         Define struct Tlsdesc_info.
9111         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9112         (Target_x86_64::do_reloc_symbol_index): New function.
9113         (Target_x86_64::add_tlsdesc_info): New function.
9114         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9115         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9116         tlsdesc_rel_ field.
9117         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9118         all callers.
9119         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9120         (Target_x86_64::rela_tlsdesc_section): New function.
9121         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9122         handling.
9123         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9124         (Target_x86_64::do_reloc_addend): New function.
9125         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9126         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9127         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9128         (Output_reloc::type): New function.
9129         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9130         (Output_reloc::is_target_specific): New function.
9131         (Output_reloc::target_arg): New function.
9132         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9133         absolute relocs and target specific relocs.
9134         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9135         add_target_specific.
9136         (class Output_data_reloc) [SHT_RELA]: Likewise.
9137         * output.cc (Output_reloc::Output_reloc): Add four new versions
9138         for absolute relocs and target specific relocs.
9139         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9140         (Output_reloc::get_symbol_index): Likewise.
9141         (Output_reloc::local_section_offset): Check that local_sym_index_
9142         is not TARGET_CODE or 0.
9143         (Output_reloc::symbol_value): Likewise.
9144         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9145         reloc.
9146         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9147         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9148         functions.
9149         * layout.cc (add_target_dynamic_tags): Use output section for
9150         DT_PLTRELSZ and DT_JMPREL.
9151
9152 2010-01-07  Ian Lance Taylor  <iant@google.com>
9153
9154         PR 11061
9155         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9156         function.
9157         (class Output_data_reloc_generic): Define.
9158         (class Output_data_reloc_base): Change base class to
9159         Output_data_reloc_generic.  Change add() method to call
9160         bump_relative_reloc_count for a relative reloc.  Remove
9161         sort_relocs_ field.
9162         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9163         to sort_relocs().
9164         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9165         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9166         appropriate.
9167         * layout.h (class Layout): Update declaration.
9168
9169 2010-01-07  Ian Lance Taylor  <iant@google.com>
9170
9171         * output.h (class Output_data): Add const version of
9172         output_section and do_output_section.
9173         (class Output_section_data): Add const version of
9174         do_output_section.
9175         (class Output_section): Likewise.
9176         * layout.cc (Layout::add_target_dynamic_tags): New function.
9177         * layout.h (class Layout): Update declarations.
9178         * arm.cc (Target_arm::do_finalize_sections): Use
9179         add_target_dynamic_tags.
9180         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9181         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9182         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9183         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9184
9185 2010-01-07  Ian Lance Taylor  <iant@google.com>
9186
9187         PR 11042
9188         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9189         object as needed.
9190
9191 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9192             Ian Lance Taylor  <iant@google.com>
9193
9194         PR 11019
9195         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9196         Xindex::read_symtab_xindex.
9197
9198 2010-01-07  Doug Kwan  <dougkwan@google.com>
9199
9200         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9201         (Insn_template::thumb16_bcond_insn): New method declaration.
9202         (Insn_template): Fix spelling.
9203         (Stub::thumb16_special): New method declaration.
9204         (Stub::do_write): Define virtual method which was previously pure
9205         virtual.
9206         (Stub::do_thumb16_special): New method declaration.
9207         (Stub::do_fixed_endian_write): New template member.
9208         (Reloc_stub::do_write): Remove.
9209         (Reloc_stub::do_fixed_endian_write): Remove.
9210         (Cortex_a8_stub): New class definition.
9211         (Stub_factory::make_cortex_a8_stub): New method definition.
9212         (Stub_factory::Stub_factory): Add missing static storage class
9213         qualifier for elf32_arm_stub_a8_veneer_blx.
9214
9215 2010-01-07  Ian Lance Taylor  <iant@google.com>
9216
9217         PR 10980
9218         * options.h (class General_options): Add --warn-unresolved-symbols
9219         and --error-unresolved-symbols.
9220         * errors.cc (Errors::undefined_symbol): Implement
9221         --warn-unresolved-symbols.
9222
9223         * options.h (class General_options): Add -z text and -z textoff.
9224         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9225
9226 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9227
9228         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9229         (Garbage_collection::cident_sections): New function.
9230         (Garbage_collection::add_cident_section): New function.
9231         (Garbage_collection::cident_sections_): New member.
9232         (gc_process_relocs): Add references to sections whose names are C
9233         identifiers.
9234         * gold.h (cident_section_start_prefix): New constant.
9235         (cident_section_stop_prefix): New constant.
9236         (is_cident): New function.
9237         * layout.cc (Layout::define_section_symbols): Replace string constants
9238         with the newly defined constants.
9239         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9240         C identifiers.
9241         * testsuite/Makefile.am: Add gc_orphan_section_test.
9242         * testsuite/Makefile.in: Regenerate.
9243         * testsuite/gc_orphan_section_test.cc: New file.
9244         * testsuite/gc_orphan_section_test.sh: New file.
9245
9246 2010-01-06  Ian Lance Taylor  <iant@google.com>
9247
9248         PR 10980
9249         * options.h (class General_options): Add --warn-shared-textrel.
9250         * layout.cc (Layout::finish_dynamic_section): Implement
9251         --warn-shared-textrel.
9252
9253         PR 10980
9254         * options.h (class General_options): Add --warn-multiple-gp.
9255
9256 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9257
9258         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9259         $(THREADSLIB) and $(LIBDL).
9260         * Makefile.in: Rebuild.
9261
9262 2010-01-06  Ian Lance Taylor  <iant@google.com>
9263
9264         PR 10980
9265         * options.cc (General_options::parse_section_start): New function.
9266         (General_options::section_start): New function.
9267         (General_options::General_options): Initialize all members.
9268         * options.h: Include <map>
9269         (class General_options): Add --section-start.  Add section_starts_
9270         member.
9271         * layout.cc (Layout::attach_allocated_section_to_segment): If
9272         --section-start was used, set the address of the segment.  Remove
9273         local sort_sections.
9274         (Layout::relaxation_loop_body): If the address of the load segment
9275         has been set by --section-start, don't use it.
9276         * output.h (Output_segment::update_flags_for_output_section): New
9277         function.
9278         * output.cc (Output_segment::add_output_section): Call
9279         update_flags_for_output_section.
9280
9281 2010-01-05  Ian Lance Taylor  <iant@google.com>
9282
9283         PR 10980
9284         * options.h (class General_options): Add --undefined-version.
9285         * script.cc (struct Version_expression): Add was_matched_by_symbol
9286         field.
9287         (Version_script_info::matched_symbol): New function.
9288         (Version_script_info::get_symbol_version_helper): Call
9289         matched_symbol.
9290         (Version_script_info::check_unmatched_names): New function.
9291         * script.h (class Version_script_info): Update declarations.
9292         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9293
9294         * options.h (class General_options): Use DEFINE_bool_alias for
9295         allow_multiple_definition.
9296         * resolve.cc (Symbol_table::should_override): Don't test
9297         allow_multiple_definition.
9298
9299         PR 10980
9300         * options.h (class General_options): Add --cref.
9301         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9302         until after printing cref table.
9303         * cref.cc: Include "symtab.h".
9304         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9305         (Cref_table_compare::operator()): New function.
9306         (Cref_inputs::gather_cref): New function.
9307         (filecol): New static const.
9308         (Cref_inputs::print_cref): New function.
9309         (Cref::print_cref): New function.
9310         * cref.h: Include <cstdio>.
9311         (class Cref): Update declarations.
9312         * mapfile.h (Mapfile::file): New function.
9313         * object.h (class Object): Define Symbols.  Declare virtual
9314         do_get_global_symbols.
9315         (Object::get_global_symbols): New function.
9316         * object.cc (Input_objects::add_object): Pass object to cref_ if
9317         --cref.
9318         (Input_objects::archive_start): Likewise.
9319         (Input_objects::archive_stop): Likewise.
9320         (Input_objects::print_cref): New function.
9321         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9322         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9323         --cref.
9324         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9325         function.
9326         * plugin.h (class Sized_pluginobj): Update declarations.
9327
9328 2010-01-05  Ian Lance Taylor  <iant@google.com>
9329
9330         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9331         to is_default_version.  Rename insdef to insdefault.
9332         (Symbol_table::add_from_relobj): Rename def to is_default_version
9333         and local to is_forced_local.
9334         (Symbol_table::add_from_pluginobj): Likewise.
9335         (Symbol_table::add_from_dynobj): Likewise.
9336         (Symbol_table::define_special_symbol): Rename insdef to
9337         insdefault.
9338
9339 2010-01-04  Ian Lance Taylor  <iant@google.com>
9340
9341         PR 10980
9342         * options.h (class General_options): Add
9343         --allow-multiple-definition and -z muldefs.
9344         * resolve.cc (Symbol_table::should_override): Don't warn about a
9345         multiple symbol definition if --allow-multiple-definition or -z
9346         muldefs.
9347
9348         PR 10980
9349         * options.h (class General_options): Add --add-needed and
9350         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9351         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9352         error if --copy-dt-needed-entries aka --add-needed is used and
9353         would cause a change in behaviour.
9354
9355         PR 10980
9356         * options.h (class General_options): Add -G as a short version of
9357         --shared.  Add no-op options -assert, -g, and -i.
9358
9359 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9360
9361         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9362         check for .text or .gnu.linkonce.t sections.
9363         * icf.cc (Icf::find_identical_sections): Ditto.
9364         Change the detection for mangled function name within the section
9365         name.
9366         * icf.h (is_section_foldable_candidate): New function.
9367
9368 2009-12-30  Ian Lance Taylor  <iant@google.com>
9369
9370         PR 10980
9371         * options.h (class General_options): Permit two dashes with
9372         --retain-symbols-file.
9373
9374 2009-12-30  Ian Lance Taylor  <iant@google.com>
9375
9376         PR 10979
9377         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9378         don't put the file header and segment headers in the text
9379         segment.
9380
9381         PR 10979
9382         * common.cc (Sort_commons::operator()): Stabilize sort when both
9383         entries are NULL.
9384         (Symbol_table::do_allocate_commons_list): When allocating common
9385         symbols, skip a symbol which is no longer common.
9386         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9387         an object before checking its type.
9388         * testsuite/common_test_2.c: New file.
9389         * testsuite/common_test_3.c: New file.
9390         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9391         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9392         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9393         (common_test_2_pic.o, common_test_2.so): New targets.
9394         (common_test_3_pic.o, common_test_3.so): New targets.
9395         * testsuite/Makefile.in: Rebuild.
9396
9397         PR 10979
9398         * script.cc (read_input_script): If we see a new SECTIONS clause,
9399         and we have added an input section, give an error.
9400         * layout.h (class Layout): Add have_added_input_section function.
9401         Add have_added_input_section_ field.
9402         * layout.cc (Layout::Layout): Initialize
9403         have_added_input_section_.
9404         (Layout::layout): Set have_added_input_section_.
9405         (Layout::layout_eh_frame): Likewise.
9406
9407 2009-12-30  Ian Lance Taylor  <iant@google.com>
9408
9409         PR 10931
9410         * options.h (class General_options): Add --sort-common option.
9411         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9412         * common.cc (Sort_common): Add sort_order parameter to
9413         constructor.  Add sort_order_ field.
9414         (Sort_commons::operator): Check sort_order_.
9415         (Symbol_table::allocate_commons): Determine the sort order.
9416         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9417         Change all callers.
9418         (Symbol_table::do_allocate_commons_list): Likewise.
9419
9420 2009-12-30  Ian Lance Taylor  <iant@google.com>
9421
9422         PR 10916
9423         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9424         symbols from this object, don't change the visibility of an
9425         undefined symbol.
9426         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9427
9428 2009-12-30  Ian Lance Taylor  <iant@google.com>
9429
9430         PR 10861
9431         * script.h (class Version_script_info): Define Language enum.
9432         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9433         new fields globals_, locals_, and is_finalized_.
9434         * script.cc: Various formatting fixes.
9435         (class Parser_closure): Change language_stack_ from a vector of
9436         std::string to one of Version_script_info::Language.  Adjust all
9437         uses accordingly.
9438         (class Lazy_demangler): Remove.
9439         (struct Version_expression): Change language from std::string to
9440         Version_script_info::Language.
9441         (Version_script_info::Version_script_info): New function.
9442         (Version_script_info::~Version_script_info): Don't call clear.
9443         (Version_script_info::finalize): New function.
9444         (Version_script_info::build_lookup_tables): New function.
9445         (Version_script_info::build_expression_list_lookup): New
9446         function.
9447         (Version_script_info::get_symbol_version_helper): Rewrite to use
9448         lookup tables.
9449         (Version_script_info::print_expression_list): Adjust to use
9450         Version_script_info::Language.
9451         (script_push_lex_into_version_mode): Check that the version script
9452         has not been finalized.
9453         (version_script_push_lang): Change language string to
9454         Version_script_info::Language.
9455         * options.cc (Command_line::version_script): New function.
9456         * options.h (class General_options): Add finalize_dynamic_list
9457         function.  Change version_script from declaration to definition.
9458         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9459         * testsuite/version_script.map: Remove duplicate def of foo.
9460         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9461         version_script.map.
9462         * testsuite/Makefile.in: Rebuild.
9463
9464 2009-12-30  Ian Lance Taylor  <iant@google.com>
9465
9466         PR 10843
9467         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9468         if the input symbol index is 0, make the output symbol index 0.
9469
9470 2009-12-30  Ian Lance Taylor  <iant@google.com>
9471
9472         PR 10670
9473         * options.h (class General_options): Add -x/--discard-all.
9474         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9475         --discard-all.  If the local symbol needs a dynamic entry, check
9476         that before handling --discard-locals.
9477
9478 2009-12-30  Ian Lance Taylor  <iant@google.com>
9479
9480         PR 10450
9481         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9482         flags to PF_R.
9483         (Output_segment::add_output_section): Don't change the flags if
9484         the type is PT_TLS.
9485
9486         PR 10450
9487         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9488         GNU hash table if they need a dynamic value.  Otherwise, don't add
9489         them if they are defined in a dynamic object or are forced local.
9490
9491 2009-12-29  Ian Lance Taylor  <iant@google.com>
9492
9493         PR 10450
9494         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9495         .gnu.hash table for a 32-bit target.
9496
9497         PR 10450
9498         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9499         regular and a dynamic object only needs a dynamic symbol table
9500         entry if it is externally visible.
9501
9502         PR 10450
9503         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9504         constructor.  Add global_offset_table_ field.
9505         (Target_i386::got_section): Set global_offset_table_.
9506         (Target_i386::do_finalize_sections): Set global_offset_table_
9507         size.
9508         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9509         in constructor.  Add global_offset_table_ field.
9510         (Target_x86_64::got_section): Set global_offset_table_.
9511         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9512         size.
9513
9514         * layout.cc (Layout::Layout): Initialize increase_relro_.
9515         (Layout::get_output_section): Add is_relro, is_last_relro, and
9516         is_first_non_relro parameters.  Change all callers.
9517         (Layout::choose_output_section): Likewise.
9518         (Layout::add_output_section_data): Likewise.
9519         (Layout::make_output_section): Likewise.
9520         (Layout::set_segment_offsets): Clear increase_relro when using a
9521         linker script.
9522         * layout.h (class Layout): Add increase_relro method.  Add
9523         increase_relro_ field.  Update declarations.
9524         * output.cc (Output_section::Output_section): Initialize
9525         is_last_relro_ and is_first_non_relro_.
9526         (Output_segment::add_output_section): Group relro sections is
9527         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9528         (Output_segment::maximum_alignment): Remove relro handling.
9529         (Output_segment::set_section_addresses): Add increase_relro
9530         parameter.  Change all callers.  Add initial alignment to align
9531         relro sections on separate page.  Remove old relro handling.
9532         (Output_segment::set_section_list_addresses): Remove in_relro
9533         parameter.  Change all callers.
9534         (Output_segment::set_offset): Add increase parameter.  Change all
9535         callers.  Remove old relro handling.
9536         * output.h (class Output_section): Add new methods: is_last_relro,
9537         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9538         Add is_last_relro_ and is_first_non_relro_ fields.
9539         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9540         Create separate .got.plt section.  Call increase_relro.
9541         * x86_64.cc (Target_x86_64::got_section): Likewise.
9542         * testsuite/relro_script_test.t: Add .got.plt.
9543
9544         PR 10450
9545         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9546         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9547         (Layout::finalize): Call set_dynamic_symbol_size.
9548         (Layout::set_dynamic_symbol_size): New function.
9549         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9550         set_dynamic_symbol_size.
9551
9552         PR 10450
9553         * output.h (class Output_section): Add is_entsize_zero_ field.
9554         * output.cc (Output_section::Output_section): Initialize
9555         is_entsize_zero_.
9556         (Output_section::set_entsize): If two different entsizes are
9557         requested, force it to zero.
9558         (Output_section::add_input_section): Set flags for .debug_str
9559         before updating section flags.  Set entsize.
9560         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9561         and SHF_STRING if all input sections have those flags.
9562
9563 2009-12-29   Rafael Espindola  <espindola@google.com>
9564
9565         * main.cc (main): Fix the sys time reporting.
9566         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9567         reporting.
9568
9569 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9570
9571         * options.cc (General_options::parse_version): Allow -v to exit
9572         without an error if there is nothing to link.
9573
9574 2009-12-29  Ian Lance Taylor  <iant@google.com>
9575
9576         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9577         using a version of gcc before 4.1.
9578         * configure: Rebuild.
9579
9580 2009-12-28  Chris Demetriou  <cgd@google.com>
9581
9582         * attributes.cc (Output_attributes_section_data::do_write): Use
9583         std::vector::front rather than std::vector::data.
9584
9585 2009-12-28  Ian Lance Taylor  <iant@google.com>
9586
9587         * symtab.h (class Symbol_table): Add enum Defined.
9588         * resolve.cc (Symbol_table::should_override): Add defined
9589         parameter.  Change all callers.  Test whether object is NULL
9590         before calling a method on it.
9591         (Symbol_table::report_resolve_problem): Add defined parameter.
9592         Change all callers.
9593         (Symbol_table::should_override_with_special): Likewise.
9594         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9595         parameter.  Change all callers.
9596         (Symbol_table::do_define_in_output_data): Likewise.
9597         (Symbol_table::define_in_output_segment): Likewise.
9598         (Symbol_table::do_define_in_output_segment): Likewise.
9599         (Symbol_table::define_as_constant): Likewise.
9600         (Symbol_table::do_define_as_constant): Likewise.
9601         * script.h (class Symbol_assignment): Add is_defsym parameter to
9602         constructor; change all callers.
9603         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9604         parameter.  Change all callers.  Add is_defsym_ field.
9605         (class Parser_closure): Add parsing_defsym parameter to
9606         constructor; change all callers.  Add parsing_defsym accessor
9607         function.  Add parsing_defsym_ field.
9608
9609 2009-12-28  Ian Lance Taylor  <iant@google.com>
9610
9611         * gold.cc (queue_middle_tasks): Fix formatting.
9612         * object.cc (Relobj::is_section_name_included): Likewise.
9613
9614 2009-12-23  Ian Lance Taylor  <iant@google.com>
9615
9616         * i386.cc (Target_i386::do_calls_non_split): Recognize
9617         -fsplit-stack prologue for a function with a static chain.
9618         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9619         -fsplit-stack prologue when using %r11.
9620
9621 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9622
9623         * options.cc (General_options::parse_version): Make -v continue and do
9624         the link like GNU ld does.
9625
9626 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9627
9628         * Makefile.am (CCFILES): Add timer.cc.
9629         (HFILES): Add timer.h.
9630         * configure.ac: Check for sysconf and times.
9631         * main.cc: include timer.h.
9632         (main): Use Timer instead of get_run_time.
9633         * timer.cc: New.
9634         * timer.h: New.
9635         * workqueue.cc: include timer.h.
9636         (Workqueue::find_and_run_task):
9637         Report user, sys and wall time.
9638         * Makefile.in: Regenerate.
9639         * config.in: Regenerate.
9640         * configure: Regenerate.
9641
9642 2009-12-16  Doug Kwan  <dougkwan@google.com>
9643
9644         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9645         sections.
9646         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9647         relaxed input sections.
9648         * output.cc (Output_section::find_relaxed_input_section): Change
9649         return type to Output_relaxed_input_section pointer.  Adjust code
9650         for new type of relaxed_input_section_map_.
9651         * output.h (Output_section::find_relaxed_input_section): Change
9652         return type to Output_relaxed_input_section pointer.
9653         (Output_section::Output_relaxed_input_section_by_input_section_map):
9654         New type.
9655         (Output_section::relaxed_input_section_map_): Change type to
9656         Output_section::Output_relaxed_input_section_by_input_section_map.
9657         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9658         input section.
9659
9660 2009-12-15  Ian Lance Taylor  <iant@google.com>
9661
9662         * layout.cc (Layout::create_shstrtab): Only write out after input
9663         sections if we are compressing debug sections.
9664
9665 2009-12-15  Ian Lance Taylor  <iant@google.com>
9666
9667         * archive.cc (Archive::add_symbols): Only look up a symbol without
9668         a version if there is, in fact, a version.
9669
9670 2009-12-14  Ian Lance Taylor  <iant@google.com>
9671
9672         Revert -Wshadow changes, all changes from:
9673         2009-12-11  Doug Kwan  <dougkwan@google.com>
9674         2009-12-11  Nick Clifton  <nickc@redhat.com>
9675         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9676
9677 2009-12-11  Doug Kwan  <dougkwan@google.com>
9678
9679         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9680         due to -Wshadow.
9681         * attributes.cc (Object_attribute::size): Ditto.
9682         (Attributes_section_data::size): Ditto.
9683         (Attributes_section_data::Attributes_section_data): Ditto.
9684         (Output_attributes_section_data::do_write): Ditto.
9685         * attributes.h (Object_attribute::set_type): Ditto.
9686         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9687
9688 2009-12-11  Nick Clifton  <nickc@redhat.com>
9689
9690         * archive.cc: Fix shadowed variable warnings.
9691         * arm.cc: Likewise.
9692         * compressed_output.cc: Likewise.
9693         * compressed_output.h: Likewise.
9694         * configure: Likewise.
9695         * dwarf_reader.cc: Likewise.
9696         * dynobj.cc: Likewise.
9697         * dynobj.h: Likewise.
9698         * ehframe.cc: Likewise.
9699         * ehframe.h: Likewise.
9700         * errors.cc: Likewise.
9701         * expression.cc: Likewise.
9702         * fileread.cc: Likewise.
9703         * fileread.h: Likewise.
9704         * freebsd.h: Likewise.
9705         * i386.cc: Likewise.
9706         * icf.cc: Likewise.
9707         * incremental.h: Likewise.
9708         * layout.cc: Likewise.
9709         * layout.h: Likewise.
9710         * mapfile.cc: Likewise.
9711         * merge.cc: Likewise.
9712         * merge.h: Likewise.
9713         * object.cc: Likewise.
9714         * object.h: Likewise.
9715         * options.h: Likewise.
9716         * output.cc: Likewise.
9717         * output.h: Likewise.
9718         * parameters.cc: Likewise.
9719         * plugin.cc: Likewise.
9720         * powerpc.cc: Likewise.
9721         * reduced_debug_output.cc: Likewise.
9722         * reduced_debug_output.h: Likewise.
9723         * reloc.cc: Likewise.
9724         * reloc.h: Likewise.
9725         * resolve.cc: Likewise.
9726         * script-sections.cc: Likewise.
9727         * script.cc: Likewise.
9728         * script.h: Likewise.
9729         * sparc.cc: Likewise.
9730         * symtab.cc: Likewise.
9731         * symtab.h: Likewise.
9732         * target-select.cc: Likewise.
9733         * target-select.h: Likewise.
9734         * token.h: Likewise.
9735         * workqueue.cc: Likewise.
9736         * workqueue.h: Likewise.
9737         * x86_64.cc: Likewise.
9738
9739 2009-12-10  Doug Kwan  <dougkwan@google.com>
9740
9741         * arm.cc (attributes.h): New include.
9742         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9743         (Arm_relobj::~Arm_relobj): Delete object pointed by
9744         attributes_section_data_.
9745         (Arm_relobj::attributes_section_data): New method definition.
9746         (Arm_relobj::attributes_section_data_): New data member declaration.
9747         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9748         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9749         attributes_section_data_.
9750         (Arm_dynobj::attributes_section_data): New method definition.
9751         (Arm_dynobj::attributes_section_data_): New data member declaration.
9752         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9753         initialization value of may_use_blx_ to false.
9754         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9755         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9756         object attributes to compute results instead of hard-coding.
9757         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9758         Target_arm::get_secondary_compatible_arch,
9759         Target_arm::set_secondary_compatible_arch
9760         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9761         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9762         New method declarations.
9763         (Target_arm::get_aeabi_object_attribute): New method definition.
9764         (Target_arm::attributes_section_data_): New data member declaration.
9765         (read_arm_attributes_section): New template definition.
9766         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9767         (Arm_dynobj::do_read_symbols): Ditto.
9768         (Target_arm::do_finalize_sections): Merge attributes sections from
9769         input.  Check for BLX use after attributes section merging.
9770         Fix __exidx_start and __exidx_end visibility.  Create an
9771         .ARM.attributes section if necessary.
9772         (Target_arm::get_secondary_compatible_arch,
9773         Target_arm::set_secondary_compatible_arch,
9774         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9775         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9776         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9777         New method definitions.
9778
9779 2009-12-09  Ian Lance Taylor  <iant@google.com>
9780
9781         * plugin.cc (Plugin::load): Don't cast from void* to a function
9782         pointer.
9783
9784 2009-12-09  Ian Lance Taylor  <iant@google.com>
9785
9786         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9787         information fields.
9788
9789 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9790
9791         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9792         Replace two_file_shared_1.so with two_file_shared_2.so.
9793         * testsuite/Makefile.in: Regenerated.
9794
9795 2009-12-08  Doug Kwan  <dougkwan@google.com>
9796
9797         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9798         (HFILES): Add attributes.h and int_encoding.h.
9799         * Makefile.in: Regenerate.
9800         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9801         function definitions to int_encoding.cc
9802         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9803         prototypes to int_encoding.h
9804         * reduced_debug_output.cc (int_encoding.h): New include.
9805         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9806         function definitions to int_encoding.cc
9807         (insert_into_vector, read_from_pointer): Move template definitions to
9808         int_encoding.h
9809         * attributes.cc: New file.
9810         * attributes.h: New file.
9811         * int_encoding.cc: New file.
9812         * int_encoding.h: New file.
9813
9814 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9815
9816         PR gold/11055
9817         * incremental-dump.cc (dump_incremental_inputs): New.
9818         (main): Use dump_incremental_inputs.
9819
9820 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9821
9822         PR gold/10893
9823         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9824         checking elfcpp::STT_FUNC.
9825         (Target_i386::Relocate::relocate): Likewise.
9826         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9827
9828         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9829         symbols from shared libraries into normal FUNC symbols.
9830
9831         * symtab.h (Symbol): Add is_func and use it.
9832
9833 2009-12-05  Doug Kwan  <dougkwan@google.com>
9834
9835         * arm.cc (Target_arm::arm_info): Initialize new fields
9836         attributes_section and attributes_vendor.
9837         * i386.cc (Target_i386::i386_info): Same.
9838         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9839         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9840         fields attributes_section and attributes_vendor.
9841         * sparc.cc (Target_sparc::sparc_info): Same.
9842         * target.h (Target::attributes_section, Target::attributes_vendor,
9843         Target::is_attributes_section, Target::attribute_arg_type,
9844         Target::attributes_order): New method definitions.
9845         (Target::Target_info::attributes_section,
9846         Target::Target_info::attributes_vendor): New fields.
9847         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9848         virtual method definitions.
9849         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9850         attributes_section and attributes_vendor.
9851         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9852
9853 2009-12-05  Doug Kwan  <dougkwan@google.com>
9854
9855         * arm.cc: Update comments about interworking and stub generation.
9856         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9857         considered as non-PIC.
9858         (Arm_relocate_functions::base_abs): Fix formatting.
9859         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9860         of function to use GOT entry address instead of offset.
9861         (Target_arm::Scan::global): Issue an error if a symbol would need a
9862         PLT does not get one because it is untyped.  Remove code to create
9863         dynamic symbols for relative branches.
9864         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9865         takes unsigned integer instead of boolean.
9866
9867 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9868
9869         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9870         (two_file_test_LDADD): Likewise.
9871         (common_test_1_LDADD): Likewise.
9872         (exception_test_LDADD) Likewise.
9873         (weak_test_LDADD): Likewise.
9874         (many_sections_test_LDADD): Likewise.
9875         (initpri1_LDADD): Likewise.
9876         (script_test_1_LDADD): Likewise.
9877         (script_test_2_LDADD): Likewise.
9878         (justsyms_LDADD): Likewise.
9879         (binary_test_LDADD): Likewise.
9880         (large_LDADD): Likewise.
9881         * testsuite/Makefile.in: Regenerated.
9882
9883 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9884
9885         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9886         (Symbol_table::override_with_special): Likewise.
9887         (Symbol_table::add_from_object): Likewise.
9888
9889 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9890
9891         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9892         Don't set the data_offset twice.
9893
9894 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9895
9896         * testsuite/Makefile.in: Regenerate.
9897
9898 2009-12-03  Doug Kwan  <dougkwan@google.com>
9899
9900         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9901         (Target_arm::do_finalize_sections): Add parameter for symbol table
9902         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9903         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9904         parameter for symbol table pointer.
9905         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9906         an additional parameter for a pointer to symbol table.
9907         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9908         parameter for a symbol table pointer.
9909         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9910         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9911         Ditto.
9912         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9913         parameter for a symbol table pointer.
9914
9915 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9916
9917         * incremental.cc (Incremental_inputs_header)
9918         (Incremental_inputs_header_write, Incremental_inputs_entry)
9919         (Incremental_inputs_entry_write): Move ...
9920         * incremental.h (Incremental_inputs_header)
9921         (Incremental_inputs_header_write, Incremental_inputs_entry)
9922         (Incremental_inputs_entry_write): here.
9923
9924 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9925
9926         * incremental.cc (make_sized_incremental_binary): Set the target.
9927         Error if it is incompatible.
9928         * output.h (Output_file): Add filename method.
9929
9930 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9931
9932         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9933         from the get_* methods.
9934
9935 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9936
9937         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9938         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9939         Write 0 for the data_offset of scripts.
9940
9941 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9942
9943         * testsuite/Makefile.am: Add the incremental_test.sh test.
9944         * testsuite/incremental_test.sh: New.
9945         * testsuite/incremental_test_1.c: New.
9946         * testsuite/incremental_test_2.c: New.
9947
9948 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9949
9950         * incremental-dump.cc (main): Fix typos.
9951
9952 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9953
9954         PR gold/11025
9955         * incremental-dump.cc (main): Use llu to print 64 bit values.
9956
9957 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9958             H.J. Lu  <hongjiu.lu@intel.com>
9959
9960         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9961         $(LIBDL).
9962         (incremental_dump_LDADD): Likewise.
9963         * Makefile.in: Regenerated.
9964
9965 2009-11-25  Doug Kwan  <dougkwan@google.com>
9966
9967         Revert:
9968
9969         2009-11-25  Doug Kwan  <dougkwan@google.com>
9970
9971                 * arm.cc (Target_arm::Target_arm): Move method definition
9972                 outside of class definition.  Add code to handle
9973                 --target1-rel, --target1-abs and --target2= options.
9974                 (Target_arm::get_reloc_reloc_type): Change method to be
9975                 non-static and const.
9976                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9977                 New data member declaration.
9978                 (Target_arm::Scan::local, Target_arm::Scan::global,
9979                 Target_arm::Relocate::relocate,
9980                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9981                 Adjust call to Target_arm::get_real_reloc_type.
9982                 (Target_arm::get_real_reloc_type): Use command line options
9983                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9984                 * options.h (--target1-rel, --target1-abs, --target2): New
9985                 ARM-only options.
9986
9987 2009-11-25  Doug Kwan  <dougkwan@google.com>
9988
9989         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9990         class definition.  Add code to handle --target1-rel, --target1-abs
9991         and --target2= options.
9992         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9993         and const.
9994         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9995         member declaration.
9996         (Target_arm::Scan::local, Target_arm::Scan::global,
9997         Target_arm::Relocate::relocate,
9998         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9999         call to Target_arm::get_real_reloc_type.
10000         (Target_arm::get_real_reloc_type): Use command line options to
10001         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10002         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10003         options.
10004
10005 2009-11-25  Doug Kwan  <dougkwan@google.com>
10006
10007         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10008         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10009         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10010         formatting.
10011         (Arm_relocate_functions::thm_call): Replace body with a call to
10012         Arm_relocate_functions::thumb_branch_common.
10013         (Arm_relocate_functions::thm_jump24,
10014         Arm_relocate_functions::thm_xpc22): New method definitions.
10015         (Arm_relocate_functions::thumb_branch_common): New method definition.
10016         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10017         operator.
10018         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10019         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10020
10021 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10022
10023         * Makefile.am: Build incremental-dump
10024         * Makefile.in: Regenerate.
10025         * incremental-dump.cc: New.
10026         * incremental.cc (Incremental_inputs_header_data,
10027         Incremental_inputs_entry_data): Move to incremental.h
10028         * incremental.h: (Incremental_inputs_header_data,
10029         Incremental_inputs_entry_data): Move from incremental.cc
10030
10031 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10032
10033         * incremental.cc (Incremental_inputs_header,
10034         Incremental_inputs_header_write, Incremental_inputs_entry,
10035         Incremental_inputs_entry_write): Add a typedef with the data type.
10036
10037 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10038
10039         * incremental.cc (Incremental_inputs_header,
10040         Incremental_inputs_header_write, Incremental_inputs_entry,
10041         Incremental_inputs_entry_write): Update comment about which
10042         type has the filed descriptions.
10043
10044 2009-11-15  Doug Kwan  <dougkwan@google.com>
10045
10046         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10047         (Arm_relocate_functions::arm_branch_common): Change method defintion
10048         in class definition to a method declaration and update list of formal
10049         parameters.
10050         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10051         Arm_relocation_functions::jump24): Adjust call to
10052         Arm_relocate_functions::arm_branch_common.  Update list of formal
10053         parameters.
10054         (Arm_relocate_functions::xpc25): New method definition.
10055         (Arm_relocate_functions::arm_branch_common): Move method defintion
10056         out from class definition.  Use stubs for mode-switching and extending
10057         branch ranges.
10058         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10059         specially.  Change code to enable use of stubs in ARM branches.
10060
10061 2009-11-10  Doug Kwan  <dougkwan@google.com>
10062
10063         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10064         in method declaration.
10065         (Target_arm::relocate_stub): New method declaration.
10066         (Target_arm::default_target): Change to return a pointer instead of
10067         a const reference.
10068         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10069         Target_arm::default_target.
10070         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10071         method definition.
10072         (Target_arm::relocate_section): Adjust view.
10073         (Target_arm::relocate_stub): New method definition.
10074
10075 2009-11-10  Doug Kwan  <dougkwan@google.com>
10076
10077         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10078         a format warning.
10079         * incremental.cc (open_incremental_binary): Initialized local
10080         variables to avoid warnings.
10081         * object.cc (make_elf_object): Ditto.
10082         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10083         a format warning.
10084
10085 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10086
10087         PR gold/10930
10088         * testsuite/plugin_test.c: Include "config.h".
10089
10090 2009-11-09  Doug Kwan  <dougkwan@google.com>
10091
10092         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10093         (arm_symbol_value): Remove.
10094         (Arm_relocate_functions::arm_branch_common,
10095         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10096         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10097         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10098         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10099         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10100         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10101         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10102         Arm_relocate_functions::thm_mobw_abs_nc,
10103         Arm_relocate_functions::thm_mov_abs,
10104         Arm_relocate_functions::movw_prel_nc,
10105         Arm_relocate_functions::thm_movt_abs,
10106         Arm_relocate_functions::movt_prel,
10107         Arm_relocate_functions::thm_movw_prel_nc,
10108         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10109         (Target_arm::Relocate::relocate): Only decompose address into two
10110         parts if relocation type uses the thumb-bit and pass the actual
10111         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10112         calls to methods in Arm_relocate_functions for this change.
10113
10114 2009-11-08  Ian Lance Taylor  <iant@google.com>
10115
10116         PR 10925
10117         * reloc.cc: Instantiate
10118         Sized_relobj::initialize_input_to_output_maps and
10119         Sized_relobj:free_input_to_output_maps.
10120
10121 2009-11-06  Ian Lance Taylor  <iant@google.com>
10122
10123         PR 10876
10124         * defstd.cc (in_segment): Set only_if_ref true for "end".
10125
10126 2009-11-06  Doug Kwan  <dougkwan@google.com>
10127
10128         * arm.cc (class Reloc_stub): Correct a comment.
10129         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10130         (Target_arm::scan_section_for_stubs): New method declaration.
10131         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10132         Change methods from private to protected.
10133         (Target_arm::do_may_relax): New method definition.
10134         (Target_arm::do_relax, Target_arm::group_sections,
10135         Target_arm::scan_reloc_for_stub,
10136         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10137         (Target_arm::arm_input_section_map_): New data member declaration.
10138         (Target_arm::scan_reloc_for_stub,
10139         Target_arm::scan_reloc_section_for_stubs,
10140         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10141         Target_arm::do_relax): New method definitions.
10142
10143 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10144
10145         * configure.ac: Check for (struct stat)::st_mtim
10146         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10147         * config.in: Regenerate.
10148         * configure: Regenerate.
10149
10150 2009-11-05  Ian Lance Taylor  <iant@google.com>
10151
10152         PR 10910
10153         * output.cc (Output_segment::add_output_section): Add missing
10154         return statement.
10155
10156 2009-11-04  Ian Lance Taylor  <iant@google.com>
10157
10158         PR 10880
10159         * object.h (class Object): Add is_needed and set_is_needed
10160         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10161         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10162         defined in a dynamic object and referenced by a regular object,
10163         set is_needed for the dynamic object.
10164         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10165         if the file is marked with as_needed and it is not needed.
10166
10167 2009-11-04  Ian Lance Taylor  <iant@google.com>
10168
10169         PR 10887
10170         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10171         tags if data is discarded by linker script.
10172         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10173         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10174         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10175         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10176
10177 2009-11-04  Ian Lance Taylor  <iant@google.com>
10178
10179         * layout.cc (Layout::get_output_section): Add is_interp and
10180         is_dynamic_linker_section parameters.  Change all callers.
10181         (Layout::choose_output_section): Likewise.
10182         (Layout::make_output_section): Likewise.
10183         (Layout::add_output_section_data): Add is_dynamic_linker_section
10184         parameter.  Change all callers.
10185         * layout.h (class Layout): Update declarations.
10186         * output.h (class Output_section): Add is_interp, set_is_interp,
10187         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10188         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10189         generate_code_fills_at_write_ to a bitfield.
10190         * output.cc (Output_section::Output_sections): Initialize new
10191         fields.
10192         (Output_segment::add_output_section): Add do_sort parameter.
10193         Change all callers.
10194
10195 2009-11-03  Ian Lance Taylor  <iant@google.com>
10196
10197         PR 10860
10198         * options.h (class General_options): Add --warn-common.
10199         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10200         merging two common symbols.
10201         (Symbol_table::should_override): Handle --warn-common when merging
10202         a common symbol with a defined symbol.  Use report_resolve_problem
10203         for multiple definitions.
10204         (Symbol_table::report_resolve_problem): New function.
10205         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10206
10207 2009-11-03  Doug Kwan  <dougkwan@google.com>
10208
10209         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10210         stub_factory_.
10211         (Target_arm::stub_factory): New method definition.
10212         (Target_arm::new_arm_input_section,
10213         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10214         Target_arm::reloc_uses_thumb_bit): New method declarations.
10215         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10216         New type definitions.
10217         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10218         member declarations.
10219         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10220         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10221         New method definitions.
10222
10223 2009-11-03  Ian Lance Taylor  <iant@google.com>
10224
10225         * options.h (class General_options): Add --warn_constructors.
10226
10227 2009-11-03  Ian Lance Taylor  <iant@google.com>
10228
10229         PR 10893
10230         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10231         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10232
10233 2009-11-03  Ian Lance Taylor  <iant@google.com>
10234
10235         PR 10895
10236         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10237         --msgid-bugs-address.
10238         (install-pdf): New target.
10239         (install-data_yes): Look up one directory to find mkinstalldirs.
10240
10241 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10242
10243         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10244         tree.
10245
10246 2009-10-30  Doug Kwan  <dougkwan@google.com>
10247
10248         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10249
10250 2009-10-30  Doug Kwan  <dougkwan@google.com>
10251
10252         * arm.cc (Stub_addend_reader): New struct template definition
10253         and partial specializations.
10254         (Stub_addend_reader::operator()): New method definition for a
10255         partially specialized template.
10256
10257 2009-10-30  Doug Kwan  <dougkwan@google.com>
10258
10259         * arm.cc (Arm_relobj::processor_specific_flags): New method
10260         definition.
10261         (Arm_relobj::do_read_symbols): New method declaration.
10262         (Arm_relobj::processor_specific_flags_): New data member declaration.
10263         (Arm_dynobj): New class definition.
10264         (Target_arm::do_finalize_sections): Add input_objects parameter.
10265         (Target_arm::do_adjust_elf_header): New method declaration.
10266         (Target_arm::are_eabi_versions_compatible,
10267         (Target_arm::merge_processor_specific_flags): New method declaration.
10268         (Target_arm::do_make_elf_object): New overloaded method definitions
10269         and declaration.
10270         (Arm_relobj::do_read_symbols): New method definition.
10271         (Arm_dynobj::do_read_symbols): Ditto.
10272         (Target_arm::do_finalize_sections): Add input_objects parameters.
10273         Merge processor-specific flags from all input objects.
10274         (Target_arm::are_eabi_versions_compatible,
10275         Target_arm::merge_processor_specific_flags,
10276         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10277         New method definitions.
10278         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10279         Input_objects pointer type parameter.
10280         * layout.cc (Layout::finalize): Pass input objects to target's.
10281         finalize_sections function.
10282         * output.cc (Output_file_header::do_sized_write): Set ELF file
10283         header's processor-specific flags.
10284         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10285         Input_objects pointer type parameter.
10286         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10287         * target.h (Input_objects): New forward class declaration.
10288         (Target::processor_specific_flags,
10289         Target::are_processor_specific_flags_sect): New method definitions.
10290         (Target::finalize_sections): Add input_objects parameter.
10291         (Target::Target): Initialize processor_specific_flags_ and
10292         are_processor_specific_flags_set_.
10293         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10294         parameter.
10295         (Target::set_processor_specific_flags): New method definition.
10296         (Target::processor_specific_flags_,
10297         Target::are_processor_specific_flags_set_): New data member
10298         declarations.
10299         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10300         Input_objects pointer type parameter.
10301
10302 2009-10-30  Doug Kwan  <dougkwan@google.com>
10303
10304         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10305
10306 2009-10-28  Ian Lance Taylor  <iant@google.com>
10307
10308         * object.h (class Relobj): Drop options parameter from
10309         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10310         do_scan_relocs, do_relocate.  Change all callers.
10311         (class Sized_relobj): Drop options parameters from
10312         do_gc_process_relocs, do_scan_relocs, do_relocate,
10313         do_relocate_sections, relocate_sections, emit_relocs_scan,
10314         emit_relocs_scan_reltype.  Change all callers.
10315         (struct Relocate_info): Remove options field and all references to
10316         it.
10317         * reloc.h (class Read_relocs): Remove options constructor
10318         parameter and options_ field.  Change all callers.
10319         (class Gc_process_relocs, class Scan_relocs): Likewise.
10320         (class Relocate_task): Likewise.
10321         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10322         all callers.
10323         (scan_relocatable_relocs): Likewise.
10324         * target.h (class Sized_target): Remove options parameter from
10325         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10326         all callers.
10327         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10328         callers.
10329         * arm.cc: Update functions to remove options parameters.
10330         * i386.cc: Likewise.
10331         * powerpc.cc: Likewise.
10332         * sparc.cc: Likewise.
10333         * x86_64.cc: Likewise.
10334         * testsuite/testfile.cc: Likewise.
10335
10336 2009-10-28  Doug Kwan  <dougkwan@google.com>
10337
10338         * arm.cc (Arm_relobj): New class definition.
10339         (Arm_relobj::scan_sections_for_stubs,
10340         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10341         New method definitions.
10342
10343 2009-10-28  Cary Coutant  <ccoutant@google.com>
10344
10345         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10346         (Plugin::cleanup_done_): New member.
10347         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10348         (Plugin_manager::cleanup_done_): Remove.
10349         (Plugin_manager::add_input_file): Edit error message.
10350         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10351         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10352
10353 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10354
10355         * fileread.cc: (File_read::View::~View): Use the new
10356         data_ownership_ filed.
10357         (File_read::~File_read): Dispose the new whole_file_view_.
10358         (File_read::open): Mmap the whole file if needed.
10359         (File_read::open): Use whole_file_view_ instead of contents_.
10360         (File_read::find_view): Use whole_file_view_ if applicable.
10361         (File_read::do_read): Use whole_file_view_ instead of contents_.
10362         (File_read::make_view): Use whole_file_view_ instead of contents_,
10363         update File_read::View::View call.
10364         (File_read::find_or_make_view): Update File_read::View::View
10365         call.
10366         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10367         remove contents_
10368         (File_read::View::Data_ownership): New enum.
10369         (File_read::View::View): Replace bool mapped_ with Data_ownership
10370         argument.
10371         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10372         (File_read::View::data_ownership_): New field.
10373         (File_read::contents_): Remove (replaced by whole_file_view_).
10374         (File_read::whole_file_view_): New field.
10375         * options.h (class General_options): Add --keep-files-mapped.
10376
10377 2009-10-27  Cary Coutant  <ccoutant@google.com>
10378
10379         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10380         * testsuite/Makefile.am (plugin_test_5): New test case.
10381         * testsuite/Makefile.in: Regenerate.
10382
10383 2009-10-25  Doug Kwan  <dougkwan@google.com>
10384
10385         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10386         from private to protected to allow access by child class.
10387         (Sized_relobj::do_relocate_sections): New method declaration.
10388         (Sized_relobj::relocate_sections): Virtualize.
10389         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10390         Sized_relobj::relocate_sections.  Instantiate template explicitly
10391         for different target sizes and endianity.
10392
10393 2009-10-24  Doug Kwan  <dougkwan@google.com>
10394
10395         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10396         (Arm_input_section::as_arm_input_section): New method.
10397         (Arm_output_section): New class definition.
10398         (Arm_output_section::create_stub_group,
10399         Arm_output_section::group_sections): New method definitions.
10400
10401 2009-10-22  Doug Kwan  <dougkwan@google.com>
10402
10403         * arm.cc (Arm_input_section): New class definition.
10404         (Arm_input_section::init, Arm_input_section:do_write,
10405         Arm_input_section::set_final_data_size,
10406         Arm_input_section::do_reset_address_and_file_offset): New method
10407         definitions.
10408
10409 2009-10-21  Doug Kwan  <dougkwan@google.com>
10410
10411         * arm.cc (Stub_table, Arm_input_section): New forward class
10412         declarations.
10413         (Stub_table): New class defintion.
10414         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10415         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10416         New method definition.
10417
10418 2009-10-21  Doug Kwan  <dougkwan@google.com>
10419
10420         * arm.cc: Update copyright comments.
10421         (Target_arm): New forward class template declaration.
10422         (Arm_address): New type.
10423         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10424         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10425         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10426         constants.
10427         (Insn_template): Same.
10428         (DEF_STUBS): New macro.
10429         (Stub_type): New enum type.
10430         (Stub_template): New class definition.
10431         (Stub): Same.
10432         (Reloc_stub): Same.
10433         (Stub_factory): Same.
10434         (Target_arm::Target_arm): Initialize may_use_blx_ and
10435         should_force_pic_veneer_.
10436         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10437         Target_arm::should_force_pic_veneer,
10438         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10439         Target_arm::using_thumb_only, Target_arm:;default_target): New
10440         method defintions.
10441         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10442         New data member declarations.
10443         (Insn_template::size, Insn_template::alignment): New method defintions.
10444         (Stub_template::Stub_template): New method definition.
10445         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10446         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10447         (Stub_factory::Stub_factory): New method definition.
10448         * gold.h (string_hash): New template.
10449         * output.h (Input_section_specifier::hash_value): Use
10450         gold::string_hash.
10451         (Input_section_specifier::string_hash): Remove.
10452         * stringpool.cc (Stringpool_template::string_hash): Use
10453         gold::string_hash.
10454
10455 2009-10-20  Doug Kwan  <dougkwan@google.com>
10456
10457         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10458         symbols of relaxed input sections.
10459         * output.h (Output_section::find_relaxed_input_section): Make
10460         method public.
10461
10462 2009-10-16  Doug Kwan  <dougkwan@google.com>
10463
10464         * dynobj.cc (Versions::Versions): Initialize version_script_.
10465         Only insert base version symbol definition for a shared object
10466         if version script defines any version versions.
10467         (Versions::define_base_version): New method definition.
10468         (Versions::add_def): Check that base version is not needed.
10469         (Versions::add_need): Define base version lazily.
10470         * dynobj.h (Versions::define_base_version): New method declaration.
10471         (Versions::needs_base_version_): New data member declaration.
10472         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10473         (check_DATA): Add no_version_test.stdout.
10474         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10475         New make rules.
10476         * testsuite/Makefile.in: Regenerate.
10477         * testsuite/no_version_test.c: New file.
10478         * testsuite/no_version_test.sh: Ditto.
10479
10480 2009-10-16  Doug Kwan  <dougkwan@google.com>
10481
10482         * expression.cc (class Segment_start_expression): New class definition.
10483         (Segment_start_expression::value): New method definition.
10484         (script_exp_function_segment_start): Return a new
10485         Segment_start_expression.
10486         * gold/script-c.h (script_saw_segment_start_expression): New function
10487         prototype.
10488         * script-sections.cc (Script_sections::Script_sections): Initialize
10489         SAW_SEGMENT_START_EXPRESSION_ to false.
10490         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10491         and -Tbbs options to specify section addresses if given in
10492         command line and no SEGMENT_START expression is seen in a script.
10493         * script-sections.h (Script_sections::saw_segment_start_expression,
10494         Script_sections::set_saw_segment_start_expression): New method
10495         definition.
10496         (Script_sections::saw_segment_start_expression_): New data member
10497         declaration.
10498         * script.cc (script_saw_segment_start_expression): New function.
10499         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10500         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10501         script_test_7.sh and script_test_8.sh.
10502         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10503         script_test_8.stdout.
10504         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10505         (script_test_6, script_test_6.stdout, script_test_7,
10506         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10507         * Makefile.in: Regenerate.
10508         * testsuite/script_test_6.sh: New file.
10509         * testsuite/script_test_6.t: Same.
10510         * testsuite/script_test_7.sh: Same.
10511         * testsuite/script_test_7.t: Same.
10512         * testsuite/script_test_8.sh: Same.
10513
10514 2009-10-16  Doug Kwan  <dougkwan@google.com>
10515
10516         * output.cc (Output_segment::set_section_list_address): Cast
10517         expressions to unsigned long long type to avoid format warnings.
10518
10519 2009-10-15  Ian Lance Taylor  <iant@google.com>
10520
10521         * script.cc (Script_options::add_symbol_assignment): Always add a
10522         dot assignment to script_sections_.
10523         * script-sections.cc (Script_sections::add_dot_assignment):
10524         Initialize if necessary.
10525
10526         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10527         program headers with no load segment if there is a linker script.
10528
10529         * layout.cc (Layout::set_segment_offsets): Align the file offset
10530         to the segment aligment for -N or -n with no load segment.
10531         * output.cc (Output_segment::add_output_section): Don't crash if
10532         the first section is a TLS section.
10533         (Output_segment::set_section_list_addresses): Print an error
10534         message if the address moves backward in a linker script.
10535         * script-sections.cc
10536         (Output_section_element_input::set_section_addresses): Don't
10537         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10538         (Orphan_output_section::set_section_addresses): Likewise.
10539
10540 2009-10-15  Doug Kwan  <dougkwan@google.com>
10541
10542         * layout.cc (Layout::finish_dynamic_section): Generate tags
10543         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10544         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10545         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10546
10547 2009-10-14  Ian Lance Taylor  <iant@google.com>
10548
10549         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10550         fields.
10551         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10552         data_shdr fields of relinfo.
10553         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10554         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10555         R_386_TLS_LDO_32, adjust based on section flags.
10556         (Target_i386::Relocate::fix_up_ldo): Remove.
10557
10558 2009-10-13  Ian Lance Taylor  <iant@google.com>
10559
10560         Add support for -pie.
10561         * options.h (class General_options): Add -pie and
10562         --pic-executable.
10563         (General_options::output_is_position_independent): Test -pie.
10564         (General_options::output_is_executable): Return true if not shared
10565         and not relocatable.
10566         (General_options::output_is_pie): Remove.
10567         * options.cc (General_options::finalize): Reject incompatible uses
10568         of -pie.
10569         * gold.cc (queue_middle_tasks): A -pie link is not static.
10570         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10571         * symtab.cc (Symbol::final_value_is_known): Return false if
10572         output_is_position_independent.
10573         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10574         output_is_position_independent.
10575         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10576         output_is_position_independent.
10577         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10578         output_is_position_independent.
10579         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10580         two_file_pie_test.
10581         (basic_pie_test.o, basic_pie_test): New targets.
10582         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10583         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10584         (two_file_pie_test): New target.
10585         * testsuite/Makefile.in: Rebuild.
10586         * README: Remove note saying that -pie is not supported.
10587
10588 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10589
10590         * options.h (class General_options): Add -init and -fini.
10591         * layout.cc (Layout::finish_dynamic_section): Emit
10592         given init and fini functions.
10593
10594 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10595
10596         * gc.h (gc_process_relocs): Check if icf is enabled using new
10597         function.
10598         * gold.cc (queue_initial_tasks): Likewise.
10599         (queue_middle_tasks): Likewise.
10600         * object.cc (do_layout): Likewise.
10601         * symtab.cc (is_section_folded): Likewise.
10602         * main.cc (main): Likewise.
10603         * reloc.cc (Read_relocs::run): Likewise.
10604         (Sized_relobj::do_scan_relocs): Likewise.
10605         * icf.cc (is_function_ctor_or_dtor): New function.
10606         (Icf::find_identical_sections): Check if function is ctor or dtor when
10607         safe icf is chosen.
10608         * options.h (General_options::icf): Change option to be an enum.
10609         (Icf_status): New enum.
10610         (icf_enabled): New method.
10611         (icf_safe_folding): New method.
10612         (set_icf_status): New method.
10613         (icf_status_): New variable.
10614         * (options.cc) (General_options::finalize): Set icf_status_.
10615         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10616         icf_test and icf_keep_unique_test to use the --icf enum flag.
10617         * testsuite/icf_safe_test.sh: New file.
10618         * testsuite/icf_safe_test.cc: New file.
10619
10620 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10621
10622         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10623         includes to gc.h and icf.h.
10624         * arm.cc: Include gc.h.
10625         * gold.cc: Likewise.
10626         * i386.cc: Likewise.
10627         * powerpc.cc: Likewise.
10628         * sparc.cc: Likewise.
10629         * x86_64.cc: Likewise.
10630         * gc.h: Include icf.h.
10631
10632 2009-10-11  Ian Lance Taylor  <iant@google.com>
10633
10634         * plugin.cc: Include "gold.h" before other header files.
10635
10636 2009-10-10  Chris Demetriou  <cgd@google.com>
10637
10638         * options.h (Input_file_argument::Input_file_type): New enum.
10639         (Input_file_argument::is_lib_): Replace with...
10640         (Input_file_argument::type_): New member.
10641         (Input_file_argument::Input_file_argument): Take Input_file_type
10642         'type' rather than boolean 'is_lib' as second argument.
10643         (Input_file_argument::is_lib): Use type_.
10644         (Input_file_argument::is_searched_file): New function.
10645         (Input_file_argument::may_need_search): Handle is_searched_file.
10646         * options.cc (General_options::parse_library): Support -l:filename.
10647         (General_options::parse_just_symbols): Update for Input_file_argument
10648         changes.
10649         (Command_line::process): Likewise.
10650         * archive.cc (Archive::get_file_and_offset): Likewise.
10651         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10652         * script.cc (read_script_file, script_add_file): Likewise.
10653         * fileread.cc (Input_file::Input_file): Likewise.
10654         (Input_file::will_search_for): Handle is_searched_file.
10655         (Input_file::open): Likewise.
10656         * readsyms.cc (Read_symbols::get_name): Likewise.
10657         * testsuite/Makefile.am (searched_file_test): New test.
10658         * testsuite/Makefile.in: Regenerate.
10659         * testsuite/searched_file_test.cc: New file.
10660         * testsuite/searched_file_test_lib.cc: New file.
10661
10662 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10663             Ian Lance Taylor  <iant@google.com>
10664
10665         * descriptor.cc: Include <cstdio> and "binary-io.h".
10666         (Descriptors::open): Open the files in binary mode always.
10667         * script.cc (Lex::get_token): Treat \r as whitespace.
10668
10669 2009-10-09  Ian Lance Taylor  <iant@google.com>
10670
10671         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10672
10673 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10674             Ian Lance Taylor  <iant@google.com>
10675
10676         * configure.ac: Check for readv function also.
10677         * fileread.cc (readv): Define if not HAVE_READV.
10678         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10679         does not exist.
10680         * config.in: Regenerate.
10681         * configure: Regenerate.
10682
10683 2009-10-09  Doug Kwan  <dougkwan@google.com>
10684
10685         * layout.cc (Layout::make_output_section): Call target hook to make
10686         ordinary output section.
10687         (Layout::finalize): Adjust parameter list of call the
10688         Target::may_relax().
10689         * layout.h (class Layout::section_list): New method.
10690         * merge.h (Output_merge_base::entsize): Change visibility to public.
10691         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10692         New methods.
10693         (Output_merge_string::do_is_string): New method.
10694         * object.cc (Sized_relobj::do_setup): renamed from
10695         Sized_relobj::set_up.
10696         * object.h (Sized_relobj::adjust_shndx,
10697         Sized_relobj::initializ_input_to_output_maps,
10698         Sized_relobj::free_input_to_output_maps): Change visibilities to
10699         protected.
10700         (Sized_relobj::setup): Virtualize.
10701         (Sized_relobj::do_setup): New method declaration.
10702         (Sized_relobj::invalidate_section_offset,
10703         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10704         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10705         * options.cc (parse_int): New function.
10706         * options.h (parse_int): New declaration.
10707         (DEFINE_int): New macro.
10708         (stub_group_size): New option.
10709         * output.cc (Output_section::Output_section): Initialize memebers
10710         merge_section_map_, merge_section_by_properties_map_,
10711         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10712         (Output_section::add_input_section): Handled deferred code-fill
10713         generation and remove an old comment.
10714         (Output_section::add_relaxed_input_section): New method definition.
10715         (Output_section::add_merge_input_section): Use merge section by
10716         properties map to speed to search.  Update merge section maps
10717         as appropriate.
10718         (Output_section::build_relaxation_map): New method definition.
10719         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10720         Same.
10721         (Output_section::relax_input_section): Renamed to
10722         Output_section::convert_input_sections_to_relaxed_sections and change
10723         interface to take a vector of pointers to relaxed sections.
10724         (Output_section::find_merge_section,
10725         Output_section::find_relaxed_input_section): New method definitions.
10726         (Output_section::is_input_address_mapped,
10727         Output_section::output_offset, Output_section::output_address):
10728         Use output section data maps to speed up searching.
10729         (Output_section::find_starting_output_address): Add comments.
10730         (Output_section::do_write,
10731         Output_section::write_to_postprocessing_buffer): Do code-fill
10732         generation as appropriate.
10733         (Output_section::get_input_sections): Invalidate relaxed input section
10734         map.
10735         (Output_section::restore_states): Adjust type of checkpoint .
10736         Invalidate relaxed input section map.
10737         * output.h (Output_merge_base): New class declaration.
10738         (Input_section_specifier): New class defintion.
10739         (class Output_relaxed_input_section) Change base class to
10740         Output_section_data_build.
10741         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10742         base class initializer.
10743         (Output_section::add_relaxed_input_section): New method declaration.
10744         (Output_section::Input_section): Change visibility to protected.
10745         (Output_section::Input_section::relobj,
10746         Output_section::Input_section::shndx): Handle relaxed input sections.
10747         Output_section::input_sections) Change visibility to protected.  Also
10748         define overload to return a non-const pointer.
10749         (Output_section::Merge_section_properties): New class defintion.
10750         (Output_section::Merge_section_by_properties_map,
10751         Output_section::Output_section_data_by_input_section_map,
10752         Output_section::Relaxation_map): New types.
10753         (Output_section::relax_input_section): Rename method to
10754         Output_section::convert_input_sections_to_relaxed_sections and change
10755         interface to take a vector of relaxed section pointers.
10756         (Output_section::find_merge_section,
10757         Output_section::find_relaxed_input_section,
10758         Output_section::build_relaxation_map,
10759         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10760         New method declarations.
10761         (Output_section::merge_section_map_
10762         Output_section::merge_section_by_properties_map_,
10763         Output_section::relaxed_input_section_map_,
10764         Output_section::is_relaxed_input_section_map_valid_,
10765         Output_section::generate_code_fills_at_write_): New data members.
10766         * script-sections.cc
10767         (Output_section_element_input::set_section_addresses): Call
10768         current_data_size and addralign methods of relaxed input sections.
10769         (Orphan_output_section::set_section_addresses): Call current_data_size
10770         and addralign methods of relaxed input sections.
10771         * symtab.cc (Symbol_table::compute_final_value): Extract template
10772         from the body of Symbol_table::sized_finalize_symbol.
10773         (Symbol_table::sized_finalized_symbol): Call
10774         Symbol_table::compute_final_value.
10775         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10776         (Symbol_table::compute_final_value): New templated method declaration.
10777         * target.cc (Target::do_make_output_section): New method defintion.
10778         * target.h (Target::make_output_section): New method declaration.
10779         (Target::relax): Add more parameters for input objects, symbol table
10780         and layout.  Adjust call to do_relax.
10781         (Target::do_make_output_section): New method declaration.
10782         (Target::do_relax): Add parameters for input objects, symbol table
10783         and layout.
10784
10785 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10786
10787         * pread.c: Include stdio.h.
10788
10789 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10790
10791         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10792         defined.
10793
10794 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10795
10796         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10797         Change read_shndx type to unsigned int.
10798         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10799         int.
10800         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10801         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10802         Change read_shndx type to unsigned int.
10803         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10804         int.
10805         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10806         * layout.cc (Layout::create_symtab_sections): Cast the result of
10807         local_symcount * symsize to off_t in the gold_assert.
10808
10809 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10810
10811         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10812         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10813         R_ARM_BASE_ABS.
10814         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10815         (Arm_relocate_functions::thm_abs5): New function.
10816         (Arm_relocate_functions::abs12): New function.
10817         (Arm_relocate_functions::abs16): New function.
10818         (Arm_relocate_functions::base_abs): New function.
10819         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10820         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10821         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10822         R_ARM_BASE_ABS.
10823         (Scan::global): Likewise.
10824         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10825         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10826         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10827         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10828         R_ARM_BASE_ABS.
10829
10830 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10831
10832         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10833         (Arm_relocate_functions::movt_prel): New function.
10834         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10835         (Arm_relocate_functions::thm_movt_prel): New function.
10836         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10837         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10838         (Scan::global, Relocate::relocate): Likewise.
10839         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10840
10841 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10842
10843         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10844         Incremental_checker.
10845         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10846         unsigned int.
10847         (class Incremental_inputs_header): New class.
10848         (Incremental_inputs_header_writer): Edit comment.
10849         (Incremental_inputs_entry): New class.
10850         (Incremental_inputs_entry_writer): Edit comment.
10851         (Sized_incremental_binary::do_find_incremental_inputs_section):
10852         Add *strtab_shndx parameter, fill it.
10853         (Sized_incremental_binary::do_check_inputs): New method.
10854         (Incremental_checker::can_incrementally_link_output_file): Use
10855         Sized_incremental_binary::check_inputs.
10856         (Incremental_inputs::report_command_line): Save command line in
10857         command_line_.
10858         * incremental.h:
10859         (Incremental_binary::find_incremental_inputs_section): New
10860         method.
10861         (Incremental_binary::do_find_incremental_inputs_section): Add
10862         strtab_shndx parameter.
10863         (Incremental_binary::do_check_inputs): New pure virtual method.
10864         (Sized_incremental_binary::do_check_inputs): Declare.
10865         (Incremental_checker::Incremental_checker): Add incremental_inputs
10866         parameter, use it to initialize incremental_inputs_.
10867         (Incremental_checker::incremental_inputs_): New field.
10868         (Incremental_checker::command_line): New method.
10869         (Incremental_checker::inputs): New method.
10870         (Incremental_checker::command_line_): New field.
10871
10872 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10873
10874         * incremental.cc: Include <cstdarg> and "target-select.h".
10875         (vexplain_no_incremental): New function.
10876         (explain_no_incremental): New function.
10877         (Incremental_binary::error): New method.
10878         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10879         method.
10880         (make_sized_incremental_binary): New function.
10881         (open_incremental_binary): New function.
10882         (can_incrementally_link_file): Add checks if output is ELF and has
10883         inputs section.
10884         * incremental.h: Include "elfcpp_file.h" and "output.h".
10885         (Incremental_binary): New class.
10886         (Sized_incremental_binary): New class.
10887         (open_incremental_binary): Declare.
10888         * object.cc (is_elf_object): Use
10889         elfcpp::Elf_recognizer::is_elf_file.
10890         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10891         * output.h (Output_file::filesize): New method.
10892
10893 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10894
10895         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10896         New function.
10897         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10898         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10899         function.
10900         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10901         function.
10902         (Arm_relocate_functions::movw_abs_nc): New function.
10903         (Arm_relocate_functions::movt_abs): New function.
10904         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10905         (Arm_relocate_functions::thm_movt_abs): New function.
10906         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10907         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10908         (Scan::global): Likewise.
10909         (Relocate::relocate): Likewise.
10910         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10911
10912 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10913
10914         * arm.cc (Arm_relocate_functions::got_prel) New function.
10915         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10916         (Relocate::relocate): Likewise.
10917         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10918
10919 2009-10-06  Ian Lance Taylor  <iant@google.com>
10920
10921         * options.h (class General_options): Define
10922         split_stack_adjust_size parameter.
10923         * object.h (class Object): Add uses_split_stack_ and
10924         has_no_split_stack_ fields.  Add uses_split_stack and
10925         has_no_split_stack accessor functions.  Declare
10926         handle_split_stack_section.
10927         (class Reloc_symbol_changes): Define.
10928         (class Sized_relobj): Define Function_offsets.  Declare
10929         split_stack_adjust, split_stack_adjust_reltype, and
10930         find_functions.
10931         * object.cc (Object::handle_split_stack_section): New function.
10932         (Sized_relobj::do_layout): Call handle_split_stack_section.
10933         * dynobj.cc (Sized_dynobj::do_layout): Call
10934         handle_split_stack_section.
10935         * reloc.cc (Sized_relobj::relocate_sections): Call
10936         split_stack_adjust for executable sections in split_stack
10937         objects.  Pass reloc_map to relocate_section.
10938         (Sized_relobj::split_stack_adjust): New function.
10939         (Sized_relobj::split_stack_adjust_reltype): New function.
10940         (Sized_relobj::find_functions): New function.
10941         * target-reloc.h: Include "object.h".
10942         (relocate_section): Add reloc_symbol_changes parameter.  Change
10943         all callers.
10944         * target.h (class Target): Add calls_non_split method.  Declare
10945         do_calls_non_split virtual method.  Declare match_view and
10946         set_view_to_nop.
10947         * target.cc: Include "elfcpp.h".
10948         (Target::do_calls_non_split): New function.
10949         (Target::match_view): New function.
10950         (Target::set_view_to_nop): New function.
10951         * gold.cc (queue_middle_tasks): Give an error if mixing
10952         split-stack and non-split-stack objects with -r.
10953         * i386.cc (Target_i386::relocate_section): Add
10954         reloc_symbol_changes parameter.
10955         (Target_i386::do_calls_non_split): New function.
10956         * x86_64.cc (Target_x86_64::relocate_section): Add
10957         reloc_symbol_changes parameter.
10958         (Target_x86_64::do_calls_non_split): New function.
10959         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10960         parameter.
10961         * powerpc.cc (Target_powerpc::relocate_section): Add
10962         reloc_symbol_changes parameter.
10963         * sparc.cc (Target_sparc::relocate_section): Add
10964         reloc_symbol_changes parameter.
10965         * configure.ac: Call AM_CONDITIONAL for the default target.
10966         * configure: Rebuild.
10967         * testsuite/Makefile.am (TEST_AS): New variable.
10968         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10969         (check_DATA): Add split_i386 and split_x86_64 files.
10970         (SPLIT_DEFSYMS): Define.
10971         (split_i386_[1234n].o): New targets.
10972         (split_i386_[124]): New targets.
10973         (split_i386_[1234r].stdout): New targets.
10974         (split_x86_64_[1234n].o): New targets.
10975         (split_x86_64_[124]): New targets.
10976         (split_x86_64_[1234r].stdout): New targets.
10977         (MOSTLYCLEANFILES): Add new executables.
10978         * testsuite/split_i386.sh: New file.
10979         * testsuite/split_x86_64.sh: New file.
10980         * testsuite/split_i386_1.s: New file.
10981         * testsuite/split_i386_2.s: New file.
10982         * testsuite/split_i386_3.s: New file.
10983         * testsuite/split_i386_4.s: New file.
10984         * testsuite/split_i386_n.s: New file.
10985         * testsuite/split_x86_64_1.s: New file.
10986         * testsuite/split_x86_64_2.s: New file.
10987         * testsuite/split_x86_64_3.s: New file.
10988         * testsuite/split_x86_64_4.s: New file.
10989         * testsuite/split_x86_64_n.s: New file.
10990         * testsuite/testfile.cc (Target_test): Update relocation_section
10991         function.
10992         * testsuite/Makefile.in: Rebuild.
10993
10994 2009-10-06  Ian Lance Taylor  <iant@google.com>
10995
10996         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10997         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10998         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10999         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11000         the address on ldo_addrs_.
11001         (Target_i386::Relocate::fix_up_ldo): New function.
11002
11003 2009-10-06   Rafael Espindola  <espindola@google.com>
11004
11005         * plugin.cc (add_input_library): New.
11006         (Plugin::load): Add add_input_library to tv.
11007         (Plugin_manager::add_input_file): Add the is_lib argument.
11008         (add_input_file): Update call to Plugin_manager::add_input_file.
11009         (add_input_library): New.
11010         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11011
11012 2009-09-30  Doug Kwan  <dougkwan@google.com>
11013
11014         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11015         symbol and call Symbol::may_need_copy_reloc to determine if
11016         a copy reloc is needed.
11017         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11018         nocopyreloc is given in command line.
11019         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11020         given in command line.
11021         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11022         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11023         of the removed Target_i386::may_need_copy_reloc.
11024         * options.h (copyreloc): New option with default value false.
11025         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11026         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11027         instead of the removed Target_powerpc::may_need_copy_reloc.
11028         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11029         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11030         instead of the removed Target_sparc::may_need_copy_reloc.
11031         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11032         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11033         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11034         instead of the removed Target_x86_64::may_need_copy_reloc.
11035
11036 2009-09-30  Ian Lance Taylor  <iant@google.com>
11037
11038         * object.h (class Object): Remove target_ field, and target,
11039         sized_target, and set_target methods.
11040         (Object::sized_target): Remove.
11041         (class Sized_relobj): Update declarations.  Remove sized_target.
11042         * object.cc (Sized_relobj::setup): Remove target parameter.
11043         Change all callers.
11044         (Input_objects::add_object): Don't do anything with the target.
11045         (make_elf_sized_object): Add punconfigured parameter.  Change all
11046         callers.  Set or test parameter target.
11047         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11048         Change all callers.
11049         * parameters.cc (Parameters::set_target): Change parameter type to
11050         be non-const.
11051         (Parameters::default_target): Remove.
11052         (set_parameters_target): Change parameter type to be non-const.
11053         (parameters_force_valid_target): New function.
11054         (parameters_clear_target): New function.
11055         * parameters.h (class Parameters): Update declarations.  Remove
11056         default_target method.  Add sized_target and clear_target
11057         methods.  Change target_ to be non-const.
11058         (set_parameters_target): Update declaration.
11059         (parameters_force_valid_target): Declare.
11060         (parameters_clear_target): Declare.
11061         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11062         as NULL if we aren't searching.
11063         (Add_symbols::run): Don't check for compatible target.
11064         * fileread.cc (Input_file::open_binary): Call
11065         parameters_force_valid_target.
11066         * gold.cc (queue_middle_tasks): Likewise.
11067         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11068         set_target on object.
11069         * dynobj.h (class Sized_dynobj): Update declarations.
11070         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11071         make_elf_object returns NULL.
11072         (Archive::include_member): Don't check whether object target is
11073         compatible.
11074         * output.cc (Output_section::add_input_section): Get target from
11075         parameters.
11076         (Output_section::relax_input_section): Likewise.
11077         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11078         parameters.
11079         (Sized_relobj::do_scan_relocs): Likewise.
11080         (Sized_relobj::relocate_sections): Likewise.
11081         * resolve.cc (Symbol_table::resolve): Likewise.
11082         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11083         parameter.  Change all callers.
11084         (Symbol_table::add_from_object): Get target from parameters.
11085         (Symbol_table::add_from_relobj): Don't check object target.
11086         (Symbol_table::add_from_dynobj): Likewise.
11087         (Symbol_table::define_special_symbol): Get target from
11088         parameters.
11089         * symtab.h (class Symbol_table): Update declaration.
11090         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11091         parameter.  Change all callers.  Clear parameter target.
11092         (Binary_test): Test target here.
11093         * testsuite/object_unittest.cc (gold_testsuite): Remove
11094         target_test_pointer parameter.  Change all callers.
11095         (Object_test): Test target here.
11096
11097 2009-09-26  Ian Lance Taylor  <iant@google.com>
11098
11099         * testsuite/initpri1.c: Don't try to use constructor priorities if
11100         compiling with gcc before 4.3.
11101
11102 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11103
11104         * testsuite/retain_symbols_file_test.sh (check_present): Change
11105         output file name to retain_symbols_file_test.stdout.
11106         (check_absent): Likewise.
11107
11108 2009-09-18  Craig Silverstein  <csilvers@google.com>
11109
11110         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11111         * options.cc: Include <cerrno> and <fstream>.
11112         (General_options::finalize): Parse -retain-symbols-file tag.
11113         * options.h: New flag.
11114         (General_options): New method should_retain_symbol, new
11115         variable symbols_to_retain.
11116         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11117         should_retain_symbol map.
11118         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11119         * testsuite/Makefile.in: Regenerate.
11120         * testsuite/retain_symbols_file_test.sh: New file.
11121
11122 2009-09-18  Nick Clifton  <nickc@redhat.com>
11123
11124         * po/es.po: Updated Spanish translation.
11125
11126 2009-09-17  Doug Kwan  <dougkwan@google.com>
11127
11128         * debug.h (DEBUG_RELAXATION): New constant.
11129         (DEBUG_ALL): Add DEBUG_RELAXATION.
11130         (debug_string_to_enum): Add relaxation debug option.
11131         * layout.cc
11132         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11133         Layout::Relaxation_debug_check::read_sections,
11134         Layout::Relaxation_debug_check::read_sections): New method definitions.
11135         (Layout::Layout): Initialize data members
11136         record_output_section_data_from_scrips_,
11137         script_output_section_data_list_ and relaxation_debug_check_.
11138         (Layout::save_segments, Layout::restore_segments,
11139         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11140         Layout::relaxation_loop_body): New method definitions.
11141         (Layout::finalize): Support relaxation.  Move section layout code to
11142         Layout::relaxation_loop_body.
11143         (Layout::set_asection_address_from_script): Move code for orphan
11144         section placement out.
11145         (Layout::place_orphan_sections_in_script): New method definition.
11146         * layout.h (Output_segment_headers, Output_file_header):
11147         New forward class declarations.
11148         (Layout::~Layout): Define.
11149         (Layout::new_output_section_data_from_script): New method definition.
11150         (Layout::place_orphan_sections_in_script): New method declaration.
11151         (Layout::Segment_states): New type declaration.
11152         (Layout::save_segments, Layout::restore_segments,
11153         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11154         Layout::relaxation_loop_body): New method declarations.
11155         (Layout::Output_section_data_list): New type declaration.
11156         (Layout::Relaxation_debug_check): New class definition.
11157         (Layout::record_output_section_data_from_script_,
11158         Layout::script_output_section_data_list_, Layout::segment_states_,
11159         Layout::relaxation_debug_check_): New data members.
11160         * output.cc: (Output_section_headers::do_size): New method definition.
11161         (Output_section_headers::Output_section_headers): Move size
11162         computation to Output_section_headers::do_size.
11163         (Output_segment_headers::do_size): New method definition.
11164         (Output_file_header::Output_file_header): Move size computation to
11165         Output_file_header::do_size and call it.
11166         (Output_file_header::do_size): New method definition.
11167         (Output_data_group::Output_data_group): Adjust call to
11168         Output_section_data.
11169         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11170         (Output_symtab_xindex::do_write): Add array bound check.
11171         (Output_section::Input_section::print_to_mapfile): Handle
11172         RELAXED_INPUT_SECTION_CODE.
11173         (Output_section::Output_section): Initialize data member checkpoint_.
11174         (Output_section::~Output_section): Delete checkpoint object pointed
11175         by checkpoint_.
11176         (Output_section::add_input_section): Always add an Input_section if
11177         relaxing.
11178         (Output_section::add_merge_input_section): Add assert.
11179         (Output_section::relax_input_section): New method definition.
11180         (Output_section::set_final_data_size): Set load address to zero for
11181         an unallocated section.
11182         (Output_section::do_address_and_file_offset_have_reset_values):
11183         New method definition.
11184         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11185         Handle relaxed input section.
11186         (Output_section::sort_attached_input_sections): Checkpoint input
11187         section list lazily.
11188         (Output_section::get_input_sections): Change type of input_sections to
11189         list of Simple_input_section pointers.  Checkpoint input section list
11190         lazily.  Also handle relaxed input sections.
11191         (Output_section::add_input_section_for_script): Take a reference to
11192         a Simple_input_section object instead of Relobj pointer and section
11193         index as parameter.  Handle relaxed input sections.
11194         (Output_section::save_states, Output_section::restore_states): New
11195         method definitions.
11196         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11197         (Output_data::is_data_size_fixed): New method definition.
11198         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11199         if it is fixed.
11200         (Output_data::address_and_file_offset_have_reset_values): New method
11201         definition.
11202         (Output_data::do_address_and_file_offset_have_reset_values): New method
11203         definition.
11204         (Output_data::set_data_size): Check that data size is not fixed.
11205         (Output_data::fix_data_size): New method definition.
11206         (Output_data::is_data_size_fixed_): New data member.
11207         (Output_section_headers::set_final_data_size): New method definition.
11208         (Output_section_headers::do_size): New method declaration.
11209         (Output_segment_headers::set_final_data_size): New method definition.
11210         (Output_segment_headers::do_size): New method declaration.
11211         (Output_file_header::set_final_data_size)::New method definition.
11212         (Output_file_header::do_size)::New method declaration.
11213         (Output_section_data::Output_section_data): Add new parameter
11214         is_data_size_fixed and use it to fix data size.
11215         (Output_data_const::Output_data_const): Adjust call to base class
11216         constructor and fix data size.
11217         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11218         base class constructor and fix data size.
11219         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11220         base class constructor and fix data size.
11221         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11222         class constructor and fix data size.
11223         (Output_data_group::set_final_data_size): New method definition.
11224         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11225         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11226         class constructor and fix data size.
11227         (Output_relaxed_input_section): New class definition.
11228         (Output_section::Simple_input_section): New class definition.
11229         (Output_section::get_input_sections): Adjust parameter list.
11230         (Output_section::add_input_section_for_script): Same.
11231         (Output_section::save_states, Output_section::restore_states,
11232         Output_section::do_address_and_file_offset_have_reset_values,
11233         (Output_section::Input_section::Input_section): Handle
11234         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11235         Output_relaxed_input_section.
11236         (Output_section::Input_section::is_input_section,
11237         Output_section::Input_section::set_output_section): Handle relaxed
11238         input section.
11239         (Output_section::Input_section::is_relaxed_input_section,
11240         Output_section::Input_section::output_section_data,
11241         Output_section::Input_section::relaxed_input_section): New method
11242         definitions.
11243         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11244         value.
11245         (Output_section::Input_section::u1_): Update comments.
11246         (Output_section::Input_section::u2_): Add new union member poris.
11247         (Output_section::Checkpoint_output_section): New classs definition.
11248         (Output_section::relax_input_section): New method declaration.
11249         (Output_section::checkpoint_): New data member.
11250         (Output_segment): Update comments.
11251         (Output_segment::Output_segment): Un-privatize copy constructor.
11252         (Output_segment::operator=): Un-privatize.
11253         * script-sections.cc (Output_section_element::Input_section_list):
11254         Change element type to Output_section::Simple_input_section.
11255         (Output_section_element_dot_assignment::set_section_addresses):
11256         Register output section data for relaxation clean up.
11257         (Output_data_exression::Output_data_expression): Adjust call to base
11258         constructor to fix data size.
11259         (Output_section_element_data::set_section_addresses): Register
11260         Output_data_expression object for relaxation clean up.
11261         (struct Input_section_info): Replace Relobj pointer and section index
11262         pair with Output_section::Simple_input_section and Convert struct to a
11263         class.
11264         (Input_section_sorter::operator()): Adjust access to
11265         Input_section_info data member to use accessors.
11266         (Output_section_element_input::set_section_addresses): Use layout
11267         parameter.  Adjust code to use Output_section::Simple_input_section
11268         and Input_secction_info classes.  Register filler for relaxation
11269         clean up.
11270         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11271         and section index pair with Output_section::Simple_input_section
11272         class.  Adjust code accordingly.
11273         (Phdrs_element::release_segment): New method definition.
11274         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11275         segment list.
11276         (Script_sections::release_segments): New method definition.
11277         * gold/script-sections.h (Script_sections::release_segments): New
11278         method declaration.
11279         * gold/target.h (Target::may_relax, Target::relax,
11280         Target::do_may_relax, Target::do_relax): New method definitions.
11281
11282 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11283
11284         * arm.cc (has_signed_unsigned_overflow): New function.
11285         (Arm_relocate_functions::abs8): New function.
11286         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11287         (Target_arm::Scan::global): Likewise.
11288         (Target_arm::relocate::relocate): Likewise.
11289         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11290         Likewise.
11291
11292 2009-09-16  Cary Coutant  <ccoutant@google.com>
11293
11294         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11295         * testsuite/Makefile.in: Regenerate.
11296
11297 2009-09-11  Nick Clifton  <nickc@redhat.com>
11298
11299         * po/gold.pot: Updated by the Translation project.
11300
11301 2009-09-08  Cary Coutant  <ccoutant@google.com>
11302
11303         * output.cc (Output_file::open): Add execute permission to empty file.
11304         * testsuite/Makefile.am (permission_test): New test.
11305         * testsuite/Makefile.in: Regenerate.
11306
11307 2009-09-02  Ian Lance Taylor  <iant@google.com>
11308
11309         * output.cc (Output_file::resize): Call map_no_anonymous rather
11310         than map.
11311
11312 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11313
11314         * gold.cc: Include "incremental.h".
11315         (queue_initial_tasks): Call Incremental_checker methods.
11316         * incremental.cc: Include "output.h".
11317         (Incremental_checker::can_incrementally_link_output_file): New
11318         method.
11319         * incremental.h (Incremental_checker): New class.
11320
11321         * output.cc (Output_file::open_for_modification): New method.
11322         (Output_file::map_anonymous): Changed return type to bool.  Record
11323         map in base_ field.
11324         (Output_file::map_no_anonymous): New method, broken out of map.
11325         (Output_file::map): Use map_no_anonymous and map_anonymous.
11326         * output.h (class Output_file): Update declarations.
11327
11328 2009-08-24  Cary Coutant  <ccoutant@google.com>
11329
11330         * options.h (Command_line::Pre_options): New class.
11331         (Command_line::pre_options): New member.
11332         * options.cc (gold::options::ready_to_register): New variable.
11333         (One_option::register_option): Do nothing if not registering options.
11334         Assert if same short option registered twice.
11335         (General_options::General_options): Turn off option registration when
11336         done constructing.
11337         (Command_line::Pre_options::Pre_options): New constructor.
11338
11339 2009-08-24  Cary Coutant  <ccoutant@google.com>
11340
11341         * options.h (General_options::no_keep_memory): Remove incorrect
11342         short option.
11343
11344 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11345
11346         * Makefile.am (am__skiplex, am__skipyacc): New.
11347         * Makefile.in: Regenerate.
11348
11349 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11350
11351         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11352         (INCLUDES): ... this.
11353         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11354         (AM_CPPFLAGS): Renamed from ...
11355         (INCLUDE): ... this.
11356         * Makefile.in, testsuite/Makefile.in: Regenerate.
11357
11358         * Makefile.in: Regenerate.
11359         * aclocal.m4: Likewise.
11360         * config.in: Likewise.
11361         * configure: Likewise.
11362         * testsuite/Makefile.in: Likewise.
11363
11364         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11365         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11366         * Makefile.in: Regenerate.
11367         * testsuite/Makefile.in: Regenerate.
11368
11369 2009-08-19  Cary Coutant  <ccoutant@google.com>
11370
11371         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11372         symbols in shared libraries overridden by hidden or internal symbols
11373         in the main program.
11374
11375 2009-08-19  Chris Demetriou  <cgd@google.com>
11376
11377         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11378         checking source file names in error messages.
11379
11380 2009-08-18  Doug Kwan  <dougkwan@google.com>
11381
11382         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11383         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11384         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11385         an elfcpp::Ehdr as parameter.
11386         * object.cc (Object::set_target): Remove the version that looks up
11387         a target and sets it.
11388         (Sized_relobj::setup): Take a Target object instead of
11389         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11390         (make_elf_sized_object): Find target and ask target to
11391         make an ELF object.
11392         * object.h: (Object::set_target): Remove the version that looks up
11393         a target and sets it.
11394         (Sized_relobj::setup): Take a Target object instead of
11395         an elfcpp:Ehdr as parameter.
11396         * target.cc: Include dynobj.h.
11397         (Target::do_make_elf_object_implementation): New.
11398         (Target::do_make_elf_object): New.
11399         * target.h (Target::make_elf_object): New template declaration.
11400         (Target::do_make_elf_object): New method declarations.
11401         (Target::do_make_elf_object_implementation): New template declaration.
11402
11403 2009-08-14  Ian Lance Taylor  <iant@google.com>
11404
11405         * gold.h (FUNCTION_NAME): Define.
11406         (gold_unreachable): Use FUNCTION_NAME.
11407
11408 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11409
11410         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11411         symbol in the --keep-unique list is not found.
11412
11413 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11414
11415         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11416         been maked as --keep-unique.
11417         (Icf::unfold_section): New function.
11418         * icf.h (Icf::unfold_section): New function.
11419         * options.h (General_options::keep_unique): New option.
11420         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11421         * testsuite/Makefile.in: Regenerate.
11422         * testsuite/icf_keep_unique_test.sh: New file.
11423         * testsuite/icf_keep_unique_test.cc: New file.
11424
11425 2009-08-12  Cary Coutant  <ccoutant@google.com>
11426
11427         PR 10471
11428         * resolve.cc (Symbol_table::resolve): Check for references from
11429         dynamic objects to hidden and internal symbols.
11430         * testsuite/Makefile.am (hidden_test.sh): New test.
11431         * testsuite/Makefile.in: Regenerate.
11432         * testsuite/hidden_test.sh: New script.
11433         * testsuite/hidden_test_1.c: New test source.
11434         * testsuite/hidden_test_main.c: New test source.
11435
11436 2009-08-11  Doug Kwan  <dougkwan@google.com>
11437
11438         * arm.cc: Update comments.
11439         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11440         segment to locate the .ARM.exidx section if present.
11441
11442 2009-08-09  Doug Kwan  <dougkwan@google.com>
11443
11444         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11445         patch.
11446
11447 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11448         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11449         compiler warnings.
11450
11451 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11452
11453         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11454         valid tls_segment only for non-debug-section relocations.
11455         * testsuite/Makefile.am: Add gc_tls_test.
11456         * testsuite/Makefile.in: Regenerate.
11457         * testsuite/gc_tls_test.cc: New file.
11458         * testsuite/gc_tls_test.sh: New file.
11459
11460 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11461
11462         * icf.cc: New file.
11463         * icf.h: New file.
11464         * Makefile.am (CCFILES): Add icf.cc.
11465         (HFILES): Add icf.h
11466         * Makefile.in: Regenerate.
11467         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11468         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11469         section, symbol and addend information for the relocs.
11470         * gold.cc (queue_middle_tasks): Call identical code folding.
11471         * gold.h: Add defines for multimap.
11472         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11473         to the call of finalize_local_symbols.
11474         * main.cc (main): Create object of class Icf.
11475         * object.cc (Sized_relobj::do_layout): Allow this function to be
11476         called twice during icf.
11477         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11478         to sections marked as identical by icf.
11479         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11480         when available.
11481         (Sized_relobj::do_section_entsize): New function.
11482         * object.h (Object::section_entsize): New function.
11483         (Object::do_section_entsize): New pure virtual function.
11484         (Relobj::finalize_local_symbols): Add new parameter.
11485         (Relobj::do_section_entsize): New function.
11486         * options.h (General_options::icf): New option.
11487         (General_options::icf_iterations): New option.
11488         (General_options::print_icf_sections): New option.
11489         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11490         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11491         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11492         icf.
11493         * symtab.cc (Symbol_table::is_section_folded): New function.
11494         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11495         to sections marked as identical by icf.
11496         * symtab.h (Symbol_table::set_icf): New function.
11497         (Symbol_table::icf): New function.
11498         (Symbol_table::is_section_folded): New function.
11499         (Symbol_table::icf_): New data member.
11500         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11501         * testsuite/Makefile.am: Add commands to build icf_test.
11502         * testsuite/Makefile.in: Regenerate.
11503         * testsuite/icf_test.sh: New file.
11504         * testsuite/icf_test.cc: New file.
11505
11506 2009-07-24  Chris Demetriou  <cgd@google.com>
11507
11508         * layout.cc (is_compressible_debug_section): Fix incorrect
11509         comment about compressed section names.
11510
11511 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11512
11513         PR 10419
11514         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11515
11516 2009-07-16  Ian Lance Taylor  <iant@google.com>
11517
11518         PR 10400
11519         * layout.h: #include <map>.
11520         (class Kept_section): Change from struct to class.  Add accessors
11521         and setters.  Add section size to Comdat_group mapping.  Change
11522         Comdat_group to std::map.  Add is_comdat_ field.  Add
11523         linkonce_size field in union.
11524         (class Layout): Update declaration of find_or_add_kept_section.
11525         Don't declare find_kept_object.
11526         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11527         parameter.  Add object, shndx, is_comdat, and is_group_name
11528         parameters.  Change all callers.  Adjust for new Kept_section.
11529         (Layout::find_kept_object): Remove.
11530         * object.cc (Sized_relobj::include_section_group): Update use of
11531         Kept_section.  Rename secnum to shndx.  Only record
11532         Kept_comdat_section if sections are the same size.
11533         (Sized_relobj::include_linkonce_section): Update use of
11534         Kept_section.  Only record Kept_comdat_section if sections are the
11535         same size.  Set size of linkonce section.
11536         (Sized_relobj::map_to_kept_section): Update call to
11537         get_kept_comdat_section.
11538         * object.h (class Sized_relobj): Rename fields in
11539         Kept_comdat_section to drop trailing underscores; change object
11540         field to Relobj*.  Change Kept_comdat_section_table to store
11541         struct rather than pointer.
11542         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11543         Add kept_object and kept_shndx parameters.  Change all callers.
11544         (Sized_relobj::get_kept_comdat_section): Change return type to
11545         bool.  Add kept_object and kept_shndx parameters.  Change all
11546         callers.
11547         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11548         Layout::find_or_add_kept_section.
11549
11550 2009-07-09  Ian Lance Taylor  <iant@google.com>
11551
11552         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11553         Reserve space in the hash table.
11554
11555 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11556
11557         * fileread.cc (File_read::get_mtime): New method.
11558         * fileread.h (Timespec): New structure.
11559         (File_read::get_mtime): New method.
11560         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11561         Renamed from timestamp_nsec.
11562         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11563         Elf_Xword.
11564         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11565         timestamp_nsec.
11566         (Incremental_inputs::report_archive): Save mtime; style fix.
11567         (Incremental_inputs::report_obejct): Save mtime; style fix.
11568         (Incremental_inputs::report_script): Save mtime; style fix.
11569         (Incremental_inputs::finalize_inputs): Style fix.
11570         (Incremental_inputs::finalize): Style fix.
11571         (Incremental_inputs::create_input_section_data): Store inputs
11572         mtime.
11573         * incremental.h (Incremental_inputs::report_script): Add mtime
11574         argument.
11575         (Incremental_inputs::Input_info::Input_info): Intialize only one
11576         union member.
11577         (Incremental_inputs::Input_info::archive): Move to nameless
11578         union.
11579         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11580         (Incremental_inputs::Input_info::script): Move to nameless union.
11581         (Incremental_inputs::mtime): New field.
11582         * script.cc (read_input_script): Pass file mtime to
11583         Incremental_input.
11584         * script.h (Script_info::inputs): Style fix.
11585
11586 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11587
11588         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11589         instead of 32.
11590
11591 2009-06-24  Ian Lance Taylor  <iant@google.com>
11592
11593         PR 10156
11594         * layout.cc (Layout::choose_output_section): If we find an
11595         existing section, update the flags.
11596         (Layout::create_notes): New function, broken out of
11597         Layout::finalize.
11598         (Layout::finalize): Don't create note sections.
11599         (Layout::create_note): Don't crash if linker script discards
11600         section.
11601         (Layout::create_gold_note): Likewise.
11602         (Layout::create_build_id): Likewise.  Don't set
11603         after_input_sections on the section.
11604         (Layout::create_executable_stack_info): Remove target parameter.
11605         Change caller.
11606         * layout.h (class Layout): Declare create_notes.  Update
11607         declaration of create_executable_stack_info.
11608         * gold.cc (queue_middle_tasks): Call create_notes.
11609         * output.cc (Output_section::update_flags_for_input_section): Move
11610         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11611         invalid.
11612         * output.h (Output_data::mark_address_invalid): New function.
11613         (class Output_section): Only declare, not define,
11614         update_flags_for_input_section.  Remove set_flags.
11615
11616 2009-06-24  Ian Lance Taylor  <iant@google.com>
11617
11618         * script-sections.cc (Output_section_definition::
11619         set_section_addresses): Rename shadowing local load_address to
11620         laddr.
11621
11622 2009-06-24  Ian Lance Taylor  <iant@google.com>
11623
11624         PR 10244
11625         * reloc.cc (relocate_sections): Skip empty relocation sections.
11626
11627 2009-06-23  Ian Lance Taylor  <iant@google.com>
11628
11629         PR 10156
11630         * layout.cc (Layout::create_note): Use choose_output_section
11631         rather than make_output_section.
11632
11633 2009-06-23  Ian Lance Taylor  <iant@google.com>
11634
11635         PR 10237
11636         * options.cc (General_options::parse_V): Set printed_version_.
11637         (General_options::General_options): Initialize printed_version_.
11638         * options.h (class General_options): Add printed_version_ field.
11639         * gold.cc (queue_initial_tasks): If there are no input files,
11640         don't give a fatal error if we printed the version information.
11641         (queue_middle_tasks): If using -r with a shared object, give a
11642         fatal error rather than an ordinary error.
11643
11644 2009-06-23  Ian Lance Taylor  <iant@google.com>
11645
11646         PR 10219
11647         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11648         (Layout::make_output_section): Set have_stabstr_section_ if we see
11649         a .stab*str section.
11650         (Layout::finalize): Call link_stabs_sections.
11651         (Layout::link_stabs_sections): New file.
11652         * layout.h (class Layout): Add have_stabstr_section_ field.
11653         Declare link_stabs_sections.
11654
11655 2009-06-23  Doug Kwan  <dougkwan@google.com>
11656
11657         * Makefile.am (libgold_a_LIBADD): New.
11658         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11659         * Makefile.in: Regenerate.
11660         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11661         * configure: Regenerate.
11662         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11663         * fileread.cc: Include sys/state.h
11664         * gold.h: Declare memmem and strndup if found missing.
11665         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11666
11667 2009-06-23  Ian Lance Taylor  <iant@google.com>
11668
11669         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11670         * configure: Rebuild.
11671
11672 2009-06-23  Ian Lance Taylor  <iant@google.com>
11673
11674         PR 10147
11675         * object.cc (Object::section_contents): Don't try to get a view if
11676         the section has length zero.
11677         (Object::handle_gnu_warning_section): If the section is empty, use
11678         the name of the section as the warning.
11679
11680 2009-06-23  Ian Lance Taylor  <iant@google.com>
11681
11682         PR 10133
11683         * stringpool.h (class Stringpool_template): Add optimize_ field.
11684         (Stringpool_template::set_optimize): New function.
11685         * stringpool.cc (Stringpool_template::Stringpool_template):
11686         Initialize optimize_ field.
11687         (Stringpool_template::set_string_offsets): Test local optimize
11688         fild rather than parameter.
11689         * layout.cc (Layout::Layout): Call set_optimize on the section
11690         name stringpool.
11691
11692 2009-06-22  Ian Lance Taylor  <iant@google.com>
11693
11694         PR 10030
11695         * yyscript.y: Parse TARGET.
11696         * script.cc (script_set_target): New function.
11697         * script-c.h (script_set_target): Declare.
11698         * options.cc (General_options::string_to_object_format): Rename
11699         from string_to_object_format in anonymous namespace.  Change
11700         callers.
11701         * options.h (class General_options): Declare
11702         string_to_object_format.
11703
11704 2009-06-22  Ian Lance Taylor  <iant@google.com>
11705
11706         * script-sections.cc (Script_sections::create_segments): Don't put
11707         program headers in a PT_LOAD segment if -n or -N.
11708
11709 2009-06-22  Ian Lance Taylor  <iant@google.com>
11710
11711         PR 10141
11712         * options.h (class General_options): Add -z lazy and -z now.  Sort
11713         -z options into alphabetical order.
11714         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11715
11716 2009-06-21  Ian Lance Taylor  <iant@google.com>
11717
11718         * layout.cc (Layout::make_output_section): Call
11719         Target::new_output_section.
11720         (Layout::attach_allocated_section_to_segment): Put large section
11721         sections in a separate load segment with the large segment flag
11722         set.
11723         (Layout::segment_precedes): Sort large data segments after other
11724         load segments.
11725         (align_file_offset): New static function.
11726         (Layout::set_segment_offsets): Use align_file_offset.
11727         * output.h (class Output_section): Add is_small_section_ and
11728         is_large_section_ fields.
11729         (Output_section::is_small_section): New function.
11730         (Output_section::set_is_small_section):  New function.
11731         (Output_section::is_large_section): New function.
11732         (Output_section::set_is_large_section): New function.
11733         (Output_section::is_large_data_section): New function.
11734         (class Output_segment): Add is_large_data_segment_ field.
11735         (Output_segment::is_large_data_segment): New function.
11736         (Output_segment::set_is_large_data_segment): New function.
11737         * output.cc (Output_section::Output_section): Initialize new
11738         fields.
11739         (Output_segment::Output_segment): Likewise.
11740         (Output_segment::add_output_section): Add assertion that large
11741         data sections always go in large data segments.  Force small data
11742         sections to the end of the list of data sections.  Force small BSS
11743         sections to the start of the list of BSS sections.  For large BSS
11744         sections to the end of the list of BSS sections.
11745         * symtab.h (class Symbol): Declare is_common_shndx.
11746         (Symbol::is_defined): Check Symbol::is_common_shndx.
11747         (Symbol::is_common): Likewise.
11748         (class Symbol_table): Define enum Commons_section_type.  Update
11749         declarations.  Add small_commons_ and large_commons_ fields.
11750         * symtab.cc (Symbol::is_common_shndx): New function.
11751         (Symbol_table::Symbol_table): Initialize new fields.
11752         (Symbol_table::add_from_object): Put small and large common
11753         symbols in the right list.
11754         (Symbol_table::sized_finalized_symbol): Check
11755         Symbol::is_common_shndx.
11756         (Symbol_table::sized_write_globals): Likewise.
11757         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11758         common symbol lists.  Don't call do_allocate_commons_list if the
11759         list is empty.
11760         (Symbol_table::do_allocate_commons_list): Remove is_tls
11761         parameter.  Add comons_section_type parameter.  Change all
11762         callers.  Handle small and large common symbols.
11763         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11764         Symbol::is_common_shndx.
11765         * resolve.cc (symbol_to_bits): Likewise.
11766         * target.h (Target::small_common_shndx): New function.
11767         (Target::small_common_section_flags): New function.
11768         (Target::large_common_shndx): New function.
11769         (Target::large_common_section_flags): New function.
11770         (Target::new_output_section): New function.
11771         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11772         small_common_section_flags, and large_common_section_flags
11773         fields.
11774         (Target::do_new_output_section): New virtual function.
11775         * arm.cc (Target_arm::arm_info): Initialize new fields.
11776         * i386.cc (Target_i386::i386_info): Likewise.
11777         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11778         Likewise.
11779         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11780         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11781         (Target_x86_64::do_new_output_section): New function.
11782         * configure.ac: Define conditional MCMODEL_MEDIUM.
11783         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11784         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11785         (large_LDFLAGS): Define.
11786         * testsuite/large.c: New file.
11787         * testsuite/testfile.cc (Target_test::test_target_info):
11788         Initialize new fields.
11789         * configure, testsuite/Makefile.in: Rebuild.
11790
11791 2009-06-05  Doug Kwan  <dougkwan@google.com>
11792
11793         * Makefile.am (CCFILES): Add target.cc.
11794         * Makefile.in: Regenerate.
11795         * i386.cc (class Target_i386): Define new virtual method to
11796         override do_is_local_label_name in parent.
11797         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11798         local symbols if --discard-locals or -X is given.
11799         * options.h (class General_options): Declare new options
11800         '--discard-locals' and '-X' for discarding locals.
11801         * target.h (class Target): Define new methods is_local_label_name.
11802         Declare new virtual method do_is_local_label_name.
11803         * target.cc: New file.
11804         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11805         (check_SCRIPTS): Add discard_locals_test.sh.
11806         (check_DATA): Add discard_local_tests.syms.
11807         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11808         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11809         * testsuite/Makefile.in: Regenerate.
11810         * testsuite/discard_locals_test.c: New file.
11811         * testsuite/discard_locals_test.sh: Same.
11812
11813 2009-06-05  Doug Kwan  <dougkwan@google.com>
11814
11815         * object.cc (Sized_relobj::Sized_relobj): Initialize
11816         discarded_eh_frame_shndx_ to -1U.
11817         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11818         section.
11819         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11820         a discarded .eh_frame section.
11821         (Sized_relobj::do_finalize_local_symbols): Ditto.
11822         * object.h (class Sized_relobj): Declare new member
11823         discarded_eh_frame_shndx_.
11824         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11825         (local_labels_test.o, local_labels_test): New rules.
11826         * testsuite/Makefile.in: Regenerate.
11827
11828 2009-06-04  Doug Kwan  <dougkwan@google.com>
11829
11830         * layout.cc (Layout::section_name_mapping): Add mapping for
11831         special ARM sections.
11832
11833 2009-06-03  Doug Kwan  <dougkwan@google.com>
11834
11835         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11836         (utils::has_overflow): Same.
11837
11838 2009-06-03  Ian Lance Taylor  <iant@google.com>
11839
11840         * layout.cc (Layout::section_name_mapping): New array, replacing
11841         Layout::linkonce_mapping.
11842         (Layout::section_name_mapping_count): New variable, replacing
11843         Layout::linkonce_mapping_count.
11844         (Layout::linkonce_output_name): Remove.
11845         (Layout::output_section_name): Rewrite.
11846         * layout.h (class Layout): Rename Linkonce_mapping to
11847         Section_name_mapping, linkonce_mapping to section_name_mapping,
11848         linkonce_mapping_count to section_name_mapping_count.  Don't
11849         declare linkonce_output_name.
11850
11851 2009-06-03  Doug Kwan  <dougkwan@google.com>
11852
11853         * gold/arm.cc (namespace utils): New.
11854         (Target_arm::reloc_is_non_pic): Define new method.
11855         (class Arm_relocate_functions): New.
11856         (Target_arm::Relocate::relocate): Handle relocation types used by
11857         Android.
11858
11859 2009-06-03  Ian Lance Taylor  <iant@google.com>
11860
11861         * arm.cc (Target_arm::scan::global): Use || instead of |.
11862
11863 2009-06-02  Doug Kwan  <dougkwan@google.com>
11864
11865         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11866         issued_non_pic_error_.
11867         (class Target_arm::Scan): Declare new method check_non_pic.
11868         Define new method symbol_needs_plt_entry.
11869         Declare new data member issued_non_pic_error_.
11870         (class Target_arm::Relocate): Declare new method
11871         should_apply_static_reloc.
11872         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11873         (Target_arm::Scan::check_non_pic): Define new method.
11874         (Target_arm::Scan::local): Handle a small subset of reloc types used
11875         by Android.
11876         (Target_arm::Scan::local): Same.
11877         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11878
11879 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11880
11881         * incremental.cc (Incremental_inputs::report_command_line): Filter
11882         out --incremental-* options.
11883
11884 2009-05-29  Doug Kwan  <dougkwan@google.com>
11885
11886         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11887         template class.
11888         (class Target_arm): Update comment.
11889         (Target_arm::Target_arm): Initialize new data members GOT_,
11890         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11891         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11892         and Target_arm::rel_dyn_section.
11893         Declare new_enum Target_arm::Got_type.
11894         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11895         and DYNBSS_.
11896         Update commments for member do_dynsym_value.
11897         (Target_arm::got_size, Target_arm::plt_section,
11898         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11899         new methods inside class defintion.
11900         (Target_arm::got_section): Define new method.
11901         (Target_arm::rel_dyn_section): Same.
11902         (Output_data_plt_arm): New template class.
11903         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11904         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11905         (Output_data_plt_arm::add_entry): Same.
11906         (Output_data_plt_arm::first_plt_entry): Define new
11907         static data member for PLT instruction template.
11908         (Output_data_plt_arm::plt_entry): Same.
11909         (Output_data_plt_arm::do_write): Define new method.
11910         (Target_arm::make_plt_entry): Same.
11911         (Target_arm::do_finalize_sections): Same.
11912         (Target_arm::do_dynsym_value): Same.
11913
11914 2009-05-28  Doug Kwan  <dougkwan@google.com>
11915
11916         * Makefile.am (TARGETSOURCES): Add arm.cc.
11917         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11918         * Makefile.in: Regenerate.
11919         * arm.cc: New file.
11920         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11921
11922 2009-05-26  Doug Kwan  <dougkwan@google.com>
11923
11924         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11925         (General_options::check_excluded_libs): Strip off directories in
11926         archive name before matching like GNU ld does.
11927         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11928         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11929         (exclude_libs_test_LDFLAGS): Add linker option
11930         -Wl,--exclude-libs,libexclude_libs_test_3
11931         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11932         an explicit archive without using -l.
11933         (alt/libexclude_libs_test_3.a): New make rule.
11934         * testsuite/Makefile.in: Regenerate.
11935         * testsuite/exclude_libs_test.c : Declare lib3_default().
11936         (main): Call it.
11937         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11938         * exclude_libs_test_3.c: New file.
11939
11940 2009-05-26  Nick Clifton  <nickc@redhat.com>
11941
11942         * po/id.po: New Indonesian translation.
11943         * po/gold.pot: Updated template file.
11944
11945 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11946
11947         * testsuite/Makefile.am: Add -ffunction-sections to compile
11948         gc_comdat_test files.  Add -Wl,--gc-sections to build
11949         gc_comdat_test.
11950         * testsuite/Makefile.in: Regenerate.
11951         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11952
11953 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11954
11955         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11956         kept comdat section was garbage collected.
11957         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11958         * testsuite/Makefile.in: Regenerate.
11959         * testsuite/gc_comdat_test.sh: New file.
11960         * testsuite/gc_comdat_test_1.cc: New file.
11961         * testsuite/gc_comdat_test_2.cc: New file.
11962
11963 2009-05-19  Doug Kwan  <dougkwan@google.com>
11964
11965         * archive.cc (Archive::Archive): Move constructor from archive.h
11966         to here.  Initialize no_export_.
11967         (Archive::get_elf_object_for_member): Set no_export flag of object.
11968         * archive.h (Archive::Archive): Move constructor body to
11969         archive.cc.
11970         (Archive::no_export): New method.
11971         (Archive::no_export_): New field.
11972         * object.h (Object::Object): Initialize no_export_ to false.
11973         (Object::no_export, Object::set_no_export): New methods.
11974         (Object::no_export_): New field.
11975         * options.cc (General_options::parse_exclude_libs): New method.
11976         (General_options::check_excluded_libs) Same.
11977         * options.h (exclude_libs): New option.
11978         (General_options::check_excluded_libs): New method declaration.
11979         (General_options::excluded_libs_): New field.
11980         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11981         default or protected visibility if an object has no-export flag set.
11982         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11983         (check_SCRIPTS): Add exclude_libs_test.sh.
11984         (check_DATA): Add exclude_libs_test.syms.
11985         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11986         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11987         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11988         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11989         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11990         libexclude_libs_test_2.a): New rules.
11991         * testsuite/Makefile.in: Regenerate.
11992         * testsuite/exclude_libs_test.c: New file.
11993         * testsuite/exclude_libs_test.sh: Ditto.
11994         * testsuite/exclude_libs_test_1.c: Ditto.
11995         * testsuite/exclude_libs_test_2.c: Ditto.
11996
11997 2009-05-15  Ian Lance Taylor  <iant@google.com>
11998
11999         * configure.ac: Check for declarations for cases where libiberty.h
12000         checks HAVE_DECL_xxx.
12001         * configure, config.in: Rebuild.
12002
12003 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12004
12005         * gold.h (Incremental_argument_list): Remove (invalid) forward
12006         declaration.
12007         * incremental.cc (Incremental_inputs::report_achive): New method.
12008         (Incremental_inputs::report_object): New method.
12009         (Incremental_inputs::report_script): New method.
12010         (Incremental_inputs::finalize_inputs): New method.
12011         (Incremental_inputs::finalize): Call finalize_inputs().
12012         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12013         Create inputs entries.
12014         * incremental.h (Incremental_input_type): New enum.
12015         (Incremental_inputs::Incremental_input): Initialize new fields.
12016         (Incremental_inputs::report_inputs): New method.
12017         (Incremental_inputs::report_achive): New method.
12018         (Incremental_inputs::report_object): New method.
12019         (Incremental_inputs::report_script): New method.
12020         (Incremental_inputs::finalize_inputs): New method.
12021         (Incremental_inputs::Input_info): New struct.
12022         (Incremental_inputs::Input_info_map): New typedef.
12023         (Incremental_inputs::lock_): New field.
12024         (Incremental_inputs::Inputs_): New field.
12025         (Incremental_inputs::Inputs_map): New field.
12026         * main.cc (main): Call Incremental_input::report_inputs.
12027         * options.h (Input_argument_list): Typedef moved from
12028         Input_arguments.
12029         (Input_file_group::Files): Remove, use ::Input_argument_list.
12030         (Input_file_group::Input_argument_list): Remove, use
12031         ::Input_argument_list.
12032         * plugin.cc (Plugin_manager::add_input_file): Add error in
12033         incremental build.
12034         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12035         functions.
12036         * script.cc (read_input_script): Call
12037         Incremental_input::report_script.
12038         * script.h (Script_info): New class.
12039
12040 2009-04-27  Ian Lance Taylor  <iant@google.com>
12041
12042         * x86_64.cc (do_adjust_output_section): Set entsize to
12043         plt_entry_size.
12044
12045 2009-04-23  Elliott Hughes  <enh@google.com>
12046
12047         * output.cc (Output_file::close): After short writes, continue
12048         writing from the correct offset in the buffer being written.
12049
12050 2009-04-23  Chris Demetriou  <cgd@google.com>
12051
12052         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12053         * configure: Regenerate.
12054         * config.in: Regenerate.
12055         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12056         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12057
12058 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12059
12060         * incremental.cc (Incremental_inputs_header_data): Renamed from
12061         Incremental_input_header_data.
12062         (Incremental_inputs_header_data::data_size): New field.
12063         (Incremental_inputs_header_data::put_input_file_count): Renamed
12064         from input_file_count.
12065         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12066         from command_line_offset.
12067         (Incremental_inputs_header_data::put_reserved): Renamed from
12068         put_reserved.
12069         (Incremental_inputs_entry_data): Renamed from
12070         Incremental_input_entry_data.
12071         (Incremental_inputs_entry_data::data_size): New field.
12072         (Incremental_inputs::report_command_line): New method.
12073         (Incremental_inputs::finalize): New method.
12074         (Incremental_inputs::create_incremental_inputs_data): New method.
12075         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12076         * incremental.h: New file.
12077         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12078         (Layout::finalize): Create incremental inputs section in
12079         incremental builds.
12080         (Layout::create_incremental_info_sections): New method.
12081         * layout.h (Layout::incremental_inputs): New method.
12082         (Layout::create_incremental_info_sections): New method.
12083         (Layout::incremental_inputs_): New field.
12084         * main.cc (main): Notify Incremental_input of the command line.
12085
12086 2009-04-01  Ian Lance Taylor  <iant@google.com>
12087             Mikolaj Zalewski  <mikolajz@google.com>
12088
12089         * gold.h (reserve_unordered_map): Define, three versions, one for
12090         each version of Unordered_map.
12091         * layout.cc (Layout::Layout): Remove options parameter.  Add
12092         number_of_input_files parameter.  Don't initialize options_.
12093         Initialize number_of_input_files_ and resized_signatures_.  Move
12094         sections_are_attached_.
12095         (Layout::layout_group): Reserve space for group_signatures_.
12096         (Layout::find_or_add_kept_section): Change name parameter to be a
12097         reference.  Resize signatures_ map when it gets large enough.
12098         (Layout::layout_eh_frame): Use parameters->options() instead of
12099         this->options_.
12100         (Layout::make_output_section): Likewise.
12101         (Layout::attach_allocated_section_to_segment): Likewise.
12102         (Layout::finalize, Layout::create_executable_stack): Likewise.
12103         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12104         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12105         * layout.h (class Layout): Update declarations.  Remove options_
12106         field.  Add number_of_input_files_ and resized_signatures_
12107         fields.  Move sections_are_attached_ field.
12108         * main.cc (main): Pass number of input files to Layout
12109         constructor.  Don't pass options.
12110
12111 2009-03-30  Ian Lance Taylor  <iant@google.com>
12112
12113         * ffsll.c (ffsll): Correct implementation.
12114
12115 2009-03-27  Ian Lance Taylor  <iant@google.com>
12116
12117         * ffsll.c: New file.
12118         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12119         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12120         * ftruncate.c (ftruncate): Declare before definition.
12121         * mremap.c (mremap): Likewise.
12122         * pread.c (pread): Likewise.
12123         * configure, Makefile.in, config.in: Rebuild.
12124
12125         * mremap.c: New file.
12126         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12127         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12128         (mremap): Declare if HAVE_MREMAP is not defined.
12129         * configure, Makefile.in, config.in: Rebuild.
12130
12131 2009-03-27  Cary Coutant  <ccoutant@google.com>
12132
12133         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12134         position independent.
12135         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12136         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12137
12138 2009-03-24  Cary Coutant  <ccoutant@google.com>
12139
12140         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12141         an executable.
12142         (needs_dynamic_reloc): Likewise.
12143
12144 2009-03-24  Ian Lance Taylor  <iant@google.com>
12145
12146         * yyscript.y (file_cmd): Recognize EXTERN.
12147         (extern_name_list, extern_name_list_body): New nonterminals.
12148         * script.cc (script_add_extern): Define.
12149         * script-c.h (script_add_extern): Declare.
12150
12151 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12152
12153         * object.cc (is_elf_object): Define.
12154         * object.h (is_elf_object): Declare.
12155         * archive.cc (Archive::get_elf_object_for_member): Call
12156         is_elf_object.
12157         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12158
12159 2009-03-24  Elliott Hughes  <enh@google.com>
12160
12161         * output.cc (Output_file::map_anonymous): Define.
12162         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12163         try an anonymous one.  Report the size if the mmap fails.
12164         * output.h (class Output_file): Declare map_anonymous.
12165
12166 2009-03-24  Ian Lance Taylor  <iant@google.com>
12167
12168         * target-select.cc (instantiate_target): Don't acquire the lock if
12169         the instantiated_target_ field has already been set.
12170
12171 2009-03-23  Ian Lance Taylor  <iant@google.com>
12172
12173         * gold-threads.h (class Initialize_lock): Define.
12174         * gold-threads.cc (class Initialize_lock_once): Define.
12175         (initialize_lock_control): New static variable.
12176         (initialize_lock_pointer): New static variable.
12177         (initialize_lock_once): New static function.
12178         (Initialize_lock::Initialize_lock): Define.
12179         (Initialize_lock::initialize): Define.
12180         * target-select.h: Include "gold-threads.h".
12181         (class Target_selector): Add lock_ and initialize_lock_ fields.
12182         Don't define instantiate_target, just declare it.
12183         * target-select.cc (Target_selector::Target_selector): Initialize
12184         new fields.
12185         (Target_selector::instantiate_target): Define.
12186         * descriptors.h: Include "gold-threads.h".
12187         (class Descriptors): Add initialize_lock_ field.
12188         * descriptors.cc (Descriptors::Descriptors): Initialize new
12189         field.
12190         (Descriptors::open): Use initialize_lock_ field
12191         * errors.h (class Errors): Add initialize_lock_ field.
12192         * errors.cc (Errors::Errors): Initialize new field.
12193         (Errors::initialize_lock): Use initialize_lock_ field.
12194         * powerpc.cc (class Target_selector_powerpc): Remove
12195         instantiated_target_ field.  In do_recognize call
12196         instantiate_target rather than do_instantiate_target.  In
12197         do_instantiate_target just allocate a new target.
12198         * sparc.cc (class Target_selector_sparc): Likewise.
12199
12200         * freebsd.h: New file.
12201         * i386.cc: Include "freebsd.h".
12202         (Target_i386): Derive from Target_freebsd rather than
12203         Sized_target.
12204         (Target_selector_i386): Derive from Target_selector_freebsd rather
12205         than Target_selector.
12206         * x86_64.cc: Include "freebsd.h".
12207         (Target_x86_64): Derive from Target_freebsd rather than
12208         Sized_target.
12209         (Target_selector_x86_64): Derive from Target_selector_freebsd
12210         rather than Target_selector.
12211         * target.h (class Target): Add adjust_elf_header and
12212         do_adjust_elf_header.
12213         * output.cc (Output_file_header:: do_sized_write): Call target
12214         adjust_elf_header routine.
12215         * configure.tgt: Set targ_osabi.
12216         * configure.ac: Define GOLD_DEFAULT_OSABI.
12217         * parameters.cc (Parameters::default_target): Pass
12218         GOLD_DEFAULT_OSABI to select_target.
12219         * target-select.h (class Target_selector): Make instantiate_target
12220         protected rather than private.
12221         * Makefile.am (HFILES): Add freebsd.h.
12222         * configure, Makefile.in, config.in: Rebuild.
12223
12224         * merge.cc (do_add_input_section): Correct pend value.  Change
12225         message about last entry not being null terminated from error to
12226         warning.
12227
12228 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12229
12230         * incremental.cc: New file.
12231         * Makefile.am (CCFILES): Add incremental.cc.
12232         * Makefile.in: Rebuild.
12233
12234 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12235
12236         * layout.cc (Layout::output_section_name): Preserve names
12237         of '.note.' sections.
12238
12239 2009-03-19  Ian Lance Taylor  <iant@google.com>
12240
12241         * descriptors.cc (Descriptors::open): Check that the options are
12242         valid before using them.
12243
12244 2009-03-18  Ian Lance Taylor  <iant@google.com>
12245
12246         * script-sections.h: Include <list>.
12247         (class Script_sections): Change Sections_elements from std::vector
12248         to std::list.  Typedef public Elements_iterator.  Add
12249         orphan_section_placement_, data_segment_align_start_, and
12250         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12251         field.
12252         * script-sections.cc (class Orphan_section_placement): New class.
12253         (class Sections_element): Add virtual functions is_relro and
12254         orphan_section_init.  Remove virtual function place_orphan_here.
12255         (class Output_section_definition): Add is_relro and
12256         orphan_section_init.  Remove place_orphan_here.
12257         (class Orphan_output_section): Likewise.
12258         (Script_sections::Script_sections): Update for field changes.
12259         (Script_sections::data_segment_align): Set saw_data_segment_align_
12260         and data_segment_align_start_, not data_segment_align_index.
12261         (Script_sections::data_segment_relro_end): Check
12262         saw_data_segment_align_.  Use data_segment_align_start_ rather
12263         than data_segment_align_index_.
12264         (Script_sections::place_orphan): Rewrite to use
12265         Orphan_section_placement.
12266
12267 2009-03-17  Ian Lance Taylor  <iant@google.com>
12268
12269         * archive.cc (Archive::add_symbols): Check for a version attached
12270         to the symbol name in the archive map.
12271         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12272         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12273         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12274         (ver_test_11.a): New target.
12275         * testsuite/Makefile.in: Rebuild.
12276
12277         * configure.ac: Check for chsize and posix_fallocate.  Replace
12278         ftruncate.
12279         * ftruncate.c: New file, from gnulib.
12280         * output.cc (posix_fallocate): Define dummy version if not
12281         HAVE_POSIX_FALLOCATE.
12282         (Output_file::map): Call posix_fallocate rather than lseek and
12283         write.
12284         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12285         * configure, Makefile.in, config.in: Rebuild.
12286
12287 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12288
12289         * layout.h (Layout::create_note): Add section_name parameter.
12290         * layout.cc (Layout::create_note): Likewise.
12291         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12292
12293 2009-03-17  Ian Lance Taylor  <iant@google.com>
12294
12295         * descriptors.cc: Include "options.h".
12296         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12297         (Descriptors::open): Always use O_CLOEXEC when opening a new
12298         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12299         then set FD_CLOEXEC.
12300
12301         * sparc.cc (class Target_sparc): Add has_got_section.
12302         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12303         make sure we have a GOT section.
12304
12305         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12306         (Target_sparc::Scan::local): Likewise.
12307         (Target_sparc::Scan::global): Likewise.
12308         (Target_sparc::Relocate::relocate): Likewise.
12309         (Target_sparc::Relocate::relocate_tls): Likewise.
12310
12311         * symtab.cc (Symbol_table::define_default_version): New function,
12312         broken out of add_from_object.
12313         (Symbol_table::add_from_object): Call define_default_version.
12314         (Symbol_table::define_special_symbol): Add resolve_oldsym
12315         parameter.  Change all callers.  If the version for a symbol comes
12316         from a version script, resolve it with the symbol with the same
12317         name with no version.  Also add the symbol without a version if
12318         appropriate.
12319         (do_define_in_output_data): If resolving with oldsym, don't delete
12320         sym.
12321         (do_define_in_output_segment): Likewise.
12322         (do_define_as_constant): Likewise.
12323         * symtab.h (class Symbol_table): Update declarations.
12324
12325 2009-03-13  Ian Lance Taylor  <iant@google.com>
12326
12327         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12328         (Read_symbols::requeue): New function.
12329         (Read_symbols::do_read_symbols): If make_elf_object fails because
12330         the target type is not configured, and the file was searched for,
12331         issue a warning and retry with the next directory.
12332         (Add_symbols::run): If the file has an incompatible format, and
12333         it was searched for, requeue the Read_symbols task.  On error,
12334         release the object.
12335         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12336         dirindex parameter to constructor.  Change all callers.  Declare
12337         incompatible_warning and requeue.
12338         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12339         input_argument_ and input_group_ fields.  Add them to
12340         constructor.  Change all callers.
12341         (class Read_script): Add dirindex_ field.  Add it to constructor.
12342         Change all callers.
12343         * archive.cc (Archive::setup): Remove input_objects parameter.
12344         Change all callers.
12345         (Archive::get_file_and_offset): Likewise.
12346         (Archive::read_all_symbols): Likewise.
12347         (Archive::read_symbols): Likewise.
12348         (Archive::get_elf_object_for_member): Remove input_objects
12349         parameter.  Add punconfigured parameter.  Change all callers.
12350         (Archive::add_symbols): Change return type to bool.  Check return
12351         value of include_member.
12352         (Archive::include_all_members): Likewise.
12353         (Archive::include_member): Change return type to bool.  Return
12354         false if first included object has incompatible target.  Set
12355         included_member_ field.
12356         (Add_archive_symbols::run): If add_symbols returns false, requeue
12357         Read_symbols task.
12358         * archive.h (class Archive): Add included_member_ field.
12359         Initialize it in constructor.  Add input_file and searched_for
12360         methods.  Update declarations.
12361         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12362         input_argument_ fields.  Add them to constructor.  Change all
12363         callers.
12364         * script.cc: Include "target-select.h".
12365         (class Parser_closure): Add skip_on_incompatible_target_ and
12366         found_incompatible_target_ fields.  Add
12367         skip_on_incompatible_target parameter to constructor.  Change all
12368         callers.  Add methods skip_on_incompatible_target,
12369         clear_skip_on_incompatible_target, found_incompatible_target, and
12370         set_found_incompatible_target.
12371         (read_input_script): Add dirindex parameter.  Change all callers.
12372         If parser finds an incompatible target, requeue Read_symbols
12373         task.
12374         (script_set_symbol): Clear skip_on_incompatible_target in
12375         closure.
12376         (script_add_assertion, script_parse_option): Likewise.
12377         (script_start_sections, script_add_phdr): Likewise.
12378         (script_check_output_format): New function.
12379         * script.h (read_input_script): Update declaration.
12380         * script-c.h (script_check_output_format): Declare.
12381         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12382         (ignore_cmd): Remove OUTPUT_FORMAT.
12383         * fileread.cc (Input_file::Input_file): Add explicit this.
12384         (Input_file::will_search_for): New function.
12385         (Input_file::open): Add pindex parameter.  Change all callers.
12386         * fileread.h (class Input_file): Add input_file_argument method.
12387         Declare will_search_for.  Update declarations.
12388         * object.cc (make_elf_object): Add punconfigured parameter.
12389         Change all callers.
12390         * object.h (class Object): Make input_file public.  Add
12391         searched_for method.
12392         (make_elf_object): Update declaration.
12393         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12394         restart search.
12395         * dirsearch.h (class Dirsearch): Update declaration.
12396         * options.h (class General_options): Add --warn-search-mismatch.
12397         * parameters.cc (Parameters::is_compatible_target): New function.
12398         * parameters.h (class Parameters): Declare is_compatible_target.
12399         * workqueue.cc (Workqueue::add_blocker): New function.
12400         * workqueue.h (class Workqueue): Declare add_blocker.
12401
12402         * fileread.cc (Input_file::open): Remove options parameter.
12403         Change all callers.
12404         (Input_file::open_binary): Likewise.
12405         * script.cc (read_input_script): Likewise.
12406         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12407         options parameter from constructor.  Change all callers.
12408         (class Read_script): Likewise.
12409         * fileread.h (class Input_file): Update declarations.
12410         * script.h (read_input_script): Update declaration.
12411
12412 2009-03-10  Nick Clifton  <nickc@redhat.com>
12413
12414         * po/es.po: New Spanish translation.
12415
12416 2009-03-06  Cary Coutant  <ccoutant@google.com>
12417
12418         * options.cc (parse_short_option): Keep dash_z from registering itself.
12419
12420 2009-03-03  Ian Lance Taylor  <iant@google.com>
12421
12422         PR 9918
12423         * target-reloc.h (relocate_section): Pass output_section to
12424         relocate.
12425         * i386.cc (Target_i386::should_apply_static_reloc): Add
12426         output_section parameter.  Change all callers.
12427         (Target_i386::Relocate::relocate): Add output_section parameter.
12428         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12429         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12430         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12431         * testsuite/two_file_shared.sh: New script.
12432         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12433         (check_DATA): Add two_file_shared.dbg.
12434         (two_file_shared.dbg): New target.
12435         * testsuite/Makefile.in: Rebuild.
12436
12437 2009-03-01  Ian Lance Taylor  <iant@google.com>
12438
12439         * configure.ac: Check for byteswap.h.
12440         * configure: Rebuild.
12441         * config.in: Rebuild.
12442
12443 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12444
12445         * layout.cc (Layout::find_or_add_kept_section): New function.
12446         (Layout::add_comdat): Removed.
12447         * layout.h (struct Kept_section): Move out of class Layout.
12448         Remove trailing underscores from field names.  Add group_sections
12449         field.  Rename group_ field to is_group.  Change all uses.
12450         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12451         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12452         comdat_groups_ field.
12453         (Sized_relobj::include_section_group): Use
12454         find_or_add_kept_section and Kept_section::group_sections.
12455         (Sized_relobj::include_linkonce_section): Likewise.
12456         * object.cc (class Sized_relobj): Don't define Comdat_group or
12457         Comdat_group_table.  Remove find_comdat_group and
12458         add_comdat_group.  Remove comdat_groups_ field.
12459         * plugin.cc (include_comdat_group): Use
12460         Layout::find_or_add_kept_section.
12461
12462 2009-02-28  Ian Lance Taylor  <iant@google.com>
12463
12464         * README: --gc-sections and map files are now supported.  Document
12465         some build requirements.
12466
12467         PR 6992
12468         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12469         relocatable link set the value of the section symbol to zero.
12470         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12471         relocatable link don't include the section address in the local
12472         symbol value.
12473
12474 2009-02-27  Ian Lance Taylor  <iant@google.com>
12475
12476         PR 6811
12477         * options.h (class Search_directory): Add is_system_directory.
12478         (class General_options): Declare is_in_system_directory.
12479         * options.cc (get_relative_sysroot): Make static.
12480         (get_default_sysroot): Make static.
12481         (General_optoins::is_in_system_directory): New function.
12482         * fileread.cc (Input_file::is_in_system_directory): New function.
12483         * fileread.h (class Input_file): Declare is_in_system_directory.
12484         * object.h (class Object): Add is_in_system_directory.
12485         (class Input_objects): Remove system_library_directory_ field.
12486         * object.cc (Input_objects::add_object): Don't set
12487         system_library_directory_.
12488         (input_objects::found_in_system_library_directory): Remove.
12489         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12490         parameter.  Change all callers.
12491         (Symbol_table::sized_write_globals): Likewise.
12492         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12493         Call Object::is_in_system_directory.
12494         * symtab.h (class Symbol_table): Update declarations.
12495
12496         PR 5990
12497         * descriptors.h (Open_descriptor): Add is_on_stack field.
12498         * descriptors.cc (Descriptors::open): If the descriptor is on the
12499         top of the stack, remove it.  Initialize is_on_stack field.
12500         (Descriptors::release): Only add pod to stack if it is not on the
12501         stack already.
12502         (Descriptors::close_some_descriptor): Clear stack_next and
12503         is_on_stack fields.
12504
12505         PR 7091
12506         * output.cc (Output_section::find_starting_output_address): Rename
12507         from starting_output_address; add PADDR parameter; change return
12508         type.
12509         * output.h (class Output_section): Declare
12510         find_starting_output_address instead of starting_output_address.
12511         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12512         section symbol for which we can't find a merge section.
12513
12514         PR 9836
12515         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12516         hidden or internal, force the symbol to be local.
12517         * resolve.cc (Symbol::override_visibility): Define.
12518         (Symbol::override_base): Use override_visibility.
12519         (Symbol_table::resolve): Likewise.
12520         (Symbol::override_base_with_special): Likewise.
12521         (Symbol_table::override_with_special): If the visibility is hidden
12522         or internal, force the symbol to be local.
12523         * symtab.h (class Symbol): Add set_visibility and
12524         override_visibility.
12525         * testsuite/ver_test_1.sh: New file.
12526         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12527         (check_DATA): Add ver_test_1.syms.
12528         (ver_test_1.syms): New target.
12529         * testsuite/Makefile.in: Rebuild.
12530
12531 2009-02-25  Cary Coutant  <ccoutant@google.com>
12532
12533         * layout.cc (Layout::choose_output_section): Don't rename sections
12534         when using a linker script that has a SECTIONS clause.
12535         * Makefile.in: Regenerate.
12536
12537         * testsuite/Makefile.am (script_test_5.sh): New test case.
12538         * testsuite/Makefile.in: Regenerate.
12539         * testsuite/script_test_5.cc: New file.
12540         * testsuite/script_test_5.sh: New file.
12541         * testsuite/script_test_5.t: New file.
12542
12543 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12544
12545         * archive.cc (Archive::include_member): Update calls to add_symbols.
12546         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12547         the Layout argument.
12548         * dynobj.h (do_add_symbols): Add the Layout argument.
12549         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12550         Layout argument.
12551         * object.h (Object::add_symbols): Add the Layout argument.
12552         (Object::do_add_symbols): Add the Layout argument.
12553         (Sized_relobj::do_add_symbols): Add the Layout argument.
12554         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12555         Unify the two versions.
12556         (Add_plugin_symbols): Remove.
12557         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12558         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12559         (Add_plugin_symbols): Remove.
12560         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12561         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12562         (Add_symbols::run): Make it work with Pulginobj.
12563
12564 2009-02-06  Ian Lance Taylor  <iant@google.com>
12565
12566         * object.cc (Sized_relobj::do_layout): Make info message start
12567         with lower case letter.
12568
12569 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12570
12571         * binary.cc: Fix file comment.
12572
12573         * options.h (enum Incremental_disposition): Define.
12574         (class General_options): Add new options: --incremental,
12575         --incremental_changed, --incremental_unchanged,
12576         --incremental_unknown.  Add incremental_disposition_ and
12577         implicit_incremental_ fields.
12578         (General_options::incremental_disposition): New function.
12579         (class Position_dependent_options): Add incremental_disposition
12580         option.
12581         (Position_dependent_options::copy_from_options): Set incremental
12582         dispositions.
12583         * options.cc (General_options::parse_incremental_changed): New
12584         function.
12585         (General_options::parse_incremental_unchanged): New function.
12586         (General_options::parse_incremental_unknown): New function.
12587         (General_options::General_options): Initialize new fields
12588         incremental_disposition_ and implicit_incremental_.
12589         (General_options::finalize): Check for uasge of --incremental-*
12590         without --incremental.
12591
12592 2009-02-06  Chris Demetriou  <cgd@google.com>
12593
12594         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12595         pointer and to report location as the file name associated with
12596         the symbol.
12597         (gold_undefined_symbol_at_location): New function to replace the
12598         old gold_undefined_symbol functionality.
12599         * target-reloc.h (relocate_section): Update to use
12600         gold_undefined_symbol_at_location.
12601         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12602         Call gold_undefined_symbol function rather than gold_error.
12603         * errors.h (Errors::undefined_symbol): Take location as a
12604         string, rather than calculating it from a relocation.
12605         * errors.cc (Errors::fatal): Print "fatal error:" before the
12606         formatted message.
12607         (Errors::error, Errors::error_at_location): Print "error: "
12608         before the formatted message.
12609         (Errors::undefined_symbol): Take location as a string, rather
12610         than calculating it from a relocation.
12611         (gold_undefined_symbol_at_location): New function akin to
12612         old gold_undefined_symbol, calculates location from relocation.
12613         (gold_undefined_symbol): Change to take only a Symbol pointer
12614         and to report location as the file name associated with the symbol.
12615         * testsuite/debug_msg.sh: Update for changed error messages.
12616         * testsuite/undef_symbol.sh: Likewise.
12617
12618 2009-02-04  Duncan Sands  <baldrick@free.fr>
12619
12620         PR 9812
12621         * reduced_debug_output.h
12622         (Output_reduced_debug_abbrev_section::failed): Use format for
12623         gold_warning.
12624         (Output_reduced_debug_info_section::faild): Likewise.
12625
12626 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12627
12628         * script.cc (Lazy_demangler): New class.
12629         (Version_script_info::get_symbol_version_helper): Demangle a
12630         symbol only once.
12631
12632 2009-01-29  Cary Coutant  <ccoutant@google.com>
12633
12634         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12635         to __tls_get_addr.
12636         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12637
12638 2009-01-28  Ian Lance Taylor  <iant@google.com>
12639
12640         * version.cc (version_string): Bump to 1.9.
12641
12642         * gold.h: Include <cstring> and <stdint.h>.
12643         * version.cc: Include <cstdio>.
12644         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12645         warning.
12646         * reduced_debug_output.cc (insert_into_vector): Rename from
12647         Insert_into_vector; change all callers.  Use Swap_unaligned to
12648         avoid aliasing issue; remove union since it is unnecessary.
12649
12650 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12651
12652         * Makefile.am (CCFILES): Add gc.cc.
12653         (HFILES): Add gc.h.
12654         * Makefile.in: Regenerate.
12655         * gold.cc (Gc_runner): New class.
12656         (queue_initial_tasks): Call garbage collection related tasks
12657         when corresponding options are invoked.
12658         (queue_middle_gc_tasks): New function.
12659         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12660         processed early before laying out sections during garbage collection.
12661         * gold.h (queue_middle_gc_tasks): New function.
12662         (is_prefix_of): Move from "layout.cc".
12663         * i386.cc (Target_i386::gc_process_relocs): New function.
12664         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12665         * main.cc (main): Create object of class "Garbage_collection".
12666         * object.cc (Relobj::copy_symbols_data): New function.
12667         (Relobj::is_section_name_included): New function.
12668         (Sized_relobj::do_layout): Allow this function to be called twice
12669         during garbage collection and defer layout of section during the
12670         first call.
12671         * object.h (Relobj::get_symbols_data): New function.
12672         (Relobj::is_section_name_included): New function.
12673         (Relobj::copy_symbols_data): New function.
12674         (Relobj::set_symbols_data): New function.
12675         (Relobj::get_relocs_data): New function.
12676         (Relobj::set_relocs_data): New function.
12677         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12678         (Relobj::gc_process_relocs): New function.
12679         (Relobj::do_gc_process_relocs): New pure virtual function.
12680         (Relobj::sd_): New data member.
12681         (Sized_relobj::is_output_section_offset_invalid): New function.
12682         (Sized_relobj::do_gc_process_relocs): New function.
12683         * options.h (General_options::gc_sections): Modify to not be a no-op.
12684         (General_options::print_gc_sections): New option.
12685         * plugin.cc (Plugin_finish::run): Remove function call to
12686         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12687         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12688         * reloc.cc (Read_relocs::run): Add task to process relocs and
12689         determine unreferenced sections when doing garbage collection.
12690         (Gc_process_relocs): New class.
12691         (Sized_relobj::do_gc_process_relocs): New function.
12692         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12693         sections that are garbage collected.
12694         * reloc.h (Gc_process_relocs): New class.
12695         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12696         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12697         symbols whose corresponding sections are garbage collected.
12698         (Symbol_table::Symbol_table): Add new parameter for the garbage
12699         collection object.
12700         (Symbol_table::gc_mark_undef_symbols): New function.
12701         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12702         (Symbol_table::gc_mark_dyn_syms): New function.
12703         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12704         as garbage.
12705         (Symbol_table::add_from_object): Likewise.
12706         (Symbol_table::add_from_relobj): When building shared objects, do not
12707         treat externally visible symbols as garbage.
12708         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12709         table information for static and relocatable links.
12710         * symtab.h (Symbol_table::set_gc): New function.
12711         (Symbol_table::gc): New function.
12712         (Symbol_table::gc_mark_undef_symbols): New function.
12713         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12714         (Symbol_table::gc_mark_dyn_syms): New function.
12715         (Symbol_table::gc_): New data member.
12716         * target.h (Sized_target::gc_process_relocs): New pure virtual
12717         function.
12718         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12719         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12720
12721 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12722
12723         * options.h (General_options::gc_sections): Define as a no-op for now.
12724         (General_options::no_keep_memory): Ditto.
12725         (General_options::Bshareable): Define.
12726         * options.cc (General_options::finalize): Honor -Bshareable.
12727
12728 2009-01-20  Andreas Schwab  <schwab@suse.de>
12729
12730         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12731         read the value in the contents, since we don't use it.  Use the
12732         template endianness when writing.
12733         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12734
12735 2009-01-19  Andreas Schwab  <schwab@suse.de>
12736
12737         * configure.tgt (powerpc64-*): Fix targ_obj.
12738
12739 2009-01-15  Ian Lance Taylor  <iant@google.com>
12740
12741         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12742         local symbols when stripping all symbols.
12743
12744 2009-01-14  Cary Coutant  <ccoutant@google.com>
12745
12746         * output.cc (Output_reloc): Add explicit instantiations.
12747
12748 2009-01-14  Cary Coutant  <ccoutant@google.com>
12749
12750         * archive.cc (Archive::get_elf_object_for_member): Remove call
12751         to File_read::claim_for_plugin.
12752         * descriptors.cc (Descriptors::open): Remove reference to
12753         is_claimed.
12754         (Descriptors::claim_for_plugin): Remove.
12755         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12756         (Descriptors::is_claimed): Remove.
12757         (claim_descriptor_for_plugin): Remove.
12758         * fileread.cc (File_read::claim_for_plugin): Remove.
12759         * fileread.h (File_read::claim_for_plugin): Remove.
12760         (File_read::descriptor): Reopen descriptor if necessary.
12761         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12762         (Plugin_manager::all_symbols_read): Add task parameter. Change
12763         all callers.
12764         (Plugin_manager::get_input_file): New function.
12765         (Plugin_manager::release_input_file): New function.
12766         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12767         corresponding data member.
12768         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12769         and pass to base constructor. Change all callers.
12770         (get_input_file, release_input_file): New functions.
12771         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12772         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12773         (Plugin_manager::all_symbols_read): Add task parameter.
12774         (Plugin_manager::get_input_file): New function.
12775         (Plugin_manager::release_input_file): New function.
12776         (Plugin_manager::task_): New data member.
12777         (Pluginobj::Pluginobj): Add filesize parameter.
12778         (Pluginobj::filename): New function.
12779         (Pluginobj::descriptor): New function.
12780         (Pluginobj::filesize): New function.
12781         (Pluginobj::filesize_): New data member.
12782         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12783         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12784         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12785
12786         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12787         with archive libraries.
12788         * testsuite/Makefile.in: Regenerate.
12789         * testsuite/plugin_test.c (struct sym_info): New type.
12790         (get_input_file, release_input_file): New static variables.
12791         (onload): Capture new transfer vector entries.
12792         (claim_file_hook): Stop reading at end of file according to filesize.
12793         Factor out parsing of readelf output into separate function.
12794         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12795         APIs and get the source file name from the symbol table.  Convert
12796         source file name to corresponding object file name.  Print info
12797         message when adding new input files.
12798         (parse_readelf_line): New function.
12799         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12800         * testsuite/plugin_test_2.sh: Likewise.
12801         * testsuite/plugin_test_3.sh: Likewise.
12802         * testsuite/plugin_test_4.sh: New test case.
12803
12804 2009-01-07  Ian Lance Taylor  <iant@google.com>
12805
12806         * version.cc (version_string): Bump to 1.8.
12807
12808 2008-12-23  Cary Coutant  <ccoutant@google.com>
12809
12810         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12811         * plugin.cc (Plugin_manager::finish): Rename as
12812         layout_deferred_objects.  Move cleanup to separate function.
12813         (Plugin_manager::cleanup): New function.
12814         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12815         separately.
12816         * plugin.h (Plugin_manager::finish): Rename as
12817         layout_deferred_objects.
12818         (Plugin_manager::cleanup): New function.
12819         (Plugin_manager::cleanup_done): New field.
12820
12821 2008-12-23  Cary Coutant  <ccoutant@google.com>
12822
12823         * plugin.cc (is_visible_from_outside): New function.
12824         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12825         so we don't return "IR only" status for exported symbols or -r links.
12826
12827         * testsuite/Makefile.am (plugin_test_3): New test case.
12828         * testsuite/Makefile.in: Regenerate.
12829         * testsuite/plugin_test_3.sh: New file.
12830
12831 2008-12-22  Cary Coutant  <ccoutant@google.com>
12832
12833         * object.cc (Sized_relobj::layout_section): New function.
12834         (Sized_relobj::do_layout): Defer layout of input sections until after
12835         plugin has provided replacement files.
12836         (Sized_relobj::do_layout_deferred_sections): New function.
12837         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12838         (Relobj::layout_deferred_sections): New function.
12839         (Relobj::do_layout_deferred_sections): New function.
12840         (Sized_relobj::do_layout_deferred_sections): New function.
12841         (Sized_relobj::layout_section): New function.
12842         (Sized_relobj::Deferred_layout): New structure.
12843         (Sized_relobj::deferred_layout_): New field.
12844         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12845         Change all callers.  Layout deferred sections.
12846         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12847         references.
12848         (Plugin_hook::run): Move code from do_plugin_hook inline.
12849         (Plugin_hook::do_plugin_hook): Remove.
12850         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12851         (Plugin_manager::finish): Renamed, was cleanup.
12852         (Plugin_manager::should_defer_layout): New function.
12853         (Plugin_manager::add_deferred_layout_object): New function.
12854         (Plugin_manager::Deferred_layout_list): New type.
12855         (Plugin_manager::deferred_layout_objects_): New field.
12856         (Plugin_hook::do_plugin_hook): Remove.
12857
12858 2008-12-17  Ian Lance Taylor  <iant@google.com>
12859
12860         * options.h (class General_options): Add --no case for
12861         --export-dynamic.
12862
12863 2008-12-16  Cary Coutant  <ccoutant@google.com>
12864
12865         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12866         vector.
12867         (Plugin_manager::claim_file): Create plugin object even if
12868         plugin did not call the add_symbols callback.
12869         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12870         asking for more symbols than were added.
12871         * testsuite/Makefile.am (plugin_test_1): Add test case with
12872         no global symbols.
12873         (empty.syms): New target.
12874         * testsuite/Makefile.in: Regenerate.
12875         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12876         message. Don't call add_symbols if no globals.
12877         (all_symbols_read_hook): Don't provide replacement for empty
12878         claimed file.
12879
12880 2008-12-12  Ian Lance Taylor  <iant@google.com>
12881
12882         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12883         r_type == 0 for a local symbol with r_sym == 0.
12884         (scan_relocatable_relocs): Pass r_sym to
12885         local_non_section_strategy.
12886         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12887         r_sym parameter.
12888
12889         * configure.ac: Update test for TLS descriptors: they are
12890         supported as of glibc 2.9.
12891         * configure: Rebuild.
12892
12893 2008-12-11  Ian Lance Taylor  <iant@google.com>
12894
12895         PR 7091
12896         * target-reloc.h (Default_scan_relocatable_relocs): For each
12897         function, map r_type == 0 to RELOC_DISCARD.
12898
12899 2008-12-10  Cary Coutant  <ccoutant@google.com>
12900
12901         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12902         object to override a kept COMDAT group from a plugin object.
12903
12904 2008-12-09  Ian Lance Taylor  <iant@google.com>
12905
12906         PR 7088
12907         * yyscript.y (file_cmd): Handle INPUT.
12908
12909         * testsuite/initpri1.c: Change all declarations to be full
12910         prototypes by adding void, to avoid compiler warnings.
12911
12912 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12913
12914         * options.cc (General_options::parse_plugin_opt): New.
12915         (General_options::add_plugin): The argument now is just the filename.
12916         (General_options::add_plugin_option): New.
12917         * options.h (plugin_opt): New.
12918         (add_plugin): Change argument name.
12919         (add_plugin_option): New.
12920         * plugin.cc (Plugin::load): Don't parse the plugin option.
12921         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12922         (Plugin::add_option): New.
12923         (Plugin::args_): Change type.
12924         (Plugin::filename_): New.
12925         (Plugin_manager::add_plugin_option): New.
12926         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12927         * testsuite/Makefile.in: Regenerate.
12928
12929 2008-12-05  Cary Coutant  <ccoutant@google.com>
12930
12931         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12932         Handle --strip-lto-sections option.
12933         * options.h (strip_lto_sections): New option.
12934
12935 2008-12-01  Cary Coutant  <ccoutant@google.com>
12936
12937         * plugin.cc (ld_plugin_message): Change format parameter to const.
12938         Fix mismatch between new[] and delete.
12939
12940 2008-11-14  Cary Coutant  <ccoutant@google.com>
12941
12942         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12943         instead of -1U.
12944
12945 2008-11-05  Craig Silverstein  <csilvers@google.com>
12946
12947         * options.cc (General_options::parse_dynamic_list): New function.
12948         * options.h (General_options): New flags dynamic_list,
12949         dynamic_list_data, dynamic_list_cpp_new, and
12950         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12951         (General_options::in_dynamic_list): New function.
12952         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12953         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12954         (Lex::can_continue_name): Likewise.
12955         (yylex): Likewise.
12956         (read_script_file): New parameter script_options.
12957         (read_dynamic_list): New function.
12958         (Script_options::define_dynamic_list): New function.
12959         (dynamic_list_keyword_parsecodes): New variable.
12960         (dynamic_list_keywords): New variable.
12961         * script.h (Script_options::define_dynamic_list): New function
12962         prototype.
12963         (read_dynamic_list): New function prototype.
12964         * symtab.cc (strprefix): New macro.
12965         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12966         dynamic_list_data, dynamic_list_cpp_new, and
12967         dynamic_list_cpp_typeinfo.
12968         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12969         (dynamic_list_expr): New rule.
12970         (dynamic_list_nodes): Likewise.
12971         (dynamic_list_node): Likewise.
12972         * testsuite/Makefile.am (dynamic_list): New test.
12973         * testsuite/Makefile.in: Regenerated.
12974         * testsuite/dynamic_list.t: New file.
12975         * testsuite/dynamic_list.sh: New file.
12976
12977 2008-11-05  Craig Silverstein  <csilvers@google.com>
12978
12979         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12980         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12981         (t11_last): Likewise.
12982         * testsuite/ver_test_6.c (main): Likewise.
12983
12984 2008-10-07  Cary Coutant  <ccoutant@google.com>
12985
12986         * options.c (General_options::finalize): Add check for -static and
12987         -shared.
12988         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12989         is not empty.
12990
12991 2008-10-02  Cary Coutant  <ccoutant@google.com>
12992
12993         * plugin.cc (make_sized_plugin_object): Fix conditional
12994         compilation to work when not all targets are enabled.
12995
12996 2008-09-29  Cary Coutant  <ccoutant@google.com>
12997
12998         * archive.cc (Archive::get_file_and_offset): Use filename instead
12999         of name to get library path.
13000         (Archive::include_member): Unlock external member of a thin archive.
13001
13002         * testsuite/Makefile.am (TEST_AR): New variable.
13003         (thin_archive_test_1): New test.
13004         (thin_archive_test_2): New test.
13005         * testsuite/Makefile.in: Regenerate.
13006         * testsuite/thin_archive_main.cc: New file.
13007         * testsuite/thin_archive_test_1.cc: New file.
13008         * testsuite/thin_archive_test_2.cc: New file.
13009         * testsuite/thin_archive_test_3.cc: New file.
13010         * testsuite/thin_archive_test_4.cc: New file.
13011
13012 2008-09-29  Cary Coutant  <ccoutant@google.com>
13013
13014         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13015         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13016         instead of -1U.
13017         (Sized_relobj::do_finalize_local_symbols): Likewise.
13018         (Sized_relobj::map_to_kept_section): Likewise.
13019         * object.h (Sized_relobj::invalid_address): New constant.
13020         (Sized_relobj::do_output_section_offset): Check for invalid_address
13021         and return -1ULL.
13022         * output.cc (Output_reloc::local_section_offset): Use constant
13023         invalid_address instead of -1U.
13024         (Output_reloc::get_address): Likewise.
13025         (Output_section::output_address): Change -1U to -1ULL.
13026         * output.h (Output_reloc::invalid_address): New constant.
13027         * reloc.cc (Sized_relobj::write_sections): Use constant
13028         invalid_address instead of -1U.
13029         (Sized_relobj::relocate_sections): Likewise.
13030         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13031         values for merge sections.
13032         * target-reloc.h (relocate_for_relocatable): Use constant
13033         invalid_address instead of -1U.
13034
13035 2008-09-19  Cary Coutant  <ccoutant@google.com>
13036
13037         Add plugin functionality for link-time optimization (LTO).
13038         * configure.ac (plugins): Add --enable-plugins option.
13039         * configure: Regenerate.
13040         * config.in: Regenerate.
13041         * Makefile.am (LIBDL): New variable.
13042         (CCFILES): Add plugin.cc.
13043         (HFILES): Add plugin.h.
13044         (ldadd_var): Add LIBDL.
13045         * Makefile.in: Regenerate.
13046
13047         * archive.cc: Include "plugin.h".
13048         (Archive::setup): Don't preread archive symbols when using a plugin.
13049         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13050         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13051         files.
13052         (Archive::include_member): Add symbols from plugin objects.
13053         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13054         * descriptors.cc (Descriptors::open): Check for file descriptors
13055         abandoned by plugins.
13056         (Descriptors::claim_for_plugin): New function.
13057         * descriptors.h (Descriptors::claim_for_plugin): New function.
13058         (Open_descriptor::is_claimed): New field.
13059         (claim_descriptor_for_plugin): New function.
13060         * fileread.cc (File_read::claim_for_plugin): New function.
13061         * fileread.h (File_read::claim_for_plugin): New function.
13062         (File_read::descriptor): New function.
13063         * gold.cc: Include "plugin.h".
13064         (queue_initial_tasks): Add task to call plugin hooks for generating
13065         new object files.
13066         * main.cc: Include "plugin.h".
13067         (main): Load plugin libraries.
13068         * object.h (Pluginobj): Declare.
13069         (Object::pluginobj): New function.
13070         (Object::do_pluginobj): New function.
13071         (Object::set_target): New function.
13072         * options.cc: Include "plugin.h".
13073         (General_options::parse_plugin): New function.
13074         (General_options::General_options): Initialize plugins_ field.
13075         (General_options::add_plugin): New function.
13076         * options.h (Plugin_manager): Declare.
13077         (General_options): Add --plugin option.
13078         (General_options::has_plugins): New function.
13079         (General_options::plugins): New function.
13080         (General_options::add_plugin): New function.
13081         (General_options::plugins_): New field.
13082         * plugin.cc: New file.
13083         * plugin.h: New file.
13084         * readsyms.cc: Include "plugin.h".
13085         (Read_symbols::do_read_symbols): Check for archive before checking
13086         for ELF file.  Call plugin hooks to claim files.
13087         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13088         from a real object file; force override when processing replacement
13089         files.
13090         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13091         (Symbol::init_base_object): Likewise.
13092         (Symbol::init_base_output_data): Likewise.
13093         (Symbol::init_base_output_segment): Likewise.
13094         (Symbol::init_base_constant): Likewise.
13095         (Symbol::init_base_undefined): Likewise.
13096         (Symbol::output_section): Assert that object is not a plugin.
13097         (Symbol_table::add_from_pluginobj): New function.
13098         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13099         undefined.
13100         (Symbol_table::sized_write_globals): Likewise.
13101         (Symbol_table::add_from_pluginobj): Instantiate template.
13102         * symtab.h (Sized_pluginobj): Declare.
13103         (Symbol::in_real_elf): New function.
13104         (Symbol::set_in_real_elf): New function.
13105         (Symbol::in_real_elf_): New field.
13106         (Symbol_table::add_from_pluginobj): New function.
13107
13108         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13109         (LIBDL): New variable.
13110         (LDADD): Add LIBDL.
13111         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13112         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13113         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13114         (MOSTLYCLEANFILES): Likewise.
13115         * testsuite/Makefile.in: Regenerate.
13116         * testsuite/plugin_test.c: New file.
13117         * testsuite/plugin_test_1.sh: New file.
13118         * testsuite/plugin_test_2.sh: New file.
13119
13120 2008-09-16  Ian Lance Taylor  <iant@google.com>
13121
13122         * target-reloc.h (relocate_section): Check whether a symbol is
13123         defined by the ABI before reporting an undefined symbol error.
13124         * target.h (Target::is_defined_by_abi): Make parameter const.
13125         (Target::do_is_defined_by_abi): Likewise.
13126         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13127         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13128         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13129         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13130         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13131         * testsuite/Makefile.in: Rebuild.
13132
13133         * fileread.cc (make_view): Add casts to avoid warning.
13134
13135 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13136
13137         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13138         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13139
13140 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13141
13142         * options.h (General_options::output_is_executable): New.
13143         (General_options::output_is_pie): New.
13144         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13145         for shared libraries.
13146         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13147
13148 2008-09-11  Chris Demetriou  <cgd@google.com>
13149
13150         * options.h (origin): New -z option.
13151         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13152         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13153         in DT_FLAGS_1.
13154
13155 2008-09-05  Cary Coutant  <ccoutant@google.com>
13156
13157         * fileread.cc (File_read::make_view): Add check for attempt to map
13158         beyond end of file.
13159
13160 2008-09-05  Cary Coutant  <ccoutant@google.com>
13161
13162         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13163         explicit instantiations.
13164
13165 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13166
13167         PR gold/6858
13168         * options.cc (General_options::finalize): Allow undefined symbols
13169         in shlibs if linking -shared.
13170
13171         PR gold/6859
13172         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13173         symbols as not needing a dynsym entry.
13174
13175 2008-08-20  Craig Silverstein  <csilvers@google.com>
13176
13177         * fileread.cc (File_read::open): Do not lock the file unless it
13178         was successfully opened.
13179
13180 2008-08-14  Cary Coutant  <ccoutant@google.com>
13181
13182         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13183         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13184         * testsuite/tls_test.cc (struct int128): 128-bit struct
13185         for testing TLS relocs with non-zero addend.
13186         (v12): New TLS variable.
13187         (t12): New test.
13188         (t_last): Add check for v12.
13189         * testsuite/tls_test.h (t12): New function.
13190         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13191
13192 2008-08-13  Ian Lance Taylor  <iant@google.com>
13193
13194         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13195         set tls_segment_ or relro_segment_.
13196         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13197         when appropriate.
13198         * output.h (Output_section::clear_is_relro): New function.
13199         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13200         sections specially even when output_data_ is empty.
13201         (Output_segment::maximum_alignment): When first section is relro,
13202         only force alignment for PT_LOAD segments.
13203         * script.cc (script_data_segment_align): New function.
13204         (script_data_segment_relro_end): New function.
13205         * script-c.h (script_data_segment_align): Declare.
13206         (script_data_segment_relro_end): Declare.
13207         * script-sections.h (class Script_sections): Declare
13208         data_segment_align and data_segment_relro_end.  Add fields
13209         segment_align_index_ and saw_relro_end_.
13210         * script-sections.cc (class Sections_element): Add set_is_relro
13211         virtual function.  Add new bool* parameter to place_orphan_here.
13212         Add get_output_section virtual function.
13213         (class Output_section_definition): Add set_is_relro.  Add new
13214         bool* parameter to place_orphan_here.  Add get_output_section.
13215         Add is_relro_ field.
13216         (Output_section_definition::Output_section_definition): Initialize
13217         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13218         and is_relro_ fields.
13219         (Output_section_definition::place_orphan_here): Add is_relro
13220         parameter.
13221         (Output_section_definition::set_section_addresses): Set relro for
13222         output section.
13223         (Output_section_definition::alternate_constraint): Likewise.
13224         (class Orphan_output_section): Add new bool* parameter to
13225         place_orphan_here.  Add get_output_section.
13226         (Orphan_output_section::place_orphan_here): Add is_relro
13227         parameter.
13228         (Script_sections::Script_sections): Initialize
13229         data_segment_align_index_ and saw_relro_end_.
13230         (Script_sections::data_segment_align): New function.
13231         (Script_sections::data_segment_relro_end): New function.
13232         (Script_sections::place_orphan): Set or clear is_relro.
13233         (Script_sections::set_section_addresses): Force alignment of first
13234         TLS section.
13235         * yyscript.y (exp): Call script_data_segment_align and
13236         script_data_segment_relro_end.
13237         * testsuite/relro_script_test.t: New file.
13238         * testsuite/relro_test.cc (using_script): Declare.
13239         (t1, t2): Test using_script.
13240         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13241         (relro_script_test_SOURCES): Define.
13242         (relro_script_test_DEPENDENCIES): Define.
13243         (relro_script_test_LDFLAGS): Define.
13244         (relro_script_test_LDADD): Define.
13245         (relro_script_test.so): New target.
13246         * testsuite/Makefile.in: Rebuild.
13247
13248 2008-08-06  Cary Coutant <ccoutant@google.com>
13249
13250         * archive.cc (Archive::total_archives, Archive::total_members)
13251         (Archive::total_members_loaded): New variables.
13252         (Archive::setup): Add parameter.  Add option to preread
13253         archive symbols.
13254         (Archive::read_armap): Add counter.
13255         (Archive::get_file_and_offset): New function.
13256         (Archive::get_elf_object_for_member): New function.
13257         (Archive::read_all_symbols): New function.
13258         (Archive::read_symbols): New function.
13259         (Archive::add_symbols): Add counters.
13260         (Archive::include_all_members): Use armap to find members if it's
13261         already built.
13262         (Archive::include_member): Skip reading symbols if already read.
13263         Factored code into Archive::get_file_and_offset and
13264         Archive::get_elf_object_for_member.  Changed call to
13265         Mapfile::report_include_archive_member.
13266         (Archive::print_stats): New function.
13267         * archive.h: Declare Object and Read_symbols_data classes.
13268         (Archive::Archive): Add initializers for new members.
13269         (Archive::setup): Add parameter.
13270         (Archive::print_stats): New function.
13271         (Archive::total_archives, Archive::total_members)
13272         (Archive::total_members_loaded): New variables.
13273         (Archive::get_file_and_offset): New function.
13274         (Archive::get_elf_object_for_member): New function.
13275         (Archive::read_all_symbols): New function.
13276         (Archive::read_symbols): New function.
13277         (Archive::Archive_member): New class.
13278         (Archive::members_): New member.
13279         (Archive::num_members_): New member.
13280         * main.cc: Include archive.h.
13281         (main): Call Archive::print_stats.
13282         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13283         archive parameter; member_name is now the fully-decorated name.
13284         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13285         * options.h: (General_options): Add --preread-archive-symbols option.
13286         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13287         Archive::setup.
13288
13289 2008-08-04  Ian Lance Taylor  <iant@google.com>
13290
13291         * symtab.h (Symbol::use_plt_offset): New function.
13292         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13293         * powerpc.cc (Relocate::relocate): Likewise.
13294         * sparc.cc (Relocate::relocate): Likewise.
13295         * x86_64.cc (Relocate::relocate): Likewise.
13296         * testsuite/weak_plt.sh: New test.
13297         * testsuite/weak_plt_main.cc: New test.
13298         * testsuite/weak_plt_shared.cc: New test.
13299         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13300         (check_PROGRAMS): Add weak_plt.
13301         (check_DATA): Add weak_plt_shared.so.
13302         (weak_plt_main_pic.o, weak_plt): New targets.
13303         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13304         * testsuite/Makefile.in: Rebuild.
13305
13306         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13307         gcctestdir/ld.
13308         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13309         * testsuite/Makefile.in: Rebuild.
13310
13311 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13312
13313         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13314         * Makefile.in: Regenerate.
13315         * po/POTFILES.in: Regenerate.
13316
13317 2008-07-29  Ian Lance Taylor  <iant@google.com>
13318
13319         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13320         symbols before other symbols.
13321         * testsuite/script_test_2.cc (test_addr): Declare.
13322         (test_addr_alias): Declare.
13323         (main): Check that test_addr and test_addr_alias have the right
13324         values.
13325         * testsuite/script_test_2.t: Define test_addr_alias and
13326         test_addr.
13327
13328 2008-07-24  Ian Lance Taylor  <iant@google.com>
13329
13330         PR 5990
13331         * descriptors.cc: New file.
13332         * descriptors.h: New file.
13333         * gold-threads.h (class Hold_optional_lock): New class.
13334         * fileread.cc: Include "descriptors.h".
13335         (File_read::~File_read): Release descriptor rather than closing
13336         it.
13337         (File_read::open) [file]: Call open_descriptor rather than open.
13338         Set is_descriptor_opened_.
13339         (File_read::open) [memory]: Assert that descriptor is not open.
13340         (File_read::reopen_descriptor): New function.
13341         (File_read::release): Release descriptor.
13342         (File_read::do_read): Make non-const.  Reopen descriptor.
13343         (File_read::read): Make non-const.
13344         (File_read::make_view): Reopen descriptor.
13345         (File_read::do_readv): Likewise.
13346         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13347         Update declarations.
13348         * layout.cc: Include "descriptors.h".
13349         (Layout::create_build_id): Use open_descriptor rather than open.
13350         * output.cc: Include "descriptors.h".
13351         (Output_file::open): Use open_descriptor rather than open.
13352         * archive.cc (Archive::const_iterator): Change Archive to be
13353         non-const.
13354         (Archive::begin, Archive::end): Make non-const.
13355         (Archive::count_members): Likewise.
13356         * archive.h (class Archive): Update declarations.
13357         * object.h (Object::read): Make non-const.
13358         * Makefile.am (CCFILES): Add descriptors.cc.
13359         (HFILES): Add descriptors.h.
13360         * Makefile.in: Rebuild.
13361
13362         PR 6716
13363         * gold.h: Always include <clocale>.  Add Solaris workarounds
13364         following code in binutils/sysdep.h.
13365
13366         PR 6048
13367         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13368         this->eh_frame_hdr_ is NULL before using it.
13369
13370         * dynobj.cc (Versions::Versions): Update comment.
13371
13372         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13373         the base version name.
13374
13375         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13376         array size plus one.
13377         (Stringpool_template::set_string_offsets): Subtract one from key
13378         before using it as an array index.
13379         (Stringpool_template::get_offset_with_length): Likewise.
13380         (Stringpool_template::write_to_buffer): Likewise.
13381         * stringpool.h (Stringpool_template::get_offset_from_key):
13382         Likewise.
13383
13384 2008-07-23  Ian Lance Taylor  <iant@google.com>
13385
13386         PR 6658
13387         * object.h (Merged_symbol_value::value): Do our best to handle a
13388         negative addend.
13389
13390         PR 6647
13391         * script.cc (Version_script_info::get_versions): Don't add empty
13392         version tag to return value.
13393         (Version_script_info::get_symbol_version_helper): Change return
13394         type to bool.  Add pversion parameter.  Change all callers.
13395         (script_register_vers_node): Don't require a non-NULL tag.
13396         * script.h (class Version_script_info): Update declarations.
13397         (Version_script_info::get_symbol_version): Change return type to
13398         bool.  Add version parameter.  Change all callers.
13399         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13400         handling.  Handle an empty version from a version script.
13401         (Symbol_table::define_special_symbol): Likewise.
13402         * testsuite/ver_test_10.script: New file.
13403         * testsuite/ver_test_10.sh: New file.
13404         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13405         (check_DATA): Add ver_test_10.syms.
13406         (ver_test_10.syms, ver_test_10.so): New target.
13407         * testsuite/Makefile.in: Rebuild.
13408
13409 2008-07-23  Simon Baldwin  <simonb@google.com>
13410
13411         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13412         to zero for undefined symbols from dynamic libraries.
13413
13414 2008-07-23  Ian Lance Taylor  <iant@google.com>
13415
13416         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13417         Change all callers.
13418         * symtab.h (class Symbol_table): Update declaration.
13419         * testsuite/ver_test_9.cc: New file.
13420         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13421         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13422         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13423         (ver_test_9.so, ver_test_9.o): New targets.
13424         * testsuite/Makefile.in: Rebuild.
13425
13426 2008-07-22  Ian Lance Taylor  <iant@google.com>
13427
13428         * options.h (class General_options): Define --check-sections.
13429         * layout.cc (Layout::set_segment_offsets): Handle
13430         --check-sections.
13431
13432         * options.h (class General_options): Define -n/--nmagic and
13433         -N/--omagic.
13434         * options.cc (General_options::finalize): For -n/--nmagic or
13435         -N/--omagic, set -static.
13436         * layout.cc (Layout::attach_allocated_section_to_segment): If
13437         -N/--omagic, don't put read-only and read-write sections in
13438         different segments.
13439         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13440         finding a read-only segment.
13441         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13442         don't set the minimum segment alignment to the common page size,
13443         and don't set the file offset to the address modulo the page size.
13444         * script-sections.cc (Script_sections::create_segments): If
13445         -n/--omagic, don't put read-only and read-write sections in
13446         different segments.
13447
13448         * cref.cc: New file.
13449         * cref.h: New file.
13450         * options.h (class General_options): Add --print-symbol-counts.
13451         * main.cc (main): Issue defined symbol report if requested.
13452         * archive.cc (Archive::interpret_header): Make into a const member
13453         function.
13454         (Archive::add_symbols): Call Input_objects::archive_start and
13455         archive_stop.
13456         (Archive::const_iterator): Define new class.
13457         (Archive::begin, Archive::end): New functions.
13458         (Archive::include_all_members): Rewrite to use iterator.
13459         (Archive::count_members): New function.
13460         * archive.h (class Archive): Update declarations.
13461         (Archive::filename): New function.
13462         * object.cc: Include "cref.h".
13463         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13464         (Sized_relobj::do_get_global_symbol_counts): New function.
13465         (Input_objects::add_object): Add object to cross-referencer.
13466         (Input_objects::archive_start): New function.
13467         (Input_objects::archive_stop): New function.
13468         (Input_objects::print_symbol_counts): New function.
13469         * object.h: Declare Cref and Archive.
13470         (Object::get_global_symbol_counts): New function.
13471         (Object::do_get_global_symbol_counts): New pure virtual function.
13472         (class Sized_relobj): Add defined_count_ field.  Update
13473         declarations.
13474         (class Input_objects): Add cref_ field.  Update constructor.
13475         Update declarations.
13476         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13477         defined_count_.
13478         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13479         symbol counts.
13480         (Sized_dynobj::do_get_global_symbol_counts): New function.
13481         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13482         defined_count_.  Update declarations.  Define Symbols typedef.
13483         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13484         parameter.  Change all callers.
13485         (Symbol_table::add_from_dynobj): Add sympointers and defined
13486         parameters.  Change all callers.
13487         * symtab.h (class Symbol_table): Update declarations.
13488         * Makefile.am (CCFILES): Add cref.cc.
13489         (HFILES): Add cref.h.
13490         * Makefile.in: Rebuild.
13491
13492 2008-07-22  Simon Baldwin  <simonb@google.com>
13493
13494         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13495         to zero when writing undefined symbols.
13496
13497 2008-07-22  Ian Lance Taylor  <iant@google.com>
13498
13499         * output.cc (Output_section::add_input_section): Don't try to
13500         merge empty merge sections.
13501
13502 2008-07-21  Craig Silverstein  <csilvers@google.com>
13503
13504         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13505         Include symbol version in error message.
13506
13507 2008-07-20  Chris Demetriou  <cgd@google.com>
13508
13509         * configure.ac (gold_cv_c_random_seed): New configured variable.
13510         (RANDOM_SEED_CFLAGS): New substituted variable.
13511         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13512         * configure: Rebuild.
13513         * Makefile.in: Likewise.
13514         * testsuite/Makefile.in: Likewise.
13515
13516 2008-07-18  Ian Lance Taylor  <iant@google.com>
13517
13518         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13519         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13520         * testsuite/ver_test_main.cc (main): Call t4.
13521         (t4, t4_2a): Define.
13522         * testsuite/ver_test_2.cc (t4_2): Define.
13523         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13524         * testsuite/ver_test_4.cc (t4_2a): Define.
13525         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13526         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13527
13528 2008-07-17  Ian Lance Taylor  <iant@google.com>
13529
13530         * dynobj.cc (Versions::add_def): If we give an error about a
13531         missing version, go ahead and create the version anyhow.
13532
13533 2008-07-10  Ian Lance Taylor  <iant@google.com>
13534
13535         Handle output sections with more than 0x7fffffff bytes.
13536         * object.h (class Relobj): Change map_to_output_ to
13537         output_sections_, and just keep a section pointer.  Change all
13538         uses.  Move comdat group support to Sized_relobj.
13539         (Relobj::is_section_specially_mapped): Remove.
13540         (Relobj::output_section): Remove poff parameter.  Change all
13541         callers.
13542         (Relobj::output_section_offset): New function.
13543         (Relobj::set_section_offset): Rewrite.
13544         (Relobj::map_to_output): Remove.
13545         (Relobj::output_sections): New function.
13546         (Relobj::do_output_section_offset): New pure virtual function.
13547         (Relobj::do_set_section_offset): Likewise.
13548         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13549         group support from Relobj.  Update declarations.
13550         (Sized_relobj::get_output_section_offset): New function.
13551         (Sized_relobj::do_output_section_offset): New function.
13552         (Sized_relobj::do_set_section_offset): New function.
13553         * object.cc (Relobj::output_section_address): Remove.
13554         (Sized_relobj::Sized_relobj): Initialize new fields.
13555         (Sized_relobj::include_section_group): Cast find_kept_object to
13556         Sized_relobj.
13557         (Sized_relobj::include_linkonce_section): Likewise.
13558         (Sized_relobj::do_layout): Use separate arrays for output section
13559         and output offset.
13560         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13561         output_sections.
13562         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13563         output_sections and section_offsets.
13564         (Sized_relobj::write_local_symbols): Likewise.
13565         (map_to_kept_section): Compute output address directly.
13566         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13567         output_sections and section_offsets.
13568         (Sized_relobj::write_sections): Likewise.
13569         (Sized_relobj::relocate_sections): Likewise.
13570         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13571         * output.h (class Output_reloc): Update declarations.  Change
13572         u2_.relobj to Sized_relobj*.
13573         (class Output_data_reloc): Change add functions to use
13574         Sized_relobj*.
13575         * output.cc (Output_reloc::Output_reloc): Change relobj to
13576         Sized_relobj*.
13577         (Output_reloc::local_section_offset): Change return type to
13578         Elf_Addr.  Use get_output_section_offset.
13579         (Output_reloc::get_address): Likewise.
13580         (Output_section::is_input_address_mapped): Don't call
13581         is_section_specially_mapped.
13582         (Output_section::output_offset): Likewise.
13583         (Output_section::output_address): Likewise.
13584         (Output_section::starting_output_address): Likewise.
13585         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13586         parameter to Sized_relobj*.
13587         (Copy_relocs::need_copy_reloc): Likewise.
13588         (Copy_relocs::save): Likewise.
13589         * copy-relocs.h (class Copy_relocs): Update declarations.
13590         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13591         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13592         * target-reloc.h (relocate_for_relocatable): Change
13593         offset_in_output_section type to Elf_Addr.  Change code that uses
13594         it as well.
13595         * layout.cc (Layout::layout): Always set *off.
13596         * mapfile.cc (Mapfile::print_input_section): Use
13597         output_section_offset.
13598         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13599         Sized_relobj*.
13600         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13601         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13602         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13603
13604 2008-07-03  Ian Lance Taylor  <iant@google.com>
13605
13606         * layout.cc (Layout::include_section): Do not discard unrecognized
13607         SHT_STRTAB sections.
13608
13609 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13610
13611         * script.cc (Lex::can_continue_name): Make '?' allowable in
13612         version-script names.
13613         * testsuite/version_script.map: Change glob pattern to use '?'
13614
13615 2008-06-30  Manish Singh  <yosh@gimp.org>
13616
13617         PR 6585
13618         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13619         Correct typo.
13620
13621 2008-06-30  Ian Lance Taylor  <iant@google.com>
13622
13623         PR 6660
13624         PR 6682
13625         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13626         versions]: Don't try to read the value in the contents, since we
13627         don't use it.  Use the template endianness when writing.
13628
13629 2008-06-25  Cary Coutant  <ccoutant@google.com>
13630
13631         * fileread.cc (File_read::make_view): Assert on zero-length view.
13632         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13633         symbol table when there are no symbols to read.
13634
13635 2008-06-23  Craig Silverstein  <csilvers@google.com>
13636
13637         * version.cc (version_string): Bump to 1.7
13638
13639 2008-06-18  Craig Silverstein  <csilvers@google.com>
13640
13641         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13642         constant 0xFFFF to type Valtype.
13643         (Powerpc_relocate_functions::rel16_ha): Likewise.
13644
13645 2008-06-17  Ian Lance Taylor  <iant@google.com>
13646
13647         * output.h (Output_section::Input_section): Initialize p2align_ to
13648         zero for Output_section_data constructors.
13649         (Output_section::Input_section::addralign): If not an input
13650         section, return the alignment of the Output_section_data.
13651         * testsuite/copy_test.cc: New file.
13652         * testsuite/copy_test_1.cc: New file.
13653         * testsuite/copy_test_2.cc: New file.
13654         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13655         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13656         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13657         (copy_test_1_pic.o, copy_test_1.so): New targets.
13658         (copy_test_2_pic.o, copy_test_2.so): New targets.
13659         * testsuite/Makefile.in: Rebuild.
13660
13661         * script-sections.cc (Script_sections::place_orphan): Initialize
13662         local variable exact.
13663
13664 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13665
13666         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13667
13668 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13669             David S. Miller  <davem@davemloft.net>
13670
13671         * powerpc.cc: New file.
13672         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13673         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13674         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13675         * Makefile.in: Rebuild.
13676
13677 2008-06-09  Ian Lance Taylor  <iant@google.com>
13678
13679         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13680         <exception>.
13681         (throwing, orig_terminate): New static variables.
13682         (terminate_handler): New static function.
13683         (t2): Set terminate handler.
13684
13685 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13686
13687         PR 6584
13688         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13689         alignment.
13690
13691 2008-05-30  Cary Coutant  <ccoutant@google.com>
13692
13693         * archive.cc (Archive::include_all_members) Correct to step
13694         over symbol table and extended name table in thin archives.
13695
13696 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13697
13698         PR 6407
13699         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13700         calculation.
13701
13702 2008-05-28  Caleb Howe  <cshowe@google.com>
13703
13704         * reduced_debug_output.cc: New file.
13705         * reduced_debug_output.h: New file.
13706         * options.h (class General_options): Add --strip-debug-non-line.
13707         * options.cc (General_options::finalize): Add strip_debug_non_line
13708         to the strip heirarchy.
13709         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13710         fields.
13711         * layout.cc: Include "reduced_debug_output.h".
13712         (Layout::Layout): Initialize new fields.
13713         (line_only_debug_sections): New static array.
13714         (is_lines_only_debug_sections): New static inline function.
13715         (Layout::include_section): Handle --strip-debug-non-line.
13716         (Layout::make_output_section): If --strip-debug-non-line, build
13717         new output sections for .debug_abbrev and .debug_info.
13718         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13719         gold.  Warn about possible overflow.
13720         (read_signed_LEB_128): Likewise.
13721         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13722         (read_signed_LEB_128): Declare.
13723         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13724         (HFILES): Add reduced_debug_output.h.
13725         * Makefile.in: Rebuild.
13726
13727 2008-05-21  Ian Lance Taylor  <iant@google.com>
13728
13729         * mapfile.cc: New file.
13730         * mapfile.h: New file.
13731         * options.h (class General_options): Add -M/--print-map and -Map.
13732         * options.cc (General_options::finalize): Make -M equivalent to
13733         -Map -.
13734         * main.cc: Include <cstdio> and "mapfile.h".
13735         (main): Open mapfile if requested.
13736         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13737         constructor.  Change caller.
13738         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13739         (queue_middle_tasks): Likewise.
13740         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13741         declarations.
13742         * archive.cc: Include "mapfile.h".
13743         (Archive::add_symbols): Add mapfile parameter.  Change all
13744         callers.  Pass mapfile, symbol, and reason to include_member.
13745         (Archive::include_all_members): Add mapfile parameter.  Change all
13746         callers.
13747         (Archive::include_member): Add mapfile, sym, and why parameters.
13748         Change all callers.  Report inclusion to map file.
13749         * archive.h: Include "fileread.h".
13750         (class Archive): Update declarations.
13751         (Archive::file): New const method.
13752         (class Add_archive_symbols): Add mapfile_ field.  Update
13753         constructor.  Change all callers.
13754         * readsyms.h (class Read_symbols): Likewise.
13755         (class Finish_group): Likewise.
13756         (class Read_script): Likewise.
13757         * common.cc: Include "mapfile.h".
13758         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13759         all callers.
13760         (Symbol_table::do_allocate_commons): Likewise.
13761         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13762         symbol allocation to mapfile.
13763         * common.h (class Allocate_commons_task): Add mapfile_ field.
13764         Update constructor.  Change all callers.
13765         * symtab.h (class Symbol_table): Update declarations.
13766         * layout.cc: Include "mapfile.h".
13767         (Layout_task_runner::run): Print information to mapfile.
13768         (Layout::create_gold_note): Change Output_data_fixed_space to
13769         Output_data_zero_fill.
13770         (Layout::create_build_id): Likewise.
13771         (Layout::print_to_mapfile): New function.
13772         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13773         constructor.  Change caller.
13774         (class Layout): Declare print_to_mapfile.
13775         * output.cc (Output_section::Input_section::print_to_mapfile): New
13776         function.
13777         (Output_section::add_input_section): If producing a map, always
13778         add to input_sections_ list.
13779         (Output_section::do_print_to_mapfile): New function.
13780         (Output_segment::print_sections_to_mapfile): New function.
13781         (Output_segment::print_section_list_to_mapfile): New function.
13782         * output.h: Include "mapfile.h".
13783         (Output_data::print_to_mapfile): New function.
13784         (Output_data::do_print_to_mapfile): New virtual function.
13785         (Output_segment_headers::do_print_to_mapfile): New function.
13786         (Output_file_header::do_print_to_mapfile): New function.
13787         (Output_data_const::do_print_to_mapfile): New function.
13788         (class Output_data_const_buffer): Add map_name_ field.  Update
13789         constructor.  Change all callers.  Add do_print_to_mapfile
13790         function.
13791         (class Output_data_fixed_space): Likewise.
13792         (class Output_data_space): Likewise.
13793         (class Output_data_zero_fill): New class.
13794         (Output_data_strtab::do_print_to_mapfile): New function.
13795         (Output_data_reloc_base::do_print_to_mapfile): New function.
13796         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13797         (Output_data_group::do_print_to_mapfile): New function.
13798         (Output_data_got::do_print_to_mapfile): New function.
13799         (Output_data_dynamic::do_print_to_mapfile): New function.
13800         (Output_symtab_xindex::do_print_to_mapfile): New function.
13801         (class Output_section): Declare do_print_to_mapflie.  Declare
13802         print_to_mapfile in Input_section.
13803         (class Output_segment): Declare new functions.
13804         * object.h (Sized_relobj::symbol_count): New function.
13805         * script-sections.cc
13806         (Output_section_element_dot_assignment::set_section_addresses):
13807         Change Output_data_fixed_space to Output_data_zero_fill.
13808         (Output_data_expression::do_print_to_mapfile): New function.
13809         * script.cc (read_input_script): Add mapfile parameter.  Change
13810         all callers.
13811         * script.h (read_input_script): Update declaration.
13812         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13813         (Eh_frame::do_print_to_mapfile): New function.
13814         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13815         (Output_merge_string::do_print_to_mapfile): New function.
13816         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13817         function.
13818         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13819         function.
13820         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13821         function.
13822         * Makefile.am (CCFILES): Add mapfile.cc.
13823         (HFILES): Add mapfile.h.
13824         * Makefile.in: Rebuild.
13825
13826 2008-05-19  Ian Lance Taylor  <iant@google.com>
13827
13828         * options.h (class General_options): Add -z relro.
13829         * layout.cc (Layout::Layout): Initialize relro_segment_.
13830         (Layout::add_output_section_data): Return the output section.
13831         (Layout::make_output_section): Rcognize relro sections and mark
13832         them appropriately.
13833         (Layout::attach_allocated_section_to_segment): Put relro sections
13834         in a PT_GNU_RELRO segment.
13835         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13836         section as relro.
13837         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13838         PT_TLS segments.
13839         (Layout::linkonce_mapping): Map d.rel.ro.local to
13840         .data.rel.ro.local.
13841         (Layout::output_section_name): Us .data.rel.ro.local for any
13842         section which begins with that.
13843         * layout.h (class Layout): Update add_output_section_data
13844         declaration.  Add relro_segment_ field.
13845         * output.cc (Output_section::Output_section): Initialize is_relro_
13846         and is_relro_local_ fields.
13847         (Output_segment::add_output_section): Group relro sections.
13848         (Output_segment::is_first_section_relro): New function.
13849         (Output_segment::maximum_alignment): If there is a relro section,
13850         align the segment to the common page size.
13851         (Output_segment::set_section_addresses): Track whether we are
13852         looking at relro sections.  If the last section is a relro
13853         section, align to the common page size.
13854         (Output_segment::set_section_list_addresses): Add in_relro
13855         parameter.  Change all callers.  Align to the page size when
13856         moving from relro to non-relro section.
13857         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13858         segment.
13859         * output.h (class Output_section): Add is_relro_ and
13860         is_relro_local_ fields.
13861         (Output_section::is_relro): New function.
13862         (Output_section::set_is_relro): New function.
13863         (Output_section::is_relro_local): New function.
13864         (Output_section::set_is_relro_local): New function.
13865         (class Output_segment): Update declarations.
13866         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13867         * sparc.cc (Target_sparc::got_section): Likewise.
13868         * x86_64.cc (Target_x86_64::got_section): Likewise.
13869         * testsuite/relro_test_main.cc: New file.
13870         * testsuite/relro_test.cc: New file.
13871         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13872         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13873         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13874         (relro_test.so, relro_test_pic.o): New targets.
13875         * testsuite/Makefile.in: Rebuild.
13876
13877 2008-05-16  Ian Lance Taylor  <iant@google.com>
13878
13879         * output.cc (Output_segment::add_output_section): Remove front
13880         parameter.
13881         * output.h (class Output_segment): Remove
13882         add_initial_output_section and overloaded add_output_section.
13883         Update declaration of remaining add_output_section.
13884         * layout.cc (Layout::create_interp): Call add_output_section
13885         rather than add_initial_output_section.
13886         (Layout::finish_dynamic_section): Likewise.
13887
13888         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13889         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13890         know the dynamic type.
13891         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13892         field.  Initialize it in constructor.
13893         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13894         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13895         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13896         reloc.
13897
13898         * output.cc (Output_reloc::get_address): Change return type to
13899         Elf_Addr.
13900         * output.h (class Output_reloc): Update get_address declaration.
13901         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13902         for section addresses.
13903
13904 2008-05-09  Ian Lance Taylor  <iant@google.com>
13905
13906         PR 6493
13907         * gold.cc (gold_nomem): Use return value of write.
13908
13909 2008-05-08  Ian Lance Taylor  <iant@google.com>
13910
13911         * symtab.c (Symbol::init_base_output_data): Add version
13912         parameter.  Change all callers.
13913         (Symbol::init_base_output_segment): Likewise.
13914         (Symbol::init_base_constant): Likewise.
13915         (Symbol::init_base_undefined): Likewise.
13916         (Sized_symbol::init_output_data): Likewise.
13917         (Sized_symbol::init_output_segment): Likewise.
13918         (Sized_symbol::init_constant): Likewise.
13919         (Sized_symbol::init_undefined): Likewise.
13920         (Symbol_table::do_define_in_output_data): If the new symbol has a
13921         version, mark it as the default.
13922         (Symbol_table::do_define_in_output_segment): Likewise.
13923         (Symbol_table::do_define_as_constant): Likewise.
13924         * symtab.h (class Symbol): Update declarations.
13925         (class Sized_symbol): Likewise.
13926         * resolve.cc (Symbol::override_version): New function.
13927         (Symbol::override_base): Call override_version.
13928         (Symbol::override_base_with_special): Likewise.
13929         * testsuite/ver_script_8.script: New file.
13930         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13931         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13932         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13933         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13934
13935 2008-05-06  Ian Lance Taylor  <iant@google.com>
13936
13937         PR 6049
13938         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13939         functions.
13940         (class General_options): Remove existing --undefined, and add
13941         --no-undefined instead.  Add new --undefined as synonym for -u.
13942         * archive.cc (Archive::add_symbols): Check whether symbol was
13943         named with -u.
13944         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13945         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13946         all uses.  Add IS_UNDEFINED.  Update declarations to split
13947         different versions of init_base.  Declare init_base_undefined.
13948         (Symbol::is_defined): Handle IS_UNDEFINED.
13949         (Symbol::is_undefined): Likewise.
13950         (Symbol::is_weak_undefined): Call is_undefined.
13951         (Symbol::is_absolute): Handle IS_CONSTANT.
13952         (class Sized_symbol): Update declarations to split different
13953         versions of init.  Declare init_undefined.
13954         (class Symbol_table): Declare new functions.
13955         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13956         Change all callers.
13957         (Symbol::init_base_output_data): Likewise.
13958         (Symbol::init_base_output_segment): Likewise.
13959         (Symbol::init_base_constant): Likewise.
13960         (Symbol::init_base_undefined): New function.
13961         (Sized_symbol::init_object): Rename from init.  Change all
13962         callers.
13963         (Sized_symbol::init_output_data): Likewise.
13964         (Sized_symbol::init_output_segment): Likewise.
13965         (Sized_symbol::init_constant): Likewise.
13966         (Sized_symbol::init_undefined): New function.
13967         (Symbol_table::add_undefined_symbols_from_command_line): New
13968         function.
13969         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13970         function.
13971         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13972         (Symbol::output_section): Likewise.
13973         (Symbol::set_output_section): Likewise.
13974         (Symbol_table::sized_finalize_symbol): Likewise.
13975         (Symbol_table::sized_write_globals): Likewise.
13976         * resolve.cc (Symbol_table::should_override): Likewise.
13977         (Symbol::override_base_with_special): Likewise.
13978
13979         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13980         symbol, change it to have default visibility.
13981         * testsuite/protected_1.cc: New file.
13982         * testsuite/protected_2.cc: New file.
13983         * testsuite/protected_3.cc: New file.
13984         * testsuite/protected_main_1.cc: New file.
13985         * testsuite/protected_main_2.cc: New file.
13986         * testsuite/protected_main_3.cc: New file.
13987         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13988         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13989         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13990         (protected_1.so): New target.
13991         (protected_1_pic.o, protected_2_pic.o): New targets.
13992         (protected_3_pic.o): New target.
13993         (check_PROGRAMS): Add protected_2.
13994         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13995         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13996         * testsuite/Makefile.in: Rebuild.
13997
13998         * options.h (DEFINE_var): Add set_user_set_##varname__.
13999         (DEFINE_bool_alias): New macro.
14000         (class General_options): Define -Bstatic using DEFINE_bool_alias
14001         rather than DEFINE_special.  Add --undefined as an alias for -z
14002         defs.
14003         * options.cc (General_options::parse_Bstatic): Remove.
14004
14005         * options.h (class General_options): Add --fatal-warnings.
14006         * main.cc (main): Implement --fatal-warnings.
14007         * errors.h (Errors::warning_count): New function.
14008
14009         * options.h (class General_options): Add -Bsymbolic-functions.
14010         * symtab.h (Symbol::is_preemptible): Check for
14011         -Bsymbolic-functions.
14012
14013 2008-05-05  Ian Lance Taylor  <iant@google.com>
14014
14015         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14016         as noVARNAME rather than no-VARNAME.
14017         (class General_options): Add option -z combreloc.
14018         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14019         get_address.
14020         (Output_reloc::sort_before) [SHT_REL]: New function.
14021         (Output_reloc::sort_before) [SHT_RELA]: New function.
14022         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14023         Sort_relocs_comparison.
14024         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14025         parameter.  Change all callers.
14026         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14027         sort_relocs parameter.  Change all callers.
14028         * output.cc (Output_reloc::get_address): New function, broken out
14029         of write_rel.
14030         (Output_reloc::write_rel): Call it.
14031         (Output_reloc::compare): New function.
14032         (Output_data_reloc_base::do_write): Optionally sort relocs.
14033
14034         * configure.ac: If targ_extra_obj is set, link it in.
14035         * configure.tgt: Initialize all variables.
14036         (x86_64*): Set targ_extra_obj and targ_extra_size.
14037         * configure: Rebuild.
14038
14039         * object.cc (Sized_relobj::include_section_group): Adjust section
14040         indexes read from group data.  Build vector to pass to
14041         layout_group.
14042         * layout.cc (Layout::layout_group): Add flags and shndxes
14043         parameters.  Remove contents parameter.  Change caller.  Update
14044         explicit instantiations.
14045         * layout.h (class Layout): Update layout_group declaration.
14046         * output.cc (Output_data_group::Output_data_group): Add flags and
14047         input_shndxes parameters.  Remove contents parameter.  Change
14048         caller.
14049         (Output_data_group::do_write): Change input_sections_ to
14050         input_shndxes_.
14051         * output.h (class Output_data_group): Update constructor
14052         declaration.  Rename input_sections_ to input_shndxes_.
14053         * testsuite/many_sections_test.cc: Add template.
14054
14055 2008-04-30  Cary Coutant  <ccoutant@google.com>
14056
14057         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14058
14059         * layout.cc (Layout::include_section): Refactored check for debug
14060         info section.
14061         (Layout::add_comdat): Add new parameters.  Change type
14062         of signature parameter.  Add object and shndx to signatures table.
14063         (Layout::find_kept_object): New function.
14064         * layout.h: Include <cstring>.
14065         (Layout::is_debug_info_section): New function.
14066         (Layout::add_comdat): Add new parameters.
14067         (Layout::find_kept_object): New function.
14068         (Layout::Kept_section): New struct.
14069         (Layout::Signatures): Change type of map range.
14070         * object.cc (Relobj::output_section_address): New function.
14071         (Sized_relobj::include_section_group): Add new parameters.  Change
14072         calls to Layout::add_comdat.  Change to build table of kept comdat
14073         groups and table mapping discarded sections to kept sections.
14074         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14075         (Sized_relobj::do_layout): Change calls to include_section_group and
14076         include_linkonce_section.
14077         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14078         value to zero when section is discarded.
14079         (Sized_relobj::map_to_kept_section): New function.
14080         * object.h (Relobj::output_section_address): New function.
14081         (Relobj::Comdat_group): New type.
14082         (Relobj::find_comdat_group): New function.
14083         (Relobj::Comdat_group_table): New type.
14084         (Relobj::Kept_comdat_section): New type.
14085         (Relobj::Kept_comdat_section_table): New type.
14086         (Relobj::add_comdat_group): New function.
14087         (Relobj::set_kept_comdat_section): New function.
14088         (Relobj::get_kept_comdat_section): New function.
14089         (Relobj::comdat_groups_): New field.
14090         (Relobj::kept_comdat_sections_): New field.
14091         (Symbol_value::input_value): Update comment.
14092         (Sized_relobj::map_to_kept_section) New function.
14093         (Sized_relobj::include_linkonce_section): Add new parameter.
14094         * target-reloc.h (Comdat_behavior): New type.
14095         (get_comdat_behavior): New function.
14096         (relocate_section): Add code to map a discarded section to the
14097         corresponding kept section when applying a relocation.
14098
14099 2008-04-30  Craig Silverstein  <csilvers@google.com>
14100
14101         * dwarf_reader.cc (next_generation_count): New static var.
14102         (Addr2line_cache_entry): New struct.
14103         (addr2line_cache): New static var.
14104         (Dwarf_line_info::one_addr2line): Added caching.
14105         (Dwarf_line_info::clear_addr2line_cache): New function.
14106         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14107         cache-size parameter.
14108         (Dwarf_line_info::one_addr2line_cache): New function.
14109         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14110         new cache-size argument to one_addr2line(), and clear cache.
14111
14112 2008-04-28  Cary Coutant  <ccoutant@google.com>
14113
14114         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14115         R_386_PC8 relocations.
14116
14117 2008-04-23  Ian Lance Taylor  <iant@google.com>
14118
14119         * object.cc (Sized_relobj::include_section_group): Check for
14120         invalid section group.
14121
14122         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14123         header size.
14124
14125         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14126         than read for file header.
14127         * archive.cc (Archive::include_member): Likewise.
14128
14129 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14130
14131         * aclocal.m4: Regenerate.
14132         * configure: Regenerate.
14133
14134 2008-04-19  Ian Lance Taylor  <iant@google.com>
14135
14136         * version.cc (version_string): Bump to 1.6.
14137
14138         * testsuite/Makefile.am (many_sections_r_test): New target.
14139         (many_sections_r_test_SOURCES): Remove.
14140         (many_sections_r_test_DEPENDENCIES): Remove.
14141         (many_sections_r_test_LDFLAGS): Remove.
14142         (many_sections_r_test_LDADD): Remove.
14143
14144         * object.cc (Sized_relobj::do_add_symbols): Always pass
14145         local_symbol_count_ to add_from_relobj.
14146
14147         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14148         every thousand variables.
14149         * testsuite/Makefile.in: Rebuild.
14150
14151         * object.cc (Xindex::initialize_symtab_xindex): New function.
14152         (Xindex::read_symtab_xindex): New function.
14153         (Xindex::sym_xindex_to_shndx): New function.
14154         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14155         available.
14156         (Sized_relobj::do_initialize_xindex): New function.
14157         (Sized_relobj::do_read_symbols): Adjust section links.
14158         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14159         parameter.  Change all callers.
14160         (Sized_relobj::include_section_group): Adjust section links and
14161         symbol section indexes.
14162         (Sized_relobj::do_layout): Adjust section links.
14163         (Sized_relobj::do_count_local_symbols): Adjust section links and
14164         symbol section indexes.
14165         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14166         ordinary and special symbols.
14167         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14168         dynsym_xindex parameters.  Change all callers.  Adjust section
14169         links.  Use SHN_XINDEX when needed.
14170         (Sized_relobj::get_symbol_location_info): Adjust section links.
14171         Don't get fooled by special symbols.
14172         * object.h (class Xindex): Define.
14173         (class Object): Add xindex_ parameter.  Declare virtual functoin
14174         do_initialize_xindex.
14175         (Object::adjust_sym_shndx): New function.
14176         (Object::set_xindex): New protected function.
14177         (class Symbol_value): Add is_ordinary_shndx_ field.
14178         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14179         (Symbol_value::value): Assert ordinary section.
14180         (Symbol_value::initialize_input_to_output_map): Likewise.
14181         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14182         Change all callers.
14183         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14184         all callers.
14185         (class Sized_relobj): Update declarations.
14186         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14187         parameter.  Change all callers.
14188         (Sized_relobj::adjust_shndx): New function.
14189         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14190         field.
14191         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14192         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14193         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14194         (Sized_dynobj::read_dynsym_section): Adjust section links.
14195         (Sized_dynobj::read_dynamic): Likewise.
14196         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14197         section links.
14198         (Sized_dynobj::do_initialize_xindex): New function.
14199         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14200         do_initialize_xindex.
14201         (Sized_dynobj::adjust_shndx): New function.
14202         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14203         dynsym_xindex_ fields.
14204         (Layout::finalize): Add a call to set_section_indexes before
14205         creating the symtab sections.
14206         (Layout::set_section_indexes): Don't do anything if the section
14207         already has a section index.
14208         (Layout::create_symtab_sections): Add shnum parameter.  Change
14209         caller.  Create .symtab_shndx section if needed.
14210         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14211         caller.
14212         (Layout::allocated_output_section_count): New function.
14213         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14214         needed.
14215         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14216         fields.  Update declarations.
14217         (Layout::symtab_xindex): New function.
14218         (Layout::dynsym_xindex): New function.
14219         (class Write_symbols_task): Add layout_ field.
14220         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14221         Change caller.
14222         * output.cc (Output_section_headers::Output_section_headers): Add
14223         shstrtab_section parameter.  Change all callers.
14224         (Output_section_headers::do_sized_write): Store overflow values
14225         for section count and section string table section index in
14226         section header zero.
14227         (Output_file_header::do_sized_write): Check for overflow of
14228         section count and section string table section index.
14229         (Output_symtab_xindex::do_write): New function.
14230         (Output_symtab_xindex::endian_do_write): New function.
14231         * output.h (class Output_section_headers): Add shstrtab_section_.
14232         Update declarations.
14233         (class Output_symtab_xindex): Define.
14234         (Output_section::has_out_shndx): New function.
14235         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14236         field.
14237         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14238         Change all callers.
14239         (Sized_symbol::init): Likewise.
14240         (Symbol::output_section): Check for ordinary symbol.
14241         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14242         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14243         callers.
14244         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14245         Change all callers.  Simplify handling of symbols from sections
14246         not included in the link.
14247         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14248         distinction.
14249         (Weak_alias_sorter::operator()): Assert that symbols are
14250         ordinary.
14251         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14252         distinction.
14253         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14254         parameters.  Change all callers.
14255         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14256         symbol distinction.  Use SHN_XINDEX when needed.
14257         (Symbol_table::write_section_symbol): Add symtab_xindex
14258         parameter.  Change all callers.
14259         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14260         SHN_XINDEX when needed.
14261         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14262         declarations.
14263         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14264         (Symbol::is_defined): Check is_ordinary.
14265         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14266         (Symbol::is_absolute, Symbol::is_common): Likewise.
14267         (class Sized_symbol): Update declarations.
14268         (class Symbol_table): Update declarations.
14269         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14270         parameters.  Change all callers.
14271         (Sized_symbol::override): Likewise.
14272         (Symbol_table::override): Likewise.
14273         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14274         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14275         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14276         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14277         to be in an ordinary section.
14278         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14279         object and is_ordinary parameters.  Change all callers.
14280         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14281         Change all callers.  Don't add undefined or non-ordinary symbols
14282         to reloc_map_.
14283         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14284         Change all callers.
14285         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14286         declarations.
14287         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14288         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14289         (Sized_relobj::relocate_sections): Likewise.
14290         * target-reloc.h (scan_relocs): Adjust section symbol index.
14291         (scan_relocatable_relocs): Likewise.
14292         * i386.cc (Scan::local): Check for ordinary symbols.
14293         * sparc.cc (Scan::local): Likewise.
14294         * x86_64.cc (Scan::local): Likewise.
14295         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14296         to symbol_section_and_value.
14297         * testsuite/many_sections_test.cc: New file.
14298         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14299         (check_PROGRAMS): Add many_sections_test.
14300         (many_sections_test_SOURCES): Define.
14301         (many_sections_test_DEPENDENCIES): Define.
14302         (many_sections_test_LDFLAGS): Define.
14303         (BUILT_SOURCES): Add many_sections_define.h.
14304         (many_sections_define.h): New target.
14305         (BUILT_SOURCES): Add many_sections_check.h.
14306         (many_sections_check.h): New target.
14307         (check_PROGRAMS): Add many_sections_r_test.
14308         (many_sections_r_test_SOURCES): Define.
14309         (many_sections_r_test_DEPENDENCIES): Define.
14310         (many_sections_r_test_LDFLAGS): Define.
14311         (many_sections_r_test_LDADD): Define.
14312         (many_sections_r_test.o): New target.
14313         * testsuite/Makefile.in: Rebuild.
14314
14315 2008-04-17  Cary Coutant  <ccoutant@google.com>
14316
14317         * errors.cc (Errors::info): New function.
14318         (gold_info): New function.
14319         * errors.h (Errors::info): New function.
14320         * gold.h (gold_info): New function.
14321         * object.cc (Input_objects::add_object): Print trace output.
14322         * options.cc (options::parse_set): New function.
14323         (General_options::parse_wrap): Deleted.
14324         (General_options::General_options): Deleted initializer.
14325         * options.h (options::String_set): New typedef.
14326         (options::parse_set): New function.
14327         (DEFINE_set): New macro.
14328         (General_options::wrap): Changed to use DEFINE_set. Changed
14329         callers of any_wrap_symbols and is_wrap_symbol.
14330         (General_options::trace, General_options::trace_symbol):
14331         New options.
14332         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14333         (General_options::wrap_symbols_): Deleted.
14334         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14335
14336 2008-04-17  David S. Miller  <davem@davemloft.net>
14337
14338         * options.cc (General_options::parse_V): New function.
14339         * options.h: Add entries for -V and -Qy.
14340
14341 2008-04-17  Ian Lance Taylor  <iant@google.com>
14342
14343         * common.cc (Symbol_table::allocate_commons): Remove options
14344         parameter.  Change caller.
14345         (Symbol_table::do_allocate_commons): Remove options parameter.
14346         Change caller.  Just call do_allocate_commons_list twice.
14347         (Symbol_table::do_allocate_commons_list): New function, broken out
14348         of do_allocate_commons.
14349         * common.h (class Allocate_commons_task): Remove options_ field.
14350         Update constructor.
14351         * symtab.cc (Symbol_table::Symbol_table): Initialize
14352         tls_commons_.
14353         (Symbol_table::add_from_object): Put TLS common symbols on
14354         tls_commons_ list.
14355         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14356         which are IN_OUTPUT_DATA.
14357         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14358         allocate_commons and do_allocate_commons declarations.  Declare
14359         do_allocate_commons_list.
14360         * gold.cc (queue_middle_tasks): Update creation of
14361         Allocate_commons_task to not pass options.
14362         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14363         (TLS_TEST_C_FLAGS): New variable.
14364         (tls_test_c_pic.o): New target.
14365         (tls_test_shared.so): Link in tls_test_c_pic.o.
14366         (tls_test_c_pic_ie.o): New target.
14367         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14368         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14369         (tls_test_c.o): New target.
14370         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14371         (tls_pic_test_LDADD): Likewise.
14372         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14373         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14374         (tls_test_c_gnu2.o): New target.
14375         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14376         tls_test_c_gnu2.o.
14377         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14378         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14379         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14380         * testsuite/tls_test.cc: Include "config.h".
14381         (t_last): Call t11_last.
14382         * testsuite/tls_test.h (t11, t11_last): Declare.
14383         * testsuite/tls_test_c.c: New file.
14384         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14385         * configure.ac: Check for OpenMP support.
14386         * configure, config.in, Makefile.in: Rebuild.
14387         * testsuite/Makefile.in: Rebuild.
14388
14389 2008-04-16  Cary Coutant  <ccoutant@google.com>
14390
14391         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14392         (Target_i386::tls_base_symbol_defined_): New field.
14393         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14394         (Target_i386::Scan::global): Likewise.
14395         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14396         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14397         (Target_x86_64::tls_base_symbol_defined_): New field.
14398         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14399         (Target_x86_64::Scan::global): Likewise.
14400
14401 2008-04-16  Cary Coutant  <ccoutant@google.com>
14402
14403         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14404         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14405         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14406         building shared libraries.
14407         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14408         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14409         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14410         * testsuite/Makefile.in: Rebuild.
14411         * testsuite/weak_undef.h: New file.
14412         * testsuite/weak_undef_file1.cc: Add extra test cases.
14413         * testsuite/weak_undef_file2.cc: Likewise.
14414         * testsuite/weak_undef_test.cc: Likewise.
14415
14416 2008-04-16  David S. Miller  <davem@davemloft.net>
14417
14418         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14419         Add issued_non_pic_error_ field.  Declare check_non_pic.
14420         (Target_sparc::Scan::check_non_pic): New function.
14421         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14422         (Target_sparc::Scan::global): Likewise.
14423
14424         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14425         * configure: Rebuild.
14426
14427         * options.h (DEFINE_enable): New macro.
14428         (new_dtags): New enable option.
14429         (initfirst, interpose, loadfltr, nodefaultlib,
14430         nodelete, nodlopen, nodump): New -z options.
14431         * layout.cc (Layout:finish_dynamic_section): If new
14432         dtags enabled, emit DT_RUNPATH.  Also, emit a
14433         DT_FLAGS_1 containing any specified -z flags.
14434
14435 2008-04-16  Ian Lance Taylor  <iant@google.com>
14436
14437         * copy-relocs.cc: New file.
14438         * copy-relocs.h: New file.
14439         * reloc.cc: Remove Copy_relocs code.
14440         * reloc.h: Likewise.
14441         * reloc-types.h (struct Reloc_types) [both versions]: Add
14442         get_reloc_addend_noerror.
14443         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14444         variants of add_global which take an addend which must be zero.
14445         * i386.cc: Include "copy-relocs.h".
14446         (class Target_i386): Change type of copy_relocs_ to variable,
14447         update initializer.
14448         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14449         Change all callers.
14450         (Target_i386::do_finalize_sections): Change handling of
14451         copy_relocs_.
14452         * sparc.cc: Include "copy-relocs.h".
14453         (class Target_sparc): Change type of copy_relocs_ to variable,
14454         update initializer.
14455         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14456         Change all callers.
14457         (Target_sparc::do_finalize_sections): Change handling of
14458         copy_relocs_.
14459         * x86_64.cc: Include "copy-relocs.h".
14460         (class Target_x86_64): Change type of copy_relocs_ to variable,
14461         update initializer.
14462         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14463         class.  Change all callers.
14464         (Target_x86_64::do_finalize_sections): Change handling of
14465         copy_relocs_.
14466         * Makefile.am (CCFILES): Add copy-relocs.cc.
14467         (HFILES): Add copy-relocs.h.
14468
14469         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14470
14471         * testsuite/script_test_4.sh: Permit leading zeroes.
14472
14473 2008-04-15  Ian Lance Taylor  <iant@google.com>
14474
14475         * script-sections.cc (Script_sections::create_segments): Use
14476         header_size_adjustment even when there is enough room for the
14477         headers.
14478         * testsuite/script_test_4.sh: New file.
14479         * testsuite/script_test_4.t: New file.
14480         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14481         (check_DATA): Add script_test_4.stdout.
14482         (MOSTLYCLEANFILES): Likewise.
14483         (script_test_4): New target.
14484         (script_test_4.stdout): New target.
14485         * testsuite/Makefile.in: Rebuild.
14486
14487         * sparc.cc: Add definitions for Output_data_plt_sparc class
14488         constants.
14489
14490 2008-04-14  David S. Miller  <davem@davemloft.net>
14491
14492         * sparc.cc: New file.
14493         * Makefile.am (TARGETSOURCES): Add sparc.cc
14494         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14495         * configure.tgt: Document targ_extra_size and
14496         targ_extra_big_endian.  Add entries for sparc-* and
14497         sparc64-*.
14498         * configure.ac: Handle targ_extra_size and
14499         targ_extra_big_endian.
14500         * Makefile.in: Rebuild.
14501         * configure: Likewise.
14502         * po/POTFILES.in: Likewise.
14503         * po/gold.pot: Likewise.
14504
14505 2008-04-14  Ian Lance Taylor  <iant@google.com>
14506
14507         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14508         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14509         in the name/type/flags to section mapping.  Don't call
14510         allocate_output_section.
14511         (Layout::choose_output_section): Change parameter from adjust_name
14512         to is_input_section.  Don't permit input sections after sections
14513         are attached to segments.  Don't call allocate_output_section.
14514         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14515         not write_enable_output_section.
14516         (Layout::make_output_section): Don't push to
14517         unattached_section_list_ nor call attach_to_segment.  Call
14518         attach_section_to_segment if sections are attached.
14519         (Layout::attach_sections_to_segments): New function.
14520         (Layout::attach_section_to_segment): New function.
14521         (Layout::attach_allocated_section_to_segment): Rename from
14522         attach_to_segment.  Remove flags parameter.
14523         (Layout::allocate_output_section): Remove function.
14524         (Layout::write_enable_output_section): Remove function.
14525         * layout.h (class Layout): Update for above changes.  Add new
14526         field sections_are_attached_.
14527         * output.h (Output_section::update_flags_for_input_section): New
14528         function.
14529         * output.cc (Output_section::add_input_section): Call
14530         update_flags_for_input_section.
14531         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14532
14533 2008-04-11  Cary Coutant  <ccoutant@google.com>
14534
14535         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14536         thought unnecessary.
14537         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14538
14539 2008-04-11  Ian Lance Taylor  <iant@google.com>
14540
14541         * output.h (class Output_section_data): Remove inline definition
14542         of set_addralign.
14543         * output.cc (Output_section_data::set_addralign): New function.
14544
14545 2008-04-11  Cary Coutant  <ccoutant@google.com>
14546
14547         Add support for TLS descriptors for i386 and x86_64.
14548         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14549         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14550         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14551         GOT_TYPE_TLS_DESC.
14552         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14553         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14554         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14555         relocations.
14556         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14557         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14558         Fix problem with initial-exec relocations.
14559         (Target_i386::Relocate::relocate_tls): Likewise.
14560         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14561         relaxation.
14562         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14563         support for section-plus-offset dynamic table entries.
14564         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14565         (Output_data_dynamic::Dynamic_entry): Add support for
14566         section-plus-offset dynamic table entries.
14567         (Output_data_dynamic::Classification): Likewise.
14568         (Output_data_dynamic::classification_): Renamed offset_.
14569         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14570         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14571         (Target_x86_64::make_plt_section): New function.
14572         (Target_x86_64::reserve_tlsdesc_entries): New function.
14573         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14574         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14575         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14576         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14577         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14578         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14579         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14580         add extra PLT entry for TLS descriptors.
14581         (Output_data_plt_x86_64::got_): New field.
14582         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14583         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14584         fields.
14585         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14586         descriptors.
14587         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14588         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14589         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14590         R_386_TLS_DESC_CALL relocations.
14591         (Target_x86_64::Scan::global): Likewise.
14592         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14593         for TLS descriptors.
14594         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14595         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14596         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14597         GD-to-IE relaxation.
14598         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14599         and TLS_DESCRIPTORS.
14600         * Makefile.in: Rebuild.
14601         * configure: Rebuild.
14602         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14603         (tls_test_shared2.so): New target.
14604         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14605         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14606         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14607         (tls_shared_gd_to_ie_test_LDADD): New variable.
14608         (tls_shared_gnu2_gd_to_ie_test): New target.
14609         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14610         New targets.
14611         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14612         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14613         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14614         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14615         (tls_shared_gnu2_test): New target.
14616         (tls_test_gnu2_shared.so): New target.
14617         (tls_shared_gnu2_test_SOURCES): New variable.
14618         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14619         (tls_shared_gnu2_test_LDFLAGS): New variable.
14620         (tls_shared_gnu2_test_LDADD): New variable.
14621         * testsuite/Makefile.in: Rebuild.
14622         * testsuite/Makefile.
14623
14624 2008-04-11  Ian Lance Taylor  <iant@google.com>
14625
14626         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14627         justsyms.t.
14628         * testsuite/Makefile.in: Rebuild.
14629
14630         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14631         long.
14632         * testsuite/script_test_2.cc (main): Adjust test.
14633
14634 2008-04-11  David S. Miller  <davem@davemloft.net>
14635             Ian Lance Taylor  <iant@google.com>
14636
14637         * options.h (General_options): Add entries for '-Y' and
14638         '-relax'.
14639         * options.cc (General_options:finalize): If -Y was used, add those
14640         entries to the library path instead of the default "/lib" and
14641         "/usr/lib".
14642
14643 2008-04-11  David S. Miller  <davem@davemloft.net>
14644
14645         * testsuite/justsyms.t: Start at 0x100.
14646         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14647         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14648         long.
14649         * testsuite/script_test_2.cc: Adjust string and section length
14650         checks.
14651
14652 2008-04-09  Ian Lance Taylor  <iant@google.com>
14653
14654         PR gold/5996
14655         * script-sections.cc (Sections_element::allocate_to_segment): Add
14656         orphan parameter.
14657         (Output_section_definition::allocate_to_segment): Likewise.
14658         (Orphan_output_section::allocate_to_segment): Likewise.
14659         (Script_sections::attach_sections_using_phdrs_clause): Don't
14660         propagate non-PT_LOAD segments to orphan sections.
14661         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14662         readelf rather than objdump.
14663         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14664         .interp section and PT_INTERP segment are the same size.
14665         * testsuite/Makefile.in: Rebuild.
14666
14667         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14668         aliases for symbols defined in the same object.
14669         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14670         (weak_alias_test_SOURCES): New variable.
14671         (weak_alias_test_DEPENDENCIES): New variable.
14672         (weak_alias_test_LDFLAGS): New variable.
14673         (weak_alias_test_LDADD): New variable.
14674         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14675         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14676         (weak_alias_test_3.o): New target.
14677         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14678         * testsuite/weak_alias_test_main.cc: New file.
14679         * testsuite/weak_alias_test_1.cc: New file.
14680         * testsuite/weak_alias_test_2.cc: New file.
14681         * testsuite/weak_alias_test_3.cc: New file.
14682
14683 2008-04-08  Ian Lance Taylor  <iant@google.com>
14684
14685         * options.h (class General_options): Add --noinhibit-exec option.
14686         * main.cc (main): Check --noinhibit-exec.
14687
14688         * options.h (class General_options): Define --wrap as a special
14689         option.  Add wrap_symbols_ field.
14690         (General_options::any_wrap_symbols): New function.
14691         (General_options::is_wrap_symbol): New function.
14692         * options.cc (General_options::parse_wrap): New function.
14693         (General_options::General_options): Initialize wrap_symbols_.
14694         * symtab.cc (Symbol_table::wrap_symbol): New function.
14695         (Symbol_table::add_from_object): Handle --wrap.
14696         * symtab.h (class Symbol_table): Declare wrap_symbol.
14697         * target.h (Target::wrap_char): New function.
14698         (Target::Target_info): Add wrap_char field.
14699         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14700         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14701         * testsuite/testfile.cc (Target_test::test_target_info):
14702         Likewise.
14703
14704         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14705         there is one.
14706
14707         * layout.h (class Layout): Add added_eh_frame_data_ field.
14708         * layout.cc (Layout::Layout): Initialize new field.
14709         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14710         output section until we find a section we merged successfully.
14711         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14712         that the size be non-zero.
14713
14714         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14715         qualifier.
14716
14717 2008-04-08  Craig Silverstein  <csilvers@google.com>
14718
14719         * configure.ac: Export new conditional variable HAVE_ZLIB.
14720         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14721         on HAVE_ZLIB.
14722         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14723         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14724
14725 2008-04-07  Ian Lance Taylor  <iant@google.com>
14726
14727         * version.cc (version_string): Set to "1.5".
14728
14729         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14730         Add issued_non_pic_error_ field.  Declare check_non_pic.
14731         (Target_x86_64::Scan::check_non_pic): New function.
14732         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14733         (Target_x86_64::Scan::global): Likewise.
14734
14735         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14736         addend parameter.  Change caller.  Handle merge sections.
14737         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14738         Address to Addend.  Don't add in the result of
14739         local_section_offset, pass down the addend and use the returned
14740         value.
14741         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14742         Update declarations of local_section_offset and symbol_value.
14743         * testsuite/two_file_test_1.cc (t18): New function.
14744         * testsuite/two_file_test_2.cc (f18): New function.
14745         * testsuite/two_file_test_main.cc (main): Call t18.
14746         * testsuite/two_file_test.h (t18, f18): Declare.
14747
14748         * configure.ac: Don't test for objdump, c++filt, or readelf.
14749         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14750         conditionals.
14751         (TEST_READELF): New variable.
14752         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14753         (check_PROGRAMS): Add two_file_strip_test.
14754         (two_file_strip_test): New target.
14755         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14756         (two_file_same_shared_strip_test_SOURCES): New variable.
14757         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14758         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14759         (two_file_same_shared_strip_test_LDADD): New variable.
14760         (two_file_shared_strip.so): New target.
14761         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14762         (ver_test_5.syms, ver_test_7.syms): Likewise.
14763         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14764         (strip_test_3.stdout): Use TEST_OBJDUMP.
14765         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14766
14767 2008-04-04  Cary Coutant  <ccoutant@google.com>
14768
14769         * symtab.h (Symbol::is_weak_undefined): New function.
14770         (Symbol::is_strong_undefined): New function.
14771         (Symbol::is_absolute): New function.
14772         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14773         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14774         absolute symbols.
14775         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14776         (weak_undef_test): New target.
14777         * testsuite/Makefile.in: Rebuild.
14778         * testsuite/weak_undef_file1.cc: New file.
14779         * testsuite/weak_undef_file2.cc: New file.
14780         * testsuite/weak_undef_test.cc: New file.
14781
14782 2008-04-03  Craig Silverstein  <csilvers@google.com>
14783
14784         * compressed_output.h (class Output_compressed_section): Use
14785         unsigned buffer.
14786         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14787         add zlib header.
14788         (zlib_compressed_suffix): Removed.
14789         (Output_compressed_section::set_final_data_size): Use unsigned
14790         buffers.
14791         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14792         Fix linker invocation.
14793         (flagstest_o_specialfile_and_compress_debug_sections):
14794         Likewise.
14795         * testsuite/Makefile.in: Regenerated.
14796
14797 2008-04-02  David S. Miller  <davem@davemloft.net>
14798
14799         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14800         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14801
14802 2008-04-02  Craig Silverstein  <csilvers@google.com>
14803
14804         * TODO: New file.
14805
14806 2008-04-02  Ian Lance Taylor  <iant@google.com>
14807
14808         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14809         parameters.  Update for new key type to views_.  Change all
14810         callers.
14811         (File_read::read): Adjust for byteshift in returned view.
14812         (File_read::add_view): New function, broken out of
14813         find_and_make_view.
14814         (File_read::make_view): New function, broken out of
14815         find_and_make_view.
14816         (File_read::find_or_make_view): Add offset and aligned
14817         parameters.  Rewrite accordingly.  Change all callers.
14818         (File_read::get_view): Add offset and aligned parameters.  Adjust
14819         for byteshift in return value.
14820         (File_read::get_lasting_view): Likewise.
14821         * fileread.h (class File_read): Update declarations.
14822         (class File_read::View): Add byteshift_ field.  Add byteshift to
14823         constructor.  Add byteshift method.
14824         * archive.h (Archive::clear_uncached_views): New function.
14825         (Archive::get_view): Add aligned parameter.  Change all callers.
14826         * object.h (Object::get_view): Add aligned parameter.  Change all
14827         callers.
14828         (Object::get_lasting_view): Likewise.
14829
14830         * fileread.cc (File_read::release): Don't call clear_views if
14831         there are multiple objects.
14832         * fileread.h (File_read::clear_uncached_views): New function.
14833         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14834         on the archive.
14835
14836 2008-03-31  Cary Coutant  <ccoutant@google.com>
14837
14838         Add thin archive support.
14839         * archive.cc (Archive::armagt): New const.
14840         (Archive::setup): Remove task parameter and calls to unlock.
14841         (Archive::unlock_nested_archives): New function.
14842         (Archive::read_header): Add nested_off parameter. Change
14843         all callers.
14844         (Archive::interpret_header): Likewise.
14845         (Archive::include_all_members): Change to handle thin
14846         archives.
14847         (Archive::include_member): Likewise.
14848         * archive.h (Archive::Archive): Add new parameters and
14849         initializers.
14850         (Archive::armagt): New const.
14851         (Archive::setup): Remove task parameter.
14852         (Archive::unlock_nested_archives): New function.
14853         (Archive::read_header): Add nested_off parameter.
14854         (Archive::interpret_header): Likewise.
14855         (Archive::Nested_archive_table): New typedef.
14856         (Archive::is_thin_archive_): New field.
14857         (Archive::nested_archives_): New field.
14858         (Archive::options_): New field.
14859         (Archive::dirpath_): New field.
14860         (Archive::task_): New field.
14861         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14862         for thin archives.  Pass additional parameters to
14863         Archive::Archive.  Unlock the archive file after calling
14864         Archive::setup.
14865
14866 2008-03-29  Ian Lance Taylor  <iant@google.com>
14867
14868         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14869         version symbol to be local.
14870         * testsuite/ver_test_4.sh: New file.
14871         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14872         (check_DATA): Add ver_test_4.syms.
14873         (ver_test_4.syms): New target.
14874         * testsuite/Makefile.in: Rebuild.
14875
14876         * output.cc
14877         (Output_section::Input_section_sort_entry::has_priority): New
14878         function.
14879         (Output_section::Input_section_sort_entry::match_file_name): New
14880         function.
14881         (Output_section::Input_section_sort_entry::match_section_name):
14882         Remove.
14883         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14884         Remove.
14885         (Output_section::Input_section_sort_entry::match_section_file):
14886         Remove.
14887         (Output_section::Input_section_sort_compare::operator()): Rewrite
14888         using new Input_section_sort_entry functions.  Sort crtbegin and
14889         crtend first.  Sort sections with no priority before sections with
14890         a priority.
14891         * testsuite/initpri1.c (d3): Check j != 4.
14892         (cd5): New constructor/destructor function.
14893         (main): Check j != 2.
14894
14895         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14896         new symbol when resolving, don't call set_is_default.
14897         * testsuite/ver_test_7.cc: New file.
14898         * testsuite/ver_test_7.sh: New file.
14899         * testsuite/Makefile.am (ver_test_7.so): New target.
14900         (ver_test_7.o): New target.
14901         (check_SCRIPTS): Add ver_test_7.sh.
14902         (check_DATA): Add ver_test_7.syms.
14903         (ver_test_7.syms): New target.
14904
14905 2008-03-28  Ian Lance Taylor  <iant@google.com>
14906
14907         * layout.cc (Layout::layout): If we see an input section with a
14908         name that needs sorting, set the must_sort flag for the output
14909         section.
14910         (Layout::make_output_section): If the name of the output section
14911         indicates that it might require sorting, set the may_sort flag.
14912         * output.h (Output_section::may_sort_attached_input_sections): New
14913         function.
14914         (Output_section::set_may_sort_attached_input_sections): New
14915         function.
14916         (Output_section::must_sort_attached_input_sections): New
14917         function.
14918         (Output_section::set_must_sort_attached_input_sections): New
14919         function.
14920         (class Output_section): Declare Input_section_sort_entry.  Define
14921         Input_section_sort_compare.  Declare
14922         sort_attached_input_sections.  Add new fields:
14923         may_sort_attached_input_sections_,
14924         must_sort_attached_input_sections_,
14925         attached_input_sections_are_sorted_.
14926         * output.cc (Output_section::Output_section): Initialize new
14927         fields.
14928         (Output_section::add_input_section): Add an entry to
14929         input_sections_ if may_sort or must_sort are true.
14930         (Output_section::set_final_data_size): Call
14931         sort_attached_input_sections if necessary.
14932         (Output_section::Input_section_sort_entry): Define new class.
14933         (Output_section::Input_section_sort_compare::operator()): New
14934         function.
14935         (Output_section::sort_attached_input_sections): New function.
14936         * configure.ac: Check whether the compiler supports constructor
14937         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14938         * testsuite/initpri1.c: New file.
14939         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14940         CONSTRUCTOR_PRIORITY.
14941         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14942         (initpri1_LDFLAGS): New variable.
14943         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14944
14945 2008-03-27  Ian Lance Taylor  <iant@google.com>
14946
14947         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14948         * testsuite/common_test_1.c: New file.
14949         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14950         (common_test_1_SOURCES): New variable.
14951         (common_test_1_DEPENDENCIES): New variable.
14952         (common_test_1_LDFLAGS): New variable.
14953
14954         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14955         and commons_ correctly when NAME/VERSION does not override
14956         NAME/NULL.
14957         * testsuite/ver_test_6.c: New file.
14958         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14959         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14960         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14961
14962 2008-03-26  Ian Lance Taylor  <iant@google.com>
14963
14964         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14965         of an undefined symbol from a version script.
14966         * testsuite/Makefile.am (ver_test_5.so): New target.
14967         (ver_test_5.o): New target.
14968         (check_SCRIPTS): Add ver_test_5.sh.
14969         (check_DATA): Add ver_test_5.syms.
14970         (ver_test_5.syms): New target.
14971         * testsuite/ver_test_5.cc: New file.
14972         * testsuite/ver_test_5.script: New file.
14973         * testsuite/ver_test_5.sh: New file.
14974         * Makefile.in, testsuite/Makefile.in: Rebuild.
14975
14976         PR gold/5986
14977         Fix problems building gold with gcc 4.3.0.
14978         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14979         (gold_error_at_location, gold_warning_at_location): Use it.
14980         * configure.ac: Check whether we can compile and use a template
14981         function with a printf attribute.
14982         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14983         when jumping over bytes.
14984         * object.cc: Instantiate Object::read_section_data.
14985         * debug.h: Include <cstring>
14986         * dwarf_reader.cc: Include <algorithm>
14987         * main.cc: Include <cstring>.
14988         * options.cc: Include <cstring>.
14989         * output.cc: Include <cstring>.
14990         * script.cc: Include <cstring>.
14991         * script.h: Include <string>.
14992         * symtab.cc: Include <cstring> and <algorithm>.
14993         * target-select.cc: Include <cstring>.
14994         * version.cc: Include <string>.
14995         * testsuite/testmain.cc: Include <cstdlib>.
14996         * configure, config.in: Rebuild.
14997
14998 2008-03-25  Ian Lance Taylor  <iant@google.com>
14999
15000         * options.cc: Include "../bfd/bfdver.h".
15001         (options::help): Print bug reporting address.
15002
15003         * version.cc (print_version): Adjust output for current value of
15004         BFD_VERSION_STRING.
15005
15006         * NEWS: New file.
15007
15008         * options.cc (options::help): Print list of supported targets.
15009         * target-select.h: Include <vector>.
15010         (class Target_selector): Make machine_, size_, and is_big_endian_
15011         fields const.  Add bfd_name_ and instantiated_target_ fields.
15012         (Target_selector::Target_selector): Add bfd_name parameter.
15013         (Target_selector::recognize): Make non-virtual, call
15014         do_recognize.
15015         (Target_selector::recognize_by_name): Make non-virtual, call
15016         do_recognize_by_name.
15017         (Target_selector::supported_names): New function.
15018         (Target_selector::bfd_name): New function.
15019         (Target_selector::do_instantiate_target): New pure virtual
15020         function.
15021         (Target_selector::do_recognize): New virtual function.
15022         (Target_selector::do_recognize_by_name): New virtual function.
15023         (Target_selector::instantiate_target): New private function.
15024         (supported_target_names): Declare.
15025         * target-select.cc (Target_selector::Target_selector): Update for
15026         new parameter and fields.
15027         (select_target_by_name): Check that the name matches before
15028         calling recognize_by_name.
15029         (supported_target_names): New function.
15030         * i386.cc (class Target_selector_i386): Update Target_selector
15031         constructor call.  Remove recognize and recognize_by_name.  Add
15032         do_instantiate_target.
15033         * x86_64.cc (class Target_selector_x86_64): Likewise.
15034         * testsuite/testfile.cc (class Target_selector_test): Update for
15035         changes to Target_selector.
15036
15037         * README: Rewrite, with some notes on unsupported features.
15038
15039 2008-03-24  Cary Coutant  <ccoutant@google.com>
15040
15041         * i386.cc (Target_i386::Got_type): New enum declaration.
15042         (Target_i386::Scan::local): Updated callers of Output_data_got
15043         member functions.
15044         (Target_i386::Scan::global): Likewise.
15045         (Target_i386::Relocate::relocate): Likewise.
15046         (Target_i386::Relocate::relocate_tls): Likewise.
15047         * object.h (Got_offset_list): New class.
15048         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15049         (Sized_relobj::local_got_offset): Likewise.
15050         (Sized_relobj::set_local_got_offset): Likewise.
15051         (Sized_relobj::local_has_tls_got_offset): Removed.
15052         (Sized_relobj::local_tls_got_offset): Removed.
15053         (Sized_relobj::set_local_tls_got_offset): Removed.
15054         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15055         * output.cc (Output_data_got::add_global): Added got_type parameter.
15056         (Output_data_got::add_global_with_rel): Likewise.
15057         (Output_data_got::add_global_with_rela): Likewise.
15058         (Output_data_got::add_global_pair_with_rel): New function.
15059         (Output_data_got::add_global_pair_with_rela): New function.
15060         (Output_data_got::add_local): Added got_type parameter.
15061         (Output_data_got::add_local_with_rel): Likewise.
15062         (Output_data_got::add_local_with_rela): Likewise.
15063         (Output_data_got::add_local_pair_with_rel): New function.
15064         (Output_data_got::add_local_pair_with_rela): New function.
15065         (Output_data_got::add_global_tls): Removed.
15066         (Output_data_got::add_global_tls_with_rel): Removed.
15067         (Output_data_got::add_global_tls_with_rela): Removed.
15068         (Output_data_got::add_local_tls): Removed.
15069         (Output_data_got::add_local_tls_with_rel): Removed.
15070         (Output_data_got::add_local_tls_with_rela): Removed.
15071         * output.h (Output_data_got::add_global): Added got_type parameter.
15072         (Output_data_got::add_global_with_rel): Likewise.
15073         (Output_data_got::add_global_with_rela): Likewise.
15074         (Output_data_got::add_global_pair_with_rel): New function.
15075         (Output_data_got::add_global_pair_with_rela): New function.
15076         (Output_data_got::add_local): Added got_type parameter.
15077         (Output_data_got::add_local_with_rel): Likewise.
15078         (Output_data_got::add_local_with_rela): Likewise.
15079         (Output_data_got::add_local_pair_with_rel): New function.
15080         (Output_data_got::add_local_pair_with_rela): New function.
15081         (Output_data_got::add_global_tls): Removed.
15082         (Output_data_got::add_global_tls_with_rel): Removed.
15083         (Output_data_got::add_global_tls_with_rela): Removed.
15084         (Output_data_got::add_local_tls): Removed.
15085         (Output_data_got::add_local_tls_with_rel): Removed.
15086         (Output_data_got::add_local_tls_with_rela): Removed.
15087         * resolve.cc (Symbol::override_base_with_special): Removed
15088         reference to has_got_offset_ field.
15089         * symtab.cc (Symbol::init_fields): Replaced initialization
15090         of got_offset_ with got_offsets_.  Removed initialization
15091         of has_got_offset_
15092         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15093         (Symbol::got_offset): Likewise.
15094         (Symbol::set_got_offset): Likewise.
15095         (Symbol::has_tls_got_offset): Removed.
15096         (Symbol::tls_got_offset): Removed.
15097         (Symbol::set_tls_got_offset): Removed.
15098         (Symbol::got_offset_): Removed.
15099         (Symbol::tls_mod_got_offset_): Removed.
15100         (Symbol::tls_pair_got_offset_): Removed.
15101         (Symbol::got_offsets_): New field.
15102         (Symbol::has_got_offset): Removed.
15103         (Symbol::has_tls_mod_got_offset): Removed.
15104         (Symbol::has_tls_pair_got_offset): Removed.
15105         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15106         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15107         member functions.
15108         (Target_x86_64::Scan::global): Likewise.
15109         (Target_x86_64::Relocate::relocate): Likewise.
15110         (Target_x86_64::Relocate::relocate_tls): Likewise.
15111
15112 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15113
15114         * yyscript.y: Fix spelling error in comment.
15115
15116 2008-03-24  Ian Lance Taylor  <iant@google.com>
15117
15118         * options.h (class General_options): Define build_id option.
15119         * layout.h (class Layout): Declare write_build_id, create_note,
15120         create_build_id.  Add build_id_note_ member.
15121         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15122         "libiberty.h", "md5.h", "sha1.h".
15123         (Layout::Layout): Initialize eh_frame_data_,
15124         eh_frame_hdr_section_, and build_id_note_.
15125         (Layout::finalize): Call create_build_id.
15126         (Layout::create_note): New function, broken out of
15127         Layout::create_gold_note.
15128         (Layout::create_gold_note): Call create_note.
15129         (Layout::create_build_id): New function.
15130         (Layout::write_build_id): New function.
15131         (Close_task_runner::run): Call write_build_id.
15132
15133         * x86_64.cc: Correct license to GPLv3.
15134
15135 2008-03-23  Ian Lance Taylor  <iant@google.com>
15136
15137         * options.cc: Include "demangle.h".
15138         (parse_optional_string): New function.
15139         (parse_long_option): Handle takes_optional_argument.
15140         (parse_short_option): Update dash_z initializer.  Handle
15141         takes_optional_argument.
15142         (General_options::General_options): Initialize do_demangle_.
15143         (General_options::finalize): Set do_demangle_.  Handle demangling
15144         style.
15145         * options.h (parse_optional_string): Declare.
15146         (struct One_option): Add optional_arg field.  Update constructor.
15147         Update call constructor calls.  Add takes_optional_argument
15148         function.
15149         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15150         (DEFINE_optional_string): Define.
15151         (General_options::demangle): Change from DEFINE_bool to
15152         DEFINE_optional_string.
15153         (General_options::no_demangle): New function.
15154         (General_options::do_demangle): New function.
15155         (General_options::set_do_demangle): New function.
15156         (General_options::execstack_status_): Move definition to end of
15157         class definition.
15158         (General_options::static_): Likewise.
15159         (General_options::do_demangle_): New field.
15160         * object.cc (big_endian>::get_symbol_location_info): Call
15161         Options::do_demangle, not Options::demangle.
15162         * symtab.cc (demangle): Likewise.
15163
15164 2008-03-22  Ian Lance Taylor  <iant@google.com>
15165
15166         * gold.h: Include <cstddef> and <sys/types.h>
15167         * options.h: Include <cstring>.
15168
15169 2008-03-21  Ian Lance Taylor  <iant@google.com>
15170
15171         * Added source code to GNU binutils.
15172 \f
15173 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15174
15175 Copying and distribution of this file, with or without modification,
15176 are permitted in any medium without royalty provided the copyright
15177 notice and this notice are preserved.
15178
15179 Local Variables:
15180 mode: change-log
15181 left-margin: 8
15182 fill-column: 74
15183 version-control: never
15184 End: