gold/
[external/binutils.git] / gold / ChangeLog
1 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2
3         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
4         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
5         its only use.
6         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
7
8         * archive.h: Use struct rather than class for forward declaration
9         of Read_symbols_data.
10
11 2013-10-07  Cary Coutant  <ccoutant@google.com>
12
13         PR gold/16010
14         * testsuite/Makefile.am (icf_test): Fix dependencies.
15         (icf_safe_test): Likewise.
16         (icf_safe_so_test): Likewise.
17         (large_symbol_alignment): Add empty _LDADD rule.
18         * testsuite/Makefile.in: Regenerate.
19
20 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
21
22         PR gold/15927
23         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
24         relocation for R_X86_64_32 on x32.
25
26 2013-08-27  Roland McGrath  <mcgrathr@google.com>
27
28         * output.cc (Output_segment::set_section_addresses): Take new
29         Target* argument.  If target->isolate_execinstr() and the segment
30         is executable and starts at a target->abi_pagesize() boundary,
31         pad its end out to a target->abi_pagesize() boundary with code fill.
32         * output.h (Output_segment::set_section_addresses): Update decl.
33         * layout.h (Layout::check_output_data_for_reset_values): Take new
34         argument RELAX_OUTPUTS.
35         (Layout): New member relax_output_list_.
36         (Layout::add_relax_output): New method.
37         * layout.cc (Layout::Layout): Update constructor.
38         (Layout::reset_relax_output): New method.
39         (Layout::clean_up_after_relaxation): Call it.
40         (Layout::prepare_for_relaxation): Update caller.
41         (Layout::set_segment_offsets): Update callers of set_section_addresses.
42         Call reset_relax_output before re-processing segments for
43         isolate_execinstr case.
44         (Layout::write_data): Handle relax_output_list_.
45         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
46         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
47
48 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
49
50         PR binutils/15834
51         * object.h: Fix typos.
52
53 2013-08-16  Roland McGrath  <mcgrathr@google.com>
54
55         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
56         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
57
58 2013-08-07  Cary Coutant  <ccoutant@google.com>
59
60         Revert support for v2 DWP files:
61
62         2013-03-01  Cary Coutant  <ccoutant@google.com>
63
64             Add dwp support for v2 DWARF package file format.
65             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
66             tu_length parameter.  Adjust all callers.
67             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
68             * dwp.cc: Include dwarf.h.
69             (Section_bounds): New struct type.
70             (Unit_set): New struct type.
71             (Dwo_file::Dwo_file): Initialize new data member.
72             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
73             Combine and rename to...
74             (Dwo_file::read_unit_index): ...this.
75             (Dwo_file::sized_read_compunit_index)
76             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
77             (Dwo_file::sized_read_unit_index): ...this.
78             (Dwo_file::copy_section): Remove section_name, is_str_offsets
79             parameters; add section_id parameter.
80             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
81             (Dwo_file::add_unit_set): ...this.
82             (Dwo_file::shndx_map_): Remove.
83             (Dwo_file::sect_offsets_): New data member.
84             (Dwp_output_file::Dwp_output_file): Initialize new data members.
85             (Dwp_output_file::add_section): Rename to...
86             (Dwp_output_file::add_contribution): ...this.
87             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
88             (Dwp_output_file::add_tu_set): Likewise.
89             (Dwp_output_file::Contribution): New type.
90             (Dwp_output_file::Section::contributions): New data member.
91             (Dwp_output_file::Cu_or_tu_set): Remove.
92             (Dwp_output_file::Section::Section): New ctor.
93             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
94             (Dwp_output_file::Dwp_index::Section_table): New type.
95             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
96             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
97             parameter.
98             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
99             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
100             (Dwp_output_file::Dwp_index::section_table): New member function.
101             (Dwp_output_file::Dwp_index::section_table_end): New member function.
102             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
103             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
104             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
105             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
106             (Dwp_output_file::Dwp_index::section_table_): New data member.
107             (Dwp_output_file::Dwp_index::section_mask_): New data member.
108             (Dwp_output_file::add_output_section): New member function.
109             (Dwp_output_file::write_new_section): New member function.
110             (Dwp_output_file::write_contributions): New member function.
111             (Dwp_output_file::section_id_map_): New data member.
112             (class Dwo_id_info_reader): Remove.
113             (class Unit_reader): New class.
114             (get_dwarf_section_name): New function.
115             (Dwo_file::read_executable): Adjust initializations of class data.
116             (Dwo_file::read): Add support for v2 package file format.
117             (Dwo_file::read_unit_index): Likewise.
118             (Dwo_file::sized_read_unit_index): Likewise.
119             (Dwo_file::copy_section): Likewise.
120             (Dwo_file::add_unit_set): Likewise.
121             (Dwp_output_file::add_output_section): Likewise.
122             (Dwp_output_file::add_contribution): Likewise.
123             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
124             for empty slot.
125             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
126             file format.
127             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
128             slot.
129             (Dwp_output_file::initialize): Remove unused function.
130             (Dwp_output_file::finalize): Add support for v2 package file format.
131             (Dwp_output_file::write_index): Likewise.
132             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
133             function prototype.
134
135 2013-07-31  Cary Coutant  <ccoutant@google.com>
136
137         * object.cc (Sized_relobj::do_output_section_address): New function.
138         (Sized_relobj): Instantiate explicitly.
139         * object.h (Object::output_section_address): New function.
140         (Object::do_output_section_address): New function.
141         (Sized_relobj::do_output_section_address): New function.
142         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
143
144 2013-07-30  Cary Coutant  <ccoutant@google.com>
145             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
146
147         * parameters.cc (Parameters::entry): Return target-specific entry
148         symbol name.
149         * target.h (Target::entry_symbol_name): New function.
150         (Target_info::entry_symbol_name): New data member.
151
152         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
153         * i386.cc (Target_i386::i386_info): Likewise.
154         (Target_i386_nacl::i386_nacl_info): Likewise.
155         * sparc.cc (Target_sparc::sparc_info): Likewise.
156         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
157         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
158         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
159         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
160
161 2013-07-22  Sterling Augustine  <saugustine@google.com>
162
163         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
164         Convert parameter shndx to local variable. Add parameters symtab
165         and symtab_size.  Scan over section names.  Find relocation
166         section corresponding to current section.  Create and initialize
167         reloc_mapper_ and reloc_type_.
168         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
169         unit_length to off_t.  Initialize member unit_length_.  Fill in field
170         cu_offset_.
171         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
172         Initialize new fields unit_length_ and cu_offset_.
173         (Dwarf_pubnames_table::read_section): Update prototype.
174         (Dwarf_pubnames_table::cu_offset): New member function.
175         (Dwarf_pubnames_table::subsection_size): Likewise.
176         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
177         New fields.
178         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
179         member functions public.
180         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
181         Update comment.  Rework logic.  Move repeated parts to...
182         (Gdb_index_info_reader::read_pubtable): ...here. New function.
183         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
184         pubtypes_table_, and stmt_list_offset.
185         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
186         Gdb_index::find_pubtype_offset,
187         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
188         (Gdb_index::pubnames_read): Update prototype and rework logic.
189         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
190         Forward declare.
191         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
192         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
193         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
194         Gdb_index::map_pubtable_to_dies):
195         Declare functions.
196         (Gdb_index::pubnames_read): Update declaration.
197         (Gdb_index::Pubname_offset_map): New type.
198         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
199         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
200         Gdb_index::stmt_list_offset): Declare.
201         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
202         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
203         Gdb_index::pubtypes_offset_): Remove.
204
205 2013-07-19  Roland McGrath  <mcgrathr@google.com>
206
207         * options.h (General_options): Add -Trodata-segment option.
208         * parameters.cc (Parameters::check_rodata_segment): New function.
209         (Parameters::set_target_once): Call it.
210         * parameters.h (Parameters): Declare it (private member function).
211         * layout.cc (load_seg_unusable_for_headers): New function, broken
212         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
213         then validate rodata segment rather than text segment.
214         (relaxation_loop_body): Call that.
215         (is_text_segment): New function.  Don't admit a non-executable
216         segment if TARGET->isolate_execinstr().
217         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
218
219 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
220
221         PR gold/15070
222         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
223         * nacl.h (Sniff_file::View::View): Request aligned view.
224
225 2013-07-11  Cary Coutant  <ccoutant@google.com>
226
227         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
228         correct BRLT entry size.
229
230 2013-07-03  Alan Modra  <amodra@gmail.com>
231
232         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
233         comment.
234
235 2013-07-01  Cary Coutant  <ccoutant@google.com>
236
237         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
238         reloc_type_.
239         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
240         (Dwarf_ranges_table::lookup_reloc): New function.
241         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
242         reloc_type_.
243         (Dwarf_ranges_table::lookup_reloc): New function.
244         (Dwarf_ranges_table::reloc_type_): New data member.
245
246 2013-06-27  Jing Yu  <jingyu@google.com>
247
248         PR gold/15662
249         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
250         function.
251         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
252         (Target_powerpc::do_relax): Call the above.
253
254 2013-06-27  Cary Coutant  <ccoutant@google.com>
255
256         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
257         on garbage collected .opd section.
258
259 2013-06-27  Alan Modra  <amodra@gmail.com>
260
261         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
262         is non-zero.
263         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
264         (Target_powerpc::do_function_location): Likewise for loc->shndx.
265
266 2013-06-14  Cary Coutant  <ccoutant@google.com>
267
268         * resolve.cc (Symbol::override_base): Don't override st_type
269         from plugin placeholder symbols.
270         (Symbol_table::resolve): Likewise.
271         (Symbol_table::should_override): Don't complain about TLS mismatch
272         if the TO symbol is a plugin placeholder.
273         * testsuite/Makefile.am (plugin_test_tls): New test.
274         * testsuite/Makefile.in: Regenerate.
275         * testsuite/plugin_test_tls.sh: New test script.
276         * testsuite/two_file_test_2_tls.cc: New test source.
277         * testsuite/two_file_test_tls.cc: New test source.
278
279 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
280
281         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
282         the maximum segment alignment is larger than the page size.
283         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
284         correctly aligns the symbols with large alignemnt.
285         * testsuite/Makefile.in: Regenerate.
286         * testsuite/large_symbol_alignment.cc: New file.
287
288 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
289             Sriraman Tallam  <tmsriram@google.com>
290
291         * options.h (sort_section): New option.
292         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
293         Rename from Input_section_sort_section_name_special_ordering_compare.
294         (Input_section_sort_section_name_compare): New struct.
295         * output.cc (Output_section::Input_section_sort_section_name_compare::
296         operator()): New function.
297         (Output_section::sort_attached_input_sections): Use new sort function
298         for .text if --sort-section=name is specified.
299         * layout.cc (Layout::make_output_section):
300         Add sorting by name when --sort-section=name is specified.
301         * testsuite/Makefile.am (text_section_grouping): Test option
302         --sort-section=name.
303         * testsuite/Makefile.in: Regenerate.
304         * testsuite/section_sorting_name.cc: New file.
305         * testsuite/section_sorting_name.sh: New file.
306
307 2013-05-21  Cary Coutant  <ccoutant@google.com>
308
309         * symtab.h (Symbol::is_cxx_vtable): New function.
310         * target-reloc.h (relocate_section): Check for vtable symbol.
311         * testsuite/Makefile.am (missing_key_func.sh): New test case.
312         * testsuite/Makefile.in: Regenerate.
313         * testsuite/missing_key_func.cc: New test source.
314         * testsuite/missing_key_func.sh: New test script.
315
316 2013-05-21  Cary Coutant  <ccoutant@google.com>
317
318         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
319         type of enclosing symbol.
320         (Relocate_info::location): Check symbol type when describing symbol.
321         * object.h (Symbol_location_info): Remove unused line_number;
322         add enclosing_symbol_type.
323         * testsuite/debug_msg.sh: Adjust expected output.
324
325 2013-05-13  Cary Coutant  <ccoutant@google.com>
326
327         * configure.ac: Export DEFAULT_TARGET.
328         * configure: Regenerate.
329         * Makefile.in: Regenerate.
330         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
331         * testsuite/Makefile.in: Regenerate.
332         * testsuite/debug_msg.sh: Delete duplicate tests.
333         Don't check undef_int error message match for powerpc where the
334         source file and line number aren't available.
335
336 2013-05-10  Roland McGrath  <mcgrathr@google.com>
337
338         * options.h (General_options): Add --rosegment-gap option.
339         * options.cc (finalize): --rosegment-gap implies --rosegment.
340         * layout.cc (set_segment_offsets): Let user option override
341         target->rosegment_gap().
342
343 2013-05-10  Roland McGrath  <mcgrathr@google.com>
344
345         * options.h (General_options): Remove leading space from help
346         messages for -nostdlib and --rosegment.
347
348 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
349
350         PR ld/15365
351         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
352
353 2013-05-03  Alan Modra  <amodra@gmail.com>
354
355         * merge.cc (Output_merge_string::do_add_input_section): Correct
356         scan for number of strings.  Rename vars to avoid shadowing.
357         Include missing terminator in input_size_.
358
359 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
360
361         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
362         Restore empty string handling.
363
364 2013-05-01  Cary Coutant  <ccoutant@google.com>
365
366         * stringpool.cc (Stringpool_template::new_key_offset): Fix
367         uninitialized warning.
368
369 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
370
371         * output.cc (Output_section::add_merge_input_section): Allow
372         to merge sections if the alignment is more than character size.
373         * merge.h (Output_merge_string::Output_merge_string): Remove
374         assert.
375         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
376         only not-null strings. Check the alignment of strings.
377         * stringpool.h
378         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
379         alignment as the argument.
380         (Stringpool_template<Stringpool_char>::addralign_): New class member.
381         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
382         Align non-zero length strings according to the addralign_.
383         (Stringpool_template<Stringpool_char>::set_string_offsets):
384         Updating offsets according to the given alignment.
385         * testsuite/Makefile.am (text_section_grouping): Test if string
386         literals are getting merged.
387         * testsuite/Makefile.in: Regenerate.
388         * testsuite/merge_string_literals_1.c: New file.
389         * testsuite/merge_string_literals_2.c: Ditto.
390         * testsuite/merge_string_literals.sh: Ditto.
391
392 2013-04-26  Ian Lance Taylor  <iant@google.com>
393
394         * target-reloc.h (relocate_section): If the reloc offset is out of
395         range, pass VIEW as NULL to relocate.relocate.
396         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
397         * i386.cc (Target_i386::Relocate::relocate): Likewise.
398         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
399         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
400         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
401         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
402
403 2013-04-26  Geoff Pike  <gpike@chromium.org>
404
405         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
406         * layout.cc (Hash_task): New class.
407         (Layout::queue_build_id_tasks): New function.
408         (Layout::write_build_id): Handle single-thread portion of build ID
409         computation.  (In some cases, all of it is single-threaded.)  Replace
410         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
411         functionality in fewer lines of code.
412         * layout.h (Layout::queue_build_id_tasks): New function declaration.
413         * options.h (General_options): make "--build-id" default to tree
414         rather than sha1.  Add two new options related to --build-id=tree:
415         --build-id-chunk-size-for-treehash and
416         --build-id-min-file-size-for-treehash.
417         * Makefile.am: add testing of --build-id=tree and related new options
418         (these tests will be invoked by "make check").
419         * Makefile.in: Regenerate.
420
421 2013-04-25  Alan Modra  <amodra@gmail.com>
422
423         * configure.tgt: Add powerpcle and powerpc64le.
424
425 2013-04-22  Alan Modra  <amodra@gmail.com>
426
427         PR gold/15355
428         * layout.cc (Layout::segment_precedes): Allow more than one
429         segment with the same type and flags.
430
431 2013-04-15  Cary Coutant  <ccoutant@google.com>
432
433         * layout.cc (Layout::set_relocatable_section_offsets): Don't
434         allocate space in file for BSS sections.
435
436 2013-04-15  Cary Coutant  <ccoutant@google.com>
437
438         * script-sections.cc (Orphan_output_section): Reset address
439         to zero after each orphaned section for relocatable links.
440
441 2013-04-15  Cary Coutant  <ccoutant@google.com>
442
443         * symtab.cc (Symbol_table::sized_write_globals): Subtract
444         section starting address for relocatable link.
445         * testsuite/Makefile.am (script_test_11): New test.
446         * testsuite/Makefile.in: Regenerate.
447         * testsuite/script_test_11.c: New source file.
448         * testsuite/script_test_11.t: New linker script.
449
450 2013-04-13  Alan Modra  <amodra@gmail.com>
451
452         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
453         owner when sections are not adjacent and exceed group size.
454         (Target_powerpc::group_sections): Handle corner case.
455         (Target_powerpc::Branch_info::make_stub): Handle case where
456         stub table doesn't exist due to branches in non-exec sections.
457         (Target_powerpc::Relocate::relocate): Likewise.
458
459 2013-04-11  Alan Modra  <amodra@gmail.com>
460
461         PR gold/15354
462         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
463         .branch_lt to match bfd ld.  Adjust comments throughout file.
464
465 2013-04-04  Ian Lance Taylor  <iant@google.com>
466
467         GCC PR c++/56840
468         * object.cc (do_layout_deferred_sections): Handle .eh_frame
469         sections before checking whether they are included in the link.
470
471 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
472
473         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
474         object before calling the plugin claim_file handler.  Pass the elf
475         object of the archive to the plugin. Delete the elf object if the
476         plugin claims the file.
477
478 2013-03-21  Alan Modra  <amodra@gmail.com>
479
480         * layout.cc (Layout::set_segment_offsets): Accept writable .text
481         segment when omagic.
482
483 2013-03-21  Alan Modra  <amodra@gmail.com>
484
485         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
486         comparison warning.
487         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
488         uninitialized" warning.
489
490 2013-03-20  Alan Modra  <amodra@gmail.com>
491
492         * symtab.h (Symbol::clear_version): New function.
493         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
494         is_needed by weak references.  Clear version for symbols defined
495         in as-needed objects that are not needed.
496
497 2013-03-15  Alan Modra  <amodra@gmail.com>
498
499         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
500         static and public.  Add report_err param.  Return false for data refs.
501         (Target_powerpc::rela_dyn_section): New overloaded function.
502         (Target_powerpc::plt_, iplt_): Elucidate.
503         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
504         (Output_data_plt_powerpc::do_write): Don't write .iplt.
505         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
506         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
507         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
508         push_branch and make_plt_entry for ifunc syms when
509         reloc_needs_plt_for_ifunc.
510         (Target_powerpc::Relocate::relocate): Don't use plt entry value
511         for ifunc unless reloc_needs_plt_for_ifunc.
512
513 2013-03-15  Alan Modra  <amodra@gmail.com>
514
515         * gc.h (gc_process_relocs): Don't look through function descriptors.
516         * icf.cc (get_section_contents): Do so here instead.
517
518 2013-03-13  Alan Modra  <amodra@gmail.com>
519
520         * powerpc.cc (is_branch_reloc): Forward declare.
521         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
522         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
523         false for 64-bit, true for 32-bit non-branch relocs.
524         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
525         * testsuite/Makefile.am (icf_test): Use linker map file instead of
526         nm output.
527         (icf_safe_test): Generate linker map file as well as nm output.
528         (icf_safe_so_test): Likewise.
529         * testsuite/Makefile.in: Regenerate.
530         * testsuite/icf_test.sh: Parse linker map file to determine
531         section folding.
532         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
533         * testsuite/icf_safe_so_test.sh: Likewise.
534         (X86_32_or_ARM_specific_safe_fold): Merge into..
535         (arch_specific_safe_fold): ..this.
536         (X86_64_specific_safe_fold): Delete unused function.
537
538 2013-03-12  Alan Modra  <amodra@gmail.com>
539
540         * gc.h (gc_process_relocs): Look through function descriptors
541         to determine shndx, symvalue and addend used by ICF.  Tidy
542         variable duplication.
543
544 2013-03-11  Alan Modra  <amodra@gmail.com>
545
546         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
547         * layout.cc (Layout_task_runner::run): ..to here.
548         * symtab.h (struct Symbol_location): Extract from..
549         (class Symbol_table): ..here.
550         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
551         * target.h (class Target): Add function_location and
552         do_function_location functions.
553         (class Sized_target): Add do_function_location.
554         * object.h (class Sized_relobj_file): Move find_shdr..
555         (class Object): ..to here.
556         * object.cc: Likewise.  Update to suit.  Instantiate.
557         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
558         * powerpc.cc (class Powerpc_dynobj): New.
559         (Target_powerpc::do_function_location): New function.
560         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
561         (Powerpc_dynobj::do_read_symbols): New function.
562         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
563
564 2013-03-08  Ian Lance Taylor  <iant@google.com>
565
566         * options.cc (General_options::string_to_object_format): Accept
567         "default".
568
569 2013-03-08  Alan Modra  <amodra@gmail.com>
570
571         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
572         pointer to Post_fde.
573         (struct Post_fde): Move definition to here..
574         * ehframe.cc (struct Post_fde): ..from here.
575         (Cie::write): Don't alloc Post_fde.
576         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
577
578 2013-03-07  Alan Modra  <amodra@gmail.com>
579
580         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
581         relocation referencing .LC0.
582         * testsuite/discard_locals_test.sh: Remove FIXMEs.
583
584 2013-03-07  Alan Modra  <amodra@gmail.com>
585
586         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
587         always_inline.  Add assembly for powerpc to avoid GOT.
588
589 2013-03-07  Alan Modra  <amodra@gmail.com>
590
591         * testsuite/script_test_10.sh: Don't test .bss section
592         header number.
593
594 2013-03-06  Alan Modra  <amodra@gmail.com>
595
596         * powerpc.cc (class Powerpc_relobj): Move some member functions.
597         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
598         all callers.  Handle folded sections.
599         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
600         to Powerpc_relobj.
601         (Global_symbol_visitor_opd::operator()): Likewise.
602
603 2013-03-04  Alan Modra  <amodra@gmail.com>
604
605         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
606         * testsuite/Makefile.in: Regenerate.
607
608 2013-03-01  Cary Coutant  <ccoutant@google.com>
609
610         Add dwp support for v2 DWARF package file format.
611         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
612         tu_length parameter.  Adjust all callers.
613         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
614         * dwp.cc: Include dwarf.h.
615         (Section_bounds): New struct type.
616         (Unit_set): New struct type.
617         (Dwo_file::Dwo_file): Initialize new data member.
618         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
619         Combine and rename to...
620         (Dwo_file::read_unit_index): ...this.
621         (Dwo_file::sized_read_compunit_index)
622         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
623         (Dwo_file::sized_read_unit_index): ...this.
624         (Dwo_file::copy_section): Remove section_name, is_str_offsets
625         parameters; add section_id parameter.
626         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
627         (Dwo_file::add_unit_set): ...this.
628         (Dwo_file::shndx_map_): Remove.
629         (Dwo_file::sect_offsets_): New data member.
630         (Dwp_output_file::Dwp_output_file): Initialize new data members.
631         (Dwp_output_file::add_section): Rename to...
632         (Dwp_output_file::add_contribution): ...this.
633         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
634         (Dwp_output_file::add_tu_set): Likewise.
635         (Dwp_output_file::Contribution): New type.
636         (Dwp_output_file::Section::contributions): New data member.
637         (Dwp_output_file::Cu_or_tu_set): Remove.
638         (Dwp_output_file::Section::Section): New ctor.
639         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
640         (Dwp_output_file::Dwp_index::Section_table): New type.
641         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
642         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
643         parameter.
644         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
645         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
646         (Dwp_output_file::Dwp_index::section_table): New member function.
647         (Dwp_output_file::Dwp_index::section_table_end): New member function.
648         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
649         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
650         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
651         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
652         (Dwp_output_file::Dwp_index::section_table_): New data member.
653         (Dwp_output_file::Dwp_index::section_mask_): New data member.
654         (Dwp_output_file::add_output_section): New member function.
655         (Dwp_output_file::write_new_section): New member function.
656         (Dwp_output_file::write_contributions): New member function.
657         (Dwp_output_file::section_id_map_): New data member.
658         (class Dwo_id_info_reader): Remove.
659         (class Unit_reader): New class.
660         (get_dwarf_section_name): New function.
661         (Dwo_file::read_executable): Adjust initializations of class data.
662         (Dwo_file::read): Add support for v2 package file format.
663         (Dwo_file::read_unit_index): Likewise.
664         (Dwo_file::sized_read_unit_index): Likewise.
665         (Dwo_file::copy_section): Likewise.
666         (Dwo_file::add_unit_set): Likewise.
667         (Dwp_output_file::add_output_section): Likewise.
668         (Dwp_output_file::add_contribution): Likewise.
669         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
670         for empty slot.
671         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
672         file format.
673         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
674         slot.
675         (Dwp_output_file::initialize): Remove unused function.
676         (Dwp_output_file::finalize): Add support for v2 package file format.
677         (Dwp_output_file::write_index): Likewise.
678         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
679         function prototype.
680
681 2013-03-01  Cary Coutant  <ccoutant@google.com>
682
683         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
684         function into class definition in header file.
685         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
686         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
687         New function.
688         (Dwarf_info_reader::check_buffer): Move here from .cc file.
689
690 2013-02-28  Alan Modra  <amodra@gmail.com>
691
692         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
693         * target.cc (Target::do_plt_fde_location): New function.
694         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
695         accessor function, and constructor param.
696         (struct Post_fde, Post_fdes): Declare.
697         (Cie::write): Add post_fdes param.
698         * ehframe.cc (Fde::write): Use plt_fde_location.
699         (struct Post_fde): Define.
700         (Cie::write): Stash FDEs added post merge mapping.
701         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
702         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
703         (Eh_frame::do_sized_write): Arrange to write post map FDES after
704         other FDEs.
705         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
706         (Target_powerpc::has_glink): New function.
707         (Target_powerpc::do_relax): Add eh_frame info for stubs.
708         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
709         glink_eh_frame_fde_32, default_fde): New data.
710         (Stub_table::eh_frame_added_): New var.
711         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
712         Make const.
713         (Stub_table::add_eh_frame): New function.
714         (Output_data_glink::add_eh_frame): New function.
715         (Target_powerpc::make_glink_section): Call add_eh_frame.
716
717 2013-02-15  Ian Lance Taylor  <iant@google.com>
718
719         * options.h (DEFINE_uint64_alias): Define.
720         (class General_options): Add -Ttext-segment as an alias for
721         -Ttext.
722
723 2013-02-15  Alan Modra  <amodra@gmail.com>
724
725         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
726         (Stub_table::do_write): ..here, two places.
727         (Stub_table::plt_call_size): Use it here too.
728
729 2013-02-11  Ian Lance Taylor  <iant@google.com>
730
731         * descriptors.cc (Descriptors::close_all): New function.
732         * descriptors.h (class Descriptors): Declare close_all.
733         (close_all_descriptors): New inline function.
734         * plugin.cc: Include "descriptors.h".
735         (Plugin_manager::cleanup): Call close_all_descriptors.
736
737 2013-02-06  Alan Modra  <amodra@gmail.com>
738
739         * README: Update coding style link.
740
741 2013-01-28  Cary Coutant  <ccoutant@google.com>
742
743         * dwp.cc (File_list): New typedef.
744         (Dwo_name_info_reader): New class.
745         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
746         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
747         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
748         (Dwo_file::read_executable): New function.
749         (Dwo_file::read): Move common setup code to ...
750         (Dwo_file::make_object): ... here.
751         (dwp_options): Add --exec/-e.
752         (usage): Likewise.
753         (main): Likewise.
754
755 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
756
757         * layout.cc (Layout::layout): Check for option text_reorder.
758         (Layout::make_output_section): Ditto.
759         * options.h (text_reorder): New option.
760         * output.cc (Input_section_sort_compare): Remove special ordering
761         of section names.
762         (Output_section::
763          Input_section_sort_section_name_special_ordering_compare::
764          operator()): New function.
765         (Output_section::sort_attached_input_sections): Use new sort function
766         for .text.
767         * output.h (Input_section_sort_section_name_special_ordering_compare):
768         New struct.
769         * testsuite/Makefile.am (text_section_grouping): Test option
770         --no-text-reorder
771         * testsuite/Makefile.in: Regenerate.
772         * testsuite/text_section_grouping.sh: Check order of functions without
773         default text reordering.
774
775 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
776
777         * options.h (General_options): Change default to true for new_dtags.
778
779 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
780
781         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
782         when enable_new_dtags is false.  Only add DT_RUNPATH when
783         enable_new_dtags is true.
784
785 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
786
787         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
788         used in declaration and definition consistent.
789         (Target_powerpc::symval_for_branch): Ditto.
790
791 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
792
793         * testsuite/plugin_final_layout.cc: Fix comment.
794
795 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
796
797         * layout.cc (Layout::layout): Do not do default sorting for
798         text sections when section ordering is specified.
799         (make_output_section): Ditto.
800         * testsuite/plugin_final_layout.cc: Name the function sections
801         to catch reordering issues.
802
803 2013-01-15  Alan Modra  <amodra@gmail.com>
804
805         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
806         plt-thread-safe.
807
808 2013-01-15  Alan Modra  <amodra@gmail.com>
809
810         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
811         * testsuite/Makefile.in: Regenerate.
812
813 2013-01-14  Alan Modra  <amodra@gmail.com>
814
815         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
816         * testsuite/Makefile.in: Regenerate.
817
818 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
819
820         PR bfd/14430
821         Fix mingw gold build with plugins enabled
822         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
823         * configure.ac: Export DLOPEN_LIBS and add headers check.
824         * plugin.cc: Handle non-dlfcn case.
825         * Makefile.in: Regenerate.
826         * config.in: Regenerate.
827         * configure: Regenerate.
828         * testsuite/Makefile.in: Regenerate.
829
830 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
831
832         * output.h (sort_attached_input_sections): Change to be public.
833         * script-sections.cc
834         (Output_section_definition::set_section_addresses): Sort
835         attached input sections according to section order before linker
836         script assigns section addresses.
837         (Orphan_output_section::set_section_addresses): Sort
838         attached input sections according to section order before linker
839         script assigns section addresses.
840         * Makefile.am (final_layout.sh): Use a simple linker script to
841         check if section ordering still works.
842         * Makefile.in: Regenerate.
843
844 2013-01-09  Ben Cheng  <bccheng@google.com>
845
846         * arm.cc (Target_arm::attributes_accept_div): New function.
847         (Target_arm::attributes_forbid_div): New function.
848         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
849         attribute using the same new functions as what bfd/elf32_arm.c
850         does.
851
852 2013-01-07  Cary Coutant  <ccoutant@google.com>
853
854         PR gold/14993
855         * output.cc (Output_section::add_input_section): For incremental
856         updates, don't track input sections that are allocated from patch
857         space.
858
859 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
860             Ian Lance Taylor  <iant@google.com>
861
862         PR gold/14897
863         * configure.ac (--enable-ld): Removed.
864         (install_as_default): Set to yes only for --enable-gold=default
865         or --disable-ld.
866         * configure: Regenerated.
867
868 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
869
870         * options.h (General_options): Add -fuse-ld= for GCC linker
871         option compatibility.
872
873 2013-01-04  Cary Coutant  <ccoutant@google.com>
874
875         * configure.ac: Fix typo restoring CXXFLAGS.
876         * configure: Regenerate.
877
878 2013-01-04  Cary Coutant  <ccoutant@google.com>
879
880         * testsuite/Makefile.am (CXXLINK_S): New macro.
881         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
882         * testsuite/Makefile.in: Regenerate.
883
884 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
885
886         * version.cc (print_version): Update copyright year to 2013.
887
888 2012-12-20  Ian Lance Taylor  <iant@google.com>
889
890         * layout.cc (Layout::special_ordering_of_input_section): New
891         function.
892         (Layout::layout): If input section requires special ordering, must
893         sort input sections.
894         (Layout::make_output_section): May sort .text input sections.
895         (Layout::is_section_name_prefix_grouped): Remove.
896         * layout.h (class Layout): Declare
897         special_ordering_of_input_section.  Don't declare
898         is_section_name_prefix_grouped.
899         * output.cc (Output_section::add_input_section): Revert last
900         change.
901         (Output_section::Input_section_sort::match_file_name): Don't crash
902         if called on output section data.
903         (Output_section::Input_section_sort_compare): Sort based on
904         special ordering.
905         (Output_section::Input_section_sort_section_order_index_compare):
906         Revert last patch.
907         (Output_section::sort_attached_input_sections): Likewise.
908
909 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
910
911         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
912         * layout.h (Layout::is_section_name_prefix_grouped): New function.
913         * output.cc (Output_section::add_input_section): Check if section
914         name contains special prefix.  Keep input sections to sort such
915         sections.
916         (Output_section::Input_section_sort_section_order_index_compare
917          ::operator()): Group sections according to prefixes.
918         (Output_section::sort_attached_input_sections): Add condition to
919         Input_section_entry constructor call.
920         * testsuite/Makefile.am (text_section_grouping): New test.
921         * testsuite/Makefile.in: Regenerate.
922         * testsuite/text_section_grouping.cc: New file.
923         * testsuite/text_section_grouping.sh: New file.
924
925 2012-12-17  Nick Clifton  <nickc@redhat.com>
926
927         * Makefile.am: Add copyright notice.
928         * NEWS: Likewise.
929         * README: Likewise.
930         * configure.ac: Likewise.
931         * ftruncate.c: Likewise.
932         * Makefile.in: Regenerate.
933
934 2012-12-14  Cary Coutant  <ccoutant@google.com>
935
936         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
937         --no-as-needed flag.
938         (exception_separate_shared_12_test): Likewise.
939         (incremental_copy_test): Likewise.
940         * testsuite/Makefile.in: Regenerate.
941
942 2012-12-14  Cary Coutant  <ccoutant@google.com>
943
944         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
945         (Dwp_output_file::Dwp_index::enter_set): Add assert.
946
947 2012-12-12  Alan Modra  <amodra@gmail.com>
948
949         * powerpc.cc (class Track_tls): New.
950         (class Relocate, class Scan): Inherit Track_tls.
951         (Target_powerpc::Scan::local, global): Track tls optimization
952         and avoid creating plt entry for __tls_get_addr if all uses
953         are optimized away.
954         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
955
956 2012-12-12  Alan Modra  <amodra@gmail.com>
957
958         * options.h (General_options): Add --toc-sort/--no-toc-sort.
959         Replace no_toc_optimize with toc_optimize.
960         * output.h (Output_section::input_sections): Provide non-const variant.
961         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
962         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
963         accessors.
964         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
965         (class Sort_toc_sections): New.
966         (Target_powerpc::do_finalize_sections): Sort toc sections.
967         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
968
969 2012-12-10  Roland McGrath  <mcgrathr@google.com>
970
971         * testsuite/binary_unittest.cc (read_all): New function.
972         (Sized_binary_test): Use it instead of ::read.
973         * fileread.cc (do_read): Don't assume pread always reads the whole
974         amount in a single call.
975
976 2012-12-10  Alan Modra  <amodra@gmail.com>
977
978         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
979         Set EM_PPC64 or EM_PPC here.
980         (Target_selector_powerpc::do_recognize): Delete.
981
982 2012-12-10  Alan Modra  <amodra@gmail.com>
983
984         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
985         stub_table_.
986         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
987
988 2012-12-07  Roland McGrath  <mcgrathr@google.com>
989
990         * testsuite/binary_unittest.cc (Sized_binary_test):
991         Use open_descriptor rather than ::open.
992
993 2012-12-07  Alan Modra  <amodra@gmail.com>
994
995         * powerpc.cc (Stub_table::do_write): Delete redundant Address
996         typedef and invalid_address constant.
997         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
998         instantiate constants.
999
1000 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1001
1002         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1003         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1004         * aclocal.m4: Regenerate.
1005         * configure: Regenerate.
1006         * Makefile.in: Regenerate.
1007         * testsuite/Makefile.in: Regenerate.
1008
1009 2012-12-07  Alan Modra  <amodra@gmail.com>
1010
1011         * options.h (General_options): Add no_toc_optimize.
1012         * powerpc.cc (ok_lo_toc_insn): New function.
1013         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1014
1015 2012-12-06  Alan Modra  <amodra@gmail.com>
1016
1017         * options.h (General_options): Add plt_align, plt_static_chain,
1018         plt_thread_safe.  Update stub_group_size help text.
1019         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1020         for new plt_thread_safe_ var.
1021         (use_plt_offset): Correct comments.
1022         (Target_powerpc::do_relax): Look for thread creation symbols to
1023         determine default plt_thread_safe value.  Clear plt call stubs
1024         as well as branch stubs each iteration.
1025         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1026         insn constants.
1027         (l, hi, ha, write_insn): Move earlier.
1028         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1029         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1030         plt stubs too.
1031         (Stub_table::update_size): Adjust.
1032         (Stub_table::prev_size, set_prev_size): Delete.
1033         (Stub_table::stub_align): Let --plt-align affect result.
1034         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1035         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1036         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1037         (Stub_table::do_write): Support more stub variants.
1038
1039 2012-12-04  Alan Modra  <amodra@gmail.com>
1040
1041         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1042         (Target_powerpc::do_define_standard_symbols): New function.
1043
1044 2012-12-03  Alan Modra  <amodra@gmail.com>
1045
1046         * output.h: Formatting, whitespace.
1047
1048 2012-12-03  Alan Modra  <amodra@gmail.com>
1049
1050         * layout.h (Layout::get_executable_sections): Declare.
1051         * layout.cc (Layout::get_executable_sections): New function.
1052         * arm.cc (Target_arm::group_sections): Use it.
1053         (Arm_output_section::group_sections): Delete now redundant test.
1054         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1055         param to handle relative relocs.
1056         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1057         (Output_data_reloc::add_absolute): Adjust.
1058         (Output_data_reloc::add_relative): New function.
1059         (Output_data::reset_data_size): New function.
1060         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1061         (Output_section::set_addralign): New function.
1062         (Output_section::checkpoint_set_addralign): New function.
1063         (Output_section::clear_section_offsets_need_adjustment): New function.
1064         (Output_section::input_sections): Make public.
1065         * powerpc.cc (class Output_data_brlt_powerpc): New.
1066         (class Stub_table, class Stub_control): New.
1067         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1068         stub_table_, set_stub_table, stub_table): New vectors and accessor
1069         functions.
1070         (Target_powerpc::do_may_relax, do_relax, push_branch,
1071         new_stub_table, stub_tables, brlt_section, group_sections,
1072         add_branch_lookup_table, find_branch_lookup_table,
1073         write_branch_lookup_table, make_brlt_section): New functions.
1074         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1075         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1076         branch_info_): New vars.
1077         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1078         make call stubs here.
1079         (Output_data_glink): Remove all call stub handling from this class.
1080         (Target_powerpc::Scan::local, global): Save interesting branch
1081         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1082         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1083         functions on final link.
1084         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1085         Handle long branch destinations too.
1086         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1087         do_plt_address_for_local): Adjust lookup of plt call stubs.
1088
1089 2012-11-30  Alan Modra  <amodra@gmail.com>
1090
1091         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1092         relocs against protected symbols when building 32-bit shared libs.
1093
1094 2012-11-30  Alan Modra  <amodra@gmail.com>
1095
1096         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1097         param.  Call got_section() to make .got.  Update all callers
1098         and their callers and so on.
1099
1100 2012-11-30  Alan Modra  <amodra@gmail.com>
1101
1102         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1103         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1104         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1105         value if it already exists.
1106
1107 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1108
1109         PR gold/14858
1110         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1111
1112 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1113
1114         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1115         than bfc instruction for data sandboxing.
1116
1117 2012-11-08  Alan Modra  <amodra@gmail.com>
1118
1119         * po/POTFILES.in: Regenerate.
1120
1121 2012-11-05  Alan Modra  <amodra@gmail.com>
1122
1123         * configure.ac: Apply 2012-09-10 change to config.in here.
1124         * configure: Regenerate.
1125
1126 2012-11-05  Alan Modra  <amodra@gmail.com>
1127
1128         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1129         (struct Opd_ent): Use "Address" rather than "Offset".
1130         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1131         (Target_powerpc::got_section): Make public.
1132         (Target_powerpc::scan_relocs): Move code setting symbols..
1133         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1134         Create _SDA_BASE_ only when referenced.
1135
1136 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1137
1138         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1139         from last change.
1140
1141 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1142
1143         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1144         for offset_in_output_section parameter.
1145         (Sized_target::relocate_special_relocatable): Likewise.
1146         * arm.cc (Target_arm::relocate_relocs): Likewise.
1147         (Target_arm::relocate_special_relocatable): Likewise.
1148         * i386.cc (Target_i386::relocate_relocs): Likewise.
1149         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1150         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1151         * target-reloc.h (relocate_relocs): Likewise.
1152         * testsuite/testfile.cc (Target_test): Likewise.
1153         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1154         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1155
1156         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1157         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1158
1159         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1160         parameter, which is unused in the [!F_SETFD] case.
1161
1162         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1163         SYMNDX to off_t before comparing it to this->data_size().
1164         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1165         * incremental.cc (Output_section_incremental_inputs::do_write):
1166         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1167
1168         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1169
1170 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1171
1172         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1173         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1174         in EABI_VER5.
1175
1176 2012-10-29  Cary Coutant  <ccoutant@google.com>
1177
1178         * dwp.cc (usage): Add file and exit status parameters;
1179         add --help and --version options.
1180         (print_version): New function.
1181         (main): Add --help and --version options.
1182
1183 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1184
1185         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1186         final_layout_sequence.txt.
1187         * testsuite/Makefile.in: Regenerated.
1188
1189 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1190
1191         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1192         COMPILE generated by automake.
1193         (LINK1): Likewise.
1194         (CXXCOMPILE1): Likewise.
1195         (CXXLINK1): Likewise.
1196         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1197         (LINK): Likewise.
1198         (CXXCOMPILE): Likewise.
1199         (CXXLINK): Likewise.
1200         * testsuite/Makefile.in: Regenerated.
1201
1202 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1203
1204         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1205         on bad fwrite return.
1206
1207 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1208
1209         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1210         on val.
1211
1212 2012-10-23  Cary Coutant  <ccoutant@google.com>
1213
1214         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1215         * testsuite/Makefile.in: Regenerate.
1216         * testsuite/dwp_test.h: New source file.
1217         * testsuite/dwp_test_1.cc: New source file.
1218         * testsuite/dwp_test_1.s: New source file.
1219         * testsuite/dwp_test_1.sh: New source file.
1220         * testsuite/dwp_test_1b.cc: New source file.
1221         * testsuite/dwp_test_1b.s: New source file.
1222         * testsuite/dwp_test_2.cc: New source file.
1223         * testsuite/dwp_test_2.s: New source file.
1224         * testsuite/dwp_test_2.sh: New source file.
1225         * testsuite/dwp_test_main.cc: New source file.
1226         * testsuite/dwp_test_main.s: New source file.
1227
1228 2012-10-23  Cary Coutant  <ccoutant@google.com>
1229
1230         * dwp.h: New header file.
1231         * dwp.cc: New source file.
1232         * gold.h: Move shared declarations to system.h.
1233         * system.h: New header file.
1234         * Makefile.am: Add dwp.
1235         * Makefile.in: Regenerate.
1236
1237 2012-10-23  Cary Coutant  <ccoutant@google.com>
1238
1239         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1240         Dwarf_info_reader::read_from_pointer.
1241         (Dwarf_pubnames_table::read_header): Likewise.
1242         (Dwarf_pubnames_table::next_name): Likewise.
1243         (Dwarf_die::read_attributes): Likewise.
1244         (Dwarf_die::skip_attributes): Likewise.
1245         (Dwarf_info_reader::read_from_pointer): New function template.
1246         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1247         (Dwarf_pubnames_table): Likewise.
1248         (Dwarf_info_reader::read_from_pointer): New function template.
1249         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1250         Dwarf_pubnames_table ctor.
1251
1252 2012-10-23  Cary Coutant  <ccoutant@google.com>
1253
1254         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1255         abbrev_shndx.
1256         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1257         abbrev_shndx_.
1258         (Dwarf_info_reader::set_abbrev_shndx): New method.
1259         (Dwarf_info_reader::abbrev_shndx_): New data member.
1260
1261 2012-10-23  Cary Coutant  <ccoutant@google.com>
1262
1263         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1264         from object, not parameters.
1265         (Dwarf_info_reader::parse): Likewise.
1266         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1267         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1268         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1269         methods.
1270
1271 2012-10-23  Cary Coutant  <ccoutant@google.com>
1272
1273         * fileread.cc (Input_file::Input_file): New constructor.
1274         * fileread.h (class Input_file): Add new constructor.
1275
1276 2012-10-18  Alan Modra  <amodra@gmail.com>
1277
1278         PR gold/14727
1279         * object.cc (Relobj::is_section_name_included): Also match
1280         .sdata personality section.
1281
1282 2012-10-18  Alan Modra  <amodra@gmail.com>
1283
1284         * target-reloc.h (class Default_comdat_behavior): New, package up..
1285         (get_comdat_behaviour): ..this.
1286         (relocate_section): Add Relocate_comdat_behavior template arg,
1287         adjust code to suit.
1288         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1289         (Target_arm::scan_reloc_section): Likewise.
1290         * i386.cc (Target_i386::relocate_section): Likewise.
1291         * sparc.cc (Target_sparc::relocate_section): Likewise.
1292         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1293         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1294         * powerpc.cc (class Relocate_comdat_behavior): New.
1295         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1296         gold::relocate_section with new template arg.
1297
1298 2012-10-18  Alan Modra  <amodra@gmail.com>
1299
1300         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1301         dynamic relocs for GOT_TPREL got entries, without symbol if
1302         resolving locally.
1303         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1304         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1305         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1306
1307 2012-10-17  Alan Modra  <amodra@gmail.com>
1308
1309         PR gold/14726
1310         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1311
1312 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1313
1314         * layout.cc (Layout::include_section): Keep sections marked
1315         SHF_EXCLUDE when doing relocatable links.
1316
1317 2012-10-16  Alan Modra  <amodra@gmail.com>
1318
1319         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1320         (Target_powerpc::do_finalize_sections): Call it.
1321         (Output_data_save_res): New class and supporting functions.
1322         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1323         normal symbols defined in object files.
1324
1325 2012-10-12  Alan Modra  <amodra@gmail.com>
1326
1327         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1328         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1329         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1330         section if scan_opd_relocs not yet called.
1331         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1332
1333 2012-10-12  Alan Modra  <amodra@gmail.com>
1334
1335         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1336         add_local_ifunc_entry): Revert last change.
1337         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1338
1339 2012-10-05  Alan Modra  <amodra@gmail.com>
1340
1341         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1342         do_plt_address_for_global): New functions.
1343         (Output_data_got_powerpc::do_write): Don't segfault when linking
1344         statically.
1345         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1346         add_local_ifunc_entry): Return true on adding entry..
1347         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1348         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1349         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1350         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1351         set up symbols here.
1352         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1353         syms here.  Do so even when no .iplt.  Don't segfault when linking
1354         statically.
1355         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1356         new variants without reloc param.
1357         (Glink_sym_ent::Glink_sym_ent): Likewise.
1358         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1359         reloc when refs will resolve to plt call stub.
1360         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1361         R_PPC_PLTREL24 to resolve locally.
1362         (Target_powerpc::Scan::global): Correct ifunc handling.
1363         (Target_powerpc::Relocate::relocate): Correct local sym glink
1364         lookup.  Don't destroy "value" when we have a plt call stub,
1365         and when checking plt call validity.
1366         (Target_powerpc::do_dynsym_value): Simplify.
1367
1368 2012-10-05  Alan Modra  <amodra@gmail.com>
1369
1370         * i386.cc (Output_data_plt_i386::address_for_global,
1371         address_for_local): Add plt offset to returned value.  Adjust uses.
1372         * sparc.cc (Output_data_plt_sparc::address_for_global,
1373         address_for_local): Likewise.
1374         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1375         address_for_local): Likewise.
1376         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1377         address_for_local): Likewise.
1378         * target.h (Target::plt_address_for_global, plt_address_for_local):
1379         Update comment.
1380         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1381         (Output_data_got::Got_entry::write): Nor here.
1382         * output.h: Comment fix.
1383
1384 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1385
1386         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1387         global_offset_table_ value for larget got.
1388         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1389
1390 2012-09-29  Alan Modra  <amodra@gmail.com>
1391
1392         * powerpc.cc (Target_powerpc::iplt_): New output section.
1393         (Target_powerpc::iplt_section, make_iplt_section,
1394         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1395         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1396         Target_powerpc::plt_entry_count): Count iplt entries too.
1397         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1398         reloc section in constructor.  New params.
1399         (Target_powerpc::make_plt_section): Create reloc section here instead.
1400         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1401         functions.
1402         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1403         (Output_data_glink::add_entry, find_entry): New functions to
1404         deal with local syms.
1405         (Glink_sym_ent): Add support for local syms.
1406         (Output_data_glink::do_write): Handle ifunc plt entries.
1407         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1408         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1409         (Target_powerpc::Relocate::relocate): Likewise.
1410         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1411
1412 2012-09-25  Alan Modra  <amodra@gmail.com>
1413
1414         * object.h (Sized_relobj_file::adjust_local_symbol,
1415         do_adjust_local_symbol): New functions.
1416         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1417         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1418         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1419         and irregular opd entry spacing.
1420         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1421         (Global_symbol_visitor_opd): New functor.
1422         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1423         on deleted opd entries.
1424
1425 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1426
1427         * tilegx.cc: New file.
1428         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1429         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1430         * configure.tgt: Add entries for tilegx*.
1431         * configure.ac: Likewise.
1432         * Makefile.in: Rebuild.
1433         * configure: Likewise.
1434         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1435         tilegx.
1436
1437 2012-09-13  Alan Modra  <amodra@gmail.com>
1438
1439         * target-reloc.h (scan_relocs): Call scan.local for relocs
1440         against symbols in discarded sections.  Pass is_discarded
1441         param.
1442         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1443         Add is_discarded param.
1444         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1445         is_discarded to flag opd entry as discarded.  Don't emit dyn
1446         relocs on such entries.
1447         (Target_powerpc::Scan::global): Similarly detect and handle
1448         such opd entries.
1449         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1450         opd_ent_.  Update all uses.
1451         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1452         (Target_powerpc::relocate_section): Zero out discarded opd
1453         entry relocs.
1454
1455 2012-09-12  Ian Lance Taylor  <iant@google.com>
1456
1457         PR gold/14570
1458         * output.cc: Rename Output_data_got template parameter from size
1459         to got_size for all functions.  Compile all variants of
1460         Output_data_got.
1461         (Output_data_got::Got_entry::write): Correct use of size for
1462         symbol value.  Use local_is_tls rather than casting to
1463         Sized_relobj_file.
1464         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1465         (class Sized_relobj_file): Add do_local_is_tls.
1466         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1467
1468 2012-09-11  Alan Modra  <amodra@gmail.com>
1469
1470         PR gold/14566
1471         * layout.cc (Layout::set_segment_offsets): When using
1472         common-page-size alignment, ensure we are on a new max-page-size
1473         page.
1474         * output.cc (Output_segment::set_section_addresses): Use
1475         abi_pagesize, not common_pagesize for relro boundary.
1476         (Output_segment::set_offset): Likewise.
1477
1478 2012-09-11  Alan Modra  <amodra@gmail.com>
1479
1480         * output.h (Output_data_got::add_global_tls, add_local_tls,
1481         add_local_tls_pair): New functions.
1482         (Output_data_got::add_local_pair_with_rel): Remove second
1483         reloc param.  Expand comment.
1484         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1485         use_plt_or_tls_offset_, similarly for constructor param.
1486         (Output_data_got::Got_entry::write): Add got_index param.
1487         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1488         add_local_tls_pair): New functions.
1489         (Output_data_got::Got_entry::write): Handle tls symbols
1490         with use_plt_or_tls_offset_ set specially.
1491         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1492         (Output_data_got::do_write): Replace iterator with index, pass
1493         index to entry write function.
1494         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1495         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1496         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1497         call.
1498         * i386.cc (Target_i386::Scan::local): Likewise.
1499         * sparc.cc (Target_sparc::Scan::local): Likewise.
1500         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1501         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1502         do_tls_offset_for_global): New functions.
1503         (Target_powerpc::Scan::local): Correct TLS relocations and got
1504         entry values.
1505         (Target_powerpc::Scan::global): Don't emit unnecessary
1506         dynamic relocations on TLS GOT entries.
1507
1508 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1509
1510         * config.in: Disable sanity check for kfreebsd.
1511
1512 2012-09-10  Sterling Augustine  <saugustine@google.com>
1513
1514         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1515         (Gdb_index::pubtypes_read): New parameter.
1516         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1517         to calls.
1518         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1519         pubtypes_object_.
1520
1521 2012-09-09  Alan Modra  <amodra@gmail.com>
1522
1523         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1524         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1525         * gc.h (gc_process_relocs): Call target gc_add_reference.
1526         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1527         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1528         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1529         unnecessary cast.
1530         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1531         to cater for when we don't need code offset.  Update use.
1532         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1533         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1534         set_opd_valid): New functions.
1535         (Target_powerpc::do_gc_add_reference): New function.
1536         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1537         stashed refs.
1538         (Target_powerpc::do_gc_mark_symbol): New function.
1539
1540 2012-09-06  Cary Coutant  <ccoutant@google.com>
1541
1542         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1543         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1544         (Dwarf_die::skip_attributes): Likewise.
1545         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1546         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1547         (main): Call it.
1548         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1549
1550 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1551
1552         * testsuite/script_test_3.t: Add .got.plt output section
1553         statement.
1554         * testsuite/script_test_4.t: Likewise.
1555
1556 2012-09-05  Alan Modra  <amodra@gmail.com>
1557
1558         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1559         update all uses and lose "enum" when using type.
1560
1561 2012-09-05  Alan Modra  <amodra@gmail.com>
1562
1563         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1564         * configure: Regenerate.
1565         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1566         (plugin_final_layout.stdout): Likewise.
1567         (memory_test): Set page sizes to 0x1000.
1568         * testsuite/Makefile.in: Regenerate.
1569         * testsuite/discard_locals_test.sh: Add FIXME comment.
1570         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1571         * testsuite/pr14265.t: Add .got output section statement.
1572         * testsuite/script_test_2.t: Likewise.
1573         * testsuite/script_test_3.t: Likewise.
1574         * testsuite/script_test_4.t: Likewise.
1575         * testsuite/script_test_5.t: Likewise.
1576         * testsuite/script_test_6.t: Likewise.
1577         * testsuite/script_test_7.t: Likewise.
1578         * testsuite/script_test_9.t: Likewise.
1579
1580 2012-09-05  Alan Modra  <amodra@gmail.com>
1581
1582         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1583         (Powerpc_relocate_functions::Status): New typedef.
1584         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1585         (Target_powerpc::Scan::local): Handle REL64.
1586         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1587         for REL32 and REL64.
1588         (Target_powerpc::symval_for_branch): New function, extracted from..
1589         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1590         checks.  Report overflow errors.
1591
1592 2012-09-05  Alan Modra  <amodra@gmail.com>
1593
1594         * object.h (Sized_relobj_file::emit_relocs): Delete.
1595         (Sized_relobj_file::emit_relocs_reltype): Delete.
1596         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1597         relocate_relocs for --emit-relocs.
1598         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1599         * output.h: Update comment.
1600         (Output_segment::first_section): New function.
1601         (Output_segment::first_section_load_address): Use first_section.
1602         * output.cc (Output_segment::first_section): New function extracted..
1603         (Output_segment::first_section_load_address): ..from here.  Delete.
1604         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1605         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1606         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1607         adjust call to target.h function.
1608         * i386.cc (Target_i386): Likewise.
1609         * sparc.cc (Target_sparc): Likewise.
1610         * x86_64.cc (Target_x86_64): Likewise.
1611         * powerpc.cc (Target_powerpc): Likewise.
1612         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1613         first tls section has section symbol for optimised local dynamic
1614         output relocs.
1615         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1616         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1617         optimised tls code.
1618         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1619         Rename to relocate_relocs.  Update error message.
1620
1621 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1622
1623         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1624         --just-symbols.
1625
1626 2012-08-31  Alan Modra  <amodra@gmail.com>
1627
1628         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1629         (Powerpc_relobj::toc_base_offset): New stub function.
1630         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1631         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1632         (Target_powerpc::Relocate::enum skip_tls): New.
1633         (Target_powerpc::call_tls_get_addr_): New var.
1634         (Target_powerpc::is_branch_reloc): Move to file scope.
1635         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1636         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1637         New functions.
1638         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1639         (powerpc_info): Correct common_pagesize for ppc64.
1640         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1641         (Powerpc_relocate_functions): Add overflow check enums and functions.
1642         Add non-shift version of rela, rela_ua.  Delete all rel public
1643         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1644         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1645         addr16_ha3, addr14 functions.
1646         (Output_data_got_powerpc::add_constant_pair): New function.
1647         (Output_data_got_powerpc::got_base_offset): Likewise.
1648         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1649         (instruction constants): Sort, add some more.
1650         (Output_data_glink::do_write): Add and use Address typedef.  Use
1651         object->toc_base_offset() stub for 64-bit.
1652         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1653         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1654         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1655         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1656         Always treat .opd relocs as against locally defined symbol.
1657         Correct condition for RELATIVE relocs.
1658         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1659         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1660         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1661         calculations.  Handle TLS relocs, and more.  Add overflow
1662         checking and adjust for Powerpc_relocate_functions changes.
1663         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1664         Reinstate --emit-relocs code with FIXME.
1665
1666 2012-08-30  Alan Modra  <amodra@gmail.com>
1667
1668         * layout.cc (Layout::set_segment_offsets): Set p_align to
1669         abi_pagesize, not common_pagesize.
1670         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1671         to determine whether file header can go in segment.
1672
1673 2012-08-30  Alan Modra  <amodra@gmail.com>
1674
1675         * output.h (Output_reloc::Output_reloc <output section>): Add
1676         is_relative param.  Adjust calls.
1677         (Output_reloc::add_output_section_relative): New functions.
1678         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1679         is_relative.
1680         (Output_reloc::symbol_value): Handle SECTION_CODE.
1681
1682 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1683
1684         * gold.cc (queue_middle_tasks): Call layout again when unique
1685         segments for sections is desired.
1686         * layout.cc (Layout::Layout): Initialize new members.
1687         (Layout::get_output_section_flags): New function.
1688         (Layout::choose_output_section): Call get_output_section_flags.
1689         (Layout::layout): Make output section for mapping to a unique segment.
1690         (Layout::insert_section_segment_map): New function.
1691         (Layout::attach_allocated_section_to_segment): Make unique segment for
1692         output sections marked so.
1693         (Layout::segment_precedes): Check for unique segments when sorting.
1694         * layout.h (Layout::Unique_segment_info): New struct.
1695         (Layout::Section_segment_map): New typedef.
1696         (Layout::insert_section_segment_map): New function.
1697         (Layout::get_output_section_flags): New function.
1698         (Layout::is_unique_segment_for_sections_specified): New function.
1699         (Layout::set_unique_segment_for_sections_specified): New function.
1700         (Layout::unique_segment_for_sections_specified_): New member.
1701         (Layout::section_segment_map_): New member.
1702         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1703         Rename is_gc_pass_one to is_pass_one.
1704         Rename is_gc_pass_two to is_pass_two.
1705         Rename is_gc_or_icf to is_two_pass.
1706         Check for which pass based on whether symbols data is present.
1707         Make it two pass when unique segments for sections is desired.
1708         * output.cc (Output_section::Output_section): Initialize new
1709         members.
1710         * output.h (Output_section::is_unique_segment): New function.
1711         (Output_section::set_is_unique_segment): New function.
1712         (Output_section::is_unique_segment_): New member.
1713         (Output_section::extra_segment_flags): New function.
1714         (Output_section::set_extra_segment_flags): New function.
1715         (Output_section::extra_segment_flags_): New member.
1716         (Output_section::segment_alignment): New function.
1717         (Output_section::set_segment_alignment): New function.
1718         (Output_section::segment_alignment_): New member.
1719         (Output_segment::Output_segment): Initialize is_unique_segment_.
1720         (Output_segment::is_unique_segment): New function.
1721         (Output_segment::set_is_unique_segment): New function.
1722         (Output_segment::is_unique_segment_): New member.
1723         * plugin.cc (allow_unique_segment_for_sections): New function.
1724         (unique_segment_for_sections): New function.
1725         (Plugin::load): Add new functions to transfer vector.
1726         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1727         * Makefile.in: Regenerate.
1728         * testsuite/plugin_final_layout.sh: Check if unique segment
1729         functionality works.
1730         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1731         are available.
1732         (allow_unique_segment_for_sections): New global.
1733         (unique_segment_for_sections): New global.
1734         (claim_file_hook): Call allow_unique_segment_for_sections.
1735         (all_symbols_read_hook): Call unique_segment_for_sections.
1736
1737 2012-08-22  Cary Coutant  <ccoutant@google.com>
1738
1739         * layout.cc (Layout::include_section): Don't assert on GROUP
1740         sections with --emit-relocs.
1741
1742 2012-08-21  Cary Coutant  <ccoutant@google.com>
1743
1744         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1745         if --export-dynamic-symbol names an undef symbol.
1746
1747 2012-08-18  Alan Modra  <amodra@gmail.com>
1748
1749         * powerpc.cc: Formatting and white space.
1750         (Powerpc_relobj): Rename got2_section_ to special_.
1751         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1752         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1753         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1754         (Target_powerpc): Add Address typedef and invalid_address.  Use
1755         throughout.
1756         (Target_powerpc::is_branch_reloc): New function.
1757         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1758         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1759         for dst_mask, value and addend.
1760         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1761         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1762         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1763         uint16_t for 24-bit offset.  Use get_output_section_offset and
1764         check return.
1765         (Target_powerpc::Scan::local): Handle more relocs.
1766         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1767         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1768         Plug in toc restoring insn after plt calls.  Translate branches
1769         to function descriptor symbols to corresponding entry point.
1770         (Target_powerpc::relocate_for_relocatable): Check return from
1771         get_output_section_offset.
1772         * symtab.h: Comment typo.
1773
1774 2012-08-14  Ian Lance Taylor  <iant@google.com>
1775
1776         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1777         unsupported_relocal_local to call unsupported_reloc_global.
1778
1779 2012-08-14  Nick Clifton  <nickc@redhat.com>
1780
1781         PR ld/14265
1782         * script-sections.cc (Sections_element::output_section_name): Add
1783         keep return parameter.
1784         (Output_section_element::match_name): Add keep return parameter.
1785         Return the value of the keep_ member.
1786         * script-sections.h (class Output_section): Update
1787         output_section_name prototype.
1788         * layout.cc (Layout::keep_input_section): New public member
1789         function.
1790         (Layout::choose_output_section): Pass keep parameter to
1791         output_section_name.
1792         * layout.h (class Layout): Add keep_input_section.
1793         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1794         sections.
1795         * testsuite/Makefile.am: Add a test.
1796         * testsuite/Makefile.in: Regenerate.
1797         * testsuite/pr14265.c: Source file for the test.
1798         * testsuite/pr14265.t: Linker script for the test.
1799         * testsuite/pr14265.sh: Shell script for the test.
1800
1801 2012-08-14  Alan Modra  <amodra@gmail.com>
1802
1803         * target.h (Target::output_section_name): New function.
1804         (Target::do_output_section_name): New function.
1805         * layout.cc (Layout::choose_output_section): Call the above.
1806         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1807
1808 2012-08-14  Alan Modra  <amodra@gmail.com>
1809
1810         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1811         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1812         for replace_constant call.
1813         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1814         (Output_data_glink::do_print_to_mapfile): New function.
1815         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1816         (Target_powerpc::Relocate::relocate): Likewise.
1817
1818 2012-08-14  Alan Modra  <amodra@gmail.com>
1819
1820         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1821         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1822         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1823         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1824         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1825         here.
1826         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1827         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1828         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1829         here.
1830         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1831         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1832
1833 2012-08-12  Alan Modra  <amodra@gmail.com>
1834
1835         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1836         (glink insn constants): Use uint32_t.
1837         (Output_data_glink::add_entry): Use insert, not [] operator.
1838
1839 2012-08-11  Alan Modra  <amodra@gmail.com>
1840
1841         * object.h (Sized_relobj_file::find_shdr): New function.
1842         (Sized_relobj_file::find_special_sections): New function.
1843         * object.cc (Sized_relobj_file::find_shdr): New function.
1844         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1845         (Sized_relobj_file::find_special_sections): New function, split out..
1846         (Sized_relobj_file::do_read_symbols): ..from here.
1847         * output.h (Output_data_got::replace_constant): New function.
1848         (Output_data_got::num_entries): New function.
1849         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1850         (Output_data_got::got_offset): Protected rather than private.
1851         (Output_data_got::replace_got_entry): New function.
1852         * output.cc (Output_data_got::replace_got_entry): New function.
1853         * powerpc.cc (class Powerpc_relobj): New.
1854         (class Powerpc_relocate_functions): Delete all psymval variants or
1855         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1856         Implement _ha functions using corresponding _hi function.
1857         (Powerpc_relobj::find_special_sections): New function.
1858         (Target_powerpc::do_make_elf_object): New function.
1859         (class Output_data_got_powerpc): New.
1860         (class Output_data_glink): New.
1861         (class Powerpc_scan_relocatable_reloc): New.
1862         Many more changes througout file.
1863
1864 2012-08-09  Nick Clifton  <nickc@redhat.com>
1865
1866         * po/vi.po: Updated Vietnamese translation.
1867
1868 2012-08-07  Ian Lance Taylor  <iant@google.com>
1869
1870         * layout.cc (Layout::add_target_dynamic_tags): If
1871         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1872         plt_rel.
1873
1874 2012-07-30  Nick Clifton  <nickc@redhat.com>
1875
1876         * po/gold.pot: Updated template.
1877         * po/es.po: Updated Spanish translation.
1878
1879 2012-07-18  Cary Coutant  <ccoutant@google.com>
1880
1881         PR gold/14344
1882         * configure.ac: Add check for -gpubnames support.
1883         * configure: Regenerate.
1884         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1885         support; force -gno-pubnames.
1886         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1887         support.
1888         (gdb_index_test_4): New test.
1889         * testsuite/Makefile.in: Regenerate.
1890         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1891         * testsuite/gdb_index_test_2.sh: Likewise.
1892         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1893         * testsuite/gdb_index_test_4.sh: New script.
1894         * testsuite/gdb_index_test_comm.sh: New script with common code;
1895         don't look for space after colon.
1896
1897 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1898
1899         * gold.cc (queue_middle_tasks): Update function order only after
1900         deferred objects due to plugins are processed.
1901
1902 2012-07-11  Ian Lance Taylor  <iant@google.com>
1903
1904         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1905         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1906         (Target_arm::scan_reloc_for_stub): Likewise.
1907         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1908         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1909         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1910         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1911         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1912
1913 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1914             Ian Lance Taylor  <iant@google.com>
1915
1916         PR gold/14309
1917         * configure.ac: Test whether std::tr1::hash<off_t> works.
1918         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1919         needed.
1920         * output.h (class Output_fill): Add virtual destructor.
1921         * configure, config.in: Rebuild.
1922
1923 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1924
1925         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1926
1927 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1928
1929         * plugin.cc (Plugin::load): Handle position independent executables.
1930
1931 2012-06-06  Cary Coutant  <ccoutant@google.com>
1932
1933         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1934         add .debug_macro.
1935         (lines_only_debug_sections): Likewise.
1936         (gdb_fast_lookup_sections): New static array.
1937         (is_gdb_debug_section): Rename formal parameter.
1938         (is_lines_only_debug_section): Likewise.
1939         (is_gdb_fast_lookup_section): New function.
1940         (Layout::include_section): Check for ".zdebug_" prefix; pass
1941         section name suffix to is_gdb_debug_section, et al.; check for
1942         fast-lookup sections when building .gdb_index.
1943         * options.h (--strip-debug-gdb): Update GDB version number.
1944
1945 2012-06-06  Cary Coutant  <ccoutant@google.com>
1946
1947         * configure.ac: Add check for fallocate.
1948         * configure: Regenerate.
1949         * config.in: Regenerate.
1950
1951         * options.h (class General_options): Add --mmap-output-file and
1952         --posix-fallocate options.
1953         * output.cc: (posix_fallocate): Remove; replace with...
1954         (gold_fallocate): New function.
1955         (Output_file::map_no_anonymous): Call gold_fallocate.
1956         (Output_file::map): Check --mmap-output-file option.
1957
1958 2012-06-05  Jing Yu  <jingyu@google.com>
1959
1960         * gold.h (textdomain): Add do {} to empty while(0).
1961         (bindtextdomain): Likewise.
1962
1963 2012-06-04  Cary Coutant  <ccoutant@google.com>
1964
1965         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1966         has_dynsym_index.
1967
1968 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1969
1970         * symtab.cc (Symbol_table::define_special_symbol):
1971         Initialize *poldsym to prevent uninitialized variable errors.
1972
1973 2012-05-23  Cary Coutant  <ccoutant@google.com>
1974
1975         * layout.cc (Layout::section_name_mapping): Add rules to handle
1976         exact match on .data.rel.ro.local or .data.rel.ro.
1977         (Layout::output_section_name): Check for exact matches.
1978
1979 2012-05-23  Cary Coutant  <ccoutant@google.com>
1980
1981         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1982         more carefully.
1983
1984 2012-05-22  Cary Coutant  <ccoutant@google.com>
1985
1986         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1987         object before exporting symbol.
1988
1989 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1990
1991         * testsuite/tls_test.cc: Include "config.h" first.
1992         * testsuite/tls_test_c.c: Likewise.
1993
1994 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1995             Nick Clifton  <nickc@redhat.com>
1996
1997         PR 14072
1998         * configure.in: Add check that sysdep.h has been included before
1999         any system header files.
2000         * configure: Regenerate.
2001         * config.in: Regenerate.
2002
2003 2012-05-14  Cary Coutant  <ccoutant@google.com>
2004
2005         * layout.cc (Layout::make_output_section): Mark .tdata section
2006         as RELRO.
2007         * testsuite/relro_test.cc: Add a TLS variable.
2008
2009 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2010
2011         PR gold/14091
2012         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2013         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2014         R_X86_64_64.
2015
2016 2012-05-08  Cary Coutant  <ccoutant@google.com>
2017
2018         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2019         (lines_only_debug_sections): Likewise.
2020
2021 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2022
2023         * nacl.cc: New file.
2024         * nacl.h: New file.
2025         * Makefile.am (CCFILES, HFILES): Add them.
2026         * Makefile.in: Regenerate.
2027         * i386.cc (Output_data_plt_i386_nacl): New class.
2028         (Output_data_plt_i386_nacl_exec): New class.
2029         (Output_data_plt_i386_nacl_dyn): New class.
2030         (Target_i386_nacl): New class.
2031         (Target_selector_i386_nacl): New class.
2032         (target_selector_i386): Use it instead of Target_selector_i386.
2033         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2034         (Target_x86_64_nacl): New class.
2035         (Target_selector_x86_64_nacl): New class.
2036         (target_selector_x86_64, target_selector_x32): Use it instead of
2037         Target_selector_x86_64.
2038         * arm.cc (Output_data_plt_arm_nacl): New class.
2039         (Target_arm_nacl): New class.
2040         (Target_selector_arm_nacl): New class.
2041         (target_selector_arm, target_selector_armbe): Use it instead of
2042         Target_selector_arm.
2043
2044         * target-select.cc (select_target): Take new Input_file* and off_t
2045         arguments, pass them on to recognize method of selector.
2046         * object.cc (make_elf_sized_object): Update caller.
2047         * parameters.cc (parameters_force_valid_target): Likewise.
2048         * incremental.cc (make_sized_incremental_binary): Likewise.
2049         * target-select.h: Update decl.
2050         (Target_selector::recognize): Take new Input_file* argument,
2051         pass it on to do_recognize.
2052         (Target_selector::do_recognize): Take new Input_file* argument.
2053         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2054         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2055         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2056         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2057
2058         * target.h (Target::Target_info): New members isolate_execinstr
2059         and rosegment_gap.
2060         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2061         * arm.cc (Target_arm::arm_info): Update initializer.
2062         * i386.cc (Target_i386::i386_info): Likewise.
2063         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2064         * sparc.cc (Target_sparc::sparc_info): Likewise.
2065         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2066         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2067         * layout.cc (Layout::attach_allocated_section_to_segment):
2068         Take new const Target* argument.  If target->isolate_execinstr(), act
2069         like --rosegment.
2070         (Layout::find_first_load_seg): Take new const Target* argument;
2071         if target->isolate_execinstr(), reject PF_X segments.
2072         (Layout::relaxation_loop_body): Update caller.
2073         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2074         reset file offset to zero when we hit LOAD_SEG, and then do a second
2075         loop over the segments before LOAD_SEG to reassign offsets after
2076         addresses have been determined.  Handle target->rosegment_gap().
2077         (Layout::attach_section_to_segment): Take new const Target* argument;
2078         pass it to attach_allocated_section_to_segment.
2079         (Layout::make_output_section): Update caller.
2080         (Layout::attach_sections_to_segments): Take new const Target* argument;
2081         pass it to attach_section_to_segment.
2082         * gold.cc (queue_middle_tasks): Update caller.
2083         * layout.h (Layout): Update method decls with new arguments.
2084
2085         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2086         Target_info pointer to use.
2087         (Target_arm::do_make_data_plt): New virtual method.
2088         (Target_arm::make_data_plt): New method that calls it.
2089         (Target_arm::make_plt_entry): Use it.
2090         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2091         for the section alignment.
2092         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2093         method.
2094         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2095         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2096         method.
2097         (Output_data_plt_arm::get_plt_entry_size): Call it.
2098         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2099         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2100         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2101         method.
2102         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2103         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2104         method instead of sizeof(plt_entry).
2105         (Output_data_plt_arm::add_entry): Likewise.
2106         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2107         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2108         than static method.
2109         (Target_arm::plt_entry_size): Likewise.
2110         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2111         Move to ...
2112         (Output_data_plt_arm_standard): ... here, new class.
2113         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2114         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2115         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2116
2117         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2118         Take additional argument for the PLT entry size.
2119         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2120         Use get_plt_entry_size method rather than plt_entry_size variable.
2121         (Output_data_plt_x86_64::reserve_slot): Likewise.
2122         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2123         (Output_data_plt_x86_64::add_entry): Likewise.
2124         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2125         (Output_data_plt_x86_64::address_for_global): Likewise.
2126         (Output_data_plt_x86_64::address_for_local): Likewise.
2127         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2128         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2129         Make method non-static.
2130         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2131         method.
2132         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2133         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2134         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2135         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2136         virtual method.
2137         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2138         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2139         virtual method.
2140         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2141         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2142         virtual method.
2143         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2144         (Output_data_plt_x86_64::plt_entry_size)
2145         (Output_data_plt_x86_64::first_plt_entry)
2146         (Output_data_plt_x86_64::plt_entry)
2147         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2148         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2149         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2150         (Output_data_plt_x86_64_standard): ... here, new class.
2151         (Target_x86_64::Target_x86_64): Take optional argument for the
2152         Target_info pointer to use.
2153         (Target_x86_64::do_make_data_plt): New virtual method.
2154         (Target_x86_64::make_data_plt): New method to call it.
2155         (Target_x86_64::init_got_plt_for_update): Use that.
2156         Call this->plt_->add_eh_frame method here.
2157         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2158         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2159         rather than static method.
2160         (Target_x86_64::plt_entry_size): Likewise.
2161         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2162         rather than plt_entry_size variable.  Move guts of PLT filling to...
2163         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2164         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2165         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2166
2167         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2168         additional argument for the section alignment.
2169         Don't do add_eh_frame_for_plt here.
2170         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2171         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2172         variable.
2173         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2174         method.
2175         (Output_data_plt_i386::get_plt_entry_size): Call it.
2176         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2177         (Output_data_plt_i386::add_eh_frame): New method to call it.
2178         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2179         method.
2180         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2181         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2182         method.
2183         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2184         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2185         method instead of plt_entry_size.
2186         (Output_data_plt_i386::plt_entry_size)
2187         (Output_data_plt_i386::plt_eh_frame_fde_size)
2188         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2189         (Output_data_plt_i386_standard): ... here, new class.
2190         (Output_data_plt_i386_exec): New class.
2191         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2192         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2193         (Output_data_plt_i386::exec_plt_entry): Move to ...
2194         (Output_data_plt_i386_exec::plt_entry): ... here.
2195         (Output_data_plt_i386_dyn): New class.
2196         (Output_data_plt_i386::first_plt_entry): Move to ...
2197         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2198         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2199         (Output_data_plt_i386_dyn::plt_entry): ... here.
2200         (Target_i386::Target_i386): Take optional argument for the Target_info
2201         pointer to use.
2202         (Target_i386::do_make_data_plt): New virtual method.
2203         (Target_i386::make_data_plt): New method to call it.
2204         (Target_i386::make_plt_section): Use that.
2205         Call this->plt_->add_eh_frame method here.
2206         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2207         rather than plt_entry_size variable.
2208         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2209         (Output_data_plt_i386::address_for_local): Likewise.
2210         (Output_data_plt_i386::do_write): Likewise.
2211         Move guts of PLT filling to...
2212         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2213         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2214         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2215         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2216
2217 2012-05-01  Cary Coutant  <ccoutant@google.com>
2218
2219         * dwarf_reader.cc (Dwarf_die::read_attributes)
2220         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2221         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2222         * reduced_debug_output.cc
2223         (Output_reduced_debug_info_section::get_die_end): Remove
2224         DW_FORM_GNU_ref_index.  Add default case.
2225
2226 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2227
2228         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2229         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2230         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2231         DW_AT_high_pc as offset from DW_AT_low_pc.
2232
2233         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2234         * testsuite/Makefile.in: Regenerate.
2235         * testsuite/gdb_index_test_3.c: New test source file.
2236         * testsuite/gdb_index_test_3.sh: New test source file.
2237
2238 2012-04-25  Ian Lance Taylor  <iant@google.com>
2239
2240         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2241         pointer.
2242         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2243         as a class, not a struct.
2244         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2245         (Target_arm::apply_cortex_a8_workaround): Likewise.
2246         * gc.h: Declare Reloc_types as a struct, not a class.
2247         * object.h: Declare Symbols_data as a struct.
2248         * reloc.h: Declare Read_relocs_data as a struct.
2249         * target.h: Declare Relocate_info as a struct.
2250
2251 2012-04-24  David S. Miller  <davem@davemloft.net>
2252
2253         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2254         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2255         and R_SPARC_WPLT30.
2256
2257 2012-04-24  Cary Coutant  <ccoutant@google.com>
2258
2259         * incremental-dump.cc (find_input_containing_global): Replace
2260         magic number with symbolic constant.
2261         (dump_incremental_inputs): Update version number.
2262         * incremental.cc (Output_section_incremental_inputs): Update version
2263         number; import symbolic constants from Incremental_inputs_reader.
2264         (Incremental_inputs::create_data_sections): Align relocations
2265         section correctly for 64-bit targets.
2266         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2267         constants; add padding.
2268         (Output_section_incremental_inputs::write_header): Add assert for
2269         header_size.
2270         (Output_section_incremental_inputs::write_input_files): Add assert
2271         for input_entry_size.
2272         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2273         add assert for object_info_size, input_section_entry_size,
2274         global_sym_entry_size.
2275         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2276         for data structure sizes; use them.
2277         (Incremental_input_entry_reader): Import symbolic constants from
2278         Incremental_inputs_reader; use them.
2279
2280 2012-04-23  David S. Miller  <davem@davemloft.net>
2281
2282         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2283         and elf_flags_set_.
2284         (Target_sparc::Target_sparc): Initialize new fields.
2285         (Target_sparc::do_make_elf_object): New function.
2286         (Target_sparc::do_adjust_elf_header): New function.
2287
2288 2012-04-23  Cary Coutant  <ccoutant@google.com>
2289
2290         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2291         CU range table of gdb index.
2292
2293 2012-04-20  David S. Miller  <davem@davemloft.net>
2294
2295         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2296         instead of false.
2297
2298 2012-04-16  David S. Miller  <davem@davemloft.net>
2299
2300         * sparc.cc (Target_sparc::got_address): New function.
2301         (Sparc_relocate_functions::gdop_hix22): New function.
2302         (Sparc_relocate_functions::gdop_lox10): New function.
2303         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2304         relocs.
2305         (Target_sparc::Scan::local): Likewise if the global symbol is not
2306         preemptible and is not IFUNC.
2307         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2308         transformations for local and non-preemptible non-IFUNC global
2309         symbols.
2310
2311         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2312         writing out 64-bit part of ranges.
2313
2314         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2315         -fpic and -fpie respectively.
2316         * Makefile.in: Regenerate.
2317
2318         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2319         (Target_sparc::Target_sparc): Initialize new field.
2320         (Target_sparc::do_plt_section_for_global): New function.
2321         (Target_sparc::do_plt_section_for_local): New function.
2322         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2323         (Target_sparc::make_plt_section): New function, broken out of
2324         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2325         (Target_sparc::make_plt_entry): Call make_plt_section.
2326         (Target_sparc::make_local_ifunc_plt_entry): New function.
2327         (Target_sparc::rela_ifunc_section): New function.
2328         (Target_sparc::plt_section): Remove const.
2329         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2330         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2331         and ifunc_count_ fields.
2332         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2333         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2334         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2335         (Output_data_plt_sparc::rela_ifunc): New function.
2336         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2337         (Output_data_plt_sparc::has_ifunc_section): New function.
2338         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2339         (Output_data_plt_sparc::address_for_global): New function.
2340         (Output_data_plt_sparc::address_for_local): New function.
2341         (Output_data_plt_sparc::plt_index_to_offset): New function.
2342         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2343         and entry_count.
2344         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2345         entry_count.
2346         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2347         R_SPARC_JMP_IREL to switch.
2348         (Target_sparc::Scan::check_non_pic): Likewise.
2349         (Target_sparc::Scan::local): Handle IFUNC symbols.
2350         (Target_sparc::Scan::local): Likewise.
2351         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2352         and plt_address_for_local.
2353         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2354         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2355
2356         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2357         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2358         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2359         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2360         global relocs too.
2361         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2362         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2363         calls.
2364         * sparc.cc (Target_sparc::Scan::global): Likewise.
2365         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2366
2367 2012-04-16  Cary Coutant  <ccoutant@google.com>
2368
2369         * archive.cc (Library_base::should_include_member): Check for
2370         --export-dynamic-symbol.
2371         * options.h (class General_options): Add --export-dynamic-symbol.
2372         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2373         --export-dynamic-symbol.
2374         (Symbol_table::gc_mark_undef_symbols): Likewise.
2375         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2376
2377 2012-04-12  David S. Miller  <davem@davemloft.net>
2378
2379         * sparc.cc (Reloc::wdisp10): New relocation method.
2380         (Reloc::h34): Likewise.
2381         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2382         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2383         R_SPARC_WDISP10.
2384         (Target_sparc::Scan::local): Likewise.
2385         (Target_sparc::Scan::global): Likewise.
2386         (Target_sparc::Relocate::relocate): Likewise.
2387
2388 2012-04-09  Cary Coutant  <ccoutant@google.com>
2389
2390         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2391         low_pc == 0.
2392
2393 2012-04-06  Ian Lance Taylor  <iant@google.com>
2394
2395         * timer.cc: #include <unistd.h>.
2396
2397 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2398
2399         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2400         * config.in: Regenerate.
2401         * configure: Regenerate.
2402
2403 2012-04-05  Nick Clifton  <nickc@redhat.com>
2404
2405         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2406         (AM_LC_MESSAGES): Add.
2407         * aclocal.m4: Regenerate.
2408         * config.in: Regenerate.
2409         * configure: Regenerate.
2410
2411 2012-03-21  Cary Coutant  <ccoutant@google.com>
2412
2413         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2414         * Makefile.in: Regenerate.
2415         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2416         (Sized_elf_reloc_mapper::symbol_section): New function.
2417         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2418         (make_elf_reloc_mapper): New function.
2419         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2420         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2421         (Dwarf_abbrev_table::do_get_abbrev): New function.
2422         (Dwarf_ranges_table::read_ranges_table): New function.
2423         (Dwarf_ranges_table::read_range_list): New function.
2424         (Dwarf_pubnames_table::read_section): New function.
2425         (Dwarf_pubnames_table::read_header): New function.
2426         (Dwarf_pubnames_table::next_name): New function.
2427         (Dwarf_die::Dwarf_die): New function.
2428         (Dwarf_die::read_attributes): New function.
2429         (Dwarf_die::skip_attributes): New function.
2430         (Dwarf_die::set_name): New function.
2431         (Dwarf_die::set_linkage_name): New function.
2432         (Dwarf_die::attribute): New function.
2433         (Dwarf_die::string_attribute): New function.
2434         (Dwarf_die::int_attribute): New function.
2435         (Dwarf_die::uint_attribute): New function.
2436         (Dwarf_die::ref_attribute): New function.
2437         (Dwarf_die::child_offset): New function.
2438         (Dwarf_die::sibling_offset): New function.
2439         (Dwarf_info_reader::check_buffer): New function.
2440         (Dwarf_info_reader::parse): New function.
2441         (Dwarf_info_reader::do_parse): New function.
2442         (Dwarf_info_reader::do_read_string_table): New function.
2443         (Dwarf_info_reader::lookup_reloc): New function.
2444         (Dwarf_info_reader::get_string): New function.
2445         (Dwarf_info_reader::visit_compilation_unit): New function.
2446         (Dwarf_info_reader::visit_type_unit): New function.
2447         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2448         Sized_elf_reloc_mapper.
2449         (Sized_dwarf_line_info::symbol_section): Remove function.
2450         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2451         (Sized_dwarf_line_info::read_line_mappings): Remove object
2452         parameter, adjust callers.
2453         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2454         * dwarf_reader.h: Include <sys/types.h>.
2455         (class Track_relocs): Remove forward declaration.
2456         (class Elf_reloc_mapper): New class.
2457         (class Sized_elf_reloc_mapper): New class.
2458         (class Dwarf_abbrev_table): New class.
2459         (class Dwarf_range_list): New class.
2460         (class Dwarf_ranges_table): New class.
2461         (class Dwarf_pubnames_table): New class.
2462         (class Dwarf_die): New class.
2463         (class Dwarf_info_reader): New class.
2464         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2465         (Sized_dwarf_line_info::symbol_section): Remove member function.
2466         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2467         base class.
2468         * gdb-index.cc: New source file.
2469         * gdb-index.h: New source file.
2470         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2471         and .debug_types sections, call Layout::add_to_gdb_index.
2472         (Sized_relobj_incr::do_section_name): Implement.
2473         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2474         return type; Implement.
2475         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2476         return type.
2477         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2478         parameter list and return type.
2479         (Sized_incr_dynobj::do_section_contents): Likewise.
2480         * layout.cc: Include gdb-index.h.
2481         (Layout::Layout): Initialize gdb_index_data_.
2482         (Layout::init_fixed_output_section): Check for .gdb_index section.
2483         (Layout::add_to_gdb_index): New function. Instantiate.
2484         * layout.h: Add forward declaration for class Gdb_index.
2485         (Layout::add_to_gdb_index): New member function.
2486         (Layout::gdb_index_data_): New data member.
2487         * main.cc: Include gdb-index.h.
2488         (main): Print statistics for gdb index.
2489         * object.cc (Object::section_contents): Move code into
2490         do_section_contents.
2491         (need_decompressed_section): Check for sections needed when building
2492         gdb index.
2493         (build_compressed_section_map): Likewise.
2494         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2495         gdb index.
2496         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2497         sections; call Layout::add_to_gdb_index.
2498         (Sized_relobj_file::do_decompressed_section_contents): Call
2499         do_section_contents directly.
2500         * object.h (Object::do_section_contents): Adjust parameter list and
2501         return type.
2502         (Object::do_decompressed_section_contents): Call do_section_contents
2503         directly.
2504         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2505         return type.
2506         * options.h (class General_options): Add --gdb-index option.
2507         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2508         list and return type.
2509         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2510         * reloc.h (Track_relocs::checkpoint): New function.
2511         (Track_relocs::reset): New function.
2512
2513         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2514         New test cases.
2515         * testsuite/Makefile.in: Regenerate.
2516         * testsuite/gdb_index_test.cc: New test source file.
2517         * testsuite/gdb_index_test_1.sh: New test source file.
2518         * testsuite/gdb_index_test_2.sh: New test source file.
2519
2520 2012-03-19  Doug Kwan  <dougkwan@google.com>
2521
2522         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2523         (Target_arm::do_finalize_sections): Remove code which defines
2524         __exidx_start and __exidx_end.  Make symbol table parameter
2525         anonymous as it is not used.
2526         * gold.cc (queue_middle_tasks): Call target hook to define any
2527         target-specific symbols.
2528         * target.h (Target::define_standard_symbols): New method.
2529         (Target::do_define_standard_symbols): Same.
2530         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2531         * testsuite/Makefile.in: Regenerate.
2532         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2533         and __exidx_end.
2534         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2535         relocations are generated for __exidx_start and __exidx_end.
2536
2537 2012-03-16  Doug Kwan  <dougkwan@google.com>
2538
2539         * testsuite/Makefile.am: Disable test initpri3b.
2540         * testsuite/Makefile.in: Regenerate.
2541
2542 2012-03-15  Doug Kwan  <dougkwan@google.com>
2543
2544         * arm.cc (Target_arm::got_section): Make .got section read-only
2545         if -z now is given.
2546
2547 2012-03-15  Ian Lance Taylor  <iant@google.com>
2548
2549         PR gold/13850
2550         * layout.cc (Layout::make_output_section): Correctly mark
2551         SHT_INIT_ARRAY, et. al., as relro.
2552
2553 2012-03-14  Doug Kwan  <dougkwan@google.com>
2554
2555         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2556         dynamic relocations for protected symbols in shared objects.
2557
2558 2012-03-13  Ian Lance Taylor  <iant@google.com>
2559
2560         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2561         keep the larger alignment.
2562
2563 2012-03-12  Cary Coutant  <ccoutant@google.com>
2564
2565         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2566         handling of DW_LNE_define_file.
2567
2568 2012-03-12  Cary Coutant  <ccoutant@google.com>
2569
2570         * reduced_debug_output.cc
2571         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2572         codes to switch.
2573
2574 2012-02-29  Cary Coutant  <ccoutant@google.com>
2575
2576         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2577
2578 2012-02-29  Cary Coutant  <ccoutant@google.com>
2579
2580         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2581         Call Object::decompressed_section_contents.
2582         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2583         New dtor.
2584         (Sized_dwarf_line_info::buffer_start_): New data member.
2585         * merge.cc (Output_merge_data::do_add_input_section): Call
2586         Object::decompressed_section_contents.
2587         (Output_merge_string::do_add_input_section): Likewise.
2588         * object.cc (need_decompressed_section): New function.
2589         (build_compressed_section_map): Decompress sections needed later.
2590         (Sized_relobj_file::do_decompressed_section_contents): New function.
2591         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2592         * object.h (Object::decompressed_section_contents): New function.
2593         (Object::discard_decompressed_sections): New function.
2594         (Object::do_decompressed_section_contents): New function.
2595         (Object::do_discard_decompressed_sections): New function.
2596         (Compressed_section_info): New type.
2597         (Compressed_section_map): Include decompressed section contents.
2598         (Sized_relobj_file::do_decompressed_section_contents): New function.
2599         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2600
2601 2012-02-16  Cary Coutant  <ccoutant@google.com>
2602
2603         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2604         * testsuite/Makefile.in: Regenerate.
2605
2606 2012-02-14  Cary Coutant  <ccoutant@google.com>
2607
2608         * options.cc (General_options::finalize): Disallow -pie and -static.
2609
2610 2012-02-03  Doug Kwan  <dougkwan@google.com>
2611
2612         * arm.cc (Arm_relocate_functions::abs8,
2613         Arm_relocate_functions::abs16): Use
2614         Bits::has_signed_unsigned_overflow32.
2615         (Arm_relocate_functions::thm_abs8): Correct range of
2616         overflow check.
2617         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2618         in assertions.
2619
2620 2012-02-02  Doug Kwan  <dougkwan@google.com>
2621
2622         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2623         position independent outputs, not just shared objects.
2624
2625 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2626
2627         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2628         * configure: Regenerated.
2629
2630 2012-01-27  Ian Lance Taylor  <iant@google.com>
2631
2632         * reloc.h (Bits): New class with static functions, copied from
2633         namespace utils in arm.cc.
2634         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2635         instead.
2636
2637 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2638
2639         * incremental.cc (write_info_blocks): Correct relocation offset.
2640
2641 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2642
2643         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2644         (Relocate::tls_gd_to_le): Likewise.
2645
2646 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2647
2648         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2649
2650 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2651
2652         * configure.ac: Check if -mcmodel=medium works.
2653         * configure: Regenerated.
2654
2655 2012-01-24  Cary Coutant  <ccoutant@google.com>
2656
2657         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2658         definition and ...
2659         (read_unsigned_LEB_128_x): ... this new function.
2660         (read_signed_LEB_128): Replaced with inline definition and ...
2661         (read_signed_LEB_128_x): ... this new function.
2662         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2663         (read_unsigned_LEB_128): Add inline definition.
2664         (read_signed_LEB_128_x): New function.
2665         (read_signed_LEB_128): Add inline definition.
2666         * testsuite/Makefile.am (leb128_unittest): New unit test.
2667         * testsuite/Makefile.in: Regenerate.
2668         * testsuite/leb128_unittest.cc: New unit test.
2669
2670 2012-01-23  Ian Lance Taylor  <iant@google.com>
2671
2672         PR gold/13617
2673         * i386.cc (Target_i386::do_code_fill): When using a jmp
2674         instruction, pad with nop instructions.
2675         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2676
2677 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2678
2679         * x86_64.cc (gc_process_relocs): Add typename on types used in
2680         template.
2681         (scan_relocs): Likewise.
2682         (relocate_section): Likewise.
2683         (apply_relocation): Likewise.
2684
2685 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2686
2687         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2688         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2689         under x32.
2690
2691 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2692
2693         * x86_64.cc: Initial support for x32.
2694
2695 2012-01-03  Cary Coutant  <ccoutant@google.com>
2696
2697         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2698         Use abstract base class for GOT.
2699         * gold/output.h (class Output_data_got_base): New abstract base class.
2700         (class Output_data_got): Derive from new base class, adjust ctors.
2701         (Output_data_got::reserve_slot): Make virtual; rename to
2702         do_reserve_slot; Adjust callers.
2703         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2704         pointer to abstract base class.
2705         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2706
2707 2011-12-18  Ian Lance Taylor  <iant@google.com>
2708
2709         * object.h (Relobj::local_symbol_value): New function.
2710         (Relobj::local_plt_offset): New function.
2711         (Relobj::local_has_got_offset): New function.
2712         (Relobj::local_got_offset): New function.
2713         (Relobj::set_local_got_offset): New function.
2714         (Relobj::do_local_symbol_value): New pure virtual function.
2715         (Relobj::do_local_plt_offset): Likewise.
2716         (Relobj::do_local_has_got_offset): Likewise.
2717         (Relobj::do_local_got_offset): Likewise.
2718         (Relobj::do_set_local_got_offset): Likewise.
2719         (Sized_relobj::do_local_has_got_offset): Rename from
2720         local_has_got_offset.
2721         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2722         (Sized_relobj::do_set_local_got_offset): Rename from
2723         set_local_got_offset.
2724         (Sized_relobj_file::do_local_plt_offset): Rename from
2725         local_plt_offset.
2726         (Sized_relobj_file::do_local_symbol_value): New function.
2727         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2728         local_plt_offset.
2729         * output.cc (Output_data_got::Got_entry::write): Change object to
2730         Relobj.  Use local_symbol_value.
2731         (Output_data_got::add_global_with_rel): Change rel_dyn to
2732         Output_data_reloc_generic*.  Use add_global_generic.
2733         (Output_data_got::add_global_with_rela): Remove.  Change all
2734         callers to use add_global_with_rel.
2735         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2736         Output_data_reloc_generic*.  Use add_global_generic.
2737         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2738         callers to use add_global_pair_with_rel.
2739         (Output_data_got::add_local): Change object to Relobj*.
2740         (Output_data_got::add_local_plt): Likewise.
2741         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2742         change rel_dyn to Output_data_reloc_generic*.  Use
2743         add_local_generic.
2744         (Output_data_got::add_local_with_rela): Remove.  Change all
2745         callers to use all_local_with_rel.
2746         (Output_data_got::add_local_pair_with_rel): Change object to
2747         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2748         add_output_section_generic.
2749         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2750         callers to use add_local_pair_with_rel.
2751         (Output_data_got::reserve_local): Change object to Relobj*.
2752         * output.h: (class Output_data_reloc_generic): Add pure virtual
2753         declarations for add_global_generic, add_local_generic,
2754         add_output_section_generic.
2755         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2756         functions for Output_data_reloc_generic.  Update declarations for
2757         changes listed in output.cc.
2758         (class Output_data_got): Change template parameter to got_size.
2759         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2760         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2761         function.
2762         (Sized_relobj_incr::do_local_plt_offset): New function.
2763         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2764         add_global_generic.
2765
2766 2011-12-17  Cary Coutant  <ccoutant@google.com>
2767
2768         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2769         * resolve.cc (Symbol_table::resolve): Likewise.
2770         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2771         arrays.
2772         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2773
2774 2011-12-16  Ian Lance Taylor  <iant@google.com>
2775
2776         * output.h (Output_data_reloc_generic::add): Only call
2777         add_dynamic_reloc if this is a dynamic reloc section.
2778
2779 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2780
2781         PR gold/13505
2782         * target-reloc.h (apply_relocation): Replace <64, false> with
2783         <size, big_endian>.
2784
2785 2011-11-25  Nick Clifton  <nickc@redhat.com>
2786
2787         * po/it.po: New Italian translation.
2788
2789 2011-11-17  Sterling Augustine  <saugustine@google.com>
2790
2791         * script.cc (script_include_directive): Implement.
2792         (read_script_file): New local variables name and search_path. Update
2793         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2794         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2795         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2796
2797 2011-11-11  Sterling Augustine  <saugustine@google.com>
2798
2799         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2800         (file_or_sections_cmd): Likewise.
2801
2802 2011-11-11  Doug Kwan  <dougkwan@google.com>
2803
2804         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2805         if --just-symbols is given.
2806
2807 2011-11-10  Doug Kwan  <dougkwan@google.com>
2808
2809         PR gold/13362
2810         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2811         when processing data relocs.
2812         * reloc.h (Relocate_functions::rel_unaligned): New method.
2813         (Relocate_functions::pcrel_unaligned): Ditto.
2814         (Relocate_functions::rel32_unaligned): Ditto.
2815         (Relocate_functions::pcrel32_unaligned): Ditto.
2816
2817 2011-11-09  Doug Kwan  <dougkwan@google.com>
2818
2819         PR gold/13362
2820         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2821         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2822         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2823         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2824         (Relocate_functions::rel_unaligned): New.
2825         (Relocate_functions::rel32_unaligned): New.
2826         * target-reloc.h (relocate_for_relocatable): Add code to handle
2827         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2828         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2829         arm_unaligned_reloc_r): New targets.
2830         * testsuite/Makefile.in: Regenerate.
2831         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2832         linking.
2833
2834 2011-11-02  Ian Lance Taylor  <iant@google.com>
2835
2836         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2837         NATIVE_LINKER.
2838         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2839         * options.cc (General_options::finalize): Use library search path
2840         from configure script if specified.  If not native and no sysroot,
2841         only search TOOLLIBDIR.
2842         * options.h (Search_directory::Search_directory): Change name to
2843         const std::string&.
2844         (General_options::add_to_library_path_with_sysroot): Change arg to
2845         const std::string&.
2846         * configure, Makefile.in, config.in: Rebuild.
2847
2848 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2849
2850         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2851         we are working around the ARM1176 Erratum.
2852         * options.h (General_options::fix_arm1176): Add option.
2853         * testsuite/Makefile.am: Add testcases, and keep current ones
2854         working.
2855         * testsuite/Makefile.in: Regenerate.
2856         * testsuite/arm_fix_1176.s: New file.
2857         * testsuite/arm_fix_1176.sh: Likewise.
2858
2859 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2860
2861         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2862         may_use_blx_.
2863         (Target_arm::may_use_blx): Remove method.
2864         (Target_arm::set_may_use_blx): Likewise.
2865         (Target_arm::may_use_v4t_interworking): New method.
2866         (Target_arm::may_use_v5t_interworking): Likewise.
2867         (Target_arm::may_use_blx_): Remove member variable.
2868         (Arm_relocate_functions::arm_branch_common): Check for v5T
2869         interworking.
2870         (Arm_relocate_functions::thumb_branch_common): Likewise.
2871         (Reloc_stub::stub_type_for_reloc): Likewise.
2872         (Target_arm::do_finalize_sections): Correct interworking checks.
2873         * testsuite/Makefile.am: Add new tests.
2874         * testsuite/Makefile.in: Regenerate.
2875         * testsuite/arm_farcall_arm_arm.s: New test.
2876         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2877         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2878         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2879         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2880         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2881         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2882         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2883
2884 2011-10-31  Cary Coutant  <ccoutant@google.com>
2885
2886         PR gold/13023
2887         * expression.cc (Expression::eval_with_dot): Add
2888         is_section_dot_assignment parameter.
2889         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2890         absolute and assigning to dot within a section.
2891         * script-sections.cc
2892         (Output_section_element_assignment::set_section_addresses): Pass
2893         dot_section to set_if_absolute.
2894         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2895         as is_section_dot_assignment flag to eval_with_dot.
2896         (Output_section_element_dot_assignment::set_section_addresses):
2897         Likewise.
2898         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2899         parameter.  Also set value if relative to dot_section; set the
2900         symbol's output_section.
2901         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2902         parameter.  Adjust all callers.
2903         (Expression::eval_maybe_dot): Likewise.
2904         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2905         Adjust all callers.
2906         * testsuite/script_test_2.t: Test assignment of an absolute value
2907         to dot within an output section element.
2908
2909 2011-10-31  Cary Coutant  <ccoutant@google.com>
2910
2911         * options.h (class General_options): Add --[no-]gnu-unique options.
2912         * symtab.cc (Symbol_table::sized_write_globals): Convert
2913         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2914
2915 2011-10-31  Cary Coutant  <ccoutant@google.com>
2916
2917         PR gold/13359
2918         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2919         unnecessary assertion.
2920         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2921
2922 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2923
2924         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2925         gc_mark_symbol.
2926         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2927         gc_mark_symbol.
2928         Change to just keep the section associated with symbol.
2929         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2930         they are externally visible and --export-dynamic is turned on.
2931         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2932
2933 2011-10-19  Ian Lance Taylor  <iant@google.com>
2934
2935         PR gold/13163
2936         * script-sections.cc
2937         (Output_section_element_dot_assignment::needs_output_section): New
2938         function.
2939
2940 2011-10-19  Ian Lance Taylor  <iant@google.com>
2941
2942         PR gold/13204
2943         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2944         --section-start option was seen.
2945         * options.h (General_options::any_section_start): New function.
2946
2947 2011-10-18  David S. Miller  <davem@davemloft.net>
2948
2949         PR binutils/13301
2950         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2951         member to track relocation locations that have moved during TLS
2952         reloc optimizations.
2953         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2954         (Target_sparc::Relocate::relocate): Adjust view down by 4
2955         bytes if it matches reloc_adjust_addr_.
2956         (Target_sparc::Relocate::relocate_tls): Always move the
2957         __tls_get_addr call delay slot instruction forward 4 bytes when
2958         performing relaxation.
2959
2960 2011-10-18  Cary Coutant  <ccoutant@google.com>
2961
2962         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2963         (Output_file::map_no_anonymous): Check for non-zero
2964         return code from posix_fallocate.
2965
2966 2011-10-17  Cary Coutant  <ccoutant@google.com>
2967
2968         PR gold/13245
2969         * plugin.cc (is_visible_from_outside): Check for symbols
2970         referenced from dynamic objects.
2971         * resolve.cc (Symbol_table::resolve): Don't count references
2972         from dynamic objects as references from real ELF files.
2973         * testsuite/plugin_test_2.sh: Adjust expected result.
2974
2975 2011-10-17  Cary Coutant  <ccoutant@google.com>
2976
2977         * gold.cc: Include timer.h.
2978         (queue_middle_tasks): Stamp time.
2979         (queue_final_tasks): Likewise.
2980         * main.cc (main): Store timer in parameters.  Print timers
2981         for each pass.
2982         * parameters.cc (Parameters::Parameters): Initialize timer_.
2983         (Parameters::set_timer): New function.
2984         (set_parameters_timer): New function.
2985         * parameters.h (Parameters::set_timer): New function.
2986         (Parameters::timer): New function.
2987         (Parameters::timer_): New data member.
2988         (set_parameters_timer): New function.
2989         * timer.cc (Timer::stamp): New function.
2990         (Timer::get_pass_time): New function.
2991         * timer.h (Timer::stamp): New function.
2992         (Timer::get_pass_time): New function.
2993         (Timer::pass_times_): New data member.
2994
2995 2011-10-17  Cary Coutant  <ccoutant@google.com>
2996
2997         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2998         task for members of lib groups.
2999
3000 2011-10-17  Cary Coutant  <ccoutant@google.com>
3001
3002         PR gold/13288
3003         * fileread.cc (File_read::find_view): Add assert.
3004         (File_read::make_view): Move bounds check (replace with assert)...
3005         (File_read::find_or_make_view): ... to here.
3006
3007 2011-10-12  Cary Coutant  <ccoutant@google.com>
3008
3009         * output.cc (Output_file::open_base_file): Handle case where
3010         ::read returns less than requested size.
3011
3012 2011-10-10  Cary Coutant  <ccoutant@google.com>
3013
3014         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3015         Initialize defined_count_.
3016         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3017         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3018         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3019         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3020         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3021         * incremental.h (Sized_relobj_incr::defined_count_): New data
3022         member.
3023         (Sized_incr_dynobj::defined_count_): New data member.
3024         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3025         Return zeroes instead of internal error.
3026
3027 2011-10-10  Cary Coutant  <ccoutant@google.com>
3028
3029         PR gold/13249
3030         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3031         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3032         * output.h (class Output_reloc): Add use_plt_offset flag.
3033         (Output_reloc::type_): Adjust size of bit field.
3034         (Output_reloc::use_plt_offset_): New bit field.
3035         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3036         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3037         flag.  Adjust all callers.
3038         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3039         creating RELATIVE relocations.
3040
3041 2011-10-10  Nick Clifton  <nickc@redhat.com>
3042
3043         * po/es.po: Updated Spanish translation.
3044         * po/fi.po: Updated Finnish translation.
3045
3046 2011-10-03   Diego Novillo  <dnovillo@google.com>
3047
3048         * options.cc (parse_uint): Fix dereference of RETVAL.
3049
3050 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3051
3052         * layout.h (section_order_map_): New member.
3053         (get_section_order_map): New member function.
3054         * output.cc (Output_section::add_input_section): Check for patterns
3055         only when --section-ordering-file is specified.
3056         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3057         output_sections have been formed.
3058         * layout.cc (Layout_Layout): Initialize section_order_map_.
3059         * plugin.cc (update_section_order): Store order in order_map. Do not
3060         update the order.
3061         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3062         * testsuite/Makefile.in: Regenerate.
3063         * testsuite/plugin_section_order.c: New file.
3064         * testsuite/plugin_final_layout.cc: New file.
3065         * testsuite/plugin_final_layout.sh: New file.
3066
3067 2011-09-29  Cary Coutant  <ccoutant@google.com>
3068
3069         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3070         Check for NULL.
3071         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3072         symbols during incremental update.
3073         (Symbol_table::add_from_dynobj): Likewise.
3074
3075 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3076             Ian Lance Taylor  <iant@google.com>
3077
3078         * symtab.cc (Symbol_table::define_special_symbol): Always
3079         canonicalize version string.
3080
3081 2011-09-26  Cary Coutant  <ccoutant@google.com>
3082
3083         * gold.cc (queue_initial_tasks): Move option checks ...
3084         * options.cc (General_options::finalize): ... to here. Disable
3085         some options; make others fatal.
3086
3087 2011-09-26  Cary Coutant  <ccoutant@google.com>
3088
3089         gcc PR lto/47247
3090         * plugin.cc (get_symbols_v2): New function.
3091         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3092         (is_referenced_from_outside): New function.
3093         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3094         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3095         (get_symbols): Pass version parameter.
3096         (get_symbols_v2): New function.
3097         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3098         parameter.
3099         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3100         (onload): Add LDPT_GET_SYMBOLS_V2.
3101         (all_symbols_read_hook): Use get_symbols_v2; check for
3102         LDPR_PREVAILING_DEF_IRONLY_EXP.
3103         * testsuite/plugin_test_3.sh: Update expected results.
3104
3105 2011-09-23  Simon Baldwin  <simonb@google.com>
3106
3107         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3108         configuration options.
3109         * configure: Regenerate.
3110         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3111         * Makefile.in: Regenerate.
3112         * testsuite/Makefile.in: Regenerate.
3113
3114 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3115
3116         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3117
3118 2011-09-19  Cary Coutant  <ccoutant@google.com>
3119
3120         * incremental.cc (can_incremental_update): Fix typo in comment.
3121         * incremental.h (can_incremental_update): Likewise.
3122
3123 2011-09-18  Cary Coutant  <ccoutant@google.com>
3124
3125         * incremental.cc (can_incremental_update): New function.
3126         * incremental.h (can_incremental_update): New function.
3127         * layout.cc (Layout::init_fixed_output_section): Call it.
3128         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3129         * object.cc (Sized_relobj_file::do_layout): Call
3130         can_incremental_update.
3131
3132 2011-09-13  Cary Coutant  <ccoutant@google.com>
3133
3134         * configure.ac: Check for glibc support for gnu_indirect_function
3135         support with static linking, setting automake conditional
3136         IFUNC_STATIC.
3137         * Makefile.in: Regenerate.
3138         * configure: Regenerate.
3139
3140         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3141         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3142         for IFUNC_STATIC.
3143         * testsuite/Makefile.in: Regenerate.
3144
3145 2011-09-13  Cary Coutant  <ccoutant@google.com>
3146
3147         * incremental.cc (Sized_relobj_incr::do_layout): Call
3148         report_comdat_group for kept comdat sections.
3149         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3150         * testsuite/Makefile.in: Regenerate.
3151         * testsuite/incr_comdat_test_1.cc: New source file.
3152         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3153         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3154         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3155
3156 2011-09-13  Ian Lance Taylor  <iant@google.com>
3157
3158         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3159         variable external_symbols_offset.
3160
3161 2011-09-12  Ian Lance Taylor  <iant@google.com>
3162
3163         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3164         triggered if object has no symbols.
3165
3166 2011-09-09  David S. Miller  <davem@davemloft.net>
3167
3168         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3169         (Output_fill_debug_line::do_write): Likewise.
3170
3171 2011-08-29  Cary Coutant  <ccoutant@google.com>
3172
3173         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3174         casts to match formatting specs.
3175         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3176
3177 2011-08-26  Cary Coutant  <ccoutant@google.com>
3178
3179         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3180         remaining hole size when allocating.
3181         (Layout::make_output_section): Set fill methods for debug sections.
3182         * layout.h (Free_list::Free_list_node): Move from private to
3183         public.
3184         (Free_list::set_min_hole_size): New function.
3185         (Free_list::begin, Free_list::end): New functions.
3186         (Free_list::min_hole_): New data member.
3187         * output.cc: Include dwarf.h.
3188         (Output_fill_debug_info::do_minimum_hole_size): New function.
3189         (Output_fill_debug_info::do_write): New function.
3190         (Output_fill_debug_line::do_minimum_hole_size): New function.
3191         (Output_fill_debug_line::do_write): New function.
3192         (Output_section::Output_section): Initialize new data member.
3193         (Output_section::set_final_data_size): Ensure patch space is larger
3194         than minimum hole size.
3195         (Output_section::do_write): Fill holes in debug sections.
3196         * output.h (Output_fill): New class.
3197         (Output_fill_debug_info): New class.
3198         (Output_fill_debug_line): New class.
3199         (Output_section::set_free_space_fill): New function.
3200         (Output_section::free_space_fill_): New data member.
3201         * testsuite/Makefile.am (incremental_test_3): Add
3202         --incremental-patch option.
3203         (incremental_test_4): Likewise.
3204         (incremental_test_5): Likewise.
3205         (incremental_test_6): Likewise.
3206         (incremental_copy_test): Likewise.
3207         (incremental_common_test_1): Likewise.
3208         * testsuite/Makefile.in: Regenerate.
3209
3210 2011-08-26  Nick Clifton  <nickc@redhat.com>
3211
3212         * po/es.po: Updated Spanish translation.
3213
3214 2011-08-01  Cary Coutant  <ccoutant@google.com>
3215
3216         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3217         * gold/testsuite/Makefile.in: Regenerate.
3218         * gold/testsuite/justsyms_exec.c: New source file.
3219         * gold/testsuite/justsyms_lib.c: New source file.
3220
3221 2011-08-01  Cary Coutant  <ccoutant@google.com>
3222
3223         * layout.cc (Layout::set_segment_offsets): Don't realign text
3224         segment if -Ttext was specified.
3225         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3226         file type.
3227         * object.h (Sized_relobj_file::e_type): New function.
3228         (Sized_relobj_file::e_type_): New data member.
3229         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3230         base address for ET_EXEC files.
3231         * target.cc (Target::do_make_elf_object_implementation): Allow
3232         ET_EXEC files with --just-symbols option.
3233
3234 2011-07-28  Cary Coutant  <ccoutant@google.com>
3235
3236         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3237         Add thread_number parameter.
3238         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3239         * workqueue-threads.cc
3240         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3241         current thread if its thread number is greater than desired thread
3242         count.
3243         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3244         Add thread_number parameter.
3245         (Workqueue::should_cancel_thread): Likewise.
3246         (Workqueue::find_runnable_or_wait): Pass thread_number to
3247         should_cancel_thread.
3248         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3249         parameter.
3250
3251 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3252
3253         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3254         only after checking if it cannot be forced local.
3255         * symtab.h (is_externally_visible): Check if the symbol is not forced
3256         local.
3257
3258 2011-07-15  Ian Lance Taylor  <iant@google.com>
3259
3260         * options.h (class General_options): Add --print-output-format.
3261         Move -EL next to -EB, for  better --help output.
3262         * target-select.cc: Include <cstdio>, "options.h", and
3263         "parameters.h".
3264         (Target_selector::do_target_bfd_name): New function.
3265         (print_output_format): New function.
3266         * target-select.h (class Target_selector): Update declarations.
3267         (Target_selector::target_bfd_name): New function.
3268         (print_output_format): Declare.
3269         * main.cc: Include "target-select.h".
3270         (main): Handle --print-output-format.
3271         * gold.cc: Include "target-select.h".
3272         (queue_initial_tasks): Handle --print-output-format when there are
3273         no input files.
3274         * parameters.cc (parameters_force_valid_target): Give a better
3275         error message if -EB/-EL does not match target.
3276         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3277         function.
3278
3279 2011-07-15  Ian Lance Taylor  <iant@google.com>
3280
3281         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3282         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3283         (Output_data_plt_i386::do_write): Write address of .dynamic
3284         section to first entry in .got.plt section.
3285         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3286         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3287         Initialize layout_.
3288         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3289         section to first entry in .got.plt section.
3290         * layout.h (Layout::dynamic_section): New function.
3291
3292 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3293
3294         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3295         to claim_file call.
3296         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3297         input_section_position_, and input_section_glob_.
3298         (read_layout_from_file): Call function section_ordering_specified.
3299         * layout.h (is_section_ordering_specified): New function.
3300         (section_ordering_specified): New function.
3301         (section_ordering_specified_): New boolean member.
3302         * main.cc(main): Call load_plugins after layout object is defined.
3303         * output.cc (Output_section::add_input_section): Use
3304         function section_ordering_specified to check if section ordering is
3305         needed.
3306         * output.cc (Output_section::add_relaxed_input_section): Use
3307         function section_ordering_specified to check if section ordering is
3308         needed.
3309         (Output_section::update_section_layout): New function.
3310         (Output_section::sort_attached_input_sections): Check if input section
3311         must be reordered.
3312         * output.h (Output_section::update_section_layout): New function.
3313         * plugin.cc (get_section_count): New function.
3314         (get_section_type): New function.
3315         (get_section_name): New function.
3316         (get_section_contents): New function.
3317         (update_section_order): New function.
3318         (allow_section_ordering): New function.
3319         (Plugin::load): Add the new interfaces to the transfer vector.
3320         (Plugin_manager::load_plugins): New parameter.
3321         (Plugin_manager::all_symbols_read): New parameter.
3322         (Plugin_manager::claim_file): New parameter. Save the elf object for
3323         unclaimed objects.
3324         (Plugin_manager::get_elf_object): New function.
3325         (Plugin_manager::get_view): Change to directly use the bool to check
3326         if get_view is called from claim_file_hook.
3327         * plugin.h (input_objects): New function
3328         (Plugin__manager::load_plugins): New parameter.
3329         (Plugin_manager::claim_file): New parameter.
3330         (Plugin_manager::get_elf_object): New function.
3331         (Plugin_manager::in_claim_file_handler): New function.
3332         (Plugin_manager::in_claim_file_handler_): New member.
3333         (layout): New function.
3334         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3335         handler with an extra parameter. Make the elf object before calling
3336         claim_file handler.
3337         * testsuite/plugin_test.c (get_section_count): New function pointer.
3338         (get_section_type): New function pointer.
3339         (get_section_name): New function pointer.
3340         (get_section_contents): New function pointer.
3341         (update_section_order): New function pointer.
3342         (allow_section_ordering): New function pointer.
3343         (onload): Check if the new interfaces exist.
3344
3345 2011-07-13  Ian Lance Taylor  <iant@google.com>
3346
3347         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3348         relro section.
3349         * x86_64.cc (Target_x86_64::got_section): Likewise.
3350         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3351         (relro_now_test_SOURCES): New variable.
3352         (relro_now_test_DEPENDENCIES): New variable.
3353         (relro_now_test_LDFLAGS): New variable.
3354         (relro_now_test_LDADD): New variable.
3355         (relro_now_test.so): New target.
3356         * testsuite/Makefile.in: Rebuild.
3357
3358 2011-07-12  Ian Lance Taylor  <iant@google.com>
3359
3360         PR gold/12980
3361         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3362         GLOB_DAT relocation rather than a RELATIVE relocation for a
3363         protected symbol when creating a shared library.
3364         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3365         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3366         * testsuite/protected_main_1.cc (main): Test that protected
3367         function has same address.
3368
3369 2011-07-11  Ian Lance Taylor  <iant@google.com>
3370
3371         PR gold/12979
3372         * options.h (class General_options): Add -Bgroup.
3373         * options.cc (General_options::finalize): If -Bgroup is set,
3374         default to --unresolved-symbols=report-all.
3375         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3376         * target-reloc.h (issue_undefined_symbol_error): Handle
3377         --unresolved-symbols=report-all.
3378
3379 2011-07-08  Ian Lance Taylor  <iant@google.com>
3380
3381         PR gold/11985
3382         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3383         if linker script discards key sections.
3384         (Layout::create_dynamic_symtab): Likewise.
3385         (Layout::assign_local_dynsym_offsets): Likewise.
3386         (Layout::sized_create_version_sections): Likewise.
3387         (Layout::create_interp): Likewise.
3388         (Layout::finish_dynamic_section): Likewise.
3389         (Layout::set_dynamic_symbol_size): Likewise.
3390
3391 2011-07-08  Ian Lance Taylor  <iant@google.com>
3392
3393         PR gold/12386
3394         * options.h (class General_options): Add --unresolved-symbols.
3395         * target-reloc.h (issue_undefined_symbol_error): Check
3396         --unresolved-symbols.  Add comments.
3397
3398 2011-07-08  Ian Lance Taylor  <iant@google.com>
3399
3400         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3401         expression more complex.
3402
3403 2011-07-08  Ian Lance Taylor  <iant@google.com>
3404
3405         PR gold/11317
3406         * target-reloc.h (issue_undefined_symbol_error): New inline
3407         function, broken out of relocate_section.
3408         (relocate_section): Call issue_undefined_symbol_error.
3409         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3410         there is no TLS segment if we are about to issue an undefined
3411         symbol error.
3412         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3413
3414 2011-07-08  Ian Lance Taylor  <iant@google.com>
3415
3416         PR gold/12279
3417         * resolve.cc (Symbol_table::should_override): Add fromtype
3418         parameter.  Change all callers.  Give error when linking together
3419         TLS and non-TLS symbol.
3420         (Symbol_table::should_override_with_special): Add fromtype
3421         parameter.  Change all callers.
3422         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3423         there is no TLS segment if we have reported some errors.
3424         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3425
3426 2011-07-08  Ian Lance Taylor  <iant@google.com>
3427
3428         PR gold/12372
3429         * target.h (Target::plt_address_for_global): New function.
3430         (Target::plt_address_for_local): New function.
3431         (Target::plt_section_for_global): Remove.
3432         (Target::plt_section_for_local): Remove.
3433         (Target::do_plt_address_for_global): New virtual function.
3434         (Target::do_plt_address_for_local): New virtual function.
3435         (Target::do_plt_section_for_global): Remove.
3436         (Target::do_plt_section_for_local): Remove.
3437         (Target::register_global_plt_entry): Add Symbol_table and Layout
3438         parameters.
3439         * output.cc (Output_data_got::Got_entry::write): Use
3440         plt_address_for_global and plt_address_for_local.
3441         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3442         address of output section.
3443         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3444         got_irelative_, and irelative_count_ fields.  Update
3445         declarations.
3446         (Output_data_plt_i386::has_irelative_section): New function.
3447         (Output_data_plt_i386::entry_count): Add irelative_count_.
3448         (Output_data_plt_i386::set_final_data_size): Likewise.
3449         (class Target_i386): Add got_irelative_ and rel_irelative_
3450         fields.  Update declarations.
3451         (Target_i386::Target_i386): Initialize new fields.
3452         (Target_i386::do_plt_address_for_global): New function replacing
3453         do_plt_section_for_global.
3454         (Target_i386::do_plt_address_for_local): New function replacing
3455         do_plt_section_for_local.
3456         (Target_i386::got_section): Create got_irelative_.
3457         (Target_i386::rel_irelative_section): New function.
3458         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3459         fields.  Don't define __rel_iplt_{start,end}.
3460         (Output_data_plt_i386::add_entry): Add symtab and layout
3461         parameters.  Change all callers.  Use different PLT and GOT for
3462         IFUNC symbols.
3463         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3464         layout parameters.  Change all callers.  Use different PLT and
3465         GOT.
3466         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3467         (Output_data_plt_i386::rel_irelative): New function.
3468         (Output_data_plt_i386::address_for_global): New function.
3469         (Output_data_plt_i386::address_for_local): New function.
3470         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3471         IRELATIVE GOT when changing IFUNC GOT entries.
3472         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3473         reloc.
3474         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3475         if we didn't create an IRELATIVE GOT.
3476         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3477         plt_address_for_local.
3478         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3479         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3480         got_irelative_, and irelative_count_ fields.  Update
3481         declarations.
3482         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3483         Initialize new fields.  Remove symtab parameter.  Change all
3484         callers.
3485         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3486         irelative_count_.
3487         (Output_data_plt_x86_64::has_irelative_section): New function.
3488         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3489         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3490         fields.  Update declarations.
3491         (Target_x86_64::Target_x86_64): Initialize new fields.
3492         (Target_x86_64::do_plt_address_for_global): New function replacing
3493         do_plt_section_for_global.
3494         (Target_x86_64::do_plt_address_for_local): New function replacing
3495         do_plt_section_for_local.
3496         (Target_x86_64::got_section): Create got_irelative_.
3497         (Target_x86_64::rela_irelative_section): New function.
3498         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3499         all callers.  Don't create __rel_iplt_{start,end}.
3500         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3501         parameters.  Change all callers.  Use different PLT and GOT for
3502         IFUNC symbols.
3503         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3504         layout parameters.  Change all callers.  Use different PLT and
3505         GOT.
3506         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3507         parameters.  Change all callers.  Use different PLT and GOT for
3508         IFUNC symbols.
3509         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3510         (Output_data_plt_x86_64::rela_irelative): New function.
3511         (Output_data_plt_x86_64::address_for_global): New function.
3512         (Output_data_plt_x86_64::address_for_local): New function.
3513         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3514         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3515         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3516         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3517         parameters.
3518         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3519         reloc.
3520         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3521         symbols if we didn't create an IRELATIVE GOT.
3522         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3523         plt_address_for_local.
3524         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3525         * testsuite/ifuncvar1.c: New test file.
3526         * testsuite/ifuncvar2.c: New test file.
3527         * testsuite/ifuncvar3.c: New test file.
3528         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3529         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3530         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3531         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3532         * testsuite/Makefile.in: Rebuild.
3533
3534 2011-07-07  Cary Coutant  <ccoutant@google.com>
3535
3536         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3537         (two_file_test_1_ndebug.o): Likewise.
3538         (two_file_test_1b_ndebug.o): Likewise.
3539         (two_file_test_2_ndebug.o): Likewise.
3540         (two_file_test_main_ndebug.o): Likewise.
3541         (incremental_test_2): Link with no-debug versions.
3542
3543 2011-07-06  Cary Coutant  <ccoutant@google.com>
3544
3545         * gold/incremental.cc
3546         (Output_section_incremental_inputs::write_info_blocks): Check for
3547         hidden and internal symbols.
3548
3549 2011-07-06  Cary Coutant  <ccoutant@google.com>
3550
3551         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3552         Check disposition for startup file.
3553         (Incremental_inputs::report_command_line): Ignore
3554         --incremental-startup-unchanged option.
3555         * options.cc (General_options::parse_incremental_startup_unchanged):
3556         New function.
3557         (General_options::General_options): Initialize new data member.
3558         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3559         (General_options): Add --incremental-startup-unchanged option.
3560         (General_options::incremental_startup_disposition): New function.
3561         (General_options::incremental_startup_disposition_): New data member.
3562
3563 2011-07-06  Cary Coutant  <ccoutant@google.com>
3564
3565         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3566         input file index to Script_info ctor.
3567         (Sized_incremental_binary::do_file_has_changed): Find the
3568         command-line argument for files named in scripts.
3569         * incremental.h (Script_info::Script_info): New ctor
3570         with input file index.
3571         (Script_info::input_file_index): New function.
3572         (Script_info::input_file_index_): New data member.
3573         (Incremental_binary::get_library): Add const.
3574         (Incremental_binary::get_script_info): Add const.
3575         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3576         * testsuite/Makefile.am (incremental_test_5): New test case.
3577         (incremental_test_6): New test case.
3578         * testsuite/Makefile.in: Regenerate.
3579
3580 2011-07-06  Cary Coutant  <ccoutant@google.com>
3581
3582         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3583         debug output when command lines differ.
3584
3585 2011-07-06  Cary Coutant  <ccoutant@google.com>
3586
3587         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3588         --incremental-patch option.
3589         * layout.cc (Free_list::allocate): Extend allocation beyond original
3590         end if enabled.
3591         (Layout::make_output_section): Mark sections that should get
3592         patch space.
3593         * options.cc (parse_percent): New function.
3594         * options.h (parse_percent): New function.
3595         (DEFINE_percent): New macro.
3596         (General_options): Add --incremental-patch option.
3597         * output.cc (Output_section::Output_section): Initialize new data
3598         members.
3599         (Output_section::add_input_section): Print section name when out
3600         of patch space.
3601         (Output_section::add_output_section_data): Likewise.
3602         (Output_section::set_final_data_size): Add patch space when
3603         doing --incremental-full.
3604         (Output_section::do_reset_address_and_file_offset): Remove patch
3605         space.
3606         (Output_segment::set_section_list_addresses): Print debug output
3607         only if --incremental-update.
3608         * output.h (Output_section::set_is_patch_space_allowed): New function.
3609         (Output_section::is_patch_space_allowed_): New data member.
3610         (Output_section::patch_space_): New data member.
3611         * parameters.cc (Parameters::incremental_full): New function.
3612         * parameters.h (Parameters::incremental_full): New function
3613         * testsuite/Makefile.am (incremental_test_2): Add test for
3614         --incremental-patch option.
3615         * testsuite/Makefile.in: Regenerate.
3616         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3617         (t18): Remove function body.
3618
3619 2011-07-05  Doug Kwan  <dougkwan@google.com>
3620
3621         PR gold/12771
3622         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3623         Arm_Address type for relocation result.
3624         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3625         overflow check.
3626         (Arm_relocate_functions::abs32): Use unaligned access.
3627         (Arm_relocate_functions::rel32): Ditto.
3628         (Arm_relocate_functions::prel31): Ditto.
3629         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3630         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3631         static data relocations.
3632         * testsuite/Makefile.in: Regnerate.
3633         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3634
3635 2011-07-05  Ian Lance Taylor  <iant@google.com>
3636
3637         PR gold/12392
3638         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3639         symbols if necessary.
3640         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3641
3642 2011-07-05  Ian Lance Taylor  <iant@google.com>
3643
3644         PR gold/12952
3645         * resolve.cc (Symbol::override_base_with_special): Simply override
3646         version with special symbol version, ignoring previous version.
3647
3648 2011-07-05  Ian Lance Taylor  <iant@google.com>
3649
3650         * object.cc (Sized_relobj_file::include_section_group): Add
3651         information to comment about signature location.
3652
3653 2011-07-02  Ian Lance Taylor  <iant@google.com>
3654
3655         PR gold/12957
3656         * options.h (class General_options): Add -f and -F.
3657         * options.cc (General_options::finalize): Fatal error if -f/-F
3658         are used without -shared.
3659         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3660
3661 2011-07-02  Ian Lance Taylor  <iant@google.com>
3662
3663         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3664
3665 2011-07-01  Ian Lance Taylor  <iant@google.com>
3666
3667         PR gold/12525
3668         PR gold/12952
3669         * resolve.cc (Symbol::override_base_with_special): Don't override
3670         the version if the overriding symbol has a different name.
3671         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3672         all callers.  If we give an error about an undefined version,
3673         define the base version if necessary.
3674         * dynobj.h (class Versions): Update declaration.
3675         * testsuite/weak_alias_test_5.cc: New file.
3676         * testsuite/weak_alias_test.script: New file.
3677         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3678         and versioned_alias have the right value, and call t2.
3679         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3680         weak_alias_test_5.so.
3681         (weak_alias_test_LDADD): Likewise.
3682         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3683         * testsuite/Makefile.in: Rebuild.
3684
3685 2011-07-01  Ian Lance Taylor  <iant@google.com>
3686
3687         PR gold/12525
3688         * options.h (class General_options): Support -z notext.
3689         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3690         -Wl,-z,notext.
3691         (two_file_shared_nonpic.so): Likewise.
3692         (two_file_shared_mixed.so): Likewise.
3693         (two_file_shared_mixed_1.so): Likewise.
3694         (weak_undef_lib_nonpic.so): Likewise.
3695         (alt/weak_undef_lib_nonpic.so): Likewise.
3696         (tls_test_shared_nonpic.so): Likewise.
3697         * testsuite/Makefile.in: Rebuild.
3698
3699 2011-07-01  Ian Lance Taylor  <iant@google.com>
3700
3701         PR gold/12525
3702         * configure.ac: Test whether static linking works, setting
3703         the automake conditional HAVE_STATIC.
3704         * testsuite/Makefile.am: Disable tests using -static if
3705         HAVE_STATIC is not true.
3706         * configure, testsuite/Makefile.in: Rebuild.
3707
3708 2011-07-01  Ian Lance Taylor  <iant@google.com>
3709
3710         PR gold/12525
3711         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3712         Assert if we see DW_EH_PE_indirect.
3713         * target.h (Target::ehframe_datarel_base): New function.
3714         (Target::do_ehframe_datarel_base): New target function.
3715         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3716         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3717         function.
3718
3719 2011-07-01  Ian Lance Taylor  <iant@google.com>
3720
3721         PR gold/12571
3722         * options.h (class General_options): Add
3723         --ld-generated-unwind-info.
3724         * ehframe.cc (Fde::write): Add address parameter.  Change all
3725         callers.  If associated with PLT, fill in address and size.
3726         (Cie::set_output_offset): Only add merge mapping if there is an
3727         object.
3728         (Cie::write): Add address parameter.  Change all callers.
3729         (Eh_frame::add_ehframe_for_plt): New function.
3730         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3731         input_offset_ fields into union u_, with new plt field.
3732         (Fde::Fde): Adjust for new union field.
3733         (Fde::Fde) [Output_data version]: New constructor.
3734         (Fde::add_mapping): Only add merge mapping if there is an object.
3735         (class Cie): Update declarations.
3736         (class Eh_frame): Declare add_ehframe_for_plt.
3737         * layout.cc (Layout::layout_eh_frame): Break out code into
3738         make_eh_frame_section, and call it.
3739         (Layout::make_eh_frame_section): New function.
3740         (Layout::add_eh_frame_for_plt): New function.
3741         * layout.h (class Layout): Update declarations.
3742         * merge.cc (Merge_map::add_mapping): Add assertion.
3743         * i386.cc: Include "dwarf.h".
3744         (class Output_data_plt_i386): Make first_plt_entry,
3745         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3746         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3747         and plt_eh_frame_fde.
3748         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3749         boundary.  Call add_eh_frame_for_plt if appropriate.
3750         * x86_64.cc: Include "dwarf.h".
3751         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3752         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3753         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3754         and plt_eh_frame_fde.
3755         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3756         appropriate.
3757
3758 2011-06-29  Ian Lance Taylor  <iant@google.com>
3759
3760         PR gold/12629
3761         * object.cc (Sized_relobj_file::layout_section): Change shdr
3762         parameter to be const.
3763         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3764         out of do_layout.
3765         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3766         appropriate.  Call layout_eh_frame_section.
3767         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3768         sections.
3769         * object.h (class Sized_relobj_file): Update declarations.
3770
3771 2011-06-29  Ian Lance Taylor  <iant@google.com>
3772
3773         PR gold/12652
3774         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3775         modifier.
3776         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3777
3778 2011-06-29  Ian Lance Taylor  <iant@google.com>
3779
3780         PR gold/12675
3781         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3782         SHT_X86_64_UNWIND.
3783         * layout.cc (Layout::layout_eh_frame): Likewise.
3784
3785 2011-06-29  Ian Lance Taylor  <iant@google.com>
3786
3787         PR gold/12695
3788         * layout.cc (Layout::symtab_section_shndx): New function.
3789         * layout.h (class Layout): Declare symtab_section_shndx.
3790         * output.cc (Output_section::write_header): Call it.
3791
3792 2011-06-29  Ian Lance Taylor  <iant@google.com>
3793
3794         PR gold/12818
3795         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3796         symbols which are not used in a relocation.
3797
3798 2011-06-28  Ian Lance Taylor  <iant@google.com>
3799
3800         PR gold/12898
3801         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3802         script create indistinguishable segments.
3803         (Layout::set_segment_offsets): Use stable_sort when sorting
3804         segments.  Pass this to Compare_segments constructor.
3805         * layout.h (class Layout): Make segment_precedes non-static.
3806         (class Compare_segments): Change from struct to class.  Add
3807         layout_ field.  Add constructor.
3808         * script-sections.cc
3809         (Script_sections::attach_sections_using_phdrs_clause): Rename
3810         local orphan to is_orphan.  Don't report failure to put empty
3811         section in segment.  On attachment failure, report name of
3812         section, and attach to first PT_LOAD segment.
3813
3814 2011-06-28  Ian Lance Taylor  <iant@google.com>
3815
3816         PR gold/12934
3817         * target-select.cc (Target_selector::Target_selector): Add
3818         emulation parameter.  Change all callers.
3819         (select_target_by_bfd_name): Rename from select_target_by_name.
3820         Change all callers.
3821         (select_target_by_emulation): New function.
3822         (supported_emulation_names): New function.
3823         * target-select.h (class Target_selector): Add emulation_ field.
3824         Update declarations.
3825         (Target_selector::recognize_by_bfd_name): Rename from
3826         recognize_by_name.  Change all callers.
3827         (Target_selector::supported_bfd_names): Rename from
3828         supported_names.  Change all callers.
3829         (Target_selector::recognize_by_emulation): New function.
3830         (Target_selector::supported_emulations): New function.
3831         (Target_selector::emulation): New function.
3832         (Target_selector::do_recognize_by_bfd_name): Rename from
3833         do_recognize_by_name.  Change all callers.
3834         (Target_selector::do_supported_bfd_names): Rename from
3835         do_supported_names.  Change all callers.
3836         (Target_selector::do_recognize_by_emulation): New function.
3837         (Target_selector::do_supported_emulations): New function.
3838         (select_target_by_bfd_name): Change name in declaration.
3839         (select_target_by_emulation): Declare.
3840         (supported_emulation_names): Declare.
3841         * parameters.cc (parameters_force_valid_target): Try to find
3842         target based on emulation from -m option.
3843         * options.h (class General_options): Change doc string for -m.
3844         * options.cc (help): Print emulations.
3845         (General_options::parse_V): Likewise.
3846         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3847         Add emulation parameter.  Change all callers.
3848
3849 2011-06-28  Ian Lance Taylor  <iant@google.com>
3850
3851         * target.h (class Target): Add osabi_ field.
3852         (Target::osabi): New function.
3853         (Target::set_osabi): New function.
3854         (Target::Target): Initialize osabi_.
3855         (Target::do_adjust_elf_header): Make pure virtual.
3856         (Sized_target::do_adjust_elf_header): Declare.
3857         * target.cc (Sized_target::do_adjust_elf_header): New function.
3858         (class Sized_target): Instantiate all versions.
3859         * freebsd.h (class Target_freebsd): Remove.
3860         (Target_selector_freebsd::do_recognize): Call set_osabi on
3861         Target.
3862         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3863         (Target_selector_freebsd::set_osabi): Remove.
3864         * i386.cc (class Target_i386): Inherit from Sized_target rather
3865         than Target_freebsd.
3866         * x86_64.cc (class Target_x86_64): Likewise.
3867
3868 2011-06-28  Ian Lance Taylor  <iant@google.com>
3869
3870         * target.h (Target::can_check_for_function_pointers): Rewrite.
3871         Make non-virtual.
3872         (Target::can_icf_inline_merge_sections): Likewise.
3873         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3874         (Target::Target_info): Add can_icf_inline_merge_sections field.
3875         (Target::do_can_check_for_function_pointers): New virtual
3876         function.
3877         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3878         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3879         from can_check_for_function_pointers, move in file.
3880         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3881         section_may_have_icf_unsafe_poineters, move in file.
3882         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3883         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3884         Rename from can_check_for_function_pointers, move in file.
3885         (Target_i386::can_icf_inline_merge_sections): Remove.
3886         (Target_i386::i386_info): Initialize
3887         can_icf_inline_merge_sections.
3888         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3889         Initialize can_icf_inline_merge_sections.
3890         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3891         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3892         Rename from can_check_for_function_pointers, move in file.
3893         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3894         (Target_x86_64::x86_64_info): Initialize
3895         can_icf_inline_merge_sections.
3896         * testsuite/testfile.cc (Target_test::test_target_info):
3897         Likewise.
3898         * icf.cc (get_section_contents): Correct formatting.
3899
3900 2011-06-27  Ian Lance Taylor  <iant@google.com>
3901
3902         * symtab.cc (Symbol::versioned_name): New function.
3903         (Symbol_table::add_to_final_symtab): Use versioned_name when
3904         appropriate.
3905         (Symbol_table::sized_write_symbol): Likewise.
3906         * symtab.h (class Symbol): Declare versioned_name.
3907         * stringpool.h (class Stringpool_template): Add variant of add
3908         which takes a std::basic_string.
3909         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3910         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3911         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3912         (ver_test_12.o): New target.
3913         * testsuite/Makefile.in: Rebuild.
3914
3915 2011-06-27  Doug Kwan  <dougkwan@google.com>
3916
3917         * arm.cc (Arm_relocate_functions::thm_jump8,
3918         Arm_relocate_functions::thm_jump11): Use a wider signed
3919         type to compute offset.
3920         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3921         arm_thm_jump8.
3922         * testsuite/Makefile.in: Regenerate.
3923         * testsuite/arm_branch_in_range.sh: Check test results of
3924         arm_thm_jump11 and arm_thm_jump8.
3925         * testsuite/arm_thm_jump11.s: New test source file.
3926         * testsuite/arm_thm_jump11.t: New linker script.
3927         * testsuite/arm_thm_jump8.s: New test source file.
3928         * testsuite/arm_thm_jump8.t: New linker script.
3929
3930 2011-06-24  Ian Lance Taylor  <iant@google.com>
3931
3932         * layout.cc: Include "object.h".
3933         (ctors_sections_in_init_array): New static variable.
3934         (Layout::is_ctors_in_init_array): New function.
3935         (Layout::layout): Add entry to ctors_sections_in_init_array if
3936         appropriate.
3937         * layout.h (class Layout): Declare is_ctors_in_init_array.
3938         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3939         is_ctors_reverse_view is set.
3940         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3941         all callers.  Set is_ctors_reverse_view field of View_size.
3942         (Sized_relobj_file::reverse_words): New function.
3943         * object.h (Sized_relobj_file::View_size): Add
3944         is_ctors_reverse_view field.
3945         (class Sized_relobj_file): Update declarations.
3946         * testsuite/initpri3.c: New test.
3947         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3948         initpri3b.
3949         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3950         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3951         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3952         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3953         * testsuite/Makefile.in: Rebuild.
3954
3955 2011-06-24  Cary Coutant  <ccoutant@google.com>
3956
3957         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3958         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3959         (debug_msg_cdebug.err): New targets.
3960         * testsuite/Makefile.in: Regenerate.
3961         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3962         Fix checks for link with shared library.
3963
3964 2011-06-24  Doug Kwan  <dougkwan@google.com>
3965
3966         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3967         skip empty text sections.
3968         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3969
3970 2011-06-22  Ian Lance Taylor  <iant@google.com>
3971
3972         PR gold/12910
3973         * options.h (class General_options): Add --ctors-in-init-array.
3974         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3975         friends as SHT_PROGBITS for merging sections.
3976         (Layout::layout): Remove special handling of .init_array and
3977         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3978         and .dtors if ctors_in_init_array.
3979         (Layout::make_output_section): Force correct section types for
3980         .init_array and friends.  Don't sort if doing relocatable link,
3981         Don't sort .ctors and .dtors if ctors_in_init_array.
3982         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3983         (Layout::output_section_name): Add relobj parameter.  Change all
3984         callers.  Handle .ctors. and .dtors. in code rather than table.
3985         Handle .ctors and .dtors if ctors_in_init_array.
3986         (Layout::match_file_name): New function, moved from output.cc.
3987         * layout.h (class Layout): Update declarations.
3988         * output.cc: Include "layout.h".
3989         (Input_section_sort_entry::get_priority): New function.
3990         (Input_section_sort_entry::match_file_name): Just call
3991         Layout::match_file_name.
3992         (Output_section::Input_section_sort_init_fini_compare::operator()):
3993         Handle .ctors and .dtors.  Sort by explicit priority rather than
3994         by name.
3995         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3996         * testsuite/initpri2.c: New test.
3997         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3998         (check_PROGRAMS): Add initpri2.
3999         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4000         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4001         * configure, testsuite/Makefile.in: Rebuild.
4002
4003 2011-06-19  Ian Lance Taylor  <iant@google.com>
4004
4005         PR gold/12880
4006         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4007         .interp section to a PT_INTERP segment even if we have seen a
4008         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4009         clause in a linker script.
4010         (Layout::finalize): Don't create a .interp section if we've
4011         already create a PT_INTERP segment.
4012         (Layout::create_interp): Always call choose_output_section (revert
4013         patch of 2011-06-17).  Don't create PT_INTERP segment.
4014         * script-sections.cc
4015         (Script_sections::create_note_and_tls_segments): Add a .interp
4016         section to a PT_INTERP segment even if we have seen a
4017         --dynamic-linker option.
4018
4019 2011-06-18  Ian Lance Taylor  <iant@google.com>
4020
4021         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4022         merely because a non-PT_LOAD segment has a dynamic reloc.
4023
4024 2011-06-18  Ian Lance Taylor  <iant@google.com>
4025
4026         * layout.cc (Layout::finish_dynamic_section): Don't create
4027         DT_FLAGS entry if not needed.
4028
4029 2011-06-18  Ian Lance Taylor  <iant@google.com>
4030
4031         PR gold/12745
4032         * layout.cc (Layout::layout_eh_frame): Correct handling of
4033         writable .eh_frame section.
4034
4035 2011-06-17  Ian Lance Taylor  <iant@google.com>
4036
4037         PR gold/12893
4038         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4039         symbol is redefined with the exact same object and value.
4040
4041 2011-06-17  Ian Lance Taylor  <iant@google.com>
4042
4043         PR gold/12880
4044         * layout.h (class Layout): Add interp_segment_ field.
4045         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4046         (Layout::attach_allocated_section_to_segment): If making shared
4047         library, put .interp section in PT_INTERP segment.
4048         (Layout::finalize): Also call create_interp if -dynamic-linker
4049         option was used.
4050         (Layout::create_interp): Assert that there is no PT_INTERP
4051         segment.  If not using a SECTIONS clause, use make_output_section.
4052         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4053         * script-sections.cc
4054         (Script_sections::create_note_and_tls_segments): If making shared
4055         library, put .interp section in PT_INTERP segment.
4056
4057 2011-06-17  Ian Lance Taylor  <iant@google.com>
4058
4059         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4060         when making a shared library.
4061
4062 2011-06-17  Ian Lance Taylor  <iant@google.com>
4063
4064         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4065         parameter.  Change all callers.  Don't issue warning about PC32
4066         against locally defined symbol.
4067
4068 2011-06-16  Ian Lance Taylor  <iant@google.com>
4069
4070         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4071         occurs in same object.
4072
4073 2011-06-14  Alan Modra  <amodra@gmail.com>
4074
4075         * po/POTFILES.in: Regenerate.
4076
4077 2011-06-09  Ian Lance Taylor  <iant@google.com>
4078
4079         * script-sections.cc
4080         (Orphan_output_section::set_section_addresses): For a relocatable
4081         link set address to 0.
4082
4083 2011-06-09  Cary Coutant  <ccoutant@google.com>
4084
4085         PR gold/12804
4086         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4087         used with --compress-debug-sections.
4088         * gold/object.cc (Sized_relobj_file::do_layout): Report
4089         uncompressed size of compressed input sections.
4090
4091 2011-06-08  Cary Coutant  <ccoutant@google.com>
4092
4093         PR gold/12804
4094         * testsuite/two_file_test_2_v1.cc: Change initialization of
4095         v2 to keep it in .data.
4096
4097 2011-06-07  Cary Coutant  <ccoutant@google.com>
4098
4099         * common.cc (Symbol_table::do_allocate_commons_list): Call
4100         gold_fallback.
4101         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4102         (Errors::fallback): New function.
4103         (gold_fallback): New function.
4104         * errors.h (Errors::fallback): New function.
4105         * gold.cc (gold_exit): Change status parameter to enum; adjust
4106         all callers.
4107         (queue_initial_tasks): Call gold_fallback.
4108         * gold.h: Include cstdlib.
4109         (Exit_status): New enum type.
4110         (gold_exit): Change status parameter to enum.
4111         (gold_fallback): New function.
4112         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4113         (Layout::create_symtab_sections): Likewise.
4114         (Layout::create_shdrs): Likewise.
4115         * main.cc (main): Adjust call to gold_exit.
4116         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4117         (Output_data_got::add_got_entry_pair): Likewise.
4118         (Output_section::add_input_section): Likewise.
4119         (Output_section::add_output_section_data): Likewise.
4120         (Output_segment::set_section_list_addresses): Likewise.
4121         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4122
4123 2011-06-07  Cary Coutant  <ccoutant@google.com>
4124
4125         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4126         for incremental links.
4127         * output.cc (Output_segment::set_section_list_addresses): Remove
4128         FIXME and test for TLS or BSS.
4129
4130 2011-06-07  Cary Coutant  <ccoutant@google.com>
4131
4132         * testsuite/Makefile.am: Add incremental_copy_test,
4133         incremental_common_test_1.
4134         * testsuite/Makefile.in: Regenerate.
4135         * testsuite/common_test_1_v1.c: New source file.
4136         * testsuite/common_test_1_v2.c: New source file.
4137         * testsuite/copy_test_v1.cc: New source file.
4138
4139 2011-06-07  Cary Coutant  <ccoutant@google.com>
4140
4141         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4142         update, allocate common from bss section's free list.
4143         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4144         linker-defined symbols.
4145         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4146         Skip GOT and PLT entries that are no longer referenced.
4147         (Output_section_incremental_inputs::write_info_blocks): Mark
4148         linker-defined symbols.
4149         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4150         * output.cc (Output_section::allocate): New function.
4151         * output.h (Output_section::allocate): New function.
4152         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4153         linker-defined symbols.
4154         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4155         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4156         (Symbol::init_base_output_data): Likewise.
4157         (Symbol::init_base_output_segment): Likewise.
4158         (Symbol::init_base_constant): Likewise.
4159         (Sized_symbol::init_output_data): Likewise.
4160         (Sized_symbol::init_output_segment): Likewise.
4161         (Sized_symbol::init_constant): Likewise.
4162         (Symbol_table::do_define_in_output_data): Likewise.
4163         (Symbol_table::do_define_in_output_segment): Likewise.
4164         (Symbol_table::do_define_as_constant): Likewise.
4165         * symtab.h (Symbol::is_predefined): New function.
4166         (Symbol::init_base_output_data): Add is_predefined parameter.
4167         (Symbol::init_base_output_segment): Likewise.
4168         (Symbol::init_base_constant): Likewise.
4169         (Symbol::is_predefined_): New data member.
4170         (Sized_symbol::init_output_data): Add is_predefined parameter.
4171         (Sized_symbol::init_output_segment): Likewise.
4172         (Sized_symbol::init_constant): Likewise.
4173         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4174
4175 2011-06-07  Cary Coutant  <ccoutant@google.com>
4176
4177         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4178         instead of emit_copy_reloc.
4179         (Copy_relocs::emit_copy_reloc): Refactor.
4180         (Copy_relocs::make_copy_reloc): New function.
4181         (Copy_relocs::add_copy_reloc): Remove.
4182         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4183         section.
4184         (Copy_relocs::make_copy_reloc): New function.
4185         (Copy_relocs::add_copy_reloc): Remove.
4186         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4187         unchanged input files.
4188         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4189         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4190         Reserve BSS space for COPY relocations.
4191         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4192         (Output_section_incremental_inputs::write_info_blocks): Record
4193         whether a symbol is copied from a shared object.
4194         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4195         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4196         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4197         (Incremental_input_entry_reader::get_output_symbol_index): Add
4198         is_copy parameter.
4199         (Incremental_binary::emit_copy_relocs): New function.
4200         (Incremental_binary::do_emit_copy_relocs): New function.
4201         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4202         new data member.
4203         (Sized_incremental_binary::add_copy_reloc): New function.
4204         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4205         (Sized_incremental_binary::Copy_reloc): New struct.
4206         (Sized_incremental_binary::Copy_relocs): New typedef.
4207         (Sized_incremental_binary::copy_relocs_): New data member.
4208         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4209         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4210         * target.h (Sized_target::emit_copy_reloc): New function.
4211         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4212
4213 2011-06-02  Cary Coutant  <ccoutant@google.com>
4214
4215         PR gold/12163
4216         * gold/archive.cc (Archive::Archive): Initialize new data member.
4217         (Archive::include_all_members): Return if archive has already been
4218         included.
4219         * gold/archive.h (Archive::include_all_members_): New data member.
4220
4221 2011-06-02  Nick Clifton  <nickc@redhat.com>
4222
4223         * dynobj.h: Fix spelling mistake in comment.
4224         * output.cc: Likewise.
4225
4226 2011-05-31  Doug Kwan  <dougkwan@google.com>
4227             Asier Llano
4228
4229         PR gold/12826
4230         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4231         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4232         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4233         redundant arm_exidx_test.so.
4234         * testsuite/Makefile.in: Regenerate.
4235         (check_SCRIPTS): Add pr12826.sh
4236         (check_DATA): Add pr12826.stdout
4237         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4238         * testsuite/pr12826.sh: New file.
4239         * testsuite/pr12826_1.s: Ditto.
4240         * testsuite/pr12826_1.s: Ditto.
4241
4242 2011-05-30  Ian Lance Taylor  <iant@google.com>
4243
4244         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4245         sections.
4246
4247 2011-05-29  Ian Lance Taylor  <iant@google.com>
4248
4249         PR gold/12804
4250         * testsuite/Makefile.am: Use different file name for two_file_test
4251         temporary file for each incremental test.
4252         * testsuite/Makefile.in: Rebuild.
4253
4254 2011-05-29  Ian Lance Taylor  <iant@google.com>
4255
4256         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4257         binary input file is empty.
4258
4259 2011-05-27  Ian Lance Taylor  <iant@google.com>
4260
4261         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4262         (ver_test_9.so): Likewise.
4263         * testsuite/Makefile.in: Rebuild.
4264
4265 2011-05-26 Cary Coutant  <ccoutant@google.com>
4266
4267         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4268         * incremental.cc (Incremental_inputs::report_input_section): Fix
4269         comment, indentation.
4270         (Incremental_inputs::report_comdat_group): New function.
4271         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4272         of data for incremental input file entry.
4273         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4274         group count, COMDAT group signatures.
4275         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4276         an unchanged input file.
4277         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4278         Initialize new data member.
4279         (Incremental_object_entry::add_comdat_group): New function.
4280         (Incremental_object_entry::get_comdat_group_count): New function.
4281         (Incremental_object_entry::get_comdat_signature_key): New function.
4282         (Incremental_object_entry::groups_): New data member.
4283         (Incremental_inputs::report_comdat_group): New function.
4284         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4285         data for incremental input file entry.
4286         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4287         (Incremental_input_entry_reader::get_input_section): Adjust size of
4288         data for incremental input file entry.
4289         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4290         (Incremental_input_entry_reader::get_comdat_group_signature): New
4291         function.
4292         * object.cc (Sized_relobj::include_section_group): Report kept
4293         COMDAT groups for incremental links.
4294
4295 2011-05-24  David Meyer  <pdox@google.com>
4296
4297         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4298         with name parameter.  Add found_name parameter.
4299         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4300         * dirsearch.h (class Dirsearch): Update declaration.
4301
4302 2011-05-24  Ian Lance Taylor  <iant@google.com>
4303
4304         * archive.cc (Library_base::should_include_member): Pull in object
4305         from archive if it defines the entry symbol.
4306         * parameters.cc (Parameters::entry): New function.
4307         * parameters.h (class Parameters): Declare entry.
4308         * output.h (class Output_file_header): Remove entry_ field.
4309         * output.cc (Output_file_header::Output_file_header): Remove entry
4310         parameter.  Change all callers.
4311         (Output_file_header::entry): Use parameters->entry.
4312         * gold.cc (queue_middle_tasks): Likewise.
4313         * plugin.cc (Plugin_hook::run): Likewise.
4314
4315 2011-05-24 Cary Coutant  <ccoutant@google.com>
4316
4317         * gold.cc (queue_initial_tasks): Pass incremental base filename
4318         to Output_file::open_base_file; don't print error message.
4319         * incremental-dump.cc (main): Adjust call to
4320         Output_file::open_for_modification.
4321         * incremental-dump.cc (main): Likewise.
4322         * incremental.cc (Incremental_inputs::report_command_line):
4323         Ignore --incremental-base option when comparing command lines.
4324         Ignore parameter when given as separate argument.
4325         * options.h (class General_options): Add --incremental-base.
4326         * output.cc (Output_file::Output_file):
4327         (Output_file::open_base_file): Add base_name and writable parameters;
4328         read base file into new file; print error message here.
4329         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4330         callers.
4331         * output.h (Output_file::open_for_modification): Rename to...
4332         (Output_file::open_base_file): ...this; add base_name and
4333         writable parameters; adjust all callers.
4334         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4335         callers.
4336         * testsuite/Makefile.am (incremental_test_4): Test
4337         --incremental-base.
4338         * testsuite/Makefile.in: Regenerate.
4339
4340 2011-05-24 Cary Coutant  <ccoutant@google.com>
4341
4342         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4343         incremental_test_4.
4344         * testsuite/Makefile.in: Regenerate.
4345         * testsuite/two_file_test_1_v1.cc: New test source file.
4346         * testsuite/two_file_test_1b_v1.cc: New test source file.
4347         * testsuite/two_file_test_2_v1.cc: New test source file.
4348
4349 2011-05-24 Cary Coutant  <ccoutant@google.com>
4350
4351         * dynobj.h (Dynobj::do_dynobj): New function.
4352         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4353         flag and soname for shared objects.
4354         * incremental.cc (Incremental_inputs::report_object): Make
4355         either Incremental_object_entry or Incremental_dynobj_entry; add
4356         soname to string table.
4357         (Incremental_inputs::report_input_section): Add assertion.
4358         (Output_section_incremental_inputs::set_final_data_size): Adjust
4359         type of input file entry for shared libraries; adjust size of
4360         shared library info entry.
4361         (Output_section_incremental_inputs::write_input_files): Write
4362         as_needed flag for shared libraries.
4363         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4364         of input file entry for shared libraries; write soname.
4365         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4366         soname from incremental info.
4367         * incremental.h (enum Incremental_input_flags): Add
4368         INCREMENTAL_INPUT_AS_NEEDED.
4369         (Incremental_input_entry::Incremental_input_entry): Initialize new
4370         data member.
4371         (Incremental_input_entry::set_as_needed): New function.
4372         (Incremental_input_entry::as_needed): New function.
4373         (Incremental_input_entry::do_dynobj_entry): New function.
4374         (Incremental_input_entry::as_needed_): New data member.
4375         (Incremental_object_entry::Incremental_object_entry): Don't check
4376         for shared library.
4377         (Incremental_object_entry::do_type): Likewise.
4378         (class Incremental_dynobj_entry): New class.
4379         (Incremental_input_entry_reader::as_needed): New function.
4380         (Incremental_input_entry_reader::get_soname): New function.
4381         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4382         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4383         size of shared library info entry.
4384         * layout.cc (Layout::finish_dynamic_section): Don't test for
4385         incremental link when adding DT_NEEDED entries.
4386         * object.h (Object::Object): Initialize new data member.
4387         (Object::dynobj): New function.
4388         (Object::set_as_needed): New function.
4389         (Object::as_needed): New function.
4390         (Object::do_dynobj): New function.
4391         (Object::as_needed_): New data member.
4392
4393 2011-05-24 Cary Coutant  <ccoutant@google.com>
4394
4395         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4396         info; adjust display of GOT entries.
4397         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4398         vector of input objects; remove file_status_.
4399         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4400         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4401         got_plt reader; call target hooks to reserve GOT entries.
4402         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4403         of input file info header and GOT info entry.
4404         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4405         relocation info.
4406         (Got_plt_view_info::got_descriptor): Remove.
4407         (Got_plt_view_info::sym_index): New data member.
4408         (Got_plt_view_info::input_index): New data member.
4409         (Local_got_offset_visitor::visit): Write input file index.
4410         (Global_got_offset_visitor::visit): Write 0 for input file index.
4411         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4412         with sym_index and input_index.
4413         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4414         incremental info GOT entry; replace got_descriptor with input_index.
4415         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4416         map from input file index to object.
4417         (Sized_relobj_incr::do_layout): Replace direct data member reference
4418         with accessor function.
4419         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4420         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4421         Adjust size of input file info header.
4422         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4423         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4424         (Incremental_input_entry_reader::get_input_section): Adjust size of
4425         input file info header.
4426         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4427         of incremental info GOT entry.
4428         (Incremental_got_plt_reader::get_got_desc): Remove.
4429         (Incremental_got_plt_reader::get_got_symndx): New function.
4430         (Incremental_got_plt_reader::get_got_input_index): New function.
4431         (Sized_incremental_binary::Sized_incremental_binary): Remove
4432         file_status_; add input_objects_.
4433         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4434         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4435         (Sized_incremental_binary::file_is_unchanged): Remove.
4436         (Sized_incremental_binary::set_input_object): New function.
4437         (Sized_incremental_binary::input_object): New function.
4438         (Sized_incremental_binary::file_status_): Remove.
4439         (Sized_incremental_binary::input_objects_): New data member.
4440         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4441         references.
4442         (Sized_relobj_incr::invalid_address): Move to base class.
4443         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4444         class.
4445         (Sized_relobj_incr::do_output_section_offset): Likewise.
4446         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4447         (Sized_relobj_incr::section_offsets_): Likewise.
4448         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4449         function.
4450         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4451         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4452         with accessor function.
4453         (Sized_relobj_file::do_layout): Likewise.
4454         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4455         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4456         (Sized_relobj_file::compute_final_local_value): Replace refs to
4457         section_offsets_ with accessor function.
4458         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4459         * object.h (Relobj::Relobj): Initialize new data members.
4460         (Relobj::add_dyn_reloc): New function.
4461         (Relobj::first_dyn_reloc): New function.
4462         (Relobj::dyn_reloc_count): New function.
4463         (Relobj::first_dyn_reloc_): New data member.
4464         (Relobj::dyn_reloc_count_): New data member.
4465         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4466         references.
4467         (Sized_relobj::Address): New typedef.
4468         (Sized_relobj::invalid_address): Move here from child class.
4469         (Sized_relobj::Sized_relobj): Initialize new data members.
4470         (Sized_relobj::sized_relobj): New function.
4471         (Sized_relobj::is_output_section_offset_invalid): Move here from
4472         child class.
4473         (Sized_relobj::get_output_section_offset): Likewise.
4474         (Sized_relobj::local_has_got_offset): Likewise.
4475         (Sized_relobj::local_got_offset): Likewise.
4476         (Sized_relobj::set_local_got_offset): Likewise.
4477         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4478         (Sized_relobj::clear_got_offsets): New function.
4479         (Sized_relobj::section_offsets): Move here from child class.
4480         (Sized_relobj::do_output_section_offset): Likewise.
4481         (Sized_relobj::do_set_section_offset): Likewise.
4482         (Sized_relobj::Local_got_offsets): Likewise.
4483         (Sized_relobj::local_got_offsets_): Likewise.
4484         (Sized_relobj::section_offsets_): Likewise.
4485         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4486         references.
4487         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4488         class.
4489         (Sized_relobj_file::sized_relobj): New function
4490         (Sized_relobj_file::local_has_got_offset): Move to base class.
4491         (Sized_relobj_file::local_got_offset): Likewise.
4492         (Sized_relobj_file::set_local_got_offset): Likewise.
4493         (Sized_relobj_file::get_output_section_offset): Likewise.
4494         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4495         (Sized_relobj_file::do_output_section_offset): Likewise.
4496         (Sized_relobj_file::do_set_section_offset): Likewise.
4497         (Sized_relobj_file::Local_got_offsets): Likewise.
4498         (Sized_relobj_file::local_got_offsets_): Likewise.
4499         (Sized_relobj_file::section_offsets_): Likewise.
4500         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4501         (all constructors).
4502         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4503         (Output_reloc::get_symbol_index): Likewise.
4504         (Output_reloc::local_section_offset): Likewise.
4505         (Output_reloc::get_address): Likewise.
4506         (Output_reloc::symbol_value): Likewise.
4507         (Output_data_got::reserve_slot): Move to class definition.
4508         (Output_data_got::reserve_local): New function.
4509         (Output_data_got::reserve_slot_for_global): Remove.
4510         (Output_data_got::reserve_global): New function.
4511         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4512         (all constructors, two instantiations).
4513         (Output_reloc::get_relobj): New function (two instantiations).
4514         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4515         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4516         (Output_data_reloc::add_global): Adjust type of relobj.
4517         (Output_data_reloc::add_global_relative): Likewise.
4518         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4519         (Output_data_reloc::add_local): Likewise.
4520         (Output_data_reloc::add_local_relative): Likewise.
4521         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4522         (Output_data_reloc::add_local_section): Likewise.
4523         (Output_data_reloc::add_output_section): Likewise.
4524         (Output_data_reloc::add_absolute): Likewise.
4525         (Output_data_reloc::add_target_specific): Likewise.
4526         (Output_data_got::reserve_slot): Move definition here.
4527         (Output_data_got::reserve_local): New function.
4528         (Output_data_got::reserve_global): New function.
4529         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4530         section_offsets_ with accessor function.
4531         (Sized_relobj_file::write_sections): Likewise.
4532         (Sized_relobj_file::do_relocate_sections): Likewise.
4533         * target.h (Sized_target::reserve_local_got_entry): New function.
4534         (Sized_target::reserve_global_got_entry): New function.
4535         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4536         (Target_x86_64::reserve_global_got_entry): New function.
4537         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4538
4539 2011-05-23 Cary Coutant  <ccoutant@google.com>
4540
4541         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4542         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4543         bit when checking got_type.
4544         * incremental.cc (Sized_incremental_binary::setup_readers):
4545         Store symbol table and string table locations; initialize bit vector
4546         of file status flags.
4547         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4548         unchanged files.
4549         (Sized_incremental_binary::do_process_got_plt): New function.
4550         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4551         (Output_section_incremental_inputs::set_final_data_size): Record
4552         file index for each input file.
4553         (Output_section_incremental_inputs::write_got_plt): Store file index
4554         instead of input entry offset for each GOT entry.
4555         * incremental.h
4556         (Incremental_input_entry::Incremental_input_entry): Initialize new
4557         data member.
4558         (Incremental_input_entry::set_offset): Store file index.
4559         (Incremental_input_entry::get_file_index): New function.
4560         (Incremental_input_entry::file_index_): New data member.
4561         (Incremental_binary::process_got_plt): New function.
4562         (Incremental_binary::do_process_got_plt): New function.
4563         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4564         data members.
4565         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4566         (Sized_incremental_binary::set_file_is_unchanged): New function.
4567         (Sized_incremental_binary::file_is_unchanged): New function.
4568         (Sized_incremental_binary::do_process_got_plt): New function.
4569         (Sized_incremental_binary::file_status_): New data member.
4570         (Sized_incremental_binary::main_symtab_loc_): New data member.
4571         (Sized_incremental_binary::main_strtab_loc_): New data member.
4572         * output.cc (Output_data_got::Got_entry::write): Add case
4573         RESERVED_CODE.
4574         (Output_data_got::add_global): Call add_got_entry.
4575         (Output_data_got::add_global_plt): Likewise.
4576         (Output_data_got::add_global_with_rel): Likewise.
4577         (Output_data_got::add_global_with_rela): Likewise.
4578         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4579         (Output_data_got::add_global_pair_with_rela): Likewise.
4580         (Output_data_got::add_local): Call add_got_entry.
4581         (Output_data_got::add_local_plt): Likewise.
4582         (Output_data_got::add_local_with_rel): Likewise.
4583         (Output_data_got::add_local_with_rela): Likewise.
4584         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4585         (Output_data_got::add_local_pair_with_rela): Likewise.
4586         (Output_data_got::reserve_slot): New function.
4587         (Output_data_got::reserve_slot_for_global): New function.
4588         (Output_data_got::add_got_entry): New function.
4589         (Output_data_got::add_got_entry_pair): New function.
4590         (Output_section::add_output_section_data): Edit FIXME.
4591         * output.h
4592         (Output_section_data_build::Output_section_data_build): New
4593         constructor with size parameter.
4594         (Output_data_space::Output_data_space): Likewise.
4595         (Output_data_got::Output_data_got): Initialize new data member; new
4596         constructor with size parameter.
4597         (Output_data_got::add_constant): Call add_got_entry.
4598         (Output_data_got::reserve_slot): New function.
4599         (Output_data_got::reserve_slot_for_global): New function.
4600         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4601         (Output_data_got::add_got_entry): New function.
4602         (Output_data_got::add_got_entry_pair): New function.
4603         (Output_data_got::free_list_): New data member.
4604         * target.h (Sized_target::init_got_plt_for_update): New function.
4605         (Sized_target::register_global_plt_entry): New function.
4606         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4607         Initialize new data member; call init; add constructor with PLT count.
4608         (Output_data_plt_x86_64::init): New function.
4609         (Output_data_plt_x86_64::add_relocation): New function.
4610         (Output_data_plt_x86_64::reserve_slot): New function.
4611         (Output_data_plt_x86_64::free_list_): New data member.
4612         (Target_x86_64::init_got_plt_for_update): New function.
4613         (Target_x86_64::register_global_plt_entry): New function.
4614         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4615         incremental updates.
4616         (Output_data_plt_x86_64::add_relocation): New function.
4617         * testsuite/object_unittest.cc (Object_test): Set default options.
4618
4619 2011-05-16  Ian Lance Taylor  <iant@google.com>
4620
4621         * options.h (class General_options): Make -i a synonym for -r.
4622
4623 2011-05-16  Ian Lance Taylor  <iant@google.com>
4624
4625         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4626
4627 2011-05-10 Cary Coutant  <ccoutant@google.com>
4628
4629         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4630         strip_all (-s).
4631
4632 2011-05-06  Ian Lance Taylor  <iant@google.com>
4633
4634         * layout.cc (Layout::layout): If the output section flags change,
4635         update the ordering.
4636
4637 2011-04-25 Cary Coutant  <ccoutant@google.com>
4638
4639         * incremental-dump.cc (dump_incremental_inputs): Print local
4640         symbol info for each input file.
4641         * incremental.cc
4642         (Output_section_incremental_inputs::set_final_data_size): Add local
4643         symbol info to input file entries in incremental info.
4644         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4645         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4646         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4647         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4648         implementation.
4649         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4650         (Sized_incr_relobj::do_relocate): Write the local symbols.
4651         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4652         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4653         Adjust size of input file header.
4654         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4655         (Incremental_inputs_reader::get_local_symbol_count): New function.
4656         (Incremental_inputs_reader::get_input_section): Adjust size of input
4657         file header.
4658         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4659         (Sized_incr_relobj::This): New typedef.
4660         (Sized_incr_relobj::sym_size): New const data member.
4661         (Sized_incr_relobj::Local_symbol): New struct.
4662         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4663         (Sized_incr_relobj::do_local_symbol_offset): New function.
4664         (Sized_incr_relobj::local_symbol_count_): New data member.
4665         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4666         (Sized_incr_relobj::local_symbol_index_): New data member.
4667         (Sized_incr_relobj::local_symbol_offset_): New data member.
4668         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4669         (Sized_incr_relobj::local_symbols_): New data member.
4670         * object.h (Relobj::output_local_symbol_count): New function.
4671         (Relobj::local_symbol_offset): New function.
4672         (Relobj::do_output_local_symbol_count): New function.
4673         (Relobj::do_local_symbol_offset): New function.
4674         (Sized_relobj::do_output_local_symbol_count): New function.
4675         (Sized_relobj::do_local_symbol_offset): New function.
4676
4677 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4678
4679         * descriptors.cc (set_close_on_exec): New function.
4680         (Descriptors::open): Use set_close_on_exec.
4681         * output.cc (S_ISLNK): Define if not defined.
4682
4683 2011-04-22 Cary Coutant  <ccoutant@google.com>
4684
4685         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4686         global symbol map.
4687         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4688         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4689         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4690         relocations.
4691         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4692         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4693         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4694         * incremental.h
4695         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4696         function.
4697         (Incremental_binary::apply_incremental_relocs): New function.
4698         (Incremental_binary::do_apply_incremental_relocs): New function.
4699         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4700         data member.
4701         (Sized_incremental_binary::add_global_symbol): New function.
4702         (Sized_incremental_binary::global_symbol): New function.
4703         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4704         (Sized_incremental_binary::symbol_map_): New data member.
4705         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4706         * target.h (Sized_target::apply_relocation): New function.
4707         * target-reloc.h (apply_relocation): New function.
4708         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4709
4710 2011-04-22  Doug Kwan  <dougkwan@google.com>
4711
4712         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4713         flag of a SHT_ARM_EXIDX section.
4714         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4715         * testsuite/Makefile.in: Regenerate.
4716         * testsuite/arm_exidx_test.s: New file.
4717         * testsuite/arm_exidx_test.sh: Same.
4718
4719 2011-04-20 Cary Coutant  <ccoutant@google.com>
4720
4721         PR gold/12689
4722         * archive.h (Incremental_archive_entry::Archive_member):
4723         Initialize arg_serial_ (second constructor).
4724
4725 2011-04-17  Ian Lance Taylor  <iant@google.com>
4726
4727         * object.cc (Relocate_info::location): Simplify location string.
4728         * errors.cc (Errors::error_at_location): Don't print program
4729         name.
4730         (Errors::warning_at_location): Likewise.
4731         (Errors::undefined_symbol): Likewise.
4732         * testsuite/debug_msg.sh: Update accordingly.
4733
4734 2011-04-14 Cary Coutant  <ccoutant@google.com>
4735
4736         * gold/layout.cc (Layout::symtab_section_offset): New function.
4737         * gold/layout.h (Layout::symtab_section_offset): New function.
4738         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4739
4740 2011-04-12  Ian Lance Taylor  <iant@google.com>
4741
4742         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4743         with MREMAP_MAYMOVE.
4744         * output.h (class Output_file): Add map_is_allocated_ field.
4745         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4746         not available, provide stubs.  If mremap is not available, #define
4747         it to gold_mremap.
4748         (MREMAP_MAYMOVE): Define if not defined.
4749         (Output_file::Output_file): Initialize map_is_allocated_.
4750         (Output_file::resize): Check map_is_allocated_.
4751         (Output_file::map_anonymous): If mmap fails, use malloc.
4752         (Output_file::unmap): Don't do anything for an anonymous map.
4753         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4754         is not available, provide stubs.
4755         (File_read::View::~View): Use free rather than delete[].
4756         (File_read::make_view): Use malloc rather than new[].  If mmap
4757         fails, use malloc.
4758         (File_read::find_or_make_view): Use malloc rather than new[].
4759         * gold.h: Remove HAVE_REMAP code.
4760         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4761         exists.  Rename mremap to gold_mremap.  If mmap is not available
4762         don't do anything.
4763         * configure, config.in: Rebuild.
4764
4765 2011-04-11  Ian Lance Taylor  <iant@google.com>
4766
4767         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4768         initialize local variable v.
4769
4770 2011-04-11  Cary Coutant  <ccoutant@google.com>
4771
4772         * archive.cc (Archive::include_member): Adjust call to
4773         report_object.
4774         (Add_archive_symbols::run): Track argument serial numbers.
4775         (Lib_group::include_member): Likewise.
4776         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4777         * archive.h (Incremental_archive_entry::Archive_member):
4778         Initialize arg_serial_.
4779         (Archive_member::arg_serial_): New data member.
4780         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4781         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4782         incremental link.
4783         (Sized_dynobj::do_for_all_local_got_entries): New function.
4784         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4785         function.
4786         * fileread.cc (get_mtime): New function.
4787         * fileread.h (get_mtime): New function.
4788         * gold.cc (queue_initial_tasks): Check for incremental update.
4789         (process_incremental_input): New function.
4790         (queue_middle_tasks): Don't force valid target for incremental
4791         update.
4792         * incremental-dump.cc (find_input_containing_global): Adjust
4793         size of symbol info entry.
4794         (dump_incremental_inputs): Dump argument serial number and
4795         in_system_directory flag; bias shndx by 1; print symbol names
4796         when dumping per-file symbol lists; use new symbol info readers.
4797         * incremental.cc
4798         (Output_section_incremental_inputs:update_data_size): New function.
4799         (Sized_incremental_binary::setup_readers): Setup input readers
4800         for each input file; build maps for files added from libraries
4801         and scripts.
4802         (Sized_incremental_binary::check_input_args): New function.
4803         (Sized_incremental_binary::do_check_inputs): Build map of argument
4804         serial numbers to input arguments.
4805         (Sized_incremental_binary::do_file_has_changed): Rename
4806         do_file_is_unchanged to this; compare file modification times.
4807         (Sized_incremental_binary::do_init_layout): New function.
4808         (Sized_incremental_binary::do_reserve_layout): New function.
4809         (Sized_incremental_binary::do_get_input_reader): Remove.
4810         (Sized_incremental_binary::get_symtab_view): New function.
4811         (Incremental_checker::can_incrementally_link_output_file): Remove.
4812         (Incremental_inputs::report_command_line): Exclude --debug options.
4813         (Incremental_inputs::report_archive_begin): Add parameter; track
4814         argument serial numbers; don't put input file entry for archive
4815         before archive members.
4816         (Incremental_inputs::report_archive_end): Put input file entry
4817         for archive after archive members.
4818         (Incremental_inputs::report_object): Add parameter; track argument
4819         serial numbers and in_system_directory flag.
4820         (Incremental_inputs::report_script): Add parameter; track argument
4821         serial numbers.
4822         (Output_section_incremental_inputs::set_final_data_size): Adjust
4823         size of symbol info entry; check for forwarding symbols.
4824         (Output_section_incremental_inputs::write_input_files): Write
4825         in_system_directory flag and argument serial number.
4826         (Output_section_incremental_inputs::write_info_blocks): Map section
4827         indices between incremental info and original input file; store
4828         input section index for each symbol.
4829         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4830         change operator() to visit().
4831         (class Global_got_offset_visitor): Likewise.
4832         (class Global_symbol_visitor_got_plt):
4833         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4834         classes.
4835         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4836         (Sized_incr_relobj::do_read_symbols): New function.
4837         (Sized_incr_relobj::do_layout): New function.
4838         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4839         (Sized_incr_relobj::do_add_symbols): New function.
4840         (Sized_incr_relobj::do_should_include_member): New function.
4841         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4842         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4843         (Sized_incr_relobj::do_section_size): New function.
4844         (Sized_incr_relobj::do_section_name): New function.
4845         (Sized_incr_relobj::do_section_contents): New function.
4846         (Sized_incr_relobj::do_section_flags): New function.
4847         (Sized_incr_relobj::do_section_entsize): New function.
4848         (Sized_incr_relobj::do_section_address): New function.
4849         (Sized_incr_relobj::do_section_type): New function.
4850         (Sized_incr_relobj::do_section_link): New function.
4851         (Sized_incr_relobj::do_section_info): New function.
4852         (Sized_incr_relobj::do_section_addralign): New function.
4853         (Sized_incr_relobj::do_initialize_xindex): New function.
4854         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4855         (Sized_incr_relobj::do_read_relocs): New function.
4856         (Sized_incr_relobj::do_gc_process_relocs): New function.
4857         (Sized_incr_relobj::do_scan_relocs): New function.
4858         (Sized_incr_relobj::do_count_local_symbols): New function.
4859         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4860         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4861         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4862         (Sized_incr_relobj::do_relocate): New function.
4863         (Sized_incr_relobj::do_set_section_offset): New function.
4864         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4865         (Sized_incr_dynobj::do_read_symbols): New function.
4866         (Sized_incr_dynobj::do_layout): New function.
4867         (Sized_incr_dynobj::do_add_symbols): New function.
4868         (Sized_incr_dynobj::do_should_include_member): New function.
4869         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4870         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4871         (Sized_incr_dynobj::do_section_size): New function.
4872         (Sized_incr_dynobj::do_section_name): New function.
4873         (Sized_incr_dynobj::do_section_contents): New function.
4874         (Sized_incr_dynobj::do_section_flags): New function.
4875         (Sized_incr_dynobj::do_section_entsize): New function.
4876         (Sized_incr_dynobj::do_section_address): New function.
4877         (Sized_incr_dynobj::do_section_type): New function.
4878         (Sized_incr_dynobj::do_section_link): New function.
4879         (Sized_incr_dynobj::do_section_info): New function.
4880         (Sized_incr_dynobj::do_section_addralign): New function.
4881         (Sized_incr_dynobj::do_initialize_xindex): New function.
4882         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4883         (make_sized_incremental_object): New function.
4884         (Incremental_library::copy_unused_symbols): New function.
4885         (Incremental_library::do_for_all_unused_symbols): New function.
4886         * incremental.h (enum Incremental_input_flags): New type.
4887         (class Incremental_checker): Remove.
4888         (Incremental_input_entry::Incremental_input_entry): Add argument
4889         serial number.
4890         (Incremental_input_entry::arg_serial): New function.
4891         (Incremental_input_entry::set_is_in_system_directory): New function.
4892         (Incremental_input_entry::is_in_system_directory): New function.
4893         (Incremental_input_entry::arg_serial_): New data member.
4894         (Incremental_input_entry::is_in_system_directory_): New data member.
4895         (class Script_info): Move here from script.h.
4896         (Script_info::Script_info): Add filename parameter.
4897         (Script_info::filename): New function.
4898         (Script_info::filename_): New data member.
4899         (Incremental_script_entry::Incremental_script_entry): Add argument
4900         serial number.
4901         (Incremental_object_entry::Incremental_object_entry): Likewise.
4902         (Incremental_object_entry::add_input_section): Build list of input
4903         sections with map to original shndx.
4904         (Incremental_object_entry::get_input_section_index): New function.
4905         (Incremental_object_entry::shndx_): New data member.
4906         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4907         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4908         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4909         serial number.
4910         (Incremental_inputs::report_archive_begin): Likewise.
4911         (Incremental_inputs::report_object): Likewise.
4912         (Incremental_inputs::report_script): Likewise.
4913         (class Incremental_global_symbol_reader): New class.
4914         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4915         and store flags and input file type.
4916         (Incremental_input_entry_reader::arg_serial): New function.
4917         (Incremental_input_entry_reader::type): Extract type from flags.
4918         (Incremental_input_entry_reader::is_in_system_directory): New function.
4919         (Incremental_input_entry_reader::get_input_section_count): Call
4920         accessor function for type.
4921         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4922         function for type; adjust size of global symbol entry.
4923         (Incremental_input_entry_reader::get_global_symbol_count): Call
4924         accessor function for type.
4925         (Incremental_input_entry_reader::get_object_count): Likewise.
4926         (Incremental_input_entry_reader::get_object_offset): Likewise.
4927         (Incremental_input_entry_reader::get_member_count): Likewise.
4928         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4929         (Incremental_input_entry_reader::get_member_offset): Likewise.
4930         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4931         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4932         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4933         (Incremental_input_entry_reader::get_global_symbol_reader): New
4934         function.
4935         (Incremental_input_entry_reader::get_output_symbol_index): New
4936         function.
4937         (Incremental_input_entry_reader::type_): Remove.
4938         (Incremental_input_entry_reader::flags_): New data member.
4939         (Incremental_inputs_reader::input_file_offset): New function.
4940         (Incremental_inputs_reader::input_file_index): New function.
4941         (Incremental_inputs_reader::input_file): Call input_file_offset.
4942         (Incremental_inputs_reader::input_file_at_offset): New function.
4943         (Incremental_relocs_reader::get_r_type): Reformat.
4944         (Incremental_relocs_reader::get_r_shndx): Reformat.
4945         (Incremental_relocs_reader::get_r_offset): Reformat.
4946         (Incremental_relocs_reader::data): New function.
4947         (Incremental_binary::Incremental_binary): Initialize new data members.
4948         (Incremental_binary::check_inputs): Add cmdline parameter.
4949         (Incremental_binary::file_is_unchanged): Remove.
4950         (Input_reader::arg_serial): New function.
4951         (Input_reader::get_unused_symbol_count): New function.
4952         (Input_reader::get_unused_symbol): New function.
4953         (Input_reader::do_arg_serial): New function.
4954         (Input_reader::do_get_unused_symbol_count): New function.
4955         (Input_reader::do_get_unused_symbol): New function.
4956         (Incremental_binary::input_file_count): New function.
4957         (Incremental_binary::get_input_reader): Change signature to use
4958         index instead of filename.
4959         (Incremental_binary::file_has_changed): New function.
4960         (Incremental_binary::get_input_argument): New function.
4961         (Incremental_binary::get_library): New function.
4962         (Incremental_binary::get_script_info): New function.
4963         (Incremental_binary::init_layout): New function.
4964         (Incremental_binary::reserve_layout): New function.
4965         (Incremental_binary::output_file): New function.
4966         (Incremental_binary::do_check_inputs): New function.
4967         (Incremental_binary::do_file_is_unchanged): Remove.
4968         (Incremental_binary::do_file_has_changed): New function.
4969         (Incremental_binary::do_init_layout): New function.
4970         (Incremental_binary::do_reserve_layout): New function.
4971         (Incremental_binary::do_input_file_count): New function.
4972         (Incremental_binary::do_get_input_reader): Change signature.
4973         (Incremental_binary::input_args_map_): New data member.
4974         (Incremental_binary::library_map_): New data member.
4975         (Incremental_binary::script_map_): New data member.
4976         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4977         new data members.
4978         (Sized_incremental_binary::output_section): New function.
4979         (Sized_incremental_binary::inputs_reader): Add const.
4980         (Sized_incremental_binary::symtab_reader): Add const.
4981         (Sized_incremental_binary::relocs_reader): Add const.
4982         (Sized_incremental_binary::got_plt_reader): Add const.
4983         (Sized_incremental_binary::get_symtab_view): New function.
4984         (Sized_incremental_binary::Inputs_reader): New typedef.
4985         (Sized_incremental_binary::Input_entry_reader): New typedef.
4986         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4987         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4988         (Sized_incremental_binary::do_file_has_changed): New function.
4989         (Sized_incremental_binary::do_init_layout): New function.
4990         (Sized_incremental_binary::do_reserve_layout): New function.
4991         (Sized_input_reader::Inputs_reader): Remove.
4992         (Sized_input_reader::Input_entry_reader): Remove.
4993         (Sized_input_reader::do_arg_serial): New function.
4994         (Sized_input_reader::do_get_unused_symbol_count): New function.
4995         (Sized_input_reader::do_get_unused_symbol): New function.
4996         (Sized_incremental_binary::do_input_file_count): New function.
4997         (Sized_incremental_binary::do_get_input_reader): Change signature;
4998         use index instead of filename.
4999         (Sized_incremental_binary::section_map_): New data member.
5000         (Sized_incremental_binary::input_entry_readers_): New data member.
5001         (class Sized_incr_relobj): New class.
5002         (class Sized_incr_dynobj): New class.
5003         (make_sized_incremental_object): New function.
5004         (class Incremental_library): New class.
5005         * layout.cc (Free_list::num_lists): New static data member.
5006         (Free_list::num_nodes): New static data member.
5007         (Free_list::num_removes): New static data member.
5008         (Free_list::num_remove_visits): New static data member.
5009         (Free_list::num_allocates): New static data member.
5010         (Free_list::num_allocate_visits): New static data member.
5011         (Free_list::init): New function.
5012         (Free_list::remove): New function.
5013         (Free_list::allocate): New function.
5014         (Free_list::dump): New function.
5015         (Free_list::print_stats): New function.
5016         (Layout_task_runner::run): Resize output file for incremental updates.
5017         (Layout::Layout): Initialize new data members.
5018         (Layout::set_incremental_base): New function.
5019         (Layout::init_fixed_output_section): New function.
5020         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5021         incremental updates.
5022         (Layout::create_gold_note): Do not create gold note section for
5023         incremental updates.
5024         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5025         for incremental updates.
5026         (Layout::set_section_offsets): For incremental updates, allocate space
5027         from free list.
5028         (Layout::create_symtab_sections): Layout with offsets relative to
5029         start of section; for incremental updates, allocate space from free
5030         list.
5031         (Layout::create_shdrs): For incremental updates, allocate space from
5032         free list.
5033         (Layout::finish_dynamic_section): For incremental updates, do not
5034         check --as-needed (fixed in subsequent patch).
5035         * layout.h (class Free_list): New class.
5036         (Layout::set_incremental_base): New function.
5037         (Layout::incremental_base): New function.
5038         (Layout::init_fixed_output_section): New function.
5039         (Layout::allocate): New function.
5040         (Layout::incremental_base_): New data member.
5041         (Layout::free_list_): New data member.
5042         * main.cc (main): Print Free_list statistics.
5043         * object.cc (Relobj::finalize_incremental_relocs): Add
5044         clear_counts parameter; clear counts only when clear_counts is set.
5045         (Sized_relobj::Sized_relobj): Initialize new base class.
5046         (Sized_relobj::do_layout): Don't report special sections.
5047         (Sized_relobj::do_for_all_local_got_entries): New function.
5048         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5049         symtab_off to all symbol table offsets.
5050         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5051         * object.h (class Got_offset_list): Move to top of file.
5052         (Object::Object): Allow case where input_file == NULL.
5053         (Object::~Object): Likewise.
5054         (Object::input_file): Assert that input_file != NULL.
5055         (Object::lock): Allow case where input_file == NULL.
5056         (Object::unlock): Likewise.
5057         (Object::is_locked): Likewise.
5058         (Object::token): Likewise.
5059         (Object::release): Likewise.
5060         (Object::is_incremental): New function.
5061         (Object::get_mtime): New function.
5062         (Object::for_all_local_got_entries): New function.
5063         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5064         (Object::set_is_in_system_directory): New function.
5065         (Object::is_in_system_directory): New function.
5066         (Object::do_is_incremental): New function.
5067         (Object::do_get_mtime): New function.
5068         (Object::do_for_all_local_got_entries): New function.
5069         (Object::is_in_system_directory_): New data member.
5070         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5071         (class Sized_relobj_base): New class.
5072         (class Sized_relobj): Derive from Sized_relobj_base.
5073         (class Sized_relobj::Symbols): Redeclare from base class.
5074         (class Sized_relobj::local_got_offset_list): Remove.
5075         (class Sized_relobj::Output_sections): Redeclare from base class.
5076         (class Sized_relobj::do_for_all_local_got_entries): New function.
5077         (class Sized_relobj::write_local_symbols): Add offset parameter.
5078         (class Sized_relobj::local_symbol_offset_): Update comment.
5079         (class Sized_relobj::local_dynsym_offset_): Update comment.
5080         * options.cc (Input_arguments::add_file): Remove const.
5081         * options.h (Input_file_argument::Input_file_argument):
5082         Initialize arg_serial_ (all constructors).
5083         (Input_file_argument::set_arg_serial): New function.
5084         (Input_file_argument::arg_serial): New function.
5085         (Input_file_argument::arg_serial_): New data member.
5086         (Input_arguments::Input_arguments): Initialize file_count_.
5087         (Input_arguments::add_file): Remove const.
5088         (Input_arguments::number_of_input_files): New function.
5089         (Input_arguments::file_count_): New data member.
5090         (Command_line::number_of_input_files): Call
5091         Input_arguments::number_of_input_files.
5092         * output.cc (Output_segment_headers::Output_segment_headers):
5093         Set current size.
5094         (Output_section::Input_section::current_data_size): New function.
5095         (Output_section::Output_section): Initialize new data members.
5096         (Output_section::add_input_section): Don't do merge sections for
5097         an incremental link; allocate space from free list for an
5098         incremental update.
5099         (Output_section::add_output_section_data): Allocate space from
5100         free list for an incremental update.
5101         (Output_section::update_data_size): New function.
5102         (Output_section::set_fixed_layout): New function.
5103         (Output_section::reserve): New function.
5104         (Output_segment::set_section_addresses): Remove const.
5105         (Output_segment::set_section_list_addresses): Remove const; allocate
5106         space from free list for an incremental update.
5107         (Output_segment::set_offset): Adjust size of RELRO segment for an
5108         incremental update.
5109         * output.h (Output_data::current_data_size): Move here from
5110         child classes.
5111         (Output_data::pre_finalize_data_size): New function.
5112         (Output_data::update_data_size): New function.
5113         (Output_section_headers::update_data_size): new function.
5114         (Output_section_data_build::current_data_size): Move to Output_data.
5115         (Output_data_strtab::update_data_size): New function.
5116         (Output_section::current_data_size): Move to Output_data.
5117         (Output_section::set_fixed_layout): New function.
5118         (Output_section::has_fixed_layout): New function.
5119         (Output_section::reserve): New function.
5120         (Output_section::update_data_size): New function.
5121         (Output_section::has_fixed_layout_): New data member.
5122         (Output_section::free_list_): New data member.
5123         (Output_segment::set_section_addresses): Remove const.
5124         (Output_segment::set_section_list_addresses): Remove const.
5125         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5126         New function.
5127         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5128         New function.
5129         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5130         parameter when calling Add_symbols constructor; store argument
5131         serial number for members of a lib group.
5132         (Add_symbols::locks): Allow case where token == NULL.
5133         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5134         (Read_member::~Read_member): New function.
5135         (Read_member::is_runnable): New function.
5136         (Read_member::locks): New function.
5137         (Read_member::run): New function.
5138         (Check_script::~Check_script): New function.
5139         (Check_script::is_runnable): New function.
5140         (Check_script::locks): New function.
5141         (Check_script::run): New function.
5142         (Check_library::~Check_library): New function.
5143         (Check_library::is_runnable): New function.
5144         (Check_library::locks): New function.
5145         (Check_library::run): New function.
5146         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5147         (Add_symbols::library_): New data member.
5148         (class Read_member): New class.
5149         (class Check_script): New class.
5150         (class Check_library): New class.
5151         * reloc.cc (Read_relocs::is_runnable): Allow case where
5152         token == NULL.
5153         (Read_relocs::locks): Likewise.
5154         (Scan_relocs::locks): Likewise.
5155         (Relocate_task::locks): Likewise.
5156         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5157         to clear counters.
5158         (Sized_relobj::incremental_relocs_scan): Fix comment.
5159         (Sized_relobj::do_relocate): Pass output file offset to
5160         write_local_symbols.
5161         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5162         from class declaration.
5163         * script.cc (read_input_script): Allocate Script_info; pass
5164         argument serial number to report_script.
5165         * script.h (class Script_info): Move to incremental.h.
5166         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5167         * symtab.h (Symbol_table::add_from_incrobj): New function.
5168         (Symbol_table::set_file_offset): New function.
5169
5170 2011-04-05  Cary Coutant  <ccoutant@google.com>
5171
5172         * incremental-dump.cc (dump_incremental_inputs): Change signature
5173         to take a Sized_incremental_binary; change caller.  Use readers
5174         in Sized_incremental_binary.
5175         * incremental.cc
5176         (Sized_incremental_binary::find_incremental_inputs_sections):
5177         Rename do_find_incremental_inputs_sections to this.
5178         (Sized_incremental_binary::setup_readers): New function.
5179         (Sized_incremental_binary::do_check_inputs): Check
5180         has_incremental_info_ flag; move setup code to setup_readers;
5181         use input readers.
5182         (Sized_incremental_binary::do_file_is_unchanged): New function.
5183         (Sized_incremental_binary::do_get_input_reader): New function.
5184         * incremental.h (class Incremental_binary): Move to end of file.
5185         (Incremental_binary::file_is_unchanged): New function.
5186         (Incremental_binary::do_file_is_unchanged): New function.
5187         (Incremental_binary::Input_reader): New class.
5188         (Incremental_binary::get_input_reader): New function.
5189         (class Sized_incremental_binary): Move to end of file.
5190         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5191         input section reader classes.
5192         (Sized_incremental_binary::has_incremental_info): New function.
5193         (Sized_incremental_binary::inputs_reader): New function.
5194         (Sized_incremental_binary::symtab_reader): New function.
5195         (Sized_incremental_binary::relocs_reader): New function.
5196         (Sized_incremental_binary::got_plt_reader): New function.
5197         (Sized_incremental_binary::do_file_is_unchanged): New function.
5198         (Sized_incremental_binary::Sized_input_reader): New class.
5199         (Sized_incremental_binary::get_input_reader): New function.
5200         (Sized_incremental_binary::find_incremental_inputs_sections):
5201         Rename do_find_incremental_inputs_sections to this.
5202         (Sized_incremental_binary::setup_readers): New function.
5203         (Sized_incremental_binary::has_incremental_info_): New data member.
5204         (Sized_incremental_binary::inputs_reader_): New data member.
5205         (Sized_incremental_binary::symtab_reader_): New data member.
5206         (Sized_incremental_binary::relocs_reader_): New data member.
5207         (Sized_incremental_binary::got_plt_reader_): New data member.
5208         (Sized_incremental_binary::current_input_file_): New data member.
5209
5210 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5211
5212         PR gold/12640
5213         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5214         violation.
5215
5216 2011-03-30  Cary Coutant  <ccoutant@google.com>
5217
5218         * archive.cc (Archive::include_member): Adjust call to report_object.
5219         (Add_archive_symbols::run): Add script_info to call to
5220         report_archive_begin.
5221         (Lib_group::include_member): Adjust call to report_object.
5222         (Add_lib_group_symbols::run): Adjust call to report_object.
5223         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5224         blocks.  Add object count for script input files.
5225         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5226         script_info parameter; change all callers.
5227         (Incremental_inputs::report_object): Add script_info parameter;
5228         change all callers.
5229         (Incremental_inputs::report_script): Store backpointer to
5230         incremental info entry.
5231         (Output_section_incremental_inputs::set_final_data_size): Record
5232         additional information for scripts.
5233         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5234         * incremental.h (Incremental_script_entry::add_object): New function.
5235         (Incremental_script_entry::get_object_count): New function.
5236         (Incremental_script_entry::get_object): New function.
5237         (Incremental_script_entry::objects_): New data member; adjust
5238         constructor.
5239         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5240         (Incremental_inputs::report_object): Add script_info parameter.
5241         (Incremental_inputs_reader::get_object_count): New function.
5242         (Incremental_inputs_reader::get_object_offset): New function.
5243         * options.cc (Input_arguments::add_file): Return reference to
5244         new input argument.
5245         * options.h (Input_argument::set_script_info): New function.
5246         (Input_argument::script_info): New function.
5247         (Input_argument::script_info_): New data member; adjust all
5248         constructors.
5249         (Input_file_group::add_file): Return reference to new input argument.
5250         (Input_file_lib::add_file): Likewise.
5251         (Input_arguments::add_file): Likewise.
5252         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5253         * script.cc (Parser_closure::Parser_closure): Add script_info
5254         parameter; adjust all callers.
5255         (Parser_closure::script_info): New function.
5256         (Parser_closure::script_info_): New data member.
5257         (read_input_script): Report scripts earlier to incremental info.
5258         (script_add_file): Set script_info in Input_argument.
5259         (script_add_library): Likewise.
5260         * script.h (Script_options::Script_info): Rewrite class.
5261
5262 2011-03-29  Cary Coutant  <ccoutant@google.com>
5263
5264         * archive.cc (Library_base::should_include_member): Move
5265         method here from class Archive.
5266         (Archive::Archive): Initialize base class.
5267         (Archive::should_include_member): Move to base class.
5268         (Archive::do_for_all_unused_symbols): New function.
5269         (Add_archive_symbols::run): Remove redundant access to
5270         incremental_inputs.
5271         (Lib_group::Lib_group): Initialize base class.
5272         (Lib_group::do_filename): New function.
5273         (Lib_group::include_member): Pass pointer to Lib_group to
5274         report_object.
5275         (Lib_group::do_for_all_unused_symbols): New function.
5276         (Add_lib_group_symbols::run): Report archive information for
5277         incremental links.
5278         * archive.h (class Library_base): New base class.
5279         (class Archive): Derive from Library_base.
5280         (Archive::filename): Move to base class.
5281         (Archive::set_incremental_info): Likewise.
5282         (Archive::incremental_info): Likewise.
5283         (Archive::Should_include): Likewise.
5284         (Archive::should_include_member): Likewise.
5285         (Archive::Armap_entry): Remove.
5286         (Archive::Unused_symbol_iterator): Remove.
5287         (Archive::unused_symbols_begin): Remove.
5288         (Archive::unused_symbols_end): Remove.
5289         (Archive::do_filename): New function.
5290         (Archive::do_get_mtime): New function.
5291         (Archive::do_for_all_unused_symbols): New function.
5292         (Archive::task_): Move to base class.
5293         (Archive::incremental_info_): Likewise.
5294         (class Lib_group): Derive from Library_base.
5295         (Lib_group::do_filename): New function.
5296         (Lib_group::do_get_mtime): New function.
5297         (Lib_group::do_for_all_unused_symbols): New function.
5298         (Lib_group::task_): Move to base class.
5299         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5300         function.
5301         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5302         function.
5303         * incremental.cc (Incremental_inputs::report_archive_begin):
5304         Use Library_base; call library's get_mtime; add incremental inputs
5305         entry before members.
5306         (class Unused_symbol_visitor): New class.
5307         (Incremental_inputs::report_archive_end): Use Library_base; use
5308         visitor class to record unused symbols; don't add incremental inputs
5309         entry after members.
5310         (Incremental_inputs::report_object): Use Library_base.
5311         * incremental.h
5312         (Incremental_archive_entry::Incremental_archive_entry): Remove
5313         unused Archive parameter.
5314         (Incremental_inputs::report_archive_begin): Use Library_base.
5315         (Incremental_inputs::report_archive_end): Likewise.
5316         (Incremental_inputs::report_object): Likewise.
5317         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5318         function.
5319         * object.h (Object::for_all_global_symbols): New function.
5320         (Object::do_for_all_global_symbols): New function.
5321         (Sized_relobj::do_for_all_global_symbols): New function.
5322         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5323         function.
5324         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5325         function.
5326
5327 2011-03-27  Ian Lance Taylor  <iant@google.com>
5328
5329         * archive.cc (Archive::interpret_header): Return -1 if something
5330         goes wrong.  Change callers accordingly.
5331
5332 2011-03-25  Cary Coutant  <ccoutant@google.com>
5333
5334         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5335         * testsuite/Makefile.in: Regenerate.
5336
5337 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5338
5339         * plugin.cc (get_view): New.
5340         (Plugin::load): Pass get_view to the plugin.
5341         (Plugin_manager::get_view): New.
5342
5343 2011-03-21  Ian Lance Taylor  <iant@google.com>
5344
5345         * testsuite/final_layout.sh: Rewrite to not use dc.
5346         * testsuite/relro_test.sh: Fail if dc is not present.
5347
5348 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5349
5350         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5351         Change == to -eq.
5352         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5353         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5354         Change == to -eq.
5355         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5356         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5357
5358 2011-03-14  Ian Lance Taylor  <iant@google.com>
5359
5360         * script-sections.cc (Sort_output_sections::script_compare):
5361         Rename from is_before, change return type.
5362         (Sort_output_sections::operator()): Adjust accordingly.
5363
5364 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5365
5366         PR gold/12572
5367         * testsuite/odr_violation2.cc: Add comment to make all error line
5368         numbers double digits.
5369         * testsuite/debug_msg.sh: Adjust expected errors.
5370
5371 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5372
5373         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5374         but mark earlier ones as non-canonical
5375         (offset_to_iterator): Update search target and example
5376         (do_addr2line): Return extra lines in a vector*
5377         (format_file_lineno): Extract from do_addr2line
5378         (one_addr2line): Add vector* out-param
5379         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5380         when a lineno entry appeared last for its instruction
5381         (Dwarf_line_info): Add vector* out-param
5382         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5383         * symtab.cc (Odr_violation_compare): Include the lineno in the
5384         comparison again.
5385         (linenos_from_loc): New. Combine the canonical line for an
5386         address with its other lines.
5387         (True_if_intersect): New. Helper functor to make
5388         std::set_intersection a query.
5389         (detect_odr_violations): Compare sets of lines instead of just
5390         one line for each function. This became less deterministic, but
5391         has fewer false positives.
5392         * symtab.h: Declarations.
5393         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5394         mix an optimized and non-optimized object in the same binary
5395         (odr_violation2.so): Same.
5396         * testsuite/Makefile.in: Regenerate from Makefile.am.
5397         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5398         * testsuite/debug_msg.sh: Update line numbers and add
5399         assertions.
5400         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5401         non-optimized context.
5402         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5403         isn't inlined, and use OdrDerived in an optimized context.
5404         * testsuite/odr_header1.h: Defines OdrDerived, where
5405         optimization will change the
5406         first-instruction-in-the-destructor's file and line number.
5407         * testsuite/odr_header2.h: Defines OdrBase.
5408
5409 2011-03-09  Ian Lance Taylor  <iant@google.com>
5410
5411         * fileread.cc (File_read::clear_views): Don't delete the whole
5412         file view.
5413
5414 2011-03-08  Ian Lance Taylor  <iant@google.com>
5415
5416         PR gold/12525
5417         * fileread.cc: #include <climits>.
5418         (GOLD_IOV_MAX): Define.
5419         (File_read::read_multiple): Limit number of entries by iov_max.
5420         * fileread.h (class File_read): Always set max_readv_entries to
5421         128.
5422
5423 2011-03-07  Ian Lance Taylor  <iant@google.com>
5424
5425         PR gold/12525
5426         * options.h (class General_options): Add -dy and -dn.
5427
5428 2011-03-02  Cary Coutant  <ccoutant@google.com>
5429
5430         * testsuite/script_test_9.t: Add TLS segment.
5431
5432 2011-03-02  Simon Baldwin  <simonb@google.com>
5433
5434         * configure.ac: Add check for gnu_indirect_function support in
5435         the toolchain building binutils.
5436         * configure: Rebuild.
5437
5438 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5439
5440         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5441         plugin only symbols.
5442         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5443         in plugin files as not needed in the symbol table.
5444
5445 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5446
5447         * output.cc (Output_section::add_input_section): Delay fill
5448         generation for section ordering.
5449
5450 2011-02-09  Ian Lance Taylor  <iant@google.com>
5451
5452         PR gold/12316
5453         * object.h (class Sized_relobj): Remove clear_local_symbols.
5454         * reloc.cc (Sized_relobj::do_relocate): Don't call
5455         clear_local_symbols.
5456
5457 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5458
5459         * plugin.cc (is_visible_from_outside): Return true for symbols
5460         in the -u option.
5461
5462 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5463
5464         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5465         filename.
5466
5467 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5468
5469         * icf.h (is_section_foldable_candidate): Change type of parameter
5470         to std::string.
5471         * icf.cc (Icf::find_identical_sections): Change type of local variable
5472         section_name to be std::string.
5473         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5474
5475 2011-01-25  Ian Lance Taylor  <iant@google.com>
5476
5477         * script.cc (script_add_extern): Rewrite to use
5478         add_symbol_reference.
5479
5480 2011-01-25  Doug Kwan  <dougkwan@google.com>
5481
5482         * icf.cc (get_section_contents): Always lock section's object.
5483
5484 2011-01-24  Ian Lance Taylor  <iant@google.com>
5485
5486         * options.h (class General_options): Accept
5487         --no-detect-odr-violations.
5488
5489 2011-01-24  Ian Lance Taylor  <iant@google.com>
5490
5491         * version.cc (version_string): Bump to 1.11.
5492
5493 2011-01-24  Ian Lance Taylor  <iant@google.com>
5494
5495         * plugin.cc (class Plugin_rescan): Define new class.
5496         (Plugin_manager::claim_file): Set any_claimed_.
5497         (Plugin_manager::save_archive): New function.
5498         (Plugin_manager::save_input_group): New function.
5499         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5500         necessary.
5501         (Plugin_manager::new_undefined_symbol): New function.
5502         (Plugin_manager::rescan): New function.
5503         (Plugin_manager::rescannable_defines): New function.
5504         (Plugin_manager::add_input_file): Set any_added_.
5505         * plugin.h (class Plugin_manager): define new fields rescannable_,
5506         undefined_symbols_, any_claimed_, and any_added_.  Declare
5507         Plugin_rescan as friend.  Declare new functions.
5508         (Plugin_manager::Rescannable): Define type.
5509         (Plugin_manager::Rescannable_list): Define type.
5510         (Plugin_manager::Undefined_symbol_list): Define type.
5511         (Plugin_manager::Plugin_manager): Initialize new fields.
5512         * archive.cc (Archive::defines_symbol): New function.
5513         (Add_archive_symbols::run): Pass archive to plugins if any.
5514         * archive.h (class Archive): Declare defines_symbol.
5515         * readsyms.cc (Input_group::~Input_group): New function.
5516         (Finish_group::run): Pass input_group to plugins if any.
5517         * readsyms.h (class Input_group): Declare destructor.
5518         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5519         any.
5520
5521 2011-01-10  Ian Lance Taylor  <iant@google.com>
5522
5523         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5524         section as relro.
5525         (Layout::set_segment_offsets): Reset increase_relro before calling
5526         set_section_addresses a second time.
5527
5528 2011-01-04  Cary Coutant  <ccoutant@google.com>
5529
5530         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5531         sections before NOBITS sections.
5532
5533 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5534
5535         * version.cc (print_version): Update copyright to 2011.
5536
5537 2010-12-23  Cary Coutant  <ccoutant@google.com>
5538
5539         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5540         of OS to this->add.  Add OD parameter to second form of the function.
5541
5542 2010-12-20  Ian Lance Taylor  <iant@google.com>
5543
5544         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5545         second of two consecutive entries with same offset.
5546
5547 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5548
5549         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5550         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5551         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5552         to avoid unneeded links against $(LDADD).
5553         * testsuite/Makefile.in: Regenerate.
5554
5555 2010-12-15  Ian Lance Taylor  <iant@google.com>
5556
5557         PR gold/12324
5558         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5559         for R_X86_64_32 and R_X86_64_PC32.
5560         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5561         ver_matching_def_pic.o.
5562         (ver_matching_def_pic.o): New target.
5563
5564 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5565
5566         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5567         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5568         Move definition before File_read::View member definitions.
5569         (File_read::View::~View): Initialize and hold lock before
5570         updating current_mapped_bytes.
5571
5572 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5573
5574         * dwarf_reader.cc: Remove outdated comment.
5575         * gold-threads.cc: Fix typo in error message.
5576         * archive.cc: Fix typos in comments.
5577         * archive.h: Likewise.
5578         * arm-reloc-property.cc: Likewise.
5579         * arm-reloc-property.h: Likewise.
5580         * arm-reloc.def: Likewise.
5581         * arm.cc: Likewise.
5582         * attributes.h: Likewise.
5583         * cref.cc: Likewise.
5584         * ehframe.cc: Likewise.
5585         * fileread.h: Likewise.
5586         * gold.h: Likewise.
5587         * i386.cc: Likewise.
5588         * icf.cc: Likewise.
5589         * incremental.h: Likewise.
5590         * int_encoding.cc: Likewise.
5591         * layout.h: Likewise.
5592         * main.cc: Likewise.
5593         * merge.h: Likewise.
5594         * object.cc: Likewise.
5595         * object.h: Likewise.
5596         * options.cc: Likewise.
5597         * readsyms.cc: Likewise.
5598         * reduced_debug_output.cc: Likewise.
5599         * reloc.cc: Likewise.
5600         * script-sections.cc: Likewise.
5601         * sparc.cc: Likewise.
5602         * symtab.h: Likewise.
5603         * target-reloc.h: Likewise.
5604         * target.cc: Likewise.
5605         * target.h: Likewise.
5606         * timer.cc: Likewise.
5607         * timer.h: Likewise.
5608         * x86_64.cc: Likewise.
5609
5610 2010-12-09  Cary Coutant  <ccoutant@google.com>
5611
5612         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5613         stack.
5614         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5615         parameter; change all callers.
5616         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5617         * options.h (warn_execstack): New option.
5618
5619 2010-12-07  Doug Kwan  <dougkwan@google.com>
5620
5621         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5622         like function call relocations.
5623
5624 2010-12-07  Ian Lance Taylor  <iant@google.com>
5625
5626         * archive.cc (Archive::get_elf_object_for_member): Permit
5627         punconfigured to be NULL.
5628         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5629         (Archive::include_member): Pass NULL to get_elf_object_for_member
5630         if we searched for the archive and this is the first included
5631         object.
5632
5633 2010-12-01  Ian Lance Taylor  <iant@google.com>
5634
5635         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5636         track_relocs_type_ field.
5637         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5638         Set track_relocs_type_.
5639         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5640         contents when using RELA relocs.
5641         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5642         reloc_map_.
5643         * reloc.cc (Track_relocs::next_addend): New function.
5644         * reloc.h (class Track_relocs): Declare next_addend.
5645
5646 2010-12-01  Ian Lance Taylor  <iant@google.com>
5647
5648         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5649         virtual destructor.
5650
5651 2010-12-01  Ian Lance Taylor  <iant@google.com>
5652
5653         * README: Update compilers known to work and fail.
5654
5655 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5656
5657         * configure.in: For --enable-gold, handle value `default' instead of
5658         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5659         not the default.
5660         * configure: Regenerate.
5661
5662 2010-11-18  Doug Kwan  <dougkwan@google.com>
5663
5664         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5665         and right_alignment to be zero.  Store result alignment only if it is
5666         greater than existing alignment.
5667
5668 2010-11-16  Cary Coutant  <ccoutant@google.com>
5669
5670         PR gold/12220
5671         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5672         Check for ".zdebug_line".
5673
5674 2010-11-16  Doug Kwan  <dougkwan@google.com>
5675             Cary Coutant  <ccoutant@google.com>
5676
5677         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5678         by reference; adjust all callers.
5679         * output.cc (Output_segment::set_section_addresses): Adjust references
5680         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5681         list is empty.
5682         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5683         end at page boundary.
5684
5685 2010-11-16  Cary Coutant  <ccoutant@google.com>
5686
5687         PR gold/12220
5688         * layout.cc (Layout::choose_output_section): Transform names of
5689         compressed sections even when using a script with a SECTIONS clause.
5690         (Layout::output_section_name): Remove code to transform
5691         compressed debug section names.
5692         * output.cc (Output_section::add_input_section): Use uncompressed
5693         section size when tracking input sections.
5694
5695 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5696
5697         * symtab.h (Symbol::NON_PIC_REF): Remove.
5698         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5699         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5700         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5701         (Symbol::use_plt_offset): Take a flags argument and pass it
5702         directly to needs_dynamic_reloc.  Restrict check for undefined
5703         weak symbols to function calls.
5704         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5705         (Target_arm::Scan::global): Use it.
5706         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5707         (Target_arm::Relocate::relocate): Likewise.
5708         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5709         parameter with an r_type parameter.  Use get_reference_flags
5710         to get the flags.
5711         (Target_arm::Relocate::relocate): Update accordingly.
5712         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5713         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5714         (Target_i386::Scan::global): Likewise.
5715         (Target_i386::Relocate::relocate): Likewise.
5716         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5717         parameter with an r_type parameter.  Use get_reference_flags
5718         to get the flags.
5719         (Target_i386::Relocate::relocate): Update accordingly.
5720         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5721         (Target_powerpc::Scan::global): Use it.
5722         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5723         (Target_powerpc::Relocate::relocate): Likewise.
5724         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5725         (Target_sparc::Scan::global): Use it.
5726         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5727         (Target_sparc::Relocate::relocate): Likewise.
5728         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5729         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5730         (Target_x86_64::Scan::global): Likewise.
5731         (Target_x86_64::Relocate::relocate): Likewise.
5732
5733 2010-11-08  Doug Kwan  <dougkwan@google.com>
5734             Cary Coutant  <ccoutant@google.com>
5735
5736         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5737         (Arm_exidx_merge_section::section_contents_): New data member.
5738         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5739         (Arm_input_section::~Arm_input_section): De-allocate memory.
5740         (Arm_input_section::original_contents_): New data member.
5741         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5742         in parameters instead of calling Object::section_contents without
5743         locking.
5744         (Arm_output_section::group_section): New parameter TASK.  Pass it
5745         to callees that need locking objects.
5746         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5747         to lock EXIDX input sections.  Fix a formatting issue.  Call
5748         Arm_exidx_merged_section::build_contents to create merged section
5749         contents.
5750         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5751         to lock object of stub table owner.
5752         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5753         TEXT_SIZE to initialize data member TEXT_SIZE_.
5754         (Arm_exidx_input_section::addralign): Fix typo in comment.
5755         (Arm_exidx_input_section::text_size): New method.
5756         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5757         that require locking objects.  Lock objects before scanning for stubs
5758         and updating local symbols.
5759         (Arm_input_section<big_endian>::init): Copy contents of original
5760         input section.
5761         (Arm_input_section<big_endian>::do_write): Use saved contents of
5762         original input section instead of calling Object::section_contents
5763         without locking.
5764         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5765         size without calling Object::section_size().
5766         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5767         for size.  Allocate a buffer for merged EXIDX entries.
5768         (Arm_exidx_merged_section::build_contents): New method.
5769         (Arm_exidx_merged_section::do_write): Move merge section contents
5770         building code to Arm_exidx_merged_section::build_contetns.  Write
5771         out contetns in buffer instead of building it on the fly.
5772         (Arm_relobj::make_exidx_input_section): Also pass text section size
5773         to Arm_exidx_input_section constructor.
5774         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5775         (Arm_dynobj::do_read_symbols): Fix memory leak.
5776         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5777         * target.h: (class Task): Add forward declaration.
5778         (Target::relax): Add new parameter TASK and pass it to
5779         Target::do_relax().
5780         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5781
5782 2010-11-05  Cary Coutant  <ccoutant@google.com>
5783
5784         PR gold/10708
5785         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5786         object when reading from the file.
5787         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5788         second layout pass.
5789         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5790         when reading section contents.
5791         (get_section_contents): Likewise.
5792         (icf::find_identical_sections): Likewise.
5793         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5794         object when reading from the file.
5795         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5796         the object when doing deferred section layout.
5797
5798 2010-11-03  Nick Clifton  <nickc@redhat.com>
5799
5800         PR gold/12001
5801         * script.h (class Symbol_assignment: name): New member.  Returns
5802         the name of the symbol.
5803         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5804         Returns true if the given symbol name is on the list of
5805         assignments wating to be processed.
5806         * archive.cc (should_incldue_member): If the symbol is undefined,
5807         check to see if it is on the list of symbols pending assignment.
5808
5809 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5810
5811         * script-sections.cc (Script_sections::find_memory_region): Check
5812         for a NULL output section pointer.
5813
5814 2010-10-29  Doug Kwan  <dougkwan@google.com>
5815
5816         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5817         Output_section::add_relaxed_input_section.
5818         * output.cc (Output_section::add_relaxed_input_section): Add new
5819         arguments LAYOUT and NAME.  Set section order index.
5820         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5821         Copy section order index.
5822         * output.h (Output_section::add_relaxed_input_section): Add new
5823         arguments LAYOUT and NAME.
5824
5825 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5826
5827         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5828         NATIVE_OR_CROSS_LINKER.
5829         * testsuite/Makefile.in: Regenerate.
5830
5831 2010-10-20  Doug Kwan  <dougkwan@google.com>
5832
5833         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5834         without SHF_LINK_ORDER flags.
5835         * layout.cc (Layout::choose_output_section): Do not filter
5836         SHF_LINK_ORDER flag in a relocatable link.
5837
5838 2010-10-17  Cary Coutant  <ccoutant@google.com>
5839
5840         * output.h (Output_segment::set_section_addresses): Change function
5841         signature.  Update all callers.
5842         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5843         sections.
5844         (Output_segment::set_section_addresses): Align after last TLS
5845         section.  Add padding before last relro section instead of after.
5846
5847 2010-10-17  Doug Kwan  <dougkwan@google.com>
5848
5849         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5850         GOT output section to be writable.
5851
5852 2010-10-14  Cary Coutant  <ccoutant@google.com>
5853
5854         * debug.h (DEBUG_INCREMENTAL): New flag.
5855         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5856         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5857         mode.
5858         * incremental.cc (report_command_line): Ignore all forms of
5859         --incremental.
5860         * layout.cc (Layout::Layout): Check parameters for incremental link
5861         mode.
5862         * options.cc (General_options::parse_incremental): New function.
5863         (General_options::parse_no_incremental): New function.
5864         (General_options::parse_incremental_full): New function.
5865         (General_options::parse_incremental_update): New function.
5866         (General_options::incremental_mode_): New data member.
5867         (General_options::finalize): Check incremental_mode_.
5868         * options.h (General_options): Update help text for --incremental.
5869         Add --no-incremental, --incremental-full, --incremental-update.
5870         (General_options::Incremental_mode): New enum type.
5871         (General_options::incremental_mode): New function.
5872         (General_options::incremental_mode_): New data member.
5873         * parameters.cc (Parameters::incremental_mode_): New data member.
5874         (Parameters::set_options): Set incremental_mode_.
5875         (Parameters::set_incremental_full): New function.
5876         (Parameters::incremental): New function.
5877         (Parameters::incremental_update): New function.
5878         (set_parameters_incremental_full): New function.
5879         * parameters.h (Parameters::set_incremental_full): New function.
5880         (Parameters::incremental): New function.
5881         (Parameters::incremental_update): New function.
5882         (Parameters::incremental_mode_): New data member.
5883         (set_parameters_incremental_full): New function.
5884         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5885         incremental link mode.
5886         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5887         (Sized_relobj::do_relocate_sections): Likewise.
5888         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5889         option.
5890         * testsuite/Makefile.in: Regenerate.
5891         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5892
5893 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5894
5895         * script-sections.h (class Script_sections): Make
5896         Sections_elements typedef public.
5897         * script-sections.cc (class Sort_output_sections): Add elements_
5898         field.  Add constructor which sets it; change all callers.
5899         (Sort_output_sections::is_before): New function.
5900         (Sort_output_sections::operator()): Call is_before.
5901         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5902         conditional.
5903         * testsuite/script_test_10.sh: New test. Test script section
5904         order.
5905         * testsuite/script_test_10.t: Likewise.
5906         * testsuite/script_test_10.s: Likewise.
5907         * testsuite/Makefile.am: Wrap the cross linker tests and the
5908         common tests into NATIVE_OR_CROSS_LINKER.
5909         (check_SCRIPTS): Add script_test_10.sh.
5910         (check_DATA): Add script_test_10.stdout.
5911         (script_test_10.o, script_test_10): New targets.
5912         (script_test_10.stdout): New target.
5913         * configure, testsuite/Makefile.in: Regenerate.
5914
5915 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5916
5917         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5918         error for the deprecated relocations.
5919         (Target_arm::Scan::global): Likewise.
5920         (Target_arm::Relocate::relocate): Likewise.
5921
5922 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5923
5924         * fileread.cc (Input_file::find_file): Initialize *found_name
5925         and *namep when using the fallback search for case 4.
5926
5927 2010-10-11  Cary Coutant  <ccoutant@google.com>
5928
5929         * options.h (class General_options): Redefine -z lazy as an alias for
5930         the negation of -z now.
5931
5932 2010-10-11  Ian Lance Taylor  <iant@google.com>
5933
5934         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5935         binding.
5936
5937 2010-10-06  Nick Clifton  <nickc@redhat.com>
5938
5939         * script-sections.cc(class Memory_region): Remove
5940         current_lma_offset_ field.  Rename current_vma_offset_ to
5941         current_offset_.  Add last_section_ field.
5942         (Memory_region::get_current_vma_address): Rename to
5943         get_current_address.
5944         (Memory_region::get_current_lma_address): Delete.
5945         (Memory_region::increment_vma_offset): Rename to
5946         increment_offset.
5947         (Memory_region::increment_lma_offset): Delete.
5948         (Memory_region::attributes_compatible): New method.  Returns
5949         true if the provided section is compatible with the region.
5950         (Memory_region::get_last_section): New method.  Returns the last
5951         section to use the region.
5952         (Memory_region::set_last_section): New method.  Stores the last
5953         section to use the region.
5954         (Script_sections::block_in_region): New method.  Returns true if
5955         a block of memory is contained within a region.
5956         (Script_sections::find_memory_region): New method.  Locates a
5957         memory region to be used to set a VMA or LMA address.
5958         (Output_section_definition::set_section_addresses): Add code to
5959         check for addresses set by memory regions.
5960         (Output_segment::set_section_addresses): Remove memory region
5961         walking code.
5962         (Script_sections::create_segment): Add a warning if a header
5963         segment is created outside of any region.
5964         * script-sections.h (class Script_sections): Add prototypes for
5965         find_memory_region and block_in_region methods.
5966         * testsuite/memory_test.s: Use .long instead of .word.
5967         * testsuite/memory_test.t: Add some more output sections.
5968         * testsuite/memory_test.sh: Update expected output.
5969
5970 2010-10-02  Doug Kwan  <dougkwan@google.com>
5971
5972         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5973         defintion to symtab.h
5974         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5975         declaration to defintion.
5976
5977 2010-10-01  Nick Clifton  <nickc@redhat.com>
5978
5979         * expression.cc (eval): Replace dummy argument with NULL.
5980         (eval_maybe_dot): Check for a NULL result section pointer.
5981         (Symbol_expression::value): Likewise.
5982         (Dot_expression::value): Likewise.
5983         (BINARY_EXPRESSION): Likewise.
5984         (Max_expression::value): Likewise.
5985         (Min_expression::value): Likewise.
5986         (Absolute_expression::value): Likewise.
5987         (Addr_expression::value_from_output_section): Likewise.
5988         (Loaddddr_expression::value_from_output_section): Likewise.
5989         (Segment_start_expression::value): Likewise.
5990         * script-sections.cc
5991         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5992         argument with NULL.
5993         (Sections_elememt_dot_assignment::set_section_addresses):
5994         Likewise.
5995         (Output_data_expression::do_write_to_buffer): Likewise.
5996         (Output_section_definition::finalize_symbols): Likewise.
5997         (Output_section_definition::set_section_addresses): Likewise.
5998
5999 2010-09-30  Doug Kwan  <dougkwan@google.com>
6000
6001         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6002
6003 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6004
6005         * target.h (Target::can_icf_inline_merge_sections): New virtual
6006         function.
6007         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6008         virtual function.
6009         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6010         virtual function.
6011         * icf.cc (get_section_contents): Inline merge sections only when
6012         target allows it.
6013
6014 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6015
6016         * configure: Regenerate.
6017
6018 2010-09-17  Ian Lance Taylor  <iant@google.com>
6019
6020         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6021         * testsuite/Makefile.am (memory_test.o): New target.
6022         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6023         memory_test.t.
6024         * testsuite/Makefile.in: Rebuild.
6025
6026 2010-09-17  Doug Kwan  <dougkwan@google.com>
6027
6028         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6029         defintion if relocation uses GOT entries of the symbol.
6030         * testsuite/icf_safe_test.sh: Fix test.
6031         * testsuite/icf_safe_so_test.sh: Fix test.
6032
6033 2010-09-16  Cary Coutant  <ccoutant@google.com>
6034
6035         * script_sections.cc (class Memory_region): Remove "NULL" from
6036         vector initializations.
6037
6038 2010-09-15  Cary Coutant  <ccoutant@google.com>
6039
6040         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6041         Resolve forwarding symbols.
6042
6043 2010-09-15  Doug Kwan  <dougkwan@google.com>
6044
6045         * gold/testsuite/script_test_3.t: Add ARM special sections.
6046         * gold/testsuite/script_test_4.t: Same.
6047         * gold/testsuite/script_test_5.t: Same.
6048         * gold/testsuite/script_test_6.t: Same.
6049         * gold/testsuite/script_test_7.t: Same.
6050         * gold/testsuite/script_test_7.t: Same.
6051         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6052
6053 2010-09-14  Cary Coutant  <ccoutant@google.com>
6054
6055         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6056         (Target_x86_64::Relocate::relocate_tls): Replace check for
6057         saw_tls_block_reloc_ with test for executable section.
6058
6059 2010-09-12  Cary Coutant  <ccoutant@google.com>
6060
6061         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6062         position-independent executables to shared libraries need dynamic
6063         relocations.
6064         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6065         position-independent executables.
6066         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6067         * testsuite/Makefile.in: Regenerate.
6068
6069 2010-09-10  Nick Clifton  <nickc@redhat.com>
6070
6071         PR gold/11997
6072         * testsuite/memory_test.t: Discard any sections that are not
6073         needed.
6074
6075 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6076
6077         PR gold/11996
6078         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6079         "This::" to work around a bug in gcc 4.2.
6080
6081         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6082
6083 2010-09-09  Rafael Espindola  <espindola@google.com>
6084
6085         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6086         sections with different PF_X flags in the same segment.
6087         (Layout::find_first_load_seg): Search all segments to find the first
6088         one.
6089         * options.h (rosegment): New.
6090
6091 2010-09-08  Rafael Espindola  <espindola@google.com>
6092
6093         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6094
6095 2010-09-08  Doug Kwan  <dougkwan@google.com>
6096
6097         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6098         (Arm_relobj::do_relocate_sections): Add new parameter for output
6099         file to match the parent.
6100         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6101         of local symbols instead of input values.  Update code to track
6102         changes in gold::relocate_section.
6103         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6104         (Sized_relobj::compute_final_local_value_internal): New methods.
6105         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6106         body into private version of Sized_relobj::compute_final_local_value.
6107         Call the inline method.
6108         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6109         merged symbol value if there is one.
6110         (Symbol_value::has_output_value): New method defintiion.
6111         (Sized_relobj::Compute_final_local_value_status): New enum type.
6112         (Sized_relobj::compute_final_local_value): New methods.
6113         (Sized_relobj::compute_final_local_value_internal): New methods.
6114         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6115         and arm_cortex_a8.sh.
6116         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6117         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6118         New tests.
6119         * Makefile.in: Regenerate.
6120         * testsuite/arm_bl_out_of_range.s: Update test.
6121         * testsuite/thumb_bl_out_of_range.s: Ditto.
6122         * testsuite/thumb_blx_out_of_range.s: Ditto.
6123         * testsuite/arm_branch_out_of_range.sh: New file.
6124         * testsuite/arm_cortex_a8.sh: Ditto.
6125         * testsuite/arm_cortex_a8_b.s: Ditto.
6126         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6127         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6128         * testsuite/arm_cortex_a8_bl.s: Ditto.
6129         * testsuite/arm_cortex_a8_blx.s: Ditto.
6130         * testsuite/arm_cortex_a8_local.s: Ditto.
6131         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6132         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6133
6134 2010-09-08  Rafael Espindola  <espindola@google.com>
6135
6136         * Makefile.am (memory_test.stdout): Run readelf with -W.
6137         * Makefile.in: Regenerate.
6138         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6139         64 bit output.
6140
6141 2010-09-08  Rafael Espindola  <espindola@google.com>
6142
6143         * script-sections.cc (Script_sections::add_memory_region): Convert
6144         field precision to int.
6145         * script.cc (script_set_section_region, script_set_section_region):
6146         Convert field precision to int.
6147
6148 2010-09-08  Rafael Espindola  <espindola@google.com>
6149
6150         * arm.cc (do_finalize_sections): Create the __exidx_start and
6151         __exdix_end symbols even when the section is missing.
6152
6153 2010-09-08  Nick Clifton  <nickc@redhat.com>
6154
6155         * README: Remove claim that MEMORY is not supported.
6156         * expression.cc (script_exp_function_origin)
6157         (script_exp_function_length): Move from here to ...
6158         * script.cc: ... here.
6159         (script_set_section_region, script_add_memory)
6160         (script_parse_memory_attr, script_include_directive): New
6161         functions.
6162         * script-sections.cc
6163         (class Memory_region): New class.
6164         (class Output_section_definition): Add set_memory_region,
6165         set_section_vma, set_section_lma and get_section_name methods.
6166         (class Script_Sections): Add add_memory_region,
6167         find_memory_region, find_memory_region_origin,
6168         find_memory_region_length and set_memory_region methods.
6169         Have set_section_addresses method walk the list of set memory
6170         regions.
6171         Extend the print methos to display memory regions.
6172         * script-sections.h: Add prototypes for new methods.
6173         Add enum for MEMORY region attributes.
6174         * yyscript.y: Add support for parsing MEMORY regions.
6175         * script-c.h: Add prototypes for new functions.
6176         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6177         * testsuite/Makefile.in: Regenerate.
6178         * testsuite/memory_test.sh: New script.
6179         * testsuite/memory_test.s: New assembler source file.
6180         * testsuite/memory_test.t: New linker script.
6181
6182 2010-08-27  Doug Kwan  <dougkwan@google.com>
6183
6184         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6185         reference override an existing dynamic weak reference.
6186         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6187         * testsuite/Makefile.in: Regenerate.
6188         * testsuite/dyn_weak_ref.sh: New file.
6189         * testsuite/dyn_weak_ref_1.c: Ditto.
6190         * testsuite/dyn_weak_ref_2.c: Ditto.
6191
6192 2010-08-27  Ian Lance Taylor  <iant@google.com>
6193
6194         * incremental.h (class Incremental_input_entry): Add virtual
6195         destructor.
6196
6197 2010-08-27  Ian Lance Taylor  <iant@google.com>
6198
6199         * testsuite/start_lib_test_3.c: Mark t3 as used.
6200
6201 2010-08-27  Nick Clifton  <nickc@redhat.com>
6202
6203         * options.cc (version_script): Fix small typo in previous
6204         whitespace tidyup.
6205
6206 2010-08-25  Nick Clifton  <nickc@redhat.com>
6207
6208         * archive.cc: Formatting fixes: Remove whitespace between
6209         typename and following asterisk.  Remove whitespace between
6210         function name and opening parenthesis.
6211         * archive.h: Likewise.
6212         * arm.cc: Likewise.
6213         * attributes.cc: Likewise.
6214         * attributes.h: Likewise.
6215         * common.cc: Likewise.
6216         * copy-relocs.cc: Likewise.
6217         * dirsearch.h: Likewise.
6218         * dynobj.cc: Likewise.
6219         * ehframe.cc: Likewise.
6220         * ehframe.h: Likewise.
6221         * expression.cc: Likewise.
6222         * fileread.cc: Likewise.
6223         * fileread.h: Likewise.
6224         * gc.h: Likewise.
6225         * gold-threads.cc: Likewise.
6226         * gold.cc: Likewise.
6227         * i386.cc: Likewise.
6228         * icf.h: Likewise.
6229         * incremental-dump.cc: Likewise.
6230         * incremental.cc: Likewise.
6231         * layout.cc: Likewise.
6232         * layout.h: Likewise.
6233         * main.cc: Likewise.
6234         * merge.cc: Likewise.
6235         * merge.h: Likewise.
6236         * object.cc: Likewise.
6237         * object.h: Likewise.
6238         * options.cc: Likewise.
6239         * options.h: Likewise.
6240         * output.cc: Likewise.
6241         * output.h: Likewise.
6242         * plugin.cc: Likewise.
6243         * plugin.h: Likewise.
6244         * powerpc.cc: Likewise.
6245         * reloc.cc: Likewise.
6246         * script-c.h: Likewise.
6247         * script-sections.cc: Likewise.
6248         * script.cc: Likewise.
6249         * stringpool.cc: Likewise.
6250         * symtab.cc: Likewise.
6251         * symtab.h: Likewise.
6252         * target.cc: Likewise.
6253         * timer.cc: Likewise.
6254         * timer.h: Likewise.
6255         * version.cc: Likewise.
6256         * x86_64.cc: Likewise.
6257
6258 2010-08-24  Nick Clifton  <nickc@redhat.com>
6259
6260         PR 11899
6261         * layout.cc (segment_precedes): Sort segments by their physical
6262         addresses, if they have been set.
6263
6264 2010-08-23  Cary Coutant  <ccoutant@google.com>
6265
6266         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6267         symbols data.
6268         (Lib_group::include_member): Unlock object after deleting its
6269         symbols data.
6270         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6271         the bug fixed here.
6272
6273 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6274             Cary Coutant  <ccoutant@google.com>
6275
6276         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6277         constructor, and set_blocker.
6278         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6279         readsyms_blocker_.
6280         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6281         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6282         * testsuite/Makefile.am (start_lib_test): New test case.
6283         * testsuite/Makefile.in: Regenerate.
6284         * testsuite/start_lib_test_main.c: New file.
6285         * testsuite/start_lib_test_1.c: New file.
6286         * testsuite/start_lib_test_2.c: New file.
6287         * testsuite/start_lib_test_3.c: New file.
6288
6289 2010-08-19  Ian Lance Taylor  <iant@google.com>
6290
6291         * Makefile.in: Rebuild with automake 1.11.1.
6292         * aclocal.m4: Likewise.
6293         * testsuite/Makefile.in: Likewise.
6294
6295 2010-08-19  Ian Lance Taylor  <iant@google.com>
6296
6297         PR 10893
6298         * i386.cc (class Output_data_plt_i386): Update declarations.
6299         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6300         local_ifuncs_ fields.
6301         (Target_i386::do_plt_section_for_global): New function.
6302         (Target_i386::do_plt_section_for_local): New function.
6303         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6304         parameter; change all callers.  Initialize global_ifuncs_ and
6305         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6306         __rel_iplt_end.
6307         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6308         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6309         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6310         symbols.
6311         (Target_i386::make_plt_section): New function, broken out of
6312         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6313         (Target_i386::make_plt_entry): Call make_plt_section.
6314         (Target_i386::make_local_ifunc_plt_entry): New function.
6315         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6316         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6317         R_386_IRELATIVE to switch.
6318         (Target_i386::Scan::global): Likewise.
6319         (Target_i386::Relocate::relocate): Likewise.
6320         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6321         switch.
6322         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6323         (Target_x86_64::do_plt_section_for_global): New function.
6324         (Target_x86_64::do_plt_section_for_local): New function.
6325         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6326         parameter; change all callers.  If doing a static link define
6327         __rela_iplt_start and __rela_iplt_end.
6328         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6329         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6330         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6331         to point to .plt.
6332         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6333         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6334         switch.
6335         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6336         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6337         R_X86_64_IRELATIVE to switch.
6338         (Target_x86_64::Scan::global): Likewise.
6339         (Target_x86_64::Relocate::relocate): Likewise.
6340         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6341         switch.
6342         * target.h (class Target): Add plt_section_for_global and
6343         plt_section_for_local functions.  Add do_plt_section_for_global
6344         and do_plt_section_for_local virtual functions.
6345         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6346         clarifying comments.
6347         (Symbol::use_plt_offset): Handle IFUNC symbol.
6348         * object.cc (Sized_relobj::Sized_relobj): Initialize
6349         local_plt_offsets_.
6350         (Sized_relobj::local_has_plt_offset): New function.
6351         (Sized_relobj::local_plt_offset): New function.
6352         (Sized_relobj::set_local_plt_offset): New function.
6353         (Sized_relobj::do_count): Handle IFUNC symbol.
6354         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6355         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6356         is_ifunc_symbol functions.
6357         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6358         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6359         local_plt_offsets_ field.
6360         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6361         * output.h (class Output_section_data): Add non-const
6362         output_section function.
6363         (class Output_data_got): Update declarations.
6364         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6365         Add use_plt_offset parameter to global and local constructors.
6366         Change all callers.  Change local_sym_index_ field to 31 bits.
6367         Change GSYM_CODE and CONSTANT_CODE accordingly.
6368         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6369         doing a static link don't set sh_link field.
6370         (Output_data_got::Got_entry::write): Use PLT offset if
6371         appropriate.
6372         (Output_data_got::add_global_plt): New function.
6373         (Output_data_got::add_local_plt): New function.
6374         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6375         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6376         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6377         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6378         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6379         IFUNC conditional.
6380         * testsuite/ifunc-sel.h: New file.
6381         * testsuite/ifuncmain1.c: New file.
6382         * testsuite/ifuncmain1vis.c: New file.
6383         * testsuite/ifuncmod1.c: New file.
6384         * testsuite/ifuncdep2.c: New file.
6385         * testsuite/ifuncmain2.c: New file.
6386         * testsuite/ifuncmain3.c: New file.
6387         * testsuite/ifuncmod3.c: New file.
6388         * testsuite/ifuncmain4.c: New file.
6389         * testsuite/ifuncmain5.c: New file.
6390         * testsuite/ifuncmod5.c: New file.
6391         * testsuite/ifuncmain6pie.c: New file.
6392         * testsuite/ifuncmod6.c: New file.
6393         * testsuite/ifuncmain7.c: New file.
6394         * configure, testsuite/Makefile.in: Rebuild.
6395
6396 2010-08-18  Ian Lance Taylor  <iant@google.com>
6397
6398         * incremental.cc
6399         (Output_section_incremental_inputs::write_input_files): Add cast
6400         to avoid signed/unsigned comparison warning.
6401         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6402
6403 2010-08-12  Cary Coutant  <ccoutant@google.com>
6404
6405         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6406
6407 2010-08-13  Ian Lance Taylor  <iant@google.com>
6408
6409         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6410
6411 2010-08-12  Cary Coutant  <ccoutant@google.com>
6412             Doug Kwan  <dougkwan@google.com>
6413
6414         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6415         defintion overrides non-weak undef, remember that the original undef
6416         is not weak.
6417         * symtab.cc (Symbol_table::sized_write_global): For undef without
6418         an original weak binding, set binding to global in output.
6419         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6420         * testsuite/Makefile.in: Regenerate.
6421         * testsuite/strong_ref_weak_def.sh: New file.
6422         * testsuite/strong_ref_weak_def_1.c: Ditto.
6423         * testsuite/strong_ref_weak_def_2.c: Ditto.
6424
6425 2010-08-12  Cary Coutant  <ccoutant@google.com>
6426
6427         * testsuite/incremental_test.sh: Rewrite.
6428         * testsuite/incremental_test_1.c: Rewrite.
6429         * testsuite/incremental_test_2.c: Rewrite.
6430
6431 2010-08-12  Cary Coutant  <ccoutant@google.com>
6432
6433         * arm.cc (Target_arm::got_size): Add const.
6434         (Target_arm::got_entry_count): New function.
6435         (Target_arm::plt_entry_count): New function.
6436         (Target_arm::first_plt_entry_offset): New function.
6437         (Target_arm::plt_entry_size): New function.
6438         (Output_data_plt_arm::entry_count): New function.
6439         (Output_data_plt_arm::first_plt_entry_offset): New function.
6440         (Output_data_plt_arm::get_plt_entry_size): New function.
6441         * i386.cc (Target_i386::got_size): Add const.
6442         (Target_i386::got_entry_count): New function.
6443         (Target_i386::plt_entry_count): New function.
6444         (Target_i386::first_plt_entry_offset): New function.
6445         (Target_i386::plt_entry_size): New function.
6446         (Output_data_plt_i386::entry_count): New function.
6447         (Output_data_plt_i386::first_plt_entry_offset): New function.
6448         (Output_data_plt_i386::get_plt_entry_size): New function.
6449         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6450         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6451         * incremental.cc: Include target.h.
6452         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6453         parameter.  Adjust all callers.  Find incremental_got_plt section.
6454         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6455         section.
6456         (Output_section_incremental_inputs::set_final_data_size): Calculate
6457         size of incremental_got_plt section.
6458         (Output_section_incremental_inputs::do_write): Write the
6459         incremental_got_plt section.
6460         (Got_plt_view_info): New struct.
6461         (Local_got_offset_visitor): New class.
6462         (Global_got_offset_visitor): New class.
6463         (Global_symbol_visitor_got_plt): New class.
6464         (Output_section_incremental_inputs::write_got_plt): New function.
6465         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6466         Add parameter.  Adjust all callers.
6467         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6468         (Incremental_inputs::got_plt_section): New function.
6469         (Incremental_inputs::got_plt_section_): New data member.
6470         (Incremental_got_plt_reader): New class.
6471         * layout.cc (Layout::create_incremental_info_sections): Add the
6472         incremental_got_plt section.
6473         * object.h (Got_offset_list::get_list): New function.
6474         (Got offset_list::for_all_got_offsets): New function.
6475         (Sized_relobj::local_got_offset_list): New function.
6476         * powerpc.cc (Target_powerpc::got_size): Add const.
6477         (Target_powerpc::got_entry_count): New function.
6478         (Target_powerpc::plt_entry_count): New function.
6479         (Target_powerpc::first_plt_entry_offset): New function.
6480         (Target_powerpc::plt_entry_size): New function.
6481         (Output_data_plt_powerpc::entry_count): New function.
6482         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6483         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6484         * sparc.cc (Target_sparc::got_size): Add const.
6485         (Target_sparc::got_entry_count): New function.
6486         (Target_sparc::plt_entry_count): New function.
6487         (Target_sparc::first_plt_entry_offset): New function.
6488         (Target_sparc::plt_entry_size): New function.
6489         (Output_data_plt_sparc::entry_count): New function.
6490         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6491         (Output_data_plt_sparc::get_plt_entry_size): New function.
6492         * symtab.h (Symbol::got_offset_list): New function.
6493         (Symbol_table::for_all_symbols): New function.
6494         * target.h (Sized_target::got_entry_count): New function.
6495         (Sized_target::plt_entry_count): New function.
6496         (Sized_target::plt_entry_size): New function.
6497         * x86_64.cc (Target_x86_64::got_size): Add const.
6498         (Target_x86_64::got_entry_count): New function.
6499         (Target_x86_64::plt_entry_count): New function.
6500         (Target_x86_64::first_plt_entry_offset): New function.
6501         (Target_x86_64::plt_entry_size): New function.
6502         (Output_data_plt_x86_64::entry_count): New function.
6503         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6504         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6505
6506 2010-08-12  Cary Coutant  <ccoutant@google.com>
6507
6508         * archive.cc: Include incremental.h.
6509         (Archive::Archive): Initialize incremental_info_.
6510         (Archive::include_member): Record archive members in incremental info.
6511         (Add_archive_symbols::run): Record begin and end of an archive in
6512         incremental info.
6513         (Lib_group::include_member): Record objects in incremental info.
6514         * archive.h (Incremental_archive_entry): Forward declaration.
6515         (Archive::set_incremental_info): New member function.
6516         (Archive::incremental_info): New member function.
6517         (Archive::Unused_symbol_iterator): New class.
6518         (Archive::unused_symbols_begin): New member function.
6519         (Archive::unused_symbols_end): New member function.
6520         (Archive::incremental_info_): New data member.
6521         * incremental-dump.cc (find_input_containing_global): New function.
6522         (dump_incremental_inputs): Dump new incremental info sections.
6523         * incremental.cc: Include symtab.h.
6524         (Output_section_incremental_inputs): New class.
6525         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6526         new incremental info sections.
6527         (Sized_incremental_binary::do_check_inputs): Likewise.
6528         (Incremental_inputs::report_archive): Remove.
6529         (Incremental_inputs::report_archive_begin): New function.
6530         (Incremental_inputs::report_archive_end): New function.
6531         (Incremental_inputs::report_object): New function.
6532         (Incremental_inputs::finalize_inputs): Remove.
6533         (Incremental_inputs::report_input_section): New function.
6534         (Incremental_inputs::report_script): Rewrite.
6535         (Incremental_inputs::finalize): Do nothing but finalize string table.
6536         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6537         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6538         (Incremental_inputs::create_data_sections): New function.
6539         (Incremental_inputs::relocs_entsize): New function.
6540         (Output_section_incremental_inputs::set_final_data_size): New function.
6541         (Output_section_incremental_inputs::do_write): New function.
6542         (Output_section_incremental_inputs::write_header): New function.
6543         (Output_section_incremental_inputs::write_input_files): New function.
6544         (Output_section_incremental_inputs::write_info_blocks): New function.
6545         (Output_section_incremental_inputs::write_symtab): New function.
6546         * incremental.h (Incremental_script_entry): Forward declaration.
6547         (Incremental_object_entry): Forward declaration.
6548         (Incremental_archive_entry): Forward declaration.
6549         (Incremental_inputs): Forward declaration.
6550         (Incremental_inputs_header_data): Remove.
6551         (Incremental_inputs_header): Remove.
6552         (Incremental_inputs_header_write): Remove.
6553         (Incremental_inputs_entry_data): Remove.
6554         (Incremental_inputs_entry): Remove.
6555         (Incremental_inputs_entry_write): Remove.
6556         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6557         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6558         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6559         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6560         Likewise.
6561         (Incremental_input_entry): New class.
6562         (Incremental_script_entry): New class.
6563         (Incremental_object_entry): New class.
6564         (Incremental_archive_entry): New class.
6565         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6566         (Incremental_inputs::report_inputs): Remove.
6567         (Incremental_inputs::report_archive): Remove.
6568         (Incremental_inputs::report_archive_begin): New function.
6569         (Incremental_inputs::report_archive_end): New function.
6570         (Incremental_inputs::report_object): Change prototype.
6571         (Incremental_inputs::report_input_section): New function.
6572         (Incremental_inputs::report_script): Change prototype.
6573         (Incremental_inputs::get_reloc_count): New function.
6574         (Incremental_inputs::set_reloc_count): New function.
6575         (Incremental_inputs::create_data_sections): New function.
6576         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6577         (Incremental_inputs::inputs_section): New function.
6578         (Incremental_inputs::symtab_section): New function.
6579         (Incremental_inputs::relocs_section): New function.
6580         (Incremental_inputs::get_stringpool): Add const.
6581         (Incremental_inputs::command_line): Add const.
6582         (Incremental_inputs::inputs): Remove.
6583         (Incremental_inputs::command_line_key): New function.
6584         (Incremental_inputs::input_file_count): New function.
6585         (Incremental_inputs::input_files): New function.
6586         (Incremental_inputs::relocs_entsize): New function.
6587         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6588         (Incremental_inputs::finalize_inputs): Remove.
6589         (Incremental_inputs::Input_info): Remove.
6590         (Incremental_inputs::lock_): Remove.
6591         (Incremental_inputs::inputs_): Change type.
6592         (Incremental_inputs::inputs_map_): Remove.
6593         (Incremental_inputs::current_object_entry_): New data member.
6594         (Incremental_inputs::inputs_section_): New data member.
6595         (Incremental_inputs::symtab_section_): New data member.
6596         (Incremental_inputs::relocs_section_): New data member.
6597         (Incremental_inputs::reloc_count_): New data member.
6598         (Incremental_inputs_reader): New class.
6599         (Incremental_symtab_reader): New class.
6600         (Incremental_relocs_reader): New class.
6601         * layout.cc (Layout::finalize): Move finalization of incremental info
6602         and creation of incremental info sections to follow finalization of
6603         symbol table.  Set offsets for postprocessing sections.
6604         (Layout::create_incremental_info_sections): Call
6605         Incremental_inputs::create_data_sections.  Add incremental symtab
6606         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6607         sections to layout after input sections.
6608         * layout.h (struct Timespec): Forward declaration.
6609         (Layout::incremental_inputs): Add const.
6610         (Layout::create_incremental_info_sections): Add parameter.
6611         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6612         * object.cc: Include incremental.h.
6613         (Relobj::finalize_incremental_relocs): New function.
6614         (Sized_relobj::do_layout): Record input sections in incremental info.
6615         * object.h (Object::output_section): New function.
6616         (Object::output_section_offset): Moved from Relobj.
6617         (Object::get_incremental_reloc_base): New function.
6618         (Object::get_incremental_reloc_count): New function.
6619         (Object::do_output_section): New function.
6620         (Object::do_output_section_offset): Moved from Relobj.
6621         (Object::do_get_incremental_reloc_base): New function.
6622         (Object::do_get_incremental_reloc_count): New function.
6623         (Object::Object): Initialize new data members.
6624         (Relobj::output_section): Renamed do_output_section and moved to
6625         protected.
6626         (Relobj::output_section_offset): Moved to Object.
6627         (Relobj::do_get_incremental_reloc_base): New function.
6628         (Relobj::do_get_incremental_reloc_count): New function.
6629         (Relobj::allocate_incremental_reloc_counts): New function.
6630         (Relobj::count_incremental_reloc): New function.
6631         (Relobj::finalize_incremental_relocs): New function.
6632         (Relobj::next_incremental_reloc_index): New function.
6633         (Relobj::reloc_counts_): New data member.
6634         (Relobj::reloc_bases_): New data member.
6635         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6636         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6637         (Sized_relobj::incremental_relocs_scan): New function.
6638         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6639         (Sized_relobj::incremental_relocs_write): New function.
6640         (Sized_relobj::incremental_relocs_write_reltype): New function.
6641         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6642         incremental link.
6643         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6644         archives and object files elsewhere.
6645         (Add_symbols::run): Report object files here.
6646         (Finish_group::run): Report end of archive at end of group.
6647         * reloc.cc: Include layout.h, incremental.h.
6648         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6649         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6650         (Sized_relobj::incremental_relocs_scan): New function.
6651         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6652         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6653         (Sized_relobj::incremental_relocs_write): New function.
6654         (Sized_relobj::incremental_relocs_write_reltype): New function.
6655         * script.cc (read_input_script): Rewrite test for incremental link.
6656         Change call to Incremental_inputs::report_script.
6657         * symtab.h (Symbol_table::first_global_index): New function.
6658         (Symbol_table::output_count): New function.
6659
6660 2010-08-12  Doug Kwan  <dougkwan@google.com>
6661
6662         * arm.cc (Target_arm::merge_object_attributes): Check command line
6663         options --no-wchar-size-warning and --no-enum-size-warning.
6664         * options.h (General_options): Add ld-compatible options
6665         --no-enum-size-warning and --no-wchar-size-warning.
6666
6667 2010-08-04  Ian Lance Taylor  <iant@google.com>
6668
6669         * x86_64.cc (Target_x86_64::Scan::local): Use
6670         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6671         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6672         (Target_x86_64::Scan::global): Likewise.
6673         (Target_x86_64::Relocate::relocate): Likewise.
6674         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6675         Likewise.
6676
6677 2010-08-03  Cary Coutant  <ccoutant@google.com>
6678
6679         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6680         to reserve space in merged_strings vector. Keep total input size
6681         for stats.
6682         (Output_merge_string::do_print_merge_stats): Print total input size.
6683         * merge.h (Output_merge_string): Add input_size_ field.
6684         * stringpool.cc (Stringpool_template::string_length): Move
6685         implementations out of Stringpool_template class and place in
6686         stringpool.h.
6687         * stringpool.h (string_length): Move out of Stringpool_template.
6688
6689 2010-08-03  Ian Lance Taylor  <iant@google.com>
6690
6691         PR 11712
6692         * layout.cc (relaxation_loop_body): If address of load segment is
6693         set, adjust address to include headers if possible.
6694
6695 2010-08-03  Ian Lance Taylor  <iant@google.com>
6696
6697         * version.cc (version_string): Bump to 1.10.
6698
6699 2010-08-03  Ian Lance Taylor  <iant@google.com>
6700
6701         PR 11805
6702         * layout.h (enum Output_section_order): Define.
6703         (class Layout): Update declarations.
6704         * layout.cc (Layout::get_output_section): Add order parameter.
6705         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6706         is_first_non_relro parameters.  Change all callers.
6707         (Layout::choose_output_section): Likewise.
6708         (Layout::add_output_section_data): Likewise.
6709         (Layout::make_output_section): Likewise.  Set order.
6710         (Layout::default_section_order): New function.
6711         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6712         * output.cc (Output_section::Output_section): Initialize order_.
6713         Don't initialize deleted fields.
6714         (Output_segment::Output_segment): Don't initialize deleted
6715         fields.
6716         (Output_segment::add_output_section_to_load): New function
6717         replacing add_output_section.  Change all callers to call this or
6718         add_output_section_to_nonload.
6719         (Output_segment::add_output_section_to_nonload): New function.
6720         (Output_segment::remove_output_section): Rewrite.
6721         (Output_segment::add_initial_output_data): Likewise.
6722         (Output_segment::has_any_data_sections): Likewise.
6723         (Output_segment::is_first_section_relro): Likewise.
6724         (Output_segment::maximum_alignment): Likewise.
6725         (Output_segment::has_dynamic_reloc): New function replacing
6726         dynamic_reloc_count.  Change all callers.
6727         (Output_segment::has_dynamic_reloc_list): New function replacing
6728         dynamic_reloc_count_list.  Change all callers.
6729         (Output_segment::set_section_addresses): Rewrite.
6730         (Output_segment::set_offset): Rewrite.
6731         (Output_segment::find_first_and_last_list): Remove.
6732         (Output_segment::set_tls_offsets): Rewrite.
6733         (Output_segment::first_section_load_address): Likewise.
6734         (Output_segment::output_section_count): Likewise.
6735         (Output_segment::section_with_lowest_load_address): Likewise.
6736         (Output_segment::write_section_headers): Likewise.
6737         (Output_segment::print_sections_to_map): Likewise.
6738         * output.h (class Output_data): Remove dynamic_reloc_count_
6739         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6740         (Output_data::add_dynamic_reloc): Rewrite.
6741         (Output_data::has_dynamic_reloc): New function.
6742         (Output_data::dynamic_reloc_count): Remove.
6743         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6744         is_last_relro_, is_first_non_relro_, is_interp_,
6745         is_dynamic_linker_section_ fields.  Add order and set_order
6746         functions.  Remove is_relro_local, set_is_relro_local,
6747         is_last_relro, set_is_last_relro, is_first_non_relro,
6748         set_is_first_non_relro functions, is_interp, set_is_interp,
6749         is_dynamic_linker_section, and set_is_dynamic_linker_section
6750         functions.
6751         (class Output_segment): Change Output_data_list from std::list to
6752         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6753         output_bss_ fields.  Update declarations.
6754
6755 2010-08-02  Ian Lance Taylor  <iant@google.com>
6756
6757         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6758         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6759         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6760
6761 2010-08-02  Ian Lance Taylor  <iant@google.com>
6762
6763         PR 11855
6764         * script.cc (Script_options::Script_options): Initialize
6765         symbol_definitions_ and symbol_references_.
6766         (Script_options::add_symbol_assignment): Update
6767         symbol_definitions_ and symbol_references_.
6768         (Script_options::add_symbol_reference): New function.
6769         (script_symbol): New function.
6770         * script.h (class Script_options): Add symbol_definitions_ and
6771         symbol_references_ fields.
6772         (Script_options::referenced_const_iterator): New type.
6773         (Script_options::referenced_begin): New function.
6774         (Script_options::referenced_end): New function.
6775         (Script_options::is_referenced): New function.
6776         (Script_options::any_unreferenced): New function.
6777         * script-c.h (script_symbol): Declare.
6778         * yyscript.y (exp): Call script_symbol.
6779         * symtab.cc: Include "script.h".
6780         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6781         Change all callers.  Check symbols referenced by scripts.
6782         (Symbol_table::add_undefined_symbols_from_command_line): Add
6783         layout parameter.  Change all callers.
6784         (Symbol_table::do_add_undefined_symbols_from_command_line):
6785         Likewise.  Break out loop body.  Check symbols referenced by
6786         scripts.
6787         (Symbol_table::add_undefined_symbol_from_command_line): New
6788         function broken out of
6789         do_add_undefined_symbols_from_command_line.
6790         * symtab.h (class Symbol_table): Update declarations.
6791         * archive.cc: Include "layout.h".
6792         (Archive::should_include_member): Add layout parameter.  Change
6793         all callers.  Check for symbol mentioned in expression.
6794         * archive.h (class Archive): Update declaration.
6795         * object.cc (Sized_relobj::do_should_include_member): Add layout
6796         parameter.
6797         * object.h (Object::should_include_member): Add layout parameter.
6798         Change all callers.
6799         (Object::do_should_include_member): Add layout parameter.
6800         (class Sized_relobj): Update declaration.
6801         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6802         parameter.
6803         * dynobj.h (class Sized_dynobj): Update declaration.
6804         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6805         layout parameter.
6806         * plugin.h (class Sized_pluginobj): Update declaration.
6807
6808 2010-08-02  Ian Lance Taylor  <iant@google.com>
6809
6810         PR 11866
6811         * output.cc (Output_segment::set_offset): Search for the first and
6812         last sections rather than assuming that the list is in order.
6813         (Output_segment::find_first_and_last_list): New function.
6814         * output.h (class Output_segment): Update declarations.
6815         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6816         (relro_strip_test_SOURCES): New variable.
6817         (relro_strip_test_DEPENDENCIES): New variable.
6818         (relro_strip_test_LDFLAGS): New variable.
6819         (relro_strip_test_LDADD): New variable.
6820         (relro_strip_test.so): New target.
6821
6822 2010-08-02  Ian Lance Taylor  <iant@google.com>
6823
6824         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6825         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6826         (Target_i386::got_tlsdesc_section): New function.
6827         (Target_i386::got_section): Create space for GOT entries for
6828         TLSDESC relocations.
6829         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6830         R_386_TLS_GOTDESC.
6831         (Target_i386::Scan::global): Likewise.
6832         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6833         using TLSDESC GOT.
6834         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6835         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6836         (Target_x86_64::got_tlsdesc_section): New function.
6837         (Target_x86_64::got_section): Create space for GOT entries for
6838         TLSDESC relocations.
6839         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6840         R_386_TLS_GOTDESC.
6841         (Target_x86_64::Scan::global): Likewise.
6842         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6843         using TLSDESC GOT.
6844
6845 2010-08-02  Ian Lance Taylor  <iant@google.com>
6846
6847         * testsuite/final_layout.sh: Use dc to convert from hex to
6848         decimal.
6849
6850 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6851
6852         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6853         paramter to the call to gold::gc_process_relocs.
6854         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6855         paramter to the call to gold::gc_process_relocs.
6856         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6857         parameter to the call to gold::gc_process_relocs.
6858         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6859         template parameter to the call to gold::gc_process_relocs.
6860         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6861         paramter to the call to gold::gc_process_relocs.
6862         * gc.h (get_embedded_addend_size): New function.
6863         (gc_process_relocs): Save the size of the reloc for use by ICF.
6864         * icf.cc (get_section_contents): Get the addend from the text section
6865         for SHT_REL relocation sections.
6866         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6867         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6868         * int_encoding.h (read_from_pointer): New overloaded function.
6869         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6870         * testsuite/icf_sht_rel_addend_test.sh: New file.
6871         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6872         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6873
6874 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6875
6876         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6877         * Makefile.in: Regenerate.
6878         * testsuite/Makefile.in: Regenerate.
6879
6880 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6881
6882         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6883         * gold/testsuite/debug_msg.cc: Likewise.
6884         * gold/testsuite/odr_violation1.cc
6885         * gold/testsuite/odr_violation2.cc
6886
6887 2010-07-21  Cary Coutant  <ccoutant@google.com>
6888
6889         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6890         string, and length fields.
6891         (Output_merge_string::Merged_strings_list): New type.
6892         (Output_merge_string::Merged_strings_lists): New typedef.
6893         (Output_merge_string): Replace merged_strings_ with
6894         merged_strings_lists_.
6895         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6896         Merged_strings_list per input object and section.  Don't store pointer
6897         to the string.  Don't store length with each merged string entry.
6898         (Output_merge_string::finalize_merged_data): Loop over list of merged
6899         strings lists.  Recompute length of each merged string.
6900
6901 2010-07-15  Cary Coutant  <ccoutant@google.com>
6902
6903         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6904         here.
6905
6906 2010-07-14  Ian Lance Taylor  <iant@google.com>
6907
6908         * descriptors.cc (Descriptors::open): Report correct name in error
6909         message.
6910
6911 2010-07-13  Doug Kwan  <dougkwan@google.com>
6912
6913         * arm.cc (Arm_input_section::Arm_input_section): For a
6914         SHT_ARM_EXIDX section, always keeps the input sections.
6915         (Arm_input_section::set_exidx_section_link): New method.
6916         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6917         has_errors_ to false.
6918         (Arm_exidx_input_section::has_errors,
6919         Arm_exidx_input_section::set_has_errors): New methods.
6920         (Arm_exidx_input_section::has_errors_): New data member.
6921         (Arm_relobj::get_exidx_shndx_list): New method.
6922         (Arm_output_section::append_text_sections_to_list): Do not skip
6923         section without SHF_EXECINSTR.
6924         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6925         errors.
6926         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6927         section header.  Make error messages more verbose.  Check for
6928         a non-executable section linked to an EXIDX section.
6929         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6930         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6931         check that there is no deferred EXIDX section if we exit early.
6932         Instead of not making an EXIDX section in case of an error, make one
6933         and set the has_errors flag of it.
6934         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6935         in a relocatable link.
6936         (Target_arm::do_relax): Look for the EXIDX output section instead of
6937         assuming that it is called .ARM.exidx.
6938         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6939         section list.  Do not check for SHF_EXECINSTR section flags but
6940         skip any input section with errors.
6941         * output.cc (Output_section::Output_section): Initialize
6942         always_keeps_input_sections_ to false.
6943         (Output_section::add_input_section): Check for
6944         always_keeps_input_sections_.
6945         *  output.h (Output_section::always_keeps_input_sections,
6946         Output_section::set_always_keeps_input_sections): New methods.
6947         (Output_section::always_keeps_input_sections): New data member.
6948
6949 2010-07-13  Rafael Espindola  <espindola@google.com>
6950
6951         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6952         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6953
6954 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6955             Ian Lance Taylor  <iant@google.com>
6956
6957         * output.h (Output_section_lookup_maps::add_merge_section):
6958         Correct check of whether value was inserted.
6959         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6960         (Output_section_lookup_maps::add_relaxed_input_section):
6961         Likewise.
6962         * arm.cc (Target_arm::got_section): Remove used local os.
6963         * i386.cc (Target_i386::got_section): Likewise.
6964         * x86_64.cc (Target_x86_64::got_section): Likewise.
6965         * sparc.cc (Target_sparc::got_section): Likewise.
6966         (Target_sparc::relocate): Remove unused local have_got_offset.
6967         * powerpc.cc (Target_powerpc::relocate): Likewise.
6968
6969 2010-07-13  Ian Lance Taylor  <iant@google.com>
6970
6971         * compressed_output.cc (zlib_decompress): Fix signature in
6972         !HAVE_ZLIB_H case.
6973
6974         * archive.cc (Archive::include_member): Unlock an external member
6975         of a thin archive.  Don't bother to delete an object we know is
6976         NULL.
6977
6978 2010-07-12  Cary Coutant  <ccoutant@google.com>
6979
6980         * compressed_output.cc (zlib_decompress): New function.
6981         (get_uncompressed_size): New function.
6982         (decompress_input_section): New function.
6983         * compressed_output.h (get_uncompressed_size): New function.
6984         (decompress_input_section): New function.
6985         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6986         Handle compressed debug sections.
6987         * layout.cc (is_compressed_debug_section): New function.
6988         (Layout::output_section_name): Map compressed section names to
6989         canonical names.
6990         * layout.h (is_compressed_debug_section): New function.
6991         (is_debug_info_section): Recognize compressed debug sections.
6992         * merge.cc: Include compressed_output.h.
6993         (Output_merge_data::do_add_input_section): Handle compressed
6994         debug sections.
6995         (Output_merge_string::do_add_input_section): Handle compressed
6996         debug sections.
6997         * object.cc: Include compressed_output.h.
6998         (Sized_relobj::Sized_relobj): Initialize new data members.
6999         (build_compressed_section_map): New function.
7000         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7001         * object.h (Object::section_is_compressed): New method.
7002         (Object::do_section_is_compressed): New method.
7003         (Sized_relobj::Compressed_section_map): New type.
7004         (Sized_relobj::do_section_is_compressed): New method.
7005         (Sized_relobj::compressed_sections_): New data member.
7006         * output.cc (Output_section::add_input_section): Handle compressed
7007         debug sections.
7008         * reloc.cc: Include compressed_output.h.
7009         (Sized_relobj::write_sections): Handle compressed debug sections.
7010
7011 2010-07-08  Cary Coutant  <ccoutant@google.com>
7012
7013         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7014         weak when resolving to a dynamic def.
7015         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7016         for weak undef/dynamic def cases. Adjust callers.
7017         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7018         undef_binding_weak_.
7019         (Symbol_table::sized_write_globals): Adjust symbol binding.
7020         (Symbol_table::sized_write_symbol): Add binding parameter.
7021         * symtab.h (Symbol::set_undef_binding): New method.
7022         (Symbol::is_undef_binding_weak): New method.
7023         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7024         (Symbol_table::should_override): Add new parameter.
7025         (Symbol_table::sized_write_symbol): Add new parameter.
7026
7027         * testsuite/weak_undef_file1.cc: Add new test case.
7028         * testsuite/weak_undef_file2.cc: Fix header comment.
7029         * testsuite/weak_undef_test.cc: Add new test case.
7030
7031 2010-06-29  Doug Kwan  <dougkwan@google.com>
7032
7033         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7034         Initialize USE_SYMBOL_.
7035         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7036         definition.
7037         (Arm_reloc_property::uses_symbol_): New data member declaration.
7038         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7039         uses symbol value and symbol is undefined but not weakly undefined.
7040
7041 2010-06-28  Rafael Espindola  <espindola@google.com>
7042
7043         * plugin.cc (Plugin::load): Use dlerror.
7044
7045 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7046
7047         * symtab.cc (detect_odr_violations): When reporting an ODR
7048         violation, report an object where the symbol is defined.
7049
7050 2010-06-25  Doug Kwan  <dougkwan@google.com>
7051
7052         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7053         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7054         definition.
7055         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7056         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7057         target hook to detect function points.
7058         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7059         * icf.h (Icf::check_section_for_function_pointers): Change type of
7060         parameter SECTION_NAME to const reference to std::string.  Use
7061         target hook to determine if section may have unsafe pointers.
7062         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7063         method definition.
7064
7065 2010-06-21  Rafael Espindola  <espindola@google.com>
7066
7067         * fileread.cc (Input_file::find_fie): New
7068         (Input_file::open): Use Input_file::find_fie.
7069         * fileread.h (Input_file::find_fie): New
7070         * plugin.cc (set_extra_library_path): New.
7071         (Plugin::load): Add set_extra_library_path to the transfer vector.
7072         (Plugin_manager::set_extra_library_path): New.
7073         (Plugin_manager::add_input_file): Use the extra search path if set.
7074         (set_extra_library_path(): New.
7075         * plugin.h (Plugin_manager): Add set_extra_library_path and
7076         extra_search_path_.
7077
7078 2010-06-19  Cary Coutant  <ccoutant@google.com>
7079
7080         * layout.cc (gdb_sections): Add .debug_types.
7081         (lines_only_debug_sections): Likewise.
7082
7083 2010-06-18  Rafael Espindola  <espindola@google.com>
7084
7085         * plugin.cc (add_input_file,add_input_library)
7086         (Plugin_manager::add_input_file): Make filename arguments const.
7087         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7088         const.
7089
7090 2010-06-16  Doug Kwan  <dougkwan@google.com>
7091
7092         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7093         .ARM.attributes section if we have not merged any input
7094         attributes sections.
7095
7096 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7097
7098         * arm.cc: Allow combining objects with no EABI version
7099         information.
7100
7101 2010-06-15  Rafael Espindola  <espindola@google.com>
7102
7103         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7104
7105 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7106
7107         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7108         (struct iovec): Correct !HAVE_READV definition.
7109
7110 2010-06-10  Cary Coutant  <ccoutant@google.com>
7111
7112         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7113         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7114         reloc sections.
7115         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7116
7117         PR 11683
7118         * symtab.h (Symbol::is_placeholder): New member function.
7119         * target-reloc.h (relocate_section): Check for placeholder symbols.
7120
7121         * testsuite/Makefile.am (plugin_test_8): New test.
7122         (plugin_test_9): New test.
7123         * testsuite/Makefile.in: Regenerate.
7124
7125 2010-06-09  Nick Clifton  <nickc@redhat.com>
7126
7127         * yyscript.y (input_list_element): Allow strings prefixed with
7128         the '-' character.  Treat these as libraries.
7129         * script.cc (script_add_library): New function.  Adds a library
7130         specified by "-l<name>" found in an input script.
7131         * script-c.h: Add prototype for script_add_library.
7132
7133 2010-06-07  Doug Kwan  <dougkwan@google.com>
7134
7135         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7136         Restrict stub-group size to be within long conditional branch
7137         range when working around cortex-A8 erratum.
7138
7139 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7140
7141         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7142         #ifdef typo.
7143
7144 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7145
7146         PR gold/11658
7147         * output.cc
7148         (Output_section::Input_section_sort_entry::compare_section_ordering):
7149         Change to return non-zero correctly.
7150         (Output_section::Input_section_sort_section_order_index_compare
7151         ::operator()): Change to fix ambiguity in comparisons.
7152
7153 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7154
7155         * gold.h (is_wildcard_string): New function.
7156         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7157         (Layout::layout_eh_frame): Ditto.
7158         (Layout::find_section_order_index): New method.
7159         (Layout::read_layout_from_file): New method.
7160         * layout.h (Layout::find_section_order_index): New method.
7161         (Layout::read_layout_from_file): New method.
7162         (Layout::input_section_position_): New private member.
7163         (Layout::input_section_glob_): New private member.
7164         * main.cc (main): Call read_layout_from_file here.
7165         * options.h (--section-ordering-file): New option.
7166         * output.cc (Output_section::input_section_order_specified_): New
7167         member.
7168         (Output_section::Output_section): Initialize new member.
7169         (Output_section::add_input_section): Add new parameter.
7170         Keep input sections when --section-ordering-file is used.
7171         (Output_section::set_final_data_size): Sort input sections when
7172         section ordering file is specified.
7173         (Output_section::Input_section_sort_entry): Add new parameter.
7174         Check sorting type.
7175         (Output_section::Input_section_sort_entry::compare_section_ordering):
7176         New method.
7177         (Output_section::Input_section_sort_compare::operator()): Change to
7178         consider section_order_index.
7179         (Output_section::Input_section_sort_init_fini_compare::operator()):
7180         Change to consider section_order_index.
7181         (Output_section::Input_section_sort_section_order_index_compare
7182         ::operator()): New method.
7183         (Output_section::sort_attached_input_sections): Change to sort
7184         according to section order when specified.
7185         (Output_section::add_input_section<32, true>): Add new parameter.
7186         (Output_section::add_input_section<64, true>): Add new parameter.
7187         (Output_section::add_input_section<32, false>): Add new parameter.
7188         (Output_section::add_input_section<64, false>): Add new parameter.
7189         * output.h (Output_section::add_input_section): Add new parameter.
7190         (Output_section::input_section_order_specified): New
7191         method.
7192         (Output_section::set_input_section_order_specified): New method.
7193         (Input_section::Input_section): Initialize section_order_index_.
7194         (Input_section::section_order_index): New method.
7195         (Input_section::set_section_order_index): New method.
7196         (Input_section::section_order_index_): New member.
7197         (Input_section::Input_section_sort_section_order_index_compare): New
7198         struct.
7199         (Output_section::input_section_order_specified_): New member.
7200         * script-sections.cc (is_wildcard_string): Delete and move modified
7201         method to gold.h.
7202         (Output_section_element_input::Output_section_element_input): Modify
7203         call to is_wildcard_string.
7204         (Output_section_element_input::Input_section_pattern
7205         ::Input_section_pattern): Ditto.
7206         (Output_section_element_input::Output_section_element_input): Ditto.
7207         * testsuite/Makefile.am (final_layout): New test case.
7208         * testsuite/Makefile.in: Regenerate.
7209         * testsuite/final_layout.cc: New file.
7210         * testsuite/final_layout.sh: New file.
7211
7212 2010-06-01  Rafael Espindola  <espindola@google.com>
7213
7214         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7215
7216 2010-06-01  Rafael Espindola  <espindola@google.com>
7217
7218         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7219         visibility of symbols.
7220
7221 2010-05-27  Doug Kwan  <dougkwan@google.com>
7222
7223         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7224         from start of output section instead of address for a local symbol
7225         in a merged or relaxed section when doing a relocatable link.
7226
7227 2010-05-26  Rafael Espindola  <espindola@google.com>
7228
7229         PR 11604
7230         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7231         adding sections the garbage collector removed.
7232         * gold/testsuite/Makefile.am: Add test.
7233         * gold/testsuite/Makefile.in: Regenerate.
7234         * gold/testsuite/plugin_test_7.sh: New.
7235         * gold/testsuite/plugin_test_7_1.c: New.
7236         * gold/testsuite/plugin_test_7_2.c: New.
7237
7238 2010-05-26  Rafael Espindola  <espindola@google.com>
7239
7240         * script-sections.cc (Output_section_definition::set_section_addresses):
7241         Check for --section-start.
7242
7243 2010-05-26  Doug Kwan  <dougkwan@google.com>
7244
7245         * arm.cc (Arm_scan_relocatable_relocs): New class.
7246         (Target_arm::relocate_special_relocatable): New method.
7247         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7248         (Arm_relocate_functions::thumb_branch_common): Same.
7249         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7250         instead of Default_scan_relocatable_relocs.
7251         * target-reloc.h (relocate_for_relocatable): Let target handle
7252         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7253         * target.h (Sized_target::relocate_special_relocatable): New method.
7254
7255 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7256
7257         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7258
7259 2010-05-23  Doug Kwan  <dougkwan@google.com>
7260
7261         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7262         instead of a cast.
7263         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7264         with a direct branch, not a conditional branch, to a stub.
7265         * merge.cc (Output_merge_base::record_input_section): New method
7266         defintion.
7267         (Output_merge_data::do_add_input_section): Record input section if
7268         keeps-input-sections flag is set.
7269         (Output_merge_string::do_add_input_section): Ditto.
7270         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7271         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7272         INPUT_SECTIONS_.
7273         (Output_merge_base::keeps_input_sections,
7274         Output_merge_base::set_keeps_input_sections,
7275         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7276         method definitions.
7277         (Output_merge_base::Input_sections): New type declaration.
7278         (Output_merge_base::input_sections_begin,
7279         Output_merge_base::input_sections_end,
7280         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7281         (Output_merge_base::bool keeps_input_sections_,
7282         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7283         Output_merge_base::input_sections_): New data members.
7284         (Output_merge_data::do_set_keeps_input_sections): New method
7285         defintion.
7286         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7287         * output.cc (Output_section::Input_section::relobj): Move method
7288         defintion from class declaration to here and handle merge sections.
7289         (Output_section::Input_section::shndx): Ditto.
7290         (Output_section::Output_section): Remove initializations of removed
7291         data members and initialize new data member LOOKUP_MAPS_.
7292         (Output_section::add_input_section): Set keeps-input-sections flag
7293         for a newly created merge output section as appropriate.  Adjust code
7294         to use Output_section_lookup_maps class.
7295         (Output_section::add_relaxed_input_section): Adjst code for lookup
7296         maps code refactoring.
7297         (Output_section::add_merge_input_section): Add a new parameter
7298         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7299         class.  If adding input section to a newly created merge output
7300         section fails, remove the new merge section.
7301         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7302         Adjust code for use of the Output_section_lookup_maps class.
7303         (Output_section::find_merge_section): Ditto.
7304         (Output_section::build_lookup_maps): New method defintion.
7305         (Output_section::find_relaxed_input_section): Adjust code to use
7306         Output_section_lookup_maps class.
7307         (Output_section::get_input_sections): Export merge sections.  Adjust
7308         code to use Output_section_lookup_maps class.
7309         (Output_section:::add_script_input_section): Adjust code to use
7310         Output_section_lookup_maps class.  Update lookup maps for merge
7311         sections also.
7312         (Output_section::discard_states): Use Output_section_lookup_maps.
7313         (Output_section::restore_states): Same.
7314         * output.h (Merge_section_properties): Move class defintion out of
7315         Output_section.
7316         (Output_section_lookup_maps): New class.
7317         (Output_section::Input_section::is_merge_section): New method
7318         defintion.
7319         (Output_section::Input_section::relobj): Move defintion out of class
7320         defintion.  Declare method only.
7321         (Output_section::Input_section::shndx): Ditto.
7322         (Output_section::Input_section::output_merge_base): New method defintion.
7323         (Output_section::Input_section::u2_.pomb): New union field.
7324         (Output_section::Merge_section_by_properties_map,
7325         Output_section::Output_section_data_by_input_section_map,
7326         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7327         Remove types.
7328         (Output_section::add_merge_input_section): Add new parameter
7329         KEEPS_INPUT_SECTIONS.
7330         (Output_section::build_lookup_maps): New method declaration.
7331         (Output_section::merge_section_map_,
7332         Output_section::merge_section_by_properties_map_,
7333         Output_section::relaxed_input_section_map_,
7334         Output_section::is_relaxed_input_section_map_valid_): Remove data
7335         members.
7336         (Output_section::lookup_maps_): New data member.
7337
7338 2010-05-21  Doug Kwan  <dougkwan@google.com>
7339
7340         PR gold/11619
7341         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7342         avoid a compilation error.
7343
7344 2010-05-19  Rafael Espindola  <espindola@google.com>
7345
7346         * script-sections.cc (Output_section_definition::allocate_to_segment):
7347         Update the phdrs_list even when the output section is NULL.
7348         * testsuite/Makefile.am: Add test.
7349         * testsuite/Makefile.in: Regenerate.
7350         * testsuite/script_test_9.cc: New.
7351         * testsuite/script_test_9.sh: New.
7352         * testsuite/script_test_9.t: New.
7353
7354 2010-05-19  Doug Kwan  <dougkwan@google.com>
7355
7356         * arm.cc (Arm_input_section::original_size): New method.
7357         (Arm_input_section::do_addralign): Add a cast.
7358         (Arm_input_section::do_output_offset): Remove static cast.
7359         (Arm_input_section::original_addralign,
7360          Arm_input_section::original_size_): Change type to uint32_t.
7361         (Arm_input_section::init): Add safe casts for section alignment
7362         and size.
7363         (Arm_input_section::set_final_data_size): Do not set address and
7364         offset of stub table.
7365         (Arm_output_section::fix_exidx_coverage): Change use of of
7366         Output_section::Simple_input_section to that of
7367         Output_section::Input_section.
7368         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7369         except for the first pass.
7370         * output.cc (Output_section::get_input_sections): Change type of
7371         input_sections to std::list<Input_section>.
7372         (Output_section::add_script_input_section): Rename from
7373         Output_section::add_simple_input_section.  Change type of SIS
7374         parameter from Simple_input_section to Input_section.
7375         * output.h (Output_section::Simple_input_section): Remove class.
7376         (Output_section::Input_section): Change class visibility to public.
7377         (Output_section::Input_section::addralign): Use stored alignments
7378         for special input sections if set.
7379         (Output_section::Input_section::set_addralign): New method.
7380         (Output_section::get_input_sections): Change parameter type from
7381         list of Simple_input_section to list of Input_section.
7382         (Output_section::add_script_input_section): Rename from
7383         Output_section::add_simple_input_section. Change first parameter's
7384         type from Simple_input_section to Input_section and remove the
7385         second and third parameters.
7386         * script-sections.cc (Input_section::Input_section_list): Change
7387         type to list of Output_section::Input_section/
7388         (Input_section_info::Input_section_info): Change parameter type of
7389         INPUT_SECTION to Output_section::Input_section.
7390         (Input_section_info::input_section): Change return type.
7391         (Input_section_info::input_section_): Change type to
7392         Output_section::Input_section.
7393         (Output_section_element_input::set_section_addresses): Adjust code
7394         to use Output_section::Input_section instead of
7395         Output_section::Simple_input_section.  Adjust code for renaming
7396         of Output_section::add_simple_input_section.
7397         (Orphan_output_section::set_section_addresses): Ditto.
7398
7399 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7400
7401         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7402         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7403
7404 2010-05-18  Rafael Espindola  <espindola@google.com>
7405
7406         * options.cc (General_options::finalize): Handle -nostdlib.
7407         * options.h (nostdlib): New option.
7408         * script.cc (script_add_search_dir): Handle -nostdlib.
7409
7410 2010-05-12  Doug Kwan  <dougkwan@google.com>
7411
7412         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7413         attributes section only if there no attributes section after merging.
7414         (Target_arm::merge_object_attributes): Move value of
7415         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7416         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7417         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7418         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7419         and arm_attr_merge_7.stdout.
7420         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7421         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7422         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7423         arm_attr_merge_7b.o): New rules.
7424         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7425         arm_attr_merge_7
7426         * testsuite/Makefile.in: Regenerate.
7427         * testsuite/arm_attr_merge.sh: New file.
7428         * testsuite/arm_attr_merge_[67][ab].s: Same.
7429
7430 2010-05-05  Nick Clifton  <nickc@redhat.com>
7431
7432         * po/es.po: Updated Spanish translation.
7433
7434 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7435
7436         * Makefile.am (install-exec-local): Properly install gold as
7437         default cross linker.
7438         * Makefile.in: Regenerated.
7439
7440 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7441             Nick Clifton  <nickc@redhat.com>
7442
7443         * configure.ac (install_as_default): Define and set to false
7444         unless --enable-gold or --enable-gold=both/gold has been
7445         specified.
7446         * configure: Regenerate.
7447
7448         * Makefile.am (install-exec-local): Install the executable as
7449         'ld.gold'.  If install_as_default is true then also install it as
7450         'ld'.
7451         * Makefile.in: Regenerated.
7452
7453 2010-04-24  Ian Lance Taylor  <iant@google.com>
7454
7455         * layout.cc (Layout::layout_reloc): In relocatable link don't
7456         combine reloc sections for grouped sections.
7457
7458 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7459
7460         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7461         sections that are not ordinary to icf.
7462         * icf.cc (get_section_contents): Handle relocation pointing to section
7463         with no object or shndx information.
7464         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7465         * testsuite/Makefile.in: Regenerate.
7466         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7467         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7468
7469 2010-04-22  Ian Lance Taylor  <iant@google.com>
7470
7471         * expression.cc (Expression::Expression_eval_info): Add
7472         result_alignment_pointer field.
7473         (Expression::eval_with_dot): Add result_alignment_pointer
7474         parameter.  Change all callers.
7475         (Expression::eval_maybe_dot): Likewise.
7476         (class Binary_expression): Add alignment_pointer parameter to
7477         left_value and right_value.  Change all callers.
7478         (BINARY_EXPRESSION): Set result alignment.
7479         (class Trinary_expression): Add alignment_pointer parameter to
7480         arg2_value and arg3_value.  Change all callers.
7481         (Trinary_cond::value): Set result alignment.
7482         (Max_expression::value, Min_expression::value): Likewise.
7483         (Align_expression::value): Likewise.
7484         * script-sections.cc (class Sections_element): Add dot_alignment
7485         parameter to set_section_addresses virtual function.  Update
7486         instantiations.
7487         (class Output_section_element): Likewise.
7488         (Script_sections::create_segments): Add dot_alignment parameter.
7489         Change all callers.
7490         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7491         (Script_sections::set_phdrs_clause_addresses): Likewise.
7492         * script-sections.h: Update declarations.
7493         * script.h: Update declarations.
7494         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7495         min_p_align.
7496         * testsuite/script_test_3.t: Set large alignment.
7497         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7498         segment has expected alignment.
7499
7500 2010-04-22  Nick Clifton  <nickc@redhat.com>
7501
7502         * po/gold.pot: Updated by the Translation project.
7503         * po/vi.po: Updated Vietnamese translation.
7504
7505 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7506
7507         * testsuite/Makefile.am (check_PROGRAMS): Add
7508         icf_virtual_function_folding_test.
7509         * testsuite/Makefile.in: Regenerated.
7510
7511 2010-04-15  Andrew Haley  <aph@redhat.com>
7512
7513         * options.h (merge_exidx_entries): New option.
7514         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7515         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7516         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7517         (Target_arm::merge_exidx_entries): New function.
7518         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7519         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7520         to Arm_exidx_fixup constructor.
7521         Add new arg, merge_exidx_entries.
7522         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7523         Arm_output_section::fix_exidx_coverage.
7524
7525 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7526
7527         * icf.cc (get_section_contents): Check for preemptible functions.
7528         Ignore addend when appropriate.
7529         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7530         section folded.
7531         (add_from_relobj): Check for section folded.
7532         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7533         * symtab.h (should_add_dynsym_entry): Add new parameter.
7534         * target-reloc.h (scan_relocs): Check for section folded.
7535         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7536         Check reloc types for function pointers in shared objects.
7537         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7538         case.
7539         (icf_preemptible_functions_test): New test case.
7540         (icf_string_merge_test): New test case.
7541         * testsuite.Makefile.in: Regenerate.
7542         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7543         bar_glob.  Refactor code.
7544         * testsuite/icf_preemptible_functions_test.cc: New file.
7545         * testsuite/icf_preemptible_functions_test.sh: New file.
7546         * testsuite/icf_string_merge_test.cc: New file.
7547         * testsuite/icf_string_merge_test.sh: New file.
7548         * testsuite/icf_virtual_function_folding_test.cc: New file.
7549         * testsuite/icf_virtual_function_folding_test.sh: New file.
7550
7551 2010-04-14  Doug Kwan  <dougkwan@google.com>
7552
7553         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7554         for local symbol recounting if we remove a section due to ICF.
7555         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7556         there are no regular objects in input.
7557
7558 2010-04-13  Doug Kwan  <dougkwan@google.com>
7559
7560         * arm.cc (Arm_input_section::set_final_data_size): Compute
7561         accurate final data size instead of using current data size.
7562
7563 2010-04-09  Doug Kwan  <dougkwan@google.com>
7564
7565         * layout.cc (Layout::choose_output_section): Handle script section
7566         types.
7567         (Layout::make_output_section_for_script): Add section type parameter.
7568         Handle script section types.
7569         * layout.h (Layout::make_output_section_for_script): Add section
7570         type parameter.
7571         * output.cc (Output_section::Output_section): Initialize data member
7572         is_noload_.
7573         (Output_section::do_reset_address_and_file_offset): Do not set address
7574         to 0 if section is a NOLOAD section.
7575         * output.h (Output_section::is_noload): New method.
7576         (Output_section::set_is_noload): Ditto.
7577         (Output_section::is_noload_): New data member.
7578         * script-c.h (Script_section_type): New enum type.
7579         (struct Parser_output_section_header): Add new file section_type.
7580         * script-sections.cc (Sections_element::output_section_name): Add
7581         parameter for returning script section type.
7582         (Output_section_definition::output_section_name): Ditto.
7583         (Output_section_definition::section_type)P; New method.
7584         (Output_section_definiton::script_section_type_name): Ditto.
7585         (Output_section_definition::script_section_type_): New data member.
7586         (Output_section_definition::Output_section_definition): Initialize
7587         data member Output_section_definition::script_section_type_.
7588         (Output_section_definition::create_sections): Pass script section type
7589         to Layout::make_output_section_for_script.
7590         (Output_section_definition::output_section_name): Return script
7591         section type to caller.
7592         (Output_section_definition::set_section_address): Do not advance
7593         dot value and load address if section type is NOLOAD.  Set address
7594         of NOLOAD sections regardless of section flags.
7595         (Output_section_definition::print): Print section type if it is
7596         not SCRIPT_SECTION_TYPE_NONE.
7597         (Output_section_definition::section_type): New method.
7598         (Output_section_definition::script_section_type_name): Ditto.
7599         (Script_sections::output_section_name): Add new parameter
7600         PSECTION_TYPE for returning script section type.  Pass it to
7601         section elements.  Handle discard sections.
7602         (Sort_output_sections::operator()): Handle NOLOAD sections.
7603         * script-sections.h (Script_sections::Section_type): New enum type.
7604         (Script_sections::output_section_name): Add a new parameter for
7605         returning script section type.
7606         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7607         INFO and NOLOAD.
7608         * yyscript.y (union): Add new field SECTION_TYPE.
7609         (COPY, DSECT, INFO, NOLOAD): New tokens.
7610         (opt_address_and_section_type): Change type to output_section_header.
7611         (section_type): New non-terminal
7612         (section_header): Handle section type.
7613         (opt_address_and_section_type): Return section type value.
7614
7615 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7616
7617         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7618         * testsuite/plugin_common_test_2.c (foo): Likewise.
7619
7620 2010-04-08  Doug Kwan  <dougkwan@google.com>
7621
7622         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7623         Output_merge_data.
7624         * output.cc (Output_section::add_merge_input_section): Simplify
7625         code and return status of Output_merge_base::add_input_section.
7626         Update merge section map only if Output_merge_base::add_input_section
7627         returns true.
7628
7629 2010-04-07  Doug Kwan  <dougkwan@google.com>
7630
7631         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7632         if section is marked as containing instructions but has no mapping
7633         symbols.
7634         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7635         correct section index.
7636         (Arm_relobj::find_linked_text_section): Ditto.
7637
7638 2010-04-07  Cary Coutant  <ccoutant@google.com>
7639
7640         * archive.cc (include_member): Destroy Read_symbols_data object before
7641         releasing file.
7642         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7643         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7644         (Read_symbols_data::~Read_symbols_data) New destructor.
7645         (Section_relocs::Section_relocs) New constructor.
7646         (Section_relocs::~Section_relocs) New destructor.
7647         (Read_relocs_data::Read_relocs_data) New constructor.
7648         (Read_relocs_data::~Read_relocs_data) New destructor.
7649         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7650         pointers to NULL after deleting.
7651
7652 2010-04-07  Doug Kwan  <dougkwan@google.com>
7653
7654         * arm.cc: Replace "endianity" with "endianness" in comments.
7655         (Arm_exidx_cantunwind): Ditto.
7656         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7657         (Arm_relobj::merge_flags_and_attributes): New method.
7658         (Arm_relobj::merge_flags_and_attributes_): New data member.
7659         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7660         (Arm_relobj::scan_sections_for_stubs): Ditto.
7661         (Arm_relobj::do_read_symbols): Check to see if we really want to
7662         merge processor-specific flags and attributes.  Exit early if
7663         an object is empty except for section names and the undefined symbol.
7664         (Target_arm::do_finalize_sections): Move check for ELF format to
7665         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7666         attributes from a regular object only when we have determined that
7667         it is aapropriate.  Do not create an .ARM.attributes section in
7668         output if there is no regular input object.
7669         (Target_arm::merge_processor_specific_flags): Check
7670         --warn-mismatch before printing any error.
7671         (Target_arm::merge_object_attributes): Ditto.
7672         * gold.cc (queue_middle_tasks): Handle the case in which there is
7673         no regular object in input.
7674         * options.cc (General_options::parse_EB): New method.
7675         (General_options::parse_EL): Same.
7676         (General_options::General_options): Initialize endianness_.
7677         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7678         New options.
7679         (General_options::Endianness): New enum.
7680         (General_options::endianness): New method.
7681         (General_options::endianness_): New data member.
7682         * parameters.cc (Parameters::set_options): Check target endianness.
7683         (Parameters::set_target_once): Ditto.
7684         (Parameters::check_target_endianness): New method.
7685         (parameters_force_valid_target): If either -EL or -EB is specified,
7686         use it to define endianness of default target.
7687         * parameters.h (Parameters::check_target_endianness): New method
7688         declaration.
7689         * target.h (class Target): Change "endianity" to "endianness"
7690         in comments.
7691
7692 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7693
7694         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7695         * configure: Regenerate.
7696         * Makefile.in: Regenerate.
7697         * testsuite/Makefile.in: Regenerate.
7698
7699 2010-04-06  Cary Coutant  <ccoutant@google.com>
7700
7701         gcc PR lto/42757
7702         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7703         prevailing definitions of common symbols.
7704         * testsuite/plugin_test_6.sh: New test case.
7705         * testsuite/plugin_common_test_1.c: New test case.
7706         * testsuite/plugin_common_test_2.c: New test case.
7707         * testsuite/Makefile.am (plugin_test_6): New test case.
7708         * testsuite/Makefile.in: Regenerate.
7709
7710 2010-04-06  Nick Clifton  <nickc@redhat.com>
7711
7712         * po/vi.po: New Vietnamese translation.
7713
7714 2010-03-30  Doug Kwan  <dougkwan@google.com>
7715
7716         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7717
7718 2010-03-25  Doug Kwan  <dougkwan@google.com>
7719
7720         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7721         to avoid a conversion warning on a 32-bit host.
7722
7723 2010-03-24  Ian Lance Taylor  <iant@google.com>
7724
7725         * testsuite/script_test_3.t: Add a TLS segment.
7726         * testsuite/Makefile.am (check_PROGRAMS): Add
7727         tls_phdrs_script_test.
7728         (tls_phdrs_script_test_SOURCES): Define.
7729         (tls_phdrs_script_test_DEPENDENCIES): Define.
7730         (tls_phdrs_script_test_LDFLAGS): Define.
7731         (tls_phdrs_script_test_LDADD): Define.
7732         * testsuite/Makefile.in: Rebuild.
7733
7734 2010-03-23  Cary Coutant  <ccoutant@google.com>
7735
7736         * fileread.cc (find_or_make_view): Fix comment.
7737
7738 2010-03-23  Ian Lance Taylor  <iant@google.com>
7739
7740         * script-sections.cc (class Orphan_section_placement): Define
7741         PLACE_TLS and PLACE_TLS_BSS.
7742         (Orphan_section_placement::Orphan_section_placement): Initialize
7743         new places.
7744         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7745         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7746         (tls_script_test_SOURCES): Define.
7747         (tls_script_test_DEPENDENCIES): Define.
7748         (tls_script_test_LDFLAGS): Define.
7749         (tls_script_test_LDADD): Define.
7750         * testsuite/Makefile.in: Rebuild.
7751
7752 2010-03-22  Doug Kwan  <dougkwan@google.com>
7753
7754         * arm.cc (Arm_relocate_functions::abs8,
7755         Arm_relocate_functions::abs16): Use correct check for overflow
7756         specified in the ARM ELF specs.
7757         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7758         target of a BLX instruction specially.
7759         (Reloc_stub::stub_type_for_reloc): Ditto.
7760         (Relocate::relocate): Use symbolic names instead of numeric relocation
7761         codes to report error.
7762         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7763         workaround.
7764         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7765         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7766         thumb2_blx_out_of_range.stdout
7767         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7768         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7769         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7770         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7771         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7772         thumb2_blx_in_range, thumb2_blx_in_range.o,
7773         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7774         thumb2_blx_out_of_range.o): New rules.
7775         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7776         thumb2_blx_in_range and thumb2_blx_out_of_range.
7777         * testsuite/Makefile.in: Regenerate.
7778         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7779         * testsuite/thumb_blx_in_range.s: New file.
7780         * testsuite/thumb_blx_out_of_range.s: New file.
7781
7782 2010-03-22  Rafael Espindola  <espindola@google.com>
7783
7784         * archive.cc (Should_include): Move to archive.h.
7785         (should_include_member): Make it a member of Archive.
7786         (Lib_group): New.
7787         (Add_lib_group_symbols): New.
7788         * archive.h: Include options.h.
7789         (Archive_member): Moved from Archive.
7790         (Should_include): Moved from archive.cc.
7791         (Lib_group): New.
7792         (Add_lib_group_symbols): New.
7793         * dynobj.cc (do_should_include_member): New.
7794         * dynobj.h (do_should_include_member): New.
7795         * gold.cc (queue_initial_tasks): Update call to queue.
7796         * main.cc (main): Print lib group stats.
7797         * object.cc (do_should_include_member): New.
7798         * object.h: Include archive.h.
7799         (Object::should_include_member): New.
7800         (Object::do_should_include_member): New.
7801         (Sized_relobj::do_should_include_member): New.
7802         * options.cc (General_options::parse_start_lib): New.
7803         (General_options::parse_end_lib): New.
7804         (Input_arguments::add_file): Handle lib groups.
7805         (Input_arguments::start_group): Check we are not in a lib.
7806         (Input_arguments::start_lib): New.
7807         (Input_arguments::end_lib): New.
7808         * options.h (General_options): Add start_lib and end_lib.
7809         (Input_argument::lib_): New.
7810         (Input_argument::lib): New.
7811         (Input_argument::is_lib): New.
7812         (Input_file_lib): New.
7813         (Input_arguments::in_lib_): New.
7814         (Input_arguments::in_lib): New.
7815         (Input_arguments::start_lib): New.
7816         (Input_arguments::end_lib_): New.
7817         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7818         in unused members as preempted.
7819         (Sized_pluginobj::do_should_include_member): New.
7820         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7821         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7822         return the blocker.
7823         (Read_symbols::do_whole_lib_group): New.
7824         (Read_symbols::do_lib_group): New.
7825         (Read_symbols::do_read_symbols): Handle lib groups.
7826         (Read_symbols::get_name): Handle lib groups.
7827         * readsyms.h (Read_symbols): Add an archive member pointer.
7828         (Read_symbols::do_whole_lib_group): New.
7829         (Read_symbols::do_lib_group): New.
7830         (Read_symbols::member_): New.
7831         * script.cc (read_input_script): Update call to queue_soon.
7832
7833 2010-03-19  Doug Kwan  <dougkwan@google.com>
7834
7835         * arm.cc (Stub_table::Stub_table): Initialize new data members
7836         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7837         (Stub_table::add_reloc_stub): Assign stub offset and update
7838         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7839         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7840         New data members.
7841         (Stub_table::update_data_size_and_addralign): Use
7842         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7843         instead of going over all reloc stubs.
7844         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7845         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7846         Stringpool_template::offset_ to size of Stringpool_char.
7847         (Stringpool_template::new_key_offset): Remove code to initialize
7848         Stringpool_template::offset_.
7849         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7850         Stringpool_template::offset_ to zero.
7851
7852 2010-03-15  Doug Kwan  <dougkwan@google.com>
7853
7854         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7855         offset_.
7856         (Stringpool_template::new_key_offset): New method.
7857         (Stringpool_template::add_string): Assign offsets when adding new
7858         strings.
7859         (Stringpool_template::set_string_offsets): Do not set string offsets
7860         when not optimizing.
7861         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7862         member size_.
7863         (Chunked_vector::clear): Clear size_.
7864         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7865         (Chunked_vector::size): Return size_.
7866         (Chunked_vector::push_back): Use size_ to find insert position.
7867         (Chunked_vector::size_): New data member.
7868         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7869         (Stringpool_template::new_key_offset): New method declaration.
7870         (Stringpool_template::offset_): New data member.
7871
7872 2010-03-15   Rafael Espindola  <espindola@google.com>
7873
7874         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7875         Add_symbols' constructor.
7876         * readsyms.h (Add_symbols): Remove the input_group member.
7877
7878 2010-03-10  Ian Lance Taylor  <iant@google.com>
7879
7880         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7881         target to ask whether a reference to a symbol requires a stack
7882         split.
7883         * target.h (Target::is_call_to_non_split): New function.
7884         (Target::do_is_call_to_non_split): Declare virtual function.
7885         * target.cc: Include "symtab.h".
7886         (Target::do_is_call_to_non_split): New function.
7887         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7888
7889 2010-03-10  Cary Coutant  <ccoutant@google.com>
7890
7891         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7892         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7893         (File_read::open[2]): Add whole_file_view_ to list of views.
7894         (File_read::make_view): Remove test of whole_file_view_.
7895         (File_read::find_or_make_view): Create whole_file_view_ if
7896         necessary.
7897         (File_read::clear_views): Replace bool parameter with enum;
7898         adjust all callers.  Don't delete views with permanent data;
7899         do delete cached views and views from archives if
7900         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7901         if clearing the corresponding view.
7902         * fileread.h (File_read::Clear_views_mode): New enum.
7903         (File_read::View::is_permanent_view): New method.
7904         (File_read::clear_views): Replace bool parameter
7905         with enum; adjust all callers.
7906         * options.h (General_options): Change keep_files_mapped option;
7907         add map_whole_files.
7908         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7909         releasing the file.
7910         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7911         the file.
7912
7913 2010-03-10  David S. Miller  <davem@davemloft.net>
7914
7915         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7916
7917 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7918
7919         * icf.cc (get_section_contents): Add '@' marker after processing the
7920         merge reloc.
7921
7922 2010-03-08  Doug Kwan  <dougkwan@google.com>
7923
7924         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7925         due to a conversion warning.
7926         (Arm_relobj::update_output_local_symbol_count): Check for local
7927         symbol with unset output index.
7928
7929 2010-03-05  Ian Lance Taylor  <iant@google.com>
7930
7931         * options.h (class General_options): Add --spare-dynamic-tags.
7932         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7933         --spare-dynamic-tags.
7934
7935 2010-03-05  Ian Lance Taylor  <iant@google.com>
7936
7937         * incremental.cc: Include "libiberty.h".
7938
7939 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7940
7941         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7942         function, is_info_ member.
7943         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7944         (Versions::Versions): Update caller.
7945         (Versions::define_base_version): Likewise.
7946         (Versions::add_def): Likewise.
7947
7948 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7949
7950         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7951         (Scan::possible_function_pointer_reloc): New function.
7952         (Scan::local_reloc_may_be_function_pointer): Change to call
7953         possible_function_pointer_reloc.
7954         (Scan::global_reloc_may_be_function_pointer): Ditto.
7955         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7956         relocations in ".data.rel.ro._ZTV" section.
7957         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7958         * testsuite/icf_safe_so_test.cc: Ditto.
7959         * testsuite/icf_safe_test.cc: Ditto.
7960         * testsuite/icf_safe_test.sh: Ditto.
7961
7962 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7963             Ian Lance Taylor  <iant@google.com>
7964
7965         * target-reloc.h (relocate_section): Check the symbol table index
7966         for -1U before setting the local symbol index.
7967         (scan_relocatable_relocs): If copying the relocation, record that
7968         the local symbol is required.
7969         * object.h (Symbol_value::is_output_symtab_index_set): New
7970         function.
7971         (Symbol_value::may_be_discarded_from_output_symtab): New
7972         function.
7973         (Symbol_value::has_output_symtab_entry): New function.
7974         (Symbol_value::needs_output_symtab_entry): Remove.
7975         (Symbol_value::output_symtab_index): Make sure the symbol index is
7976         set.
7977         (Symbol_value::set_output_symtab_index): Make sure the symbol
7978         index is not set.  Make sure the new index is valid.
7979         (Symbol_value::set_must_have_output_symtab_entry): New function.
7980         (Symbol_value::has_output_dynsym_entry): New function.
7981         (Symbol_value::set_output_dynsym_index): Make sure the new index
7982         is valid.
7983         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7984         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7985         local symbol if permitted.
7986         (Sized_relobj::do_finalize_local_symbols): Call
7987         is_output_symtab_index_set rather than needs_output_symtab_entry.
7988         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7989         rather than needs_output_symtab_entry.  Call
7990         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7991         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7992         is_output_symtab_index_set rather than needs_output_symtab_entry.
7993         * testsuite/discard_locals_relocatable_test.c: New file.
7994         * testsuite/discard_locals_test.sh: Test -r.
7995         * testsuite/Makefile.am (check_DATA): Add
7996         discard_locals_relocatable_test1.syms,
7997         discard_local_relocatable_test2.syms.
7998         (MOSTLYCLEANFILES): Likewise.  Also add
7999         discard_locals_relocatable_test1.lout and
8000         discard_locals_relocatable_test2.out.
8001         (discard_locals_relocatable_test1.syms): New target.
8002         (discard_locals_relocatable_test.o): New target.
8003         (discard_locals_relocatable_test1.out): New target.
8004         (discard_locals_relocatable_test2.syms): New target.
8005         (discard_locals_relocatable_test2.out): New target.
8006         (various): Add missing ../ld-new dependencies.
8007         * testsuite/Makefile.in: Rebuild.
8008
8009 2010-03-03  Nick Clifton  <nickc@redhat.com>
8010
8011         * po/fi.po: New Finnish translation.
8012
8013 2010-03-01  Doug Kwan  <dougkwan@google.com>
8014
8015         * layout.cc (Layout::Layout): Force section types of .init_array*,
8016         .preinit_array* and .fini_array* sections.
8017         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8018         Fix check of return value of std::string::find.().
8019         (Output_section::Input_section_sort_compare::operator()): Remove
8020         comment about .init_array.
8021         (Output_section::Input_section_sort_init_fini_compare::operator()):
8022         New method.
8023         (Output_section::sort_attached_input_sections): Handle .init_array
8024         and .fini_array specially.
8025         * output.h (Output_section::Inut_section_sort_compare): Update
8026         comment.
8027         (Output_section::Input_section_sort_init_fini_compare): New struct.
8028
8029 2010-02-26  Doug Kwan  <dougkwan@google.com>
8030
8031         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8032         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8033         * testsuite/debug_msg.sh: Avoid matching source line number for
8034         use of global variable undef_int.
8035
8036 2010-02-26  Doug Kwan  <dougkwan@google.com>
8037
8038         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8039         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8040         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8041         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8042         * options.cc (General_options::General_options): Initialize member
8043         fix_v4bx_.
8044         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8045         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8046         and rm_no_fix_v4bx.stdout
8047         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8048         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8049         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8050         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8051         and arm_no_fix_v4bx.
8052         * Makefile.in: Regenerate.
8053         * testsuite/arm_fix_v4bx.s: New file.
8054         * testsuite/arm_fix_v4bx.sh: Ditto.
8055
8056 2010-02-24  Doug Kwan  <dougkwan@google.com>
8057
8058         * arm.cc (Target_arm::got_section): Make the .got section the first
8059         non RELRO section in the data segment.
8060         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8061         suffixes of section names.
8062
8063 2010-02-24  Doug Kwan  <dougkwan@google.com>
8064
8065         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8066         flags and attributes merging if an input file is a binary file.
8067         * fileread.cc (Input_file::open): Record format of original file.
8068         * fileread.h (Input_file::Format): New enum type.
8069         (Input_file::Input_file): Initialize data member format_.
8070         (Input_file::format): New method definition.
8071         (Input_file::format_):: New data member.
8072
8073 2010-02-24  Doug Kwan  <dougkwan@google.com>
8074
8075         * arm.cc (Arm_output_data_got): New class.
8076         (ARM_TCB_SIZE): New constant
8077         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8078         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8079         If user uses a script with a SECTIONS clause, issue only a warning
8080         for a misplaced EXIDX input section.  Otherwise, issue an error.
8081         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8082         garbage collection.
8083         (Target_arm::got_mode_index_entry): Handle static linking.
8084         (Target_arm::Scan::local): Ditto.
8085         (Target_arm::Scan::global): Ditto.
8086         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8087         all incorrectly implemented relocations.
8088         (Target_arm::fix_exidx_coverage): Pass layout to
8089         Arm_output_section::fix_exidx_coverage.
8090         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8091         from ".ARM.exidx." and ".ARM.extab.".
8092
8093 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8094
8095         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8096         section if it does not already exist.
8097         * attributes.cc (Attributes_section_data::Attributes_section_data):
8098         Don't crash if size is zero.
8099
8100 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8101             Ian Lance Taylor  <iant@google.com>
8102
8103         * gold.cc (queue_middle_tasks): If no input files were opened,
8104         exit.
8105         * workqueue.h (Task_function::Task_function): Assert that there is
8106         a blocker.
8107
8108 2010-02-22  Doug Kwan  <dougkwan@google.com>
8109
8110         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8111         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8112         types to avoid warnings due to different uint64_t implementations
8113         on different hosts.
8114
8115 2010-02-21  Doug Kwan  <dougkwan@google.com>
8116
8117         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8118         handling of the maximum backward branch offset.
8119         (Arm_relocate_functions::thumb_branch_common): Ditto.
8120         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8121         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8122         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8123         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8124         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8125         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8126         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8127         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8128         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8129         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8130         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8131         thumb2_bl_out_of_range.o): New rules.
8132         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8133         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8134         thumb2_bl_out_of_range
8135         * testsuite/Makefile.in: Regenerate.
8136         * testsuite/arm_bl_in_range.s: New file.
8137         * testsuite/arm_bl_out_of_range.s: Ditto.
8138         * testsuite/arm_branch_in_range.sh: Ditto.
8139         * testsuite/arm_branch_range.t: Ditto.
8140         * testsuite/thumb2_branch_range.t: Ditto.
8141         * testsuite/thumb_bl_in_range.s: Ditto.
8142         * testsuite/thumb_bl_out_of_range.s: Ditto.
8143         * testsuite/thumb_branch_range.t: Ditto.
8144
8145 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8146
8147         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8148         Add reloc offset information.
8149         * icf.cc (get_section_contents): Change iterators to point to the new
8150         vectors. Add reloc offset information to the contents.
8151         * icf.h (Icf::Sections_reachable_info): New typedef.
8152         (Icf::Sections_reachable_list): New typedef.
8153         (Icf::Offset_info): New typedef.
8154         (Icf::Reloc_info): New struct typedef.
8155         (Icf::Reloc_info_list): New typedef.
8156         (Icf::symbol_reloc_list): Delete method.
8157         (Icf::addend_reloc_list): Delete method.
8158         (Icf::section_reloc_list): Delete method.
8159         (Icf::reloc_info_list): New method.
8160         (Icf::reloc_info_list_): New member.
8161
8162 2010-02-19  Doug Kwan  <dougkwan@google.com>
8163
8164         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8165         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8166         * arm.cc (Arm_relocation_functions): New forward declaration.
8167         (Target_arm::Target_arm): Initialize new data members
8168         got_mod_index_offset_ and tls_base_symbol_defined_.
8169         (Target_arm::Relocate::relocate_tls): New method.
8170         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8171          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8172         New methods.
8173         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8174         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8175         (Target_arm::got_mod_index_offset_,
8176         Target_arm::tls_base_symbol_defined_): New data members.
8177         (Target_arm::Scan::local, Target::Scan::global,
8178         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8179         relocations.
8180
8181 2010-02-18  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8184         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8185         text section as a parameter becuase some broken tools may not set
8186         the link in section header.
8187         (Target_arm::has_got_section): New method.
8188         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8189         without any mapping symbol as data only.  Remove warning.
8190         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8191         link in its section header, try to discover the link by inspecting the
8192         REL31 relocation at the beginning of the section.
8193         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8194         in error message.
8195         (Target_arm::Scan::global): Treat any reference to the symbol
8196         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8197
8198 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8199
8200         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8201         (Scan::global_reloc_may_be_function_pointer): New function.
8202         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8203         (Scan::global_reloc_may_be_function_pointer): New function.
8204         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8205         (Scan::global_reloc_may_be_function_pointer): New function.
8206         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8207         (Scan::global_reloc_may_be_function_pointer): New function.
8208         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8209         (Scan::global_reloc_may_be_function_pointer): New function.
8210         (Scan::possible_function_pointer_reloc): New function.
8211         (Target_x86_64::can_check_for_function_pointers): New function.
8212         * gc.h (gc_process_relocs): Scan relocation types to determine if
8213         function pointers were taken for targets that support it.
8214         * icf.cc (Icf::find_identical_sections): Include functions for
8215         folding in safe ICF whose pointer is not taken.
8216         * icf.h (Secn_fptr_taken_set): New typedef.
8217         (fptr_section_id_): New member.
8218         (section_has_function_pointers): New function.
8219         (set_section_has_function_pointers): New function.
8220         (check_section_for_function_pointers): New function.
8221         * options.h: Fix comment for safe ICF option.
8222         * target.h (can_check_for_function_pointers): New function.
8223         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8224         Modify icf_safe_test for X86-64.
8225         * testsuite/Makefile.in: Regenerate.
8226         * testsuite/icf_safe_so_test.cc: New file.
8227         * testsuite/icf_safe_so_test.sh: New file.
8228         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8229         (main): Change to take pointer to function kept_func_3.
8230         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8231         folding is done correctly for X86-64.
8232
8233 2010-02-12  David S. Miller  <davem@davemloft.net>
8234
8235         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8236         is_symbolless parameter.
8237         (Output_reloc<SHT_REL>::is_symbolless): New.
8238         (Output_reloc<SHT_REL>::is_symbolless_): New.
8239         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8240         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8241         (Output_reloc<SHT_RELA>::is_symbolless): New.
8242         (Output_data_reloc::add_global): Handle is_symbolless.
8243         (Output_data_reloc::add_global_relative): Likewise.
8244         (Output_data_reloc::add_local): Likewise.
8245         (Output_data_reloc::add_local_relative): Likewise.
8246         (Output_data_reloc::add_symbolless_global_addend): New.
8247         (Output_data_reloc::add_symbolless_local_addend): New.
8248         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8249         is_symbolless.
8250         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8251         instead of ->is_relative_
8252         (Output_reloc::write): Likewise.
8253         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8254         (Output_reloc::write_rel): Simplify.
8255
8256         * sparc.cc (Target_sparc::Scan::local): Use
8257         ->add_symbolless_local_addend as needed.
8258         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8259         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8260         based upon relocation offset.
8261
8262 2010-02-11  Doug Kwan  <dougkwan@google.com>
8263
8264         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8265         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8266         beginning of function.
8267         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8268         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8269         parameter is_32bit in calls to should_apply_static_reloc.
8270         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8271         (check_DATA): Add arm_abs_global.stdout.
8272         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8273         arm_abs_global.stdout): New rules.
8274         (MOSTLLYCLEANFILES): Add arm_abs_global
8275         * Makefile.in: Regenerate.
8276         * testsuite/arm_abs_global.s: New file.
8277         * testsuite/arm_abs_global.sh: Ditto.
8278         * testsuite/arm_abs_lib.s: Ditto.
8279
8280 2010-02-11  Ian Lance Taylor  <iant@google.com>
8281
8282         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8283         Read_relocs task.
8284         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8285         Allocate_commons_task first.
8286         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8287         task, rather than symtab_lock_.
8288         (Gc_process_relocs::~Gc_process_relocs): New function.
8289         (Gc_process_relocs::is_runnable): Check this_blocker_.
8290         (Gc_process_relocs::locks): Use next_blocker_ rather than
8291         blocker_.
8292         (Scan_relocs::~Scan_relocs): New function.
8293         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8294         symtab_lock_.
8295         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8296         next_blocker_.
8297         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8298         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8299         constructor accordingly.
8300         (class Gc_process_relocs): Likewise.
8301         (class Scan_relocs): Likewise.
8302         * common.h (class Allocate_commons_task): Remove symtab_lock_
8303         field, and corresponding constructor parameter.
8304         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8305         symtab_lock_.
8306         (Allocate_commons_task::locks): Likewise.
8307
8308 2010-02-11  Ian Lance Taylor  <iant@google.com>
8309
8310         * gold-threads.h (class Once): Define.
8311         (class Initialize_lock): Rewrite as child of Once.
8312         * gold-threads.cc (class Once_initialize): Define.
8313         (once_pointer_control): New static variable.
8314         (once_pointer, once_arg): New static variables.
8315         (c_run_once): New static function.
8316         (Once::Once, Once::run_once, Once::internal_run): New functions.
8317         (class Initialize_lock_once): Remove.
8318         (initialize_lock_control): Remove.
8319         (initialize_lock_pointer): Remove.
8320         (initialize_lock_once): Remove.
8321         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8322         (Initialize_lock::initialize): Rewrite.
8323         (Initialize_lock::do_run_once): New function.
8324         * archive.cc (Archive::interpret_header): Only clear name if it is
8325         not already empty.
8326         * fileread.cc: Include "gold-threads.h"
8327         (file_counts_lock): New static variable.
8328         (file_counts_initialize_lock): Likewise.
8329         (File_read::release): Only increment counts when using --stats.
8330         Use a lock around the increment.
8331         * parameters.cc (class Set_parameters_target_once): Define.
8332         (set_parameters_target_once): New static variable.
8333         (Parameters::Parameters): Move here from parameters.h.
8334         (Parameters::set_target): Rewrite.
8335         (Parameters::set_target_once): New function.
8336         (Parameters::clear_target): Move here and rewrite.
8337         * parameters.h (class Parameters): Update declarations.  Add
8338         set_parameters_target_once_ field.
8339         (Parameters::Parameters): Move to parameters.cc.
8340         (Parameters::clear_target): Likewise.
8341         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8342         task.
8343         (Start_group::~Start_group): New function.
8344         (Start_group::is_runnable): New function.
8345         (Start_group::locks, Start_group::run): New functions.
8346         (Finish_group::run): Change saw_undefined to size_t.
8347         * readsyms.h (class Start_group): Define.
8348         (class Finish_group): Change saw_undefined_ field to size_t.
8349         (Finish_group::Finish_group): Remove saw_undefined and
8350         this_blocker parameters.  Change all callers.
8351         (Finish_group::set_saw_undefined): New function.
8352         (Finish_group::set_blocker): New function.
8353         * symtab.h (class Symbol_table): Change saw_undefined to return
8354         size_t.  Change saw_undefined_ field to size_t.
8355         * target-select.cc (Set_target_once::do_run_once): New function.
8356         (Target_selector::Target_selector): Initialize set_target_once_
8357         field.  Don't initialize lock_ and initialize_lock_ fields.
8358         (Target_selector::instantiate_target): Rewrite.
8359         (Target_selector::set_target): New function.
8360         * target-select.h (class Set_target_once): Define.
8361         (class Target_selector): Update declarations.  Make
8362         Set_target_once a friend.  Remove lock_ and initialize_lock_
8363         fields.  Add set_target_once_ field.
8364
8365 2010-02-10  Ian Lance Taylor  <iant@google.com>
8366
8367         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8368         queueing any tasks.
8369         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8370         (queue_middle_tasks): Add all blockers before queueing any tasks.
8371         (queue_final_tasks): Likewise.
8372         * token.h (Task_token::add_blockers): New function.
8373         * object.h (Input_objects::number_of_relobjs): New function.
8374
8375 2010-02-10  Ian Lance Taylor  <iant@google.com>
8376
8377         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8378         shared, not if not position independent.
8379         * x86_64.cc (Relocate::relocate_tls): Likewise.
8380         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8381         (tls_pie_pic_test): New target.
8382         * testsuite/Makefile.in: Rebuild.
8383
8384         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8385         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8386         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8387         * testsuite/Makefile.in: Rebuild.
8388
8389 2010-02-09  David S. Miller  <davem@davemloft.net>
8390
8391         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8392         R_SPARC_RELATIVE using ->add_local_relative().
8393         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8394
8395         * output.h (Output_data_dynamic::add_section_size): New method
8396         that takes two Output_data objects.
8397         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8398         entry param.  Handle it in initializers.
8399         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8400         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8401         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8402         arg.
8403         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8404         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8405         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8406         for dynrel_includes_plt.
8407         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8408         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8409         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8410         before .rela.plt
8411         (Target_sparc::do_finalize_sections): Update to pass true for
8412         dynrel_includes_plt.
8413         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8414         output before .rela.plt
8415         (Target_powerpc::do_finalize_sections): Update to pass true for
8416         dynrel_includes_plt when 32-bit.
8417
8418 2010-02-08  Doug Kwan  <dougkwan@google.com>
8419
8420         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8421         method.
8422         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8423         Arm_relobj::scan_section_for_cortex_a8_stubs,
8424         Arm_relobj::do_relocation_section): Instead of calling
8425         Output_section::output_address, use faster
8426         Arm_relobj::simple_input_section_output_address.
8427
8428 2010-02-08  David S. Miller  <davem@davemloft.net>
8429
8430         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8431         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8432         relocation helper function.
8433
8434         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8435         just like R_SPARC_GOT{10,13,22}.
8436         (Target_sparc::Scan::local): Likewise.
8437         (Target_sparc::Relocate:relocate): Likewise.
8438
8439 2010-02-06  Ian Lance Taylor  <iant@google.com>
8440
8441         * configure.ac: Rewrite targetobjs duplicate removal code to use
8442         only shell constructs.
8443         * configure: Rebuild.
8444
8445 2010-02-05  Doug Kwan  <dougkwan@google.com>
8446
8447         PR 11247
8448         * arm.cc (Arm_relobj::section_is_scannable): New method.
8449         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8450         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8451
8452 2010-02-04  Doug Kwan  <dougkwan@google.com>
8453
8454         PR 11247
8455         * arm-reloc-property.cc (cstdio): Include.
8456         * configure.ac (targetobjs): Remove duplicates.
8457         * configure: Regenerate.
8458         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8459         big and little endian version for a given address size.
8460
8461 2010-02-03  Doug Kwan  <dougkwan@google.com>
8462
8463         * arm-reloc-property.cc
8464         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8465         definition.
8466         * arm-reloc-property.h
8467         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8468         New method definition.
8469         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8470         declaration.
8471         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8472         overflow to N.
8473         (GOT_PREL): Change implemented to Y.
8474         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8475         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8476         (Arm_relocate_functions::movw_abs_nc): Remove method.
8477         (Arm_relocate_functions::movt_abs): Ditto.
8478         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8479         (Arm_relocate_functions::thm_movt_abs): Ditto.
8480         (Arm_relocate_functions::movw_rel_nc): Ditto.
8481         (Arm_relocate_functions::movw_rel): Ditto.
8482         (Arm_relocate_functions::movt_rel): Ditto.
8483         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8484         (Arm_relocate_functions:thm_movw_rel): Ditto.
8485         (Arm_relocate_functions:thm_movt_rel): Ditto.
8486         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8487         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8488         New method definitions.
8489         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8490         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8491         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8492         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8493         (Target_arm::Relocate::relocate): Check for non-static or
8494         unimplemented relocation code and exit early.  Change calls to
8495         Target_arm::reloc_uses_thumb_bit and
8496         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8497         instead.  Refactor code to handle similar relocations to increase
8498         code sharing.  Remove check for unsupported relocation code in switch
8499         statement.
8500         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8501         relocation property table to find out size.  Change error message to
8502         print out the name of a relocation code instead of the numeric value.
8503         (Target_arm::scan_reloc_for_stub): Use relocation property table
8504         instead of calling Target_arm::reloc_uses_thumb_bit().
8505
8506 2010-02-02  Doug Kwan  <dougkwan@google.com>
8507
8508         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8509         types of relaxed input section.
8510
8511 2010-02-02  Doug Kwan  <dougkwan@google.com>
8512
8513         * Makefile.am (HFILES): Add arm-reloc-property.h.
8514         (DEFFILES): New.
8515         (TARGETSOURCES): Add arm-reloc-property.cc
8516         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8517         (libgold_a_SOURCES): $(DEFFILES)
8518         * Makefile.in: Regenerate.
8519         * arm-reloc-property.cc: New file.
8520         * arm-reloc-property.h: New file.
8521         * arm-reloc.def: New file.
8522         * arm.cc: Update comments.
8523         (arm-reloc-property.h): New included header.
8524         (arm_reloc_property_table): New global variable.
8525         (Target_arm::do_select_as_default_target): New method definition.
8526         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8527         arm-reloc-property to targ_extra_obj.
8528         * parameters.cc (set_parameters_target): Call
8529         Target::select_as_default_target().
8530         * target.h (Target::select_as_default_target): New method definition.
8531         (Target::do_select_as_default_target): Same.
8532
8533 2010-02-01  Doug Kwan  <dougkwan@google.com>
8534
8535         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8536         first_output_text_section_.
8537         (Arm_exidx_fixup::first_output_text_section): New method definition.
8538         (Arm_exidx_fixup::first_output_text_section_): New data member.
8539         (Arm_exidx_fixup::process_exidx_section): Record the first text
8540         output section seen.
8541         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8542         and entsize in output section header.
8543
8544 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8545
8546         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8547         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8548         (Arm_relocate_functions::thm_alu11): New Method.
8549         (Arm_relocate_functions::thm_pc8): New Method.
8550         (Arm_relocate_functions::thm_pc12): New Method.
8551         (Target_arm::Scan::local): Handle the relocations.
8552         (Target_arm::Scan::global): Likewise.
8553         (Target_arm::Relocate::relocate): Likewise.
8554         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8555
8556 2010-01-29  Doug Kwan  <dougkwan@google.com>
8557
8558         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8559         of relocation types as ld.
8560
8561 2010-01-29  Doug Kwan  <dougkwan@google.com>
8562
8563         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8564         to public.
8565         (Arm_relocate_functions::thumb_branch_common): Ditto.
8566         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8567         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8568         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8569         Arm_relocate_functions::jump24): Remove.
8570         (Target_arm::Relocate::relocate): Adjust code to call
8571         Arm_relocation_functions::arm_branch_common and
8572         Arm_relocation_functions::thumb_branch_common instead of their removed
8573         wrappers.  Merge switch-cases together to reduce source code size.
8574
8575 2010-01-29  Doug Kwan  <dougkwan@google.com>
8576
8577         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8578         output_local_symbol_count_needs_update_.
8579         (Arm_relobj::output_local_symbol_count_needs_update,
8580          Arm_relobj::set_output_local_symbol_count_needs_update,
8581          Arm_relobj::update_output_local_symbol_count): New methods.
8582         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8583         member.
8584         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8585         of pointed function as in a R_ARM_PREL31 relocation.
8586         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8587         for output local symbol count updating.
8588         (Target_arm::do_relax): Update output local symbol counts in objects
8589         if necessary.
8590         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8591
8592 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8593
8594         * arm.cc: Added support for the ARM relocations:
8595         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8596         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8597         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8598         movw_prel_nc).
8599         (Arm_relocate_functions::movw_rel): New method.
8600         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8601         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8602         thm_movw_prel_nc).
8603         (Arm_relocate_functions::thm_movw_rel): New method.
8604         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8605         thm_movt_prel).
8606         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8607         relocations.
8608         (Target_arm::Scan::global): Likewise.
8609         (Target_arm::Relocate::relocate): Likewise.
8610         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8611         Likewise.
8612
8613 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8614
8615         * arm.cc: Added support for ARM group relocations.
8616         (Target_arm::reloc_needs_sym_origin): New method.
8617         (Arm_relocate_functions::calc_grp_kn): New method.
8618         (Arm_relocate_functions::calc_grp_residual): New method.
8619         (Arm_relocate_functions::calc_grp_gn): New method.
8620         (Arm_relocate_functions::arm_grp_alu): New Method.
8621         (Arm_relocate_functions::arm_grp_ldr): New Method.
8622         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8623         (Arm_relocate_functions::arm_grp_ldc): New Method.
8624         (Target_arm::Scan::local): Handle the ARM group relocations.
8625         (Target_arm::Scan::global): Likewise.
8626         (Target_arm::Relocate::relocate): Likewise.
8627         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8628         Likewise.
8629
8630 2010-01-26  Doug Kwan  <dougkwan@google.com>
8631
8632         * arm.cc (set): Include.
8633         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8634         pointer type.
8635         (Arm_output_section::Text_section_list): New type.
8636         (Arm_output_section::append_text_sections_to_list): New method.
8637         (Arm_output_section::fix_exidx_coverage): Ditto.
8638         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8639         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8640         Relobj::set_section_offset() instead of
8641         Sized_relobj::invalidate_section_offset().
8642         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8643         parameter for section headers. Ignore relocation sections for
8644         unallocated sections and EXIDX sections.
8645         (Target_arm::fix_exidx_coverage): New method.
8646         (Target_arm::output_section_address_less_than): New type.
8647         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8648         linked text section instead of the EXIDX section.
8649         (Arm_output_section::create_stub_group): Add an assertion to check
8650         that this is not an EXIDX output section.
8651         (Arm_output_section::append_text_sections_to_list): New method.
8652         (Arm_output_section::fix_exidx_coverage): Ditto.
8653         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8654         Arm_relobj::section_needs_reloc_stub_scanning.
8655         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8656         first pass.
8657         (Target_arm::fix_exidx_coverage): New method.
8658         * object.h (Relobj::set_output_section): New method.
8659         (Sized_relobj::invalidate_section_offset): Remove method.
8660         (Sized_relobj::do_invalidate_section_offset): Remove method.
8661         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8662
8663 2010-01-25  Doug Kwan  <dougkwan@google.com>
8664
8665         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8666         Fix warning due to signed and unsigned comparison on a 32-bit host.
8667
8668 2010-01-22  Doug Kwan  <dougkwan@google.com>
8669
8670         * arm.cc (Target_arm::do_relax): Record an output section for section
8671         offset adjustment it contains any stub table that has changed.
8672         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8673         offsets in an output section if necessary.
8674         * output.cc (Output_section::Output_section): Initialize
8675         section_offsets_need_adjustments_.
8676         (Output_section::add_input_section_for_script): Renamed to
8677         Output_section::add_simple_input_section.
8678         (Output_section::save_states): Add a comment.
8679         (Output_section::discard_states): New method defintion.
8680         (Output_section::adjust_section_offsets): Same.
8681         * output.h (Output_section::add_input_section_for_script): Renamed to
8682         Output_section::add_simple_input_section.
8683         (Output_section::discard_states): New method declaration.
8684         (Output_section::adjust_section_offsets): Same.
8685         (Output_section::section_offsets_need_adjustment,
8686         Output_section::set_section_offsets_need_adjustment): New method
8687         definitions.
8688         (Output_section::section_offsets_need_adjustment_): New data member.
8689         * script-sections.cc
8690         (Output_section_element_input::set_section_address): Adjust code for
8691         renaming of Output_section::add_input_section_for_script.
8692         (Orphan_output_section::set_section_address): Same.
8693
8694 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8695
8696         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8697         Fix_v4bx enum values .
8698         * gold/options.h (General_options): New option definitions.
8699         (General_options::fix_v4bx): New method.
8700         (General_options::Fix_v4bx): New enum.
8701         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8702         (General_options::parse_fix_v4bx_interworking): New method.
8703
8704 2010-01-22  Doug Kwan  <dougkwan@google.com>
8705
8706         * arm.cc (Arm_exidx_fixup): New class.
8707
8708 2010-01-21  Doug Kwan  <dougkwan@google.com>
8709
8710         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8711         classes.
8712         (Arm_exidx_section_offset_map): New type.
8713
8714 2010-01-21  Doug Kwan  <dougkwan@google.com>
8715
8716         * arm.cc (Arm_exidx_input_section): New class.
8717         (Arm_relobj::exidx_input_section_by_link,
8718         Arm_relobj::exidx_input_section_by_shndx,
8719         Arm_relobj::make_exidx_input_section): New methods.
8720         (read_arm_attributes_section): Remove.
8721         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8722         information about them.
8723         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8724         to here.
8725
8726 2010-01-20  Doug Kwan  <dougkwan@google.com>
8727
8728         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8729         Input_section_specifier to Section_id.
8730         (Target_arm::new_arm_input_section: Adjust code for change of key
8731         type.
8732         (Target_arm::find_arm_input_section): Ditto.
8733         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8734         (Section_id): Remove.
8735         (Garbage_collection::Section_id_hash): Remove.
8736         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8737         (Section_id): Remove.
8738         (Icf::Section_id_hash): Remove.
8739         * object.h (Section_id, Const_section_id, Section_id_hash,
8740         Const_section_id_hash): New type definitions.
8741         * output.cc (Output_section::add_relaxed_input_section): Change to
8742         use Const_section_id instead of Input_section_specifier as key type.
8743         (Output_section::add_merge_input_section): Ditto.
8744         (Output_section::build_relaxation_map): Change to use Section_id
8745         instead of Input_section_specifier as key type.
8746         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8747         Ditto.
8748         (Output_section::convert_input_sections_to_relaxed_sections): Change
8749         to use Const_section_id instead of Input_section_specifier as key type.
8750         (Output_section::find_merge_section): Ditto.
8751         (Output_section::find_relaxed_input_section): Ditto.
8752         * output.h (Input_section_specifier): Remove class.
8753         (Output_section::Output_section_data_by_input_section_map): Change
8754         key type to Const_section_id.
8755         (Output_section::Output_relaxed_input_section_by_input_section_map):
8756         Ditto.
8757         (Output_section::Relaxation_map): Change key type to Section_id.
8758
8759 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8760
8761         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8762         (class Arm_v4bx_stub): New class.
8763         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8764         (Stub_factory::make_arm_v4bx_stub): New method.
8765         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8766         (Stub_table::empty): Handle v4bx stubs.
8767         (Stub_table::add_arm_v4bx_stub): New method.
8768         (Stub_table::find_arm_v4bx_stub): New method.
8769         (Arm_relocate_functions::v4bx): New method.
8770         (Target_arm::fix_v4bx): New method.
8771         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8772         (Stub_table::relocate_stubs): Likewise.
8773         (Stub_table::do_write): Likewise.
8774         (Stub_table::update_data_size_and_addralign): Likewise.
8775         (Stub_table::finalize_stubs):  Likewise.
8776         (Target_arm::Scan::local): Likewise.
8777         (Target_arm::Scan::global): Likewise.
8778         (Target_arm::do_finalize_sections): Likewise.
8779         (Target_arm::Relocate::relocate): Likewise.
8780         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8781         Likewise.
8782         (Target_arm::scan_reloc_for_stub): Likewise.
8783         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8784
8785 2010-01-19  Ian Lance Taylor  <iant@google.com>
8786
8787         * output.cc (Output_section_headers::do_sized_write): Write large
8788         segment count to sh_info field.
8789         (Output_file_header::do_sized_write): For large segment count,
8790         write PN_XNUM to e_phnum field.
8791
8792 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8793
8794         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8795         (Arm_relocate_functions::thm_jump8): New function.
8796         (Arm_relocate_functions::thm_jump11): New function.
8797         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8798         R_ARM_THM_JUMP11.
8799         (Target_arm::Scan::global): Likewise.
8800         (Target_arm::Relocate::relocate): Likewise.
8801         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8802         Likewise.
8803
8804 2010-01-14  Doug Kwan  <dougkwan@google.com>
8805
8806         * arm.cc (map, utility): Include headers.
8807         (Target_arm::apply_cortex_a8_workaround): New method.
8808         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8809         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8810         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8811         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8812         the --[no-]fix-cortex-a8 command line options.
8813         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8814         (Target_arm::relocate_stub): Use addend in instruction template.
8815         * options.h (DEFINE_bool): Set the user-set flag.
8816         (General_options): Add --[no-]-fix-cortex options.
8817         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8818         : Update fast look-up map after conversion.
8819
8820 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8821
8822         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8823         in the first pass of do_layout.
8824
8825 2010-01-13  Doug Kwan  <dougkwan@google.com>
8826
8827         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8828         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8829         apparent compiler problem of not folding static constant integral
8830         data members of elfcpp::Elf_sizes<32>.
8831
8832 2010-01-13  Doug Kwan  <dougkwan@google.com>
8833
8834         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8835         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8836         Arm_relobj::scan_section_for_cortex_a8_erratum,
8837         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8838         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8839         sections to scan for relocation stubs into a new method
8840         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8841         relocation and Cortex-A8 stub scanning.
8842         (Target_arm::do_relax): Force stubs to be after stubbed sections
8843         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8844         the beginning of a new relaxation pass.  Update a comment.
8845         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8846
8847 2010-01-12  Ian Lance Taylor  <iant@google.com>
8848
8849         * target-reloc.h (visibility_error): New inline function.
8850         (relocate_section): Call visibility_error.
8851         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8852         (MOSTLYCLEANFILES): Likewise.
8853         (protected_4_pic.o, protected_3.err): New targets.
8854         * testsuite/protected_4.cc: New file.
8855
8856 2010-01-12  Doug Kwan  <dougkwan@google.com>
8857
8858         * arm.cc (Cortex_a8_reloc): New class.
8859         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8860         and cortex_a8_relocs_info_.
8861         (Target_arm::fix_cortex_a8): New method definition.
8862         (Target_arm::Cortex_a8_relocs_info): New type.
8863         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8864         New data member declarations.
8865         (Target_arm::scan_reloc_for_stub): Record information about
8866         relocations for THUMB branches that might be exempted from the
8867         Cortex-A8 workaround.
8868         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8869         at the beginning of a relaxation pass.
8870
8871 2010-01-12  Doug Kwan  <dougkwan@google.com>
8872
8873         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8874         (Arm_relobj::Mapping_symbol_position,
8875          Arm_reloj::Mapping_symbol_position_less,
8876          Arm_relobj::Mapping_symbols_info): New types.
8877         (Target_arm::is_mapping_symbol_name): New method definition.
8878         (Arm_relobj::do_count_local_symbols): Save information about mapping
8879         symbols.
8880
8881 2010-01-11  Doug Kwan  <dougkwan@google.com>
8882
8883         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8884         Arm_relocate_functions::thumb32_branch_upper,
8885         Arm_relocate_functions::thumb32_branch_lower,
8886         Arm_relocate_functions::thumb32_cond_branch_offset,
8887         Arm_relocate_functions::thumb32_cond_branch_upper,
8888         Arm_relocate_functions::thumb32_cond_branch_lower,
8889         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8890         branch offset encoding.
8891         (Arm_relocate_functions::thumb_branch_common): Use new branch
8892         offset encoding methods to avoid code duplication.
8893         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8894         (Stub_addend_reader::operator()): Use new branch encoding method
8895         to avoid code duplication.
8896
8897 2010-01-11  Doug Kwan  <dougkwan@google.com>
8898
8899         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8900         (Target_arm::do_finalize_sections): Define special EXIDX section
8901         symbols only if referenced.
8902         * gc.h (Garbage_collection::add_reference): New method.
8903         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8904         code duplication.
8905
8906 2010-01-11  Ian Lance Taylor  <iant@google.com>
8907
8908         * script.cc (Version_script_info::build_expression_list_lookup):
8909         Change complaing about duplicate wildcard match from error to
8910         warning.
8911
8912         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8913         of 2009-12-30.
8914         (Version_script_info::Version_script_info): Initialize globs_,
8915         default_version_, default_is_global_, and exact_.  Don't
8916         initialize globals_ or locals_.
8917         (Version_script_info::build_lookup_tables): Build local symbols
8918         first.
8919         (Version_script_info::unquote): New function.
8920         (Version_script_info::add_exact_match): New function.
8921         (Version_script_info::build_expression_list_lookup): Remove lookup
8922         parameter.  Add is_global parameter.  Change all callers.  Handle
8923         wildcard pattern specially.  Unquote pattern.  Call
8924         add_exact_match.
8925         (Version_script_info::get_name_to_match): New function.
8926         (Version_script_info::get_symbol_version): New function.
8927         (Version_script_info::get_symbol_version_helper): Remove.
8928         (Version_script_info::check_unmatched_names): Call unquote.
8929         * script.h (class Version_script_info): Change get_symbol_version
8930         to be non-inline and add is_global parameter; change all callers.
8931         Rewrite symbol_is_local.  Update declarations.  Define struct
8932         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8933         Remove globals_ and locals_ members.  Add exact_, globs_,
8934         default_version_, is_global_.
8935         (Version_script_info::Glob): Remove pattern, add expression and
8936         is_global.  Update constructor.  Change all callers.
8937         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8938         default version.
8939         (Versions::symbol_section_contents): If a symbol is undefined, or
8940         defined in a dynamic object, set the version index to
8941         VER_NDX_LOCAL.
8942         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8943         symbol_is_local.
8944         (Symbol_table::add_from_pluginobj): Likewise.
8945         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8946
8947 2010-01-11  Doug Kwan  <dougkwan@google.com>
8948
8949         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8950         (incremental_dump_LDADD): Add linking option for libintl.
8951         * Makefile.in: Regenerate.
8952
8953 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8954
8955         PR gold/11144
8956         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8957         instead of -Ds.
8958         * testsuite/Makefile.in: Regenerated.
8959
8960 2010-01-10  Doug Kwan  <dougkwan@google.com>
8961
8962         * options.h (DEFINE_var): Use parentheses around argument varname__
8963         in macro body to avoid any unintended subsequent substitutions.
8964
8965 2010-01-10  Ian Lance Taylor  <iant@google.com>
8966
8967         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8968         candidates before doing symbol resolution.
8969
8970         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8971         ODR candidates if only one is weak.
8972
8973 2010-01-08  Ian Lance Taylor  <iant@google.com>
8974
8975         * script.cc (Version_script_info::build_expression_list_lookup):
8976         Don't warn about ambiguous version, just record the ambiguity.
8977         (Version_script_info::get_symbol_version_helper): Give error if
8978         version is ambiguous.
8979
8980 2010-01-08  Doug Kwan  <dougkwan@google.com>
8981
8982         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8983         prev_data_size_ and prev_addralign_.  Remove initializer for
8984         deleted data member has_been_changed_.
8985         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8986         to determine if the table is empty.
8987         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8988         Remove.
8989         (Stub_table::add_reloc_stub): Define method in class definition
8990         instead of just declaring it there.
8991         (Stub_table::add_cortex_a8_stub): New method definition.
8992         (Stub_table::update_data_size_and_addralign): Ditto.
8993         (Stub_table::finalize_stubs): Ditto.
8994         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8995         (Stub_table::do_addralign_): Return address alignment in the
8996         (Stub_table::do_reset_address_and_file_offset): Define method in
8997         class definition instead of declaring it there.  Set current data
8998         size to be the data size of the previous pass.
8999         (Stub_table::set_final_data_size): Use current data size as the
9000         final data size.
9001         (Stub_table::relocate_stub): Change parameter type of stub from
9002         Reloc_stub pointer to Stub pointer.
9003         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9004         (Stub_table::Cortex_a8_stub_list): New typedef.
9005         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9006          Stub_table::prev_addralign_): New data member.
9007         (Arm_relobj::Arm_relobj): Initialize data member
9008         section_has_cortex_a8_workaround_.
9009         (Arm_relobj::section_has_cortex_a8_workaround,
9010          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9011          definitions.
9012         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9013         declarations.
9014         (Target_arm::relocate_stub): Change parameter type of stub from
9015         Reloc_stub pointer to Stub pointer.
9016         (Insn_template::size, Insn_template::alignment): Handle
9017         THUMB16_SPECIAL_TYPE.
9018         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9019          Stub_table::update_data_size_and_addralign,
9020          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9021         definitions.
9022         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9023         (Stub_table::do_write): Ditto.
9024         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9025
9026 2010-01-08  Ian Lance Taylor  <iant@google.com>
9027
9028         PR 11108
9029         * symtab.h (class Symbol): Remove fields is_target_special_ and
9030         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9031         (Symbol::is_defined_in_discarded_section): New function.
9032         (Symbol::set_is_defined_in_discarded_section): New function.
9033         (Symbol::has_plt_offset): Rewrite.
9034         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9035         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9036         Don't initialize is_target_special_ or has_plt_offset_.
9037         Initialize is_defined_in_discarded_section_.
9038         (Symbol_table::add_from_relobj): If appropriate, set
9039         is_defined_in_discarded_section.
9040         * resolve.cc (Symbol::override_base_with_special): Don't test
9041         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9042         * target-reloc.h (relocate_section): Do special handling for
9043         symbols defined in discarded sections for global symbols as well
9044         as local symbols.
9045
9046 2010-01-08  Ian Lance Taylor  <iant@google.com>
9047
9048         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9049         the SHT_SYMTAB case.
9050
9051 2010-01-08  Ian Lance Taylor  <iant@google.com>
9052
9053         * object.cc (Sized_relobj::do_layout): Don't get confused if
9054         layout_eh_frame returns NULL.
9055
9056 2010-01-08  Ian Lance Taylor  <iant@google.com>
9057
9058         PR 11084
9059         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9060         dynamic symbol table, use the normal symbol table.
9061         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9062         symbol table.
9063
9064 2010-01-08  Ian Lance Taylor  <iant@google.com>
9065
9066         PR 11072
9067         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9068         sections.
9069
9070 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9071
9072         * version.cc (print_version): Change to "Copyright 2010".
9073
9074 2010-01-08  Ian Lance Taylor  <iant@google.com>
9075
9076         PR 10287
9077         PR 11063
9078         * i386.cc (class Target_i386): Change return type of plt_section
9079         to be non-const.
9080         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9081         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9082         tls_desc_rel_ field.
9083         (Output_data_plt_i386::rel_tls_desc): New function.
9084         (Target_i386::rel_tls_desc_section): New function.
9085         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9086         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9087         R_386_TLS_DESC reloc in rel_tls_desc_section.
9088         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9089         Define struct Tlsdesc_info.
9090         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9091         (Target_x86_64::do_reloc_symbol_index): New function.
9092         (Target_x86_64::add_tlsdesc_info): New function.
9093         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9094         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9095         tlsdesc_rel_ field.
9096         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9097         all callers.
9098         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9099         (Target_x86_64::rela_tlsdesc_section): New function.
9100         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9101         handling.
9102         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9103         (Target_x86_64::do_reloc_addend): New function.
9104         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9105         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9106         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9107         (Output_reloc::type): New function.
9108         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9109         (Output_reloc::is_target_specific): New function.
9110         (Output_reloc::target_arg): New function.
9111         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9112         absolute relocs and target specific relocs.
9113         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9114         add_target_specific.
9115         (class Output_data_reloc) [SHT_RELA]: Likewise.
9116         * output.cc (Output_reloc::Output_reloc): Add four new versions
9117         for absolute relocs and target specific relocs.
9118         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9119         (Output_reloc::get_symbol_index): Likewise.
9120         (Output_reloc::local_section_offset): Check that local_sym_index_
9121         is not TARGET_CODE or 0.
9122         (Output_reloc::symbol_value): Likewise.
9123         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9124         reloc.
9125         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9126         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9127         functions.
9128         * layout.cc (add_target_dynamic_tags): Use output section for
9129         DT_PLTRELSZ and DT_JMPREL.
9130
9131 2010-01-07  Ian Lance Taylor  <iant@google.com>
9132
9133         PR 11061
9134         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9135         function.
9136         (class Output_data_reloc_generic): Define.
9137         (class Output_data_reloc_base): Change base class to
9138         Output_data_reloc_generic.  Change add() method to call
9139         bump_relative_reloc_count for a relative reloc.  Remove
9140         sort_relocs_ field.
9141         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9142         to sort_relocs().
9143         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9144         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9145         appropriate.
9146         * layout.h (class Layout): Update declaration.
9147
9148 2010-01-07  Ian Lance Taylor  <iant@google.com>
9149
9150         * output.h (class Output_data): Add const version of
9151         output_section and do_output_section.
9152         (class Output_section_data): Add const version of
9153         do_output_section.
9154         (class Output_section): Likewise.
9155         * layout.cc (Layout::add_target_dynamic_tags): New function.
9156         * layout.h (class Layout): Update declarations.
9157         * arm.cc (Target_arm::do_finalize_sections): Use
9158         add_target_dynamic_tags.
9159         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9160         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9161         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9162         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9163
9164 2010-01-07  Ian Lance Taylor  <iant@google.com>
9165
9166         PR 11042
9167         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9168         object as needed.
9169
9170 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9171             Ian Lance Taylor  <iant@google.com>
9172
9173         PR 11019
9174         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9175         Xindex::read_symtab_xindex.
9176
9177 2010-01-07  Doug Kwan  <dougkwan@google.com>
9178
9179         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9180         (Insn_template::thumb16_bcond_insn): New method declaration.
9181         (Insn_template): Fix spelling.
9182         (Stub::thumb16_special): New method declaration.
9183         (Stub::do_write): Define virtual method which was previously pure
9184         virtual.
9185         (Stub::do_thumb16_special): New method declaration.
9186         (Stub::do_fixed_endian_write): New template member.
9187         (Reloc_stub::do_write): Remove.
9188         (Reloc_stub::do_fixed_endian_write): Remove.
9189         (Cortex_a8_stub): New class definition.
9190         (Stub_factory::make_cortex_a8_stub): New method definition.
9191         (Stub_factory::Stub_factory): Add missing static storage class
9192         qualifier for elf32_arm_stub_a8_veneer_blx.
9193
9194 2010-01-07  Ian Lance Taylor  <iant@google.com>
9195
9196         PR 10980
9197         * options.h (class General_options): Add --warn-unresolved-symbols
9198         and --error-unresolved-symbols.
9199         * errors.cc (Errors::undefined_symbol): Implement
9200         --warn-unresolved-symbols.
9201
9202         * options.h (class General_options): Add -z text and -z textoff.
9203         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9204
9205 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9206
9207         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9208         (Garbage_collection::cident_sections): New function.
9209         (Garbage_collection::add_cident_section): New function.
9210         (Garbage_collection::cident_sections_): New member.
9211         (gc_process_relocs): Add references to sections whose names are C
9212         identifiers.
9213         * gold.h (cident_section_start_prefix): New constant.
9214         (cident_section_stop_prefix): New constant.
9215         (is_cident): New function.
9216         * layout.cc (Layout::define_section_symbols): Replace string constants
9217         with the newly defined constants.
9218         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9219         C identifiers.
9220         * testsuite/Makefile.am: Add gc_orphan_section_test.
9221         * testsuite/Makefile.in: Regenerate.
9222         * testsuite/gc_orphan_section_test.cc: New file.
9223         * testsuite/gc_orphan_section_test.sh: New file.
9224
9225 2010-01-06  Ian Lance Taylor  <iant@google.com>
9226
9227         PR 10980
9228         * options.h (class General_options): Add --warn-shared-textrel.
9229         * layout.cc (Layout::finish_dynamic_section): Implement
9230         --warn-shared-textrel.
9231
9232         PR 10980
9233         * options.h (class General_options): Add --warn-multiple-gp.
9234
9235 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9236
9237         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9238         $(THREADSLIB) and $(LIBDL).
9239         * Makefile.in: Rebuild.
9240
9241 2010-01-06  Ian Lance Taylor  <iant@google.com>
9242
9243         PR 10980
9244         * options.cc (General_options::parse_section_start): New function.
9245         (General_options::section_start): New function.
9246         (General_options::General_options): Initialize all members.
9247         * options.h: Include <map>
9248         (class General_options): Add --section-start.  Add section_starts_
9249         member.
9250         * layout.cc (Layout::attach_allocated_section_to_segment): If
9251         --section-start was used, set the address of the segment.  Remove
9252         local sort_sections.
9253         (Layout::relaxation_loop_body): If the address of the load segment
9254         has been set by --section-start, don't use it.
9255         * output.h (Output_segment::update_flags_for_output_section): New
9256         function.
9257         * output.cc (Output_segment::add_output_section): Call
9258         update_flags_for_output_section.
9259
9260 2010-01-05  Ian Lance Taylor  <iant@google.com>
9261
9262         PR 10980
9263         * options.h (class General_options): Add --undefined-version.
9264         * script.cc (struct Version_expression): Add was_matched_by_symbol
9265         field.
9266         (Version_script_info::matched_symbol): New function.
9267         (Version_script_info::get_symbol_version_helper): Call
9268         matched_symbol.
9269         (Version_script_info::check_unmatched_names): New function.
9270         * script.h (class Version_script_info): Update declarations.
9271         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9272
9273         * options.h (class General_options): Use DEFINE_bool_alias for
9274         allow_multiple_definition.
9275         * resolve.cc (Symbol_table::should_override): Don't test
9276         allow_multiple_definition.
9277
9278         PR 10980
9279         * options.h (class General_options): Add --cref.
9280         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9281         until after printing cref table.
9282         * cref.cc: Include "symtab.h".
9283         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9284         (Cref_table_compare::operator()): New function.
9285         (Cref_inputs::gather_cref): New function.
9286         (filecol): New static const.
9287         (Cref_inputs::print_cref): New function.
9288         (Cref::print_cref): New function.
9289         * cref.h: Include <cstdio>.
9290         (class Cref): Update declarations.
9291         * mapfile.h (Mapfile::file): New function.
9292         * object.h (class Object): Define Symbols.  Declare virtual
9293         do_get_global_symbols.
9294         (Object::get_global_symbols): New function.
9295         * object.cc (Input_objects::add_object): Pass object to cref_ if
9296         --cref.
9297         (Input_objects::archive_start): Likewise.
9298         (Input_objects::archive_stop): Likewise.
9299         (Input_objects::print_cref): New function.
9300         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9301         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9302         --cref.
9303         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9304         function.
9305         * plugin.h (class Sized_pluginobj): Update declarations.
9306
9307 2010-01-05  Ian Lance Taylor  <iant@google.com>
9308
9309         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9310         to is_default_version.  Rename insdef to insdefault.
9311         (Symbol_table::add_from_relobj): Rename def to is_default_version
9312         and local to is_forced_local.
9313         (Symbol_table::add_from_pluginobj): Likewise.
9314         (Symbol_table::add_from_dynobj): Likewise.
9315         (Symbol_table::define_special_symbol): Rename insdef to
9316         insdefault.
9317
9318 2010-01-04  Ian Lance Taylor  <iant@google.com>
9319
9320         PR 10980
9321         * options.h (class General_options): Add
9322         --allow-multiple-definition and -z muldefs.
9323         * resolve.cc (Symbol_table::should_override): Don't warn about a
9324         multiple symbol definition if --allow-multiple-definition or -z
9325         muldefs.
9326
9327         PR 10980
9328         * options.h (class General_options): Add --add-needed and
9329         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9330         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9331         error if --copy-dt-needed-entries aka --add-needed is used and
9332         would cause a change in behaviour.
9333
9334         PR 10980
9335         * options.h (class General_options): Add -G as a short version of
9336         --shared.  Add no-op options -assert, -g, and -i.
9337
9338 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9339
9340         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9341         check for .text or .gnu.linkonce.t sections.
9342         * icf.cc (Icf::find_identical_sections): Ditto.
9343         Change the detection for mangled function name within the section
9344         name.
9345         * icf.h (is_section_foldable_candidate): New function.
9346
9347 2009-12-30  Ian Lance Taylor  <iant@google.com>
9348
9349         PR 10980
9350         * options.h (class General_options): Permit two dashes with
9351         --retain-symbols-file.
9352
9353 2009-12-30  Ian Lance Taylor  <iant@google.com>
9354
9355         PR 10979
9356         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9357         don't put the file header and segment headers in the text
9358         segment.
9359
9360         PR 10979
9361         * common.cc (Sort_commons::operator()): Stabilize sort when both
9362         entries are NULL.
9363         (Symbol_table::do_allocate_commons_list): When allocating common
9364         symbols, skip a symbol which is no longer common.
9365         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9366         an object before checking its type.
9367         * testsuite/common_test_2.c: New file.
9368         * testsuite/common_test_3.c: New file.
9369         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9370         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9371         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9372         (common_test_2_pic.o, common_test_2.so): New targets.
9373         (common_test_3_pic.o, common_test_3.so): New targets.
9374         * testsuite/Makefile.in: Rebuild.
9375
9376         PR 10979
9377         * script.cc (read_input_script): If we see a new SECTIONS clause,
9378         and we have added an input section, give an error.
9379         * layout.h (class Layout): Add have_added_input_section function.
9380         Add have_added_input_section_ field.
9381         * layout.cc (Layout::Layout): Initialize
9382         have_added_input_section_.
9383         (Layout::layout): Set have_added_input_section_.
9384         (Layout::layout_eh_frame): Likewise.
9385
9386 2009-12-30  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10931
9389         * options.h (class General_options): Add --sort-common option.
9390         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9391         * common.cc (Sort_common): Add sort_order parameter to
9392         constructor.  Add sort_order_ field.
9393         (Sort_commons::operator): Check sort_order_.
9394         (Symbol_table::allocate_commons): Determine the sort order.
9395         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9396         Change all callers.
9397         (Symbol_table::do_allocate_commons_list): Likewise.
9398
9399 2009-12-30  Ian Lance Taylor  <iant@google.com>
9400
9401         PR 10916
9402         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9403         symbols from this object, don't change the visibility of an
9404         undefined symbol.
9405         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9406
9407 2009-12-30  Ian Lance Taylor  <iant@google.com>
9408
9409         PR 10861
9410         * script.h (class Version_script_info): Define Language enum.
9411         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9412         new fields globals_, locals_, and is_finalized_.
9413         * script.cc: Various formatting fixes.
9414         (class Parser_closure): Change language_stack_ from a vector of
9415         std::string to one of Version_script_info::Language.  Adjust all
9416         uses accordingly.
9417         (class Lazy_demangler): Remove.
9418         (struct Version_expression): Change language from std::string to
9419         Version_script_info::Language.
9420         (Version_script_info::Version_script_info): New function.
9421         (Version_script_info::~Version_script_info): Don't call clear.
9422         (Version_script_info::finalize): New function.
9423         (Version_script_info::build_lookup_tables): New function.
9424         (Version_script_info::build_expression_list_lookup): New
9425         function.
9426         (Version_script_info::get_symbol_version_helper): Rewrite to use
9427         lookup tables.
9428         (Version_script_info::print_expression_list): Adjust to use
9429         Version_script_info::Language.
9430         (script_push_lex_into_version_mode): Check that the version script
9431         has not been finalized.
9432         (version_script_push_lang): Change language string to
9433         Version_script_info::Language.
9434         * options.cc (Command_line::version_script): New function.
9435         * options.h (class General_options): Add finalize_dynamic_list
9436         function.  Change version_script from declaration to definition.
9437         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9438         * testsuite/version_script.map: Remove duplicate def of foo.
9439         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9440         version_script.map.
9441         * testsuite/Makefile.in: Rebuild.
9442
9443 2009-12-30  Ian Lance Taylor  <iant@google.com>
9444
9445         PR 10843
9446         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9447         if the input symbol index is 0, make the output symbol index 0.
9448
9449 2009-12-30  Ian Lance Taylor  <iant@google.com>
9450
9451         PR 10670
9452         * options.h (class General_options): Add -x/--discard-all.
9453         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9454         --discard-all.  If the local symbol needs a dynamic entry, check
9455         that before handling --discard-locals.
9456
9457 2009-12-30  Ian Lance Taylor  <iant@google.com>
9458
9459         PR 10450
9460         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9461         flags to PF_R.
9462         (Output_segment::add_output_section): Don't change the flags if
9463         the type is PT_TLS.
9464
9465         PR 10450
9466         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9467         GNU hash table if they need a dynamic value.  Otherwise, don't add
9468         them if they are defined in a dynamic object or are forced local.
9469
9470 2009-12-29  Ian Lance Taylor  <iant@google.com>
9471
9472         PR 10450
9473         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9474         .gnu.hash table for a 32-bit target.
9475
9476         PR 10450
9477         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9478         regular and a dynamic object only needs a dynamic symbol table
9479         entry if it is externally visible.
9480
9481         PR 10450
9482         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9483         constructor.  Add global_offset_table_ field.
9484         (Target_i386::got_section): Set global_offset_table_.
9485         (Target_i386::do_finalize_sections): Set global_offset_table_
9486         size.
9487         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9488         in constructor.  Add global_offset_table_ field.
9489         (Target_x86_64::got_section): Set global_offset_table_.
9490         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9491         size.
9492
9493         * layout.cc (Layout::Layout): Initialize increase_relro_.
9494         (Layout::get_output_section): Add is_relro, is_last_relro, and
9495         is_first_non_relro parameters.  Change all callers.
9496         (Layout::choose_output_section): Likewise.
9497         (Layout::add_output_section_data): Likewise.
9498         (Layout::make_output_section): Likewise.
9499         (Layout::set_segment_offsets): Clear increase_relro when using a
9500         linker script.
9501         * layout.h (class Layout): Add increase_relro method.  Add
9502         increase_relro_ field.  Update declarations.
9503         * output.cc (Output_section::Output_section): Initialize
9504         is_last_relro_ and is_first_non_relro_.
9505         (Output_segment::add_output_section): Group relro sections is
9506         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9507         (Output_segment::maximum_alignment): Remove relro handling.
9508         (Output_segment::set_section_addresses): Add increase_relro
9509         parameter.  Change all callers.  Add initial alignment to align
9510         relro sections on separate page.  Remove old relro handling.
9511         (Output_segment::set_section_list_addresses): Remove in_relro
9512         parameter.  Change all callers.
9513         (Output_segment::set_offset): Add increase parameter.  Change all
9514         callers.  Remove old relro handling.
9515         * output.h (class Output_section): Add new methods: is_last_relro,
9516         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9517         Add is_last_relro_ and is_first_non_relro_ fields.
9518         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9519         Create separate .got.plt section.  Call increase_relro.
9520         * x86_64.cc (Target_x86_64::got_section): Likewise.
9521         * testsuite/relro_script_test.t: Add .got.plt.
9522
9523         PR 10450
9524         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9525         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9526         (Layout::finalize): Call set_dynamic_symbol_size.
9527         (Layout::set_dynamic_symbol_size): New function.
9528         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9529         set_dynamic_symbol_size.
9530
9531         PR 10450
9532         * output.h (class Output_section): Add is_entsize_zero_ field.
9533         * output.cc (Output_section::Output_section): Initialize
9534         is_entsize_zero_.
9535         (Output_section::set_entsize): If two different entsizes are
9536         requested, force it to zero.
9537         (Output_section::add_input_section): Set flags for .debug_str
9538         before updating section flags.  Set entsize.
9539         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9540         and SHF_STRING if all input sections have those flags.
9541
9542 2009-12-29   Rafael Espindola  <espindola@google.com>
9543
9544         * main.cc (main): Fix the sys time reporting.
9545         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9546         reporting.
9547
9548 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9549
9550         * options.cc (General_options::parse_version): Allow -v to exit
9551         without an error if there is nothing to link.
9552
9553 2009-12-29  Ian Lance Taylor  <iant@google.com>
9554
9555         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9556         using a version of gcc before 4.1.
9557         * configure: Rebuild.
9558
9559 2009-12-28  Chris Demetriou  <cgd@google.com>
9560
9561         * attributes.cc (Output_attributes_section_data::do_write): Use
9562         std::vector::front rather than std::vector::data.
9563
9564 2009-12-28  Ian Lance Taylor  <iant@google.com>
9565
9566         * symtab.h (class Symbol_table): Add enum Defined.
9567         * resolve.cc (Symbol_table::should_override): Add defined
9568         parameter.  Change all callers.  Test whether object is NULL
9569         before calling a method on it.
9570         (Symbol_table::report_resolve_problem): Add defined parameter.
9571         Change all callers.
9572         (Symbol_table::should_override_with_special): Likewise.
9573         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9574         parameter.  Change all callers.
9575         (Symbol_table::do_define_in_output_data): Likewise.
9576         (Symbol_table::define_in_output_segment): Likewise.
9577         (Symbol_table::do_define_in_output_segment): Likewise.
9578         (Symbol_table::define_as_constant): Likewise.
9579         (Symbol_table::do_define_as_constant): Likewise.
9580         * script.h (class Symbol_assignment): Add is_defsym parameter to
9581         constructor; change all callers.
9582         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9583         parameter.  Change all callers.  Add is_defsym_ field.
9584         (class Parser_closure): Add parsing_defsym parameter to
9585         constructor; change all callers.  Add parsing_defsym accessor
9586         function.  Add parsing_defsym_ field.
9587
9588 2009-12-28  Ian Lance Taylor  <iant@google.com>
9589
9590         * gold.cc (queue_middle_tasks): Fix formatting.
9591         * object.cc (Relobj::is_section_name_included): Likewise.
9592
9593 2009-12-23  Ian Lance Taylor  <iant@google.com>
9594
9595         * i386.cc (Target_i386::do_calls_non_split): Recognize
9596         -fsplit-stack prologue for a function with a static chain.
9597         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9598         -fsplit-stack prologue when using %r11.
9599
9600 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9601
9602         * options.cc (General_options::parse_version): Make -v continue and do
9603         the link like GNU ld does.
9604
9605 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9606
9607         * Makefile.am (CCFILES): Add timer.cc.
9608         (HFILES): Add timer.h.
9609         * configure.ac: Check for sysconf and times.
9610         * main.cc: include timer.h.
9611         (main): Use Timer instead of get_run_time.
9612         * timer.cc: New.
9613         * timer.h: New.
9614         * workqueue.cc: include timer.h.
9615         (Workqueue::find_and_run_task):
9616         Report user, sys and wall time.
9617         * Makefile.in: Regenerate.
9618         * config.in: Regenerate.
9619         * configure: Regenerate.
9620
9621 2009-12-16  Doug Kwan  <dougkwan@google.com>
9622
9623         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9624         sections.
9625         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9626         relaxed input sections.
9627         * output.cc (Output_section::find_relaxed_input_section): Change
9628         return type to Output_relaxed_input_section pointer.  Adjust code
9629         for new type of relaxed_input_section_map_.
9630         * output.h (Output_section::find_relaxed_input_section): Change
9631         return type to Output_relaxed_input_section pointer.
9632         (Output_section::Output_relaxed_input_section_by_input_section_map):
9633         New type.
9634         (Output_section::relaxed_input_section_map_): Change type to
9635         Output_section::Output_relaxed_input_section_by_input_section_map.
9636         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9637         input section.
9638
9639 2009-12-15  Ian Lance Taylor  <iant@google.com>
9640
9641         * layout.cc (Layout::create_shstrtab): Only write out after input
9642         sections if we are compressing debug sections.
9643
9644 2009-12-15  Ian Lance Taylor  <iant@google.com>
9645
9646         * archive.cc (Archive::add_symbols): Only look up a symbol without
9647         a version if there is, in fact, a version.
9648
9649 2009-12-14  Ian Lance Taylor  <iant@google.com>
9650
9651         Revert -Wshadow changes, all changes from:
9652         2009-12-11  Doug Kwan  <dougkwan@google.com>
9653         2009-12-11  Nick Clifton  <nickc@redhat.com>
9654         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9655
9656 2009-12-11  Doug Kwan  <dougkwan@google.com>
9657
9658         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9659         due to -Wshadow.
9660         * attributes.cc (Object_attribute::size): Ditto.
9661         (Attributes_section_data::size): Ditto.
9662         (Attributes_section_data::Attributes_section_data): Ditto.
9663         (Output_attributes_section_data::do_write): Ditto.
9664         * attributes.h (Object_attribute::set_type): Ditto.
9665         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9666
9667 2009-12-11  Nick Clifton  <nickc@redhat.com>
9668
9669         * archive.cc: Fix shadowed variable warnings.
9670         * arm.cc: Likewise.
9671         * compressed_output.cc: Likewise.
9672         * compressed_output.h: Likewise.
9673         * configure: Likewise.
9674         * dwarf_reader.cc: Likewise.
9675         * dynobj.cc: Likewise.
9676         * dynobj.h: Likewise.
9677         * ehframe.cc: Likewise.
9678         * ehframe.h: Likewise.
9679         * errors.cc: Likewise.
9680         * expression.cc: Likewise.
9681         * fileread.cc: Likewise.
9682         * fileread.h: Likewise.
9683         * freebsd.h: Likewise.
9684         * i386.cc: Likewise.
9685         * icf.cc: Likewise.
9686         * incremental.h: Likewise.
9687         * layout.cc: Likewise.
9688         * layout.h: Likewise.
9689         * mapfile.cc: Likewise.
9690         * merge.cc: Likewise.
9691         * merge.h: Likewise.
9692         * object.cc: Likewise.
9693         * object.h: Likewise.
9694         * options.h: Likewise.
9695         * output.cc: Likewise.
9696         * output.h: Likewise.
9697         * parameters.cc: Likewise.
9698         * plugin.cc: Likewise.
9699         * powerpc.cc: Likewise.
9700         * reduced_debug_output.cc: Likewise.
9701         * reduced_debug_output.h: Likewise.
9702         * reloc.cc: Likewise.
9703         * reloc.h: Likewise.
9704         * resolve.cc: Likewise.
9705         * script-sections.cc: Likewise.
9706         * script.cc: Likewise.
9707         * script.h: Likewise.
9708         * sparc.cc: Likewise.
9709         * symtab.cc: Likewise.
9710         * symtab.h: Likewise.
9711         * target-select.cc: Likewise.
9712         * target-select.h: Likewise.
9713         * token.h: Likewise.
9714         * workqueue.cc: Likewise.
9715         * workqueue.h: Likewise.
9716         * x86_64.cc: Likewise.
9717
9718 2009-12-10  Doug Kwan  <dougkwan@google.com>
9719
9720         * arm.cc (attributes.h): New include.
9721         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9722         (Arm_relobj::~Arm_relobj): Delete object pointed by
9723         attributes_section_data_.
9724         (Arm_relobj::attributes_section_data): New method definition.
9725         (Arm_relobj::attributes_section_data_): New data member declaration.
9726         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9727         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9728         attributes_section_data_.
9729         (Arm_dynobj::attributes_section_data): New method definition.
9730         (Arm_dynobj::attributes_section_data_): New data member declaration.
9731         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9732         initialization value of may_use_blx_ to false.
9733         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9734         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9735         object attributes to compute results instead of hard-coding.
9736         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9737         Target_arm::get_secondary_compatible_arch,
9738         Target_arm::set_secondary_compatible_arch
9739         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9740         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9741         New method declarations.
9742         (Target_arm::get_aeabi_object_attribute): New method definition.
9743         (Target_arm::attributes_section_data_): New data member declaration.
9744         (read_arm_attributes_section): New template definition.
9745         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9746         (Arm_dynobj::do_read_symbols): Ditto.
9747         (Target_arm::do_finalize_sections): Merge attributes sections from
9748         input.  Check for BLX use after attributes section merging.
9749         Fix __exidx_start and __exidx_end visibility.  Create an
9750         .ARM.attributes section if necessary.
9751         (Target_arm::get_secondary_compatible_arch,
9752         Target_arm::set_secondary_compatible_arch,
9753         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9754         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9755         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9756         New method definitions.
9757
9758 2009-12-09  Ian Lance Taylor  <iant@google.com>
9759
9760         * plugin.cc (Plugin::load): Don't cast from void* to a function
9761         pointer.
9762
9763 2009-12-09  Ian Lance Taylor  <iant@google.com>
9764
9765         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9766         information fields.
9767
9768 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9769
9770         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9771         Replace two_file_shared_1.so with two_file_shared_2.so.
9772         * testsuite/Makefile.in: Regenerated.
9773
9774 2009-12-08  Doug Kwan  <dougkwan@google.com>
9775
9776         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9777         (HFILES): Add attributes.h and int_encoding.h.
9778         * Makefile.in: Regenerate.
9779         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9780         function definitions to int_encoding.cc
9781         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9782         prototypes to int_encoding.h
9783         * reduced_debug_output.cc (int_encoding.h): New include.
9784         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9785         function definitions to int_encoding.cc
9786         (insert_into_vector, read_from_pointer): Move template definitions to
9787         int_encoding.h
9788         * attributes.cc: New file.
9789         * attributes.h: New file.
9790         * int_encoding.cc: New file.
9791         * int_encoding.h: New file.
9792
9793 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9794
9795         PR gold/11055
9796         * incremental-dump.cc (dump_incremental_inputs): New.
9797         (main): Use dump_incremental_inputs.
9798
9799 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9800
9801         PR gold/10893
9802         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9803         checking elfcpp::STT_FUNC.
9804         (Target_i386::Relocate::relocate): Likewise.
9805         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9806
9807         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9808         symbols from shared libraries into normal FUNC symbols.
9809
9810         * symtab.h (Symbol): Add is_func and use it.
9811
9812 2009-12-05  Doug Kwan  <dougkwan@google.com>
9813
9814         * arm.cc (Target_arm::arm_info): Initialize new fields
9815         attributes_section and attributes_vendor.
9816         * i386.cc (Target_i386::i386_info): Same.
9817         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9818         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9819         fields attributes_section and attributes_vendor.
9820         * sparc.cc (Target_sparc::sparc_info): Same.
9821         * target.h (Target::attributes_section, Target::attributes_vendor,
9822         Target::is_attributes_section, Target::attribute_arg_type,
9823         Target::attributes_order): New method definitions.
9824         (Target::Target_info::attributes_section,
9825         Target::Target_info::attributes_vendor): New fields.
9826         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9827         virtual method definitions.
9828         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9829         attributes_section and attributes_vendor.
9830         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9831
9832 2009-12-05  Doug Kwan  <dougkwan@google.com>
9833
9834         * arm.cc: Update comments about interworking and stub generation.
9835         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9836         considered as non-PIC.
9837         (Arm_relocate_functions::base_abs): Fix formatting.
9838         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9839         of function to use GOT entry address instead of offset.
9840         (Target_arm::Scan::global): Issue an error if a symbol would need a
9841         PLT does not get one because it is untyped.  Remove code to create
9842         dynamic symbols for relative branches.
9843         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9844         takes unsigned integer instead of boolean.
9845
9846 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9847
9848         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9849         (two_file_test_LDADD): Likewise.
9850         (common_test_1_LDADD): Likewise.
9851         (exception_test_LDADD) Likewise.
9852         (weak_test_LDADD): Likewise.
9853         (many_sections_test_LDADD): Likewise.
9854         (initpri1_LDADD): Likewise.
9855         (script_test_1_LDADD): Likewise.
9856         (script_test_2_LDADD): Likewise.
9857         (justsyms_LDADD): Likewise.
9858         (binary_test_LDADD): Likewise.
9859         (large_LDADD): Likewise.
9860         * testsuite/Makefile.in: Regenerated.
9861
9862 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9863
9864         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9865         (Symbol_table::override_with_special): Likewise.
9866         (Symbol_table::add_from_object): Likewise.
9867
9868 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9869
9870         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9871         Don't set the data_offset twice.
9872
9873 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9874
9875         * testsuite/Makefile.in: Regenerate.
9876
9877 2009-12-03  Doug Kwan  <dougkwan@google.com>
9878
9879         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9880         (Target_arm::do_finalize_sections): Add parameter for symbol table
9881         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9882         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9883         parameter for symbol table pointer.
9884         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9885         an additional parameter for a pointer to symbol table.
9886         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9887         parameter for a symbol table pointer.
9888         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9889         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9890         Ditto.
9891         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9892         parameter for a symbol table pointer.
9893
9894 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9895
9896         * incremental.cc (Incremental_inputs_header)
9897         (Incremental_inputs_header_write, Incremental_inputs_entry)
9898         (Incremental_inputs_entry_write): Move ...
9899         * incremental.h (Incremental_inputs_header)
9900         (Incremental_inputs_header_write, Incremental_inputs_entry)
9901         (Incremental_inputs_entry_write): here.
9902
9903 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9904
9905         * incremental.cc (make_sized_incremental_binary): Set the target.
9906         Error if it is incompatible.
9907         * output.h (Output_file): Add filename method.
9908
9909 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9910
9911         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9912         from the get_* methods.
9913
9914 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9915
9916         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9917         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9918         Write 0 for the data_offset of scripts.
9919
9920 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9921
9922         * testsuite/Makefile.am: Add the incremental_test.sh test.
9923         * testsuite/incremental_test.sh: New.
9924         * testsuite/incremental_test_1.c: New.
9925         * testsuite/incremental_test_2.c: New.
9926
9927 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9928
9929         * incremental-dump.cc (main): Fix typos.
9930
9931 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9932
9933         PR gold/11025
9934         * incremental-dump.cc (main): Use llu to print 64 bit values.
9935
9936 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9937             H.J. Lu  <hongjiu.lu@intel.com>
9938
9939         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9940         $(LIBDL).
9941         (incremental_dump_LDADD): Likewise.
9942         * Makefile.in: Regenerated.
9943
9944 2009-11-25  Doug Kwan  <dougkwan@google.com>
9945
9946         Revert:
9947
9948         2009-11-25  Doug Kwan  <dougkwan@google.com>
9949
9950                 * arm.cc (Target_arm::Target_arm): Move method definition
9951                 outside of class definition.  Add code to handle
9952                 --target1-rel, --target1-abs and --target2= options.
9953                 (Target_arm::get_reloc_reloc_type): Change method to be
9954                 non-static and const.
9955                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9956                 New data member declaration.
9957                 (Target_arm::Scan::local, Target_arm::Scan::global,
9958                 Target_arm::Relocate::relocate,
9959                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9960                 Adjust call to Target_arm::get_real_reloc_type.
9961                 (Target_arm::get_real_reloc_type): Use command line options
9962                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9963                 * options.h (--target1-rel, --target1-abs, --target2): New
9964                 ARM-only options.
9965
9966 2009-11-25  Doug Kwan  <dougkwan@google.com>
9967
9968         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9969         class definition.  Add code to handle --target1-rel, --target1-abs
9970         and --target2= options.
9971         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9972         and const.
9973         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9974         member declaration.
9975         (Target_arm::Scan::local, Target_arm::Scan::global,
9976         Target_arm::Relocate::relocate,
9977         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9978         call to Target_arm::get_real_reloc_type.
9979         (Target_arm::get_real_reloc_type): Use command line options to
9980         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9981         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9982         options.
9983
9984 2009-11-25  Doug Kwan  <dougkwan@google.com>
9985
9986         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9987         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9988         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9989         formatting.
9990         (Arm_relocate_functions::thm_call): Replace body with a call to
9991         Arm_relocate_functions::thumb_branch_common.
9992         (Arm_relocate_functions::thm_jump24,
9993         Arm_relocate_functions::thm_xpc22): New method definitions.
9994         (Arm_relocate_functions::thumb_branch_common): New method definition.
9995         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9996         operator.
9997         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9998         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9999
10000 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10001
10002         * Makefile.am: Build incremental-dump
10003         * Makefile.in: Regenerate.
10004         * incremental-dump.cc: New.
10005         * incremental.cc (Incremental_inputs_header_data,
10006         Incremental_inputs_entry_data): Move to incremental.h
10007         * incremental.h: (Incremental_inputs_header_data,
10008         Incremental_inputs_entry_data): Move from incremental.cc
10009
10010 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10011
10012         * incremental.cc (Incremental_inputs_header,
10013         Incremental_inputs_header_write, Incremental_inputs_entry,
10014         Incremental_inputs_entry_write): Add a typedef with the data type.
10015
10016 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10017
10018         * incremental.cc (Incremental_inputs_header,
10019         Incremental_inputs_header_write, Incremental_inputs_entry,
10020         Incremental_inputs_entry_write): Update comment about which
10021         type has the filed descriptions.
10022
10023 2009-11-15  Doug Kwan  <dougkwan@google.com>
10024
10025         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10026         (Arm_relocate_functions::arm_branch_common): Change method defintion
10027         in class definition to a method declaration and update list of formal
10028         parameters.
10029         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10030         Arm_relocation_functions::jump24): Adjust call to
10031         Arm_relocate_functions::arm_branch_common.  Update list of formal
10032         parameters.
10033         (Arm_relocate_functions::xpc25): New method definition.
10034         (Arm_relocate_functions::arm_branch_common): Move method defintion
10035         out from class definition.  Use stubs for mode-switching and extending
10036         branch ranges.
10037         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10038         specially.  Change code to enable use of stubs in ARM branches.
10039
10040 2009-11-10  Doug Kwan  <dougkwan@google.com>
10041
10042         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10043         in method declaration.
10044         (Target_arm::relocate_stub): New method declaration.
10045         (Target_arm::default_target): Change to return a pointer instead of
10046         a const reference.
10047         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10048         Target_arm::default_target.
10049         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10050         method definition.
10051         (Target_arm::relocate_section): Adjust view.
10052         (Target_arm::relocate_stub): New method definition.
10053
10054 2009-11-10  Doug Kwan  <dougkwan@google.com>
10055
10056         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10057         a format warning.
10058         * incremental.cc (open_incremental_binary): Initialized local
10059         variables to avoid warnings.
10060         * object.cc (make_elf_object): Ditto.
10061         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10062         a format warning.
10063
10064 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10065
10066         PR gold/10930
10067         * testsuite/plugin_test.c: Include "config.h".
10068
10069 2009-11-09  Doug Kwan  <dougkwan@google.com>
10070
10071         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10072         (arm_symbol_value): Remove.
10073         (Arm_relocate_functions::arm_branch_common,
10074         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10075         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10076         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10077         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10078         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10079         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10080         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10081         Arm_relocate_functions::thm_mobw_abs_nc,
10082         Arm_relocate_functions::thm_mov_abs,
10083         Arm_relocate_functions::movw_prel_nc,
10084         Arm_relocate_functions::thm_movt_abs,
10085         Arm_relocate_functions::movt_prel,
10086         Arm_relocate_functions::thm_movw_prel_nc,
10087         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10088         (Target_arm::Relocate::relocate): Only decompose address into two
10089         parts if relocation type uses the thumb-bit and pass the actual
10090         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10091         calls to methods in Arm_relocate_functions for this change.
10092
10093 2009-11-08  Ian Lance Taylor  <iant@google.com>
10094
10095         PR 10925
10096         * reloc.cc: Instantiate
10097         Sized_relobj::initialize_input_to_output_maps and
10098         Sized_relobj:free_input_to_output_maps.
10099
10100 2009-11-06  Ian Lance Taylor  <iant@google.com>
10101
10102         PR 10876
10103         * defstd.cc (in_segment): Set only_if_ref true for "end".
10104
10105 2009-11-06  Doug Kwan  <dougkwan@google.com>
10106
10107         * arm.cc (class Reloc_stub): Correct a comment.
10108         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10109         (Target_arm::scan_section_for_stubs): New method declaration.
10110         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10111         Change methods from private to protected.
10112         (Target_arm::do_may_relax): New method definition.
10113         (Target_arm::do_relax, Target_arm::group_sections,
10114         Target_arm::scan_reloc_for_stub,
10115         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10116         (Target_arm::arm_input_section_map_): New data member declaration.
10117         (Target_arm::scan_reloc_for_stub,
10118         Target_arm::scan_reloc_section_for_stubs,
10119         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10120         Target_arm::do_relax): New method definitions.
10121
10122 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10123
10124         * configure.ac: Check for (struct stat)::st_mtim
10125         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10126         * config.in: Regenerate.
10127         * configure: Regenerate.
10128
10129 2009-11-05  Ian Lance Taylor  <iant@google.com>
10130
10131         PR 10910
10132         * output.cc (Output_segment::add_output_section): Add missing
10133         return statement.
10134
10135 2009-11-04  Ian Lance Taylor  <iant@google.com>
10136
10137         PR 10880
10138         * object.h (class Object): Add is_needed and set_is_needed
10139         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10140         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10141         defined in a dynamic object and referenced by a regular object,
10142         set is_needed for the dynamic object.
10143         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10144         if the file is marked with as_needed and it is not needed.
10145
10146 2009-11-04  Ian Lance Taylor  <iant@google.com>
10147
10148         PR 10887
10149         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10150         tags if data is discarded by linker script.
10151         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10152         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10153         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10154         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10155
10156 2009-11-04  Ian Lance Taylor  <iant@google.com>
10157
10158         * layout.cc (Layout::get_output_section): Add is_interp and
10159         is_dynamic_linker_section parameters.  Change all callers.
10160         (Layout::choose_output_section): Likewise.
10161         (Layout::make_output_section): Likewise.
10162         (Layout::add_output_section_data): Add is_dynamic_linker_section
10163         parameter.  Change all callers.
10164         * layout.h (class Layout): Update declarations.
10165         * output.h (class Output_section): Add is_interp, set_is_interp,
10166         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10167         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10168         generate_code_fills_at_write_ to a bitfield.
10169         * output.cc (Output_section::Output_sections): Initialize new
10170         fields.
10171         (Output_segment::add_output_section): Add do_sort parameter.
10172         Change all callers.
10173
10174 2009-11-03  Ian Lance Taylor  <iant@google.com>
10175
10176         PR 10860
10177         * options.h (class General_options): Add --warn-common.
10178         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10179         merging two common symbols.
10180         (Symbol_table::should_override): Handle --warn-common when merging
10181         a common symbol with a defined symbol.  Use report_resolve_problem
10182         for multiple definitions.
10183         (Symbol_table::report_resolve_problem): New function.
10184         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10185
10186 2009-11-03  Doug Kwan  <dougkwan@google.com>
10187
10188         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10189         stub_factory_.
10190         (Target_arm::stub_factory): New method definition.
10191         (Target_arm::new_arm_input_section,
10192         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10193         Target_arm::reloc_uses_thumb_bit): New method declarations.
10194         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10195         New type definitions.
10196         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10197         member declarations.
10198         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10199         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10200         New method definitions.
10201
10202 2009-11-03  Ian Lance Taylor  <iant@google.com>
10203
10204         * options.h (class General_options): Add --warn_constructors.
10205
10206 2009-11-03  Ian Lance Taylor  <iant@google.com>
10207
10208         PR 10893
10209         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10210         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10211
10212 2009-11-03  Ian Lance Taylor  <iant@google.com>
10213
10214         PR 10895
10215         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10216         --msgid-bugs-address.
10217         (install-pdf): New target.
10218         (install-data_yes): Look up one directory to find mkinstalldirs.
10219
10220 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10221
10222         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10223         tree.
10224
10225 2009-10-30  Doug Kwan  <dougkwan@google.com>
10226
10227         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10228
10229 2009-10-30  Doug Kwan  <dougkwan@google.com>
10230
10231         * arm.cc (Stub_addend_reader): New struct template definition
10232         and partial specializations.
10233         (Stub_addend_reader::operator()): New method definition for a
10234         partially specialized template.
10235
10236 2009-10-30  Doug Kwan  <dougkwan@google.com>
10237
10238         * arm.cc (Arm_relobj::processor_specific_flags): New method
10239         definition.
10240         (Arm_relobj::do_read_symbols): New method declaration.
10241         (Arm_relobj::processor_specific_flags_): New data member declaration.
10242         (Arm_dynobj): New class definition.
10243         (Target_arm::do_finalize_sections): Add input_objects parameter.
10244         (Target_arm::do_adjust_elf_header): New method declaration.
10245         (Target_arm::are_eabi_versions_compatible,
10246         (Target_arm::merge_processor_specific_flags): New method declaration.
10247         (Target_arm::do_make_elf_object): New overloaded method definitions
10248         and declaration.
10249         (Arm_relobj::do_read_symbols): New method definition.
10250         (Arm_dynobj::do_read_symbols): Ditto.
10251         (Target_arm::do_finalize_sections): Add input_objects parameters.
10252         Merge processor-specific flags from all input objects.
10253         (Target_arm::are_eabi_versions_compatible,
10254         Target_arm::merge_processor_specific_flags,
10255         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10256         New method definitions.
10257         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10258         Input_objects pointer type parameter.
10259         * layout.cc (Layout::finalize): Pass input objects to target's.
10260         finalize_sections function.
10261         * output.cc (Output_file_header::do_sized_write): Set ELF file
10262         header's processor-specific flags.
10263         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10264         Input_objects pointer type parameter.
10265         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10266         * target.h (Input_objects): New forward class declaration.
10267         (Target::processor_specific_flags,
10268         Target::are_processor_specific_flags_sect): New method definitions.
10269         (Target::finalize_sections): Add input_objects parameter.
10270         (Target::Target): Initialize processor_specific_flags_ and
10271         are_processor_specific_flags_set_.
10272         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10273         parameter.
10274         (Target::set_processor_specific_flags): New method definition.
10275         (Target::processor_specific_flags_,
10276         Target::are_processor_specific_flags_set_): New data member
10277         declarations.
10278         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10279         Input_objects pointer type parameter.
10280
10281 2009-10-30  Doug Kwan  <dougkwan@google.com>
10282
10283         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10284
10285 2009-10-28  Ian Lance Taylor  <iant@google.com>
10286
10287         * object.h (class Relobj): Drop options parameter from
10288         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10289         do_scan_relocs, do_relocate.  Change all callers.
10290         (class Sized_relobj): Drop options parameters from
10291         do_gc_process_relocs, do_scan_relocs, do_relocate,
10292         do_relocate_sections, relocate_sections, emit_relocs_scan,
10293         emit_relocs_scan_reltype.  Change all callers.
10294         (struct Relocate_info): Remove options field and all references to
10295         it.
10296         * reloc.h (class Read_relocs): Remove options constructor
10297         parameter and options_ field.  Change all callers.
10298         (class Gc_process_relocs, class Scan_relocs): Likewise.
10299         (class Relocate_task): Likewise.
10300         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10301         all callers.
10302         (scan_relocatable_relocs): Likewise.
10303         * target.h (class Sized_target): Remove options parameter from
10304         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10305         all callers.
10306         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10307         callers.
10308         * arm.cc: Update functions to remove options parameters.
10309         * i386.cc: Likewise.
10310         * powerpc.cc: Likewise.
10311         * sparc.cc: Likewise.
10312         * x86_64.cc: Likewise.
10313         * testsuite/testfile.cc: Likewise.
10314
10315 2009-10-28  Doug Kwan  <dougkwan@google.com>
10316
10317         * arm.cc (Arm_relobj): New class definition.
10318         (Arm_relobj::scan_sections_for_stubs,
10319         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10320         New method definitions.
10321
10322 2009-10-28  Cary Coutant  <ccoutant@google.com>
10323
10324         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10325         (Plugin::cleanup_done_): New member.
10326         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10327         (Plugin_manager::cleanup_done_): Remove.
10328         (Plugin_manager::add_input_file): Edit error message.
10329         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10330         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10331
10332 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10333
10334         * fileread.cc: (File_read::View::~View): Use the new
10335         data_ownership_ filed.
10336         (File_read::~File_read): Dispose the new whole_file_view_.
10337         (File_read::open): Mmap the whole file if needed.
10338         (File_read::open): Use whole_file_view_ instead of contents_.
10339         (File_read::find_view): Use whole_file_view_ if applicable.
10340         (File_read::do_read): Use whole_file_view_ instead of contents_.
10341         (File_read::make_view): Use whole_file_view_ instead of contents_,
10342         update File_read::View::View call.
10343         (File_read::find_or_make_view): Update File_read::View::View
10344         call.
10345         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10346         remove contents_
10347         (File_read::View::Data_ownership): New enum.
10348         (File_read::View::View): Replace bool mapped_ with Data_ownership
10349         argument.
10350         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10351         (File_read::View::data_ownership_): New field.
10352         (File_read::contents_): Remove (replaced by whole_file_view_).
10353         (File_read::whole_file_view_): New field.
10354         * options.h (class General_options): Add --keep-files-mapped.
10355
10356 2009-10-27  Cary Coutant  <ccoutant@google.com>
10357
10358         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10359         * testsuite/Makefile.am (plugin_test_5): New test case.
10360         * testsuite/Makefile.in: Regenerate.
10361
10362 2009-10-25  Doug Kwan  <dougkwan@google.com>
10363
10364         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10365         from private to protected to allow access by child class.
10366         (Sized_relobj::do_relocate_sections): New method declaration.
10367         (Sized_relobj::relocate_sections): Virtualize.
10368         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10369         Sized_relobj::relocate_sections.  Instantiate template explicitly
10370         for different target sizes and endianity.
10371
10372 2009-10-24  Doug Kwan  <dougkwan@google.com>
10373
10374         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10375         (Arm_input_section::as_arm_input_section): New method.
10376         (Arm_output_section): New class definition.
10377         (Arm_output_section::create_stub_group,
10378         Arm_output_section::group_sections): New method definitions.
10379
10380 2009-10-22  Doug Kwan  <dougkwan@google.com>
10381
10382         * arm.cc (Arm_input_section): New class definition.
10383         (Arm_input_section::init, Arm_input_section:do_write,
10384         Arm_input_section::set_final_data_size,
10385         Arm_input_section::do_reset_address_and_file_offset): New method
10386         definitions.
10387
10388 2009-10-21  Doug Kwan  <dougkwan@google.com>
10389
10390         * arm.cc (Stub_table, Arm_input_section): New forward class
10391         declarations.
10392         (Stub_table): New class defintion.
10393         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10394         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10395         New method definition.
10396
10397 2009-10-21  Doug Kwan  <dougkwan@google.com>
10398
10399         * arm.cc: Update copyright comments.
10400         (Target_arm): New forward class template declaration.
10401         (Arm_address): New type.
10402         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10403         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10404         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10405         constants.
10406         (Insn_template): Same.
10407         (DEF_STUBS): New macro.
10408         (Stub_type): New enum type.
10409         (Stub_template): New class definition.
10410         (Stub): Same.
10411         (Reloc_stub): Same.
10412         (Stub_factory): Same.
10413         (Target_arm::Target_arm): Initialize may_use_blx_ and
10414         should_force_pic_veneer_.
10415         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10416         Target_arm::should_force_pic_veneer,
10417         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10418         Target_arm::using_thumb_only, Target_arm:;default_target): New
10419         method defintions.
10420         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10421         New data member declarations.
10422         (Insn_template::size, Insn_template::alignment): New method defintions.
10423         (Stub_template::Stub_template): New method definition.
10424         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10425         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10426         (Stub_factory::Stub_factory): New method definition.
10427         * gold.h (string_hash): New template.
10428         * output.h (Input_section_specifier::hash_value): Use
10429         gold::string_hash.
10430         (Input_section_specifier::string_hash): Remove.
10431         * stringpool.cc (Stringpool_template::string_hash): Use
10432         gold::string_hash.
10433
10434 2009-10-20  Doug Kwan  <dougkwan@google.com>
10435
10436         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10437         symbols of relaxed input sections.
10438         * output.h (Output_section::find_relaxed_input_section): Make
10439         method public.
10440
10441 2009-10-16  Doug Kwan  <dougkwan@google.com>
10442
10443         * dynobj.cc (Versions::Versions): Initialize version_script_.
10444         Only insert base version symbol definition for a shared object
10445         if version script defines any version versions.
10446         (Versions::define_base_version): New method definition.
10447         (Versions::add_def): Check that base version is not needed.
10448         (Versions::add_need): Define base version lazily.
10449         * dynobj.h (Versions::define_base_version): New method declaration.
10450         (Versions::needs_base_version_): New data member declaration.
10451         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10452         (check_DATA): Add no_version_test.stdout.
10453         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10454         New make rules.
10455         * testsuite/Makefile.in: Regenerate.
10456         * testsuite/no_version_test.c: New file.
10457         * testsuite/no_version_test.sh: Ditto.
10458
10459 2009-10-16  Doug Kwan  <dougkwan@google.com>
10460
10461         * expression.cc (class Segment_start_expression): New class definition.
10462         (Segment_start_expression::value): New method definition.
10463         (script_exp_function_segment_start): Return a new
10464         Segment_start_expression.
10465         * gold/script-c.h (script_saw_segment_start_expression): New function
10466         prototype.
10467         * script-sections.cc (Script_sections::Script_sections): Initialize
10468         SAW_SEGMENT_START_EXPRESSION_ to false.
10469         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10470         and -Tbbs options to specify section addresses if given in
10471         command line and no SEGMENT_START expression is seen in a script.
10472         * script-sections.h (Script_sections::saw_segment_start_expression,
10473         Script_sections::set_saw_segment_start_expression): New method
10474         definition.
10475         (Script_sections::saw_segment_start_expression_): New data member
10476         declaration.
10477         * script.cc (script_saw_segment_start_expression): New function.
10478         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10479         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10480         script_test_7.sh and script_test_8.sh.
10481         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10482         script_test_8.stdout.
10483         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10484         (script_test_6, script_test_6.stdout, script_test_7,
10485         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10486         * Makefile.in: Regenerate.
10487         * testsuite/script_test_6.sh: New file.
10488         * testsuite/script_test_6.t: Same.
10489         * testsuite/script_test_7.sh: Same.
10490         * testsuite/script_test_7.t: Same.
10491         * testsuite/script_test_8.sh: Same.
10492
10493 2009-10-16  Doug Kwan  <dougkwan@google.com>
10494
10495         * output.cc (Output_segment::set_section_list_address): Cast
10496         expressions to unsigned long long type to avoid format warnings.
10497
10498 2009-10-15  Ian Lance Taylor  <iant@google.com>
10499
10500         * script.cc (Script_options::add_symbol_assignment): Always add a
10501         dot assignment to script_sections_.
10502         * script-sections.cc (Script_sections::add_dot_assignment):
10503         Initialize if necessary.
10504
10505         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10506         program headers with no load segment if there is a linker script.
10507
10508         * layout.cc (Layout::set_segment_offsets): Align the file offset
10509         to the segment aligment for -N or -n with no load segment.
10510         * output.cc (Output_segment::add_output_section): Don't crash if
10511         the first section is a TLS section.
10512         (Output_segment::set_section_list_addresses): Print an error
10513         message if the address moves backward in a linker script.
10514         * script-sections.cc
10515         (Output_section_element_input::set_section_addresses): Don't
10516         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10517         (Orphan_output_section::set_section_addresses): Likewise.
10518
10519 2009-10-15  Doug Kwan  <dougkwan@google.com>
10520
10521         * layout.cc (Layout::finish_dynamic_section): Generate tags
10522         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10523         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10524         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10525
10526 2009-10-14  Ian Lance Taylor  <iant@google.com>
10527
10528         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10529         fields.
10530         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10531         data_shdr fields of relinfo.
10532         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10533         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10534         R_386_TLS_LDO_32, adjust based on section flags.
10535         (Target_i386::Relocate::fix_up_ldo): Remove.
10536
10537 2009-10-13  Ian Lance Taylor  <iant@google.com>
10538
10539         Add support for -pie.
10540         * options.h (class General_options): Add -pie and
10541         --pic-executable.
10542         (General_options::output_is_position_independent): Test -pie.
10543         (General_options::output_is_executable): Return true if not shared
10544         and not relocatable.
10545         (General_options::output_is_pie): Remove.
10546         * options.cc (General_options::finalize): Reject incompatible uses
10547         of -pie.
10548         * gold.cc (queue_middle_tasks): A -pie link is not static.
10549         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10550         * symtab.cc (Symbol::final_value_is_known): Return false if
10551         output_is_position_independent.
10552         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10553         output_is_position_independent.
10554         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10555         output_is_position_independent.
10556         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10557         output_is_position_independent.
10558         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10559         two_file_pie_test.
10560         (basic_pie_test.o, basic_pie_test): New targets.
10561         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10562         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10563         (two_file_pie_test): New target.
10564         * testsuite/Makefile.in: Rebuild.
10565         * README: Remove note saying that -pie is not supported.
10566
10567 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10568
10569         * options.h (class General_options): Add -init and -fini.
10570         * layout.cc (Layout::finish_dynamic_section): Emit
10571         given init and fini functions.
10572
10573 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10574
10575         * gc.h (gc_process_relocs): Check if icf is enabled using new
10576         function.
10577         * gold.cc (queue_initial_tasks): Likewise.
10578         (queue_middle_tasks): Likewise.
10579         * object.cc (do_layout): Likewise.
10580         * symtab.cc (is_section_folded): Likewise.
10581         * main.cc (main): Likewise.
10582         * reloc.cc (Read_relocs::run): Likewise.
10583         (Sized_relobj::do_scan_relocs): Likewise.
10584         * icf.cc (is_function_ctor_or_dtor): New function.
10585         (Icf::find_identical_sections): Check if function is ctor or dtor when
10586         safe icf is chosen.
10587         * options.h (General_options::icf): Change option to be an enum.
10588         (Icf_status): New enum.
10589         (icf_enabled): New method.
10590         (icf_safe_folding): New method.
10591         (set_icf_status): New method.
10592         (icf_status_): New variable.
10593         * (options.cc) (General_options::finalize): Set icf_status_.
10594         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10595         icf_test and icf_keep_unique_test to use the --icf enum flag.
10596         * testsuite/icf_safe_test.sh: New file.
10597         * testsuite/icf_safe_test.cc: New file.
10598
10599 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10600
10601         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10602         includes to gc.h and icf.h.
10603         * arm.cc: Include gc.h.
10604         * gold.cc: Likewise.
10605         * i386.cc: Likewise.
10606         * powerpc.cc: Likewise.
10607         * sparc.cc: Likewise.
10608         * x86_64.cc: Likewise.
10609         * gc.h: Include icf.h.
10610
10611 2009-10-11  Ian Lance Taylor  <iant@google.com>
10612
10613         * plugin.cc: Include "gold.h" before other header files.
10614
10615 2009-10-10  Chris Demetriou  <cgd@google.com>
10616
10617         * options.h (Input_file_argument::Input_file_type): New enum.
10618         (Input_file_argument::is_lib_): Replace with...
10619         (Input_file_argument::type_): New member.
10620         (Input_file_argument::Input_file_argument): Take Input_file_type
10621         'type' rather than boolean 'is_lib' as second argument.
10622         (Input_file_argument::is_lib): Use type_.
10623         (Input_file_argument::is_searched_file): New function.
10624         (Input_file_argument::may_need_search): Handle is_searched_file.
10625         * options.cc (General_options::parse_library): Support -l:filename.
10626         (General_options::parse_just_symbols): Update for Input_file_argument
10627         changes.
10628         (Command_line::process): Likewise.
10629         * archive.cc (Archive::get_file_and_offset): Likewise.
10630         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10631         * script.cc (read_script_file, script_add_file): Likewise.
10632         * fileread.cc (Input_file::Input_file): Likewise.
10633         (Input_file::will_search_for): Handle is_searched_file.
10634         (Input_file::open): Likewise.
10635         * readsyms.cc (Read_symbols::get_name): Likewise.
10636         * testsuite/Makefile.am (searched_file_test): New test.
10637         * testsuite/Makefile.in: Regenerate.
10638         * testsuite/searched_file_test.cc: New file.
10639         * testsuite/searched_file_test_lib.cc: New file.
10640
10641 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10642             Ian Lance Taylor  <iant@google.com>
10643
10644         * descriptor.cc: Include <cstdio> and "binary-io.h".
10645         (Descriptors::open): Open the files in binary mode always.
10646         * script.cc (Lex::get_token): Treat \r as whitespace.
10647
10648 2009-10-09  Ian Lance Taylor  <iant@google.com>
10649
10650         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10651
10652 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10653             Ian Lance Taylor  <iant@google.com>
10654
10655         * configure.ac: Check for readv function also.
10656         * fileread.cc (readv): Define if not HAVE_READV.
10657         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10658         does not exist.
10659         * config.in: Regenerate.
10660         * configure: Regenerate.
10661
10662 2009-10-09  Doug Kwan  <dougkwan@google.com>
10663
10664         * layout.cc (Layout::make_output_section): Call target hook to make
10665         ordinary output section.
10666         (Layout::finalize): Adjust parameter list of call the
10667         Target::may_relax().
10668         * layout.h (class Layout::section_list): New method.
10669         * merge.h (Output_merge_base::entsize): Change visibility to public.
10670         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10671         New methods.
10672         (Output_merge_string::do_is_string): New method.
10673         * object.cc (Sized_relobj::do_setup): renamed from
10674         Sized_relobj::set_up.
10675         * object.h (Sized_relobj::adjust_shndx,
10676         Sized_relobj::initializ_input_to_output_maps,
10677         Sized_relobj::free_input_to_output_maps): Change visibilities to
10678         protected.
10679         (Sized_relobj::setup): Virtualize.
10680         (Sized_relobj::do_setup): New method declaration.
10681         (Sized_relobj::invalidate_section_offset,
10682         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10683         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10684         * options.cc (parse_int): New function.
10685         * options.h (parse_int): New declaration.
10686         (DEFINE_int): New macro.
10687         (stub_group_size): New option.
10688         * output.cc (Output_section::Output_section): Initialize memebers
10689         merge_section_map_, merge_section_by_properties_map_,
10690         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10691         (Output_section::add_input_section): Handled deferred code-fill
10692         generation and remove an old comment.
10693         (Output_section::add_relaxed_input_section): New method definition.
10694         (Output_section::add_merge_input_section): Use merge section by
10695         properties map to speed to search.  Update merge section maps
10696         as appropriate.
10697         (Output_section::build_relaxation_map): New method definition.
10698         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10699         Same.
10700         (Output_section::relax_input_section): Renamed to
10701         Output_section::convert_input_sections_to_relaxed_sections and change
10702         interface to take a vector of pointers to relaxed sections.
10703         (Output_section::find_merge_section,
10704         Output_section::find_relaxed_input_section): New method definitions.
10705         (Output_section::is_input_address_mapped,
10706         Output_section::output_offset, Output_section::output_address):
10707         Use output section data maps to speed up searching.
10708         (Output_section::find_starting_output_address): Add comments.
10709         (Output_section::do_write,
10710         Output_section::write_to_postprocessing_buffer): Do code-fill
10711         generation as appropriate.
10712         (Output_section::get_input_sections): Invalidate relaxed input section
10713         map.
10714         (Output_section::restore_states): Adjust type of checkpoint .
10715         Invalidate relaxed input section map.
10716         * output.h (Output_merge_base): New class declaration.
10717         (Input_section_specifier): New class defintion.
10718         (class Output_relaxed_input_section) Change base class to
10719         Output_section_data_build.
10720         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10721         base class initializer.
10722         (Output_section::add_relaxed_input_section): New method declaration.
10723         (Output_section::Input_section): Change visibility to protected.
10724         (Output_section::Input_section::relobj,
10725         Output_section::Input_section::shndx): Handle relaxed input sections.
10726         Output_section::input_sections) Change visibility to protected.  Also
10727         define overload to return a non-const pointer.
10728         (Output_section::Merge_section_properties): New class defintion.
10729         (Output_section::Merge_section_by_properties_map,
10730         Output_section::Output_section_data_by_input_section_map,
10731         Output_section::Relaxation_map): New types.
10732         (Output_section::relax_input_section): Rename method to
10733         Output_section::convert_input_sections_to_relaxed_sections and change
10734         interface to take a vector of relaxed section pointers.
10735         (Output_section::find_merge_section,
10736         Output_section::find_relaxed_input_section,
10737         Output_section::build_relaxation_map,
10738         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10739         New method declarations.
10740         (Output_section::merge_section_map_
10741         Output_section::merge_section_by_properties_map_,
10742         Output_section::relaxed_input_section_map_,
10743         Output_section::is_relaxed_input_section_map_valid_,
10744         Output_section::generate_code_fills_at_write_): New data members.
10745         * script-sections.cc
10746         (Output_section_element_input::set_section_addresses): Call
10747         current_data_size and addralign methods of relaxed input sections.
10748         (Orphan_output_section::set_section_addresses): Call current_data_size
10749         and addralign methods of relaxed input sections.
10750         * symtab.cc (Symbol_table::compute_final_value): Extract template
10751         from the body of Symbol_table::sized_finalize_symbol.
10752         (Symbol_table::sized_finalized_symbol): Call
10753         Symbol_table::compute_final_value.
10754         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10755         (Symbol_table::compute_final_value): New templated method declaration.
10756         * target.cc (Target::do_make_output_section): New method defintion.
10757         * target.h (Target::make_output_section): New method declaration.
10758         (Target::relax): Add more parameters for input objects, symbol table
10759         and layout.  Adjust call to do_relax.
10760         (Target::do_make_output_section): New method declaration.
10761         (Target::do_relax): Add parameters for input objects, symbol table
10762         and layout.
10763
10764 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10765
10766         * pread.c: Include stdio.h.
10767
10768 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10769
10770         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10771         defined.
10772
10773 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10774
10775         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10776         Change read_shndx type to unsigned int.
10777         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10778         int.
10779         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10780         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10781         Change read_shndx type to unsigned int.
10782         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10783         int.
10784         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10785         * layout.cc (Layout::create_symtab_sections): Cast the result of
10786         local_symcount * symsize to off_t in the gold_assert.
10787
10788 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10789
10790         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10791         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10792         R_ARM_BASE_ABS.
10793         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10794         (Arm_relocate_functions::thm_abs5): New function.
10795         (Arm_relocate_functions::abs12): New function.
10796         (Arm_relocate_functions::abs16): New function.
10797         (Arm_relocate_functions::base_abs): New function.
10798         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10799         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10800         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10801         R_ARM_BASE_ABS.
10802         (Scan::global): Likewise.
10803         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10804         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10805         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10806         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10807         R_ARM_BASE_ABS.
10808
10809 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10810
10811         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10812         (Arm_relocate_functions::movt_prel): New function.
10813         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10814         (Arm_relocate_functions::thm_movt_prel): New function.
10815         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10816         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10817         (Scan::global, Relocate::relocate): Likewise.
10818         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10819
10820 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10821
10822         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10823         Incremental_checker.
10824         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10825         unsigned int.
10826         (class Incremental_inputs_header): New class.
10827         (Incremental_inputs_header_writer): Edit comment.
10828         (Incremental_inputs_entry): New class.
10829         (Incremental_inputs_entry_writer): Edit comment.
10830         (Sized_incremental_binary::do_find_incremental_inputs_section):
10831         Add *strtab_shndx parameter, fill it.
10832         (Sized_incremental_binary::do_check_inputs): New method.
10833         (Incremental_checker::can_incrementally_link_output_file): Use
10834         Sized_incremental_binary::check_inputs.
10835         (Incremental_inputs::report_command_line): Save command line in
10836         command_line_.
10837         * incremental.h:
10838         (Incremental_binary::find_incremental_inputs_section): New
10839         method.
10840         (Incremental_binary::do_find_incremental_inputs_section): Add
10841         strtab_shndx parameter.
10842         (Incremental_binary::do_check_inputs): New pure virtual method.
10843         (Sized_incremental_binary::do_check_inputs): Declare.
10844         (Incremental_checker::Incremental_checker): Add incremental_inputs
10845         parameter, use it to initialize incremental_inputs_.
10846         (Incremental_checker::incremental_inputs_): New field.
10847         (Incremental_checker::command_line): New method.
10848         (Incremental_checker::inputs): New method.
10849         (Incremental_checker::command_line_): New field.
10850
10851 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10852
10853         * incremental.cc: Include <cstdarg> and "target-select.h".
10854         (vexplain_no_incremental): New function.
10855         (explain_no_incremental): New function.
10856         (Incremental_binary::error): New method.
10857         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10858         method.
10859         (make_sized_incremental_binary): New function.
10860         (open_incremental_binary): New function.
10861         (can_incrementally_link_file): Add checks if output is ELF and has
10862         inputs section.
10863         * incremental.h: Include "elfcpp_file.h" and "output.h".
10864         (Incremental_binary): New class.
10865         (Sized_incremental_binary): New class.
10866         (open_incremental_binary): Declare.
10867         * object.cc (is_elf_object): Use
10868         elfcpp::Elf_recognizer::is_elf_file.
10869         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10870         * output.h (Output_file::filesize): New method.
10871
10872 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10873
10874         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10875         New function.
10876         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10877         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10878         function.
10879         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10880         function.
10881         (Arm_relocate_functions::movw_abs_nc): New function.
10882         (Arm_relocate_functions::movt_abs): New function.
10883         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10884         (Arm_relocate_functions::thm_movt_abs): New function.
10885         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10886         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10887         (Scan::global): Likewise.
10888         (Relocate::relocate): Likewise.
10889         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10890
10891 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10892
10893         * arm.cc (Arm_relocate_functions::got_prel) New function.
10894         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10895         (Relocate::relocate): Likewise.
10896         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10897
10898 2009-10-06  Ian Lance Taylor  <iant@google.com>
10899
10900         * options.h (class General_options): Define
10901         split_stack_adjust_size parameter.
10902         * object.h (class Object): Add uses_split_stack_ and
10903         has_no_split_stack_ fields.  Add uses_split_stack and
10904         has_no_split_stack accessor functions.  Declare
10905         handle_split_stack_section.
10906         (class Reloc_symbol_changes): Define.
10907         (class Sized_relobj): Define Function_offsets.  Declare
10908         split_stack_adjust, split_stack_adjust_reltype, and
10909         find_functions.
10910         * object.cc (Object::handle_split_stack_section): New function.
10911         (Sized_relobj::do_layout): Call handle_split_stack_section.
10912         * dynobj.cc (Sized_dynobj::do_layout): Call
10913         handle_split_stack_section.
10914         * reloc.cc (Sized_relobj::relocate_sections): Call
10915         split_stack_adjust for executable sections in split_stack
10916         objects.  Pass reloc_map to relocate_section.
10917         (Sized_relobj::split_stack_adjust): New function.
10918         (Sized_relobj::split_stack_adjust_reltype): New function.
10919         (Sized_relobj::find_functions): New function.
10920         * target-reloc.h: Include "object.h".
10921         (relocate_section): Add reloc_symbol_changes parameter.  Change
10922         all callers.
10923         * target.h (class Target): Add calls_non_split method.  Declare
10924         do_calls_non_split virtual method.  Declare match_view and
10925         set_view_to_nop.
10926         * target.cc: Include "elfcpp.h".
10927         (Target::do_calls_non_split): New function.
10928         (Target::match_view): New function.
10929         (Target::set_view_to_nop): New function.
10930         * gold.cc (queue_middle_tasks): Give an error if mixing
10931         split-stack and non-split-stack objects with -r.
10932         * i386.cc (Target_i386::relocate_section): Add
10933         reloc_symbol_changes parameter.
10934         (Target_i386::do_calls_non_split): New function.
10935         * x86_64.cc (Target_x86_64::relocate_section): Add
10936         reloc_symbol_changes parameter.
10937         (Target_x86_64::do_calls_non_split): New function.
10938         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10939         parameter.
10940         * powerpc.cc (Target_powerpc::relocate_section): Add
10941         reloc_symbol_changes parameter.
10942         * sparc.cc (Target_sparc::relocate_section): Add
10943         reloc_symbol_changes parameter.
10944         * configure.ac: Call AM_CONDITIONAL for the default target.
10945         * configure: Rebuild.
10946         * testsuite/Makefile.am (TEST_AS): New variable.
10947         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10948         (check_DATA): Add split_i386 and split_x86_64 files.
10949         (SPLIT_DEFSYMS): Define.
10950         (split_i386_[1234n].o): New targets.
10951         (split_i386_[124]): New targets.
10952         (split_i386_[1234r].stdout): New targets.
10953         (split_x86_64_[1234n].o): New targets.
10954         (split_x86_64_[124]): New targets.
10955         (split_x86_64_[1234r].stdout): New targets.
10956         (MOSTLYCLEANFILES): Add new executables.
10957         * testsuite/split_i386.sh: New file.
10958         * testsuite/split_x86_64.sh: New file.
10959         * testsuite/split_i386_1.s: New file.
10960         * testsuite/split_i386_2.s: New file.
10961         * testsuite/split_i386_3.s: New file.
10962         * testsuite/split_i386_4.s: New file.
10963         * testsuite/split_i386_n.s: New file.
10964         * testsuite/split_x86_64_1.s: New file.
10965         * testsuite/split_x86_64_2.s: New file.
10966         * testsuite/split_x86_64_3.s: New file.
10967         * testsuite/split_x86_64_4.s: New file.
10968         * testsuite/split_x86_64_n.s: New file.
10969         * testsuite/testfile.cc (Target_test): Update relocation_section
10970         function.
10971         * testsuite/Makefile.in: Rebuild.
10972
10973 2009-10-06  Ian Lance Taylor  <iant@google.com>
10974
10975         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10976         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10977         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10978         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10979         the address on ldo_addrs_.
10980         (Target_i386::Relocate::fix_up_ldo): New function.
10981
10982 2009-10-06   Rafael Espindola  <espindola@google.com>
10983
10984         * plugin.cc (add_input_library): New.
10985         (Plugin::load): Add add_input_library to tv.
10986         (Plugin_manager::add_input_file): Add the is_lib argument.
10987         (add_input_file): Update call to Plugin_manager::add_input_file.
10988         (add_input_library): New.
10989         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10990
10991 2009-09-30  Doug Kwan  <dougkwan@google.com>
10992
10993         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10994         symbol and call Symbol::may_need_copy_reloc to determine if
10995         a copy reloc is needed.
10996         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10997         nocopyreloc is given in command line.
10998         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10999         given in command line.
11000         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11001         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11002         of the removed Target_i386::may_need_copy_reloc.
11003         * options.h (copyreloc): New option with default value false.
11004         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11005         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11006         instead of the removed Target_powerpc::may_need_copy_reloc.
11007         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11008         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11009         instead of the removed Target_sparc::may_need_copy_reloc.
11010         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11011         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11012         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11013         instead of the removed Target_x86_64::may_need_copy_reloc.
11014
11015 2009-09-30  Ian Lance Taylor  <iant@google.com>
11016
11017         * object.h (class Object): Remove target_ field, and target,
11018         sized_target, and set_target methods.
11019         (Object::sized_target): Remove.
11020         (class Sized_relobj): Update declarations.  Remove sized_target.
11021         * object.cc (Sized_relobj::setup): Remove target parameter.
11022         Change all callers.
11023         (Input_objects::add_object): Don't do anything with the target.
11024         (make_elf_sized_object): Add punconfigured parameter.  Change all
11025         callers.  Set or test parameter target.
11026         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11027         Change all callers.
11028         * parameters.cc (Parameters::set_target): Change parameter type to
11029         be non-const.
11030         (Parameters::default_target): Remove.
11031         (set_parameters_target): Change parameter type to be non-const.
11032         (parameters_force_valid_target): New function.
11033         (parameters_clear_target): New function.
11034         * parameters.h (class Parameters): Update declarations.  Remove
11035         default_target method.  Add sized_target and clear_target
11036         methods.  Change target_ to be non-const.
11037         (set_parameters_target): Update declaration.
11038         (parameters_force_valid_target): Declare.
11039         (parameters_clear_target): Declare.
11040         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11041         as NULL if we aren't searching.
11042         (Add_symbols::run): Don't check for compatible target.
11043         * fileread.cc (Input_file::open_binary): Call
11044         parameters_force_valid_target.
11045         * gold.cc (queue_middle_tasks): Likewise.
11046         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11047         set_target on object.
11048         * dynobj.h (class Sized_dynobj): Update declarations.
11049         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11050         make_elf_object returns NULL.
11051         (Archive::include_member): Don't check whether object target is
11052         compatible.
11053         * output.cc (Output_section::add_input_section): Get target from
11054         parameters.
11055         (Output_section::relax_input_section): Likewise.
11056         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11057         parameters.
11058         (Sized_relobj::do_scan_relocs): Likewise.
11059         (Sized_relobj::relocate_sections): Likewise.
11060         * resolve.cc (Symbol_table::resolve): Likewise.
11061         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11062         parameter.  Change all callers.
11063         (Symbol_table::add_from_object): Get target from parameters.
11064         (Symbol_table::add_from_relobj): Don't check object target.
11065         (Symbol_table::add_from_dynobj): Likewise.
11066         (Symbol_table::define_special_symbol): Get target from
11067         parameters.
11068         * symtab.h (class Symbol_table): Update declaration.
11069         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11070         parameter.  Change all callers.  Clear parameter target.
11071         (Binary_test): Test target here.
11072         * testsuite/object_unittest.cc (gold_testsuite): Remove
11073         target_test_pointer parameter.  Change all callers.
11074         (Object_test): Test target here.
11075
11076 2009-09-26  Ian Lance Taylor  <iant@google.com>
11077
11078         * testsuite/initpri1.c: Don't try to use constructor priorities if
11079         compiling with gcc before 4.3.
11080
11081 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11082
11083         * testsuite/retain_symbols_file_test.sh (check_present): Change
11084         output file name to retain_symbols_file_test.stdout.
11085         (check_absent): Likewise.
11086
11087 2009-09-18  Craig Silverstein  <csilvers@google.com>
11088
11089         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11090         * options.cc: Include <cerrno> and <fstream>.
11091         (General_options::finalize): Parse -retain-symbols-file tag.
11092         * options.h: New flag.
11093         (General_options): New method should_retain_symbol, new
11094         variable symbols_to_retain.
11095         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11096         should_retain_symbol map.
11097         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11098         * testsuite/Makefile.in: Regenerate.
11099         * testsuite/retain_symbols_file_test.sh: New file.
11100
11101 2009-09-18  Nick Clifton  <nickc@redhat.com>
11102
11103         * po/es.po: Updated Spanish translation.
11104
11105 2009-09-17  Doug Kwan  <dougkwan@google.com>
11106
11107         * debug.h (DEBUG_RELAXATION): New constant.
11108         (DEBUG_ALL): Add DEBUG_RELAXATION.
11109         (debug_string_to_enum): Add relaxation debug option.
11110         * layout.cc
11111         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11112         Layout::Relaxation_debug_check::read_sections,
11113         Layout::Relaxation_debug_check::read_sections): New method definitions.
11114         (Layout::Layout): Initialize data members
11115         record_output_section_data_from_scrips_,
11116         script_output_section_data_list_ and relaxation_debug_check_.
11117         (Layout::save_segments, Layout::restore_segments,
11118         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11119         Layout::relaxation_loop_body): New method definitions.
11120         (Layout::finalize): Support relaxation.  Move section layout code to
11121         Layout::relaxation_loop_body.
11122         (Layout::set_asection_address_from_script): Move code for orphan
11123         section placement out.
11124         (Layout::place_orphan_sections_in_script): New method definition.
11125         * layout.h (Output_segment_headers, Output_file_header):
11126         New forward class declarations.
11127         (Layout::~Layout): Define.
11128         (Layout::new_output_section_data_from_script): New method definition.
11129         (Layout::place_orphan_sections_in_script): New method declaration.
11130         (Layout::Segment_states): New type declaration.
11131         (Layout::save_segments, Layout::restore_segments,
11132         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11133         Layout::relaxation_loop_body): New method declarations.
11134         (Layout::Output_section_data_list): New type declaration.
11135         (Layout::Relaxation_debug_check): New class definition.
11136         (Layout::record_output_section_data_from_script_,
11137         Layout::script_output_section_data_list_, Layout::segment_states_,
11138         Layout::relaxation_debug_check_): New data members.
11139         * output.cc: (Output_section_headers::do_size): New method definition.
11140         (Output_section_headers::Output_section_headers): Move size
11141         computation to Output_section_headers::do_size.
11142         (Output_segment_headers::do_size): New method definition.
11143         (Output_file_header::Output_file_header): Move size computation to
11144         Output_file_header::do_size and call it.
11145         (Output_file_header::do_size): New method definition.
11146         (Output_data_group::Output_data_group): Adjust call to
11147         Output_section_data.
11148         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11149         (Output_symtab_xindex::do_write): Add array bound check.
11150         (Output_section::Input_section::print_to_mapfile): Handle
11151         RELAXED_INPUT_SECTION_CODE.
11152         (Output_section::Output_section): Initialize data member checkpoint_.
11153         (Output_section::~Output_section): Delete checkpoint object pointed
11154         by checkpoint_.
11155         (Output_section::add_input_section): Always add an Input_section if
11156         relaxing.
11157         (Output_section::add_merge_input_section): Add assert.
11158         (Output_section::relax_input_section): New method definition.
11159         (Output_section::set_final_data_size): Set load address to zero for
11160         an unallocated section.
11161         (Output_section::do_address_and_file_offset_have_reset_values):
11162         New method definition.
11163         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11164         Handle relaxed input section.
11165         (Output_section::sort_attached_input_sections): Checkpoint input
11166         section list lazily.
11167         (Output_section::get_input_sections): Change type of input_sections to
11168         list of Simple_input_section pointers.  Checkpoint input section list
11169         lazily.  Also handle relaxed input sections.
11170         (Output_section::add_input_section_for_script): Take a reference to
11171         a Simple_input_section object instead of Relobj pointer and section
11172         index as parameter.  Handle relaxed input sections.
11173         (Output_section::save_states, Output_section::restore_states): New
11174         method definitions.
11175         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11176         (Output_data::is_data_size_fixed): New method definition.
11177         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11178         if it is fixed.
11179         (Output_data::address_and_file_offset_have_reset_values): New method
11180         definition.
11181         (Output_data::do_address_and_file_offset_have_reset_values): New method
11182         definition.
11183         (Output_data::set_data_size): Check that data size is not fixed.
11184         (Output_data::fix_data_size): New method definition.
11185         (Output_data::is_data_size_fixed_): New data member.
11186         (Output_section_headers::set_final_data_size): New method definition.
11187         (Output_section_headers::do_size): New method declaration.
11188         (Output_segment_headers::set_final_data_size): New method definition.
11189         (Output_segment_headers::do_size): New method declaration.
11190         (Output_file_header::set_final_data_size)::New method definition.
11191         (Output_file_header::do_size)::New method declaration.
11192         (Output_section_data::Output_section_data): Add new parameter
11193         is_data_size_fixed and use it to fix data size.
11194         (Output_data_const::Output_data_const): Adjust call to base class
11195         constructor and fix data size.
11196         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11197         base class constructor and fix data size.
11198         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11199         base class constructor and fix data size.
11200         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11201         class constructor and fix data size.
11202         (Output_data_group::set_final_data_size): New method definition.
11203         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11204         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11205         class constructor and fix data size.
11206         (Output_relaxed_input_section): New class definition.
11207         (Output_section::Simple_input_section): New class definition.
11208         (Output_section::get_input_sections): Adjust parameter list.
11209         (Output_section::add_input_section_for_script): Same.
11210         (Output_section::save_states, Output_section::restore_states,
11211         Output_section::do_address_and_file_offset_have_reset_values,
11212         (Output_section::Input_section::Input_section): Handle
11213         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11214         Output_relaxed_input_section.
11215         (Output_section::Input_section::is_input_section,
11216         Output_section::Input_section::set_output_section): Handle relaxed
11217         input section.
11218         (Output_section::Input_section::is_relaxed_input_section,
11219         Output_section::Input_section::output_section_data,
11220         Output_section::Input_section::relaxed_input_section): New method
11221         definitions.
11222         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11223         value.
11224         (Output_section::Input_section::u1_): Update comments.
11225         (Output_section::Input_section::u2_): Add new union member poris.
11226         (Output_section::Checkpoint_output_section): New classs definition.
11227         (Output_section::relax_input_section): New method declaration.
11228         (Output_section::checkpoint_): New data member.
11229         (Output_segment): Update comments.
11230         (Output_segment::Output_segment): Un-privatize copy constructor.
11231         (Output_segment::operator=): Un-privatize.
11232         * script-sections.cc (Output_section_element::Input_section_list):
11233         Change element type to Output_section::Simple_input_section.
11234         (Output_section_element_dot_assignment::set_section_addresses):
11235         Register output section data for relaxation clean up.
11236         (Output_data_exression::Output_data_expression): Adjust call to base
11237         constructor to fix data size.
11238         (Output_section_element_data::set_section_addresses): Register
11239         Output_data_expression object for relaxation clean up.
11240         (struct Input_section_info): Replace Relobj pointer and section index
11241         pair with Output_section::Simple_input_section and Convert struct to a
11242         class.
11243         (Input_section_sorter::operator()): Adjust access to
11244         Input_section_info data member to use accessors.
11245         (Output_section_element_input::set_section_addresses): Use layout
11246         parameter.  Adjust code to use Output_section::Simple_input_section
11247         and Input_secction_info classes.  Register filler for relaxation
11248         clean up.
11249         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11250         and section index pair with Output_section::Simple_input_section
11251         class.  Adjust code accordingly.
11252         (Phdrs_element::release_segment): New method definition.
11253         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11254         segment list.
11255         (Script_sections::release_segments): New method definition.
11256         * gold/script-sections.h (Script_sections::release_segments): New
11257         method declaration.
11258         * gold/target.h (Target::may_relax, Target::relax,
11259         Target::do_may_relax, Target::do_relax): New method definitions.
11260
11261 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11262
11263         * arm.cc (has_signed_unsigned_overflow): New function.
11264         (Arm_relocate_functions::abs8): New function.
11265         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11266         (Target_arm::Scan::global): Likewise.
11267         (Target_arm::relocate::relocate): Likewise.
11268         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11269         Likewise.
11270
11271 2009-09-16  Cary Coutant  <ccoutant@google.com>
11272
11273         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11274         * testsuite/Makefile.in: Regenerate.
11275
11276 2009-09-11  Nick Clifton  <nickc@redhat.com>
11277
11278         * po/gold.pot: Updated by the Translation project.
11279
11280 2009-09-08  Cary Coutant  <ccoutant@google.com>
11281
11282         * output.cc (Output_file::open): Add execute permission to empty file.
11283         * testsuite/Makefile.am (permission_test): New test.
11284         * testsuite/Makefile.in: Regenerate.
11285
11286 2009-09-02  Ian Lance Taylor  <iant@google.com>
11287
11288         * output.cc (Output_file::resize): Call map_no_anonymous rather
11289         than map.
11290
11291 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11292
11293         * gold.cc: Include "incremental.h".
11294         (queue_initial_tasks): Call Incremental_checker methods.
11295         * incremental.cc: Include "output.h".
11296         (Incremental_checker::can_incrementally_link_output_file): New
11297         method.
11298         * incremental.h (Incremental_checker): New class.
11299
11300         * output.cc (Output_file::open_for_modification): New method.
11301         (Output_file::map_anonymous): Changed return type to bool.  Record
11302         map in base_ field.
11303         (Output_file::map_no_anonymous): New method, broken out of map.
11304         (Output_file::map): Use map_no_anonymous and map_anonymous.
11305         * output.h (class Output_file): Update declarations.
11306
11307 2009-08-24  Cary Coutant  <ccoutant@google.com>
11308
11309         * options.h (Command_line::Pre_options): New class.
11310         (Command_line::pre_options): New member.
11311         * options.cc (gold::options::ready_to_register): New variable.
11312         (One_option::register_option): Do nothing if not registering options.
11313         Assert if same short option registered twice.
11314         (General_options::General_options): Turn off option registration when
11315         done constructing.
11316         (Command_line::Pre_options::Pre_options): New constructor.
11317
11318 2009-08-24  Cary Coutant  <ccoutant@google.com>
11319
11320         * options.h (General_options::no_keep_memory): Remove incorrect
11321         short option.
11322
11323 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11324
11325         * Makefile.am (am__skiplex, am__skipyacc): New.
11326         * Makefile.in: Regenerate.
11327
11328 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11329
11330         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11331         (INCLUDES): ... this.
11332         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11333         (AM_CPPFLAGS): Renamed from ...
11334         (INCLUDE): ... this.
11335         * Makefile.in, testsuite/Makefile.in: Regenerate.
11336
11337         * Makefile.in: Regenerate.
11338         * aclocal.m4: Likewise.
11339         * config.in: Likewise.
11340         * configure: Likewise.
11341         * testsuite/Makefile.in: Likewise.
11342
11343         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11344         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11345         * Makefile.in: Regenerate.
11346         * testsuite/Makefile.in: Regenerate.
11347
11348 2009-08-19  Cary Coutant  <ccoutant@google.com>
11349
11350         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11351         symbols in shared libraries overridden by hidden or internal symbols
11352         in the main program.
11353
11354 2009-08-19  Chris Demetriou  <cgd@google.com>
11355
11356         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11357         checking source file names in error messages.
11358
11359 2009-08-18  Doug Kwan  <dougkwan@google.com>
11360
11361         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11362         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11363         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11364         an elfcpp::Ehdr as parameter.
11365         * object.cc (Object::set_target): Remove the version that looks up
11366         a target and sets it.
11367         (Sized_relobj::setup): Take a Target object instead of
11368         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11369         (make_elf_sized_object): Find target and ask target to
11370         make an ELF object.
11371         * object.h: (Object::set_target): Remove the version that looks up
11372         a target and sets it.
11373         (Sized_relobj::setup): Take a Target object instead of
11374         an elfcpp:Ehdr as parameter.
11375         * target.cc: Include dynobj.h.
11376         (Target::do_make_elf_object_implementation): New.
11377         (Target::do_make_elf_object): New.
11378         * target.h (Target::make_elf_object): New template declaration.
11379         (Target::do_make_elf_object): New method declarations.
11380         (Target::do_make_elf_object_implementation): New template declaration.
11381
11382 2009-08-14  Ian Lance Taylor  <iant@google.com>
11383
11384         * gold.h (FUNCTION_NAME): Define.
11385         (gold_unreachable): Use FUNCTION_NAME.
11386
11387 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11388
11389         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11390         symbol in the --keep-unique list is not found.
11391
11392 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11393
11394         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11395         been maked as --keep-unique.
11396         (Icf::unfold_section): New function.
11397         * icf.h (Icf::unfold_section): New function.
11398         * options.h (General_options::keep_unique): New option.
11399         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11400         * testsuite/Makefile.in: Regenerate.
11401         * testsuite/icf_keep_unique_test.sh: New file.
11402         * testsuite/icf_keep_unique_test.cc: New file.
11403
11404 2009-08-12  Cary Coutant  <ccoutant@google.com>
11405
11406         PR 10471
11407         * resolve.cc (Symbol_table::resolve): Check for references from
11408         dynamic objects to hidden and internal symbols.
11409         * testsuite/Makefile.am (hidden_test.sh): New test.
11410         * testsuite/Makefile.in: Regenerate.
11411         * testsuite/hidden_test.sh: New script.
11412         * testsuite/hidden_test_1.c: New test source.
11413         * testsuite/hidden_test_main.c: New test source.
11414
11415 2009-08-11  Doug Kwan  <dougkwan@google.com>
11416
11417         * arm.cc: Update comments.
11418         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11419         segment to locate the .ARM.exidx section if present.
11420
11421 2009-08-09  Doug Kwan  <dougkwan@google.com>
11422
11423         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11424         patch.
11425
11426 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11427         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11428         compiler warnings.
11429
11430 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11431
11432         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11433         valid tls_segment only for non-debug-section relocations.
11434         * testsuite/Makefile.am: Add gc_tls_test.
11435         * testsuite/Makefile.in: Regenerate.
11436         * testsuite/gc_tls_test.cc: New file.
11437         * testsuite/gc_tls_test.sh: New file.
11438
11439 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11440
11441         * icf.cc: New file.
11442         * icf.h: New file.
11443         * Makefile.am (CCFILES): Add icf.cc.
11444         (HFILES): Add icf.h
11445         * Makefile.in: Regenerate.
11446         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11447         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11448         section, symbol and addend information for the relocs.
11449         * gold.cc (queue_middle_tasks): Call identical code folding.
11450         * gold.h: Add defines for multimap.
11451         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11452         to the call of finalize_local_symbols.
11453         * main.cc (main): Create object of class Icf.
11454         * object.cc (Sized_relobj::do_layout): Allow this function to be
11455         called twice during icf.
11456         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11457         to sections marked as identical by icf.
11458         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11459         when available.
11460         (Sized_relobj::do_section_entsize): New function.
11461         * object.h (Object::section_entsize): New function.
11462         (Object::do_section_entsize): New pure virtual function.
11463         (Relobj::finalize_local_symbols): Add new parameter.
11464         (Relobj::do_section_entsize): New function.
11465         * options.h (General_options::icf): New option.
11466         (General_options::icf_iterations): New option.
11467         (General_options::print_icf_sections): New option.
11468         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11469         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11470         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11471         icf.
11472         * symtab.cc (Symbol_table::is_section_folded): New function.
11473         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11474         to sections marked as identical by icf.
11475         * symtab.h (Symbol_table::set_icf): New function.
11476         (Symbol_table::icf): New function.
11477         (Symbol_table::is_section_folded): New function.
11478         (Symbol_table::icf_): New data member.
11479         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11480         * testsuite/Makefile.am: Add commands to build icf_test.
11481         * testsuite/Makefile.in: Regenerate.
11482         * testsuite/icf_test.sh: New file.
11483         * testsuite/icf_test.cc: New file.
11484
11485 2009-07-24  Chris Demetriou  <cgd@google.com>
11486
11487         * layout.cc (is_compressible_debug_section): Fix incorrect
11488         comment about compressed section names.
11489
11490 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11491
11492         PR 10419
11493         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11494
11495 2009-07-16  Ian Lance Taylor  <iant@google.com>
11496
11497         PR 10400
11498         * layout.h: #include <map>.
11499         (class Kept_section): Change from struct to class.  Add accessors
11500         and setters.  Add section size to Comdat_group mapping.  Change
11501         Comdat_group to std::map.  Add is_comdat_ field.  Add
11502         linkonce_size field in union.
11503         (class Layout): Update declaration of find_or_add_kept_section.
11504         Don't declare find_kept_object.
11505         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11506         parameter.  Add object, shndx, is_comdat, and is_group_name
11507         parameters.  Change all callers.  Adjust for new Kept_section.
11508         (Layout::find_kept_object): Remove.
11509         * object.cc (Sized_relobj::include_section_group): Update use of
11510         Kept_section.  Rename secnum to shndx.  Only record
11511         Kept_comdat_section if sections are the same size.
11512         (Sized_relobj::include_linkonce_section): Update use of
11513         Kept_section.  Only record Kept_comdat_section if sections are the
11514         same size.  Set size of linkonce section.
11515         (Sized_relobj::map_to_kept_section): Update call to
11516         get_kept_comdat_section.
11517         * object.h (class Sized_relobj): Rename fields in
11518         Kept_comdat_section to drop trailing underscores; change object
11519         field to Relobj*.  Change Kept_comdat_section_table to store
11520         struct rather than pointer.
11521         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11522         Add kept_object and kept_shndx parameters.  Change all callers.
11523         (Sized_relobj::get_kept_comdat_section): Change return type to
11524         bool.  Add kept_object and kept_shndx parameters.  Change all
11525         callers.
11526         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11527         Layout::find_or_add_kept_section.
11528
11529 2009-07-09  Ian Lance Taylor  <iant@google.com>
11530
11531         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11532         Reserve space in the hash table.
11533
11534 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11535
11536         * fileread.cc (File_read::get_mtime): New method.
11537         * fileread.h (Timespec): New structure.
11538         (File_read::get_mtime): New method.
11539         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11540         Renamed from timestamp_nsec.
11541         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11542         Elf_Xword.
11543         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11544         timestamp_nsec.
11545         (Incremental_inputs::report_archive): Save mtime; style fix.
11546         (Incremental_inputs::report_obejct): Save mtime; style fix.
11547         (Incremental_inputs::report_script): Save mtime; style fix.
11548         (Incremental_inputs::finalize_inputs): Style fix.
11549         (Incremental_inputs::finalize): Style fix.
11550         (Incremental_inputs::create_input_section_data): Store inputs
11551         mtime.
11552         * incremental.h (Incremental_inputs::report_script): Add mtime
11553         argument.
11554         (Incremental_inputs::Input_info::Input_info): Intialize only one
11555         union member.
11556         (Incremental_inputs::Input_info::archive): Move to nameless
11557         union.
11558         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11559         (Incremental_inputs::Input_info::script): Move to nameless union.
11560         (Incremental_inputs::mtime): New field.
11561         * script.cc (read_input_script): Pass file mtime to
11562         Incremental_input.
11563         * script.h (Script_info::inputs): Style fix.
11564
11565 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11566
11567         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11568         instead of 32.
11569
11570 2009-06-24  Ian Lance Taylor  <iant@google.com>
11571
11572         PR 10156
11573         * layout.cc (Layout::choose_output_section): If we find an
11574         existing section, update the flags.
11575         (Layout::create_notes): New function, broken out of
11576         Layout::finalize.
11577         (Layout::finalize): Don't create note sections.
11578         (Layout::create_note): Don't crash if linker script discards
11579         section.
11580         (Layout::create_gold_note): Likewise.
11581         (Layout::create_build_id): Likewise.  Don't set
11582         after_input_sections on the section.
11583         (Layout::create_executable_stack_info): Remove target parameter.
11584         Change caller.
11585         * layout.h (class Layout): Declare create_notes.  Update
11586         declaration of create_executable_stack_info.
11587         * gold.cc (queue_middle_tasks): Call create_notes.
11588         * output.cc (Output_section::update_flags_for_input_section): Move
11589         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11590         invalid.
11591         * output.h (Output_data::mark_address_invalid): New function.
11592         (class Output_section): Only declare, not define,
11593         update_flags_for_input_section.  Remove set_flags.
11594
11595 2009-06-24  Ian Lance Taylor  <iant@google.com>
11596
11597         * script-sections.cc (Output_section_definition::
11598         set_section_addresses): Rename shadowing local load_address to
11599         laddr.
11600
11601 2009-06-24  Ian Lance Taylor  <iant@google.com>
11602
11603         PR 10244
11604         * reloc.cc (relocate_sections): Skip empty relocation sections.
11605
11606 2009-06-23  Ian Lance Taylor  <iant@google.com>
11607
11608         PR 10156
11609         * layout.cc (Layout::create_note): Use choose_output_section
11610         rather than make_output_section.
11611
11612 2009-06-23  Ian Lance Taylor  <iant@google.com>
11613
11614         PR 10237
11615         * options.cc (General_options::parse_V): Set printed_version_.
11616         (General_options::General_options): Initialize printed_version_.
11617         * options.h (class General_options): Add printed_version_ field.
11618         * gold.cc (queue_initial_tasks): If there are no input files,
11619         don't give a fatal error if we printed the version information.
11620         (queue_middle_tasks): If using -r with a shared object, give a
11621         fatal error rather than an ordinary error.
11622
11623 2009-06-23  Ian Lance Taylor  <iant@google.com>
11624
11625         PR 10219
11626         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11627         (Layout::make_output_section): Set have_stabstr_section_ if we see
11628         a .stab*str section.
11629         (Layout::finalize): Call link_stabs_sections.
11630         (Layout::link_stabs_sections): New file.
11631         * layout.h (class Layout): Add have_stabstr_section_ field.
11632         Declare link_stabs_sections.
11633
11634 2009-06-23  Doug Kwan  <dougkwan@google.com>
11635
11636         * Makefile.am (libgold_a_LIBADD): New.
11637         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11638         * Makefile.in: Regenerate.
11639         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11640         * configure: Regenerate.
11641         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11642         * fileread.cc: Include sys/state.h
11643         * gold.h: Declare memmem and strndup if found missing.
11644         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11645
11646 2009-06-23  Ian Lance Taylor  <iant@google.com>
11647
11648         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11649         * configure: Rebuild.
11650
11651 2009-06-23  Ian Lance Taylor  <iant@google.com>
11652
11653         PR 10147
11654         * object.cc (Object::section_contents): Don't try to get a view if
11655         the section has length zero.
11656         (Object::handle_gnu_warning_section): If the section is empty, use
11657         the name of the section as the warning.
11658
11659 2009-06-23  Ian Lance Taylor  <iant@google.com>
11660
11661         PR 10133
11662         * stringpool.h (class Stringpool_template): Add optimize_ field.
11663         (Stringpool_template::set_optimize): New function.
11664         * stringpool.cc (Stringpool_template::Stringpool_template):
11665         Initialize optimize_ field.
11666         (Stringpool_template::set_string_offsets): Test local optimize
11667         fild rather than parameter.
11668         * layout.cc (Layout::Layout): Call set_optimize on the section
11669         name stringpool.
11670
11671 2009-06-22  Ian Lance Taylor  <iant@google.com>
11672
11673         PR 10030
11674         * yyscript.y: Parse TARGET.
11675         * script.cc (script_set_target): New function.
11676         * script-c.h (script_set_target): Declare.
11677         * options.cc (General_options::string_to_object_format): Rename
11678         from string_to_object_format in anonymous namespace.  Change
11679         callers.
11680         * options.h (class General_options): Declare
11681         string_to_object_format.
11682
11683 2009-06-22  Ian Lance Taylor  <iant@google.com>
11684
11685         * script-sections.cc (Script_sections::create_segments): Don't put
11686         program headers in a PT_LOAD segment if -n or -N.
11687
11688 2009-06-22  Ian Lance Taylor  <iant@google.com>
11689
11690         PR 10141
11691         * options.h (class General_options): Add -z lazy and -z now.  Sort
11692         -z options into alphabetical order.
11693         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11694
11695 2009-06-21  Ian Lance Taylor  <iant@google.com>
11696
11697         * layout.cc (Layout::make_output_section): Call
11698         Target::new_output_section.
11699         (Layout::attach_allocated_section_to_segment): Put large section
11700         sections in a separate load segment with the large segment flag
11701         set.
11702         (Layout::segment_precedes): Sort large data segments after other
11703         load segments.
11704         (align_file_offset): New static function.
11705         (Layout::set_segment_offsets): Use align_file_offset.
11706         * output.h (class Output_section): Add is_small_section_ and
11707         is_large_section_ fields.
11708         (Output_section::is_small_section): New function.
11709         (Output_section::set_is_small_section):  New function.
11710         (Output_section::is_large_section): New function.
11711         (Output_section::set_is_large_section): New function.
11712         (Output_section::is_large_data_section): New function.
11713         (class Output_segment): Add is_large_data_segment_ field.
11714         (Output_segment::is_large_data_segment): New function.
11715         (Output_segment::set_is_large_data_segment): New function.
11716         * output.cc (Output_section::Output_section): Initialize new
11717         fields.
11718         (Output_segment::Output_segment): Likewise.
11719         (Output_segment::add_output_section): Add assertion that large
11720         data sections always go in large data segments.  Force small data
11721         sections to the end of the list of data sections.  Force small BSS
11722         sections to the start of the list of BSS sections.  For large BSS
11723         sections to the end of the list of BSS sections.
11724         * symtab.h (class Symbol): Declare is_common_shndx.
11725         (Symbol::is_defined): Check Symbol::is_common_shndx.
11726         (Symbol::is_common): Likewise.
11727         (class Symbol_table): Define enum Commons_section_type.  Update
11728         declarations.  Add small_commons_ and large_commons_ fields.
11729         * symtab.cc (Symbol::is_common_shndx): New function.
11730         (Symbol_table::Symbol_table): Initialize new fields.
11731         (Symbol_table::add_from_object): Put small and large common
11732         symbols in the right list.
11733         (Symbol_table::sized_finalized_symbol): Check
11734         Symbol::is_common_shndx.
11735         (Symbol_table::sized_write_globals): Likewise.
11736         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11737         common symbol lists.  Don't call do_allocate_commons_list if the
11738         list is empty.
11739         (Symbol_table::do_allocate_commons_list): Remove is_tls
11740         parameter.  Add comons_section_type parameter.  Change all
11741         callers.  Handle small and large common symbols.
11742         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11743         Symbol::is_common_shndx.
11744         * resolve.cc (symbol_to_bits): Likewise.
11745         * target.h (Target::small_common_shndx): New function.
11746         (Target::small_common_section_flags): New function.
11747         (Target::large_common_shndx): New function.
11748         (Target::large_common_section_flags): New function.
11749         (Target::new_output_section): New function.
11750         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11751         small_common_section_flags, and large_common_section_flags
11752         fields.
11753         (Target::do_new_output_section): New virtual function.
11754         * arm.cc (Target_arm::arm_info): Initialize new fields.
11755         * i386.cc (Target_i386::i386_info): Likewise.
11756         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11757         Likewise.
11758         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11759         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11760         (Target_x86_64::do_new_output_section): New function.
11761         * configure.ac: Define conditional MCMODEL_MEDIUM.
11762         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11763         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11764         (large_LDFLAGS): Define.
11765         * testsuite/large.c: New file.
11766         * testsuite/testfile.cc (Target_test::test_target_info):
11767         Initialize new fields.
11768         * configure, testsuite/Makefile.in: Rebuild.
11769
11770 2009-06-05  Doug Kwan  <dougkwan@google.com>
11771
11772         * Makefile.am (CCFILES): Add target.cc.
11773         * Makefile.in: Regenerate.
11774         * i386.cc (class Target_i386): Define new virtual method to
11775         override do_is_local_label_name in parent.
11776         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11777         local symbols if --discard-locals or -X is given.
11778         * options.h (class General_options): Declare new options
11779         '--discard-locals' and '-X' for discarding locals.
11780         * target.h (class Target): Define new methods is_local_label_name.
11781         Declare new virtual method do_is_local_label_name.
11782         * target.cc: New file.
11783         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11784         (check_SCRIPTS): Add discard_locals_test.sh.
11785         (check_DATA): Add discard_local_tests.syms.
11786         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11787         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11788         * testsuite/Makefile.in: Regenerate.
11789         * testsuite/discard_locals_test.c: New file.
11790         * testsuite/discard_locals_test.sh: Same.
11791
11792 2009-06-05  Doug Kwan  <dougkwan@google.com>
11793
11794         * object.cc (Sized_relobj::Sized_relobj): Initialize
11795         discarded_eh_frame_shndx_ to -1U.
11796         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11797         section.
11798         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11799         a discarded .eh_frame section.
11800         (Sized_relobj::do_finalize_local_symbols): Ditto.
11801         * object.h (class Sized_relobj): Declare new member
11802         discarded_eh_frame_shndx_.
11803         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11804         (local_labels_test.o, local_labels_test): New rules.
11805         * testsuite/Makefile.in: Regenerate.
11806
11807 2009-06-04  Doug Kwan  <dougkwan@google.com>
11808
11809         * layout.cc (Layout::section_name_mapping): Add mapping for
11810         special ARM sections.
11811
11812 2009-06-03  Doug Kwan  <dougkwan@google.com>
11813
11814         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11815         (utils::has_overflow): Same.
11816
11817 2009-06-03  Ian Lance Taylor  <iant@google.com>
11818
11819         * layout.cc (Layout::section_name_mapping): New array, replacing
11820         Layout::linkonce_mapping.
11821         (Layout::section_name_mapping_count): New variable, replacing
11822         Layout::linkonce_mapping_count.
11823         (Layout::linkonce_output_name): Remove.
11824         (Layout::output_section_name): Rewrite.
11825         * layout.h (class Layout): Rename Linkonce_mapping to
11826         Section_name_mapping, linkonce_mapping to section_name_mapping,
11827         linkonce_mapping_count to section_name_mapping_count.  Don't
11828         declare linkonce_output_name.
11829
11830 2009-06-03  Doug Kwan  <dougkwan@google.com>
11831
11832         * gold/arm.cc (namespace utils): New.
11833         (Target_arm::reloc_is_non_pic): Define new method.
11834         (class Arm_relocate_functions): New.
11835         (Target_arm::Relocate::relocate): Handle relocation types used by
11836         Android.
11837
11838 2009-06-03  Ian Lance Taylor  <iant@google.com>
11839
11840         * arm.cc (Target_arm::scan::global): Use || instead of |.
11841
11842 2009-06-02  Doug Kwan  <dougkwan@google.com>
11843
11844         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11845         issued_non_pic_error_.
11846         (class Target_arm::Scan): Declare new method check_non_pic.
11847         Define new method symbol_needs_plt_entry.
11848         Declare new data member issued_non_pic_error_.
11849         (class Target_arm::Relocate): Declare new method
11850         should_apply_static_reloc.
11851         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11852         (Target_arm::Scan::check_non_pic): Define new method.
11853         (Target_arm::Scan::local): Handle a small subset of reloc types used
11854         by Android.
11855         (Target_arm::Scan::local): Same.
11856         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11857
11858 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11859
11860         * incremental.cc (Incremental_inputs::report_command_line): Filter
11861         out --incremental-* options.
11862
11863 2009-05-29  Doug Kwan  <dougkwan@google.com>
11864
11865         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11866         template class.
11867         (class Target_arm): Update comment.
11868         (Target_arm::Target_arm): Initialize new data members GOT_,
11869         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11870         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11871         and Target_arm::rel_dyn_section.
11872         Declare new_enum Target_arm::Got_type.
11873         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11874         and DYNBSS_.
11875         Update commments for member do_dynsym_value.
11876         (Target_arm::got_size, Target_arm::plt_section,
11877         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11878         new methods inside class defintion.
11879         (Target_arm::got_section): Define new method.
11880         (Target_arm::rel_dyn_section): Same.
11881         (Output_data_plt_arm): New template class.
11882         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11883         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11884         (Output_data_plt_arm::add_entry): Same.
11885         (Output_data_plt_arm::first_plt_entry): Define new
11886         static data member for PLT instruction template.
11887         (Output_data_plt_arm::plt_entry): Same.
11888         (Output_data_plt_arm::do_write): Define new method.
11889         (Target_arm::make_plt_entry): Same.
11890         (Target_arm::do_finalize_sections): Same.
11891         (Target_arm::do_dynsym_value): Same.
11892
11893 2009-05-28  Doug Kwan  <dougkwan@google.com>
11894
11895         * Makefile.am (TARGETSOURCES): Add arm.cc.
11896         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11897         * Makefile.in: Regenerate.
11898         * arm.cc: New file.
11899         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11900
11901 2009-05-26  Doug Kwan  <dougkwan@google.com>
11902
11903         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11904         (General_options::check_excluded_libs): Strip off directories in
11905         archive name before matching like GNU ld does.
11906         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11907         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11908         (exclude_libs_test_LDFLAGS): Add linker option
11909         -Wl,--exclude-libs,libexclude_libs_test_3
11910         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11911         an explicit archive without using -l.
11912         (alt/libexclude_libs_test_3.a): New make rule.
11913         * testsuite/Makefile.in: Regenerate.
11914         * testsuite/exclude_libs_test.c : Declare lib3_default().
11915         (main): Call it.
11916         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11917         * exclude_libs_test_3.c: New file.
11918
11919 2009-05-26  Nick Clifton  <nickc@redhat.com>
11920
11921         * po/id.po: New Indonesian translation.
11922         * po/gold.pot: Updated template file.
11923
11924 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11925
11926         * testsuite/Makefile.am: Add -ffunction-sections to compile
11927         gc_comdat_test files.  Add -Wl,--gc-sections to build
11928         gc_comdat_test.
11929         * testsuite/Makefile.in: Regenerate.
11930         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11931
11932 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11933
11934         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11935         kept comdat section was garbage collected.
11936         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11937         * testsuite/Makefile.in: Regenerate.
11938         * testsuite/gc_comdat_test.sh: New file.
11939         * testsuite/gc_comdat_test_1.cc: New file.
11940         * testsuite/gc_comdat_test_2.cc: New file.
11941
11942 2009-05-19  Doug Kwan  <dougkwan@google.com>
11943
11944         * archive.cc (Archive::Archive): Move constructor from archive.h
11945         to here.  Initialize no_export_.
11946         (Archive::get_elf_object_for_member): Set no_export flag of object.
11947         * archive.h (Archive::Archive): Move constructor body to
11948         archive.cc.
11949         (Archive::no_export): New method.
11950         (Archive::no_export_): New field.
11951         * object.h (Object::Object): Initialize no_export_ to false.
11952         (Object::no_export, Object::set_no_export): New methods.
11953         (Object::no_export_): New field.
11954         * options.cc (General_options::parse_exclude_libs): New method.
11955         (General_options::check_excluded_libs) Same.
11956         * options.h (exclude_libs): New option.
11957         (General_options::check_excluded_libs): New method declaration.
11958         (General_options::excluded_libs_): New field.
11959         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11960         default or protected visibility if an object has no-export flag set.
11961         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11962         (check_SCRIPTS): Add exclude_libs_test.sh.
11963         (check_DATA): Add exclude_libs_test.syms.
11964         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11965         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11966         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11967         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11968         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11969         libexclude_libs_test_2.a): New rules.
11970         * testsuite/Makefile.in: Regenerate.
11971         * testsuite/exclude_libs_test.c: New file.
11972         * testsuite/exclude_libs_test.sh: Ditto.
11973         * testsuite/exclude_libs_test_1.c: Ditto.
11974         * testsuite/exclude_libs_test_2.c: Ditto.
11975
11976 2009-05-15  Ian Lance Taylor  <iant@google.com>
11977
11978         * configure.ac: Check for declarations for cases where libiberty.h
11979         checks HAVE_DECL_xxx.
11980         * configure, config.in: Rebuild.
11981
11982 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11983
11984         * gold.h (Incremental_argument_list): Remove (invalid) forward
11985         declaration.
11986         * incremental.cc (Incremental_inputs::report_achive): New method.
11987         (Incremental_inputs::report_object): New method.
11988         (Incremental_inputs::report_script): New method.
11989         (Incremental_inputs::finalize_inputs): New method.
11990         (Incremental_inputs::finalize): Call finalize_inputs().
11991         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11992         Create inputs entries.
11993         * incremental.h (Incremental_input_type): New enum.
11994         (Incremental_inputs::Incremental_input): Initialize new fields.
11995         (Incremental_inputs::report_inputs): New method.
11996         (Incremental_inputs::report_achive): New method.
11997         (Incremental_inputs::report_object): New method.
11998         (Incremental_inputs::report_script): New method.
11999         (Incremental_inputs::finalize_inputs): New method.
12000         (Incremental_inputs::Input_info): New struct.
12001         (Incremental_inputs::Input_info_map): New typedef.
12002         (Incremental_inputs::lock_): New field.
12003         (Incremental_inputs::Inputs_): New field.
12004         (Incremental_inputs::Inputs_map): New field.
12005         * main.cc (main): Call Incremental_input::report_inputs.
12006         * options.h (Input_argument_list): Typedef moved from
12007         Input_arguments.
12008         (Input_file_group::Files): Remove, use ::Input_argument_list.
12009         (Input_file_group::Input_argument_list): Remove, use
12010         ::Input_argument_list.
12011         * plugin.cc (Plugin_manager::add_input_file): Add error in
12012         incremental build.
12013         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12014         functions.
12015         * script.cc (read_input_script): Call
12016         Incremental_input::report_script.
12017         * script.h (Script_info): New class.
12018
12019 2009-04-27  Ian Lance Taylor  <iant@google.com>
12020
12021         * x86_64.cc (do_adjust_output_section): Set entsize to
12022         plt_entry_size.
12023
12024 2009-04-23  Elliott Hughes  <enh@google.com>
12025
12026         * output.cc (Output_file::close): After short writes, continue
12027         writing from the correct offset in the buffer being written.
12028
12029 2009-04-23  Chris Demetriou  <cgd@google.com>
12030
12031         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12032         * configure: Regenerate.
12033         * config.in: Regenerate.
12034         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12035         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12036
12037 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12038
12039         * incremental.cc (Incremental_inputs_header_data): Renamed from
12040         Incremental_input_header_data.
12041         (Incremental_inputs_header_data::data_size): New field.
12042         (Incremental_inputs_header_data::put_input_file_count): Renamed
12043         from input_file_count.
12044         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12045         from command_line_offset.
12046         (Incremental_inputs_header_data::put_reserved): Renamed from
12047         put_reserved.
12048         (Incremental_inputs_entry_data): Renamed from
12049         Incremental_input_entry_data.
12050         (Incremental_inputs_entry_data::data_size): New field.
12051         (Incremental_inputs::report_command_line): New method.
12052         (Incremental_inputs::finalize): New method.
12053         (Incremental_inputs::create_incremental_inputs_data): New method.
12054         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12055         * incremental.h: New file.
12056         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12057         (Layout::finalize): Create incremental inputs section in
12058         incremental builds.
12059         (Layout::create_incremental_info_sections): New method.
12060         * layout.h (Layout::incremental_inputs): New method.
12061         (Layout::create_incremental_info_sections): New method.
12062         (Layout::incremental_inputs_): New field.
12063         * main.cc (main): Notify Incremental_input of the command line.
12064
12065 2009-04-01  Ian Lance Taylor  <iant@google.com>
12066             Mikolaj Zalewski  <mikolajz@google.com>
12067
12068         * gold.h (reserve_unordered_map): Define, three versions, one for
12069         each version of Unordered_map.
12070         * layout.cc (Layout::Layout): Remove options parameter.  Add
12071         number_of_input_files parameter.  Don't initialize options_.
12072         Initialize number_of_input_files_ and resized_signatures_.  Move
12073         sections_are_attached_.
12074         (Layout::layout_group): Reserve space for group_signatures_.
12075         (Layout::find_or_add_kept_section): Change name parameter to be a
12076         reference.  Resize signatures_ map when it gets large enough.
12077         (Layout::layout_eh_frame): Use parameters->options() instead of
12078         this->options_.
12079         (Layout::make_output_section): Likewise.
12080         (Layout::attach_allocated_section_to_segment): Likewise.
12081         (Layout::finalize, Layout::create_executable_stack): Likewise.
12082         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12083         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12084         * layout.h (class Layout): Update declarations.  Remove options_
12085         field.  Add number_of_input_files_ and resized_signatures_
12086         fields.  Move sections_are_attached_ field.
12087         * main.cc (main): Pass number of input files to Layout
12088         constructor.  Don't pass options.
12089
12090 2009-03-30  Ian Lance Taylor  <iant@google.com>
12091
12092         * ffsll.c (ffsll): Correct implementation.
12093
12094 2009-03-27  Ian Lance Taylor  <iant@google.com>
12095
12096         * ffsll.c: New file.
12097         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12098         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12099         * ftruncate.c (ftruncate): Declare before definition.
12100         * mremap.c (mremap): Likewise.
12101         * pread.c (pread): Likewise.
12102         * configure, Makefile.in, config.in: Rebuild.
12103
12104         * mremap.c: New file.
12105         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12106         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12107         (mremap): Declare if HAVE_MREMAP is not defined.
12108         * configure, Makefile.in, config.in: Rebuild.
12109
12110 2009-03-27  Cary Coutant  <ccoutant@google.com>
12111
12112         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12113         position independent.
12114         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12115         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12116
12117 2009-03-24  Cary Coutant  <ccoutant@google.com>
12118
12119         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12120         an executable.
12121         (needs_dynamic_reloc): Likewise.
12122
12123 2009-03-24  Ian Lance Taylor  <iant@google.com>
12124
12125         * yyscript.y (file_cmd): Recognize EXTERN.
12126         (extern_name_list, extern_name_list_body): New nonterminals.
12127         * script.cc (script_add_extern): Define.
12128         * script-c.h (script_add_extern): Declare.
12129
12130 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12131
12132         * object.cc (is_elf_object): Define.
12133         * object.h (is_elf_object): Declare.
12134         * archive.cc (Archive::get_elf_object_for_member): Call
12135         is_elf_object.
12136         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12137
12138 2009-03-24  Elliott Hughes  <enh@google.com>
12139
12140         * output.cc (Output_file::map_anonymous): Define.
12141         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12142         try an anonymous one.  Report the size if the mmap fails.
12143         * output.h (class Output_file): Declare map_anonymous.
12144
12145 2009-03-24  Ian Lance Taylor  <iant@google.com>
12146
12147         * target-select.cc (instantiate_target): Don't acquire the lock if
12148         the instantiated_target_ field has already been set.
12149
12150 2009-03-23  Ian Lance Taylor  <iant@google.com>
12151
12152         * gold-threads.h (class Initialize_lock): Define.
12153         * gold-threads.cc (class Initialize_lock_once): Define.
12154         (initialize_lock_control): New static variable.
12155         (initialize_lock_pointer): New static variable.
12156         (initialize_lock_once): New static function.
12157         (Initialize_lock::Initialize_lock): Define.
12158         (Initialize_lock::initialize): Define.
12159         * target-select.h: Include "gold-threads.h".
12160         (class Target_selector): Add lock_ and initialize_lock_ fields.
12161         Don't define instantiate_target, just declare it.
12162         * target-select.cc (Target_selector::Target_selector): Initialize
12163         new fields.
12164         (Target_selector::instantiate_target): Define.
12165         * descriptors.h: Include "gold-threads.h".
12166         (class Descriptors): Add initialize_lock_ field.
12167         * descriptors.cc (Descriptors::Descriptors): Initialize new
12168         field.
12169         (Descriptors::open): Use initialize_lock_ field
12170         * errors.h (class Errors): Add initialize_lock_ field.
12171         * errors.cc (Errors::Errors): Initialize new field.
12172         (Errors::initialize_lock): Use initialize_lock_ field.
12173         * powerpc.cc (class Target_selector_powerpc): Remove
12174         instantiated_target_ field.  In do_recognize call
12175         instantiate_target rather than do_instantiate_target.  In
12176         do_instantiate_target just allocate a new target.
12177         * sparc.cc (class Target_selector_sparc): Likewise.
12178
12179         * freebsd.h: New file.
12180         * i386.cc: Include "freebsd.h".
12181         (Target_i386): Derive from Target_freebsd rather than
12182         Sized_target.
12183         (Target_selector_i386): Derive from Target_selector_freebsd rather
12184         than Target_selector.
12185         * x86_64.cc: Include "freebsd.h".
12186         (Target_x86_64): Derive from Target_freebsd rather than
12187         Sized_target.
12188         (Target_selector_x86_64): Derive from Target_selector_freebsd
12189         rather than Target_selector.
12190         * target.h (class Target): Add adjust_elf_header and
12191         do_adjust_elf_header.
12192         * output.cc (Output_file_header:: do_sized_write): Call target
12193         adjust_elf_header routine.
12194         * configure.tgt: Set targ_osabi.
12195         * configure.ac: Define GOLD_DEFAULT_OSABI.
12196         * parameters.cc (Parameters::default_target): Pass
12197         GOLD_DEFAULT_OSABI to select_target.
12198         * target-select.h (class Target_selector): Make instantiate_target
12199         protected rather than private.
12200         * Makefile.am (HFILES): Add freebsd.h.
12201         * configure, Makefile.in, config.in: Rebuild.
12202
12203         * merge.cc (do_add_input_section): Correct pend value.  Change
12204         message about last entry not being null terminated from error to
12205         warning.
12206
12207 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12208
12209         * incremental.cc: New file.
12210         * Makefile.am (CCFILES): Add incremental.cc.
12211         * Makefile.in: Rebuild.
12212
12213 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12214
12215         * layout.cc (Layout::output_section_name): Preserve names
12216         of '.note.' sections.
12217
12218 2009-03-19  Ian Lance Taylor  <iant@google.com>
12219
12220         * descriptors.cc (Descriptors::open): Check that the options are
12221         valid before using them.
12222
12223 2009-03-18  Ian Lance Taylor  <iant@google.com>
12224
12225         * script-sections.h: Include <list>.
12226         (class Script_sections): Change Sections_elements from std::vector
12227         to std::list.  Typedef public Elements_iterator.  Add
12228         orphan_section_placement_, data_segment_align_start_, and
12229         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12230         field.
12231         * script-sections.cc (class Orphan_section_placement): New class.
12232         (class Sections_element): Add virtual functions is_relro and
12233         orphan_section_init.  Remove virtual function place_orphan_here.
12234         (class Output_section_definition): Add is_relro and
12235         orphan_section_init.  Remove place_orphan_here.
12236         (class Orphan_output_section): Likewise.
12237         (Script_sections::Script_sections): Update for field changes.
12238         (Script_sections::data_segment_align): Set saw_data_segment_align_
12239         and data_segment_align_start_, not data_segment_align_index.
12240         (Script_sections::data_segment_relro_end): Check
12241         saw_data_segment_align_.  Use data_segment_align_start_ rather
12242         than data_segment_align_index_.
12243         (Script_sections::place_orphan): Rewrite to use
12244         Orphan_section_placement.
12245
12246 2009-03-17  Ian Lance Taylor  <iant@google.com>
12247
12248         * archive.cc (Archive::add_symbols): Check for a version attached
12249         to the symbol name in the archive map.
12250         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12251         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12252         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12253         (ver_test_11.a): New target.
12254         * testsuite/Makefile.in: Rebuild.
12255
12256         * configure.ac: Check for chsize and posix_fallocate.  Replace
12257         ftruncate.
12258         * ftruncate.c: New file, from gnulib.
12259         * output.cc (posix_fallocate): Define dummy version if not
12260         HAVE_POSIX_FALLOCATE.
12261         (Output_file::map): Call posix_fallocate rather than lseek and
12262         write.
12263         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12264         * configure, Makefile.in, config.in: Rebuild.
12265
12266 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12267
12268         * layout.h (Layout::create_note): Add section_name parameter.
12269         * layout.cc (Layout::create_note): Likewise.
12270         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12271
12272 2009-03-17  Ian Lance Taylor  <iant@google.com>
12273
12274         * descriptors.cc: Include "options.h".
12275         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12276         (Descriptors::open): Always use O_CLOEXEC when opening a new
12277         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12278         then set FD_CLOEXEC.
12279
12280         * sparc.cc (class Target_sparc): Add has_got_section.
12281         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12282         make sure we have a GOT section.
12283
12284         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12285         (Target_sparc::Scan::local): Likewise.
12286         (Target_sparc::Scan::global): Likewise.
12287         (Target_sparc::Relocate::relocate): Likewise.
12288         (Target_sparc::Relocate::relocate_tls): Likewise.
12289
12290         * symtab.cc (Symbol_table::define_default_version): New function,
12291         broken out of add_from_object.
12292         (Symbol_table::add_from_object): Call define_default_version.
12293         (Symbol_table::define_special_symbol): Add resolve_oldsym
12294         parameter.  Change all callers.  If the version for a symbol comes
12295         from a version script, resolve it with the symbol with the same
12296         name with no version.  Also add the symbol without a version if
12297         appropriate.
12298         (do_define_in_output_data): If resolving with oldsym, don't delete
12299         sym.
12300         (do_define_in_output_segment): Likewise.
12301         (do_define_as_constant): Likewise.
12302         * symtab.h (class Symbol_table): Update declarations.
12303
12304 2009-03-13  Ian Lance Taylor  <iant@google.com>
12305
12306         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12307         (Read_symbols::requeue): New function.
12308         (Read_symbols::do_read_symbols): If make_elf_object fails because
12309         the target type is not configured, and the file was searched for,
12310         issue a warning and retry with the next directory.
12311         (Add_symbols::run): If the file has an incompatible format, and
12312         it was searched for, requeue the Read_symbols task.  On error,
12313         release the object.
12314         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12315         dirindex parameter to constructor.  Change all callers.  Declare
12316         incompatible_warning and requeue.
12317         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12318         input_argument_ and input_group_ fields.  Add them to
12319         constructor.  Change all callers.
12320         (class Read_script): Add dirindex_ field.  Add it to constructor.
12321         Change all callers.
12322         * archive.cc (Archive::setup): Remove input_objects parameter.
12323         Change all callers.
12324         (Archive::get_file_and_offset): Likewise.
12325         (Archive::read_all_symbols): Likewise.
12326         (Archive::read_symbols): Likewise.
12327         (Archive::get_elf_object_for_member): Remove input_objects
12328         parameter.  Add punconfigured parameter.  Change all callers.
12329         (Archive::add_symbols): Change return type to bool.  Check return
12330         value of include_member.
12331         (Archive::include_all_members): Likewise.
12332         (Archive::include_member): Change return type to bool.  Return
12333         false if first included object has incompatible target.  Set
12334         included_member_ field.
12335         (Add_archive_symbols::run): If add_symbols returns false, requeue
12336         Read_symbols task.
12337         * archive.h (class Archive): Add included_member_ field.
12338         Initialize it in constructor.  Add input_file and searched_for
12339         methods.  Update declarations.
12340         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12341         input_argument_ fields.  Add them to constructor.  Change all
12342         callers.
12343         * script.cc: Include "target-select.h".
12344         (class Parser_closure): Add skip_on_incompatible_target_ and
12345         found_incompatible_target_ fields.  Add
12346         skip_on_incompatible_target parameter to constructor.  Change all
12347         callers.  Add methods skip_on_incompatible_target,
12348         clear_skip_on_incompatible_target, found_incompatible_target, and
12349         set_found_incompatible_target.
12350         (read_input_script): Add dirindex parameter.  Change all callers.
12351         If parser finds an incompatible target, requeue Read_symbols
12352         task.
12353         (script_set_symbol): Clear skip_on_incompatible_target in
12354         closure.
12355         (script_add_assertion, script_parse_option): Likewise.
12356         (script_start_sections, script_add_phdr): Likewise.
12357         (script_check_output_format): New function.
12358         * script.h (read_input_script): Update declaration.
12359         * script-c.h (script_check_output_format): Declare.
12360         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12361         (ignore_cmd): Remove OUTPUT_FORMAT.
12362         * fileread.cc (Input_file::Input_file): Add explicit this.
12363         (Input_file::will_search_for): New function.
12364         (Input_file::open): Add pindex parameter.  Change all callers.
12365         * fileread.h (class Input_file): Add input_file_argument method.
12366         Declare will_search_for.  Update declarations.
12367         * object.cc (make_elf_object): Add punconfigured parameter.
12368         Change all callers.
12369         * object.h (class Object): Make input_file public.  Add
12370         searched_for method.
12371         (make_elf_object): Update declaration.
12372         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12373         restart search.
12374         * dirsearch.h (class Dirsearch): Update declaration.
12375         * options.h (class General_options): Add --warn-search-mismatch.
12376         * parameters.cc (Parameters::is_compatible_target): New function.
12377         * parameters.h (class Parameters): Declare is_compatible_target.
12378         * workqueue.cc (Workqueue::add_blocker): New function.
12379         * workqueue.h (class Workqueue): Declare add_blocker.
12380
12381         * fileread.cc (Input_file::open): Remove options parameter.
12382         Change all callers.
12383         (Input_file::open_binary): Likewise.
12384         * script.cc (read_input_script): Likewise.
12385         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12386         options parameter from constructor.  Change all callers.
12387         (class Read_script): Likewise.
12388         * fileread.h (class Input_file): Update declarations.
12389         * script.h (read_input_script): Update declaration.
12390
12391 2009-03-10  Nick Clifton  <nickc@redhat.com>
12392
12393         * po/es.po: New Spanish translation.
12394
12395 2009-03-06  Cary Coutant  <ccoutant@google.com>
12396
12397         * options.cc (parse_short_option): Keep dash_z from registering itself.
12398
12399 2009-03-03  Ian Lance Taylor  <iant@google.com>
12400
12401         PR 9918
12402         * target-reloc.h (relocate_section): Pass output_section to
12403         relocate.
12404         * i386.cc (Target_i386::should_apply_static_reloc): Add
12405         output_section parameter.  Change all callers.
12406         (Target_i386::Relocate::relocate): Add output_section parameter.
12407         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12408         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12409         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12410         * testsuite/two_file_shared.sh: New script.
12411         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12412         (check_DATA): Add two_file_shared.dbg.
12413         (two_file_shared.dbg): New target.
12414         * testsuite/Makefile.in: Rebuild.
12415
12416 2009-03-01  Ian Lance Taylor  <iant@google.com>
12417
12418         * configure.ac: Check for byteswap.h.
12419         * configure: Rebuild.
12420         * config.in: Rebuild.
12421
12422 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12423
12424         * layout.cc (Layout::find_or_add_kept_section): New function.
12425         (Layout::add_comdat): Removed.
12426         * layout.h (struct Kept_section): Move out of class Layout.
12427         Remove trailing underscores from field names.  Add group_sections
12428         field.  Rename group_ field to is_group.  Change all uses.
12429         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12430         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12431         comdat_groups_ field.
12432         (Sized_relobj::include_section_group): Use
12433         find_or_add_kept_section and Kept_section::group_sections.
12434         (Sized_relobj::include_linkonce_section): Likewise.
12435         * object.cc (class Sized_relobj): Don't define Comdat_group or
12436         Comdat_group_table.  Remove find_comdat_group and
12437         add_comdat_group.  Remove comdat_groups_ field.
12438         * plugin.cc (include_comdat_group): Use
12439         Layout::find_or_add_kept_section.
12440
12441 2009-02-28  Ian Lance Taylor  <iant@google.com>
12442
12443         * README: --gc-sections and map files are now supported.  Document
12444         some build requirements.
12445
12446         PR 6992
12447         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12448         relocatable link set the value of the section symbol to zero.
12449         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12450         relocatable link don't include the section address in the local
12451         symbol value.
12452
12453 2009-02-27  Ian Lance Taylor  <iant@google.com>
12454
12455         PR 6811
12456         * options.h (class Search_directory): Add is_system_directory.
12457         (class General_options): Declare is_in_system_directory.
12458         * options.cc (get_relative_sysroot): Make static.
12459         (get_default_sysroot): Make static.
12460         (General_optoins::is_in_system_directory): New function.
12461         * fileread.cc (Input_file::is_in_system_directory): New function.
12462         * fileread.h (class Input_file): Declare is_in_system_directory.
12463         * object.h (class Object): Add is_in_system_directory.
12464         (class Input_objects): Remove system_library_directory_ field.
12465         * object.cc (Input_objects::add_object): Don't set
12466         system_library_directory_.
12467         (input_objects::found_in_system_library_directory): Remove.
12468         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12469         parameter.  Change all callers.
12470         (Symbol_table::sized_write_globals): Likewise.
12471         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12472         Call Object::is_in_system_directory.
12473         * symtab.h (class Symbol_table): Update declarations.
12474
12475         PR 5990
12476         * descriptors.h (Open_descriptor): Add is_on_stack field.
12477         * descriptors.cc (Descriptors::open): If the descriptor is on the
12478         top of the stack, remove it.  Initialize is_on_stack field.
12479         (Descriptors::release): Only add pod to stack if it is not on the
12480         stack already.
12481         (Descriptors::close_some_descriptor): Clear stack_next and
12482         is_on_stack fields.
12483
12484         PR 7091
12485         * output.cc (Output_section::find_starting_output_address): Rename
12486         from starting_output_address; add PADDR parameter; change return
12487         type.
12488         * output.h (class Output_section): Declare
12489         find_starting_output_address instead of starting_output_address.
12490         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12491         section symbol for which we can't find a merge section.
12492
12493         PR 9836
12494         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12495         hidden or internal, force the symbol to be local.
12496         * resolve.cc (Symbol::override_visibility): Define.
12497         (Symbol::override_base): Use override_visibility.
12498         (Symbol_table::resolve): Likewise.
12499         (Symbol::override_base_with_special): Likewise.
12500         (Symbol_table::override_with_special): If the visibility is hidden
12501         or internal, force the symbol to be local.
12502         * symtab.h (class Symbol): Add set_visibility and
12503         override_visibility.
12504         * testsuite/ver_test_1.sh: New file.
12505         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12506         (check_DATA): Add ver_test_1.syms.
12507         (ver_test_1.syms): New target.
12508         * testsuite/Makefile.in: Rebuild.
12509
12510 2009-02-25  Cary Coutant  <ccoutant@google.com>
12511
12512         * layout.cc (Layout::choose_output_section): Don't rename sections
12513         when using a linker script that has a SECTIONS clause.
12514         * Makefile.in: Regenerate.
12515
12516         * testsuite/Makefile.am (script_test_5.sh): New test case.
12517         * testsuite/Makefile.in: Regenerate.
12518         * testsuite/script_test_5.cc: New file.
12519         * testsuite/script_test_5.sh: New file.
12520         * testsuite/script_test_5.t: New file.
12521
12522 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12523
12524         * archive.cc (Archive::include_member): Update calls to add_symbols.
12525         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12526         the Layout argument.
12527         * dynobj.h (do_add_symbols): Add the Layout argument.
12528         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12529         Layout argument.
12530         * object.h (Object::add_symbols): Add the Layout argument.
12531         (Object::do_add_symbols): Add the Layout argument.
12532         (Sized_relobj::do_add_symbols): Add the Layout argument.
12533         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12534         Unify the two versions.
12535         (Add_plugin_symbols): Remove.
12536         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12537         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12538         (Add_plugin_symbols): Remove.
12539         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12540         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12541         (Add_symbols::run): Make it work with Pulginobj.
12542
12543 2009-02-06  Ian Lance Taylor  <iant@google.com>
12544
12545         * object.cc (Sized_relobj::do_layout): Make info message start
12546         with lower case letter.
12547
12548 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12549
12550         * binary.cc: Fix file comment.
12551
12552         * options.h (enum Incremental_disposition): Define.
12553         (class General_options): Add new options: --incremental,
12554         --incremental_changed, --incremental_unchanged,
12555         --incremental_unknown.  Add incremental_disposition_ and
12556         implicit_incremental_ fields.
12557         (General_options::incremental_disposition): New function.
12558         (class Position_dependent_options): Add incremental_disposition
12559         option.
12560         (Position_dependent_options::copy_from_options): Set incremental
12561         dispositions.
12562         * options.cc (General_options::parse_incremental_changed): New
12563         function.
12564         (General_options::parse_incremental_unchanged): New function.
12565         (General_options::parse_incremental_unknown): New function.
12566         (General_options::General_options): Initialize new fields
12567         incremental_disposition_ and implicit_incremental_.
12568         (General_options::finalize): Check for uasge of --incremental-*
12569         without --incremental.
12570
12571 2009-02-06  Chris Demetriou  <cgd@google.com>
12572
12573         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12574         pointer and to report location as the file name associated with
12575         the symbol.
12576         (gold_undefined_symbol_at_location): New function to replace the
12577         old gold_undefined_symbol functionality.
12578         * target-reloc.h (relocate_section): Update to use
12579         gold_undefined_symbol_at_location.
12580         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12581         Call gold_undefined_symbol function rather than gold_error.
12582         * errors.h (Errors::undefined_symbol): Take location as a
12583         string, rather than calculating it from a relocation.
12584         * errors.cc (Errors::fatal): Print "fatal error:" before the
12585         formatted message.
12586         (Errors::error, Errors::error_at_location): Print "error: "
12587         before the formatted message.
12588         (Errors::undefined_symbol): Take location as a string, rather
12589         than calculating it from a relocation.
12590         (gold_undefined_symbol_at_location): New function akin to
12591         old gold_undefined_symbol, calculates location from relocation.
12592         (gold_undefined_symbol): Change to take only a Symbol pointer
12593         and to report location as the file name associated with the symbol.
12594         * testsuite/debug_msg.sh: Update for changed error messages.
12595         * testsuite/undef_symbol.sh: Likewise.
12596
12597 2009-02-04  Duncan Sands  <baldrick@free.fr>
12598
12599         PR 9812
12600         * reduced_debug_output.h
12601         (Output_reduced_debug_abbrev_section::failed): Use format for
12602         gold_warning.
12603         (Output_reduced_debug_info_section::faild): Likewise.
12604
12605 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12606
12607         * script.cc (Lazy_demangler): New class.
12608         (Version_script_info::get_symbol_version_helper): Demangle a
12609         symbol only once.
12610
12611 2009-01-29  Cary Coutant  <ccoutant@google.com>
12612
12613         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12614         to __tls_get_addr.
12615         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12616
12617 2009-01-28  Ian Lance Taylor  <iant@google.com>
12618
12619         * version.cc (version_string): Bump to 1.9.
12620
12621         * gold.h: Include <cstring> and <stdint.h>.
12622         * version.cc: Include <cstdio>.
12623         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12624         warning.
12625         * reduced_debug_output.cc (insert_into_vector): Rename from
12626         Insert_into_vector; change all callers.  Use Swap_unaligned to
12627         avoid aliasing issue; remove union since it is unnecessary.
12628
12629 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12630
12631         * Makefile.am (CCFILES): Add gc.cc.
12632         (HFILES): Add gc.h.
12633         * Makefile.in: Regenerate.
12634         * gold.cc (Gc_runner): New class.
12635         (queue_initial_tasks): Call garbage collection related tasks
12636         when corresponding options are invoked.
12637         (queue_middle_gc_tasks): New function.
12638         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12639         processed early before laying out sections during garbage collection.
12640         * gold.h (queue_middle_gc_tasks): New function.
12641         (is_prefix_of): Move from "layout.cc".
12642         * i386.cc (Target_i386::gc_process_relocs): New function.
12643         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12644         * main.cc (main): Create object of class "Garbage_collection".
12645         * object.cc (Relobj::copy_symbols_data): New function.
12646         (Relobj::is_section_name_included): New function.
12647         (Sized_relobj::do_layout): Allow this function to be called twice
12648         during garbage collection and defer layout of section during the
12649         first call.
12650         * object.h (Relobj::get_symbols_data): New function.
12651         (Relobj::is_section_name_included): New function.
12652         (Relobj::copy_symbols_data): New function.
12653         (Relobj::set_symbols_data): New function.
12654         (Relobj::get_relocs_data): New function.
12655         (Relobj::set_relocs_data): New function.
12656         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12657         (Relobj::gc_process_relocs): New function.
12658         (Relobj::do_gc_process_relocs): New pure virtual function.
12659         (Relobj::sd_): New data member.
12660         (Sized_relobj::is_output_section_offset_invalid): New function.
12661         (Sized_relobj::do_gc_process_relocs): New function.
12662         * options.h (General_options::gc_sections): Modify to not be a no-op.
12663         (General_options::print_gc_sections): New option.
12664         * plugin.cc (Plugin_finish::run): Remove function call to
12665         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12666         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12667         * reloc.cc (Read_relocs::run): Add task to process relocs and
12668         determine unreferenced sections when doing garbage collection.
12669         (Gc_process_relocs): New class.
12670         (Sized_relobj::do_gc_process_relocs): New function.
12671         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12672         sections that are garbage collected.
12673         * reloc.h (Gc_process_relocs): New class.
12674         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12675         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12676         symbols whose corresponding sections are garbage collected.
12677         (Symbol_table::Symbol_table): Add new parameter for the garbage
12678         collection object.
12679         (Symbol_table::gc_mark_undef_symbols): New function.
12680         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12681         (Symbol_table::gc_mark_dyn_syms): New function.
12682         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12683         as garbage.
12684         (Symbol_table::add_from_object): Likewise.
12685         (Symbol_table::add_from_relobj): When building shared objects, do not
12686         treat externally visible symbols as garbage.
12687         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12688         table information for static and relocatable links.
12689         * symtab.h (Symbol_table::set_gc): New function.
12690         (Symbol_table::gc): New function.
12691         (Symbol_table::gc_mark_undef_symbols): New function.
12692         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12693         (Symbol_table::gc_mark_dyn_syms): New function.
12694         (Symbol_table::gc_): New data member.
12695         * target.h (Sized_target::gc_process_relocs): New pure virtual
12696         function.
12697         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12698         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12699
12700 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12701
12702         * options.h (General_options::gc_sections): Define as a no-op for now.
12703         (General_options::no_keep_memory): Ditto.
12704         (General_options::Bshareable): Define.
12705         * options.cc (General_options::finalize): Honor -Bshareable.
12706
12707 2009-01-20  Andreas Schwab  <schwab@suse.de>
12708
12709         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12710         read the value in the contents, since we don't use it.  Use the
12711         template endianness when writing.
12712         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12713
12714 2009-01-19  Andreas Schwab  <schwab@suse.de>
12715
12716         * configure.tgt (powerpc64-*): Fix targ_obj.
12717
12718 2009-01-15  Ian Lance Taylor  <iant@google.com>
12719
12720         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12721         local symbols when stripping all symbols.
12722
12723 2009-01-14  Cary Coutant  <ccoutant@google.com>
12724
12725         * output.cc (Output_reloc): Add explicit instantiations.
12726
12727 2009-01-14  Cary Coutant  <ccoutant@google.com>
12728
12729         * archive.cc (Archive::get_elf_object_for_member): Remove call
12730         to File_read::claim_for_plugin.
12731         * descriptors.cc (Descriptors::open): Remove reference to
12732         is_claimed.
12733         (Descriptors::claim_for_plugin): Remove.
12734         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12735         (Descriptors::is_claimed): Remove.
12736         (claim_descriptor_for_plugin): Remove.
12737         * fileread.cc (File_read::claim_for_plugin): Remove.
12738         * fileread.h (File_read::claim_for_plugin): Remove.
12739         (File_read::descriptor): Reopen descriptor if necessary.
12740         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12741         (Plugin_manager::all_symbols_read): Add task parameter. Change
12742         all callers.
12743         (Plugin_manager::get_input_file): New function.
12744         (Plugin_manager::release_input_file): New function.
12745         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12746         corresponding data member.
12747         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12748         and pass to base constructor. Change all callers.
12749         (get_input_file, release_input_file): New functions.
12750         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12751         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12752         (Plugin_manager::all_symbols_read): Add task parameter.
12753         (Plugin_manager::get_input_file): New function.
12754         (Plugin_manager::release_input_file): New function.
12755         (Plugin_manager::task_): New data member.
12756         (Pluginobj::Pluginobj): Add filesize parameter.
12757         (Pluginobj::filename): New function.
12758         (Pluginobj::descriptor): New function.
12759         (Pluginobj::filesize): New function.
12760         (Pluginobj::filesize_): New data member.
12761         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12762         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12763         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12764
12765         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12766         with archive libraries.
12767         * testsuite/Makefile.in: Regenerate.
12768         * testsuite/plugin_test.c (struct sym_info): New type.
12769         (get_input_file, release_input_file): New static variables.
12770         (onload): Capture new transfer vector entries.
12771         (claim_file_hook): Stop reading at end of file according to filesize.
12772         Factor out parsing of readelf output into separate function.
12773         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12774         APIs and get the source file name from the symbol table.  Convert
12775         source file name to corresponding object file name.  Print info
12776         message when adding new input files.
12777         (parse_readelf_line): New function.
12778         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12779         * testsuite/plugin_test_2.sh: Likewise.
12780         * testsuite/plugin_test_3.sh: Likewise.
12781         * testsuite/plugin_test_4.sh: New test case.
12782
12783 2009-01-07  Ian Lance Taylor  <iant@google.com>
12784
12785         * version.cc (version_string): Bump to 1.8.
12786
12787 2008-12-23  Cary Coutant  <ccoutant@google.com>
12788
12789         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12790         * plugin.cc (Plugin_manager::finish): Rename as
12791         layout_deferred_objects.  Move cleanup to separate function.
12792         (Plugin_manager::cleanup): New function.
12793         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12794         separately.
12795         * plugin.h (Plugin_manager::finish): Rename as
12796         layout_deferred_objects.
12797         (Plugin_manager::cleanup): New function.
12798         (Plugin_manager::cleanup_done): New field.
12799
12800 2008-12-23  Cary Coutant  <ccoutant@google.com>
12801
12802         * plugin.cc (is_visible_from_outside): New function.
12803         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12804         so we don't return "IR only" status for exported symbols or -r links.
12805
12806         * testsuite/Makefile.am (plugin_test_3): New test case.
12807         * testsuite/Makefile.in: Regenerate.
12808         * testsuite/plugin_test_3.sh: New file.
12809
12810 2008-12-22  Cary Coutant  <ccoutant@google.com>
12811
12812         * object.cc (Sized_relobj::layout_section): New function.
12813         (Sized_relobj::do_layout): Defer layout of input sections until after
12814         plugin has provided replacement files.
12815         (Sized_relobj::do_layout_deferred_sections): New function.
12816         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12817         (Relobj::layout_deferred_sections): New function.
12818         (Relobj::do_layout_deferred_sections): New function.
12819         (Sized_relobj::do_layout_deferred_sections): New function.
12820         (Sized_relobj::layout_section): New function.
12821         (Sized_relobj::Deferred_layout): New structure.
12822         (Sized_relobj::deferred_layout_): New field.
12823         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12824         Change all callers.  Layout deferred sections.
12825         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12826         references.
12827         (Plugin_hook::run): Move code from do_plugin_hook inline.
12828         (Plugin_hook::do_plugin_hook): Remove.
12829         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12830         (Plugin_manager::finish): Renamed, was cleanup.
12831         (Plugin_manager::should_defer_layout): New function.
12832         (Plugin_manager::add_deferred_layout_object): New function.
12833         (Plugin_manager::Deferred_layout_list): New type.
12834         (Plugin_manager::deferred_layout_objects_): New field.
12835         (Plugin_hook::do_plugin_hook): Remove.
12836
12837 2008-12-17  Ian Lance Taylor  <iant@google.com>
12838
12839         * options.h (class General_options): Add --no case for
12840         --export-dynamic.
12841
12842 2008-12-16  Cary Coutant  <ccoutant@google.com>
12843
12844         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12845         vector.
12846         (Plugin_manager::claim_file): Create plugin object even if
12847         plugin did not call the add_symbols callback.
12848         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12849         asking for more symbols than were added.
12850         * testsuite/Makefile.am (plugin_test_1): Add test case with
12851         no global symbols.
12852         (empty.syms): New target.
12853         * testsuite/Makefile.in: Regenerate.
12854         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12855         message. Don't call add_symbols if no globals.
12856         (all_symbols_read_hook): Don't provide replacement for empty
12857         claimed file.
12858
12859 2008-12-12  Ian Lance Taylor  <iant@google.com>
12860
12861         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12862         r_type == 0 for a local symbol with r_sym == 0.
12863         (scan_relocatable_relocs): Pass r_sym to
12864         local_non_section_strategy.
12865         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12866         r_sym parameter.
12867
12868         * configure.ac: Update test for TLS descriptors: they are
12869         supported as of glibc 2.9.
12870         * configure: Rebuild.
12871
12872 2008-12-11  Ian Lance Taylor  <iant@google.com>
12873
12874         PR 7091
12875         * target-reloc.h (Default_scan_relocatable_relocs): For each
12876         function, map r_type == 0 to RELOC_DISCARD.
12877
12878 2008-12-10  Cary Coutant  <ccoutant@google.com>
12879
12880         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12881         object to override a kept COMDAT group from a plugin object.
12882
12883 2008-12-09  Ian Lance Taylor  <iant@google.com>
12884
12885         PR 7088
12886         * yyscript.y (file_cmd): Handle INPUT.
12887
12888         * testsuite/initpri1.c: Change all declarations to be full
12889         prototypes by adding void, to avoid compiler warnings.
12890
12891 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12892
12893         * options.cc (General_options::parse_plugin_opt): New.
12894         (General_options::add_plugin): The argument now is just the filename.
12895         (General_options::add_plugin_option): New.
12896         * options.h (plugin_opt): New.
12897         (add_plugin): Change argument name.
12898         (add_plugin_option): New.
12899         * plugin.cc (Plugin::load): Don't parse the plugin option.
12900         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12901         (Plugin::add_option): New.
12902         (Plugin::args_): Change type.
12903         (Plugin::filename_): New.
12904         (Plugin_manager::add_plugin_option): New.
12905         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12906         * testsuite/Makefile.in: Regenerate.
12907
12908 2008-12-05  Cary Coutant  <ccoutant@google.com>
12909
12910         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12911         Handle --strip-lto-sections option.
12912         * options.h (strip_lto_sections): New option.
12913
12914 2008-12-01  Cary Coutant  <ccoutant@google.com>
12915
12916         * plugin.cc (ld_plugin_message): Change format parameter to const.
12917         Fix mismatch between new[] and delete.
12918
12919 2008-11-14  Cary Coutant  <ccoutant@google.com>
12920
12921         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12922         instead of -1U.
12923
12924 2008-11-05  Craig Silverstein  <csilvers@google.com>
12925
12926         * options.cc (General_options::parse_dynamic_list): New function.
12927         * options.h (General_options): New flags dynamic_list,
12928         dynamic_list_data, dynamic_list_cpp_new, and
12929         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12930         (General_options::in_dynamic_list): New function.
12931         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12932         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12933         (Lex::can_continue_name): Likewise.
12934         (yylex): Likewise.
12935         (read_script_file): New parameter script_options.
12936         (read_dynamic_list): New function.
12937         (Script_options::define_dynamic_list): New function.
12938         (dynamic_list_keyword_parsecodes): New variable.
12939         (dynamic_list_keywords): New variable.
12940         * script.h (Script_options::define_dynamic_list): New function
12941         prototype.
12942         (read_dynamic_list): New function prototype.
12943         * symtab.cc (strprefix): New macro.
12944         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12945         dynamic_list_data, dynamic_list_cpp_new, and
12946         dynamic_list_cpp_typeinfo.
12947         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12948         (dynamic_list_expr): New rule.
12949         (dynamic_list_nodes): Likewise.
12950         (dynamic_list_node): Likewise.
12951         * testsuite/Makefile.am (dynamic_list): New test.
12952         * testsuite/Makefile.in: Regenerated.
12953         * testsuite/dynamic_list.t: New file.
12954         * testsuite/dynamic_list.sh: New file.
12955
12956 2008-11-05  Craig Silverstein  <csilvers@google.com>
12957
12958         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12959         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12960         (t11_last): Likewise.
12961         * testsuite/ver_test_6.c (main): Likewise.
12962
12963 2008-10-07  Cary Coutant  <ccoutant@google.com>
12964
12965         * options.c (General_options::finalize): Add check for -static and
12966         -shared.
12967         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12968         is not empty.
12969
12970 2008-10-02  Cary Coutant  <ccoutant@google.com>
12971
12972         * plugin.cc (make_sized_plugin_object): Fix conditional
12973         compilation to work when not all targets are enabled.
12974
12975 2008-09-29  Cary Coutant  <ccoutant@google.com>
12976
12977         * archive.cc (Archive::get_file_and_offset): Use filename instead
12978         of name to get library path.
12979         (Archive::include_member): Unlock external member of a thin archive.
12980
12981         * testsuite/Makefile.am (TEST_AR): New variable.
12982         (thin_archive_test_1): New test.
12983         (thin_archive_test_2): New test.
12984         * testsuite/Makefile.in: Regenerate.
12985         * testsuite/thin_archive_main.cc: New file.
12986         * testsuite/thin_archive_test_1.cc: New file.
12987         * testsuite/thin_archive_test_2.cc: New file.
12988         * testsuite/thin_archive_test_3.cc: New file.
12989         * testsuite/thin_archive_test_4.cc: New file.
12990
12991 2008-09-29  Cary Coutant  <ccoutant@google.com>
12992
12993         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12994         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12995         instead of -1U.
12996         (Sized_relobj::do_finalize_local_symbols): Likewise.
12997         (Sized_relobj::map_to_kept_section): Likewise.
12998         * object.h (Sized_relobj::invalid_address): New constant.
12999         (Sized_relobj::do_output_section_offset): Check for invalid_address
13000         and return -1ULL.
13001         * output.cc (Output_reloc::local_section_offset): Use constant
13002         invalid_address instead of -1U.
13003         (Output_reloc::get_address): Likewise.
13004         (Output_section::output_address): Change -1U to -1ULL.
13005         * output.h (Output_reloc::invalid_address): New constant.
13006         * reloc.cc (Sized_relobj::write_sections): Use constant
13007         invalid_address instead of -1U.
13008         (Sized_relobj::relocate_sections): Likewise.
13009         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13010         values for merge sections.
13011         * target-reloc.h (relocate_for_relocatable): Use constant
13012         invalid_address instead of -1U.
13013
13014 2008-09-19  Cary Coutant  <ccoutant@google.com>
13015
13016         Add plugin functionality for link-time optimization (LTO).
13017         * configure.ac (plugins): Add --enable-plugins option.
13018         * configure: Regenerate.
13019         * config.in: Regenerate.
13020         * Makefile.am (LIBDL): New variable.
13021         (CCFILES): Add plugin.cc.
13022         (HFILES): Add plugin.h.
13023         (ldadd_var): Add LIBDL.
13024         * Makefile.in: Regenerate.
13025
13026         * archive.cc: Include "plugin.h".
13027         (Archive::setup): Don't preread archive symbols when using a plugin.
13028         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13029         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13030         files.
13031         (Archive::include_member): Add symbols from plugin objects.
13032         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13033         * descriptors.cc (Descriptors::open): Check for file descriptors
13034         abandoned by plugins.
13035         (Descriptors::claim_for_plugin): New function.
13036         * descriptors.h (Descriptors::claim_for_plugin): New function.
13037         (Open_descriptor::is_claimed): New field.
13038         (claim_descriptor_for_plugin): New function.
13039         * fileread.cc (File_read::claim_for_plugin): New function.
13040         * fileread.h (File_read::claim_for_plugin): New function.
13041         (File_read::descriptor): New function.
13042         * gold.cc: Include "plugin.h".
13043         (queue_initial_tasks): Add task to call plugin hooks for generating
13044         new object files.
13045         * main.cc: Include "plugin.h".
13046         (main): Load plugin libraries.
13047         * object.h (Pluginobj): Declare.
13048         (Object::pluginobj): New function.
13049         (Object::do_pluginobj): New function.
13050         (Object::set_target): New function.
13051         * options.cc: Include "plugin.h".
13052         (General_options::parse_plugin): New function.
13053         (General_options::General_options): Initialize plugins_ field.
13054         (General_options::add_plugin): New function.
13055         * options.h (Plugin_manager): Declare.
13056         (General_options): Add --plugin option.
13057         (General_options::has_plugins): New function.
13058         (General_options::plugins): New function.
13059         (General_options::add_plugin): New function.
13060         (General_options::plugins_): New field.
13061         * plugin.cc: New file.
13062         * plugin.h: New file.
13063         * readsyms.cc: Include "plugin.h".
13064         (Read_symbols::do_read_symbols): Check for archive before checking
13065         for ELF file.  Call plugin hooks to claim files.
13066         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13067         from a real object file; force override when processing replacement
13068         files.
13069         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13070         (Symbol::init_base_object): Likewise.
13071         (Symbol::init_base_output_data): Likewise.
13072         (Symbol::init_base_output_segment): Likewise.
13073         (Symbol::init_base_constant): Likewise.
13074         (Symbol::init_base_undefined): Likewise.
13075         (Symbol::output_section): Assert that object is not a plugin.
13076         (Symbol_table::add_from_pluginobj): New function.
13077         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13078         undefined.
13079         (Symbol_table::sized_write_globals): Likewise.
13080         (Symbol_table::add_from_pluginobj): Instantiate template.
13081         * symtab.h (Sized_pluginobj): Declare.
13082         (Symbol::in_real_elf): New function.
13083         (Symbol::set_in_real_elf): New function.
13084         (Symbol::in_real_elf_): New field.
13085         (Symbol_table::add_from_pluginobj): New function.
13086
13087         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13088         (LIBDL): New variable.
13089         (LDADD): Add LIBDL.
13090         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13091         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13092         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13093         (MOSTLYCLEANFILES): Likewise.
13094         * testsuite/Makefile.in: Regenerate.
13095         * testsuite/plugin_test.c: New file.
13096         * testsuite/plugin_test_1.sh: New file.
13097         * testsuite/plugin_test_2.sh: New file.
13098
13099 2008-09-16  Ian Lance Taylor  <iant@google.com>
13100
13101         * target-reloc.h (relocate_section): Check whether a symbol is
13102         defined by the ABI before reporting an undefined symbol error.
13103         * target.h (Target::is_defined_by_abi): Make parameter const.
13104         (Target::do_is_defined_by_abi): Likewise.
13105         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13106         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13107         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13108         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13109         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13110         * testsuite/Makefile.in: Rebuild.
13111
13112         * fileread.cc (make_view): Add casts to avoid warning.
13113
13114 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13115
13116         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13117         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13118
13119 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13120
13121         * options.h (General_options::output_is_executable): New.
13122         (General_options::output_is_pie): New.
13123         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13124         for shared libraries.
13125         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13126
13127 2008-09-11  Chris Demetriou  <cgd@google.com>
13128
13129         * options.h (origin): New -z option.
13130         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13131         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13132         in DT_FLAGS_1.
13133
13134 2008-09-05  Cary Coutant  <ccoutant@google.com>
13135
13136         * fileread.cc (File_read::make_view): Add check for attempt to map
13137         beyond end of file.
13138
13139 2008-09-05  Cary Coutant  <ccoutant@google.com>
13140
13141         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13142         explicit instantiations.
13143
13144 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13145
13146         PR gold/6858
13147         * options.cc (General_options::finalize): Allow undefined symbols
13148         in shlibs if linking -shared.
13149
13150         PR gold/6859
13151         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13152         symbols as not needing a dynsym entry.
13153
13154 2008-08-20  Craig Silverstein  <csilvers@google.com>
13155
13156         * fileread.cc (File_read::open): Do not lock the file unless it
13157         was successfully opened.
13158
13159 2008-08-14  Cary Coutant  <ccoutant@google.com>
13160
13161         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13162         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13163         * testsuite/tls_test.cc (struct int128): 128-bit struct
13164         for testing TLS relocs with non-zero addend.
13165         (v12): New TLS variable.
13166         (t12): New test.
13167         (t_last): Add check for v12.
13168         * testsuite/tls_test.h (t12): New function.
13169         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13170
13171 2008-08-13  Ian Lance Taylor  <iant@google.com>
13172
13173         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13174         set tls_segment_ or relro_segment_.
13175         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13176         when appropriate.
13177         * output.h (Output_section::clear_is_relro): New function.
13178         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13179         sections specially even when output_data_ is empty.
13180         (Output_segment::maximum_alignment): When first section is relro,
13181         only force alignment for PT_LOAD segments.
13182         * script.cc (script_data_segment_align): New function.
13183         (script_data_segment_relro_end): New function.
13184         * script-c.h (script_data_segment_align): Declare.
13185         (script_data_segment_relro_end): Declare.
13186         * script-sections.h (class Script_sections): Declare
13187         data_segment_align and data_segment_relro_end.  Add fields
13188         segment_align_index_ and saw_relro_end_.
13189         * script-sections.cc (class Sections_element): Add set_is_relro
13190         virtual function.  Add new bool* parameter to place_orphan_here.
13191         Add get_output_section virtual function.
13192         (class Output_section_definition): Add set_is_relro.  Add new
13193         bool* parameter to place_orphan_here.  Add get_output_section.
13194         Add is_relro_ field.
13195         (Output_section_definition::Output_section_definition): Initialize
13196         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13197         and is_relro_ fields.
13198         (Output_section_definition::place_orphan_here): Add is_relro
13199         parameter.
13200         (Output_section_definition::set_section_addresses): Set relro for
13201         output section.
13202         (Output_section_definition::alternate_constraint): Likewise.
13203         (class Orphan_output_section): Add new bool* parameter to
13204         place_orphan_here.  Add get_output_section.
13205         (Orphan_output_section::place_orphan_here): Add is_relro
13206         parameter.
13207         (Script_sections::Script_sections): Initialize
13208         data_segment_align_index_ and saw_relro_end_.
13209         (Script_sections::data_segment_align): New function.
13210         (Script_sections::data_segment_relro_end): New function.
13211         (Script_sections::place_orphan): Set or clear is_relro.
13212         (Script_sections::set_section_addresses): Force alignment of first
13213         TLS section.
13214         * yyscript.y (exp): Call script_data_segment_align and
13215         script_data_segment_relro_end.
13216         * testsuite/relro_script_test.t: New file.
13217         * testsuite/relro_test.cc (using_script): Declare.
13218         (t1, t2): Test using_script.
13219         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13220         (relro_script_test_SOURCES): Define.
13221         (relro_script_test_DEPENDENCIES): Define.
13222         (relro_script_test_LDFLAGS): Define.
13223         (relro_script_test_LDADD): Define.
13224         (relro_script_test.so): New target.
13225         * testsuite/Makefile.in: Rebuild.
13226
13227 2008-08-06  Cary Coutant <ccoutant@google.com>
13228
13229         * archive.cc (Archive::total_archives, Archive::total_members)
13230         (Archive::total_members_loaded): New variables.
13231         (Archive::setup): Add parameter.  Add option to preread
13232         archive symbols.
13233         (Archive::read_armap): Add counter.
13234         (Archive::get_file_and_offset): New function.
13235         (Archive::get_elf_object_for_member): New function.
13236         (Archive::read_all_symbols): New function.
13237         (Archive::read_symbols): New function.
13238         (Archive::add_symbols): Add counters.
13239         (Archive::include_all_members): Use armap to find members if it's
13240         already built.
13241         (Archive::include_member): Skip reading symbols if already read.
13242         Factored code into Archive::get_file_and_offset and
13243         Archive::get_elf_object_for_member.  Changed call to
13244         Mapfile::report_include_archive_member.
13245         (Archive::print_stats): New function.
13246         * archive.h: Declare Object and Read_symbols_data classes.
13247         (Archive::Archive): Add initializers for new members.
13248         (Archive::setup): Add parameter.
13249         (Archive::print_stats): New function.
13250         (Archive::total_archives, Archive::total_members)
13251         (Archive::total_members_loaded): New variables.
13252         (Archive::get_file_and_offset): New function.
13253         (Archive::get_elf_object_for_member): New function.
13254         (Archive::read_all_symbols): New function.
13255         (Archive::read_symbols): New function.
13256         (Archive::Archive_member): New class.
13257         (Archive::members_): New member.
13258         (Archive::num_members_): New member.
13259         * main.cc: Include archive.h.
13260         (main): Call Archive::print_stats.
13261         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13262         archive parameter; member_name is now the fully-decorated name.
13263         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13264         * options.h: (General_options): Add --preread-archive-symbols option.
13265         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13266         Archive::setup.
13267
13268 2008-08-04  Ian Lance Taylor  <iant@google.com>
13269
13270         * symtab.h (Symbol::use_plt_offset): New function.
13271         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13272         * powerpc.cc (Relocate::relocate): Likewise.
13273         * sparc.cc (Relocate::relocate): Likewise.
13274         * x86_64.cc (Relocate::relocate): Likewise.
13275         * testsuite/weak_plt.sh: New test.
13276         * testsuite/weak_plt_main.cc: New test.
13277         * testsuite/weak_plt_shared.cc: New test.
13278         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13279         (check_PROGRAMS): Add weak_plt.
13280         (check_DATA): Add weak_plt_shared.so.
13281         (weak_plt_main_pic.o, weak_plt): New targets.
13282         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13283         * testsuite/Makefile.in: Rebuild.
13284
13285         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13286         gcctestdir/ld.
13287         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13288         * testsuite/Makefile.in: Rebuild.
13289
13290 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13291
13292         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13293         * Makefile.in: Regenerate.
13294         * po/POTFILES.in: Regenerate.
13295
13296 2008-07-29  Ian Lance Taylor  <iant@google.com>
13297
13298         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13299         symbols before other symbols.
13300         * testsuite/script_test_2.cc (test_addr): Declare.
13301         (test_addr_alias): Declare.
13302         (main): Check that test_addr and test_addr_alias have the right
13303         values.
13304         * testsuite/script_test_2.t: Define test_addr_alias and
13305         test_addr.
13306
13307 2008-07-24  Ian Lance Taylor  <iant@google.com>
13308
13309         PR 5990
13310         * descriptors.cc: New file.
13311         * descriptors.h: New file.
13312         * gold-threads.h (class Hold_optional_lock): New class.
13313         * fileread.cc: Include "descriptors.h".
13314         (File_read::~File_read): Release descriptor rather than closing
13315         it.
13316         (File_read::open) [file]: Call open_descriptor rather than open.
13317         Set is_descriptor_opened_.
13318         (File_read::open) [memory]: Assert that descriptor is not open.
13319         (File_read::reopen_descriptor): New function.
13320         (File_read::release): Release descriptor.
13321         (File_read::do_read): Make non-const.  Reopen descriptor.
13322         (File_read::read): Make non-const.
13323         (File_read::make_view): Reopen descriptor.
13324         (File_read::do_readv): Likewise.
13325         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13326         Update declarations.
13327         * layout.cc: Include "descriptors.h".
13328         (Layout::create_build_id): Use open_descriptor rather than open.
13329         * output.cc: Include "descriptors.h".
13330         (Output_file::open): Use open_descriptor rather than open.
13331         * archive.cc (Archive::const_iterator): Change Archive to be
13332         non-const.
13333         (Archive::begin, Archive::end): Make non-const.
13334         (Archive::count_members): Likewise.
13335         * archive.h (class Archive): Update declarations.
13336         * object.h (Object::read): Make non-const.
13337         * Makefile.am (CCFILES): Add descriptors.cc.
13338         (HFILES): Add descriptors.h.
13339         * Makefile.in: Rebuild.
13340
13341         PR 6716
13342         * gold.h: Always include <clocale>.  Add Solaris workarounds
13343         following code in binutils/sysdep.h.
13344
13345         PR 6048
13346         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13347         this->eh_frame_hdr_ is NULL before using it.
13348
13349         * dynobj.cc (Versions::Versions): Update comment.
13350
13351         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13352         the base version name.
13353
13354         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13355         array size plus one.
13356         (Stringpool_template::set_string_offsets): Subtract one from key
13357         before using it as an array index.
13358         (Stringpool_template::get_offset_with_length): Likewise.
13359         (Stringpool_template::write_to_buffer): Likewise.
13360         * stringpool.h (Stringpool_template::get_offset_from_key):
13361         Likewise.
13362
13363 2008-07-23  Ian Lance Taylor  <iant@google.com>
13364
13365         PR 6658
13366         * object.h (Merged_symbol_value::value): Do our best to handle a
13367         negative addend.
13368
13369         PR 6647
13370         * script.cc (Version_script_info::get_versions): Don't add empty
13371         version tag to return value.
13372         (Version_script_info::get_symbol_version_helper): Change return
13373         type to bool.  Add pversion parameter.  Change all callers.
13374         (script_register_vers_node): Don't require a non-NULL tag.
13375         * script.h (class Version_script_info): Update declarations.
13376         (Version_script_info::get_symbol_version): Change return type to
13377         bool.  Add version parameter.  Change all callers.
13378         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13379         handling.  Handle an empty version from a version script.
13380         (Symbol_table::define_special_symbol): Likewise.
13381         * testsuite/ver_test_10.script: New file.
13382         * testsuite/ver_test_10.sh: New file.
13383         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13384         (check_DATA): Add ver_test_10.syms.
13385         (ver_test_10.syms, ver_test_10.so): New target.
13386         * testsuite/Makefile.in: Rebuild.
13387
13388 2008-07-23  Simon Baldwin  <simonb@google.com>
13389
13390         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13391         to zero for undefined symbols from dynamic libraries.
13392
13393 2008-07-23  Ian Lance Taylor  <iant@google.com>
13394
13395         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13396         Change all callers.
13397         * symtab.h (class Symbol_table): Update declaration.
13398         * testsuite/ver_test_9.cc: New file.
13399         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13400         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13401         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13402         (ver_test_9.so, ver_test_9.o): New targets.
13403         * testsuite/Makefile.in: Rebuild.
13404
13405 2008-07-22  Ian Lance Taylor  <iant@google.com>
13406
13407         * options.h (class General_options): Define --check-sections.
13408         * layout.cc (Layout::set_segment_offsets): Handle
13409         --check-sections.
13410
13411         * options.h (class General_options): Define -n/--nmagic and
13412         -N/--omagic.
13413         * options.cc (General_options::finalize): For -n/--nmagic or
13414         -N/--omagic, set -static.
13415         * layout.cc (Layout::attach_allocated_section_to_segment): If
13416         -N/--omagic, don't put read-only and read-write sections in
13417         different segments.
13418         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13419         finding a read-only segment.
13420         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13421         don't set the minimum segment alignment to the common page size,
13422         and don't set the file offset to the address modulo the page size.
13423         * script-sections.cc (Script_sections::create_segments): If
13424         -n/--omagic, don't put read-only and read-write sections in
13425         different segments.
13426
13427         * cref.cc: New file.
13428         * cref.h: New file.
13429         * options.h (class General_options): Add --print-symbol-counts.
13430         * main.cc (main): Issue defined symbol report if requested.
13431         * archive.cc (Archive::interpret_header): Make into a const member
13432         function.
13433         (Archive::add_symbols): Call Input_objects::archive_start and
13434         archive_stop.
13435         (Archive::const_iterator): Define new class.
13436         (Archive::begin, Archive::end): New functions.
13437         (Archive::include_all_members): Rewrite to use iterator.
13438         (Archive::count_members): New function.
13439         * archive.h (class Archive): Update declarations.
13440         (Archive::filename): New function.
13441         * object.cc: Include "cref.h".
13442         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13443         (Sized_relobj::do_get_global_symbol_counts): New function.
13444         (Input_objects::add_object): Add object to cross-referencer.
13445         (Input_objects::archive_start): New function.
13446         (Input_objects::archive_stop): New function.
13447         (Input_objects::print_symbol_counts): New function.
13448         * object.h: Declare Cref and Archive.
13449         (Object::get_global_symbol_counts): New function.
13450         (Object::do_get_global_symbol_counts): New pure virtual function.
13451         (class Sized_relobj): Add defined_count_ field.  Update
13452         declarations.
13453         (class Input_objects): Add cref_ field.  Update constructor.
13454         Update declarations.
13455         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13456         defined_count_.
13457         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13458         symbol counts.
13459         (Sized_dynobj::do_get_global_symbol_counts): New function.
13460         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13461         defined_count_.  Update declarations.  Define Symbols typedef.
13462         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13463         parameter.  Change all callers.
13464         (Symbol_table::add_from_dynobj): Add sympointers and defined
13465         parameters.  Change all callers.
13466         * symtab.h (class Symbol_table): Update declarations.
13467         * Makefile.am (CCFILES): Add cref.cc.
13468         (HFILES): Add cref.h.
13469         * Makefile.in: Rebuild.
13470
13471 2008-07-22  Simon Baldwin  <simonb@google.com>
13472
13473         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13474         to zero when writing undefined symbols.
13475
13476 2008-07-22  Ian Lance Taylor  <iant@google.com>
13477
13478         * output.cc (Output_section::add_input_section): Don't try to
13479         merge empty merge sections.
13480
13481 2008-07-21  Craig Silverstein  <csilvers@google.com>
13482
13483         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13484         Include symbol version in error message.
13485
13486 2008-07-20  Chris Demetriou  <cgd@google.com>
13487
13488         * configure.ac (gold_cv_c_random_seed): New configured variable.
13489         (RANDOM_SEED_CFLAGS): New substituted variable.
13490         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13491         * configure: Rebuild.
13492         * Makefile.in: Likewise.
13493         * testsuite/Makefile.in: Likewise.
13494
13495 2008-07-18  Ian Lance Taylor  <iant@google.com>
13496
13497         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13498         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13499         * testsuite/ver_test_main.cc (main): Call t4.
13500         (t4, t4_2a): Define.
13501         * testsuite/ver_test_2.cc (t4_2): Define.
13502         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13503         * testsuite/ver_test_4.cc (t4_2a): Define.
13504         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13505         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13506
13507 2008-07-17  Ian Lance Taylor  <iant@google.com>
13508
13509         * dynobj.cc (Versions::add_def): If we give an error about a
13510         missing version, go ahead and create the version anyhow.
13511
13512 2008-07-10  Ian Lance Taylor  <iant@google.com>
13513
13514         Handle output sections with more than 0x7fffffff bytes.
13515         * object.h (class Relobj): Change map_to_output_ to
13516         output_sections_, and just keep a section pointer.  Change all
13517         uses.  Move comdat group support to Sized_relobj.
13518         (Relobj::is_section_specially_mapped): Remove.
13519         (Relobj::output_section): Remove poff parameter.  Change all
13520         callers.
13521         (Relobj::output_section_offset): New function.
13522         (Relobj::set_section_offset): Rewrite.
13523         (Relobj::map_to_output): Remove.
13524         (Relobj::output_sections): New function.
13525         (Relobj::do_output_section_offset): New pure virtual function.
13526         (Relobj::do_set_section_offset): Likewise.
13527         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13528         group support from Relobj.  Update declarations.
13529         (Sized_relobj::get_output_section_offset): New function.
13530         (Sized_relobj::do_output_section_offset): New function.
13531         (Sized_relobj::do_set_section_offset): New function.
13532         * object.cc (Relobj::output_section_address): Remove.
13533         (Sized_relobj::Sized_relobj): Initialize new fields.
13534         (Sized_relobj::include_section_group): Cast find_kept_object to
13535         Sized_relobj.
13536         (Sized_relobj::include_linkonce_section): Likewise.
13537         (Sized_relobj::do_layout): Use separate arrays for output section
13538         and output offset.
13539         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13540         output_sections.
13541         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13542         output_sections and section_offsets.
13543         (Sized_relobj::write_local_symbols): Likewise.
13544         (map_to_kept_section): Compute output address directly.
13545         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13546         output_sections and section_offsets.
13547         (Sized_relobj::write_sections): Likewise.
13548         (Sized_relobj::relocate_sections): Likewise.
13549         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13550         * output.h (class Output_reloc): Update declarations.  Change
13551         u2_.relobj to Sized_relobj*.
13552         (class Output_data_reloc): Change add functions to use
13553         Sized_relobj*.
13554         * output.cc (Output_reloc::Output_reloc): Change relobj to
13555         Sized_relobj*.
13556         (Output_reloc::local_section_offset): Change return type to
13557         Elf_Addr.  Use get_output_section_offset.
13558         (Output_reloc::get_address): Likewise.
13559         (Output_section::is_input_address_mapped): Don't call
13560         is_section_specially_mapped.
13561         (Output_section::output_offset): Likewise.
13562         (Output_section::output_address): Likewise.
13563         (Output_section::starting_output_address): Likewise.
13564         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13565         parameter to Sized_relobj*.
13566         (Copy_relocs::need_copy_reloc): Likewise.
13567         (Copy_relocs::save): Likewise.
13568         * copy-relocs.h (class Copy_relocs): Update declarations.
13569         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13570         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13571         * target-reloc.h (relocate_for_relocatable): Change
13572         offset_in_output_section type to Elf_Addr.  Change code that uses
13573         it as well.
13574         * layout.cc (Layout::layout): Always set *off.
13575         * mapfile.cc (Mapfile::print_input_section): Use
13576         output_section_offset.
13577         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13578         Sized_relobj*.
13579         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13580         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13581         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13582
13583 2008-07-03  Ian Lance Taylor  <iant@google.com>
13584
13585         * layout.cc (Layout::include_section): Do not discard unrecognized
13586         SHT_STRTAB sections.
13587
13588 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13589
13590         * script.cc (Lex::can_continue_name): Make '?' allowable in
13591         version-script names.
13592         * testsuite/version_script.map: Change glob pattern to use '?'
13593
13594 2008-06-30  Manish Singh  <yosh@gimp.org>
13595
13596         PR 6585
13597         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13598         Correct typo.
13599
13600 2008-06-30  Ian Lance Taylor  <iant@google.com>
13601
13602         PR 6660
13603         PR 6682
13604         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13605         versions]: Don't try to read the value in the contents, since we
13606         don't use it.  Use the template endianness when writing.
13607
13608 2008-06-25  Cary Coutant  <ccoutant@google.com>
13609
13610         * fileread.cc (File_read::make_view): Assert on zero-length view.
13611         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13612         symbol table when there are no symbols to read.
13613
13614 2008-06-23  Craig Silverstein  <csilvers@google.com>
13615
13616         * version.cc (version_string): Bump to 1.7
13617
13618 2008-06-18  Craig Silverstein  <csilvers@google.com>
13619
13620         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13621         constant 0xFFFF to type Valtype.
13622         (Powerpc_relocate_functions::rel16_ha): Likewise.
13623
13624 2008-06-17  Ian Lance Taylor  <iant@google.com>
13625
13626         * output.h (Output_section::Input_section): Initialize p2align_ to
13627         zero for Output_section_data constructors.
13628         (Output_section::Input_section::addralign): If not an input
13629         section, return the alignment of the Output_section_data.
13630         * testsuite/copy_test.cc: New file.
13631         * testsuite/copy_test_1.cc: New file.
13632         * testsuite/copy_test_2.cc: New file.
13633         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13634         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13635         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13636         (copy_test_1_pic.o, copy_test_1.so): New targets.
13637         (copy_test_2_pic.o, copy_test_2.so): New targets.
13638         * testsuite/Makefile.in: Rebuild.
13639
13640         * script-sections.cc (Script_sections::place_orphan): Initialize
13641         local variable exact.
13642
13643 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13644
13645         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13646
13647 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13648             David S. Miller  <davem@davemloft.net>
13649
13650         * powerpc.cc: New file.
13651         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13652         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13653         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13654         * Makefile.in: Rebuild.
13655
13656 2008-06-09  Ian Lance Taylor  <iant@google.com>
13657
13658         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13659         <exception>.
13660         (throwing, orig_terminate): New static variables.
13661         (terminate_handler): New static function.
13662         (t2): Set terminate handler.
13663
13664 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13665
13666         PR 6584
13667         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13668         alignment.
13669
13670 2008-05-30  Cary Coutant  <ccoutant@google.com>
13671
13672         * archive.cc (Archive::include_all_members) Correct to step
13673         over symbol table and extended name table in thin archives.
13674
13675 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13676
13677         PR 6407
13678         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13679         calculation.
13680
13681 2008-05-28  Caleb Howe  <cshowe@google.com>
13682
13683         * reduced_debug_output.cc: New file.
13684         * reduced_debug_output.h: New file.
13685         * options.h (class General_options): Add --strip-debug-non-line.
13686         * options.cc (General_options::finalize): Add strip_debug_non_line
13687         to the strip heirarchy.
13688         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13689         fields.
13690         * layout.cc: Include "reduced_debug_output.h".
13691         (Layout::Layout): Initialize new fields.
13692         (line_only_debug_sections): New static array.
13693         (is_lines_only_debug_sections): New static inline function.
13694         (Layout::include_section): Handle --strip-debug-non-line.
13695         (Layout::make_output_section): If --strip-debug-non-line, build
13696         new output sections for .debug_abbrev and .debug_info.
13697         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13698         gold.  Warn about possible overflow.
13699         (read_signed_LEB_128): Likewise.
13700         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13701         (read_signed_LEB_128): Declare.
13702         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13703         (HFILES): Add reduced_debug_output.h.
13704         * Makefile.in: Rebuild.
13705
13706 2008-05-21  Ian Lance Taylor  <iant@google.com>
13707
13708         * mapfile.cc: New file.
13709         * mapfile.h: New file.
13710         * options.h (class General_options): Add -M/--print-map and -Map.
13711         * options.cc (General_options::finalize): Make -M equivalent to
13712         -Map -.
13713         * main.cc: Include <cstdio> and "mapfile.h".
13714         (main): Open mapfile if requested.
13715         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13716         constructor.  Change caller.
13717         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13718         (queue_middle_tasks): Likewise.
13719         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13720         declarations.
13721         * archive.cc: Include "mapfile.h".
13722         (Archive::add_symbols): Add mapfile parameter.  Change all
13723         callers.  Pass mapfile, symbol, and reason to include_member.
13724         (Archive::include_all_members): Add mapfile parameter.  Change all
13725         callers.
13726         (Archive::include_member): Add mapfile, sym, and why parameters.
13727         Change all callers.  Report inclusion to map file.
13728         * archive.h: Include "fileread.h".
13729         (class Archive): Update declarations.
13730         (Archive::file): New const method.
13731         (class Add_archive_symbols): Add mapfile_ field.  Update
13732         constructor.  Change all callers.
13733         * readsyms.h (class Read_symbols): Likewise.
13734         (class Finish_group): Likewise.
13735         (class Read_script): Likewise.
13736         * common.cc: Include "mapfile.h".
13737         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13738         all callers.
13739         (Symbol_table::do_allocate_commons): Likewise.
13740         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13741         symbol allocation to mapfile.
13742         * common.h (class Allocate_commons_task): Add mapfile_ field.
13743         Update constructor.  Change all callers.
13744         * symtab.h (class Symbol_table): Update declarations.
13745         * layout.cc: Include "mapfile.h".
13746         (Layout_task_runner::run): Print information to mapfile.
13747         (Layout::create_gold_note): Change Output_data_fixed_space to
13748         Output_data_zero_fill.
13749         (Layout::create_build_id): Likewise.
13750         (Layout::print_to_mapfile): New function.
13751         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13752         constructor.  Change caller.
13753         (class Layout): Declare print_to_mapfile.
13754         * output.cc (Output_section::Input_section::print_to_mapfile): New
13755         function.
13756         (Output_section::add_input_section): If producing a map, always
13757         add to input_sections_ list.
13758         (Output_section::do_print_to_mapfile): New function.
13759         (Output_segment::print_sections_to_mapfile): New function.
13760         (Output_segment::print_section_list_to_mapfile): New function.
13761         * output.h: Include "mapfile.h".
13762         (Output_data::print_to_mapfile): New function.
13763         (Output_data::do_print_to_mapfile): New virtual function.
13764         (Output_segment_headers::do_print_to_mapfile): New function.
13765         (Output_file_header::do_print_to_mapfile): New function.
13766         (Output_data_const::do_print_to_mapfile): New function.
13767         (class Output_data_const_buffer): Add map_name_ field.  Update
13768         constructor.  Change all callers.  Add do_print_to_mapfile
13769         function.
13770         (class Output_data_fixed_space): Likewise.
13771         (class Output_data_space): Likewise.
13772         (class Output_data_zero_fill): New class.
13773         (Output_data_strtab::do_print_to_mapfile): New function.
13774         (Output_data_reloc_base::do_print_to_mapfile): New function.
13775         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13776         (Output_data_group::do_print_to_mapfile): New function.
13777         (Output_data_got::do_print_to_mapfile): New function.
13778         (Output_data_dynamic::do_print_to_mapfile): New function.
13779         (Output_symtab_xindex::do_print_to_mapfile): New function.
13780         (class Output_section): Declare do_print_to_mapflie.  Declare
13781         print_to_mapfile in Input_section.
13782         (class Output_segment): Declare new functions.
13783         * object.h (Sized_relobj::symbol_count): New function.
13784         * script-sections.cc
13785         (Output_section_element_dot_assignment::set_section_addresses):
13786         Change Output_data_fixed_space to Output_data_zero_fill.
13787         (Output_data_expression::do_print_to_mapfile): New function.
13788         * script.cc (read_input_script): Add mapfile parameter.  Change
13789         all callers.
13790         * script.h (read_input_script): Update declaration.
13791         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13792         (Eh_frame::do_print_to_mapfile): New function.
13793         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13794         (Output_merge_string::do_print_to_mapfile): New function.
13795         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13796         function.
13797         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13798         function.
13799         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13800         function.
13801         * Makefile.am (CCFILES): Add mapfile.cc.
13802         (HFILES): Add mapfile.h.
13803         * Makefile.in: Rebuild.
13804
13805 2008-05-19  Ian Lance Taylor  <iant@google.com>
13806
13807         * options.h (class General_options): Add -z relro.
13808         * layout.cc (Layout::Layout): Initialize relro_segment_.
13809         (Layout::add_output_section_data): Return the output section.
13810         (Layout::make_output_section): Rcognize relro sections and mark
13811         them appropriately.
13812         (Layout::attach_allocated_section_to_segment): Put relro sections
13813         in a PT_GNU_RELRO segment.
13814         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13815         section as relro.
13816         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13817         PT_TLS segments.
13818         (Layout::linkonce_mapping): Map d.rel.ro.local to
13819         .data.rel.ro.local.
13820         (Layout::output_section_name): Us .data.rel.ro.local for any
13821         section which begins with that.
13822         * layout.h (class Layout): Update add_output_section_data
13823         declaration.  Add relro_segment_ field.
13824         * output.cc (Output_section::Output_section): Initialize is_relro_
13825         and is_relro_local_ fields.
13826         (Output_segment::add_output_section): Group relro sections.
13827         (Output_segment::is_first_section_relro): New function.
13828         (Output_segment::maximum_alignment): If there is a relro section,
13829         align the segment to the common page size.
13830         (Output_segment::set_section_addresses): Track whether we are
13831         looking at relro sections.  If the last section is a relro
13832         section, align to the common page size.
13833         (Output_segment::set_section_list_addresses): Add in_relro
13834         parameter.  Change all callers.  Align to the page size when
13835         moving from relro to non-relro section.
13836         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13837         segment.
13838         * output.h (class Output_section): Add is_relro_ and
13839         is_relro_local_ fields.
13840         (Output_section::is_relro): New function.
13841         (Output_section::set_is_relro): New function.
13842         (Output_section::is_relro_local): New function.
13843         (Output_section::set_is_relro_local): New function.
13844         (class Output_segment): Update declarations.
13845         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13846         * sparc.cc (Target_sparc::got_section): Likewise.
13847         * x86_64.cc (Target_x86_64::got_section): Likewise.
13848         * testsuite/relro_test_main.cc: New file.
13849         * testsuite/relro_test.cc: New file.
13850         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13851         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13852         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13853         (relro_test.so, relro_test_pic.o): New targets.
13854         * testsuite/Makefile.in: Rebuild.
13855
13856 2008-05-16  Ian Lance Taylor  <iant@google.com>
13857
13858         * output.cc (Output_segment::add_output_section): Remove front
13859         parameter.
13860         * output.h (class Output_segment): Remove
13861         add_initial_output_section and overloaded add_output_section.
13862         Update declaration of remaining add_output_section.
13863         * layout.cc (Layout::create_interp): Call add_output_section
13864         rather than add_initial_output_section.
13865         (Layout::finish_dynamic_section): Likewise.
13866
13867         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13868         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13869         know the dynamic type.
13870         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13871         field.  Initialize it in constructor.
13872         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13873         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13874         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13875         reloc.
13876
13877         * output.cc (Output_reloc::get_address): Change return type to
13878         Elf_Addr.
13879         * output.h (class Output_reloc): Update get_address declaration.
13880         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13881         for section addresses.
13882
13883 2008-05-09  Ian Lance Taylor  <iant@google.com>
13884
13885         PR 6493
13886         * gold.cc (gold_nomem): Use return value of write.
13887
13888 2008-05-08  Ian Lance Taylor  <iant@google.com>
13889
13890         * symtab.c (Symbol::init_base_output_data): Add version
13891         parameter.  Change all callers.
13892         (Symbol::init_base_output_segment): Likewise.
13893         (Symbol::init_base_constant): Likewise.
13894         (Symbol::init_base_undefined): Likewise.
13895         (Sized_symbol::init_output_data): Likewise.
13896         (Sized_symbol::init_output_segment): Likewise.
13897         (Sized_symbol::init_constant): Likewise.
13898         (Sized_symbol::init_undefined): Likewise.
13899         (Symbol_table::do_define_in_output_data): If the new symbol has a
13900         version, mark it as the default.
13901         (Symbol_table::do_define_in_output_segment): Likewise.
13902         (Symbol_table::do_define_as_constant): Likewise.
13903         * symtab.h (class Symbol): Update declarations.
13904         (class Sized_symbol): Likewise.
13905         * resolve.cc (Symbol::override_version): New function.
13906         (Symbol::override_base): Call override_version.
13907         (Symbol::override_base_with_special): Likewise.
13908         * testsuite/ver_script_8.script: New file.
13909         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13910         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13911         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13912         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13913
13914 2008-05-06  Ian Lance Taylor  <iant@google.com>
13915
13916         PR 6049
13917         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13918         functions.
13919         (class General_options): Remove existing --undefined, and add
13920         --no-undefined instead.  Add new --undefined as synonym for -u.
13921         * archive.cc (Archive::add_symbols): Check whether symbol was
13922         named with -u.
13923         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13924         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13925         all uses.  Add IS_UNDEFINED.  Update declarations to split
13926         different versions of init_base.  Declare init_base_undefined.
13927         (Symbol::is_defined): Handle IS_UNDEFINED.
13928         (Symbol::is_undefined): Likewise.
13929         (Symbol::is_weak_undefined): Call is_undefined.
13930         (Symbol::is_absolute): Handle IS_CONSTANT.
13931         (class Sized_symbol): Update declarations to split different
13932         versions of init.  Declare init_undefined.
13933         (class Symbol_table): Declare new functions.
13934         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13935         Change all callers.
13936         (Symbol::init_base_output_data): Likewise.
13937         (Symbol::init_base_output_segment): Likewise.
13938         (Symbol::init_base_constant): Likewise.
13939         (Symbol::init_base_undefined): New function.
13940         (Sized_symbol::init_object): Rename from init.  Change all
13941         callers.
13942         (Sized_symbol::init_output_data): Likewise.
13943         (Sized_symbol::init_output_segment): Likewise.
13944         (Sized_symbol::init_constant): Likewise.
13945         (Sized_symbol::init_undefined): New function.
13946         (Symbol_table::add_undefined_symbols_from_command_line): New
13947         function.
13948         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13949         function.
13950         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13951         (Symbol::output_section): Likewise.
13952         (Symbol::set_output_section): Likewise.
13953         (Symbol_table::sized_finalize_symbol): Likewise.
13954         (Symbol_table::sized_write_globals): Likewise.
13955         * resolve.cc (Symbol_table::should_override): Likewise.
13956         (Symbol::override_base_with_special): Likewise.
13957
13958         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13959         symbol, change it to have default visibility.
13960         * testsuite/protected_1.cc: New file.
13961         * testsuite/protected_2.cc: New file.
13962         * testsuite/protected_3.cc: New file.
13963         * testsuite/protected_main_1.cc: New file.
13964         * testsuite/protected_main_2.cc: New file.
13965         * testsuite/protected_main_3.cc: New file.
13966         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13967         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13968         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13969         (protected_1.so): New target.
13970         (protected_1_pic.o, protected_2_pic.o): New targets.
13971         (protected_3_pic.o): New target.
13972         (check_PROGRAMS): Add protected_2.
13973         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13974         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13975         * testsuite/Makefile.in: Rebuild.
13976
13977         * options.h (DEFINE_var): Add set_user_set_##varname__.
13978         (DEFINE_bool_alias): New macro.
13979         (class General_options): Define -Bstatic using DEFINE_bool_alias
13980         rather than DEFINE_special.  Add --undefined as an alias for -z
13981         defs.
13982         * options.cc (General_options::parse_Bstatic): Remove.
13983
13984         * options.h (class General_options): Add --fatal-warnings.
13985         * main.cc (main): Implement --fatal-warnings.
13986         * errors.h (Errors::warning_count): New function.
13987
13988         * options.h (class General_options): Add -Bsymbolic-functions.
13989         * symtab.h (Symbol::is_preemptible): Check for
13990         -Bsymbolic-functions.
13991
13992 2008-05-05  Ian Lance Taylor  <iant@google.com>
13993
13994         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13995         as noVARNAME rather than no-VARNAME.
13996         (class General_options): Add option -z combreloc.
13997         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13998         get_address.
13999         (Output_reloc::sort_before) [SHT_REL]: New function.
14000         (Output_reloc::sort_before) [SHT_RELA]: New function.
14001         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14002         Sort_relocs_comparison.
14003         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14004         parameter.  Change all callers.
14005         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14006         sort_relocs parameter.  Change all callers.
14007         * output.cc (Output_reloc::get_address): New function, broken out
14008         of write_rel.
14009         (Output_reloc::write_rel): Call it.
14010         (Output_reloc::compare): New function.
14011         (Output_data_reloc_base::do_write): Optionally sort relocs.
14012
14013         * configure.ac: If targ_extra_obj is set, link it in.
14014         * configure.tgt: Initialize all variables.
14015         (x86_64*): Set targ_extra_obj and targ_extra_size.
14016         * configure: Rebuild.
14017
14018         * object.cc (Sized_relobj::include_section_group): Adjust section
14019         indexes read from group data.  Build vector to pass to
14020         layout_group.
14021         * layout.cc (Layout::layout_group): Add flags and shndxes
14022         parameters.  Remove contents parameter.  Change caller.  Update
14023         explicit instantiations.
14024         * layout.h (class Layout): Update layout_group declaration.
14025         * output.cc (Output_data_group::Output_data_group): Add flags and
14026         input_shndxes parameters.  Remove contents parameter.  Change
14027         caller.
14028         (Output_data_group::do_write): Change input_sections_ to
14029         input_shndxes_.
14030         * output.h (class Output_data_group): Update constructor
14031         declaration.  Rename input_sections_ to input_shndxes_.
14032         * testsuite/many_sections_test.cc: Add template.
14033
14034 2008-04-30  Cary Coutant  <ccoutant@google.com>
14035
14036         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14037
14038         * layout.cc (Layout::include_section): Refactored check for debug
14039         info section.
14040         (Layout::add_comdat): Add new parameters.  Change type
14041         of signature parameter.  Add object and shndx to signatures table.
14042         (Layout::find_kept_object): New function.
14043         * layout.h: Include <cstring>.
14044         (Layout::is_debug_info_section): New function.
14045         (Layout::add_comdat): Add new parameters.
14046         (Layout::find_kept_object): New function.
14047         (Layout::Kept_section): New struct.
14048         (Layout::Signatures): Change type of map range.
14049         * object.cc (Relobj::output_section_address): New function.
14050         (Sized_relobj::include_section_group): Add new parameters.  Change
14051         calls to Layout::add_comdat.  Change to build table of kept comdat
14052         groups and table mapping discarded sections to kept sections.
14053         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14054         (Sized_relobj::do_layout): Change calls to include_section_group and
14055         include_linkonce_section.
14056         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14057         value to zero when section is discarded.
14058         (Sized_relobj::map_to_kept_section): New function.
14059         * object.h (Relobj::output_section_address): New function.
14060         (Relobj::Comdat_group): New type.
14061         (Relobj::find_comdat_group): New function.
14062         (Relobj::Comdat_group_table): New type.
14063         (Relobj::Kept_comdat_section): New type.
14064         (Relobj::Kept_comdat_section_table): New type.
14065         (Relobj::add_comdat_group): New function.
14066         (Relobj::set_kept_comdat_section): New function.
14067         (Relobj::get_kept_comdat_section): New function.
14068         (Relobj::comdat_groups_): New field.
14069         (Relobj::kept_comdat_sections_): New field.
14070         (Symbol_value::input_value): Update comment.
14071         (Sized_relobj::map_to_kept_section) New function.
14072         (Sized_relobj::include_linkonce_section): Add new parameter.
14073         * target-reloc.h (Comdat_behavior): New type.
14074         (get_comdat_behavior): New function.
14075         (relocate_section): Add code to map a discarded section to the
14076         corresponding kept section when applying a relocation.
14077
14078 2008-04-30  Craig Silverstein  <csilvers@google.com>
14079
14080         * dwarf_reader.cc (next_generation_count): New static var.
14081         (Addr2line_cache_entry): New struct.
14082         (addr2line_cache): New static var.
14083         (Dwarf_line_info::one_addr2line): Added caching.
14084         (Dwarf_line_info::clear_addr2line_cache): New function.
14085         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14086         cache-size parameter.
14087         (Dwarf_line_info::one_addr2line_cache): New function.
14088         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14089         new cache-size argument to one_addr2line(), and clear cache.
14090
14091 2008-04-28  Cary Coutant  <ccoutant@google.com>
14092
14093         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14094         R_386_PC8 relocations.
14095
14096 2008-04-23  Ian Lance Taylor  <iant@google.com>
14097
14098         * object.cc (Sized_relobj::include_section_group): Check for
14099         invalid section group.
14100
14101         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14102         header size.
14103
14104         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14105         than read for file header.
14106         * archive.cc (Archive::include_member): Likewise.
14107
14108 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14109
14110         * aclocal.m4: Regenerate.
14111         * configure: Regenerate.
14112
14113 2008-04-19  Ian Lance Taylor  <iant@google.com>
14114
14115         * version.cc (version_string): Bump to 1.6.
14116
14117         * testsuite/Makefile.am (many_sections_r_test): New target.
14118         (many_sections_r_test_SOURCES): Remove.
14119         (many_sections_r_test_DEPENDENCIES): Remove.
14120         (many_sections_r_test_LDFLAGS): Remove.
14121         (many_sections_r_test_LDADD): Remove.
14122
14123         * object.cc (Sized_relobj::do_add_symbols): Always pass
14124         local_symbol_count_ to add_from_relobj.
14125
14126         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14127         every thousand variables.
14128         * testsuite/Makefile.in: Rebuild.
14129
14130         * object.cc (Xindex::initialize_symtab_xindex): New function.
14131         (Xindex::read_symtab_xindex): New function.
14132         (Xindex::sym_xindex_to_shndx): New function.
14133         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14134         available.
14135         (Sized_relobj::do_initialize_xindex): New function.
14136         (Sized_relobj::do_read_symbols): Adjust section links.
14137         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14138         parameter.  Change all callers.
14139         (Sized_relobj::include_section_group): Adjust section links and
14140         symbol section indexes.
14141         (Sized_relobj::do_layout): Adjust section links.
14142         (Sized_relobj::do_count_local_symbols): Adjust section links and
14143         symbol section indexes.
14144         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14145         ordinary and special symbols.
14146         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14147         dynsym_xindex parameters.  Change all callers.  Adjust section
14148         links.  Use SHN_XINDEX when needed.
14149         (Sized_relobj::get_symbol_location_info): Adjust section links.
14150         Don't get fooled by special symbols.
14151         * object.h (class Xindex): Define.
14152         (class Object): Add xindex_ parameter.  Declare virtual functoin
14153         do_initialize_xindex.
14154         (Object::adjust_sym_shndx): New function.
14155         (Object::set_xindex): New protected function.
14156         (class Symbol_value): Add is_ordinary_shndx_ field.
14157         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14158         (Symbol_value::value): Assert ordinary section.
14159         (Symbol_value::initialize_input_to_output_map): Likewise.
14160         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14161         Change all callers.
14162         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14163         all callers.
14164         (class Sized_relobj): Update declarations.
14165         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14166         parameter.  Change all callers.
14167         (Sized_relobj::adjust_shndx): New function.
14168         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14169         field.
14170         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14171         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14172         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14173         (Sized_dynobj::read_dynsym_section): Adjust section links.
14174         (Sized_dynobj::read_dynamic): Likewise.
14175         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14176         section links.
14177         (Sized_dynobj::do_initialize_xindex): New function.
14178         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14179         do_initialize_xindex.
14180         (Sized_dynobj::adjust_shndx): New function.
14181         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14182         dynsym_xindex_ fields.
14183         (Layout::finalize): Add a call to set_section_indexes before
14184         creating the symtab sections.
14185         (Layout::set_section_indexes): Don't do anything if the section
14186         already has a section index.
14187         (Layout::create_symtab_sections): Add shnum parameter.  Change
14188         caller.  Create .symtab_shndx section if needed.
14189         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14190         caller.
14191         (Layout::allocated_output_section_count): New function.
14192         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14193         needed.
14194         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14195         fields.  Update declarations.
14196         (Layout::symtab_xindex): New function.
14197         (Layout::dynsym_xindex): New function.
14198         (class Write_symbols_task): Add layout_ field.
14199         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14200         Change caller.
14201         * output.cc (Output_section_headers::Output_section_headers): Add
14202         shstrtab_section parameter.  Change all callers.
14203         (Output_section_headers::do_sized_write): Store overflow values
14204         for section count and section string table section index in
14205         section header zero.
14206         (Output_file_header::do_sized_write): Check for overflow of
14207         section count and section string table section index.
14208         (Output_symtab_xindex::do_write): New function.
14209         (Output_symtab_xindex::endian_do_write): New function.
14210         * output.h (class Output_section_headers): Add shstrtab_section_.
14211         Update declarations.
14212         (class Output_symtab_xindex): Define.
14213         (Output_section::has_out_shndx): New function.
14214         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14215         field.
14216         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14217         Change all callers.
14218         (Sized_symbol::init): Likewise.
14219         (Symbol::output_section): Check for ordinary symbol.
14220         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14221         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14222         callers.
14223         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14224         Change all callers.  Simplify handling of symbols from sections
14225         not included in the link.
14226         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14227         distinction.
14228         (Weak_alias_sorter::operator()): Assert that symbols are
14229         ordinary.
14230         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14231         distinction.
14232         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14233         parameters.  Change all callers.
14234         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14235         symbol distinction.  Use SHN_XINDEX when needed.
14236         (Symbol_table::write_section_symbol): Add symtab_xindex
14237         parameter.  Change all callers.
14238         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14239         SHN_XINDEX when needed.
14240         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14241         declarations.
14242         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14243         (Symbol::is_defined): Check is_ordinary.
14244         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14245         (Symbol::is_absolute, Symbol::is_common): Likewise.
14246         (class Sized_symbol): Update declarations.
14247         (class Symbol_table): Update declarations.
14248         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14249         parameters.  Change all callers.
14250         (Sized_symbol::override): Likewise.
14251         (Symbol_table::override): Likewise.
14252         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14253         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14254         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14255         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14256         to be in an ordinary section.
14257         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14258         object and is_ordinary parameters.  Change all callers.
14259         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14260         Change all callers.  Don't add undefined or non-ordinary symbols
14261         to reloc_map_.
14262         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14263         Change all callers.
14264         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14265         declarations.
14266         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14267         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14268         (Sized_relobj::relocate_sections): Likewise.
14269         * target-reloc.h (scan_relocs): Adjust section symbol index.
14270         (scan_relocatable_relocs): Likewise.
14271         * i386.cc (Scan::local): Check for ordinary symbols.
14272         * sparc.cc (Scan::local): Likewise.
14273         * x86_64.cc (Scan::local): Likewise.
14274         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14275         to symbol_section_and_value.
14276         * testsuite/many_sections_test.cc: New file.
14277         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14278         (check_PROGRAMS): Add many_sections_test.
14279         (many_sections_test_SOURCES): Define.
14280         (many_sections_test_DEPENDENCIES): Define.
14281         (many_sections_test_LDFLAGS): Define.
14282         (BUILT_SOURCES): Add many_sections_define.h.
14283         (many_sections_define.h): New target.
14284         (BUILT_SOURCES): Add many_sections_check.h.
14285         (many_sections_check.h): New target.
14286         (check_PROGRAMS): Add many_sections_r_test.
14287         (many_sections_r_test_SOURCES): Define.
14288         (many_sections_r_test_DEPENDENCIES): Define.
14289         (many_sections_r_test_LDFLAGS): Define.
14290         (many_sections_r_test_LDADD): Define.
14291         (many_sections_r_test.o): New target.
14292         * testsuite/Makefile.in: Rebuild.
14293
14294 2008-04-17  Cary Coutant  <ccoutant@google.com>
14295
14296         * errors.cc (Errors::info): New function.
14297         (gold_info): New function.
14298         * errors.h (Errors::info): New function.
14299         * gold.h (gold_info): New function.
14300         * object.cc (Input_objects::add_object): Print trace output.
14301         * options.cc (options::parse_set): New function.
14302         (General_options::parse_wrap): Deleted.
14303         (General_options::General_options): Deleted initializer.
14304         * options.h (options::String_set): New typedef.
14305         (options::parse_set): New function.
14306         (DEFINE_set): New macro.
14307         (General_options::wrap): Changed to use DEFINE_set. Changed
14308         callers of any_wrap_symbols and is_wrap_symbol.
14309         (General_options::trace, General_options::trace_symbol):
14310         New options.
14311         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14312         (General_options::wrap_symbols_): Deleted.
14313         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14314
14315 2008-04-17  David S. Miller  <davem@davemloft.net>
14316
14317         * options.cc (General_options::parse_V): New function.
14318         * options.h: Add entries for -V and -Qy.
14319
14320 2008-04-17  Ian Lance Taylor  <iant@google.com>
14321
14322         * common.cc (Symbol_table::allocate_commons): Remove options
14323         parameter.  Change caller.
14324         (Symbol_table::do_allocate_commons): Remove options parameter.
14325         Change caller.  Just call do_allocate_commons_list twice.
14326         (Symbol_table::do_allocate_commons_list): New function, broken out
14327         of do_allocate_commons.
14328         * common.h (class Allocate_commons_task): Remove options_ field.
14329         Update constructor.
14330         * symtab.cc (Symbol_table::Symbol_table): Initialize
14331         tls_commons_.
14332         (Symbol_table::add_from_object): Put TLS common symbols on
14333         tls_commons_ list.
14334         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14335         which are IN_OUTPUT_DATA.
14336         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14337         allocate_commons and do_allocate_commons declarations.  Declare
14338         do_allocate_commons_list.
14339         * gold.cc (queue_middle_tasks): Update creation of
14340         Allocate_commons_task to not pass options.
14341         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14342         (TLS_TEST_C_FLAGS): New variable.
14343         (tls_test_c_pic.o): New target.
14344         (tls_test_shared.so): Link in tls_test_c_pic.o.
14345         (tls_test_c_pic_ie.o): New target.
14346         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14347         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14348         (tls_test_c.o): New target.
14349         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14350         (tls_pic_test_LDADD): Likewise.
14351         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14352         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14353         (tls_test_c_gnu2.o): New target.
14354         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14355         tls_test_c_gnu2.o.
14356         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14357         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14358         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14359         * testsuite/tls_test.cc: Include "config.h".
14360         (t_last): Call t11_last.
14361         * testsuite/tls_test.h (t11, t11_last): Declare.
14362         * testsuite/tls_test_c.c: New file.
14363         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14364         * configure.ac: Check for OpenMP support.
14365         * configure, config.in, Makefile.in: Rebuild.
14366         * testsuite/Makefile.in: Rebuild.
14367
14368 2008-04-16  Cary Coutant  <ccoutant@google.com>
14369
14370         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14371         (Target_i386::tls_base_symbol_defined_): New field.
14372         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14373         (Target_i386::Scan::global): Likewise.
14374         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14375         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14376         (Target_x86_64::tls_base_symbol_defined_): New field.
14377         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14378         (Target_x86_64::Scan::global): Likewise.
14379
14380 2008-04-16  Cary Coutant  <ccoutant@google.com>
14381
14382         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14383         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14384         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14385         building shared libraries.
14386         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14387         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14388         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14389         * testsuite/Makefile.in: Rebuild.
14390         * testsuite/weak_undef.h: New file.
14391         * testsuite/weak_undef_file1.cc: Add extra test cases.
14392         * testsuite/weak_undef_file2.cc: Likewise.
14393         * testsuite/weak_undef_test.cc: Likewise.
14394
14395 2008-04-16  David S. Miller  <davem@davemloft.net>
14396
14397         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14398         Add issued_non_pic_error_ field.  Declare check_non_pic.
14399         (Target_sparc::Scan::check_non_pic): New function.
14400         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14401         (Target_sparc::Scan::global): Likewise.
14402
14403         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14404         * configure: Rebuild.
14405
14406         * options.h (DEFINE_enable): New macro.
14407         (new_dtags): New enable option.
14408         (initfirst, interpose, loadfltr, nodefaultlib,
14409         nodelete, nodlopen, nodump): New -z options.
14410         * layout.cc (Layout:finish_dynamic_section): If new
14411         dtags enabled, emit DT_RUNPATH.  Also, emit a
14412         DT_FLAGS_1 containing any specified -z flags.
14413
14414 2008-04-16  Ian Lance Taylor  <iant@google.com>
14415
14416         * copy-relocs.cc: New file.
14417         * copy-relocs.h: New file.
14418         * reloc.cc: Remove Copy_relocs code.
14419         * reloc.h: Likewise.
14420         * reloc-types.h (struct Reloc_types) [both versions]: Add
14421         get_reloc_addend_noerror.
14422         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14423         variants of add_global which take an addend which must be zero.
14424         * i386.cc: Include "copy-relocs.h".
14425         (class Target_i386): Change type of copy_relocs_ to variable,
14426         update initializer.
14427         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14428         Change all callers.
14429         (Target_i386::do_finalize_sections): Change handling of
14430         copy_relocs_.
14431         * sparc.cc: Include "copy-relocs.h".
14432         (class Target_sparc): Change type of copy_relocs_ to variable,
14433         update initializer.
14434         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14435         Change all callers.
14436         (Target_sparc::do_finalize_sections): Change handling of
14437         copy_relocs_.
14438         * x86_64.cc: Include "copy-relocs.h".
14439         (class Target_x86_64): Change type of copy_relocs_ to variable,
14440         update initializer.
14441         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14442         class.  Change all callers.
14443         (Target_x86_64::do_finalize_sections): Change handling of
14444         copy_relocs_.
14445         * Makefile.am (CCFILES): Add copy-relocs.cc.
14446         (HFILES): Add copy-relocs.h.
14447
14448         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14449
14450         * testsuite/script_test_4.sh: Permit leading zeroes.
14451
14452 2008-04-15  Ian Lance Taylor  <iant@google.com>
14453
14454         * script-sections.cc (Script_sections::create_segments): Use
14455         header_size_adjustment even when there is enough room for the
14456         headers.
14457         * testsuite/script_test_4.sh: New file.
14458         * testsuite/script_test_4.t: New file.
14459         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14460         (check_DATA): Add script_test_4.stdout.
14461         (MOSTLYCLEANFILES): Likewise.
14462         (script_test_4): New target.
14463         (script_test_4.stdout): New target.
14464         * testsuite/Makefile.in: Rebuild.
14465
14466         * sparc.cc: Add definitions for Output_data_plt_sparc class
14467         constants.
14468
14469 2008-04-14  David S. Miller  <davem@davemloft.net>
14470
14471         * sparc.cc: New file.
14472         * Makefile.am (TARGETSOURCES): Add sparc.cc
14473         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14474         * configure.tgt: Document targ_extra_size and
14475         targ_extra_big_endian.  Add entries for sparc-* and
14476         sparc64-*.
14477         * configure.ac: Handle targ_extra_size and
14478         targ_extra_big_endian.
14479         * Makefile.in: Rebuild.
14480         * configure: Likewise.
14481         * po/POTFILES.in: Likewise.
14482         * po/gold.pot: Likewise.
14483
14484 2008-04-14  Ian Lance Taylor  <iant@google.com>
14485
14486         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14487         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14488         in the name/type/flags to section mapping.  Don't call
14489         allocate_output_section.
14490         (Layout::choose_output_section): Change parameter from adjust_name
14491         to is_input_section.  Don't permit input sections after sections
14492         are attached to segments.  Don't call allocate_output_section.
14493         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14494         not write_enable_output_section.
14495         (Layout::make_output_section): Don't push to
14496         unattached_section_list_ nor call attach_to_segment.  Call
14497         attach_section_to_segment if sections are attached.
14498         (Layout::attach_sections_to_segments): New function.
14499         (Layout::attach_section_to_segment): New function.
14500         (Layout::attach_allocated_section_to_segment): Rename from
14501         attach_to_segment.  Remove flags parameter.
14502         (Layout::allocate_output_section): Remove function.
14503         (Layout::write_enable_output_section): Remove function.
14504         * layout.h (class Layout): Update for above changes.  Add new
14505         field sections_are_attached_.
14506         * output.h (Output_section::update_flags_for_input_section): New
14507         function.
14508         * output.cc (Output_section::add_input_section): Call
14509         update_flags_for_input_section.
14510         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14511
14512 2008-04-11  Cary Coutant  <ccoutant@google.com>
14513
14514         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14515         thought unnecessary.
14516         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14517
14518 2008-04-11  Ian Lance Taylor  <iant@google.com>
14519
14520         * output.h (class Output_section_data): Remove inline definition
14521         of set_addralign.
14522         * output.cc (Output_section_data::set_addralign): New function.
14523
14524 2008-04-11  Cary Coutant  <ccoutant@google.com>
14525
14526         Add support for TLS descriptors for i386 and x86_64.
14527         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14528         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14529         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14530         GOT_TYPE_TLS_DESC.
14531         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14532         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14533         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14534         relocations.
14535         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14536         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14537         Fix problem with initial-exec relocations.
14538         (Target_i386::Relocate::relocate_tls): Likewise.
14539         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14540         relaxation.
14541         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14542         support for section-plus-offset dynamic table entries.
14543         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14544         (Output_data_dynamic::Dynamic_entry): Add support for
14545         section-plus-offset dynamic table entries.
14546         (Output_data_dynamic::Classification): Likewise.
14547         (Output_data_dynamic::classification_): Renamed offset_.
14548         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14549         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14550         (Target_x86_64::make_plt_section): New function.
14551         (Target_x86_64::reserve_tlsdesc_entries): New function.
14552         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14553         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14554         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14555         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14556         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14557         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14558         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14559         add extra PLT entry for TLS descriptors.
14560         (Output_data_plt_x86_64::got_): New field.
14561         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14562         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14563         fields.
14564         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14565         descriptors.
14566         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14567         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14568         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14569         R_386_TLS_DESC_CALL relocations.
14570         (Target_x86_64::Scan::global): Likewise.
14571         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14572         for TLS descriptors.
14573         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14574         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14575         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14576         GD-to-IE relaxation.
14577         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14578         and TLS_DESCRIPTORS.
14579         * Makefile.in: Rebuild.
14580         * configure: Rebuild.
14581         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14582         (tls_test_shared2.so): New target.
14583         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14584         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14585         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14586         (tls_shared_gd_to_ie_test_LDADD): New variable.
14587         (tls_shared_gnu2_gd_to_ie_test): New target.
14588         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14589         New targets.
14590         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14591         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14592         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14593         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14594         (tls_shared_gnu2_test): New target.
14595         (tls_test_gnu2_shared.so): New target.
14596         (tls_shared_gnu2_test_SOURCES): New variable.
14597         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14598         (tls_shared_gnu2_test_LDFLAGS): New variable.
14599         (tls_shared_gnu2_test_LDADD): New variable.
14600         * testsuite/Makefile.in: Rebuild.
14601         * testsuite/Makefile.
14602
14603 2008-04-11  Ian Lance Taylor  <iant@google.com>
14604
14605         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14606         justsyms.t.
14607         * testsuite/Makefile.in: Rebuild.
14608
14609         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14610         long.
14611         * testsuite/script_test_2.cc (main): Adjust test.
14612
14613 2008-04-11  David S. Miller  <davem@davemloft.net>
14614             Ian Lance Taylor  <iant@google.com>
14615
14616         * options.h (General_options): Add entries for '-Y' and
14617         '-relax'.
14618         * options.cc (General_options:finalize): If -Y was used, add those
14619         entries to the library path instead of the default "/lib" and
14620         "/usr/lib".
14621
14622 2008-04-11  David S. Miller  <davem@davemloft.net>
14623
14624         * testsuite/justsyms.t: Start at 0x100.
14625         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14626         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14627         long.
14628         * testsuite/script_test_2.cc: Adjust string and section length
14629         checks.
14630
14631 2008-04-09  Ian Lance Taylor  <iant@google.com>
14632
14633         PR gold/5996
14634         * script-sections.cc (Sections_element::allocate_to_segment): Add
14635         orphan parameter.
14636         (Output_section_definition::allocate_to_segment): Likewise.
14637         (Orphan_output_section::allocate_to_segment): Likewise.
14638         (Script_sections::attach_sections_using_phdrs_clause): Don't
14639         propagate non-PT_LOAD segments to orphan sections.
14640         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14641         readelf rather than objdump.
14642         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14643         .interp section and PT_INTERP segment are the same size.
14644         * testsuite/Makefile.in: Rebuild.
14645
14646         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14647         aliases for symbols defined in the same object.
14648         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14649         (weak_alias_test_SOURCES): New variable.
14650         (weak_alias_test_DEPENDENCIES): New variable.
14651         (weak_alias_test_LDFLAGS): New variable.
14652         (weak_alias_test_LDADD): New variable.
14653         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14654         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14655         (weak_alias_test_3.o): New target.
14656         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14657         * testsuite/weak_alias_test_main.cc: New file.
14658         * testsuite/weak_alias_test_1.cc: New file.
14659         * testsuite/weak_alias_test_2.cc: New file.
14660         * testsuite/weak_alias_test_3.cc: New file.
14661
14662 2008-04-08  Ian Lance Taylor  <iant@google.com>
14663
14664         * options.h (class General_options): Add --noinhibit-exec option.
14665         * main.cc (main): Check --noinhibit-exec.
14666
14667         * options.h (class General_options): Define --wrap as a special
14668         option.  Add wrap_symbols_ field.
14669         (General_options::any_wrap_symbols): New function.
14670         (General_options::is_wrap_symbol): New function.
14671         * options.cc (General_options::parse_wrap): New function.
14672         (General_options::General_options): Initialize wrap_symbols_.
14673         * symtab.cc (Symbol_table::wrap_symbol): New function.
14674         (Symbol_table::add_from_object): Handle --wrap.
14675         * symtab.h (class Symbol_table): Declare wrap_symbol.
14676         * target.h (Target::wrap_char): New function.
14677         (Target::Target_info): Add wrap_char field.
14678         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14679         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14680         * testsuite/testfile.cc (Target_test::test_target_info):
14681         Likewise.
14682
14683         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14684         there is one.
14685
14686         * layout.h (class Layout): Add added_eh_frame_data_ field.
14687         * layout.cc (Layout::Layout): Initialize new field.
14688         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14689         output section until we find a section we merged successfully.
14690         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14691         that the size be non-zero.
14692
14693         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14694         qualifier.
14695
14696 2008-04-08  Craig Silverstein  <csilvers@google.com>
14697
14698         * configure.ac: Export new conditional variable HAVE_ZLIB.
14699         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14700         on HAVE_ZLIB.
14701         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14702         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14703
14704 2008-04-07  Ian Lance Taylor  <iant@google.com>
14705
14706         * version.cc (version_string): Set to "1.5".
14707
14708         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14709         Add issued_non_pic_error_ field.  Declare check_non_pic.
14710         (Target_x86_64::Scan::check_non_pic): New function.
14711         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14712         (Target_x86_64::Scan::global): Likewise.
14713
14714         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14715         addend parameter.  Change caller.  Handle merge sections.
14716         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14717         Address to Addend.  Don't add in the result of
14718         local_section_offset, pass down the addend and use the returned
14719         value.
14720         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14721         Update declarations of local_section_offset and symbol_value.
14722         * testsuite/two_file_test_1.cc (t18): New function.
14723         * testsuite/two_file_test_2.cc (f18): New function.
14724         * testsuite/two_file_test_main.cc (main): Call t18.
14725         * testsuite/two_file_test.h (t18, f18): Declare.
14726
14727         * configure.ac: Don't test for objdump, c++filt, or readelf.
14728         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14729         conditionals.
14730         (TEST_READELF): New variable.
14731         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14732         (check_PROGRAMS): Add two_file_strip_test.
14733         (two_file_strip_test): New target.
14734         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14735         (two_file_same_shared_strip_test_SOURCES): New variable.
14736         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14737         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14738         (two_file_same_shared_strip_test_LDADD): New variable.
14739         (two_file_shared_strip.so): New target.
14740         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14741         (ver_test_5.syms, ver_test_7.syms): Likewise.
14742         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14743         (strip_test_3.stdout): Use TEST_OBJDUMP.
14744         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14745
14746 2008-04-04  Cary Coutant  <ccoutant@google.com>
14747
14748         * symtab.h (Symbol::is_weak_undefined): New function.
14749         (Symbol::is_strong_undefined): New function.
14750         (Symbol::is_absolute): New function.
14751         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14752         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14753         absolute symbols.
14754         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14755         (weak_undef_test): New target.
14756         * testsuite/Makefile.in: Rebuild.
14757         * testsuite/weak_undef_file1.cc: New file.
14758         * testsuite/weak_undef_file2.cc: New file.
14759         * testsuite/weak_undef_test.cc: New file.
14760
14761 2008-04-03  Craig Silverstein  <csilvers@google.com>
14762
14763         * compressed_output.h (class Output_compressed_section): Use
14764         unsigned buffer.
14765         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14766         add zlib header.
14767         (zlib_compressed_suffix): Removed.
14768         (Output_compressed_section::set_final_data_size): Use unsigned
14769         buffers.
14770         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14771         Fix linker invocation.
14772         (flagstest_o_specialfile_and_compress_debug_sections):
14773         Likewise.
14774         * testsuite/Makefile.in: Regenerated.
14775
14776 2008-04-02  David S. Miller  <davem@davemloft.net>
14777
14778         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14779         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14780
14781 2008-04-02  Craig Silverstein  <csilvers@google.com>
14782
14783         * TODO: New file.
14784
14785 2008-04-02  Ian Lance Taylor  <iant@google.com>
14786
14787         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14788         parameters.  Update for new key type to views_.  Change all
14789         callers.
14790         (File_read::read): Adjust for byteshift in returned view.
14791         (File_read::add_view): New function, broken out of
14792         find_and_make_view.
14793         (File_read::make_view): New function, broken out of
14794         find_and_make_view.
14795         (File_read::find_or_make_view): Add offset and aligned
14796         parameters.  Rewrite accordingly.  Change all callers.
14797         (File_read::get_view): Add offset and aligned parameters.  Adjust
14798         for byteshift in return value.
14799         (File_read::get_lasting_view): Likewise.
14800         * fileread.h (class File_read): Update declarations.
14801         (class File_read::View): Add byteshift_ field.  Add byteshift to
14802         constructor.  Add byteshift method.
14803         * archive.h (Archive::clear_uncached_views): New function.
14804         (Archive::get_view): Add aligned parameter.  Change all callers.
14805         * object.h (Object::get_view): Add aligned parameter.  Change all
14806         callers.
14807         (Object::get_lasting_view): Likewise.
14808
14809         * fileread.cc (File_read::release): Don't call clear_views if
14810         there are multiple objects.
14811         * fileread.h (File_read::clear_uncached_views): New function.
14812         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14813         on the archive.
14814
14815 2008-03-31  Cary Coutant  <ccoutant@google.com>
14816
14817         Add thin archive support.
14818         * archive.cc (Archive::armagt): New const.
14819         (Archive::setup): Remove task parameter and calls to unlock.
14820         (Archive::unlock_nested_archives): New function.
14821         (Archive::read_header): Add nested_off parameter. Change
14822         all callers.
14823         (Archive::interpret_header): Likewise.
14824         (Archive::include_all_members): Change to handle thin
14825         archives.
14826         (Archive::include_member): Likewise.
14827         * archive.h (Archive::Archive): Add new parameters and
14828         initializers.
14829         (Archive::armagt): New const.
14830         (Archive::setup): Remove task parameter.
14831         (Archive::unlock_nested_archives): New function.
14832         (Archive::read_header): Add nested_off parameter.
14833         (Archive::interpret_header): Likewise.
14834         (Archive::Nested_archive_table): New typedef.
14835         (Archive::is_thin_archive_): New field.
14836         (Archive::nested_archives_): New field.
14837         (Archive::options_): New field.
14838         (Archive::dirpath_): New field.
14839         (Archive::task_): New field.
14840         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14841         for thin archives.  Pass additional parameters to
14842         Archive::Archive.  Unlock the archive file after calling
14843         Archive::setup.
14844
14845 2008-03-29  Ian Lance Taylor  <iant@google.com>
14846
14847         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14848         version symbol to be local.
14849         * testsuite/ver_test_4.sh: New file.
14850         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14851         (check_DATA): Add ver_test_4.syms.
14852         (ver_test_4.syms): New target.
14853         * testsuite/Makefile.in: Rebuild.
14854
14855         * output.cc
14856         (Output_section::Input_section_sort_entry::has_priority): New
14857         function.
14858         (Output_section::Input_section_sort_entry::match_file_name): New
14859         function.
14860         (Output_section::Input_section_sort_entry::match_section_name):
14861         Remove.
14862         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14863         Remove.
14864         (Output_section::Input_section_sort_entry::match_section_file):
14865         Remove.
14866         (Output_section::Input_section_sort_compare::operator()): Rewrite
14867         using new Input_section_sort_entry functions.  Sort crtbegin and
14868         crtend first.  Sort sections with no priority before sections with
14869         a priority.
14870         * testsuite/initpri1.c (d3): Check j != 4.
14871         (cd5): New constructor/destructor function.
14872         (main): Check j != 2.
14873
14874         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14875         new symbol when resolving, don't call set_is_default.
14876         * testsuite/ver_test_7.cc: New file.
14877         * testsuite/ver_test_7.sh: New file.
14878         * testsuite/Makefile.am (ver_test_7.so): New target.
14879         (ver_test_7.o): New target.
14880         (check_SCRIPTS): Add ver_test_7.sh.
14881         (check_DATA): Add ver_test_7.syms.
14882         (ver_test_7.syms): New target.
14883
14884 2008-03-28  Ian Lance Taylor  <iant@google.com>
14885
14886         * layout.cc (Layout::layout): If we see an input section with a
14887         name that needs sorting, set the must_sort flag for the output
14888         section.
14889         (Layout::make_output_section): If the name of the output section
14890         indicates that it might require sorting, set the may_sort flag.
14891         * output.h (Output_section::may_sort_attached_input_sections): New
14892         function.
14893         (Output_section::set_may_sort_attached_input_sections): New
14894         function.
14895         (Output_section::must_sort_attached_input_sections): New
14896         function.
14897         (Output_section::set_must_sort_attached_input_sections): New
14898         function.
14899         (class Output_section): Declare Input_section_sort_entry.  Define
14900         Input_section_sort_compare.  Declare
14901         sort_attached_input_sections.  Add new fields:
14902         may_sort_attached_input_sections_,
14903         must_sort_attached_input_sections_,
14904         attached_input_sections_are_sorted_.
14905         * output.cc (Output_section::Output_section): Initialize new
14906         fields.
14907         (Output_section::add_input_section): Add an entry to
14908         input_sections_ if may_sort or must_sort are true.
14909         (Output_section::set_final_data_size): Call
14910         sort_attached_input_sections if necessary.
14911         (Output_section::Input_section_sort_entry): Define new class.
14912         (Output_section::Input_section_sort_compare::operator()): New
14913         function.
14914         (Output_section::sort_attached_input_sections): New function.
14915         * configure.ac: Check whether the compiler supports constructor
14916         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14917         * testsuite/initpri1.c: New file.
14918         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14919         CONSTRUCTOR_PRIORITY.
14920         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14921         (initpri1_LDFLAGS): New variable.
14922         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14923
14924 2008-03-27  Ian Lance Taylor  <iant@google.com>
14925
14926         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14927         * testsuite/common_test_1.c: New file.
14928         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14929         (common_test_1_SOURCES): New variable.
14930         (common_test_1_DEPENDENCIES): New variable.
14931         (common_test_1_LDFLAGS): New variable.
14932
14933         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14934         and commons_ correctly when NAME/VERSION does not override
14935         NAME/NULL.
14936         * testsuite/ver_test_6.c: New file.
14937         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14938         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14939         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14940
14941 2008-03-26  Ian Lance Taylor  <iant@google.com>
14942
14943         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14944         of an undefined symbol from a version script.
14945         * testsuite/Makefile.am (ver_test_5.so): New target.
14946         (ver_test_5.o): New target.
14947         (check_SCRIPTS): Add ver_test_5.sh.
14948         (check_DATA): Add ver_test_5.syms.
14949         (ver_test_5.syms): New target.
14950         * testsuite/ver_test_5.cc: New file.
14951         * testsuite/ver_test_5.script: New file.
14952         * testsuite/ver_test_5.sh: New file.
14953         * Makefile.in, testsuite/Makefile.in: Rebuild.
14954
14955         PR gold/5986
14956         Fix problems building gold with gcc 4.3.0.
14957         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14958         (gold_error_at_location, gold_warning_at_location): Use it.
14959         * configure.ac: Check whether we can compile and use a template
14960         function with a printf attribute.
14961         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14962         when jumping over bytes.
14963         * object.cc: Instantiate Object::read_section_data.
14964         * debug.h: Include <cstring>
14965         * dwarf_reader.cc: Include <algorithm>
14966         * main.cc: Include <cstring>.
14967         * options.cc: Include <cstring>.
14968         * output.cc: Include <cstring>.
14969         * script.cc: Include <cstring>.
14970         * script.h: Include <string>.
14971         * symtab.cc: Include <cstring> and <algorithm>.
14972         * target-select.cc: Include <cstring>.
14973         * version.cc: Include <string>.
14974         * testsuite/testmain.cc: Include <cstdlib>.
14975         * configure, config.in: Rebuild.
14976
14977 2008-03-25  Ian Lance Taylor  <iant@google.com>
14978
14979         * options.cc: Include "../bfd/bfdver.h".
14980         (options::help): Print bug reporting address.
14981
14982         * version.cc (print_version): Adjust output for current value of
14983         BFD_VERSION_STRING.
14984
14985         * NEWS: New file.
14986
14987         * options.cc (options::help): Print list of supported targets.
14988         * target-select.h: Include <vector>.
14989         (class Target_selector): Make machine_, size_, and is_big_endian_
14990         fields const.  Add bfd_name_ and instantiated_target_ fields.
14991         (Target_selector::Target_selector): Add bfd_name parameter.
14992         (Target_selector::recognize): Make non-virtual, call
14993         do_recognize.
14994         (Target_selector::recognize_by_name): Make non-virtual, call
14995         do_recognize_by_name.
14996         (Target_selector::supported_names): New function.
14997         (Target_selector::bfd_name): New function.
14998         (Target_selector::do_instantiate_target): New pure virtual
14999         function.
15000         (Target_selector::do_recognize): New virtual function.
15001         (Target_selector::do_recognize_by_name): New virtual function.
15002         (Target_selector::instantiate_target): New private function.
15003         (supported_target_names): Declare.
15004         * target-select.cc (Target_selector::Target_selector): Update for
15005         new parameter and fields.
15006         (select_target_by_name): Check that the name matches before
15007         calling recognize_by_name.
15008         (supported_target_names): New function.
15009         * i386.cc (class Target_selector_i386): Update Target_selector
15010         constructor call.  Remove recognize and recognize_by_name.  Add
15011         do_instantiate_target.
15012         * x86_64.cc (class Target_selector_x86_64): Likewise.
15013         * testsuite/testfile.cc (class Target_selector_test): Update for
15014         changes to Target_selector.
15015
15016         * README: Rewrite, with some notes on unsupported features.
15017
15018 2008-03-24  Cary Coutant  <ccoutant@google.com>
15019
15020         * i386.cc (Target_i386::Got_type): New enum declaration.
15021         (Target_i386::Scan::local): Updated callers of Output_data_got
15022         member functions.
15023         (Target_i386::Scan::global): Likewise.
15024         (Target_i386::Relocate::relocate): Likewise.
15025         (Target_i386::Relocate::relocate_tls): Likewise.
15026         * object.h (Got_offset_list): New class.
15027         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15028         (Sized_relobj::local_got_offset): Likewise.
15029         (Sized_relobj::set_local_got_offset): Likewise.
15030         (Sized_relobj::local_has_tls_got_offset): Removed.
15031         (Sized_relobj::local_tls_got_offset): Removed.
15032         (Sized_relobj::set_local_tls_got_offset): Removed.
15033         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15034         * output.cc (Output_data_got::add_global): Added got_type parameter.
15035         (Output_data_got::add_global_with_rel): Likewise.
15036         (Output_data_got::add_global_with_rela): Likewise.
15037         (Output_data_got::add_global_pair_with_rel): New function.
15038         (Output_data_got::add_global_pair_with_rela): New function.
15039         (Output_data_got::add_local): Added got_type parameter.
15040         (Output_data_got::add_local_with_rel): Likewise.
15041         (Output_data_got::add_local_with_rela): Likewise.
15042         (Output_data_got::add_local_pair_with_rel): New function.
15043         (Output_data_got::add_local_pair_with_rela): New function.
15044         (Output_data_got::add_global_tls): Removed.
15045         (Output_data_got::add_global_tls_with_rel): Removed.
15046         (Output_data_got::add_global_tls_with_rela): Removed.
15047         (Output_data_got::add_local_tls): Removed.
15048         (Output_data_got::add_local_tls_with_rel): Removed.
15049         (Output_data_got::add_local_tls_with_rela): Removed.
15050         * output.h (Output_data_got::add_global): Added got_type parameter.
15051         (Output_data_got::add_global_with_rel): Likewise.
15052         (Output_data_got::add_global_with_rela): Likewise.
15053         (Output_data_got::add_global_pair_with_rel): New function.
15054         (Output_data_got::add_global_pair_with_rela): New function.
15055         (Output_data_got::add_local): Added got_type parameter.
15056         (Output_data_got::add_local_with_rel): Likewise.
15057         (Output_data_got::add_local_with_rela): Likewise.
15058         (Output_data_got::add_local_pair_with_rel): New function.
15059         (Output_data_got::add_local_pair_with_rela): New function.
15060         (Output_data_got::add_global_tls): Removed.
15061         (Output_data_got::add_global_tls_with_rel): Removed.
15062         (Output_data_got::add_global_tls_with_rela): Removed.
15063         (Output_data_got::add_local_tls): Removed.
15064         (Output_data_got::add_local_tls_with_rel): Removed.
15065         (Output_data_got::add_local_tls_with_rela): Removed.
15066         * resolve.cc (Symbol::override_base_with_special): Removed
15067         reference to has_got_offset_ field.
15068         * symtab.cc (Symbol::init_fields): Replaced initialization
15069         of got_offset_ with got_offsets_.  Removed initialization
15070         of has_got_offset_
15071         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15072         (Symbol::got_offset): Likewise.
15073         (Symbol::set_got_offset): Likewise.
15074         (Symbol::has_tls_got_offset): Removed.
15075         (Symbol::tls_got_offset): Removed.
15076         (Symbol::set_tls_got_offset): Removed.
15077         (Symbol::got_offset_): Removed.
15078         (Symbol::tls_mod_got_offset_): Removed.
15079         (Symbol::tls_pair_got_offset_): Removed.
15080         (Symbol::got_offsets_): New field.
15081         (Symbol::has_got_offset): Removed.
15082         (Symbol::has_tls_mod_got_offset): Removed.
15083         (Symbol::has_tls_pair_got_offset): Removed.
15084         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15085         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15086         member functions.
15087         (Target_x86_64::Scan::global): Likewise.
15088         (Target_x86_64::Relocate::relocate): Likewise.
15089         (Target_x86_64::Relocate::relocate_tls): Likewise.
15090
15091 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15092
15093         * yyscript.y: Fix spelling error in comment.
15094
15095 2008-03-24  Ian Lance Taylor  <iant@google.com>
15096
15097         * options.h (class General_options): Define build_id option.
15098         * layout.h (class Layout): Declare write_build_id, create_note,
15099         create_build_id.  Add build_id_note_ member.
15100         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15101         "libiberty.h", "md5.h", "sha1.h".
15102         (Layout::Layout): Initialize eh_frame_data_,
15103         eh_frame_hdr_section_, and build_id_note_.
15104         (Layout::finalize): Call create_build_id.
15105         (Layout::create_note): New function, broken out of
15106         Layout::create_gold_note.
15107         (Layout::create_gold_note): Call create_note.
15108         (Layout::create_build_id): New function.
15109         (Layout::write_build_id): New function.
15110         (Close_task_runner::run): Call write_build_id.
15111
15112         * x86_64.cc: Correct license to GPLv3.
15113
15114 2008-03-23  Ian Lance Taylor  <iant@google.com>
15115
15116         * options.cc: Include "demangle.h".
15117         (parse_optional_string): New function.
15118         (parse_long_option): Handle takes_optional_argument.
15119         (parse_short_option): Update dash_z initializer.  Handle
15120         takes_optional_argument.
15121         (General_options::General_options): Initialize do_demangle_.
15122         (General_options::finalize): Set do_demangle_.  Handle demangling
15123         style.
15124         * options.h (parse_optional_string): Declare.
15125         (struct One_option): Add optional_arg field.  Update constructor.
15126         Update call constructor calls.  Add takes_optional_argument
15127         function.
15128         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15129         (DEFINE_optional_string): Define.
15130         (General_options::demangle): Change from DEFINE_bool to
15131         DEFINE_optional_string.
15132         (General_options::no_demangle): New function.
15133         (General_options::do_demangle): New function.
15134         (General_options::set_do_demangle): New function.
15135         (General_options::execstack_status_): Move definition to end of
15136         class definition.
15137         (General_options::static_): Likewise.
15138         (General_options::do_demangle_): New field.
15139         * object.cc (big_endian>::get_symbol_location_info): Call
15140         Options::do_demangle, not Options::demangle.
15141         * symtab.cc (demangle): Likewise.
15142
15143 2008-03-22  Ian Lance Taylor  <iant@google.com>
15144
15145         * gold.h: Include <cstddef> and <sys/types.h>
15146         * options.h: Include <cstring>.
15147
15148 2008-03-21  Ian Lance Taylor  <iant@google.com>
15149
15150         * Added source code to GNU binutils.
15151 \f
15152 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15153
15154 Copying and distribution of this file, with or without modification,
15155 are permitted in any medium without royalty provided the copyright
15156 notice and this notice are preserved.
15157
15158 Local Variables:
15159 mode: change-log
15160 left-margin: 8
15161 fill-column: 74
15162 version-control: never
15163 End: