9949b9847c0d0a8fa9a3d5bcd2f3d87970294f73
[external/binutils.git] / gold / ChangeLog
1 2013-10-11  Roland McGrath  <mcgrathr@google.com>
2
3         * archive.h: Use struct rather than class for forward declaration
4         of Read_symbols_data.
5
6 2013-10-07  Cary Coutant  <ccoutant@google.com>
7
8         PR gold/16010
9         * testsuite/Makefile.am (icf_test): Fix dependencies.
10         (icf_safe_test): Likewise.
11         (icf_safe_so_test): Likewise.
12         (large_symbol_alignment): Add empty _LDADD rule.
13         * testsuite/Makefile.in: Regenerate.
14
15 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
16
17         PR gold/15927
18         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
19         relocation for R_X86_64_32 on x32.
20
21 2013-08-27  Roland McGrath  <mcgrathr@google.com>
22
23         * output.cc (Output_segment::set_section_addresses): Take new
24         Target* argument.  If target->isolate_execinstr() and the segment
25         is executable and starts at a target->abi_pagesize() boundary,
26         pad its end out to a target->abi_pagesize() boundary with code fill.
27         * output.h (Output_segment::set_section_addresses): Update decl.
28         * layout.h (Layout::check_output_data_for_reset_values): Take new
29         argument RELAX_OUTPUTS.
30         (Layout): New member relax_output_list_.
31         (Layout::add_relax_output): New method.
32         * layout.cc (Layout::Layout): Update constructor.
33         (Layout::reset_relax_output): New method.
34         (Layout::clean_up_after_relaxation): Call it.
35         (Layout::prepare_for_relaxation): Update caller.
36         (Layout::set_segment_offsets): Update callers of set_section_addresses.
37         Call reset_relax_output before re-processing segments for
38         isolate_execinstr case.
39         (Layout::write_data): Handle relax_output_list_.
40         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
41         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
42
43 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
44
45         PR binutils/15834
46         * object.h: Fix typos.
47
48 2013-08-16  Roland McGrath  <mcgrathr@google.com>
49
50         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
51         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
52
53 2013-08-07  Cary Coutant  <ccoutant@google.com>
54
55         Revert support for v2 DWP files:
56
57         2013-03-01  Cary Coutant  <ccoutant@google.com>
58
59             Add dwp support for v2 DWARF package file format.
60             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
61             tu_length parameter.  Adjust all callers.
62             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
63             * dwp.cc: Include dwarf.h.
64             (Section_bounds): New struct type.
65             (Unit_set): New struct type.
66             (Dwo_file::Dwo_file): Initialize new data member.
67             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
68             Combine and rename to...
69             (Dwo_file::read_unit_index): ...this.
70             (Dwo_file::sized_read_compunit_index)
71             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
72             (Dwo_file::sized_read_unit_index): ...this.
73             (Dwo_file::copy_section): Remove section_name, is_str_offsets
74             parameters; add section_id parameter.
75             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
76             (Dwo_file::add_unit_set): ...this.
77             (Dwo_file::shndx_map_): Remove.
78             (Dwo_file::sect_offsets_): New data member.
79             (Dwp_output_file::Dwp_output_file): Initialize new data members.
80             (Dwp_output_file::add_section): Rename to...
81             (Dwp_output_file::add_contribution): ...this.
82             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
83             (Dwp_output_file::add_tu_set): Likewise.
84             (Dwp_output_file::Contribution): New type.
85             (Dwp_output_file::Section::contributions): New data member.
86             (Dwp_output_file::Cu_or_tu_set): Remove.
87             (Dwp_output_file::Section::Section): New ctor.
88             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
89             (Dwp_output_file::Dwp_index::Section_table): New type.
90             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
91             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
92             parameter.
93             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
94             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
95             (Dwp_output_file::Dwp_index::section_table): New member function.
96             (Dwp_output_file::Dwp_index::section_table_end): New member function.
97             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
98             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
99             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
100             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
101             (Dwp_output_file::Dwp_index::section_table_): New data member.
102             (Dwp_output_file::Dwp_index::section_mask_): New data member.
103             (Dwp_output_file::add_output_section): New member function.
104             (Dwp_output_file::write_new_section): New member function.
105             (Dwp_output_file::write_contributions): New member function.
106             (Dwp_output_file::section_id_map_): New data member.
107             (class Dwo_id_info_reader): Remove.
108             (class Unit_reader): New class.
109             (get_dwarf_section_name): New function.
110             (Dwo_file::read_executable): Adjust initializations of class data.
111             (Dwo_file::read): Add support for v2 package file format.
112             (Dwo_file::read_unit_index): Likewise.
113             (Dwo_file::sized_read_unit_index): Likewise.
114             (Dwo_file::copy_section): Likewise.
115             (Dwo_file::add_unit_set): Likewise.
116             (Dwp_output_file::add_output_section): Likewise.
117             (Dwp_output_file::add_contribution): Likewise.
118             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
119             for empty slot.
120             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
121             file format.
122             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
123             slot.
124             (Dwp_output_file::initialize): Remove unused function.
125             (Dwp_output_file::finalize): Add support for v2 package file format.
126             (Dwp_output_file::write_index): Likewise.
127             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
128             function prototype.
129
130 2013-07-31  Cary Coutant  <ccoutant@google.com>
131
132         * object.cc (Sized_relobj::do_output_section_address): New function.
133         (Sized_relobj): Instantiate explicitly.
134         * object.h (Object::output_section_address): New function.
135         (Object::do_output_section_address): New function.
136         (Sized_relobj::do_output_section_address): New function.
137         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
138
139 2013-07-30  Cary Coutant  <ccoutant@google.com>
140             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
141
142         * parameters.cc (Parameters::entry): Return target-specific entry
143         symbol name.
144         * target.h (Target::entry_symbol_name): New function.
145         (Target_info::entry_symbol_name): New data member.
146
147         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
148         * i386.cc (Target_i386::i386_info): Likewise.
149         (Target_i386_nacl::i386_nacl_info): Likewise.
150         * sparc.cc (Target_sparc::sparc_info): Likewise.
151         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
152         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
153         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
154         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
155
156 2013-07-22  Sterling Augustine  <saugustine@google.com>
157
158         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
159         Convert parameter shndx to local variable. Add parameters symtab
160         and symtab_size.  Scan over section names.  Find relocation
161         section corresponding to current section.  Create and initialize
162         reloc_mapper_ and reloc_type_.
163         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
164         unit_length to off_t.  Initialize member unit_length_.  Fill in field
165         cu_offset_.
166         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
167         Initialize new fields unit_length_ and cu_offset_.
168         (Dwarf_pubnames_table::read_section): Update prototype.
169         (Dwarf_pubnames_table::cu_offset): New member function.
170         (Dwarf_pubnames_table::subsection_size): Likewise.
171         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
172         New fields.
173         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
174         member functions public.
175         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
176         Update comment.  Rework logic.  Move repeated parts to...
177         (Gdb_index_info_reader::read_pubtable): ...here. New function.
178         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
179         pubtypes_table_, and stmt_list_offset.
180         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
181         Gdb_index::find_pubtype_offset,
182         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
183         (Gdb_index::pubnames_read): Update prototype and rework logic.
184         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
185         Forward declare.
186         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
187         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
188         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
189         Gdb_index::map_pubtable_to_dies):
190         Declare functions.
191         (Gdb_index::pubnames_read): Update declaration.
192         (Gdb_index::Pubname_offset_map): New type.
193         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
194         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
195         Gdb_index::stmt_list_offset): Declare.
196         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
197         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
198         Gdb_index::pubtypes_offset_): Remove.
199
200 2013-07-19  Roland McGrath  <mcgrathr@google.com>
201
202         * options.h (General_options): Add -Trodata-segment option.
203         * parameters.cc (Parameters::check_rodata_segment): New function.
204         (Parameters::set_target_once): Call it.
205         * parameters.h (Parameters): Declare it (private member function).
206         * layout.cc (load_seg_unusable_for_headers): New function, broken
207         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
208         then validate rodata segment rather than text segment.
209         (relaxation_loop_body): Call that.
210         (is_text_segment): New function.  Don't admit a non-executable
211         segment if TARGET->isolate_execinstr().
212         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
213
214 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
215
216         PR gold/15070
217         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
218         * nacl.h (Sniff_file::View::View): Request aligned view.
219
220 2013-07-11  Cary Coutant  <ccoutant@google.com>
221
222         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
223         correct BRLT entry size.
224
225 2013-07-03  Alan Modra  <amodra@gmail.com>
226
227         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
228         comment.
229
230 2013-07-01  Cary Coutant  <ccoutant@google.com>
231
232         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
233         reloc_type_.
234         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
235         (Dwarf_ranges_table::lookup_reloc): New function.
236         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
237         reloc_type_.
238         (Dwarf_ranges_table::lookup_reloc): New function.
239         (Dwarf_ranges_table::reloc_type_): New data member.
240
241 2013-06-27  Jing Yu  <jingyu@google.com>
242
243         PR gold/15662
244         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
245         function.
246         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
247         (Target_powerpc::do_relax): Call the above.
248
249 2013-06-27  Cary Coutant  <ccoutant@google.com>
250
251         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
252         on garbage collected .opd section.
253
254 2013-06-27  Alan Modra  <amodra@gmail.com>
255
256         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
257         is non-zero.
258         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
259         (Target_powerpc::do_function_location): Likewise for loc->shndx.
260
261 2013-06-14  Cary Coutant  <ccoutant@google.com>
262
263         * resolve.cc (Symbol::override_base): Don't override st_type
264         from plugin placeholder symbols.
265         (Symbol_table::resolve): Likewise.
266         (Symbol_table::should_override): Don't complain about TLS mismatch
267         if the TO symbol is a plugin placeholder.
268         * testsuite/Makefile.am (plugin_test_tls): New test.
269         * testsuite/Makefile.in: Regenerate.
270         * testsuite/plugin_test_tls.sh: New test script.
271         * testsuite/two_file_test_2_tls.cc: New test source.
272         * testsuite/two_file_test_tls.cc: New test source.
273
274 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
275
276         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
277         the maximum segment alignment is larger than the page size.
278         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
279         correctly aligns the symbols with large alignemnt.
280         * testsuite/Makefile.in: Regenerate.
281         * testsuite/large_symbol_alignment.cc: New file.
282
283 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
284             Sriraman Tallam  <tmsriram@google.com>
285
286         * options.h (sort_section): New option.
287         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
288         Rename from Input_section_sort_section_name_special_ordering_compare.
289         (Input_section_sort_section_name_compare): New struct.
290         * output.cc (Output_section::Input_section_sort_section_name_compare::
291         operator()): New function.
292         (Output_section::sort_attached_input_sections): Use new sort function
293         for .text if --sort-section=name is specified.
294         * layout.cc (Layout::make_output_section):
295         Add sorting by name when --sort-section=name is specified.
296         * testsuite/Makefile.am (text_section_grouping): Test option
297         --sort-section=name.
298         * testsuite/Makefile.in: Regenerate.
299         * testsuite/section_sorting_name.cc: New file.
300         * testsuite/section_sorting_name.sh: New file.
301
302 2013-05-21  Cary Coutant  <ccoutant@google.com>
303
304         * symtab.h (Symbol::is_cxx_vtable): New function.
305         * target-reloc.h (relocate_section): Check for vtable symbol.
306         * testsuite/Makefile.am (missing_key_func.sh): New test case.
307         * testsuite/Makefile.in: Regenerate.
308         * testsuite/missing_key_func.cc: New test source.
309         * testsuite/missing_key_func.sh: New test script.
310
311 2013-05-21  Cary Coutant  <ccoutant@google.com>
312
313         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
314         type of enclosing symbol.
315         (Relocate_info::location): Check symbol type when describing symbol.
316         * object.h (Symbol_location_info): Remove unused line_number;
317         add enclosing_symbol_type.
318         * testsuite/debug_msg.sh: Adjust expected output.
319
320 2013-05-13  Cary Coutant  <ccoutant@google.com>
321
322         * configure.ac: Export DEFAULT_TARGET.
323         * configure: Regenerate.
324         * Makefile.in: Regenerate.
325         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
326         * testsuite/Makefile.in: Regenerate.
327         * testsuite/debug_msg.sh: Delete duplicate tests.
328         Don't check undef_int error message match for powerpc where the
329         source file and line number aren't available.
330
331 2013-05-10  Roland McGrath  <mcgrathr@google.com>
332
333         * options.h (General_options): Add --rosegment-gap option.
334         * options.cc (finalize): --rosegment-gap implies --rosegment.
335         * layout.cc (set_segment_offsets): Let user option override
336         target->rosegment_gap().
337
338 2013-05-10  Roland McGrath  <mcgrathr@google.com>
339
340         * options.h (General_options): Remove leading space from help
341         messages for -nostdlib and --rosegment.
342
343 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
344
345         PR ld/15365
346         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
347
348 2013-05-03  Alan Modra  <amodra@gmail.com>
349
350         * merge.cc (Output_merge_string::do_add_input_section): Correct
351         scan for number of strings.  Rename vars to avoid shadowing.
352         Include missing terminator in input_size_.
353
354 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
355
356         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
357         Restore empty string handling.
358
359 2013-05-01  Cary Coutant  <ccoutant@google.com>
360
361         * stringpool.cc (Stringpool_template::new_key_offset): Fix
362         uninitialized warning.
363
364 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
365
366         * output.cc (Output_section::add_merge_input_section): Allow
367         to merge sections if the alignment is more than character size.
368         * merge.h (Output_merge_string::Output_merge_string): Remove
369         assert.
370         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
371         only not-null strings. Check the alignment of strings.
372         * stringpool.h
373         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
374         alignment as the argument.
375         (Stringpool_template<Stringpool_char>::addralign_): New class member.
376         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
377         Align non-zero length strings according to the addralign_.
378         (Stringpool_template<Stringpool_char>::set_string_offsets):
379         Updating offsets according to the given alignment.
380         * testsuite/Makefile.am (text_section_grouping): Test if string
381         literals are getting merged.
382         * testsuite/Makefile.in: Regenerate.
383         * testsuite/merge_string_literals_1.c: New file.
384         * testsuite/merge_string_literals_2.c: Ditto.
385         * testsuite/merge_string_literals.sh: Ditto.
386
387 2013-04-26  Ian Lance Taylor  <iant@google.com>
388
389         * target-reloc.h (relocate_section): If the reloc offset is out of
390         range, pass VIEW as NULL to relocate.relocate.
391         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
392         * i386.cc (Target_i386::Relocate::relocate): Likewise.
393         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
394         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
395         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
396         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
397
398 2013-04-26  Geoff Pike  <gpike@chromium.org>
399
400         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
401         * layout.cc (Hash_task): New class.
402         (Layout::queue_build_id_tasks): New function.
403         (Layout::write_build_id): Handle single-thread portion of build ID
404         computation.  (In some cases, all of it is single-threaded.)  Replace
405         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
406         functionality in fewer lines of code.
407         * layout.h (Layout::queue_build_id_tasks): New function declaration.
408         * options.h (General_options): make "--build-id" default to tree
409         rather than sha1.  Add two new options related to --build-id=tree:
410         --build-id-chunk-size-for-treehash and
411         --build-id-min-file-size-for-treehash.
412         * Makefile.am: add testing of --build-id=tree and related new options
413         (these tests will be invoked by "make check").
414         * Makefile.in: Regenerate.
415
416 2013-04-25  Alan Modra  <amodra@gmail.com>
417
418         * configure.tgt: Add powerpcle and powerpc64le.
419
420 2013-04-22  Alan Modra  <amodra@gmail.com>
421
422         PR gold/15355
423         * layout.cc (Layout::segment_precedes): Allow more than one
424         segment with the same type and flags.
425
426 2013-04-15  Cary Coutant  <ccoutant@google.com>
427
428         * layout.cc (Layout::set_relocatable_section_offsets): Don't
429         allocate space in file for BSS sections.
430
431 2013-04-15  Cary Coutant  <ccoutant@google.com>
432
433         * script-sections.cc (Orphan_output_section): Reset address
434         to zero after each orphaned section for relocatable links.
435
436 2013-04-15  Cary Coutant  <ccoutant@google.com>
437
438         * symtab.cc (Symbol_table::sized_write_globals): Subtract
439         section starting address for relocatable link.
440         * testsuite/Makefile.am (script_test_11): New test.
441         * testsuite/Makefile.in: Regenerate.
442         * testsuite/script_test_11.c: New source file.
443         * testsuite/script_test_11.t: New linker script.
444
445 2013-04-13  Alan Modra  <amodra@gmail.com>
446
447         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
448         owner when sections are not adjacent and exceed group size.
449         (Target_powerpc::group_sections): Handle corner case.
450         (Target_powerpc::Branch_info::make_stub): Handle case where
451         stub table doesn't exist due to branches in non-exec sections.
452         (Target_powerpc::Relocate::relocate): Likewise.
453
454 2013-04-11  Alan Modra  <amodra@gmail.com>
455
456         PR gold/15354
457         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
458         .branch_lt to match bfd ld.  Adjust comments throughout file.
459
460 2013-04-04  Ian Lance Taylor  <iant@google.com>
461
462         GCC PR c++/56840
463         * object.cc (do_layout_deferred_sections): Handle .eh_frame
464         sections before checking whether they are included in the link.
465
466 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
467
468         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
469         object before calling the plugin claim_file handler.  Pass the elf
470         object of the archive to the plugin. Delete the elf object if the
471         plugin claims the file.
472
473 2013-03-21  Alan Modra  <amodra@gmail.com>
474
475         * layout.cc (Layout::set_segment_offsets): Accept writable .text
476         segment when omagic.
477
478 2013-03-21  Alan Modra  <amodra@gmail.com>
479
480         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
481         comparison warning.
482         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
483         uninitialized" warning.
484
485 2013-03-20  Alan Modra  <amodra@gmail.com>
486
487         * symtab.h (Symbol::clear_version): New function.
488         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
489         is_needed by weak references.  Clear version for symbols defined
490         in as-needed objects that are not needed.
491
492 2013-03-15  Alan Modra  <amodra@gmail.com>
493
494         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
495         static and public.  Add report_err param.  Return false for data refs.
496         (Target_powerpc::rela_dyn_section): New overloaded function.
497         (Target_powerpc::plt_, iplt_): Elucidate.
498         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
499         (Output_data_plt_powerpc::do_write): Don't write .iplt.
500         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
501         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
502         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
503         push_branch and make_plt_entry for ifunc syms when
504         reloc_needs_plt_for_ifunc.
505         (Target_powerpc::Relocate::relocate): Don't use plt entry value
506         for ifunc unless reloc_needs_plt_for_ifunc.
507
508 2013-03-15  Alan Modra  <amodra@gmail.com>
509
510         * gc.h (gc_process_relocs): Don't look through function descriptors.
511         * icf.cc (get_section_contents): Do so here instead.
512
513 2013-03-13  Alan Modra  <amodra@gmail.com>
514
515         * powerpc.cc (is_branch_reloc): Forward declare.
516         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
517         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
518         false for 64-bit, true for 32-bit non-branch relocs.
519         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
520         * testsuite/Makefile.am (icf_test): Use linker map file instead of
521         nm output.
522         (icf_safe_test): Generate linker map file as well as nm output.
523         (icf_safe_so_test): Likewise.
524         * testsuite/Makefile.in: Regenerate.
525         * testsuite/icf_test.sh: Parse linker map file to determine
526         section folding.
527         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
528         * testsuite/icf_safe_so_test.sh: Likewise.
529         (X86_32_or_ARM_specific_safe_fold): Merge into..
530         (arch_specific_safe_fold): ..this.
531         (X86_64_specific_safe_fold): Delete unused function.
532
533 2013-03-12  Alan Modra  <amodra@gmail.com>
534
535         * gc.h (gc_process_relocs): Look through function descriptors
536         to determine shndx, symvalue and addend used by ICF.  Tidy
537         variable duplication.
538
539 2013-03-11  Alan Modra  <amodra@gmail.com>
540
541         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
542         * layout.cc (Layout_task_runner::run): ..to here.
543         * symtab.h (struct Symbol_location): Extract from..
544         (class Symbol_table): ..here.
545         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
546         * target.h (class Target): Add function_location and
547         do_function_location functions.
548         (class Sized_target): Add do_function_location.
549         * object.h (class Sized_relobj_file): Move find_shdr..
550         (class Object): ..to here.
551         * object.cc: Likewise.  Update to suit.  Instantiate.
552         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
553         * powerpc.cc (class Powerpc_dynobj): New.
554         (Target_powerpc::do_function_location): New function.
555         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
556         (Powerpc_dynobj::do_read_symbols): New function.
557         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
558
559 2013-03-08  Ian Lance Taylor  <iant@google.com>
560
561         * options.cc (General_options::string_to_object_format): Accept
562         "default".
563
564 2013-03-08  Alan Modra  <amodra@gmail.com>
565
566         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
567         pointer to Post_fde.
568         (struct Post_fde): Move definition to here..
569         * ehframe.cc (struct Post_fde): ..from here.
570         (Cie::write): Don't alloc Post_fde.
571         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
572
573 2013-03-07  Alan Modra  <amodra@gmail.com>
574
575         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
576         relocation referencing .LC0.
577         * testsuite/discard_locals_test.sh: Remove FIXMEs.
578
579 2013-03-07  Alan Modra  <amodra@gmail.com>
580
581         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
582         always_inline.  Add assembly for powerpc to avoid GOT.
583
584 2013-03-07  Alan Modra  <amodra@gmail.com>
585
586         * testsuite/script_test_10.sh: Don't test .bss section
587         header number.
588
589 2013-03-06  Alan Modra  <amodra@gmail.com>
590
591         * powerpc.cc (class Powerpc_relobj): Move some member functions.
592         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
593         all callers.  Handle folded sections.
594         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
595         to Powerpc_relobj.
596         (Global_symbol_visitor_opd::operator()): Likewise.
597
598 2013-03-04  Alan Modra  <amodra@gmail.com>
599
600         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
601         * testsuite/Makefile.in: Regenerate.
602
603 2013-03-01  Cary Coutant  <ccoutant@google.com>
604
605         Add dwp support for v2 DWARF package file format.
606         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
607         tu_length parameter.  Adjust all callers.
608         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
609         * dwp.cc: Include dwarf.h.
610         (Section_bounds): New struct type.
611         (Unit_set): New struct type.
612         (Dwo_file::Dwo_file): Initialize new data member.
613         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
614         Combine and rename to...
615         (Dwo_file::read_unit_index): ...this.
616         (Dwo_file::sized_read_compunit_index)
617         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
618         (Dwo_file::sized_read_unit_index): ...this.
619         (Dwo_file::copy_section): Remove section_name, is_str_offsets
620         parameters; add section_id parameter.
621         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
622         (Dwo_file::add_unit_set): ...this.
623         (Dwo_file::shndx_map_): Remove.
624         (Dwo_file::sect_offsets_): New data member.
625         (Dwp_output_file::Dwp_output_file): Initialize new data members.
626         (Dwp_output_file::add_section): Rename to...
627         (Dwp_output_file::add_contribution): ...this.
628         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
629         (Dwp_output_file::add_tu_set): Likewise.
630         (Dwp_output_file::Contribution): New type.
631         (Dwp_output_file::Section::contributions): New data member.
632         (Dwp_output_file::Cu_or_tu_set): Remove.
633         (Dwp_output_file::Section::Section): New ctor.
634         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
635         (Dwp_output_file::Dwp_index::Section_table): New type.
636         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
637         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
638         parameter.
639         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
640         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
641         (Dwp_output_file::Dwp_index::section_table): New member function.
642         (Dwp_output_file::Dwp_index::section_table_end): New member function.
643         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
644         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
645         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
646         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
647         (Dwp_output_file::Dwp_index::section_table_): New data member.
648         (Dwp_output_file::Dwp_index::section_mask_): New data member.
649         (Dwp_output_file::add_output_section): New member function.
650         (Dwp_output_file::write_new_section): New member function.
651         (Dwp_output_file::write_contributions): New member function.
652         (Dwp_output_file::section_id_map_): New data member.
653         (class Dwo_id_info_reader): Remove.
654         (class Unit_reader): New class.
655         (get_dwarf_section_name): New function.
656         (Dwo_file::read_executable): Adjust initializations of class data.
657         (Dwo_file::read): Add support for v2 package file format.
658         (Dwo_file::read_unit_index): Likewise.
659         (Dwo_file::sized_read_unit_index): Likewise.
660         (Dwo_file::copy_section): Likewise.
661         (Dwo_file::add_unit_set): Likewise.
662         (Dwp_output_file::add_output_section): Likewise.
663         (Dwp_output_file::add_contribution): Likewise.
664         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
665         for empty slot.
666         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
667         file format.
668         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
669         slot.
670         (Dwp_output_file::initialize): Remove unused function.
671         (Dwp_output_file::finalize): Add support for v2 package file format.
672         (Dwp_output_file::write_index): Likewise.
673         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
674         function prototype.
675
676 2013-03-01  Cary Coutant  <ccoutant@google.com>
677
678         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
679         function into class definition in header file.
680         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
681         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
682         New function.
683         (Dwarf_info_reader::check_buffer): Move here from .cc file.
684
685 2013-02-28  Alan Modra  <amodra@gmail.com>
686
687         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
688         * target.cc (Target::do_plt_fde_location): New function.
689         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
690         accessor function, and constructor param.
691         (struct Post_fde, Post_fdes): Declare.
692         (Cie::write): Add post_fdes param.
693         * ehframe.cc (Fde::write): Use plt_fde_location.
694         (struct Post_fde): Define.
695         (Cie::write): Stash FDEs added post merge mapping.
696         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
697         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
698         (Eh_frame::do_sized_write): Arrange to write post map FDES after
699         other FDEs.
700         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
701         (Target_powerpc::has_glink): New function.
702         (Target_powerpc::do_relax): Add eh_frame info for stubs.
703         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
704         glink_eh_frame_fde_32, default_fde): New data.
705         (Stub_table::eh_frame_added_): New var.
706         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
707         Make const.
708         (Stub_table::add_eh_frame): New function.
709         (Output_data_glink::add_eh_frame): New function.
710         (Target_powerpc::make_glink_section): Call add_eh_frame.
711
712 2013-02-15  Ian Lance Taylor  <iant@google.com>
713
714         * options.h (DEFINE_uint64_alias): Define.
715         (class General_options): Add -Ttext-segment as an alias for
716         -Ttext.
717
718 2013-02-15  Alan Modra  <amodra@gmail.com>
719
720         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
721         (Stub_table::do_write): ..here, two places.
722         (Stub_table::plt_call_size): Use it here too.
723
724 2013-02-11  Ian Lance Taylor  <iant@google.com>
725
726         * descriptors.cc (Descriptors::close_all): New function.
727         * descriptors.h (class Descriptors): Declare close_all.
728         (close_all_descriptors): New inline function.
729         * plugin.cc: Include "descriptors.h".
730         (Plugin_manager::cleanup): Call close_all_descriptors.
731
732 2013-02-06  Alan Modra  <amodra@gmail.com>
733
734         * README: Update coding style link.
735
736 2013-01-28  Cary Coutant  <ccoutant@google.com>
737
738         * dwp.cc (File_list): New typedef.
739         (Dwo_name_info_reader): New class.
740         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
741         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
742         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
743         (Dwo_file::read_executable): New function.
744         (Dwo_file::read): Move common setup code to ...
745         (Dwo_file::make_object): ... here.
746         (dwp_options): Add --exec/-e.
747         (usage): Likewise.
748         (main): Likewise.
749
750 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
751
752         * layout.cc (Layout::layout): Check for option text_reorder.
753         (Layout::make_output_section): Ditto.
754         * options.h (text_reorder): New option.
755         * output.cc (Input_section_sort_compare): Remove special ordering
756         of section names.
757         (Output_section::
758          Input_section_sort_section_name_special_ordering_compare::
759          operator()): New function.
760         (Output_section::sort_attached_input_sections): Use new sort function
761         for .text.
762         * output.h (Input_section_sort_section_name_special_ordering_compare):
763         New struct.
764         * testsuite/Makefile.am (text_section_grouping): Test option
765         --no-text-reorder
766         * testsuite/Makefile.in: Regenerate.
767         * testsuite/text_section_grouping.sh: Check order of functions without
768         default text reordering.
769
770 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
771
772         * options.h (General_options): Change default to true for new_dtags.
773
774 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
775
776         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
777         when enable_new_dtags is false.  Only add DT_RUNPATH when
778         enable_new_dtags is true.
779
780 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
781
782         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
783         used in declaration and definition consistent.
784         (Target_powerpc::symval_for_branch): Ditto.
785
786 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
787
788         * testsuite/plugin_final_layout.cc: Fix comment.
789
790 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
791
792         * layout.cc (Layout::layout): Do not do default sorting for
793         text sections when section ordering is specified.
794         (make_output_section): Ditto.
795         * testsuite/plugin_final_layout.cc: Name the function sections
796         to catch reordering issues.
797
798 2013-01-15  Alan Modra  <amodra@gmail.com>
799
800         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
801         plt-thread-safe.
802
803 2013-01-15  Alan Modra  <amodra@gmail.com>
804
805         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
806         * testsuite/Makefile.in: Regenerate.
807
808 2013-01-14  Alan Modra  <amodra@gmail.com>
809
810         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
811         * testsuite/Makefile.in: Regenerate.
812
813 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
814
815         PR bfd/14430
816         Fix mingw gold build with plugins enabled
817         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
818         * configure.ac: Export DLOPEN_LIBS and add headers check.
819         * plugin.cc: Handle non-dlfcn case.
820         * Makefile.in: Regenerate.
821         * config.in: Regenerate.
822         * configure: Regenerate.
823         * testsuite/Makefile.in: Regenerate.
824
825 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
826
827         * output.h (sort_attached_input_sections): Change to be public.
828         * script-sections.cc
829         (Output_section_definition::set_section_addresses): Sort
830         attached input sections according to section order before linker
831         script assigns section addresses.
832         (Orphan_output_section::set_section_addresses): Sort
833         attached input sections according to section order before linker
834         script assigns section addresses.
835         * Makefile.am (final_layout.sh): Use a simple linker script to
836         check if section ordering still works.
837         * Makefile.in: Regenerate.
838
839 2013-01-09  Ben Cheng  <bccheng@google.com>
840
841         * arm.cc (Target_arm::attributes_accept_div): New function.
842         (Target_arm::attributes_forbid_div): New function.
843         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
844         attribute using the same new functions as what bfd/elf32_arm.c
845         does.
846
847 2013-01-07  Cary Coutant  <ccoutant@google.com>
848
849         PR gold/14993
850         * output.cc (Output_section::add_input_section): For incremental
851         updates, don't track input sections that are allocated from patch
852         space.
853
854 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
855             Ian Lance Taylor  <iant@google.com>
856
857         PR gold/14897
858         * configure.ac (--enable-ld): Removed.
859         (install_as_default): Set to yes only for --enable-gold=default
860         or --disable-ld.
861         * configure: Regenerated.
862
863 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
864
865         * options.h (General_options): Add -fuse-ld= for GCC linker
866         option compatibility.
867
868 2013-01-04  Cary Coutant  <ccoutant@google.com>
869
870         * configure.ac: Fix typo restoring CXXFLAGS.
871         * configure: Regenerate.
872
873 2013-01-04  Cary Coutant  <ccoutant@google.com>
874
875         * testsuite/Makefile.am (CXXLINK_S): New macro.
876         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
877         * testsuite/Makefile.in: Regenerate.
878
879 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
880
881         * version.cc (print_version): Update copyright year to 2013.
882
883 2012-12-20  Ian Lance Taylor  <iant@google.com>
884
885         * layout.cc (Layout::special_ordering_of_input_section): New
886         function.
887         (Layout::layout): If input section requires special ordering, must
888         sort input sections.
889         (Layout::make_output_section): May sort .text input sections.
890         (Layout::is_section_name_prefix_grouped): Remove.
891         * layout.h (class Layout): Declare
892         special_ordering_of_input_section.  Don't declare
893         is_section_name_prefix_grouped.
894         * output.cc (Output_section::add_input_section): Revert last
895         change.
896         (Output_section::Input_section_sort::match_file_name): Don't crash
897         if called on output section data.
898         (Output_section::Input_section_sort_compare): Sort based on
899         special ordering.
900         (Output_section::Input_section_sort_section_order_index_compare):
901         Revert last patch.
902         (Output_section::sort_attached_input_sections): Likewise.
903
904 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
905
906         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
907         * layout.h (Layout::is_section_name_prefix_grouped): New function.
908         * output.cc (Output_section::add_input_section): Check if section
909         name contains special prefix.  Keep input sections to sort such
910         sections.
911         (Output_section::Input_section_sort_section_order_index_compare
912          ::operator()): Group sections according to prefixes.
913         (Output_section::sort_attached_input_sections): Add condition to
914         Input_section_entry constructor call.
915         * testsuite/Makefile.am (text_section_grouping): New test.
916         * testsuite/Makefile.in: Regenerate.
917         * testsuite/text_section_grouping.cc: New file.
918         * testsuite/text_section_grouping.sh: New file.
919
920 2012-12-17  Nick Clifton  <nickc@redhat.com>
921
922         * Makefile.am: Add copyright notice.
923         * NEWS: Likewise.
924         * README: Likewise.
925         * configure.ac: Likewise.
926         * ftruncate.c: Likewise.
927         * Makefile.in: Regenerate.
928
929 2012-12-14  Cary Coutant  <ccoutant@google.com>
930
931         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
932         --no-as-needed flag.
933         (exception_separate_shared_12_test): Likewise.
934         (incremental_copy_test): Likewise.
935         * testsuite/Makefile.in: Regenerate.
936
937 2012-12-14  Cary Coutant  <ccoutant@google.com>
938
939         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
940         (Dwp_output_file::Dwp_index::enter_set): Add assert.
941
942 2012-12-12  Alan Modra  <amodra@gmail.com>
943
944         * powerpc.cc (class Track_tls): New.
945         (class Relocate, class Scan): Inherit Track_tls.
946         (Target_powerpc::Scan::local, global): Track tls optimization
947         and avoid creating plt entry for __tls_get_addr if all uses
948         are optimized away.
949         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
950
951 2012-12-12  Alan Modra  <amodra@gmail.com>
952
953         * options.h (General_options): Add --toc-sort/--no-toc-sort.
954         Replace no_toc_optimize with toc_optimize.
955         * output.h (Output_section::input_sections): Provide non-const variant.
956         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
957         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
958         accessors.
959         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
960         (class Sort_toc_sections): New.
961         (Target_powerpc::do_finalize_sections): Sort toc sections.
962         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
963
964 2012-12-10  Roland McGrath  <mcgrathr@google.com>
965
966         * testsuite/binary_unittest.cc (read_all): New function.
967         (Sized_binary_test): Use it instead of ::read.
968         * fileread.cc (do_read): Don't assume pread always reads the whole
969         amount in a single call.
970
971 2012-12-10  Alan Modra  <amodra@gmail.com>
972
973         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
974         Set EM_PPC64 or EM_PPC here.
975         (Target_selector_powerpc::do_recognize): Delete.
976
977 2012-12-10  Alan Modra  <amodra@gmail.com>
978
979         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
980         stub_table_.
981         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
982
983 2012-12-07  Roland McGrath  <mcgrathr@google.com>
984
985         * testsuite/binary_unittest.cc (Sized_binary_test):
986         Use open_descriptor rather than ::open.
987
988 2012-12-07  Alan Modra  <amodra@gmail.com>
989
990         * powerpc.cc (Stub_table::do_write): Delete redundant Address
991         typedef and invalid_address constant.
992         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
993         instantiate constants.
994
995 2012-12-06  Roland McGrath  <mcgrathr@google.com>
996
997         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
998         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
999         * aclocal.m4: Regenerate.
1000         * configure: Regenerate.
1001         * Makefile.in: Regenerate.
1002         * testsuite/Makefile.in: Regenerate.
1003
1004 2012-12-07  Alan Modra  <amodra@gmail.com>
1005
1006         * options.h (General_options): Add no_toc_optimize.
1007         * powerpc.cc (ok_lo_toc_insn): New function.
1008         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1009
1010 2012-12-06  Alan Modra  <amodra@gmail.com>
1011
1012         * options.h (General_options): Add plt_align, plt_static_chain,
1013         plt_thread_safe.  Update stub_group_size help text.
1014         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1015         for new plt_thread_safe_ var.
1016         (use_plt_offset): Correct comments.
1017         (Target_powerpc::do_relax): Look for thread creation symbols to
1018         determine default plt_thread_safe value.  Clear plt call stubs
1019         as well as branch stubs each iteration.
1020         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1021         insn constants.
1022         (l, hi, ha, write_insn): Move earlier.
1023         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1024         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1025         plt stubs too.
1026         (Stub_table::update_size): Adjust.
1027         (Stub_table::prev_size, set_prev_size): Delete.
1028         (Stub_table::stub_align): Let --plt-align affect result.
1029         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1030         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1031         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1032         (Stub_table::do_write): Support more stub variants.
1033
1034 2012-12-04  Alan Modra  <amodra@gmail.com>
1035
1036         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1037         (Target_powerpc::do_define_standard_symbols): New function.
1038
1039 2012-12-03  Alan Modra  <amodra@gmail.com>
1040
1041         * output.h: Formatting, whitespace.
1042
1043 2012-12-03  Alan Modra  <amodra@gmail.com>
1044
1045         * layout.h (Layout::get_executable_sections): Declare.
1046         * layout.cc (Layout::get_executable_sections): New function.
1047         * arm.cc (Target_arm::group_sections): Use it.
1048         (Arm_output_section::group_sections): Delete now redundant test.
1049         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1050         param to handle relative relocs.
1051         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1052         (Output_data_reloc::add_absolute): Adjust.
1053         (Output_data_reloc::add_relative): New function.
1054         (Output_data::reset_data_size): New function.
1055         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1056         (Output_section::set_addralign): New function.
1057         (Output_section::checkpoint_set_addralign): New function.
1058         (Output_section::clear_section_offsets_need_adjustment): New function.
1059         (Output_section::input_sections): Make public.
1060         * powerpc.cc (class Output_data_brlt_powerpc): New.
1061         (class Stub_table, class Stub_control): New.
1062         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1063         stub_table_, set_stub_table, stub_table): New vectors and accessor
1064         functions.
1065         (Target_powerpc::do_may_relax, do_relax, push_branch,
1066         new_stub_table, stub_tables, brlt_section, group_sections,
1067         add_branch_lookup_table, find_branch_lookup_table,
1068         write_branch_lookup_table, make_brlt_section): New functions.
1069         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1070         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1071         branch_info_): New vars.
1072         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1073         make call stubs here.
1074         (Output_data_glink): Remove all call stub handling from this class.
1075         (Target_powerpc::Scan::local, global): Save interesting branch
1076         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1077         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1078         functions on final link.
1079         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1080         Handle long branch destinations too.
1081         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1082         do_plt_address_for_local): Adjust lookup of plt call stubs.
1083
1084 2012-11-30  Alan Modra  <amodra@gmail.com>
1085
1086         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1087         relocs against protected symbols when building 32-bit shared libs.
1088
1089 2012-11-30  Alan Modra  <amodra@gmail.com>
1090
1091         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1092         param.  Call got_section() to make .got.  Update all callers
1093         and their callers and so on.
1094
1095 2012-11-30  Alan Modra  <amodra@gmail.com>
1096
1097         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1098         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1099         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1100         value if it already exists.
1101
1102 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1103
1104         PR gold/14858
1105         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1106
1107 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1108
1109         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1110         than bfc instruction for data sandboxing.
1111
1112 2012-11-08  Alan Modra  <amodra@gmail.com>
1113
1114         * po/POTFILES.in: Regenerate.
1115
1116 2012-11-05  Alan Modra  <amodra@gmail.com>
1117
1118         * configure.ac: Apply 2012-09-10 change to config.in here.
1119         * configure: Regenerate.
1120
1121 2012-11-05  Alan Modra  <amodra@gmail.com>
1122
1123         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1124         (struct Opd_ent): Use "Address" rather than "Offset".
1125         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1126         (Target_powerpc::got_section): Make public.
1127         (Target_powerpc::scan_relocs): Move code setting symbols..
1128         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1129         Create _SDA_BASE_ only when referenced.
1130
1131 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1132
1133         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1134         from last change.
1135
1136 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1137
1138         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1139         for offset_in_output_section parameter.
1140         (Sized_target::relocate_special_relocatable): Likewise.
1141         * arm.cc (Target_arm::relocate_relocs): Likewise.
1142         (Target_arm::relocate_special_relocatable): Likewise.
1143         * i386.cc (Target_i386::relocate_relocs): Likewise.
1144         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1145         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1146         * target-reloc.h (relocate_relocs): Likewise.
1147         * testsuite/testfile.cc (Target_test): Likewise.
1148         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1149         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1150
1151         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1152         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1153
1154         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1155         parameter, which is unused in the [!F_SETFD] case.
1156
1157         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1158         SYMNDX to off_t before comparing it to this->data_size().
1159         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1160         * incremental.cc (Output_section_incremental_inputs::do_write):
1161         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1162
1163         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1164
1165 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1166
1167         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1168         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1169         in EABI_VER5.
1170
1171 2012-10-29  Cary Coutant  <ccoutant@google.com>
1172
1173         * dwp.cc (usage): Add file and exit status parameters;
1174         add --help and --version options.
1175         (print_version): New function.
1176         (main): Add --help and --version options.
1177
1178 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1179
1180         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1181         final_layout_sequence.txt.
1182         * testsuite/Makefile.in: Regenerated.
1183
1184 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1185
1186         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1187         COMPILE generated by automake.
1188         (LINK1): Likewise.
1189         (CXXCOMPILE1): Likewise.
1190         (CXXLINK1): Likewise.
1191         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1192         (LINK): Likewise.
1193         (CXXCOMPILE): Likewise.
1194         (CXXLINK): Likewise.
1195         * testsuite/Makefile.in: Regenerated.
1196
1197 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1198
1199         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1200         on bad fwrite return.
1201
1202 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1203
1204         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1205         on val.
1206
1207 2012-10-23  Cary Coutant  <ccoutant@google.com>
1208
1209         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1210         * testsuite/Makefile.in: Regenerate.
1211         * testsuite/dwp_test.h: New source file.
1212         * testsuite/dwp_test_1.cc: New source file.
1213         * testsuite/dwp_test_1.s: New source file.
1214         * testsuite/dwp_test_1.sh: New source file.
1215         * testsuite/dwp_test_1b.cc: New source file.
1216         * testsuite/dwp_test_1b.s: New source file.
1217         * testsuite/dwp_test_2.cc: New source file.
1218         * testsuite/dwp_test_2.s: New source file.
1219         * testsuite/dwp_test_2.sh: New source file.
1220         * testsuite/dwp_test_main.cc: New source file.
1221         * testsuite/dwp_test_main.s: New source file.
1222
1223 2012-10-23  Cary Coutant  <ccoutant@google.com>
1224
1225         * dwp.h: New header file.
1226         * dwp.cc: New source file.
1227         * gold.h: Move shared declarations to system.h.
1228         * system.h: New header file.
1229         * Makefile.am: Add dwp.
1230         * Makefile.in: Regenerate.
1231
1232 2012-10-23  Cary Coutant  <ccoutant@google.com>
1233
1234         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1235         Dwarf_info_reader::read_from_pointer.
1236         (Dwarf_pubnames_table::read_header): Likewise.
1237         (Dwarf_pubnames_table::next_name): Likewise.
1238         (Dwarf_die::read_attributes): Likewise.
1239         (Dwarf_die::skip_attributes): Likewise.
1240         (Dwarf_info_reader::read_from_pointer): New function template.
1241         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1242         (Dwarf_pubnames_table): Likewise.
1243         (Dwarf_info_reader::read_from_pointer): New function template.
1244         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1245         Dwarf_pubnames_table ctor.
1246
1247 2012-10-23  Cary Coutant  <ccoutant@google.com>
1248
1249         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1250         abbrev_shndx.
1251         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1252         abbrev_shndx_.
1253         (Dwarf_info_reader::set_abbrev_shndx): New method.
1254         (Dwarf_info_reader::abbrev_shndx_): New data member.
1255
1256 2012-10-23  Cary Coutant  <ccoutant@google.com>
1257
1258         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1259         from object, not parameters.
1260         (Dwarf_info_reader::parse): Likewise.
1261         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1262         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1263         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1264         methods.
1265
1266 2012-10-23  Cary Coutant  <ccoutant@google.com>
1267
1268         * fileread.cc (Input_file::Input_file): New constructor.
1269         * fileread.h (class Input_file): Add new constructor.
1270
1271 2012-10-18  Alan Modra  <amodra@gmail.com>
1272
1273         PR gold/14727
1274         * object.cc (Relobj::is_section_name_included): Also match
1275         .sdata personality section.
1276
1277 2012-10-18  Alan Modra  <amodra@gmail.com>
1278
1279         * target-reloc.h (class Default_comdat_behavior): New, package up..
1280         (get_comdat_behaviour): ..this.
1281         (relocate_section): Add Relocate_comdat_behavior template arg,
1282         adjust code to suit.
1283         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1284         (Target_arm::scan_reloc_section): Likewise.
1285         * i386.cc (Target_i386::relocate_section): Likewise.
1286         * sparc.cc (Target_sparc::relocate_section): Likewise.
1287         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1288         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1289         * powerpc.cc (class Relocate_comdat_behavior): New.
1290         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1291         gold::relocate_section with new template arg.
1292
1293 2012-10-18  Alan Modra  <amodra@gmail.com>
1294
1295         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1296         dynamic relocs for GOT_TPREL got entries, without symbol if
1297         resolving locally.
1298         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1299         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1300         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1301
1302 2012-10-17  Alan Modra  <amodra@gmail.com>
1303
1304         PR gold/14726
1305         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1306
1307 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1308
1309         * layout.cc (Layout::include_section): Keep sections marked
1310         SHF_EXCLUDE when doing relocatable links.
1311
1312 2012-10-16  Alan Modra  <amodra@gmail.com>
1313
1314         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1315         (Target_powerpc::do_finalize_sections): Call it.
1316         (Output_data_save_res): New class and supporting functions.
1317         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1318         normal symbols defined in object files.
1319
1320 2012-10-12  Alan Modra  <amodra@gmail.com>
1321
1322         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1323         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1324         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1325         section if scan_opd_relocs not yet called.
1326         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1327
1328 2012-10-12  Alan Modra  <amodra@gmail.com>
1329
1330         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1331         add_local_ifunc_entry): Revert last change.
1332         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1333
1334 2012-10-05  Alan Modra  <amodra@gmail.com>
1335
1336         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1337         do_plt_address_for_global): New functions.
1338         (Output_data_got_powerpc::do_write): Don't segfault when linking
1339         statically.
1340         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1341         add_local_ifunc_entry): Return true on adding entry..
1342         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1343         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1344         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1345         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1346         set up symbols here.
1347         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1348         syms here.  Do so even when no .iplt.  Don't segfault when linking
1349         statically.
1350         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1351         new variants without reloc param.
1352         (Glink_sym_ent::Glink_sym_ent): Likewise.
1353         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1354         reloc when refs will resolve to plt call stub.
1355         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1356         R_PPC_PLTREL24 to resolve locally.
1357         (Target_powerpc::Scan::global): Correct ifunc handling.
1358         (Target_powerpc::Relocate::relocate): Correct local sym glink
1359         lookup.  Don't destroy "value" when we have a plt call stub,
1360         and when checking plt call validity.
1361         (Target_powerpc::do_dynsym_value): Simplify.
1362
1363 2012-10-05  Alan Modra  <amodra@gmail.com>
1364
1365         * i386.cc (Output_data_plt_i386::address_for_global,
1366         address_for_local): Add plt offset to returned value.  Adjust uses.
1367         * sparc.cc (Output_data_plt_sparc::address_for_global,
1368         address_for_local): Likewise.
1369         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1370         address_for_local): Likewise.
1371         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1372         address_for_local): Likewise.
1373         * target.h (Target::plt_address_for_global, plt_address_for_local):
1374         Update comment.
1375         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1376         (Output_data_got::Got_entry::write): Nor here.
1377         * output.h: Comment fix.
1378
1379 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1380
1381         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1382         global_offset_table_ value for larget got.
1383         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1384
1385 2012-09-29  Alan Modra  <amodra@gmail.com>
1386
1387         * powerpc.cc (Target_powerpc::iplt_): New output section.
1388         (Target_powerpc::iplt_section, make_iplt_section,
1389         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1390         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1391         Target_powerpc::plt_entry_count): Count iplt entries too.
1392         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1393         reloc section in constructor.  New params.
1394         (Target_powerpc::make_plt_section): Create reloc section here instead.
1395         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1396         functions.
1397         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1398         (Output_data_glink::add_entry, find_entry): New functions to
1399         deal with local syms.
1400         (Glink_sym_ent): Add support for local syms.
1401         (Output_data_glink::do_write): Handle ifunc plt entries.
1402         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1403         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1404         (Target_powerpc::Relocate::relocate): Likewise.
1405         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1406
1407 2012-09-25  Alan Modra  <amodra@gmail.com>
1408
1409         * object.h (Sized_relobj_file::adjust_local_symbol,
1410         do_adjust_local_symbol): New functions.
1411         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1412         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1413         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1414         and irregular opd entry spacing.
1415         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1416         (Global_symbol_visitor_opd): New functor.
1417         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1418         on deleted opd entries.
1419
1420 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1421
1422         * tilegx.cc: New file.
1423         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1424         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1425         * configure.tgt: Add entries for tilegx*.
1426         * configure.ac: Likewise.
1427         * Makefile.in: Rebuild.
1428         * configure: Likewise.
1429         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1430         tilegx.
1431
1432 2012-09-13  Alan Modra  <amodra@gmail.com>
1433
1434         * target-reloc.h (scan_relocs): Call scan.local for relocs
1435         against symbols in discarded sections.  Pass is_discarded
1436         param.
1437         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1438         Add is_discarded param.
1439         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1440         is_discarded to flag opd entry as discarded.  Don't emit dyn
1441         relocs on such entries.
1442         (Target_powerpc::Scan::global): Similarly detect and handle
1443         such opd entries.
1444         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1445         opd_ent_.  Update all uses.
1446         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1447         (Target_powerpc::relocate_section): Zero out discarded opd
1448         entry relocs.
1449
1450 2012-09-12  Ian Lance Taylor  <iant@google.com>
1451
1452         PR gold/14570
1453         * output.cc: Rename Output_data_got template parameter from size
1454         to got_size for all functions.  Compile all variants of
1455         Output_data_got.
1456         (Output_data_got::Got_entry::write): Correct use of size for
1457         symbol value.  Use local_is_tls rather than casting to
1458         Sized_relobj_file.
1459         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1460         (class Sized_relobj_file): Add do_local_is_tls.
1461         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1462
1463 2012-09-11  Alan Modra  <amodra@gmail.com>
1464
1465         PR gold/14566
1466         * layout.cc (Layout::set_segment_offsets): When using
1467         common-page-size alignment, ensure we are on a new max-page-size
1468         page.
1469         * output.cc (Output_segment::set_section_addresses): Use
1470         abi_pagesize, not common_pagesize for relro boundary.
1471         (Output_segment::set_offset): Likewise.
1472
1473 2012-09-11  Alan Modra  <amodra@gmail.com>
1474
1475         * output.h (Output_data_got::add_global_tls, add_local_tls,
1476         add_local_tls_pair): New functions.
1477         (Output_data_got::add_local_pair_with_rel): Remove second
1478         reloc param.  Expand comment.
1479         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1480         use_plt_or_tls_offset_, similarly for constructor param.
1481         (Output_data_got::Got_entry::write): Add got_index param.
1482         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1483         add_local_tls_pair): New functions.
1484         (Output_data_got::Got_entry::write): Handle tls symbols
1485         with use_plt_or_tls_offset_ set specially.
1486         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1487         (Output_data_got::do_write): Replace iterator with index, pass
1488         index to entry write function.
1489         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1490         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1491         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1492         call.
1493         * i386.cc (Target_i386::Scan::local): Likewise.
1494         * sparc.cc (Target_sparc::Scan::local): Likewise.
1495         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1496         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1497         do_tls_offset_for_global): New functions.
1498         (Target_powerpc::Scan::local): Correct TLS relocations and got
1499         entry values.
1500         (Target_powerpc::Scan::global): Don't emit unnecessary
1501         dynamic relocations on TLS GOT entries.
1502
1503 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1504
1505         * config.in: Disable sanity check for kfreebsd.
1506
1507 2012-09-10  Sterling Augustine  <saugustine@google.com>
1508
1509         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1510         (Gdb_index::pubtypes_read): New parameter.
1511         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1512         to calls.
1513         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1514         pubtypes_object_.
1515
1516 2012-09-09  Alan Modra  <amodra@gmail.com>
1517
1518         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1519         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1520         * gc.h (gc_process_relocs): Call target gc_add_reference.
1521         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1522         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1523         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1524         unnecessary cast.
1525         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1526         to cater for when we don't need code offset.  Update use.
1527         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1528         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1529         set_opd_valid): New functions.
1530         (Target_powerpc::do_gc_add_reference): New function.
1531         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1532         stashed refs.
1533         (Target_powerpc::do_gc_mark_symbol): New function.
1534
1535 2012-09-06  Cary Coutant  <ccoutant@google.com>
1536
1537         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1538         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1539         (Dwarf_die::skip_attributes): Likewise.
1540         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1541         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1542         (main): Call it.
1543         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1544
1545 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1546
1547         * testsuite/script_test_3.t: Add .got.plt output section
1548         statement.
1549         * testsuite/script_test_4.t: Likewise.
1550
1551 2012-09-05  Alan Modra  <amodra@gmail.com>
1552
1553         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1554         update all uses and lose "enum" when using type.
1555
1556 2012-09-05  Alan Modra  <amodra@gmail.com>
1557
1558         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1559         * configure: Regenerate.
1560         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1561         (plugin_final_layout.stdout): Likewise.
1562         (memory_test): Set page sizes to 0x1000.
1563         * testsuite/Makefile.in: Regenerate.
1564         * testsuite/discard_locals_test.sh: Add FIXME comment.
1565         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1566         * testsuite/pr14265.t: Add .got output section statement.
1567         * testsuite/script_test_2.t: Likewise.
1568         * testsuite/script_test_3.t: Likewise.
1569         * testsuite/script_test_4.t: Likewise.
1570         * testsuite/script_test_5.t: Likewise.
1571         * testsuite/script_test_6.t: Likewise.
1572         * testsuite/script_test_7.t: Likewise.
1573         * testsuite/script_test_9.t: Likewise.
1574
1575 2012-09-05  Alan Modra  <amodra@gmail.com>
1576
1577         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1578         (Powerpc_relocate_functions::Status): New typedef.
1579         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1580         (Target_powerpc::Scan::local): Handle REL64.
1581         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1582         for REL32 and REL64.
1583         (Target_powerpc::symval_for_branch): New function, extracted from..
1584         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1585         checks.  Report overflow errors.
1586
1587 2012-09-05  Alan Modra  <amodra@gmail.com>
1588
1589         * object.h (Sized_relobj_file::emit_relocs): Delete.
1590         (Sized_relobj_file::emit_relocs_reltype): Delete.
1591         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1592         relocate_relocs for --emit-relocs.
1593         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1594         * output.h: Update comment.
1595         (Output_segment::first_section): New function.
1596         (Output_segment::first_section_load_address): Use first_section.
1597         * output.cc (Output_segment::first_section): New function extracted..
1598         (Output_segment::first_section_load_address): ..from here.  Delete.
1599         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1600         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1601         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1602         adjust call to target.h function.
1603         * i386.cc (Target_i386): Likewise.
1604         * sparc.cc (Target_sparc): Likewise.
1605         * x86_64.cc (Target_x86_64): Likewise.
1606         * powerpc.cc (Target_powerpc): Likewise.
1607         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1608         first tls section has section symbol for optimised local dynamic
1609         output relocs.
1610         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1611         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1612         optimised tls code.
1613         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1614         Rename to relocate_relocs.  Update error message.
1615
1616 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1617
1618         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1619         --just-symbols.
1620
1621 2012-08-31  Alan Modra  <amodra@gmail.com>
1622
1623         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1624         (Powerpc_relobj::toc_base_offset): New stub function.
1625         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1626         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1627         (Target_powerpc::Relocate::enum skip_tls): New.
1628         (Target_powerpc::call_tls_get_addr_): New var.
1629         (Target_powerpc::is_branch_reloc): Move to file scope.
1630         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1631         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1632         New functions.
1633         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1634         (powerpc_info): Correct common_pagesize for ppc64.
1635         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1636         (Powerpc_relocate_functions): Add overflow check enums and functions.
1637         Add non-shift version of rela, rela_ua.  Delete all rel public
1638         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1639         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1640         addr16_ha3, addr14 functions.
1641         (Output_data_got_powerpc::add_constant_pair): New function.
1642         (Output_data_got_powerpc::got_base_offset): Likewise.
1643         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1644         (instruction constants): Sort, add some more.
1645         (Output_data_glink::do_write): Add and use Address typedef.  Use
1646         object->toc_base_offset() stub for 64-bit.
1647         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1648         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1649         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1650         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1651         Always treat .opd relocs as against locally defined symbol.
1652         Correct condition for RELATIVE relocs.
1653         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1654         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1655         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1656         calculations.  Handle TLS relocs, and more.  Add overflow
1657         checking and adjust for Powerpc_relocate_functions changes.
1658         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1659         Reinstate --emit-relocs code with FIXME.
1660
1661 2012-08-30  Alan Modra  <amodra@gmail.com>
1662
1663         * layout.cc (Layout::set_segment_offsets): Set p_align to
1664         abi_pagesize, not common_pagesize.
1665         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1666         to determine whether file header can go in segment.
1667
1668 2012-08-30  Alan Modra  <amodra@gmail.com>
1669
1670         * output.h (Output_reloc::Output_reloc <output section>): Add
1671         is_relative param.  Adjust calls.
1672         (Output_reloc::add_output_section_relative): New functions.
1673         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1674         is_relative.
1675         (Output_reloc::symbol_value): Handle SECTION_CODE.
1676
1677 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1678
1679         * gold.cc (queue_middle_tasks): Call layout again when unique
1680         segments for sections is desired.
1681         * layout.cc (Layout::Layout): Initialize new members.
1682         (Layout::get_output_section_flags): New function.
1683         (Layout::choose_output_section): Call get_output_section_flags.
1684         (Layout::layout): Make output section for mapping to a unique segment.
1685         (Layout::insert_section_segment_map): New function.
1686         (Layout::attach_allocated_section_to_segment): Make unique segment for
1687         output sections marked so.
1688         (Layout::segment_precedes): Check for unique segments when sorting.
1689         * layout.h (Layout::Unique_segment_info): New struct.
1690         (Layout::Section_segment_map): New typedef.
1691         (Layout::insert_section_segment_map): New function.
1692         (Layout::get_output_section_flags): New function.
1693         (Layout::is_unique_segment_for_sections_specified): New function.
1694         (Layout::set_unique_segment_for_sections_specified): New function.
1695         (Layout::unique_segment_for_sections_specified_): New member.
1696         (Layout::section_segment_map_): New member.
1697         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1698         Rename is_gc_pass_one to is_pass_one.
1699         Rename is_gc_pass_two to is_pass_two.
1700         Rename is_gc_or_icf to is_two_pass.
1701         Check for which pass based on whether symbols data is present.
1702         Make it two pass when unique segments for sections is desired.
1703         * output.cc (Output_section::Output_section): Initialize new
1704         members.
1705         * output.h (Output_section::is_unique_segment): New function.
1706         (Output_section::set_is_unique_segment): New function.
1707         (Output_section::is_unique_segment_): New member.
1708         (Output_section::extra_segment_flags): New function.
1709         (Output_section::set_extra_segment_flags): New function.
1710         (Output_section::extra_segment_flags_): New member.
1711         (Output_section::segment_alignment): New function.
1712         (Output_section::set_segment_alignment): New function.
1713         (Output_section::segment_alignment_): New member.
1714         (Output_segment::Output_segment): Initialize is_unique_segment_.
1715         (Output_segment::is_unique_segment): New function.
1716         (Output_segment::set_is_unique_segment): New function.
1717         (Output_segment::is_unique_segment_): New member.
1718         * plugin.cc (allow_unique_segment_for_sections): New function.
1719         (unique_segment_for_sections): New function.
1720         (Plugin::load): Add new functions to transfer vector.
1721         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1722         * Makefile.in: Regenerate.
1723         * testsuite/plugin_final_layout.sh: Check if unique segment
1724         functionality works.
1725         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1726         are available.
1727         (allow_unique_segment_for_sections): New global.
1728         (unique_segment_for_sections): New global.
1729         (claim_file_hook): Call allow_unique_segment_for_sections.
1730         (all_symbols_read_hook): Call unique_segment_for_sections.
1731
1732 2012-08-22  Cary Coutant  <ccoutant@google.com>
1733
1734         * layout.cc (Layout::include_section): Don't assert on GROUP
1735         sections with --emit-relocs.
1736
1737 2012-08-21  Cary Coutant  <ccoutant@google.com>
1738
1739         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1740         if --export-dynamic-symbol names an undef symbol.
1741
1742 2012-08-18  Alan Modra  <amodra@gmail.com>
1743
1744         * powerpc.cc: Formatting and white space.
1745         (Powerpc_relobj): Rename got2_section_ to special_.
1746         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1747         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1748         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1749         (Target_powerpc): Add Address typedef and invalid_address.  Use
1750         throughout.
1751         (Target_powerpc::is_branch_reloc): New function.
1752         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1753         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1754         for dst_mask, value and addend.
1755         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1756         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1757         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1758         uint16_t for 24-bit offset.  Use get_output_section_offset and
1759         check return.
1760         (Target_powerpc::Scan::local): Handle more relocs.
1761         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1762         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1763         Plug in toc restoring insn after plt calls.  Translate branches
1764         to function descriptor symbols to corresponding entry point.
1765         (Target_powerpc::relocate_for_relocatable): Check return from
1766         get_output_section_offset.
1767         * symtab.h: Comment typo.
1768
1769 2012-08-14  Ian Lance Taylor  <iant@google.com>
1770
1771         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1772         unsupported_relocal_local to call unsupported_reloc_global.
1773
1774 2012-08-14  Nick Clifton  <nickc@redhat.com>
1775
1776         PR ld/14265
1777         * script-sections.cc (Sections_element::output_section_name): Add
1778         keep return parameter.
1779         (Output_section_element::match_name): Add keep return parameter.
1780         Return the value of the keep_ member.
1781         * script-sections.h (class Output_section): Update
1782         output_section_name prototype.
1783         * layout.cc (Layout::keep_input_section): New public member
1784         function.
1785         (Layout::choose_output_section): Pass keep parameter to
1786         output_section_name.
1787         * layout.h (class Layout): Add keep_input_section.
1788         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1789         sections.
1790         * testsuite/Makefile.am: Add a test.
1791         * testsuite/Makefile.in: Regenerate.
1792         * testsuite/pr14265.c: Source file for the test.
1793         * testsuite/pr14265.t: Linker script for the test.
1794         * testsuite/pr14265.sh: Shell script for the test.
1795
1796 2012-08-14  Alan Modra  <amodra@gmail.com>
1797
1798         * target.h (Target::output_section_name): New function.
1799         (Target::do_output_section_name): New function.
1800         * layout.cc (Layout::choose_output_section): Call the above.
1801         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1802
1803 2012-08-14  Alan Modra  <amodra@gmail.com>
1804
1805         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1806         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1807         for replace_constant call.
1808         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1809         (Output_data_glink::do_print_to_mapfile): New function.
1810         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1811         (Target_powerpc::Relocate::relocate): Likewise.
1812
1813 2012-08-14  Alan Modra  <amodra@gmail.com>
1814
1815         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1816         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1817         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1818         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1819         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1820         here.
1821         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1822         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1823         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1824         here.
1825         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1826         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1827
1828 2012-08-12  Alan Modra  <amodra@gmail.com>
1829
1830         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1831         (glink insn constants): Use uint32_t.
1832         (Output_data_glink::add_entry): Use insert, not [] operator.
1833
1834 2012-08-11  Alan Modra  <amodra@gmail.com>
1835
1836         * object.h (Sized_relobj_file::find_shdr): New function.
1837         (Sized_relobj_file::find_special_sections): New function.
1838         * object.cc (Sized_relobj_file::find_shdr): New function.
1839         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1840         (Sized_relobj_file::find_special_sections): New function, split out..
1841         (Sized_relobj_file::do_read_symbols): ..from here.
1842         * output.h (Output_data_got::replace_constant): New function.
1843         (Output_data_got::num_entries): New function.
1844         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1845         (Output_data_got::got_offset): Protected rather than private.
1846         (Output_data_got::replace_got_entry): New function.
1847         * output.cc (Output_data_got::replace_got_entry): New function.
1848         * powerpc.cc (class Powerpc_relobj): New.
1849         (class Powerpc_relocate_functions): Delete all psymval variants or
1850         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1851         Implement _ha functions using corresponding _hi function.
1852         (Powerpc_relobj::find_special_sections): New function.
1853         (Target_powerpc::do_make_elf_object): New function.
1854         (class Output_data_got_powerpc): New.
1855         (class Output_data_glink): New.
1856         (class Powerpc_scan_relocatable_reloc): New.
1857         Many more changes througout file.
1858
1859 2012-08-09  Nick Clifton  <nickc@redhat.com>
1860
1861         * po/vi.po: Updated Vietnamese translation.
1862
1863 2012-08-07  Ian Lance Taylor  <iant@google.com>
1864
1865         * layout.cc (Layout::add_target_dynamic_tags): If
1866         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1867         plt_rel.
1868
1869 2012-07-30  Nick Clifton  <nickc@redhat.com>
1870
1871         * po/gold.pot: Updated template.
1872         * po/es.po: Updated Spanish translation.
1873
1874 2012-07-18  Cary Coutant  <ccoutant@google.com>
1875
1876         PR gold/14344
1877         * configure.ac: Add check for -gpubnames support.
1878         * configure: Regenerate.
1879         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1880         support; force -gno-pubnames.
1881         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1882         support.
1883         (gdb_index_test_4): New test.
1884         * testsuite/Makefile.in: Regenerate.
1885         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1886         * testsuite/gdb_index_test_2.sh: Likewise.
1887         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
1888         * testsuite/gdb_index_test_4.sh: New script.
1889         * testsuite/gdb_index_test_comm.sh: New script with common code;
1890         don't look for space after colon.
1891
1892 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
1893
1894         * gold.cc (queue_middle_tasks): Update function order only after
1895         deferred objects due to plugins are processed.
1896
1897 2012-07-11  Ian Lance Taylor  <iant@google.com>
1898
1899         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
1900         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
1901         (Target_arm::scan_reloc_for_stub): Likewise.
1902         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
1903         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
1904         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
1905         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
1906         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
1907
1908 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
1909             Ian Lance Taylor  <iant@google.com>
1910
1911         PR gold/14309
1912         * configure.ac: Test whether std::tr1::hash<off_t> works.
1913         * gold.h: Add a specialization for std::tr1::hash<off_t> if
1914         needed.
1915         * output.h (class Output_fill): Add virtual destructor.
1916         * configure, config.in: Rebuild.
1917
1918 2012-06-22  Roland McGrath  <mcgrathr@google.com>
1919
1920         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
1921
1922 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
1923
1924         * plugin.cc (Plugin::load): Handle position independent executables.
1925
1926 2012-06-06  Cary Coutant  <ccoutant@google.com>
1927
1928         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
1929         add .debug_macro.
1930         (lines_only_debug_sections): Likewise.
1931         (gdb_fast_lookup_sections): New static array.
1932         (is_gdb_debug_section): Rename formal parameter.
1933         (is_lines_only_debug_section): Likewise.
1934         (is_gdb_fast_lookup_section): New function.
1935         (Layout::include_section): Check for ".zdebug_" prefix; pass
1936         section name suffix to is_gdb_debug_section, et al.; check for
1937         fast-lookup sections when building .gdb_index.
1938         * options.h (--strip-debug-gdb): Update GDB version number.
1939
1940 2012-06-06  Cary Coutant  <ccoutant@google.com>
1941
1942         * configure.ac: Add check for fallocate.
1943         * configure: Regenerate.
1944         * config.in: Regenerate.
1945
1946         * options.h (class General_options): Add --mmap-output-file and
1947         --posix-fallocate options.
1948         * output.cc: (posix_fallocate): Remove; replace with...
1949         (gold_fallocate): New function.
1950         (Output_file::map_no_anonymous): Call gold_fallocate.
1951         (Output_file::map): Check --mmap-output-file option.
1952
1953 2012-06-05  Jing Yu  <jingyu@google.com>
1954
1955         * gold.h (textdomain): Add do {} to empty while(0).
1956         (bindtextdomain): Likewise.
1957
1958 2012-06-04  Cary Coutant  <ccoutant@google.com>
1959
1960         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
1961         has_dynsym_index.
1962
1963 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
1964
1965         * symtab.cc (Symbol_table::define_special_symbol):
1966         Initialize *poldsym to prevent uninitialized variable errors.
1967
1968 2012-05-23  Cary Coutant  <ccoutant@google.com>
1969
1970         * layout.cc (Layout::section_name_mapping): Add rules to handle
1971         exact match on .data.rel.ro.local or .data.rel.ro.
1972         (Layout::output_section_name): Check for exact matches.
1973
1974 2012-05-23  Cary Coutant  <ccoutant@google.com>
1975
1976         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
1977         more carefully.
1978
1979 2012-05-22  Cary Coutant  <ccoutant@google.com>
1980
1981         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
1982         object before exporting symbol.
1983
1984 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
1985
1986         * testsuite/tls_test.cc: Include "config.h" first.
1987         * testsuite/tls_test_c.c: Likewise.
1988
1989 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
1990             Nick Clifton  <nickc@redhat.com>
1991
1992         PR 14072
1993         * configure.in: Add check that sysdep.h has been included before
1994         any system header files.
1995         * configure: Regenerate.
1996         * config.in: Regenerate.
1997
1998 2012-05-14  Cary Coutant  <ccoutant@google.com>
1999
2000         * layout.cc (Layout::make_output_section): Mark .tdata section
2001         as RELRO.
2002         * testsuite/relro_test.cc: Add a TLS variable.
2003
2004 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2005
2006         PR gold/14091
2007         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2008         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2009         R_X86_64_64.
2010
2011 2012-05-08  Cary Coutant  <ccoutant@google.com>
2012
2013         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2014         (lines_only_debug_sections): Likewise.
2015
2016 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2017
2018         * nacl.cc: New file.
2019         * nacl.h: New file.
2020         * Makefile.am (CCFILES, HFILES): Add them.
2021         * Makefile.in: Regenerate.
2022         * i386.cc (Output_data_plt_i386_nacl): New class.
2023         (Output_data_plt_i386_nacl_exec): New class.
2024         (Output_data_plt_i386_nacl_dyn): New class.
2025         (Target_i386_nacl): New class.
2026         (Target_selector_i386_nacl): New class.
2027         (target_selector_i386): Use it instead of Target_selector_i386.
2028         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2029         (Target_x86_64_nacl): New class.
2030         (Target_selector_x86_64_nacl): New class.
2031         (target_selector_x86_64, target_selector_x32): Use it instead of
2032         Target_selector_x86_64.
2033         * arm.cc (Output_data_plt_arm_nacl): New class.
2034         (Target_arm_nacl): New class.
2035         (Target_selector_arm_nacl): New class.
2036         (target_selector_arm, target_selector_armbe): Use it instead of
2037         Target_selector_arm.
2038
2039         * target-select.cc (select_target): Take new Input_file* and off_t
2040         arguments, pass them on to recognize method of selector.
2041         * object.cc (make_elf_sized_object): Update caller.
2042         * parameters.cc (parameters_force_valid_target): Likewise.
2043         * incremental.cc (make_sized_incremental_binary): Likewise.
2044         * target-select.h: Update decl.
2045         (Target_selector::recognize): Take new Input_file* argument,
2046         pass it on to do_recognize.
2047         (Target_selector::do_recognize): Take new Input_file* argument.
2048         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2049         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2050         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2051         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2052
2053         * target.h (Target::Target_info): New members isolate_execinstr
2054         and rosegment_gap.
2055         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2056         * arm.cc (Target_arm::arm_info): Update initializer.
2057         * i386.cc (Target_i386::i386_info): Likewise.
2058         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2059         * sparc.cc (Target_sparc::sparc_info): Likewise.
2060         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2061         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2062         * layout.cc (Layout::attach_allocated_section_to_segment):
2063         Take new const Target* argument.  If target->isolate_execinstr(), act
2064         like --rosegment.
2065         (Layout::find_first_load_seg): Take new const Target* argument;
2066         if target->isolate_execinstr(), reject PF_X segments.
2067         (Layout::relaxation_loop_body): Update caller.
2068         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2069         reset file offset to zero when we hit LOAD_SEG, and then do a second
2070         loop over the segments before LOAD_SEG to reassign offsets after
2071         addresses have been determined.  Handle target->rosegment_gap().
2072         (Layout::attach_section_to_segment): Take new const Target* argument;
2073         pass it to attach_allocated_section_to_segment.
2074         (Layout::make_output_section): Update caller.
2075         (Layout::attach_sections_to_segments): Take new const Target* argument;
2076         pass it to attach_section_to_segment.
2077         * gold.cc (queue_middle_tasks): Update caller.
2078         * layout.h (Layout): Update method decls with new arguments.
2079
2080         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2081         Target_info pointer to use.
2082         (Target_arm::do_make_data_plt): New virtual method.
2083         (Target_arm::make_data_plt): New method that calls it.
2084         (Target_arm::make_plt_entry): Use it.
2085         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2086         for the section alignment.
2087         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2088         method.
2089         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2090         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2091         method.
2092         (Output_data_plt_arm::get_plt_entry_size): Call it.
2093         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2094         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2095         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2096         method.
2097         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2098         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2099         method instead of sizeof(plt_entry).
2100         (Output_data_plt_arm::add_entry): Likewise.
2101         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2102         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2103         than static method.
2104         (Target_arm::plt_entry_size): Likewise.
2105         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2106         Move to ...
2107         (Output_data_plt_arm_standard): ... here, new class.
2108         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2109         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2110         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2111
2112         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2113         Take additional argument for the PLT entry size.
2114         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2115         Use get_plt_entry_size method rather than plt_entry_size variable.
2116         (Output_data_plt_x86_64::reserve_slot): Likewise.
2117         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2118         (Output_data_plt_x86_64::add_entry): Likewise.
2119         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2120         (Output_data_plt_x86_64::address_for_global): Likewise.
2121         (Output_data_plt_x86_64::address_for_local): Likewise.
2122         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2123         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2124         Make method non-static.
2125         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2126         method.
2127         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2128         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2129         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2130         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2131         virtual method.
2132         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2133         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2134         virtual method.
2135         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2136         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2137         virtual method.
2138         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2139         (Output_data_plt_x86_64::plt_entry_size)
2140         (Output_data_plt_x86_64::first_plt_entry)
2141         (Output_data_plt_x86_64::plt_entry)
2142         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2143         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2144         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2145         (Output_data_plt_x86_64_standard): ... here, new class.
2146         (Target_x86_64::Target_x86_64): Take optional argument for the
2147         Target_info pointer to use.
2148         (Target_x86_64::do_make_data_plt): New virtual method.
2149         (Target_x86_64::make_data_plt): New method to call it.
2150         (Target_x86_64::init_got_plt_for_update): Use that.
2151         Call this->plt_->add_eh_frame method here.
2152         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2153         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2154         rather than static method.
2155         (Target_x86_64::plt_entry_size): Likewise.
2156         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2157         rather than plt_entry_size variable.  Move guts of PLT filling to...
2158         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2159         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2160         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2161
2162         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2163         additional argument for the section alignment.
2164         Don't do add_eh_frame_for_plt here.
2165         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2166         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2167         variable.
2168         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2169         method.
2170         (Output_data_plt_i386::get_plt_entry_size): Call it.
2171         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2172         (Output_data_plt_i386::add_eh_frame): New method to call it.
2173         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2174         method.
2175         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2176         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2177         method.
2178         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2179         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2180         method instead of plt_entry_size.
2181         (Output_data_plt_i386::plt_entry_size)
2182         (Output_data_plt_i386::plt_eh_frame_fde_size)
2183         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2184         (Output_data_plt_i386_standard): ... here, new class.
2185         (Output_data_plt_i386_exec): New class.
2186         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2187         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2188         (Output_data_plt_i386::exec_plt_entry): Move to ...
2189         (Output_data_plt_i386_exec::plt_entry): ... here.
2190         (Output_data_plt_i386_dyn): New class.
2191         (Output_data_plt_i386::first_plt_entry): Move to ...
2192         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2193         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2194         (Output_data_plt_i386_dyn::plt_entry): ... here.
2195         (Target_i386::Target_i386): Take optional argument for the Target_info
2196         pointer to use.
2197         (Target_i386::do_make_data_plt): New virtual method.
2198         (Target_i386::make_data_plt): New method to call it.
2199         (Target_i386::make_plt_section): Use that.
2200         Call this->plt_->add_eh_frame method here.
2201         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2202         rather than plt_entry_size variable.
2203         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2204         (Output_data_plt_i386::address_for_local): Likewise.
2205         (Output_data_plt_i386::do_write): Likewise.
2206         Move guts of PLT filling to...
2207         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2208         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2209         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2210         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2211
2212 2012-05-01  Cary Coutant  <ccoutant@google.com>
2213
2214         * dwarf_reader.cc (Dwarf_die::read_attributes)
2215         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2216         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2217         * reduced_debug_output.cc
2218         (Output_reduced_debug_info_section::get_die_end): Remove
2219         DW_FORM_GNU_ref_index.  Add default case.
2220
2221 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2222
2223         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2224         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2225         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2226         DW_AT_high_pc as offset from DW_AT_low_pc.
2227
2228         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2229         * testsuite/Makefile.in: Regenerate.
2230         * testsuite/gdb_index_test_3.c: New test source file.
2231         * testsuite/gdb_index_test_3.sh: New test source file.
2232
2233 2012-04-25  Ian Lance Taylor  <iant@google.com>
2234
2235         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2236         pointer.
2237         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2238         as a class, not a struct.
2239         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2240         (Target_arm::apply_cortex_a8_workaround): Likewise.
2241         * gc.h: Declare Reloc_types as a struct, not a class.
2242         * object.h: Declare Symbols_data as a struct.
2243         * reloc.h: Declare Read_relocs_data as a struct.
2244         * target.h: Declare Relocate_info as a struct.
2245
2246 2012-04-24  David S. Miller  <davem@davemloft.net>
2247
2248         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2249         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2250         and R_SPARC_WPLT30.
2251
2252 2012-04-24  Cary Coutant  <ccoutant@google.com>
2253
2254         * incremental-dump.cc (find_input_containing_global): Replace
2255         magic number with symbolic constant.
2256         (dump_incremental_inputs): Update version number.
2257         * incremental.cc (Output_section_incremental_inputs): Update version
2258         number; import symbolic constants from Incremental_inputs_reader.
2259         (Incremental_inputs::create_data_sections): Align relocations
2260         section correctly for 64-bit targets.
2261         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2262         constants; add padding.
2263         (Output_section_incremental_inputs::write_header): Add assert for
2264         header_size.
2265         (Output_section_incremental_inputs::write_input_files): Add assert
2266         for input_entry_size.
2267         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2268         add assert for object_info_size, input_section_entry_size,
2269         global_sym_entry_size.
2270         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2271         for data structure sizes; use them.
2272         (Incremental_input_entry_reader): Import symbolic constants from
2273         Incremental_inputs_reader; use them.
2274
2275 2012-04-23  David S. Miller  <davem@davemloft.net>
2276
2277         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2278         and elf_flags_set_.
2279         (Target_sparc::Target_sparc): Initialize new fields.
2280         (Target_sparc::do_make_elf_object): New function.
2281         (Target_sparc::do_adjust_elf_header): New function.
2282
2283 2012-04-23  Cary Coutant  <ccoutant@google.com>
2284
2285         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2286         CU range table of gdb index.
2287
2288 2012-04-20  David S. Miller  <davem@davemloft.net>
2289
2290         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2291         instead of false.
2292
2293 2012-04-16  David S. Miller  <davem@davemloft.net>
2294
2295         * sparc.cc (Target_sparc::got_address): New function.
2296         (Sparc_relocate_functions::gdop_hix22): New function.
2297         (Sparc_relocate_functions::gdop_lox10): New function.
2298         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2299         relocs.
2300         (Target_sparc::Scan::local): Likewise if the global symbol is not
2301         preemptible and is not IFUNC.
2302         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2303         transformations for local and non-preemptible non-IFUNC global
2304         symbols.
2305
2306         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2307         writing out 64-bit part of ranges.
2308
2309         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2310         -fpic and -fpie respectively.
2311         * Makefile.in: Regenerate.
2312
2313         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2314         (Target_sparc::Target_sparc): Initialize new field.
2315         (Target_sparc::do_plt_section_for_global): New function.
2316         (Target_sparc::do_plt_section_for_local): New function.
2317         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2318         (Target_sparc::make_plt_section): New function, broken out of
2319         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2320         (Target_sparc::make_plt_entry): Call make_plt_section.
2321         (Target_sparc::make_local_ifunc_plt_entry): New function.
2322         (Target_sparc::rela_ifunc_section): New function.
2323         (Target_sparc::plt_section): Remove const.
2324         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2325         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2326         and ifunc_count_ fields.
2327         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2328         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2329         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2330         (Output_data_plt_sparc::rela_ifunc): New function.
2331         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2332         (Output_data_plt_sparc::has_ifunc_section): New function.
2333         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2334         (Output_data_plt_sparc::address_for_global): New function.
2335         (Output_data_plt_sparc::address_for_local): New function.
2336         (Output_data_plt_sparc::plt_index_to_offset): New function.
2337         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2338         and entry_count.
2339         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2340         entry_count.
2341         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2342         R_SPARC_JMP_IREL to switch.
2343         (Target_sparc::Scan::check_non_pic): Likewise.
2344         (Target_sparc::Scan::local): Handle IFUNC symbols.
2345         (Target_sparc::Scan::local): Likewise.
2346         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2347         and plt_address_for_local.
2348         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2349         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2350
2351         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2352         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2353         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2354         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2355         global relocs too.
2356         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2357         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2358         calls.
2359         * sparc.cc (Target_sparc::Scan::global): Likewise.
2360         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2361
2362 2012-04-16  Cary Coutant  <ccoutant@google.com>
2363
2364         * archive.cc (Library_base::should_include_member): Check for
2365         --export-dynamic-symbol.
2366         * options.h (class General_options): Add --export-dynamic-symbol.
2367         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2368         --export-dynamic-symbol.
2369         (Symbol_table::gc_mark_undef_symbols): Likewise.
2370         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2371
2372 2012-04-12  David S. Miller  <davem@davemloft.net>
2373
2374         * sparc.cc (Reloc::wdisp10): New relocation method.
2375         (Reloc::h34): Likewise.
2376         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2377         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2378         R_SPARC_WDISP10.
2379         (Target_sparc::Scan::local): Likewise.
2380         (Target_sparc::Scan::global): Likewise.
2381         (Target_sparc::Relocate::relocate): Likewise.
2382
2383 2012-04-09  Cary Coutant  <ccoutant@google.com>
2384
2385         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2386         low_pc == 0.
2387
2388 2012-04-06  Ian Lance Taylor  <iant@google.com>
2389
2390         * timer.cc: #include <unistd.h>.
2391
2392 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2393
2394         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2395         * config.in: Regenerate.
2396         * configure: Regenerate.
2397
2398 2012-04-05  Nick Clifton  <nickc@redhat.com>
2399
2400         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2401         (AM_LC_MESSAGES): Add.
2402         * aclocal.m4: Regenerate.
2403         * config.in: Regenerate.
2404         * configure: Regenerate.
2405
2406 2012-03-21  Cary Coutant  <ccoutant@google.com>
2407
2408         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2409         * Makefile.in: Regenerate.
2410         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2411         (Sized_elf_reloc_mapper::symbol_section): New function.
2412         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2413         (make_elf_reloc_mapper): New function.
2414         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2415         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2416         (Dwarf_abbrev_table::do_get_abbrev): New function.
2417         (Dwarf_ranges_table::read_ranges_table): New function.
2418         (Dwarf_ranges_table::read_range_list): New function.
2419         (Dwarf_pubnames_table::read_section): New function.
2420         (Dwarf_pubnames_table::read_header): New function.
2421         (Dwarf_pubnames_table::next_name): New function.
2422         (Dwarf_die::Dwarf_die): New function.
2423         (Dwarf_die::read_attributes): New function.
2424         (Dwarf_die::skip_attributes): New function.
2425         (Dwarf_die::set_name): New function.
2426         (Dwarf_die::set_linkage_name): New function.
2427         (Dwarf_die::attribute): New function.
2428         (Dwarf_die::string_attribute): New function.
2429         (Dwarf_die::int_attribute): New function.
2430         (Dwarf_die::uint_attribute): New function.
2431         (Dwarf_die::ref_attribute): New function.
2432         (Dwarf_die::child_offset): New function.
2433         (Dwarf_die::sibling_offset): New function.
2434         (Dwarf_info_reader::check_buffer): New function.
2435         (Dwarf_info_reader::parse): New function.
2436         (Dwarf_info_reader::do_parse): New function.
2437         (Dwarf_info_reader::do_read_string_table): New function.
2438         (Dwarf_info_reader::lookup_reloc): New function.
2439         (Dwarf_info_reader::get_string): New function.
2440         (Dwarf_info_reader::visit_compilation_unit): New function.
2441         (Dwarf_info_reader::visit_type_unit): New function.
2442         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2443         Sized_elf_reloc_mapper.
2444         (Sized_dwarf_line_info::symbol_section): Remove function.
2445         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2446         (Sized_dwarf_line_info::read_line_mappings): Remove object
2447         parameter, adjust callers.
2448         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2449         * dwarf_reader.h: Include <sys/types.h>.
2450         (class Track_relocs): Remove forward declaration.
2451         (class Elf_reloc_mapper): New class.
2452         (class Sized_elf_reloc_mapper): New class.
2453         (class Dwarf_abbrev_table): New class.
2454         (class Dwarf_range_list): New class.
2455         (class Dwarf_ranges_table): New class.
2456         (class Dwarf_pubnames_table): New class.
2457         (class Dwarf_die): New class.
2458         (class Dwarf_info_reader): New class.
2459         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2460         (Sized_dwarf_line_info::symbol_section): Remove member function.
2461         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2462         base class.
2463         * gdb-index.cc: New source file.
2464         * gdb-index.h: New source file.
2465         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2466         and .debug_types sections, call Layout::add_to_gdb_index.
2467         (Sized_relobj_incr::do_section_name): Implement.
2468         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2469         return type; Implement.
2470         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2471         return type.
2472         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2473         parameter list and return type.
2474         (Sized_incr_dynobj::do_section_contents): Likewise.
2475         * layout.cc: Include gdb-index.h.
2476         (Layout::Layout): Initialize gdb_index_data_.
2477         (Layout::init_fixed_output_section): Check for .gdb_index section.
2478         (Layout::add_to_gdb_index): New function. Instantiate.
2479         * layout.h: Add forward declaration for class Gdb_index.
2480         (Layout::add_to_gdb_index): New member function.
2481         (Layout::gdb_index_data_): New data member.
2482         * main.cc: Include gdb-index.h.
2483         (main): Print statistics for gdb index.
2484         * object.cc (Object::section_contents): Move code into
2485         do_section_contents.
2486         (need_decompressed_section): Check for sections needed when building
2487         gdb index.
2488         (build_compressed_section_map): Likewise.
2489         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2490         gdb index.
2491         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2492         sections; call Layout::add_to_gdb_index.
2493         (Sized_relobj_file::do_decompressed_section_contents): Call
2494         do_section_contents directly.
2495         * object.h (Object::do_section_contents): Adjust parameter list and
2496         return type.
2497         (Object::do_decompressed_section_contents): Call do_section_contents
2498         directly.
2499         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2500         return type.
2501         * options.h (class General_options): Add --gdb-index option.
2502         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2503         list and return type.
2504         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2505         * reloc.h (Track_relocs::checkpoint): New function.
2506         (Track_relocs::reset): New function.
2507
2508         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2509         New test cases.
2510         * testsuite/Makefile.in: Regenerate.
2511         * testsuite/gdb_index_test.cc: New test source file.
2512         * testsuite/gdb_index_test_1.sh: New test source file.
2513         * testsuite/gdb_index_test_2.sh: New test source file.
2514
2515 2012-03-19  Doug Kwan  <dougkwan@google.com>
2516
2517         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2518         (Target_arm::do_finalize_sections): Remove code which defines
2519         __exidx_start and __exidx_end.  Make symbol table parameter
2520         anonymous as it is not used.
2521         * gold.cc (queue_middle_tasks): Call target hook to define any
2522         target-specific symbols.
2523         * target.h (Target::define_standard_symbols): New method.
2524         (Target::do_define_standard_symbols): Same.
2525         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2526         * testsuite/Makefile.in: Regenerate.
2527         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2528         and __exidx_end.
2529         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2530         relocations are generated for __exidx_start and __exidx_end.
2531
2532 2012-03-16  Doug Kwan  <dougkwan@google.com>
2533
2534         * testsuite/Makefile.am: Disable test initpri3b.
2535         * testsuite/Makefile.in: Regenerate.
2536
2537 2012-03-15  Doug Kwan  <dougkwan@google.com>
2538
2539         * arm.cc (Target_arm::got_section): Make .got section read-only
2540         if -z now is given.
2541
2542 2012-03-15  Ian Lance Taylor  <iant@google.com>
2543
2544         PR gold/13850
2545         * layout.cc (Layout::make_output_section): Correctly mark
2546         SHT_INIT_ARRAY, et. al., as relro.
2547
2548 2012-03-14  Doug Kwan  <dougkwan@google.com>
2549
2550         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2551         dynamic relocations for protected symbols in shared objects.
2552
2553 2012-03-13  Ian Lance Taylor  <iant@google.com>
2554
2555         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2556         keep the larger alignment.
2557
2558 2012-03-12  Cary Coutant  <ccoutant@google.com>
2559
2560         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2561         handling of DW_LNE_define_file.
2562
2563 2012-03-12  Cary Coutant  <ccoutant@google.com>
2564
2565         * reduced_debug_output.cc
2566         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2567         codes to switch.
2568
2569 2012-02-29  Cary Coutant  <ccoutant@google.com>
2570
2571         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2572
2573 2012-02-29  Cary Coutant  <ccoutant@google.com>
2574
2575         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2576         Call Object::decompressed_section_contents.
2577         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2578         New dtor.
2579         (Sized_dwarf_line_info::buffer_start_): New data member.
2580         * merge.cc (Output_merge_data::do_add_input_section): Call
2581         Object::decompressed_section_contents.
2582         (Output_merge_string::do_add_input_section): Likewise.
2583         * object.cc (need_decompressed_section): New function.
2584         (build_compressed_section_map): Decompress sections needed later.
2585         (Sized_relobj_file::do_decompressed_section_contents): New function.
2586         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2587         * object.h (Object::decompressed_section_contents): New function.
2588         (Object::discard_decompressed_sections): New function.
2589         (Object::do_decompressed_section_contents): New function.
2590         (Object::do_discard_decompressed_sections): New function.
2591         (Compressed_section_info): New type.
2592         (Compressed_section_map): Include decompressed section contents.
2593         (Sized_relobj_file::do_decompressed_section_contents): New function.
2594         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2595
2596 2012-02-16  Cary Coutant  <ccoutant@google.com>
2597
2598         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2599         * testsuite/Makefile.in: Regenerate.
2600
2601 2012-02-14  Cary Coutant  <ccoutant@google.com>
2602
2603         * options.cc (General_options::finalize): Disallow -pie and -static.
2604
2605 2012-02-03  Doug Kwan  <dougkwan@google.com>
2606
2607         * arm.cc (Arm_relocate_functions::abs8,
2608         Arm_relocate_functions::abs16): Use
2609         Bits::has_signed_unsigned_overflow32.
2610         (Arm_relocate_functions::thm_abs8): Correct range of
2611         overflow check.
2612         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2613         in assertions.
2614
2615 2012-02-02  Doug Kwan  <dougkwan@google.com>
2616
2617         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2618         position independent outputs, not just shared objects.
2619
2620 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2621
2622         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2623         * configure: Regenerated.
2624
2625 2012-01-27  Ian Lance Taylor  <iant@google.com>
2626
2627         * reloc.h (Bits): New class with static functions, copied from
2628         namespace utils in arm.cc.
2629         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2630         instead.
2631
2632 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2633
2634         * incremental.cc (write_info_blocks): Correct relocation offset.
2635
2636 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2637
2638         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2639         (Relocate::tls_gd_to_le): Likewise.
2640
2641 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2642
2643         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2644
2645 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2646
2647         * configure.ac: Check if -mcmodel=medium works.
2648         * configure: Regenerated.
2649
2650 2012-01-24  Cary Coutant  <ccoutant@google.com>
2651
2652         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2653         definition and ...
2654         (read_unsigned_LEB_128_x): ... this new function.
2655         (read_signed_LEB_128): Replaced with inline definition and ...
2656         (read_signed_LEB_128_x): ... this new function.
2657         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2658         (read_unsigned_LEB_128): Add inline definition.
2659         (read_signed_LEB_128_x): New function.
2660         (read_signed_LEB_128): Add inline definition.
2661         * testsuite/Makefile.am (leb128_unittest): New unit test.
2662         * testsuite/Makefile.in: Regenerate.
2663         * testsuite/leb128_unittest.cc: New unit test.
2664
2665 2012-01-23  Ian Lance Taylor  <iant@google.com>
2666
2667         PR gold/13617
2668         * i386.cc (Target_i386::do_code_fill): When using a jmp
2669         instruction, pad with nop instructions.
2670         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2671
2672 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2673
2674         * x86_64.cc (gc_process_relocs): Add typename on types used in
2675         template.
2676         (scan_relocs): Likewise.
2677         (relocate_section): Likewise.
2678         (apply_relocation): Likewise.
2679
2680 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2681
2682         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2683         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2684         under x32.
2685
2686 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2687
2688         * x86_64.cc: Initial support for x32.
2689
2690 2012-01-03  Cary Coutant  <ccoutant@google.com>
2691
2692         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2693         Use abstract base class for GOT.
2694         * gold/output.h (class Output_data_got_base): New abstract base class.
2695         (class Output_data_got): Derive from new base class, adjust ctors.
2696         (Output_data_got::reserve_slot): Make virtual; rename to
2697         do_reserve_slot; Adjust callers.
2698         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2699         pointer to abstract base class.
2700         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2701
2702 2011-12-18  Ian Lance Taylor  <iant@google.com>
2703
2704         * object.h (Relobj::local_symbol_value): New function.
2705         (Relobj::local_plt_offset): New function.
2706         (Relobj::local_has_got_offset): New function.
2707         (Relobj::local_got_offset): New function.
2708         (Relobj::set_local_got_offset): New function.
2709         (Relobj::do_local_symbol_value): New pure virtual function.
2710         (Relobj::do_local_plt_offset): Likewise.
2711         (Relobj::do_local_has_got_offset): Likewise.
2712         (Relobj::do_local_got_offset): Likewise.
2713         (Relobj::do_set_local_got_offset): Likewise.
2714         (Sized_relobj::do_local_has_got_offset): Rename from
2715         local_has_got_offset.
2716         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2717         (Sized_relobj::do_set_local_got_offset): Rename from
2718         set_local_got_offset.
2719         (Sized_relobj_file::do_local_plt_offset): Rename from
2720         local_plt_offset.
2721         (Sized_relobj_file::do_local_symbol_value): New function.
2722         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2723         local_plt_offset.
2724         * output.cc (Output_data_got::Got_entry::write): Change object to
2725         Relobj.  Use local_symbol_value.
2726         (Output_data_got::add_global_with_rel): Change rel_dyn to
2727         Output_data_reloc_generic*.  Use add_global_generic.
2728         (Output_data_got::add_global_with_rela): Remove.  Change all
2729         callers to use add_global_with_rel.
2730         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2731         Output_data_reloc_generic*.  Use add_global_generic.
2732         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2733         callers to use add_global_pair_with_rel.
2734         (Output_data_got::add_local): Change object to Relobj*.
2735         (Output_data_got::add_local_plt): Likewise.
2736         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2737         change rel_dyn to Output_data_reloc_generic*.  Use
2738         add_local_generic.
2739         (Output_data_got::add_local_with_rela): Remove.  Change all
2740         callers to use all_local_with_rel.
2741         (Output_data_got::add_local_pair_with_rel): Change object to
2742         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2743         add_output_section_generic.
2744         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2745         callers to use add_local_pair_with_rel.
2746         (Output_data_got::reserve_local): Change object to Relobj*.
2747         * output.h: (class Output_data_reloc_generic): Add pure virtual
2748         declarations for add_global_generic, add_local_generic,
2749         add_output_section_generic.
2750         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2751         functions for Output_data_reloc_generic.  Update declarations for
2752         changes listed in output.cc.
2753         (class Output_data_got): Change template parameter to got_size.
2754         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2755         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2756         function.
2757         (Sized_relobj_incr::do_local_plt_offset): New function.
2758         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2759         add_global_generic.
2760
2761 2011-12-17  Cary Coutant  <ccoutant@google.com>
2762
2763         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2764         * resolve.cc (Symbol_table::resolve): Likewise.
2765         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2766         arrays.
2767         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2768
2769 2011-12-16  Ian Lance Taylor  <iant@google.com>
2770
2771         * output.h (Output_data_reloc_generic::add): Only call
2772         add_dynamic_reloc if this is a dynamic reloc section.
2773
2774 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2775
2776         PR gold/13505
2777         * target-reloc.h (apply_relocation): Replace <64, false> with
2778         <size, big_endian>.
2779
2780 2011-11-25  Nick Clifton  <nickc@redhat.com>
2781
2782         * po/it.po: New Italian translation.
2783
2784 2011-11-17  Sterling Augustine  <saugustine@google.com>
2785
2786         * script.cc (script_include_directive): Implement.
2787         (read_script_file): New local variables name and search_path. Update
2788         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2789         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2790         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2791
2792 2011-11-11  Sterling Augustine  <saugustine@google.com>
2793
2794         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2795         (file_or_sections_cmd): Likewise.
2796
2797 2011-11-11  Doug Kwan  <dougkwan@google.com>
2798
2799         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2800         if --just-symbols is given.
2801
2802 2011-11-10  Doug Kwan  <dougkwan@google.com>
2803
2804         PR gold/13362
2805         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2806         when processing data relocs.
2807         * reloc.h (Relocate_functions::rel_unaligned): New method.
2808         (Relocate_functions::pcrel_unaligned): Ditto.
2809         (Relocate_functions::rel32_unaligned): Ditto.
2810         (Relocate_functions::pcrel32_unaligned): Ditto.
2811
2812 2011-11-09  Doug Kwan  <dougkwan@google.com>
2813
2814         PR gold/13362
2815         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2816         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2817         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2818         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2819         (Relocate_functions::rel_unaligned): New.
2820         (Relocate_functions::rel32_unaligned): New.
2821         * target-reloc.h (relocate_for_relocatable): Add code to handle
2822         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2823         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2824         arm_unaligned_reloc_r): New targets.
2825         * testsuite/Makefile.in: Regenerate.
2826         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2827         linking.
2828
2829 2011-11-02  Ian Lance Taylor  <iant@google.com>
2830
2831         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2832         NATIVE_LINKER.
2833         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2834         * options.cc (General_options::finalize): Use library search path
2835         from configure script if specified.  If not native and no sysroot,
2836         only search TOOLLIBDIR.
2837         * options.h (Search_directory::Search_directory): Change name to
2838         const std::string&.
2839         (General_options::add_to_library_path_with_sysroot): Change arg to
2840         const std::string&.
2841         * configure, Makefile.in, config.in: Rebuild.
2842
2843 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2844
2845         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2846         we are working around the ARM1176 Erratum.
2847         * options.h (General_options::fix_arm1176): Add option.
2848         * testsuite/Makefile.am: Add testcases, and keep current ones
2849         working.
2850         * testsuite/Makefile.in: Regenerate.
2851         * testsuite/arm_fix_1176.s: New file.
2852         * testsuite/arm_fix_1176.sh: Likewise.
2853
2854 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2855
2856         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2857         may_use_blx_.
2858         (Target_arm::may_use_blx): Remove method.
2859         (Target_arm::set_may_use_blx): Likewise.
2860         (Target_arm::may_use_v4t_interworking): New method.
2861         (Target_arm::may_use_v5t_interworking): Likewise.
2862         (Target_arm::may_use_blx_): Remove member variable.
2863         (Arm_relocate_functions::arm_branch_common): Check for v5T
2864         interworking.
2865         (Arm_relocate_functions::thumb_branch_common): Likewise.
2866         (Reloc_stub::stub_type_for_reloc): Likewise.
2867         (Target_arm::do_finalize_sections): Correct interworking checks.
2868         * testsuite/Makefile.am: Add new tests.
2869         * testsuite/Makefile.in: Regenerate.
2870         * testsuite/arm_farcall_arm_arm.s: New test.
2871         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2872         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2873         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2874         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2875         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2876         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2877         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2878
2879 2011-10-31  Cary Coutant  <ccoutant@google.com>
2880
2881         PR gold/13023
2882         * expression.cc (Expression::eval_with_dot): Add
2883         is_section_dot_assignment parameter.
2884         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2885         absolute and assigning to dot within a section.
2886         * script-sections.cc
2887         (Output_section_element_assignment::set_section_addresses): Pass
2888         dot_section to set_if_absolute.
2889         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
2890         as is_section_dot_assignment flag to eval_with_dot.
2891         (Output_section_element_dot_assignment::set_section_addresses):
2892         Likewise.
2893         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
2894         parameter.  Also set value if relative to dot_section; set the
2895         symbol's output_section.
2896         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
2897         parameter.  Adjust all callers.
2898         (Expression::eval_maybe_dot): Likewise.
2899         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
2900         Adjust all callers.
2901         * testsuite/script_test_2.t: Test assignment of an absolute value
2902         to dot within an output section element.
2903
2904 2011-10-31  Cary Coutant  <ccoutant@google.com>
2905
2906         * options.h (class General_options): Add --[no-]gnu-unique options.
2907         * symtab.cc (Symbol_table::sized_write_globals): Convert
2908         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
2909
2910 2011-10-31  Cary Coutant  <ccoutant@google.com>
2911
2912         PR gold/13359
2913         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
2914         unnecessary assertion.
2915         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
2916
2917 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
2918
2919         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2920         gc_mark_symbol.
2921         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
2922         gc_mark_symbol.
2923         Change to just keep the section associated with symbol.
2924         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
2925         they are externally visible and --export-dynamic is turned on.
2926         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
2927
2928 2011-10-19  Ian Lance Taylor  <iant@google.com>
2929
2930         PR gold/13163
2931         * script-sections.cc
2932         (Output_section_element_dot_assignment::needs_output_section): New
2933         function.
2934
2935 2011-10-19  Ian Lance Taylor  <iant@google.com>
2936
2937         PR gold/13204
2938         * layout.cc (Layout::segment_precedes): Don't assert failure if a
2939         --section-start option was seen.
2940         * options.h (General_options::any_section_start): New function.
2941
2942 2011-10-18  David S. Miller  <davem@davemloft.net>
2943
2944         PR binutils/13301
2945         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
2946         member to track relocation locations that have moved during TLS
2947         reloc optimizations.
2948         (Target_sparc::Relocate::Relocate): Initialize to NULL.
2949         (Target_sparc::Relocate::relocate): Adjust view down by 4
2950         bytes if it matches reloc_adjust_addr_.
2951         (Target_sparc::Relocate::relocate_tls): Always move the
2952         __tls_get_addr call delay slot instruction forward 4 bytes when
2953         performing relaxation.
2954
2955 2011-10-18  Cary Coutant  <ccoutant@google.com>
2956
2957         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
2958         (Output_file::map_no_anonymous): Check for non-zero
2959         return code from posix_fallocate.
2960
2961 2011-10-17  Cary Coutant  <ccoutant@google.com>
2962
2963         PR gold/13245
2964         * plugin.cc (is_visible_from_outside): Check for symbols
2965         referenced from dynamic objects.
2966         * resolve.cc (Symbol_table::resolve): Don't count references
2967         from dynamic objects as references from real ELF files.
2968         * testsuite/plugin_test_2.sh: Adjust expected result.
2969
2970 2011-10-17  Cary Coutant  <ccoutant@google.com>
2971
2972         * gold.cc: Include timer.h.
2973         (queue_middle_tasks): Stamp time.
2974         (queue_final_tasks): Likewise.
2975         * main.cc (main): Store timer in parameters.  Print timers
2976         for each pass.
2977         * parameters.cc (Parameters::Parameters): Initialize timer_.
2978         (Parameters::set_timer): New function.
2979         (set_parameters_timer): New function.
2980         * parameters.h (Parameters::set_timer): New function.
2981         (Parameters::timer): New function.
2982         (Parameters::timer_): New data member.
2983         (set_parameters_timer): New function.
2984         * timer.cc (Timer::stamp): New function.
2985         (Timer::get_pass_time): New function.
2986         * timer.h (Timer::stamp): New function.
2987         (Timer::get_pass_time): New function.
2988         (Timer::pass_times_): New data member.
2989
2990 2011-10-17  Cary Coutant  <ccoutant@google.com>
2991
2992         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
2993         task for members of lib groups.
2994
2995 2011-10-17  Cary Coutant  <ccoutant@google.com>
2996
2997         PR gold/13288
2998         * fileread.cc (File_read::find_view): Add assert.
2999         (File_read::make_view): Move bounds check (replace with assert)...
3000         (File_read::find_or_make_view): ... to here.
3001
3002 2011-10-12  Cary Coutant  <ccoutant@google.com>
3003
3004         * output.cc (Output_file::open_base_file): Handle case where
3005         ::read returns less than requested size.
3006
3007 2011-10-10  Cary Coutant  <ccoutant@google.com>
3008
3009         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3010         Initialize defined_count_.
3011         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3012         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3013         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3014         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3015         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3016         * incremental.h (Sized_relobj_incr::defined_count_): New data
3017         member.
3018         (Sized_incr_dynobj::defined_count_): New data member.
3019         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3020         Return zeroes instead of internal error.
3021
3022 2011-10-10  Cary Coutant  <ccoutant@google.com>
3023
3024         PR gold/13249
3025         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3026         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3027         * output.h (class Output_reloc): Add use_plt_offset flag.
3028         (Output_reloc::type_): Adjust size of bit field.
3029         (Output_reloc::use_plt_offset_): New bit field.
3030         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3031         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3032         flag.  Adjust all callers.
3033         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3034         creating RELATIVE relocations.
3035
3036 2011-10-10  Nick Clifton  <nickc@redhat.com>
3037
3038         * po/es.po: Updated Spanish translation.
3039         * po/fi.po: Updated Finnish translation.
3040
3041 2011-10-03   Diego Novillo  <dnovillo@google.com>
3042
3043         * options.cc (parse_uint): Fix dereference of RETVAL.
3044
3045 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3046
3047         * layout.h (section_order_map_): New member.
3048         (get_section_order_map): New member function.
3049         * output.cc (Output_section::add_input_section): Check for patterns
3050         only when --section-ordering-file is specified.
3051         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3052         output_sections have been formed.
3053         * layout.cc (Layout_Layout): Initialize section_order_map_.
3054         * plugin.cc (update_section_order): Store order in order_map. Do not
3055         update the order.
3056         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3057         * testsuite/Makefile.in: Regenerate.
3058         * testsuite/plugin_section_order.c: New file.
3059         * testsuite/plugin_final_layout.cc: New file.
3060         * testsuite/plugin_final_layout.sh: New file.
3061
3062 2011-09-29  Cary Coutant  <ccoutant@google.com>
3063
3064         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3065         Check for NULL.
3066         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3067         symbols during incremental update.
3068         (Symbol_table::add_from_dynobj): Likewise.
3069
3070 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3071             Ian Lance Taylor  <iant@google.com>
3072
3073         * symtab.cc (Symbol_table::define_special_symbol): Always
3074         canonicalize version string.
3075
3076 2011-09-26  Cary Coutant  <ccoutant@google.com>
3077
3078         * gold.cc (queue_initial_tasks): Move option checks ...
3079         * options.cc (General_options::finalize): ... to here. Disable
3080         some options; make others fatal.
3081
3082 2011-09-26  Cary Coutant  <ccoutant@google.com>
3083
3084         gcc PR lto/47247
3085         * plugin.cc (get_symbols_v2): New function.
3086         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3087         (is_referenced_from_outside): New function.
3088         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3089         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3090         (get_symbols): Pass version parameter.
3091         (get_symbols_v2): New function.
3092         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3093         parameter.
3094         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3095         (onload): Add LDPT_GET_SYMBOLS_V2.
3096         (all_symbols_read_hook): Use get_symbols_v2; check for
3097         LDPR_PREVAILING_DEF_IRONLY_EXP.
3098         * testsuite/plugin_test_3.sh: Update expected results.
3099
3100 2011-09-23  Simon Baldwin  <simonb@google.com>
3101
3102         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3103         configuration options.
3104         * configure: Regenerate.
3105         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3106         * Makefile.in: Regenerate.
3107         * testsuite/Makefile.in: Regenerate.
3108
3109 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3110
3111         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3112
3113 2011-09-19  Cary Coutant  <ccoutant@google.com>
3114
3115         * incremental.cc (can_incremental_update): Fix typo in comment.
3116         * incremental.h (can_incremental_update): Likewise.
3117
3118 2011-09-18  Cary Coutant  <ccoutant@google.com>
3119
3120         * incremental.cc (can_incremental_update): New function.
3121         * incremental.h (can_incremental_update): New function.
3122         * layout.cc (Layout::init_fixed_output_section): Call it.
3123         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3124         * object.cc (Sized_relobj_file::do_layout): Call
3125         can_incremental_update.
3126
3127 2011-09-13  Cary Coutant  <ccoutant@google.com>
3128
3129         * configure.ac: Check for glibc support for gnu_indirect_function
3130         support with static linking, setting automake conditional
3131         IFUNC_STATIC.
3132         * Makefile.in: Regenerate.
3133         * configure: Regenerate.
3134
3135         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3136         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3137         for IFUNC_STATIC.
3138         * testsuite/Makefile.in: Regenerate.
3139
3140 2011-09-13  Cary Coutant  <ccoutant@google.com>
3141
3142         * incremental.cc (Sized_relobj_incr::do_layout): Call
3143         report_comdat_group for kept comdat sections.
3144         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3145         * testsuite/Makefile.in: Regenerate.
3146         * testsuite/incr_comdat_test_1.cc: New source file.
3147         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3148         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3149         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3150
3151 2011-09-13  Ian Lance Taylor  <iant@google.com>
3152
3153         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3154         variable external_symbols_offset.
3155
3156 2011-09-12  Ian Lance Taylor  <iant@google.com>
3157
3158         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3159         triggered if object has no symbols.
3160
3161 2011-09-09  David S. Miller  <davem@davemloft.net>
3162
3163         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3164         (Output_fill_debug_line::do_write): Likewise.
3165
3166 2011-08-29  Cary Coutant  <ccoutant@google.com>
3167
3168         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3169         casts to match formatting specs.
3170         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3171
3172 2011-08-26  Cary Coutant  <ccoutant@google.com>
3173
3174         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3175         remaining hole size when allocating.
3176         (Layout::make_output_section): Set fill methods for debug sections.
3177         * layout.h (Free_list::Free_list_node): Move from private to
3178         public.
3179         (Free_list::set_min_hole_size): New function.
3180         (Free_list::begin, Free_list::end): New functions.
3181         (Free_list::min_hole_): New data member.
3182         * output.cc: Include dwarf.h.
3183         (Output_fill_debug_info::do_minimum_hole_size): New function.
3184         (Output_fill_debug_info::do_write): New function.
3185         (Output_fill_debug_line::do_minimum_hole_size): New function.
3186         (Output_fill_debug_line::do_write): New function.
3187         (Output_section::Output_section): Initialize new data member.
3188         (Output_section::set_final_data_size): Ensure patch space is larger
3189         than minimum hole size.
3190         (Output_section::do_write): Fill holes in debug sections.
3191         * output.h (Output_fill): New class.
3192         (Output_fill_debug_info): New class.
3193         (Output_fill_debug_line): New class.
3194         (Output_section::set_free_space_fill): New function.
3195         (Output_section::free_space_fill_): New data member.
3196         * testsuite/Makefile.am (incremental_test_3): Add
3197         --incremental-patch option.
3198         (incremental_test_4): Likewise.
3199         (incremental_test_5): Likewise.
3200         (incremental_test_6): Likewise.
3201         (incremental_copy_test): Likewise.
3202         (incremental_common_test_1): Likewise.
3203         * testsuite/Makefile.in: Regenerate.
3204
3205 2011-08-26  Nick Clifton  <nickc@redhat.com>
3206
3207         * po/es.po: Updated Spanish translation.
3208
3209 2011-08-01  Cary Coutant  <ccoutant@google.com>
3210
3211         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3212         * gold/testsuite/Makefile.in: Regenerate.
3213         * gold/testsuite/justsyms_exec.c: New source file.
3214         * gold/testsuite/justsyms_lib.c: New source file.
3215
3216 2011-08-01  Cary Coutant  <ccoutant@google.com>
3217
3218         * layout.cc (Layout::set_segment_offsets): Don't realign text
3219         segment if -Ttext was specified.
3220         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3221         file type.
3222         * object.h (Sized_relobj_file::e_type): New function.
3223         (Sized_relobj_file::e_type_): New data member.
3224         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3225         base address for ET_EXEC files.
3226         * target.cc (Target::do_make_elf_object_implementation): Allow
3227         ET_EXEC files with --just-symbols option.
3228
3229 2011-07-28  Cary Coutant  <ccoutant@google.com>
3230
3231         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3232         Add thread_number parameter.
3233         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3234         * workqueue-threads.cc
3235         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3236         current thread if its thread number is greater than desired thread
3237         count.
3238         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3239         Add thread_number parameter.
3240         (Workqueue::should_cancel_thread): Likewise.
3241         (Workqueue::find_runnable_or_wait): Pass thread_number to
3242         should_cancel_thread.
3243         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3244         parameter.
3245
3246 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3247
3248         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3249         only after checking if it cannot be forced local.
3250         * symtab.h (is_externally_visible): Check if the symbol is not forced
3251         local.
3252
3253 2011-07-15  Ian Lance Taylor  <iant@google.com>
3254
3255         * options.h (class General_options): Add --print-output-format.
3256         Move -EL next to -EB, for  better --help output.
3257         * target-select.cc: Include <cstdio>, "options.h", and
3258         "parameters.h".
3259         (Target_selector::do_target_bfd_name): New function.
3260         (print_output_format): New function.
3261         * target-select.h (class Target_selector): Update declarations.
3262         (Target_selector::target_bfd_name): New function.
3263         (print_output_format): Declare.
3264         * main.cc: Include "target-select.h".
3265         (main): Handle --print-output-format.
3266         * gold.cc: Include "target-select.h".
3267         (queue_initial_tasks): Handle --print-output-format when there are
3268         no input files.
3269         * parameters.cc (parameters_force_valid_target): Give a better
3270         error message if -EB/-EL does not match target.
3271         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3272         function.
3273
3274 2011-07-15  Ian Lance Taylor  <iant@google.com>
3275
3276         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3277         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3278         (Output_data_plt_i386::do_write): Write address of .dynamic
3279         section to first entry in .got.plt section.
3280         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3281         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3282         Initialize layout_.
3283         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3284         section to first entry in .got.plt section.
3285         * layout.h (Layout::dynamic_section): New function.
3286
3287 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3288
3289         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3290         to claim_file call.
3291         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3292         input_section_position_, and input_section_glob_.
3293         (read_layout_from_file): Call function section_ordering_specified.
3294         * layout.h (is_section_ordering_specified): New function.
3295         (section_ordering_specified): New function.
3296         (section_ordering_specified_): New boolean member.
3297         * main.cc(main): Call load_plugins after layout object is defined.
3298         * output.cc (Output_section::add_input_section): Use
3299         function section_ordering_specified to check if section ordering is
3300         needed.
3301         * output.cc (Output_section::add_relaxed_input_section): Use
3302         function section_ordering_specified to check if section ordering is
3303         needed.
3304         (Output_section::update_section_layout): New function.
3305         (Output_section::sort_attached_input_sections): Check if input section
3306         must be reordered.
3307         * output.h (Output_section::update_section_layout): New function.
3308         * plugin.cc (get_section_count): New function.
3309         (get_section_type): New function.
3310         (get_section_name): New function.
3311         (get_section_contents): New function.
3312         (update_section_order): New function.
3313         (allow_section_ordering): New function.
3314         (Plugin::load): Add the new interfaces to the transfer vector.
3315         (Plugin_manager::load_plugins): New parameter.
3316         (Plugin_manager::all_symbols_read): New parameter.
3317         (Plugin_manager::claim_file): New parameter. Save the elf object for
3318         unclaimed objects.
3319         (Plugin_manager::get_elf_object): New function.
3320         (Plugin_manager::get_view): Change to directly use the bool to check
3321         if get_view is called from claim_file_hook.
3322         * plugin.h (input_objects): New function
3323         (Plugin__manager::load_plugins): New parameter.
3324         (Plugin_manager::claim_file): New parameter.
3325         (Plugin_manager::get_elf_object): New function.
3326         (Plugin_manager::in_claim_file_handler): New function.
3327         (Plugin_manager::in_claim_file_handler_): New member.
3328         (layout): New function.
3329         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3330         handler with an extra parameter. Make the elf object before calling
3331         claim_file handler.
3332         * testsuite/plugin_test.c (get_section_count): New function pointer.
3333         (get_section_type): New function pointer.
3334         (get_section_name): New function pointer.
3335         (get_section_contents): New function pointer.
3336         (update_section_order): New function pointer.
3337         (allow_section_ordering): New function pointer.
3338         (onload): Check if the new interfaces exist.
3339
3340 2011-07-13  Ian Lance Taylor  <iant@google.com>
3341
3342         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3343         relro section.
3344         * x86_64.cc (Target_x86_64::got_section): Likewise.
3345         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3346         (relro_now_test_SOURCES): New variable.
3347         (relro_now_test_DEPENDENCIES): New variable.
3348         (relro_now_test_LDFLAGS): New variable.
3349         (relro_now_test_LDADD): New variable.
3350         (relro_now_test.so): New target.
3351         * testsuite/Makefile.in: Rebuild.
3352
3353 2011-07-12  Ian Lance Taylor  <iant@google.com>
3354
3355         PR gold/12980
3356         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3357         GLOB_DAT relocation rather than a RELATIVE relocation for a
3358         protected symbol when creating a shared library.
3359         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3360         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3361         * testsuite/protected_main_1.cc (main): Test that protected
3362         function has same address.
3363
3364 2011-07-11  Ian Lance Taylor  <iant@google.com>
3365
3366         PR gold/12979
3367         * options.h (class General_options): Add -Bgroup.
3368         * options.cc (General_options::finalize): If -Bgroup is set,
3369         default to --unresolved-symbols=report-all.
3370         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3371         * target-reloc.h (issue_undefined_symbol_error): Handle
3372         --unresolved-symbols=report-all.
3373
3374 2011-07-08  Ian Lance Taylor  <iant@google.com>
3375
3376         PR gold/11985
3377         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3378         if linker script discards key sections.
3379         (Layout::create_dynamic_symtab): Likewise.
3380         (Layout::assign_local_dynsym_offsets): Likewise.
3381         (Layout::sized_create_version_sections): Likewise.
3382         (Layout::create_interp): Likewise.
3383         (Layout::finish_dynamic_section): Likewise.
3384         (Layout::set_dynamic_symbol_size): Likewise.
3385
3386 2011-07-08  Ian Lance Taylor  <iant@google.com>
3387
3388         PR gold/12386
3389         * options.h (class General_options): Add --unresolved-symbols.
3390         * target-reloc.h (issue_undefined_symbol_error): Check
3391         --unresolved-symbols.  Add comments.
3392
3393 2011-07-08  Ian Lance Taylor  <iant@google.com>
3394
3395         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3396         expression more complex.
3397
3398 2011-07-08  Ian Lance Taylor  <iant@google.com>
3399
3400         PR gold/11317
3401         * target-reloc.h (issue_undefined_symbol_error): New inline
3402         function, broken out of relocate_section.
3403         (relocate_section): Call issue_undefined_symbol_error.
3404         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3405         there is no TLS segment if we are about to issue an undefined
3406         symbol error.
3407         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3408
3409 2011-07-08  Ian Lance Taylor  <iant@google.com>
3410
3411         PR gold/12279
3412         * resolve.cc (Symbol_table::should_override): Add fromtype
3413         parameter.  Change all callers.  Give error when linking together
3414         TLS and non-TLS symbol.
3415         (Symbol_table::should_override_with_special): Add fromtype
3416         parameter.  Change all callers.
3417         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3418         there is no TLS segment if we have reported some errors.
3419         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3420
3421 2011-07-08  Ian Lance Taylor  <iant@google.com>
3422
3423         PR gold/12372
3424         * target.h (Target::plt_address_for_global): New function.
3425         (Target::plt_address_for_local): New function.
3426         (Target::plt_section_for_global): Remove.
3427         (Target::plt_section_for_local): Remove.
3428         (Target::do_plt_address_for_global): New virtual function.
3429         (Target::do_plt_address_for_local): New virtual function.
3430         (Target::do_plt_section_for_global): Remove.
3431         (Target::do_plt_section_for_local): Remove.
3432         (Target::register_global_plt_entry): Add Symbol_table and Layout
3433         parameters.
3434         * output.cc (Output_data_got::Got_entry::write): Use
3435         plt_address_for_global and plt_address_for_local.
3436         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3437         address of output section.
3438         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3439         got_irelative_, and irelative_count_ fields.  Update
3440         declarations.
3441         (Output_data_plt_i386::has_irelative_section): New function.
3442         (Output_data_plt_i386::entry_count): Add irelative_count_.
3443         (Output_data_plt_i386::set_final_data_size): Likewise.
3444         (class Target_i386): Add got_irelative_ and rel_irelative_
3445         fields.  Update declarations.
3446         (Target_i386::Target_i386): Initialize new fields.
3447         (Target_i386::do_plt_address_for_global): New function replacing
3448         do_plt_section_for_global.
3449         (Target_i386::do_plt_address_for_local): New function replacing
3450         do_plt_section_for_local.
3451         (Target_i386::got_section): Create got_irelative_.
3452         (Target_i386::rel_irelative_section): New function.
3453         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3454         fields.  Don't define __rel_iplt_{start,end}.
3455         (Output_data_plt_i386::add_entry): Add symtab and layout
3456         parameters.  Change all callers.  Use different PLT and GOT for
3457         IFUNC symbols.
3458         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3459         layout parameters.  Change all callers.  Use different PLT and
3460         GOT.
3461         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3462         (Output_data_plt_i386::rel_irelative): New function.
3463         (Output_data_plt_i386::address_for_global): New function.
3464         (Output_data_plt_i386::address_for_local): New function.
3465         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3466         IRELATIVE GOT when changing IFUNC GOT entries.
3467         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3468         reloc.
3469         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3470         if we didn't create an IRELATIVE GOT.
3471         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3472         plt_address_for_local.
3473         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3474         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3475         got_irelative_, and irelative_count_ fields.  Update
3476         declarations.
3477         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3478         Initialize new fields.  Remove symtab parameter.  Change all
3479         callers.
3480         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3481         irelative_count_.
3482         (Output_data_plt_x86_64::has_irelative_section): New function.
3483         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3484         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3485         fields.  Update declarations.
3486         (Target_x86_64::Target_x86_64): Initialize new fields.
3487         (Target_x86_64::do_plt_address_for_global): New function replacing
3488         do_plt_section_for_global.
3489         (Target_x86_64::do_plt_address_for_local): New function replacing
3490         do_plt_section_for_local.
3491         (Target_x86_64::got_section): Create got_irelative_.
3492         (Target_x86_64::rela_irelative_section): New function.
3493         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3494         all callers.  Don't create __rel_iplt_{start,end}.
3495         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3496         parameters.  Change all callers.  Use different PLT and GOT for
3497         IFUNC symbols.
3498         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3499         layout parameters.  Change all callers.  Use different PLT and
3500         GOT.
3501         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3502         parameters.  Change all callers.  Use different PLT and GOT for
3503         IFUNC symbols.
3504         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3505         (Output_data_plt_x86_64::rela_irelative): New function.
3506         (Output_data_plt_x86_64::address_for_global): New function.
3507         (Output_data_plt_x86_64::address_for_local): New function.
3508         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3509         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3510         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3511         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3512         parameters.
3513         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3514         reloc.
3515         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3516         symbols if we didn't create an IRELATIVE GOT.
3517         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3518         plt_address_for_local.
3519         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3520         * testsuite/ifuncvar1.c: New test file.
3521         * testsuite/ifuncvar2.c: New test file.
3522         * testsuite/ifuncvar3.c: New test file.
3523         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3524         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3525         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3526         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3527         * testsuite/Makefile.in: Rebuild.
3528
3529 2011-07-07  Cary Coutant  <ccoutant@google.com>
3530
3531         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3532         (two_file_test_1_ndebug.o): Likewise.
3533         (two_file_test_1b_ndebug.o): Likewise.
3534         (two_file_test_2_ndebug.o): Likewise.
3535         (two_file_test_main_ndebug.o): Likewise.
3536         (incremental_test_2): Link with no-debug versions.
3537
3538 2011-07-06  Cary Coutant  <ccoutant@google.com>
3539
3540         * gold/incremental.cc
3541         (Output_section_incremental_inputs::write_info_blocks): Check for
3542         hidden and internal symbols.
3543
3544 2011-07-06  Cary Coutant  <ccoutant@google.com>
3545
3546         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3547         Check disposition for startup file.
3548         (Incremental_inputs::report_command_line): Ignore
3549         --incremental-startup-unchanged option.
3550         * options.cc (General_options::parse_incremental_startup_unchanged):
3551         New function.
3552         (General_options::General_options): Initialize new data member.
3553         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3554         (General_options): Add --incremental-startup-unchanged option.
3555         (General_options::incremental_startup_disposition): New function.
3556         (General_options::incremental_startup_disposition_): New data member.
3557
3558 2011-07-06  Cary Coutant  <ccoutant@google.com>
3559
3560         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3561         input file index to Script_info ctor.
3562         (Sized_incremental_binary::do_file_has_changed): Find the
3563         command-line argument for files named in scripts.
3564         * incremental.h (Script_info::Script_info): New ctor
3565         with input file index.
3566         (Script_info::input_file_index): New function.
3567         (Script_info::input_file_index_): New data member.
3568         (Incremental_binary::get_library): Add const.
3569         (Incremental_binary::get_script_info): Add const.
3570         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3571         * testsuite/Makefile.am (incremental_test_5): New test case.
3572         (incremental_test_6): New test case.
3573         * testsuite/Makefile.in: Regenerate.
3574
3575 2011-07-06  Cary Coutant  <ccoutant@google.com>
3576
3577         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3578         debug output when command lines differ.
3579
3580 2011-07-06  Cary Coutant  <ccoutant@google.com>
3581
3582         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3583         --incremental-patch option.
3584         * layout.cc (Free_list::allocate): Extend allocation beyond original
3585         end if enabled.
3586         (Layout::make_output_section): Mark sections that should get
3587         patch space.
3588         * options.cc (parse_percent): New function.
3589         * options.h (parse_percent): New function.
3590         (DEFINE_percent): New macro.
3591         (General_options): Add --incremental-patch option.
3592         * output.cc (Output_section::Output_section): Initialize new data
3593         members.
3594         (Output_section::add_input_section): Print section name when out
3595         of patch space.
3596         (Output_section::add_output_section_data): Likewise.
3597         (Output_section::set_final_data_size): Add patch space when
3598         doing --incremental-full.
3599         (Output_section::do_reset_address_and_file_offset): Remove patch
3600         space.
3601         (Output_segment::set_section_list_addresses): Print debug output
3602         only if --incremental-update.
3603         * output.h (Output_section::set_is_patch_space_allowed): New function.
3604         (Output_section::is_patch_space_allowed_): New data member.
3605         (Output_section::patch_space_): New data member.
3606         * parameters.cc (Parameters::incremental_full): New function.
3607         * parameters.h (Parameters::incremental_full): New function
3608         * testsuite/Makefile.am (incremental_test_2): Add test for
3609         --incremental-patch option.
3610         * testsuite/Makefile.in: Regenerate.
3611         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3612         (t18): Remove function body.
3613
3614 2011-07-05  Doug Kwan  <dougkwan@google.com>
3615
3616         PR gold/12771
3617         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3618         Arm_Address type for relocation result.
3619         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3620         overflow check.
3621         (Arm_relocate_functions::abs32): Use unaligned access.
3622         (Arm_relocate_functions::rel32): Ditto.
3623         (Arm_relocate_functions::prel31): Ditto.
3624         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3625         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3626         static data relocations.
3627         * testsuite/Makefile.in: Regnerate.
3628         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3629
3630 2011-07-05  Ian Lance Taylor  <iant@google.com>
3631
3632         PR gold/12392
3633         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3634         symbols if necessary.
3635         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3636
3637 2011-07-05  Ian Lance Taylor  <iant@google.com>
3638
3639         PR gold/12952
3640         * resolve.cc (Symbol::override_base_with_special): Simply override
3641         version with special symbol version, ignoring previous version.
3642
3643 2011-07-05  Ian Lance Taylor  <iant@google.com>
3644
3645         * object.cc (Sized_relobj_file::include_section_group): Add
3646         information to comment about signature location.
3647
3648 2011-07-02  Ian Lance Taylor  <iant@google.com>
3649
3650         PR gold/12957
3651         * options.h (class General_options): Add -f and -F.
3652         * options.cc (General_options::finalize): Fatal error if -f/-F
3653         are used without -shared.
3654         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3655
3656 2011-07-02  Ian Lance Taylor  <iant@google.com>
3657
3658         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3659
3660 2011-07-01  Ian Lance Taylor  <iant@google.com>
3661
3662         PR gold/12525
3663         PR gold/12952
3664         * resolve.cc (Symbol::override_base_with_special): Don't override
3665         the version if the overriding symbol has a different name.
3666         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3667         all callers.  If we give an error about an undefined version,
3668         define the base version if necessary.
3669         * dynobj.h (class Versions): Update declaration.
3670         * testsuite/weak_alias_test_5.cc: New file.
3671         * testsuite/weak_alias_test.script: New file.
3672         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3673         and versioned_alias have the right value, and call t2.
3674         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3675         weak_alias_test_5.so.
3676         (weak_alias_test_LDADD): Likewise.
3677         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3678         * testsuite/Makefile.in: Rebuild.
3679
3680 2011-07-01  Ian Lance Taylor  <iant@google.com>
3681
3682         PR gold/12525
3683         * options.h (class General_options): Support -z notext.
3684         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3685         -Wl,-z,notext.
3686         (two_file_shared_nonpic.so): Likewise.
3687         (two_file_shared_mixed.so): Likewise.
3688         (two_file_shared_mixed_1.so): Likewise.
3689         (weak_undef_lib_nonpic.so): Likewise.
3690         (alt/weak_undef_lib_nonpic.so): Likewise.
3691         (tls_test_shared_nonpic.so): Likewise.
3692         * testsuite/Makefile.in: Rebuild.
3693
3694 2011-07-01  Ian Lance Taylor  <iant@google.com>
3695
3696         PR gold/12525
3697         * configure.ac: Test whether static linking works, setting
3698         the automake conditional HAVE_STATIC.
3699         * testsuite/Makefile.am: Disable tests using -static if
3700         HAVE_STATIC is not true.
3701         * configure, testsuite/Makefile.in: Rebuild.
3702
3703 2011-07-01  Ian Lance Taylor  <iant@google.com>
3704
3705         PR gold/12525
3706         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3707         Assert if we see DW_EH_PE_indirect.
3708         * target.h (Target::ehframe_datarel_base): New function.
3709         (Target::do_ehframe_datarel_base): New target function.
3710         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3711         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3712         function.
3713
3714 2011-07-01  Ian Lance Taylor  <iant@google.com>
3715
3716         PR gold/12571
3717         * options.h (class General_options): Add
3718         --ld-generated-unwind-info.
3719         * ehframe.cc (Fde::write): Add address parameter.  Change all
3720         callers.  If associated with PLT, fill in address and size.
3721         (Cie::set_output_offset): Only add merge mapping if there is an
3722         object.
3723         (Cie::write): Add address parameter.  Change all callers.
3724         (Eh_frame::add_ehframe_for_plt): New function.
3725         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3726         input_offset_ fields into union u_, with new plt field.
3727         (Fde::Fde): Adjust for new union field.
3728         (Fde::Fde) [Output_data version]: New constructor.
3729         (Fde::add_mapping): Only add merge mapping if there is an object.
3730         (class Cie): Update declarations.
3731         (class Eh_frame): Declare add_ehframe_for_plt.
3732         * layout.cc (Layout::layout_eh_frame): Break out code into
3733         make_eh_frame_section, and call it.
3734         (Layout::make_eh_frame_section): New function.
3735         (Layout::add_eh_frame_for_plt): New function.
3736         * layout.h (class Layout): Update declarations.
3737         * merge.cc (Merge_map::add_mapping): Add assertion.
3738         * i386.cc: Include "dwarf.h".
3739         (class Output_data_plt_i386): Make first_plt_entry,
3740         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3741         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3742         and plt_eh_frame_fde.
3743         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3744         boundary.  Call add_eh_frame_for_plt if appropriate.
3745         * x86_64.cc: Include "dwarf.h".
3746         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3747         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3748         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3749         and plt_eh_frame_fde.
3750         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3751         appropriate.
3752
3753 2011-06-29  Ian Lance Taylor  <iant@google.com>
3754
3755         PR gold/12629
3756         * object.cc (Sized_relobj_file::layout_section): Change shdr
3757         parameter to be const.
3758         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3759         out of do_layout.
3760         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3761         appropriate.  Call layout_eh_frame_section.
3762         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3763         sections.
3764         * object.h (class Sized_relobj_file): Update declarations.
3765
3766 2011-06-29  Ian Lance Taylor  <iant@google.com>
3767
3768         PR gold/12652
3769         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3770         modifier.
3771         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3772
3773 2011-06-29  Ian Lance Taylor  <iant@google.com>
3774
3775         PR gold/12675
3776         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3777         SHT_X86_64_UNWIND.
3778         * layout.cc (Layout::layout_eh_frame): Likewise.
3779
3780 2011-06-29  Ian Lance Taylor  <iant@google.com>
3781
3782         PR gold/12695
3783         * layout.cc (Layout::symtab_section_shndx): New function.
3784         * layout.h (class Layout): Declare symtab_section_shndx.
3785         * output.cc (Output_section::write_header): Call it.
3786
3787 2011-06-29  Ian Lance Taylor  <iant@google.com>
3788
3789         PR gold/12818
3790         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3791         symbols which are not used in a relocation.
3792
3793 2011-06-28  Ian Lance Taylor  <iant@google.com>
3794
3795         PR gold/12898
3796         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3797         script create indistinguishable segments.
3798         (Layout::set_segment_offsets): Use stable_sort when sorting
3799         segments.  Pass this to Compare_segments constructor.
3800         * layout.h (class Layout): Make segment_precedes non-static.
3801         (class Compare_segments): Change from struct to class.  Add
3802         layout_ field.  Add constructor.
3803         * script-sections.cc
3804         (Script_sections::attach_sections_using_phdrs_clause): Rename
3805         local orphan to is_orphan.  Don't report failure to put empty
3806         section in segment.  On attachment failure, report name of
3807         section, and attach to first PT_LOAD segment.
3808
3809 2011-06-28  Ian Lance Taylor  <iant@google.com>
3810
3811         PR gold/12934
3812         * target-select.cc (Target_selector::Target_selector): Add
3813         emulation parameter.  Change all callers.
3814         (select_target_by_bfd_name): Rename from select_target_by_name.
3815         Change all callers.
3816         (select_target_by_emulation): New function.
3817         (supported_emulation_names): New function.
3818         * target-select.h (class Target_selector): Add emulation_ field.
3819         Update declarations.
3820         (Target_selector::recognize_by_bfd_name): Rename from
3821         recognize_by_name.  Change all callers.
3822         (Target_selector::supported_bfd_names): Rename from
3823         supported_names.  Change all callers.
3824         (Target_selector::recognize_by_emulation): New function.
3825         (Target_selector::supported_emulations): New function.
3826         (Target_selector::emulation): New function.
3827         (Target_selector::do_recognize_by_bfd_name): Rename from
3828         do_recognize_by_name.  Change all callers.
3829         (Target_selector::do_supported_bfd_names): Rename from
3830         do_supported_names.  Change all callers.
3831         (Target_selector::do_recognize_by_emulation): New function.
3832         (Target_selector::do_supported_emulations): New function.
3833         (select_target_by_bfd_name): Change name in declaration.
3834         (select_target_by_emulation): Declare.
3835         (supported_emulation_names): Declare.
3836         * parameters.cc (parameters_force_valid_target): Try to find
3837         target based on emulation from -m option.
3838         * options.h (class General_options): Change doc string for -m.
3839         * options.cc (help): Print emulations.
3840         (General_options::parse_V): Likewise.
3841         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3842         Add emulation parameter.  Change all callers.
3843
3844 2011-06-28  Ian Lance Taylor  <iant@google.com>
3845
3846         * target.h (class Target): Add osabi_ field.
3847         (Target::osabi): New function.
3848         (Target::set_osabi): New function.
3849         (Target::Target): Initialize osabi_.
3850         (Target::do_adjust_elf_header): Make pure virtual.
3851         (Sized_target::do_adjust_elf_header): Declare.
3852         * target.cc (Sized_target::do_adjust_elf_header): New function.
3853         (class Sized_target): Instantiate all versions.
3854         * freebsd.h (class Target_freebsd): Remove.
3855         (Target_selector_freebsd::do_recognize): Call set_osabi on
3856         Target.
3857         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3858         (Target_selector_freebsd::set_osabi): Remove.
3859         * i386.cc (class Target_i386): Inherit from Sized_target rather
3860         than Target_freebsd.
3861         * x86_64.cc (class Target_x86_64): Likewise.
3862
3863 2011-06-28  Ian Lance Taylor  <iant@google.com>
3864
3865         * target.h (Target::can_check_for_function_pointers): Rewrite.
3866         Make non-virtual.
3867         (Target::can_icf_inline_merge_sections): Likewise.
3868         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3869         (Target::Target_info): Add can_icf_inline_merge_sections field.
3870         (Target::do_can_check_for_function_pointers): New virtual
3871         function.
3872         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3873         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3874         from can_check_for_function_pointers, move in file.
3875         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3876         section_may_have_icf_unsafe_poineters, move in file.
3877         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3878         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3879         Rename from can_check_for_function_pointers, move in file.
3880         (Target_i386::can_icf_inline_merge_sections): Remove.
3881         (Target_i386::i386_info): Initialize
3882         can_icf_inline_merge_sections.
3883         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3884         Initialize can_icf_inline_merge_sections.
3885         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3886         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
3887         Rename from can_check_for_function_pointers, move in file.
3888         (Target_x86_64::can_icf_inline_merge_sections): Remove.
3889         (Target_x86_64::x86_64_info): Initialize
3890         can_icf_inline_merge_sections.
3891         * testsuite/testfile.cc (Target_test::test_target_info):
3892         Likewise.
3893         * icf.cc (get_section_contents): Correct formatting.
3894
3895 2011-06-27  Ian Lance Taylor  <iant@google.com>
3896
3897         * symtab.cc (Symbol::versioned_name): New function.
3898         (Symbol_table::add_to_final_symtab): Use versioned_name when
3899         appropriate.
3900         (Symbol_table::sized_write_symbol): Likewise.
3901         * symtab.h (class Symbol): Declare versioned_name.
3902         * stringpool.h (class Stringpool_template): Add variant of add
3903         which takes a std::basic_string.
3904         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
3905         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
3906         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
3907         (ver_test_12.o): New target.
3908         * testsuite/Makefile.in: Rebuild.
3909
3910 2011-06-27  Doug Kwan  <dougkwan@google.com>
3911
3912         * arm.cc (Arm_relocate_functions::thm_jump8,
3913         Arm_relocate_functions::thm_jump11): Use a wider signed
3914         type to compute offset.
3915         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
3916         arm_thm_jump8.
3917         * testsuite/Makefile.in: Regenerate.
3918         * testsuite/arm_branch_in_range.sh: Check test results of
3919         arm_thm_jump11 and arm_thm_jump8.
3920         * testsuite/arm_thm_jump11.s: New test source file.
3921         * testsuite/arm_thm_jump11.t: New linker script.
3922         * testsuite/arm_thm_jump8.s: New test source file.
3923         * testsuite/arm_thm_jump8.t: New linker script.
3924
3925 2011-06-24  Ian Lance Taylor  <iant@google.com>
3926
3927         * layout.cc: Include "object.h".
3928         (ctors_sections_in_init_array): New static variable.
3929         (Layout::is_ctors_in_init_array): New function.
3930         (Layout::layout): Add entry to ctors_sections_in_init_array if
3931         appropriate.
3932         * layout.h (class Layout): Declare is_ctors_in_init_array.
3933         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
3934         is_ctors_reverse_view is set.
3935         (Sized_relobj_file::write_sections): Add layout parameter.  Change
3936         all callers.  Set is_ctors_reverse_view field of View_size.
3937         (Sized_relobj_file::reverse_words): New function.
3938         * object.h (Sized_relobj_file::View_size): Add
3939         is_ctors_reverse_view field.
3940         (class Sized_relobj_file): Update declarations.
3941         * testsuite/initpri3.c: New test.
3942         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
3943         initpri3b.
3944         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
3945         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
3946         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
3947         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
3948         * testsuite/Makefile.in: Rebuild.
3949
3950 2011-06-24  Cary Coutant  <ccoutant@google.com>
3951
3952         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
3953         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
3954         (debug_msg_cdebug.err): New targets.
3955         * testsuite/Makefile.in: Regenerate.
3956         * testsuite/debug_msg.sh: Check output of link with compressed debug.
3957         Fix checks for link with shared library.
3958
3959 2011-06-24  Doug Kwan  <dougkwan@google.com>
3960
3961         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
3962         skip empty text sections.
3963         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
3964
3965 2011-06-22  Ian Lance Taylor  <iant@google.com>
3966
3967         PR gold/12910
3968         * options.h (class General_options): Add --ctors-in-init-array.
3969         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
3970         friends as SHT_PROGBITS for merging sections.
3971         (Layout::layout): Remove special handling of .init_array and
3972         friends.  Don't sort if doing relocatable link.  Sort for .ctors
3973         and .dtors if ctors_in_init_array.
3974         (Layout::make_output_section): Force correct section types for
3975         .init_array and friends.  Don't sort if doing relocatable link,
3976         Don't sort .ctors and .dtors if ctors_in_init_array.
3977         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
3978         (Layout::output_section_name): Add relobj parameter.  Change all
3979         callers.  Handle .ctors. and .dtors. in code rather than table.
3980         Handle .ctors and .dtors if ctors_in_init_array.
3981         (Layout::match_file_name): New function, moved from output.cc.
3982         * layout.h (class Layout): Update declarations.
3983         * output.cc: Include "layout.h".
3984         (Input_section_sort_entry::get_priority): New function.
3985         (Input_section_sort_entry::match_file_name): Just call
3986         Layout::match_file_name.
3987         (Output_section::Input_section_sort_init_fini_compare::operator()):
3988         Handle .ctors and .dtors.  Sort by explicit priority rather than
3989         by name.
3990         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
3991         * testsuite/initpri2.c: New test.
3992         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
3993         (check_PROGRAMS): Add initpri2.
3994         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
3995         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
3996         * configure, testsuite/Makefile.in: Rebuild.
3997
3998 2011-06-19  Ian Lance Taylor  <iant@google.com>
3999
4000         PR gold/12880
4001         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4002         .interp section to a PT_INTERP segment even if we have seen a
4003         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4004         clause in a linker script.
4005         (Layout::finalize): Don't create a .interp section if we've
4006         already create a PT_INTERP segment.
4007         (Layout::create_interp): Always call choose_output_section (revert
4008         patch of 2011-06-17).  Don't create PT_INTERP segment.
4009         * script-sections.cc
4010         (Script_sections::create_note_and_tls_segments): Add a .interp
4011         section to a PT_INTERP segment even if we have seen a
4012         --dynamic-linker option.
4013
4014 2011-06-18  Ian Lance Taylor  <iant@google.com>
4015
4016         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4017         merely because a non-PT_LOAD segment has a dynamic reloc.
4018
4019 2011-06-18  Ian Lance Taylor  <iant@google.com>
4020
4021         * layout.cc (Layout::finish_dynamic_section): Don't create
4022         DT_FLAGS entry if not needed.
4023
4024 2011-06-18  Ian Lance Taylor  <iant@google.com>
4025
4026         PR gold/12745
4027         * layout.cc (Layout::layout_eh_frame): Correct handling of
4028         writable .eh_frame section.
4029
4030 2011-06-17  Ian Lance Taylor  <iant@google.com>
4031
4032         PR gold/12893
4033         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4034         symbol is redefined with the exact same object and value.
4035
4036 2011-06-17  Ian Lance Taylor  <iant@google.com>
4037
4038         PR gold/12880
4039         * layout.h (class Layout): Add interp_segment_ field.
4040         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4041         (Layout::attach_allocated_section_to_segment): If making shared
4042         library, put .interp section in PT_INTERP segment.
4043         (Layout::finalize): Also call create_interp if -dynamic-linker
4044         option was used.
4045         (Layout::create_interp): Assert that there is no PT_INTERP
4046         segment.  If not using a SECTIONS clause, use make_output_section.
4047         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4048         * script-sections.cc
4049         (Script_sections::create_note_and_tls_segments): If making shared
4050         library, put .interp section in PT_INTERP segment.
4051
4052 2011-06-17  Ian Lance Taylor  <iant@google.com>
4053
4054         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4055         when making a shared library.
4056
4057 2011-06-17  Ian Lance Taylor  <iant@google.com>
4058
4059         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4060         parameter.  Change all callers.  Don't issue warning about PC32
4061         against locally defined symbol.
4062
4063 2011-06-16  Ian Lance Taylor  <iant@google.com>
4064
4065         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4066         occurs in same object.
4067
4068 2011-06-14  Alan Modra  <amodra@gmail.com>
4069
4070         * po/POTFILES.in: Regenerate.
4071
4072 2011-06-09  Ian Lance Taylor  <iant@google.com>
4073
4074         * script-sections.cc
4075         (Orphan_output_section::set_section_addresses): For a relocatable
4076         link set address to 0.
4077
4078 2011-06-09  Cary Coutant  <ccoutant@google.com>
4079
4080         PR gold/12804
4081         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4082         used with --compress-debug-sections.
4083         * gold/object.cc (Sized_relobj_file::do_layout): Report
4084         uncompressed size of compressed input sections.
4085
4086 2011-06-08  Cary Coutant  <ccoutant@google.com>
4087
4088         PR gold/12804
4089         * testsuite/two_file_test_2_v1.cc: Change initialization of
4090         v2 to keep it in .data.
4091
4092 2011-06-07  Cary Coutant  <ccoutant@google.com>
4093
4094         * common.cc (Symbol_table::do_allocate_commons_list): Call
4095         gold_fallback.
4096         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4097         (Errors::fallback): New function.
4098         (gold_fallback): New function.
4099         * errors.h (Errors::fallback): New function.
4100         * gold.cc (gold_exit): Change status parameter to enum; adjust
4101         all callers.
4102         (queue_initial_tasks): Call gold_fallback.
4103         * gold.h: Include cstdlib.
4104         (Exit_status): New enum type.
4105         (gold_exit): Change status parameter to enum.
4106         (gold_fallback): New function.
4107         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4108         (Layout::create_symtab_sections): Likewise.
4109         (Layout::create_shdrs): Likewise.
4110         * main.cc (main): Adjust call to gold_exit.
4111         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4112         (Output_data_got::add_got_entry_pair): Likewise.
4113         (Output_section::add_input_section): Likewise.
4114         (Output_section::add_output_section_data): Likewise.
4115         (Output_segment::set_section_list_addresses): Likewise.
4116         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4117
4118 2011-06-07  Cary Coutant  <ccoutant@google.com>
4119
4120         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4121         for incremental links.
4122         * output.cc (Output_segment::set_section_list_addresses): Remove
4123         FIXME and test for TLS or BSS.
4124
4125 2011-06-07  Cary Coutant  <ccoutant@google.com>
4126
4127         * testsuite/Makefile.am: Add incremental_copy_test,
4128         incremental_common_test_1.
4129         * testsuite/Makefile.in: Regenerate.
4130         * testsuite/common_test_1_v1.c: New source file.
4131         * testsuite/common_test_1_v2.c: New source file.
4132         * testsuite/copy_test_v1.cc: New source file.
4133
4134 2011-06-07  Cary Coutant  <ccoutant@google.com>
4135
4136         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4137         update, allocate common from bss section's free list.
4138         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4139         linker-defined symbols.
4140         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4141         Skip GOT and PLT entries that are no longer referenced.
4142         (Output_section_incremental_inputs::write_info_blocks): Mark
4143         linker-defined symbols.
4144         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4145         * output.cc (Output_section::allocate): New function.
4146         * output.h (Output_section::allocate): New function.
4147         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4148         linker-defined symbols.
4149         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4150         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4151         (Symbol::init_base_output_data): Likewise.
4152         (Symbol::init_base_output_segment): Likewise.
4153         (Symbol::init_base_constant): Likewise.
4154         (Sized_symbol::init_output_data): Likewise.
4155         (Sized_symbol::init_output_segment): Likewise.
4156         (Sized_symbol::init_constant): Likewise.
4157         (Symbol_table::do_define_in_output_data): Likewise.
4158         (Symbol_table::do_define_in_output_segment): Likewise.
4159         (Symbol_table::do_define_as_constant): Likewise.
4160         * symtab.h (Symbol::is_predefined): New function.
4161         (Symbol::init_base_output_data): Add is_predefined parameter.
4162         (Symbol::init_base_output_segment): Likewise.
4163         (Symbol::init_base_constant): Likewise.
4164         (Symbol::is_predefined_): New data member.
4165         (Sized_symbol::init_output_data): Add is_predefined parameter.
4166         (Sized_symbol::init_output_segment): Likewise.
4167         (Sized_symbol::init_constant): Likewise.
4168         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4169
4170 2011-06-07  Cary Coutant  <ccoutant@google.com>
4171
4172         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4173         instead of emit_copy_reloc.
4174         (Copy_relocs::emit_copy_reloc): Refactor.
4175         (Copy_relocs::make_copy_reloc): New function.
4176         (Copy_relocs::add_copy_reloc): Remove.
4177         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4178         section.
4179         (Copy_relocs::make_copy_reloc): New function.
4180         (Copy_relocs::add_copy_reloc): Remove.
4181         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4182         unchanged input files.
4183         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4184         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4185         Reserve BSS space for COPY relocations.
4186         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4187         (Output_section_incremental_inputs::write_info_blocks): Record
4188         whether a symbol is copied from a shared object.
4189         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4190         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4191         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4192         (Incremental_input_entry_reader::get_output_symbol_index): Add
4193         is_copy parameter.
4194         (Incremental_binary::emit_copy_relocs): New function.
4195         (Incremental_binary::do_emit_copy_relocs): New function.
4196         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4197         new data member.
4198         (Sized_incremental_binary::add_copy_reloc): New function.
4199         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4200         (Sized_incremental_binary::Copy_reloc): New struct.
4201         (Sized_incremental_binary::Copy_relocs): New typedef.
4202         (Sized_incremental_binary::copy_relocs_): New data member.
4203         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4204         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4205         * target.h (Sized_target::emit_copy_reloc): New function.
4206         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4207
4208 2011-06-02  Cary Coutant  <ccoutant@google.com>
4209
4210         PR gold/12163
4211         * gold/archive.cc (Archive::Archive): Initialize new data member.
4212         (Archive::include_all_members): Return if archive has already been
4213         included.
4214         * gold/archive.h (Archive::include_all_members_): New data member.
4215
4216 2011-06-02  Nick Clifton  <nickc@redhat.com>
4217
4218         * dynobj.h: Fix spelling mistake in comment.
4219         * output.cc: Likewise.
4220
4221 2011-05-31  Doug Kwan  <dougkwan@google.com>
4222             Asier Llano
4223
4224         PR gold/12826
4225         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4226         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4227         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4228         redundant arm_exidx_test.so.
4229         * testsuite/Makefile.in: Regenerate.
4230         (check_SCRIPTS): Add pr12826.sh
4231         (check_DATA): Add pr12826.stdout
4232         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4233         * testsuite/pr12826.sh: New file.
4234         * testsuite/pr12826_1.s: Ditto.
4235         * testsuite/pr12826_1.s: Ditto.
4236
4237 2011-05-30  Ian Lance Taylor  <iant@google.com>
4238
4239         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4240         sections.
4241
4242 2011-05-29  Ian Lance Taylor  <iant@google.com>
4243
4244         PR gold/12804
4245         * testsuite/Makefile.am: Use different file name for two_file_test
4246         temporary file for each incremental test.
4247         * testsuite/Makefile.in: Rebuild.
4248
4249 2011-05-29  Ian Lance Taylor  <iant@google.com>
4250
4251         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4252         binary input file is empty.
4253
4254 2011-05-27  Ian Lance Taylor  <iant@google.com>
4255
4256         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4257         (ver_test_9.so): Likewise.
4258         * testsuite/Makefile.in: Rebuild.
4259
4260 2011-05-26 Cary Coutant  <ccoutant@google.com>
4261
4262         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4263         * incremental.cc (Incremental_inputs::report_input_section): Fix
4264         comment, indentation.
4265         (Incremental_inputs::report_comdat_group): New function.
4266         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4267         of data for incremental input file entry.
4268         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4269         group count, COMDAT group signatures.
4270         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4271         an unchanged input file.
4272         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4273         Initialize new data member.
4274         (Incremental_object_entry::add_comdat_group): New function.
4275         (Incremental_object_entry::get_comdat_group_count): New function.
4276         (Incremental_object_entry::get_comdat_signature_key): New function.
4277         (Incremental_object_entry::groups_): New data member.
4278         (Incremental_inputs::report_comdat_group): New function.
4279         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4280         data for incremental input file entry.
4281         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4282         (Incremental_input_entry_reader::get_input_section): Adjust size of
4283         data for incremental input file entry.
4284         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4285         (Incremental_input_entry_reader::get_comdat_group_signature): New
4286         function.
4287         * object.cc (Sized_relobj::include_section_group): Report kept
4288         COMDAT groups for incremental links.
4289
4290 2011-05-24  David Meyer  <pdox@google.com>
4291
4292         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4293         with name parameter.  Add found_name parameter.
4294         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4295         * dirsearch.h (class Dirsearch): Update declaration.
4296
4297 2011-05-24  Ian Lance Taylor  <iant@google.com>
4298
4299         * archive.cc (Library_base::should_include_member): Pull in object
4300         from archive if it defines the entry symbol.
4301         * parameters.cc (Parameters::entry): New function.
4302         * parameters.h (class Parameters): Declare entry.
4303         * output.h (class Output_file_header): Remove entry_ field.
4304         * output.cc (Output_file_header::Output_file_header): Remove entry
4305         parameter.  Change all callers.
4306         (Output_file_header::entry): Use parameters->entry.
4307         * gold.cc (queue_middle_tasks): Likewise.
4308         * plugin.cc (Plugin_hook::run): Likewise.
4309
4310 2011-05-24 Cary Coutant  <ccoutant@google.com>
4311
4312         * gold.cc (queue_initial_tasks): Pass incremental base filename
4313         to Output_file::open_base_file; don't print error message.
4314         * incremental-dump.cc (main): Adjust call to
4315         Output_file::open_for_modification.
4316         * incremental-dump.cc (main): Likewise.
4317         * incremental.cc (Incremental_inputs::report_command_line):
4318         Ignore --incremental-base option when comparing command lines.
4319         Ignore parameter when given as separate argument.
4320         * options.h (class General_options): Add --incremental-base.
4321         * output.cc (Output_file::Output_file):
4322         (Output_file::open_base_file): Add base_name and writable parameters;
4323         read base file into new file; print error message here.
4324         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4325         callers.
4326         * output.h (Output_file::open_for_modification): Rename to...
4327         (Output_file::open_base_file): ...this; add base_name and
4328         writable parameters; adjust all callers.
4329         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4330         callers.
4331         * testsuite/Makefile.am (incremental_test_4): Test
4332         --incremental-base.
4333         * testsuite/Makefile.in: Regenerate.
4334
4335 2011-05-24 Cary Coutant  <ccoutant@google.com>
4336
4337         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4338         incremental_test_4.
4339         * testsuite/Makefile.in: Regenerate.
4340         * testsuite/two_file_test_1_v1.cc: New test source file.
4341         * testsuite/two_file_test_1b_v1.cc: New test source file.
4342         * testsuite/two_file_test_2_v1.cc: New test source file.
4343
4344 2011-05-24 Cary Coutant  <ccoutant@google.com>
4345
4346         * dynobj.h (Dynobj::do_dynobj): New function.
4347         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4348         flag and soname for shared objects.
4349         * incremental.cc (Incremental_inputs::report_object): Make
4350         either Incremental_object_entry or Incremental_dynobj_entry; add
4351         soname to string table.
4352         (Incremental_inputs::report_input_section): Add assertion.
4353         (Output_section_incremental_inputs::set_final_data_size): Adjust
4354         type of input file entry for shared libraries; adjust size of
4355         shared library info entry.
4356         (Output_section_incremental_inputs::write_input_files): Write
4357         as_needed flag for shared libraries.
4358         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4359         of input file entry for shared libraries; write soname.
4360         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4361         soname from incremental info.
4362         * incremental.h (enum Incremental_input_flags): Add
4363         INCREMENTAL_INPUT_AS_NEEDED.
4364         (Incremental_input_entry::Incremental_input_entry): Initialize new
4365         data member.
4366         (Incremental_input_entry::set_as_needed): New function.
4367         (Incremental_input_entry::as_needed): New function.
4368         (Incremental_input_entry::do_dynobj_entry): New function.
4369         (Incremental_input_entry::as_needed_): New data member.
4370         (Incremental_object_entry::Incremental_object_entry): Don't check
4371         for shared library.
4372         (Incremental_object_entry::do_type): Likewise.
4373         (class Incremental_dynobj_entry): New class.
4374         (Incremental_input_entry_reader::as_needed): New function.
4375         (Incremental_input_entry_reader::get_soname): New function.
4376         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4377         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4378         size of shared library info entry.
4379         * layout.cc (Layout::finish_dynamic_section): Don't test for
4380         incremental link when adding DT_NEEDED entries.
4381         * object.h (Object::Object): Initialize new data member.
4382         (Object::dynobj): New function.
4383         (Object::set_as_needed): New function.
4384         (Object::as_needed): New function.
4385         (Object::do_dynobj): New function.
4386         (Object::as_needed_): New data member.
4387
4388 2011-05-24 Cary Coutant  <ccoutant@google.com>
4389
4390         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4391         info; adjust display of GOT entries.
4392         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4393         vector of input objects; remove file_status_.
4394         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4395         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4396         got_plt reader; call target hooks to reserve GOT entries.
4397         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4398         of input file info header and GOT info entry.
4399         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4400         relocation info.
4401         (Got_plt_view_info::got_descriptor): Remove.
4402         (Got_plt_view_info::sym_index): New data member.
4403         (Got_plt_view_info::input_index): New data member.
4404         (Local_got_offset_visitor::visit): Write input file index.
4405         (Global_got_offset_visitor::visit): Write 0 for input file index.
4406         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4407         with sym_index and input_index.
4408         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4409         incremental info GOT entry; replace got_descriptor with input_index.
4410         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4411         map from input file index to object.
4412         (Sized_relobj_incr::do_layout): Replace direct data member reference
4413         with accessor function.
4414         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4415         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4416         Adjust size of input file info header.
4417         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4418         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4419         (Incremental_input_entry_reader::get_input_section): Adjust size of
4420         input file info header.
4421         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4422         of incremental info GOT entry.
4423         (Incremental_got_plt_reader::get_got_desc): Remove.
4424         (Incremental_got_plt_reader::get_got_symndx): New function.
4425         (Incremental_got_plt_reader::get_got_input_index): New function.
4426         (Sized_incremental_binary::Sized_incremental_binary): Remove
4427         file_status_; add input_objects_.
4428         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4429         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4430         (Sized_incremental_binary::file_is_unchanged): Remove.
4431         (Sized_incremental_binary::set_input_object): New function.
4432         (Sized_incremental_binary::input_object): New function.
4433         (Sized_incremental_binary::file_status_): Remove.
4434         (Sized_incremental_binary::input_objects_): New data member.
4435         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4436         references.
4437         (Sized_relobj_incr::invalid_address): Move to base class.
4438         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4439         class.
4440         (Sized_relobj_incr::do_output_section_offset): Likewise.
4441         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4442         (Sized_relobj_incr::section_offsets_): Likewise.
4443         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4444         function.
4445         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4446         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4447         with accessor function.
4448         (Sized_relobj_file::do_layout): Likewise.
4449         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4450         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4451         (Sized_relobj_file::compute_final_local_value): Replace refs to
4452         section_offsets_ with accessor function.
4453         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4454         * object.h (Relobj::Relobj): Initialize new data members.
4455         (Relobj::add_dyn_reloc): New function.
4456         (Relobj::first_dyn_reloc): New function.
4457         (Relobj::dyn_reloc_count): New function.
4458         (Relobj::first_dyn_reloc_): New data member.
4459         (Relobj::dyn_reloc_count_): New data member.
4460         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4461         references.
4462         (Sized_relobj::Address): New typedef.
4463         (Sized_relobj::invalid_address): Move here from child class.
4464         (Sized_relobj::Sized_relobj): Initialize new data members.
4465         (Sized_relobj::sized_relobj): New function.
4466         (Sized_relobj::is_output_section_offset_invalid): Move here from
4467         child class.
4468         (Sized_relobj::get_output_section_offset): Likewise.
4469         (Sized_relobj::local_has_got_offset): Likewise.
4470         (Sized_relobj::local_got_offset): Likewise.
4471         (Sized_relobj::set_local_got_offset): Likewise.
4472         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4473         (Sized_relobj::clear_got_offsets): New function.
4474         (Sized_relobj::section_offsets): Move here from child class.
4475         (Sized_relobj::do_output_section_offset): Likewise.
4476         (Sized_relobj::do_set_section_offset): Likewise.
4477         (Sized_relobj::Local_got_offsets): Likewise.
4478         (Sized_relobj::local_got_offsets_): Likewise.
4479         (Sized_relobj::section_offsets_): Likewise.
4480         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4481         references.
4482         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4483         class.
4484         (Sized_relobj_file::sized_relobj): New function
4485         (Sized_relobj_file::local_has_got_offset): Move to base class.
4486         (Sized_relobj_file::local_got_offset): Likewise.
4487         (Sized_relobj_file::set_local_got_offset): Likewise.
4488         (Sized_relobj_file::get_output_section_offset): Likewise.
4489         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4490         (Sized_relobj_file::do_output_section_offset): Likewise.
4491         (Sized_relobj_file::do_set_section_offset): Likewise.
4492         (Sized_relobj_file::Local_got_offsets): Likewise.
4493         (Sized_relobj_file::local_got_offsets_): Likewise.
4494         (Sized_relobj_file::section_offsets_): Likewise.
4495         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4496         (all constructors).
4497         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4498         (Output_reloc::get_symbol_index): Likewise.
4499         (Output_reloc::local_section_offset): Likewise.
4500         (Output_reloc::get_address): Likewise.
4501         (Output_reloc::symbol_value): Likewise.
4502         (Output_data_got::reserve_slot): Move to class definition.
4503         (Output_data_got::reserve_local): New function.
4504         (Output_data_got::reserve_slot_for_global): Remove.
4505         (Output_data_got::reserve_global): New function.
4506         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4507         (all constructors, two instantiations).
4508         (Output_reloc::get_relobj): New function (two instantiations).
4509         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4510         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4511         (Output_data_reloc::add_global): Adjust type of relobj.
4512         (Output_data_reloc::add_global_relative): Likewise.
4513         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4514         (Output_data_reloc::add_local): Likewise.
4515         (Output_data_reloc::add_local_relative): Likewise.
4516         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4517         (Output_data_reloc::add_local_section): Likewise.
4518         (Output_data_reloc::add_output_section): Likewise.
4519         (Output_data_reloc::add_absolute): Likewise.
4520         (Output_data_reloc::add_target_specific): Likewise.
4521         (Output_data_got::reserve_slot): Move definition here.
4522         (Output_data_got::reserve_local): New function.
4523         (Output_data_got::reserve_global): New function.
4524         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4525         section_offsets_ with accessor function.
4526         (Sized_relobj_file::write_sections): Likewise.
4527         (Sized_relobj_file::do_relocate_sections): Likewise.
4528         * target.h (Sized_target::reserve_local_got_entry): New function.
4529         (Sized_target::reserve_global_got_entry): New function.
4530         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4531         (Target_x86_64::reserve_global_got_entry): New function.
4532         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4533
4534 2011-05-23 Cary Coutant  <ccoutant@google.com>
4535
4536         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4537         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4538         bit when checking got_type.
4539         * incremental.cc (Sized_incremental_binary::setup_readers):
4540         Store symbol table and string table locations; initialize bit vector
4541         of file status flags.
4542         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4543         unchanged files.
4544         (Sized_incremental_binary::do_process_got_plt): New function.
4545         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4546         (Output_section_incremental_inputs::set_final_data_size): Record
4547         file index for each input file.
4548         (Output_section_incremental_inputs::write_got_plt): Store file index
4549         instead of input entry offset for each GOT entry.
4550         * incremental.h
4551         (Incremental_input_entry::Incremental_input_entry): Initialize new
4552         data member.
4553         (Incremental_input_entry::set_offset): Store file index.
4554         (Incremental_input_entry::get_file_index): New function.
4555         (Incremental_input_entry::file_index_): New data member.
4556         (Incremental_binary::process_got_plt): New function.
4557         (Incremental_binary::do_process_got_plt): New function.
4558         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4559         data members.
4560         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4561         (Sized_incremental_binary::set_file_is_unchanged): New function.
4562         (Sized_incremental_binary::file_is_unchanged): New function.
4563         (Sized_incremental_binary::do_process_got_plt): New function.
4564         (Sized_incremental_binary::file_status_): New data member.
4565         (Sized_incremental_binary::main_symtab_loc_): New data member.
4566         (Sized_incremental_binary::main_strtab_loc_): New data member.
4567         * output.cc (Output_data_got::Got_entry::write): Add case
4568         RESERVED_CODE.
4569         (Output_data_got::add_global): Call add_got_entry.
4570         (Output_data_got::add_global_plt): Likewise.
4571         (Output_data_got::add_global_with_rel): Likewise.
4572         (Output_data_got::add_global_with_rela): Likewise.
4573         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4574         (Output_data_got::add_global_pair_with_rela): Likewise.
4575         (Output_data_got::add_local): Call add_got_entry.
4576         (Output_data_got::add_local_plt): Likewise.
4577         (Output_data_got::add_local_with_rel): Likewise.
4578         (Output_data_got::add_local_with_rela): Likewise.
4579         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4580         (Output_data_got::add_local_pair_with_rela): Likewise.
4581         (Output_data_got::reserve_slot): New function.
4582         (Output_data_got::reserve_slot_for_global): New function.
4583         (Output_data_got::add_got_entry): New function.
4584         (Output_data_got::add_got_entry_pair): New function.
4585         (Output_section::add_output_section_data): Edit FIXME.
4586         * output.h
4587         (Output_section_data_build::Output_section_data_build): New
4588         constructor with size parameter.
4589         (Output_data_space::Output_data_space): Likewise.
4590         (Output_data_got::Output_data_got): Initialize new data member; new
4591         constructor with size parameter.
4592         (Output_data_got::add_constant): Call add_got_entry.
4593         (Output_data_got::reserve_slot): New function.
4594         (Output_data_got::reserve_slot_for_global): New function.
4595         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4596         (Output_data_got::add_got_entry): New function.
4597         (Output_data_got::add_got_entry_pair): New function.
4598         (Output_data_got::free_list_): New data member.
4599         * target.h (Sized_target::init_got_plt_for_update): New function.
4600         (Sized_target::register_global_plt_entry): New function.
4601         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4602         Initialize new data member; call init; add constructor with PLT count.
4603         (Output_data_plt_x86_64::init): New function.
4604         (Output_data_plt_x86_64::add_relocation): New function.
4605         (Output_data_plt_x86_64::reserve_slot): New function.
4606         (Output_data_plt_x86_64::free_list_): New data member.
4607         (Target_x86_64::init_got_plt_for_update): New function.
4608         (Target_x86_64::register_global_plt_entry): New function.
4609         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4610         incremental updates.
4611         (Output_data_plt_x86_64::add_relocation): New function.
4612         * testsuite/object_unittest.cc (Object_test): Set default options.
4613
4614 2011-05-16  Ian Lance Taylor  <iant@google.com>
4615
4616         * options.h (class General_options): Make -i a synonym for -r.
4617
4618 2011-05-16  Ian Lance Taylor  <iant@google.com>
4619
4620         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4621
4622 2011-05-10 Cary Coutant  <ccoutant@google.com>
4623
4624         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4625         strip_all (-s).
4626
4627 2011-05-06  Ian Lance Taylor  <iant@google.com>
4628
4629         * layout.cc (Layout::layout): If the output section flags change,
4630         update the ordering.
4631
4632 2011-04-25 Cary Coutant  <ccoutant@google.com>
4633
4634         * incremental-dump.cc (dump_incremental_inputs): Print local
4635         symbol info for each input file.
4636         * incremental.cc
4637         (Output_section_incremental_inputs::set_final_data_size): Add local
4638         symbol info to input file entries in incremental info.
4639         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4640         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4641         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4642         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4643         implementation.
4644         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4645         (Sized_incr_relobj::do_relocate): Write the local symbols.
4646         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4647         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4648         Adjust size of input file header.
4649         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4650         (Incremental_inputs_reader::get_local_symbol_count): New function.
4651         (Incremental_inputs_reader::get_input_section): Adjust size of input
4652         file header.
4653         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4654         (Sized_incr_relobj::This): New typedef.
4655         (Sized_incr_relobj::sym_size): New const data member.
4656         (Sized_incr_relobj::Local_symbol): New struct.
4657         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4658         (Sized_incr_relobj::do_local_symbol_offset): New function.
4659         (Sized_incr_relobj::local_symbol_count_): New data member.
4660         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4661         (Sized_incr_relobj::local_symbol_index_): New data member.
4662         (Sized_incr_relobj::local_symbol_offset_): New data member.
4663         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4664         (Sized_incr_relobj::local_symbols_): New data member.
4665         * object.h (Relobj::output_local_symbol_count): New function.
4666         (Relobj::local_symbol_offset): New function.
4667         (Relobj::do_output_local_symbol_count): New function.
4668         (Relobj::do_local_symbol_offset): New function.
4669         (Sized_relobj::do_output_local_symbol_count): New function.
4670         (Sized_relobj::do_local_symbol_offset): New function.
4671
4672 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4673
4674         * descriptors.cc (set_close_on_exec): New function.
4675         (Descriptors::open): Use set_close_on_exec.
4676         * output.cc (S_ISLNK): Define if not defined.
4677
4678 2011-04-22 Cary Coutant  <ccoutant@google.com>
4679
4680         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4681         global symbol map.
4682         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4683         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4684         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4685         relocations.
4686         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4687         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4688         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4689         * incremental.h
4690         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4691         function.
4692         (Incremental_binary::apply_incremental_relocs): New function.
4693         (Incremental_binary::do_apply_incremental_relocs): New function.
4694         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4695         data member.
4696         (Sized_incremental_binary::add_global_symbol): New function.
4697         (Sized_incremental_binary::global_symbol): New function.
4698         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4699         (Sized_incremental_binary::symbol_map_): New data member.
4700         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4701         * target.h (Sized_target::apply_relocation): New function.
4702         * target-reloc.h (apply_relocation): New function.
4703         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4704
4705 2011-04-22  Doug Kwan  <dougkwan@google.com>
4706
4707         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4708         flag of a SHT_ARM_EXIDX section.
4709         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4710         * testsuite/Makefile.in: Regenerate.
4711         * testsuite/arm_exidx_test.s: New file.
4712         * testsuite/arm_exidx_test.sh: Same.
4713
4714 2011-04-20 Cary Coutant  <ccoutant@google.com>
4715
4716         PR gold/12689
4717         * archive.h (Incremental_archive_entry::Archive_member):
4718         Initialize arg_serial_ (second constructor).
4719
4720 2011-04-17  Ian Lance Taylor  <iant@google.com>
4721
4722         * object.cc (Relocate_info::location): Simplify location string.
4723         * errors.cc (Errors::error_at_location): Don't print program
4724         name.
4725         (Errors::warning_at_location): Likewise.
4726         (Errors::undefined_symbol): Likewise.
4727         * testsuite/debug_msg.sh: Update accordingly.
4728
4729 2011-04-14 Cary Coutant  <ccoutant@google.com>
4730
4731         * gold/layout.cc (Layout::symtab_section_offset): New function.
4732         * gold/layout.h (Layout::symtab_section_offset): New function.
4733         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4734
4735 2011-04-12  Ian Lance Taylor  <iant@google.com>
4736
4737         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4738         with MREMAP_MAYMOVE.
4739         * output.h (class Output_file): Add map_is_allocated_ field.
4740         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4741         not available, provide stubs.  If mremap is not available, #define
4742         it to gold_mremap.
4743         (MREMAP_MAYMOVE): Define if not defined.
4744         (Output_file::Output_file): Initialize map_is_allocated_.
4745         (Output_file::resize): Check map_is_allocated_.
4746         (Output_file::map_anonymous): If mmap fails, use malloc.
4747         (Output_file::unmap): Don't do anything for an anonymous map.
4748         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4749         is not available, provide stubs.
4750         (File_read::View::~View): Use free rather than delete[].
4751         (File_read::make_view): Use malloc rather than new[].  If mmap
4752         fails, use malloc.
4753         (File_read::find_or_make_view): Use malloc rather than new[].
4754         * gold.h: Remove HAVE_REMAP code.
4755         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4756         exists.  Rename mremap to gold_mremap.  If mmap is not available
4757         don't do anything.
4758         * configure, config.in: Rebuild.
4759
4760 2011-04-11  Ian Lance Taylor  <iant@google.com>
4761
4762         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4763         initialize local variable v.
4764
4765 2011-04-11  Cary Coutant  <ccoutant@google.com>
4766
4767         * archive.cc (Archive::include_member): Adjust call to
4768         report_object.
4769         (Add_archive_symbols::run): Track argument serial numbers.
4770         (Lib_group::include_member): Likewise.
4771         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4772         * archive.h (Incremental_archive_entry::Archive_member):
4773         Initialize arg_serial_.
4774         (Archive_member::arg_serial_): New data member.
4775         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4776         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4777         incremental link.
4778         (Sized_dynobj::do_for_all_local_got_entries): New function.
4779         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4780         function.
4781         * fileread.cc (get_mtime): New function.
4782         * fileread.h (get_mtime): New function.
4783         * gold.cc (queue_initial_tasks): Check for incremental update.
4784         (process_incremental_input): New function.
4785         (queue_middle_tasks): Don't force valid target for incremental
4786         update.
4787         * incremental-dump.cc (find_input_containing_global): Adjust
4788         size of symbol info entry.
4789         (dump_incremental_inputs): Dump argument serial number and
4790         in_system_directory flag; bias shndx by 1; print symbol names
4791         when dumping per-file symbol lists; use new symbol info readers.
4792         * incremental.cc
4793         (Output_section_incremental_inputs:update_data_size): New function.
4794         (Sized_incremental_binary::setup_readers): Setup input readers
4795         for each input file; build maps for files added from libraries
4796         and scripts.
4797         (Sized_incremental_binary::check_input_args): New function.
4798         (Sized_incremental_binary::do_check_inputs): Build map of argument
4799         serial numbers to input arguments.
4800         (Sized_incremental_binary::do_file_has_changed): Rename
4801         do_file_is_unchanged to this; compare file modification times.
4802         (Sized_incremental_binary::do_init_layout): New function.
4803         (Sized_incremental_binary::do_reserve_layout): New function.
4804         (Sized_incremental_binary::do_get_input_reader): Remove.
4805         (Sized_incremental_binary::get_symtab_view): New function.
4806         (Incremental_checker::can_incrementally_link_output_file): Remove.
4807         (Incremental_inputs::report_command_line): Exclude --debug options.
4808         (Incremental_inputs::report_archive_begin): Add parameter; track
4809         argument serial numbers; don't put input file entry for archive
4810         before archive members.
4811         (Incremental_inputs::report_archive_end): Put input file entry
4812         for archive after archive members.
4813         (Incremental_inputs::report_object): Add parameter; track argument
4814         serial numbers and in_system_directory flag.
4815         (Incremental_inputs::report_script): Add parameter; track argument
4816         serial numbers.
4817         (Output_section_incremental_inputs::set_final_data_size): Adjust
4818         size of symbol info entry; check for forwarding symbols.
4819         (Output_section_incremental_inputs::write_input_files): Write
4820         in_system_directory flag and argument serial number.
4821         (Output_section_incremental_inputs::write_info_blocks): Map section
4822         indices between incremental info and original input file; store
4823         input section index for each symbol.
4824         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4825         change operator() to visit().
4826         (class Global_got_offset_visitor): Likewise.
4827         (class Global_symbol_visitor_got_plt):
4828         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4829         classes.
4830         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4831         (Sized_incr_relobj::do_read_symbols): New function.
4832         (Sized_incr_relobj::do_layout): New function.
4833         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4834         (Sized_incr_relobj::do_add_symbols): New function.
4835         (Sized_incr_relobj::do_should_include_member): New function.
4836         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4837         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4838         (Sized_incr_relobj::do_section_size): New function.
4839         (Sized_incr_relobj::do_section_name): New function.
4840         (Sized_incr_relobj::do_section_contents): New function.
4841         (Sized_incr_relobj::do_section_flags): New function.
4842         (Sized_incr_relobj::do_section_entsize): New function.
4843         (Sized_incr_relobj::do_section_address): New function.
4844         (Sized_incr_relobj::do_section_type): New function.
4845         (Sized_incr_relobj::do_section_link): New function.
4846         (Sized_incr_relobj::do_section_info): New function.
4847         (Sized_incr_relobj::do_section_addralign): New function.
4848         (Sized_incr_relobj::do_initialize_xindex): New function.
4849         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4850         (Sized_incr_relobj::do_read_relocs): New function.
4851         (Sized_incr_relobj::do_gc_process_relocs): New function.
4852         (Sized_incr_relobj::do_scan_relocs): New function.
4853         (Sized_incr_relobj::do_count_local_symbols): New function.
4854         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4855         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4856         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4857         (Sized_incr_relobj::do_relocate): New function.
4858         (Sized_incr_relobj::do_set_section_offset): New function.
4859         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4860         (Sized_incr_dynobj::do_read_symbols): New function.
4861         (Sized_incr_dynobj::do_layout): New function.
4862         (Sized_incr_dynobj::do_add_symbols): New function.
4863         (Sized_incr_dynobj::do_should_include_member): New function.
4864         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4865         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4866         (Sized_incr_dynobj::do_section_size): New function.
4867         (Sized_incr_dynobj::do_section_name): New function.
4868         (Sized_incr_dynobj::do_section_contents): New function.
4869         (Sized_incr_dynobj::do_section_flags): New function.
4870         (Sized_incr_dynobj::do_section_entsize): New function.
4871         (Sized_incr_dynobj::do_section_address): New function.
4872         (Sized_incr_dynobj::do_section_type): New function.
4873         (Sized_incr_dynobj::do_section_link): New function.
4874         (Sized_incr_dynobj::do_section_info): New function.
4875         (Sized_incr_dynobj::do_section_addralign): New function.
4876         (Sized_incr_dynobj::do_initialize_xindex): New function.
4877         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4878         (make_sized_incremental_object): New function.
4879         (Incremental_library::copy_unused_symbols): New function.
4880         (Incremental_library::do_for_all_unused_symbols): New function.
4881         * incremental.h (enum Incremental_input_flags): New type.
4882         (class Incremental_checker): Remove.
4883         (Incremental_input_entry::Incremental_input_entry): Add argument
4884         serial number.
4885         (Incremental_input_entry::arg_serial): New function.
4886         (Incremental_input_entry::set_is_in_system_directory): New function.
4887         (Incremental_input_entry::is_in_system_directory): New function.
4888         (Incremental_input_entry::arg_serial_): New data member.
4889         (Incremental_input_entry::is_in_system_directory_): New data member.
4890         (class Script_info): Move here from script.h.
4891         (Script_info::Script_info): Add filename parameter.
4892         (Script_info::filename): New function.
4893         (Script_info::filename_): New data member.
4894         (Incremental_script_entry::Incremental_script_entry): Add argument
4895         serial number.
4896         (Incremental_object_entry::Incremental_object_entry): Likewise.
4897         (Incremental_object_entry::add_input_section): Build list of input
4898         sections with map to original shndx.
4899         (Incremental_object_entry::get_input_section_index): New function.
4900         (Incremental_object_entry::shndx_): New data member.
4901         (Incremental_object_entry::name_key_): Rename; adjust all refs.
4902         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
4903         (Incremental_archive_entry::Incremental_archive_entry): Add argument
4904         serial number.
4905         (Incremental_inputs::report_archive_begin): Likewise.
4906         (Incremental_inputs::report_object): Likewise.
4907         (Incremental_inputs::report_script): Likewise.
4908         (class Incremental_global_symbol_reader): New class.
4909         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
4910         and store flags and input file type.
4911         (Incremental_input_entry_reader::arg_serial): New function.
4912         (Incremental_input_entry_reader::type): Extract type from flags.
4913         (Incremental_input_entry_reader::is_in_system_directory): New function.
4914         (Incremental_input_entry_reader::get_input_section_count): Call
4915         accessor function for type.
4916         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
4917         function for type; adjust size of global symbol entry.
4918         (Incremental_input_entry_reader::get_global_symbol_count): Call
4919         accessor function for type.
4920         (Incremental_input_entry_reader::get_object_count): Likewise.
4921         (Incremental_input_entry_reader::get_object_offset): Likewise.
4922         (Incremental_input_entry_reader::get_member_count): Likewise.
4923         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
4924         (Incremental_input_entry_reader::get_member_offset): Likewise.
4925         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
4926         (Incremental_input_entry_reader::Global_symbol_info): Remove.
4927         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
4928         (Incremental_input_entry_reader::get_global_symbol_reader): New
4929         function.
4930         (Incremental_input_entry_reader::get_output_symbol_index): New
4931         function.
4932         (Incremental_input_entry_reader::type_): Remove.
4933         (Incremental_input_entry_reader::flags_): New data member.
4934         (Incremental_inputs_reader::input_file_offset): New function.
4935         (Incremental_inputs_reader::input_file_index): New function.
4936         (Incremental_inputs_reader::input_file): Call input_file_offset.
4937         (Incremental_inputs_reader::input_file_at_offset): New function.
4938         (Incremental_relocs_reader::get_r_type): Reformat.
4939         (Incremental_relocs_reader::get_r_shndx): Reformat.
4940         (Incremental_relocs_reader::get_r_offset): Reformat.
4941         (Incremental_relocs_reader::data): New function.
4942         (Incremental_binary::Incremental_binary): Initialize new data members.
4943         (Incremental_binary::check_inputs): Add cmdline parameter.
4944         (Incremental_binary::file_is_unchanged): Remove.
4945         (Input_reader::arg_serial): New function.
4946         (Input_reader::get_unused_symbol_count): New function.
4947         (Input_reader::get_unused_symbol): New function.
4948         (Input_reader::do_arg_serial): New function.
4949         (Input_reader::do_get_unused_symbol_count): New function.
4950         (Input_reader::do_get_unused_symbol): New function.
4951         (Incremental_binary::input_file_count): New function.
4952         (Incremental_binary::get_input_reader): Change signature to use
4953         index instead of filename.
4954         (Incremental_binary::file_has_changed): New function.
4955         (Incremental_binary::get_input_argument): New function.
4956         (Incremental_binary::get_library): New function.
4957         (Incremental_binary::get_script_info): New function.
4958         (Incremental_binary::init_layout): New function.
4959         (Incremental_binary::reserve_layout): New function.
4960         (Incremental_binary::output_file): New function.
4961         (Incremental_binary::do_check_inputs): New function.
4962         (Incremental_binary::do_file_is_unchanged): Remove.
4963         (Incremental_binary::do_file_has_changed): New function.
4964         (Incremental_binary::do_init_layout): New function.
4965         (Incremental_binary::do_reserve_layout): New function.
4966         (Incremental_binary::do_input_file_count): New function.
4967         (Incremental_binary::do_get_input_reader): Change signature.
4968         (Incremental_binary::input_args_map_): New data member.
4969         (Incremental_binary::library_map_): New data member.
4970         (Incremental_binary::script_map_): New data member.
4971         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4972         new data members.
4973         (Sized_incremental_binary::output_section): New function.
4974         (Sized_incremental_binary::inputs_reader): Add const.
4975         (Sized_incremental_binary::symtab_reader): Add const.
4976         (Sized_incremental_binary::relocs_reader): Add const.
4977         (Sized_incremental_binary::got_plt_reader): Add const.
4978         (Sized_incremental_binary::get_symtab_view): New function.
4979         (Sized_incremental_binary::Inputs_reader): New typedef.
4980         (Sized_incremental_binary::Input_entry_reader): New typedef.
4981         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
4982         (Sized_incremental_binary::do_file_is_unchanged): Remove.
4983         (Sized_incremental_binary::do_file_has_changed): New function.
4984         (Sized_incremental_binary::do_init_layout): New function.
4985         (Sized_incremental_binary::do_reserve_layout): New function.
4986         (Sized_input_reader::Inputs_reader): Remove.
4987         (Sized_input_reader::Input_entry_reader): Remove.
4988         (Sized_input_reader::do_arg_serial): New function.
4989         (Sized_input_reader::do_get_unused_symbol_count): New function.
4990         (Sized_input_reader::do_get_unused_symbol): New function.
4991         (Sized_incremental_binary::do_input_file_count): New function.
4992         (Sized_incremental_binary::do_get_input_reader): Change signature;
4993         use index instead of filename.
4994         (Sized_incremental_binary::section_map_): New data member.
4995         (Sized_incremental_binary::input_entry_readers_): New data member.
4996         (class Sized_incr_relobj): New class.
4997         (class Sized_incr_dynobj): New class.
4998         (make_sized_incremental_object): New function.
4999         (class Incremental_library): New class.
5000         * layout.cc (Free_list::num_lists): New static data member.
5001         (Free_list::num_nodes): New static data member.
5002         (Free_list::num_removes): New static data member.
5003         (Free_list::num_remove_visits): New static data member.
5004         (Free_list::num_allocates): New static data member.
5005         (Free_list::num_allocate_visits): New static data member.
5006         (Free_list::init): New function.
5007         (Free_list::remove): New function.
5008         (Free_list::allocate): New function.
5009         (Free_list::dump): New function.
5010         (Free_list::print_stats): New function.
5011         (Layout_task_runner::run): Resize output file for incremental updates.
5012         (Layout::Layout): Initialize new data members.
5013         (Layout::set_incremental_base): New function.
5014         (Layout::init_fixed_output_section): New function.
5015         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5016         incremental updates.
5017         (Layout::create_gold_note): Do not create gold note section for
5018         incremental updates.
5019         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5020         for incremental updates.
5021         (Layout::set_section_offsets): For incremental updates, allocate space
5022         from free list.
5023         (Layout::create_symtab_sections): Layout with offsets relative to
5024         start of section; for incremental updates, allocate space from free
5025         list.
5026         (Layout::create_shdrs): For incremental updates, allocate space from
5027         free list.
5028         (Layout::finish_dynamic_section): For incremental updates, do not
5029         check --as-needed (fixed in subsequent patch).
5030         * layout.h (class Free_list): New class.
5031         (Layout::set_incremental_base): New function.
5032         (Layout::incremental_base): New function.
5033         (Layout::init_fixed_output_section): New function.
5034         (Layout::allocate): New function.
5035         (Layout::incremental_base_): New data member.
5036         (Layout::free_list_): New data member.
5037         * main.cc (main): Print Free_list statistics.
5038         * object.cc (Relobj::finalize_incremental_relocs): Add
5039         clear_counts parameter; clear counts only when clear_counts is set.
5040         (Sized_relobj::Sized_relobj): Initialize new base class.
5041         (Sized_relobj::do_layout): Don't report special sections.
5042         (Sized_relobj::do_for_all_local_got_entries): New function.
5043         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5044         symtab_off to all symbol table offsets.
5045         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5046         * object.h (class Got_offset_list): Move to top of file.
5047         (Object::Object): Allow case where input_file == NULL.
5048         (Object::~Object): Likewise.
5049         (Object::input_file): Assert that input_file != NULL.
5050         (Object::lock): Allow case where input_file == NULL.
5051         (Object::unlock): Likewise.
5052         (Object::is_locked): Likewise.
5053         (Object::token): Likewise.
5054         (Object::release): Likewise.
5055         (Object::is_incremental): New function.
5056         (Object::get_mtime): New function.
5057         (Object::for_all_local_got_entries): New function.
5058         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5059         (Object::set_is_in_system_directory): New function.
5060         (Object::is_in_system_directory): New function.
5061         (Object::do_is_incremental): New function.
5062         (Object::do_get_mtime): New function.
5063         (Object::do_for_all_local_got_entries): New function.
5064         (Object::is_in_system_directory_): New data member.
5065         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5066         (class Sized_relobj_base): New class.
5067         (class Sized_relobj): Derive from Sized_relobj_base.
5068         (class Sized_relobj::Symbols): Redeclare from base class.
5069         (class Sized_relobj::local_got_offset_list): Remove.
5070         (class Sized_relobj::Output_sections): Redeclare from base class.
5071         (class Sized_relobj::do_for_all_local_got_entries): New function.
5072         (class Sized_relobj::write_local_symbols): Add offset parameter.
5073         (class Sized_relobj::local_symbol_offset_): Update comment.
5074         (class Sized_relobj::local_dynsym_offset_): Update comment.
5075         * options.cc (Input_arguments::add_file): Remove const.
5076         * options.h (Input_file_argument::Input_file_argument):
5077         Initialize arg_serial_ (all constructors).
5078         (Input_file_argument::set_arg_serial): New function.
5079         (Input_file_argument::arg_serial): New function.
5080         (Input_file_argument::arg_serial_): New data member.
5081         (Input_arguments::Input_arguments): Initialize file_count_.
5082         (Input_arguments::add_file): Remove const.
5083         (Input_arguments::number_of_input_files): New function.
5084         (Input_arguments::file_count_): New data member.
5085         (Command_line::number_of_input_files): Call
5086         Input_arguments::number_of_input_files.
5087         * output.cc (Output_segment_headers::Output_segment_headers):
5088         Set current size.
5089         (Output_section::Input_section::current_data_size): New function.
5090         (Output_section::Output_section): Initialize new data members.
5091         (Output_section::add_input_section): Don't do merge sections for
5092         an incremental link; allocate space from free list for an
5093         incremental update.
5094         (Output_section::add_output_section_data): Allocate space from
5095         free list for an incremental update.
5096         (Output_section::update_data_size): New function.
5097         (Output_section::set_fixed_layout): New function.
5098         (Output_section::reserve): New function.
5099         (Output_segment::set_section_addresses): Remove const.
5100         (Output_segment::set_section_list_addresses): Remove const; allocate
5101         space from free list for an incremental update.
5102         (Output_segment::set_offset): Adjust size of RELRO segment for an
5103         incremental update.
5104         * output.h (Output_data::current_data_size): Move here from
5105         child classes.
5106         (Output_data::pre_finalize_data_size): New function.
5107         (Output_data::update_data_size): New function.
5108         (Output_section_headers::update_data_size): new function.
5109         (Output_section_data_build::current_data_size): Move to Output_data.
5110         (Output_data_strtab::update_data_size): New function.
5111         (Output_section::current_data_size): Move to Output_data.
5112         (Output_section::set_fixed_layout): New function.
5113         (Output_section::has_fixed_layout): New function.
5114         (Output_section::reserve): New function.
5115         (Output_section::update_data_size): New function.
5116         (Output_section::has_fixed_layout_): New data member.
5117         (Output_section::free_list_): New data member.
5118         (Output_segment::set_section_addresses): Remove const.
5119         (Output_segment::set_section_list_addresses): Remove const.
5120         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5121         New function.
5122         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5123         New function.
5124         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5125         parameter when calling Add_symbols constructor; store argument
5126         serial number for members of a lib group.
5127         (Add_symbols::locks): Allow case where token == NULL.
5128         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5129         (Read_member::~Read_member): New function.
5130         (Read_member::is_runnable): New function.
5131         (Read_member::locks): New function.
5132         (Read_member::run): New function.
5133         (Check_script::~Check_script): New function.
5134         (Check_script::is_runnable): New function.
5135         (Check_script::locks): New function.
5136         (Check_script::run): New function.
5137         (Check_library::~Check_library): New function.
5138         (Check_library::is_runnable): New function.
5139         (Check_library::locks): New function.
5140         (Check_library::run): New function.
5141         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5142         (Add_symbols::library_): New data member.
5143         (class Read_member): New class.
5144         (class Check_script): New class.
5145         (class Check_library): New class.
5146         * reloc.cc (Read_relocs::is_runnable): Allow case where
5147         token == NULL.
5148         (Read_relocs::locks): Likewise.
5149         (Scan_relocs::locks): Likewise.
5150         (Relocate_task::locks): Likewise.
5151         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5152         to clear counters.
5153         (Sized_relobj::incremental_relocs_scan): Fix comment.
5154         (Sized_relobj::do_relocate): Pass output file offset to
5155         write_local_symbols.
5156         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5157         from class declaration.
5158         * script.cc (read_input_script): Allocate Script_info; pass
5159         argument serial number to report_script.
5160         * script.h (class Script_info): Move to incremental.h.
5161         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5162         * symtab.h (Symbol_table::add_from_incrobj): New function.
5163         (Symbol_table::set_file_offset): New function.
5164
5165 2011-04-05  Cary Coutant  <ccoutant@google.com>
5166
5167         * incremental-dump.cc (dump_incremental_inputs): Change signature
5168         to take a Sized_incremental_binary; change caller.  Use readers
5169         in Sized_incremental_binary.
5170         * incremental.cc
5171         (Sized_incremental_binary::find_incremental_inputs_sections):
5172         Rename do_find_incremental_inputs_sections to this.
5173         (Sized_incremental_binary::setup_readers): New function.
5174         (Sized_incremental_binary::do_check_inputs): Check
5175         has_incremental_info_ flag; move setup code to setup_readers;
5176         use input readers.
5177         (Sized_incremental_binary::do_file_is_unchanged): New function.
5178         (Sized_incremental_binary::do_get_input_reader): New function.
5179         * incremental.h (class Incremental_binary): Move to end of file.
5180         (Incremental_binary::file_is_unchanged): New function.
5181         (Incremental_binary::do_file_is_unchanged): New function.
5182         (Incremental_binary::Input_reader): New class.
5183         (Incremental_binary::get_input_reader): New function.
5184         (class Sized_incremental_binary): Move to end of file.
5185         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5186         input section reader classes.
5187         (Sized_incremental_binary::has_incremental_info): New function.
5188         (Sized_incremental_binary::inputs_reader): New function.
5189         (Sized_incremental_binary::symtab_reader): New function.
5190         (Sized_incremental_binary::relocs_reader): New function.
5191         (Sized_incremental_binary::got_plt_reader): New function.
5192         (Sized_incremental_binary::do_file_is_unchanged): New function.
5193         (Sized_incremental_binary::Sized_input_reader): New class.
5194         (Sized_incremental_binary::get_input_reader): New function.
5195         (Sized_incremental_binary::find_incremental_inputs_sections):
5196         Rename do_find_incremental_inputs_sections to this.
5197         (Sized_incremental_binary::setup_readers): New function.
5198         (Sized_incremental_binary::has_incremental_info_): New data member.
5199         (Sized_incremental_binary::inputs_reader_): New data member.
5200         (Sized_incremental_binary::symtab_reader_): New data member.
5201         (Sized_incremental_binary::relocs_reader_): New data member.
5202         (Sized_incremental_binary::got_plt_reader_): New data member.
5203         (Sized_incremental_binary::current_input_file_): New data member.
5204
5205 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5206
5207         PR gold/12640
5208         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5209         violation.
5210
5211 2011-03-30  Cary Coutant  <ccoutant@google.com>
5212
5213         * archive.cc (Archive::include_member): Adjust call to report_object.
5214         (Add_archive_symbols::run): Add script_info to call to
5215         report_archive_begin.
5216         (Lib_group::include_member): Adjust call to report_object.
5217         (Add_lib_group_symbols::run): Adjust call to report_object.
5218         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5219         blocks.  Add object count for script input files.
5220         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5221         script_info parameter; change all callers.
5222         (Incremental_inputs::report_object): Add script_info parameter;
5223         change all callers.
5224         (Incremental_inputs::report_script): Store backpointer to
5225         incremental info entry.
5226         (Output_section_incremental_inputs::set_final_data_size): Record
5227         additional information for scripts.
5228         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5229         * incremental.h (Incremental_script_entry::add_object): New function.
5230         (Incremental_script_entry::get_object_count): New function.
5231         (Incremental_script_entry::get_object): New function.
5232         (Incremental_script_entry::objects_): New data member; adjust
5233         constructor.
5234         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5235         (Incremental_inputs::report_object): Add script_info parameter.
5236         (Incremental_inputs_reader::get_object_count): New function.
5237         (Incremental_inputs_reader::get_object_offset): New function.
5238         * options.cc (Input_arguments::add_file): Return reference to
5239         new input argument.
5240         * options.h (Input_argument::set_script_info): New function.
5241         (Input_argument::script_info): New function.
5242         (Input_argument::script_info_): New data member; adjust all
5243         constructors.
5244         (Input_file_group::add_file): Return reference to new input argument.
5245         (Input_file_lib::add_file): Likewise.
5246         (Input_arguments::add_file): Likewise.
5247         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5248         * script.cc (Parser_closure::Parser_closure): Add script_info
5249         parameter; adjust all callers.
5250         (Parser_closure::script_info): New function.
5251         (Parser_closure::script_info_): New data member.
5252         (read_input_script): Report scripts earlier to incremental info.
5253         (script_add_file): Set script_info in Input_argument.
5254         (script_add_library): Likewise.
5255         * script.h (Script_options::Script_info): Rewrite class.
5256
5257 2011-03-29  Cary Coutant  <ccoutant@google.com>
5258
5259         * archive.cc (Library_base::should_include_member): Move
5260         method here from class Archive.
5261         (Archive::Archive): Initialize base class.
5262         (Archive::should_include_member): Move to base class.
5263         (Archive::do_for_all_unused_symbols): New function.
5264         (Add_archive_symbols::run): Remove redundant access to
5265         incremental_inputs.
5266         (Lib_group::Lib_group): Initialize base class.
5267         (Lib_group::do_filename): New function.
5268         (Lib_group::include_member): Pass pointer to Lib_group to
5269         report_object.
5270         (Lib_group::do_for_all_unused_symbols): New function.
5271         (Add_lib_group_symbols::run): Report archive information for
5272         incremental links.
5273         * archive.h (class Library_base): New base class.
5274         (class Archive): Derive from Library_base.
5275         (Archive::filename): Move to base class.
5276         (Archive::set_incremental_info): Likewise.
5277         (Archive::incremental_info): Likewise.
5278         (Archive::Should_include): Likewise.
5279         (Archive::should_include_member): Likewise.
5280         (Archive::Armap_entry): Remove.
5281         (Archive::Unused_symbol_iterator): Remove.
5282         (Archive::unused_symbols_begin): Remove.
5283         (Archive::unused_symbols_end): Remove.
5284         (Archive::do_filename): New function.
5285         (Archive::do_get_mtime): New function.
5286         (Archive::do_for_all_unused_symbols): New function.
5287         (Archive::task_): Move to base class.
5288         (Archive::incremental_info_): Likewise.
5289         (class Lib_group): Derive from Library_base.
5290         (Lib_group::do_filename): New function.
5291         (Lib_group::do_get_mtime): New function.
5292         (Lib_group::do_for_all_unused_symbols): New function.
5293         (Lib_group::task_): Move to base class.
5294         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5295         function.
5296         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5297         function.
5298         * incremental.cc (Incremental_inputs::report_archive_begin):
5299         Use Library_base; call library's get_mtime; add incremental inputs
5300         entry before members.
5301         (class Unused_symbol_visitor): New class.
5302         (Incremental_inputs::report_archive_end): Use Library_base; use
5303         visitor class to record unused symbols; don't add incremental inputs
5304         entry after members.
5305         (Incremental_inputs::report_object): Use Library_base.
5306         * incremental.h
5307         (Incremental_archive_entry::Incremental_archive_entry): Remove
5308         unused Archive parameter.
5309         (Incremental_inputs::report_archive_begin): Use Library_base.
5310         (Incremental_inputs::report_archive_end): Likewise.
5311         (Incremental_inputs::report_object): Likewise.
5312         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5313         function.
5314         * object.h (Object::for_all_global_symbols): New function.
5315         (Object::do_for_all_global_symbols): New function.
5316         (Sized_relobj::do_for_all_global_symbols): New function.
5317         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5318         function.
5319         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5320         function.
5321
5322 2011-03-27  Ian Lance Taylor  <iant@google.com>
5323
5324         * archive.cc (Archive::interpret_header): Return -1 if something
5325         goes wrong.  Change callers accordingly.
5326
5327 2011-03-25  Cary Coutant  <ccoutant@google.com>
5328
5329         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5330         * testsuite/Makefile.in: Regenerate.
5331
5332 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5333
5334         * plugin.cc (get_view): New.
5335         (Plugin::load): Pass get_view to the plugin.
5336         (Plugin_manager::get_view): New.
5337
5338 2011-03-21  Ian Lance Taylor  <iant@google.com>
5339
5340         * testsuite/final_layout.sh: Rewrite to not use dc.
5341         * testsuite/relro_test.sh: Fail if dc is not present.
5342
5343 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5344
5345         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5346         Change == to -eq.
5347         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5348         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5349         Change == to -eq.
5350         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5351         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5352
5353 2011-03-14  Ian Lance Taylor  <iant@google.com>
5354
5355         * script-sections.cc (Sort_output_sections::script_compare):
5356         Rename from is_before, change return type.
5357         (Sort_output_sections::operator()): Adjust accordingly.
5358
5359 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5360
5361         PR gold/12572
5362         * testsuite/odr_violation2.cc: Add comment to make all error line
5363         numbers double digits.
5364         * testsuite/debug_msg.sh: Adjust expected errors.
5365
5366 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5367
5368         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5369         but mark earlier ones as non-canonical
5370         (offset_to_iterator): Update search target and example
5371         (do_addr2line): Return extra lines in a vector*
5372         (format_file_lineno): Extract from do_addr2line
5373         (one_addr2line): Add vector* out-param
5374         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5375         when a lineno entry appeared last for its instruction
5376         (Dwarf_line_info): Add vector* out-param
5377         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5378         * symtab.cc (Odr_violation_compare): Include the lineno in the
5379         comparison again.
5380         (linenos_from_loc): New. Combine the canonical line for an
5381         address with its other lines.
5382         (True_if_intersect): New. Helper functor to make
5383         std::set_intersection a query.
5384         (detect_odr_violations): Compare sets of lines instead of just
5385         one line for each function. This became less deterministic, but
5386         has fewer false positives.
5387         * symtab.h: Declarations.
5388         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5389         mix an optimized and non-optimized object in the same binary
5390         (odr_violation2.so): Same.
5391         * testsuite/Makefile.in: Regenerate from Makefile.am.
5392         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5393         * testsuite/debug_msg.sh: Update line numbers and add
5394         assertions.
5395         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5396         non-optimized context.
5397         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5398         isn't inlined, and use OdrDerived in an optimized context.
5399         * testsuite/odr_header1.h: Defines OdrDerived, where
5400         optimization will change the
5401         first-instruction-in-the-destructor's file and line number.
5402         * testsuite/odr_header2.h: Defines OdrBase.
5403
5404 2011-03-09  Ian Lance Taylor  <iant@google.com>
5405
5406         * fileread.cc (File_read::clear_views): Don't delete the whole
5407         file view.
5408
5409 2011-03-08  Ian Lance Taylor  <iant@google.com>
5410
5411         PR gold/12525
5412         * fileread.cc: #include <climits>.
5413         (GOLD_IOV_MAX): Define.
5414         (File_read::read_multiple): Limit number of entries by iov_max.
5415         * fileread.h (class File_read): Always set max_readv_entries to
5416         128.
5417
5418 2011-03-07  Ian Lance Taylor  <iant@google.com>
5419
5420         PR gold/12525
5421         * options.h (class General_options): Add -dy and -dn.
5422
5423 2011-03-02  Cary Coutant  <ccoutant@google.com>
5424
5425         * testsuite/script_test_9.t: Add TLS segment.
5426
5427 2011-03-02  Simon Baldwin  <simonb@google.com>
5428
5429         * configure.ac: Add check for gnu_indirect_function support in
5430         the toolchain building binutils.
5431         * configure: Rebuild.
5432
5433 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5434
5435         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5436         plugin only symbols.
5437         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5438         in plugin files as not needed in the symbol table.
5439
5440 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5441
5442         * output.cc (Output_section::add_input_section): Delay fill
5443         generation for section ordering.
5444
5445 2011-02-09  Ian Lance Taylor  <iant@google.com>
5446
5447         PR gold/12316
5448         * object.h (class Sized_relobj): Remove clear_local_symbols.
5449         * reloc.cc (Sized_relobj::do_relocate): Don't call
5450         clear_local_symbols.
5451
5452 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5453
5454         * plugin.cc (is_visible_from_outside): Return true for symbols
5455         in the -u option.
5456
5457 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5458
5459         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5460         filename.
5461
5462 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5463
5464         * icf.h (is_section_foldable_candidate): Change type of parameter
5465         to std::string.
5466         * icf.cc (Icf::find_identical_sections): Change type of local variable
5467         section_name to be std::string.
5468         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5469
5470 2011-01-25  Ian Lance Taylor  <iant@google.com>
5471
5472         * script.cc (script_add_extern): Rewrite to use
5473         add_symbol_reference.
5474
5475 2011-01-25  Doug Kwan  <dougkwan@google.com>
5476
5477         * icf.cc (get_section_contents): Always lock section's object.
5478
5479 2011-01-24  Ian Lance Taylor  <iant@google.com>
5480
5481         * options.h (class General_options): Accept
5482         --no-detect-odr-violations.
5483
5484 2011-01-24  Ian Lance Taylor  <iant@google.com>
5485
5486         * version.cc (version_string): Bump to 1.11.
5487
5488 2011-01-24  Ian Lance Taylor  <iant@google.com>
5489
5490         * plugin.cc (class Plugin_rescan): Define new class.
5491         (Plugin_manager::claim_file): Set any_claimed_.
5492         (Plugin_manager::save_archive): New function.
5493         (Plugin_manager::save_input_group): New function.
5494         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5495         necessary.
5496         (Plugin_manager::new_undefined_symbol): New function.
5497         (Plugin_manager::rescan): New function.
5498         (Plugin_manager::rescannable_defines): New function.
5499         (Plugin_manager::add_input_file): Set any_added_.
5500         * plugin.h (class Plugin_manager): define new fields rescannable_,
5501         undefined_symbols_, any_claimed_, and any_added_.  Declare
5502         Plugin_rescan as friend.  Declare new functions.
5503         (Plugin_manager::Rescannable): Define type.
5504         (Plugin_manager::Rescannable_list): Define type.
5505         (Plugin_manager::Undefined_symbol_list): Define type.
5506         (Plugin_manager::Plugin_manager): Initialize new fields.
5507         * archive.cc (Archive::defines_symbol): New function.
5508         (Add_archive_symbols::run): Pass archive to plugins if any.
5509         * archive.h (class Archive): Declare defines_symbol.
5510         * readsyms.cc (Input_group::~Input_group): New function.
5511         (Finish_group::run): Pass input_group to plugins if any.
5512         * readsyms.h (class Input_group): Declare destructor.
5513         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5514         any.
5515
5516 2011-01-10  Ian Lance Taylor  <iant@google.com>
5517
5518         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5519         section as relro.
5520         (Layout::set_segment_offsets): Reset increase_relro before calling
5521         set_section_addresses a second time.
5522
5523 2011-01-04  Cary Coutant  <ccoutant@google.com>
5524
5525         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5526         sections before NOBITS sections.
5527
5528 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5529
5530         * version.cc (print_version): Update copyright to 2011.
5531
5532 2010-12-23  Cary Coutant  <ccoutant@google.com>
5533
5534         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5535         of OS to this->add.  Add OD parameter to second form of the function.
5536
5537 2010-12-20  Ian Lance Taylor  <iant@google.com>
5538
5539         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5540         second of two consecutive entries with same offset.
5541
5542 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5543
5544         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5545         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5546         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5547         to avoid unneeded links against $(LDADD).
5548         * testsuite/Makefile.in: Regenerate.
5549
5550 2010-12-15  Ian Lance Taylor  <iant@google.com>
5551
5552         PR gold/12324
5553         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5554         for R_X86_64_32 and R_X86_64_PC32.
5555         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5556         ver_matching_def_pic.o.
5557         (ver_matching_def_pic.o): New target.
5558
5559 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5560
5561         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5562         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5563         Move definition before File_read::View member definitions.
5564         (File_read::View::~View): Initialize and hold lock before
5565         updating current_mapped_bytes.
5566
5567 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5568
5569         * dwarf_reader.cc: Remove outdated comment.
5570         * gold-threads.cc: Fix typo in error message.
5571         * archive.cc: Fix typos in comments.
5572         * archive.h: Likewise.
5573         * arm-reloc-property.cc: Likewise.
5574         * arm-reloc-property.h: Likewise.
5575         * arm-reloc.def: Likewise.
5576         * arm.cc: Likewise.
5577         * attributes.h: Likewise.
5578         * cref.cc: Likewise.
5579         * ehframe.cc: Likewise.
5580         * fileread.h: Likewise.
5581         * gold.h: Likewise.
5582         * i386.cc: Likewise.
5583         * icf.cc: Likewise.
5584         * incremental.h: Likewise.
5585         * int_encoding.cc: Likewise.
5586         * layout.h: Likewise.
5587         * main.cc: Likewise.
5588         * merge.h: Likewise.
5589         * object.cc: Likewise.
5590         * object.h: Likewise.
5591         * options.cc: Likewise.
5592         * readsyms.cc: Likewise.
5593         * reduced_debug_output.cc: Likewise.
5594         * reloc.cc: Likewise.
5595         * script-sections.cc: Likewise.
5596         * sparc.cc: Likewise.
5597         * symtab.h: Likewise.
5598         * target-reloc.h: Likewise.
5599         * target.cc: Likewise.
5600         * target.h: Likewise.
5601         * timer.cc: Likewise.
5602         * timer.h: Likewise.
5603         * x86_64.cc: Likewise.
5604
5605 2010-12-09  Cary Coutant  <ccoutant@google.com>
5606
5607         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5608         stack.
5609         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5610         parameter; change all callers.
5611         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5612         * options.h (warn_execstack): New option.
5613
5614 2010-12-07  Doug Kwan  <dougkwan@google.com>
5615
5616         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5617         like function call relocations.
5618
5619 2010-12-07  Ian Lance Taylor  <iant@google.com>
5620
5621         * archive.cc (Archive::get_elf_object_for_member): Permit
5622         punconfigured to be NULL.
5623         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5624         (Archive::include_member): Pass NULL to get_elf_object_for_member
5625         if we searched for the archive and this is the first included
5626         object.
5627
5628 2010-12-01  Ian Lance Taylor  <iant@google.com>
5629
5630         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5631         track_relocs_type_ field.
5632         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5633         Set track_relocs_type_.
5634         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5635         contents when using RELA relocs.
5636         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5637         reloc_map_.
5638         * reloc.cc (Track_relocs::next_addend): New function.
5639         * reloc.h (class Track_relocs): Declare next_addend.
5640
5641 2010-12-01  Ian Lance Taylor  <iant@google.com>
5642
5643         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5644         virtual destructor.
5645
5646 2010-12-01  Ian Lance Taylor  <iant@google.com>
5647
5648         * README: Update compilers known to work and fail.
5649
5650 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5651
5652         * configure.in: For --enable-gold, handle value `default' instead of
5653         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5654         not the default.
5655         * configure: Regenerate.
5656
5657 2010-11-18  Doug Kwan  <dougkwan@google.com>
5658
5659         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5660         and right_alignment to be zero.  Store result alignment only if it is
5661         greater than existing alignment.
5662
5663 2010-11-16  Cary Coutant  <ccoutant@google.com>
5664
5665         PR gold/12220
5666         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5667         Check for ".zdebug_line".
5668
5669 2010-11-16  Doug Kwan  <dougkwan@google.com>
5670             Cary Coutant  <ccoutant@google.com>
5671
5672         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5673         by reference; adjust all callers.
5674         * output.cc (Output_segment::set_section_addresses): Adjust references
5675         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5676         list is empty.
5677         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5678         end at page boundary.
5679
5680 2010-11-16  Cary Coutant  <ccoutant@google.com>
5681
5682         PR gold/12220
5683         * layout.cc (Layout::choose_output_section): Transform names of
5684         compressed sections even when using a script with a SECTIONS clause.
5685         (Layout::output_section_name): Remove code to transform
5686         compressed debug section names.
5687         * output.cc (Output_section::add_input_section): Use uncompressed
5688         section size when tracking input sections.
5689
5690 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5691
5692         * symtab.h (Symbol::NON_PIC_REF): Remove.
5693         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5694         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5695         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5696         (Symbol::use_plt_offset): Take a flags argument and pass it
5697         directly to needs_dynamic_reloc.  Restrict check for undefined
5698         weak symbols to function calls.
5699         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5700         (Target_arm::Scan::global): Use it.
5701         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5702         (Target_arm::Relocate::relocate): Likewise.
5703         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5704         parameter with an r_type parameter.  Use get_reference_flags
5705         to get the flags.
5706         (Target_arm::Relocate::relocate): Update accordingly.
5707         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5708         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5709         (Target_i386::Scan::global): Likewise.
5710         (Target_i386::Relocate::relocate): Likewise.
5711         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5712         parameter with an r_type parameter.  Use get_reference_flags
5713         to get the flags.
5714         (Target_i386::Relocate::relocate): Update accordingly.
5715         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5716         (Target_powerpc::Scan::global): Use it.
5717         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5718         (Target_powerpc::Relocate::relocate): Likewise.
5719         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5720         (Target_sparc::Scan::global): Use it.
5721         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5722         (Target_sparc::Relocate::relocate): Likewise.
5723         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5724         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5725         (Target_x86_64::Scan::global): Likewise.
5726         (Target_x86_64::Relocate::relocate): Likewise.
5727
5728 2010-11-08  Doug Kwan  <dougkwan@google.com>
5729             Cary Coutant  <ccoutant@google.com>
5730
5731         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5732         (Arm_exidx_merge_section::section_contents_): New data member.
5733         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5734         (Arm_input_section::~Arm_input_section): De-allocate memory.
5735         (Arm_input_section::original_contents_): New data member.
5736         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5737         in parameters instead of calling Object::section_contents without
5738         locking.
5739         (Arm_output_section::group_section): New parameter TASK.  Pass it
5740         to callees that need locking objects.
5741         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5742         to lock EXIDX input sections.  Fix a formatting issue.  Call
5743         Arm_exidx_merged_section::build_contents to create merged section
5744         contents.
5745         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5746         to lock object of stub table owner.
5747         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5748         TEXT_SIZE to initialize data member TEXT_SIZE_.
5749         (Arm_exidx_input_section::addralign): Fix typo in comment.
5750         (Arm_exidx_input_section::text_size): New method.
5751         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5752         that require locking objects.  Lock objects before scanning for stubs
5753         and updating local symbols.
5754         (Arm_input_section<big_endian>::init): Copy contents of original
5755         input section.
5756         (Arm_input_section<big_endian>::do_write): Use saved contents of
5757         original input section instead of calling Object::section_contents
5758         without locking.
5759         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5760         size without calling Object::section_size().
5761         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5762         for size.  Allocate a buffer for merged EXIDX entries.
5763         (Arm_exidx_merged_section::build_contents): New method.
5764         (Arm_exidx_merged_section::do_write): Move merge section contents
5765         building code to Arm_exidx_merged_section::build_contetns.  Write
5766         out contetns in buffer instead of building it on the fly.
5767         (Arm_relobj::make_exidx_input_section): Also pass text section size
5768         to Arm_exidx_input_section constructor.
5769         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5770         (Arm_dynobj::do_read_symbols): Fix memory leak.
5771         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5772         * target.h: (class Task): Add forward declaration.
5773         (Target::relax): Add new parameter TASK and pass it to
5774         Target::do_relax().
5775         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5776
5777 2010-11-05  Cary Coutant  <ccoutant@google.com>
5778
5779         PR gold/10708
5780         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5781         object when reading from the file.
5782         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5783         second layout pass.
5784         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5785         when reading section contents.
5786         (get_section_contents): Likewise.
5787         (icf::find_identical_sections): Likewise.
5788         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5789         object when reading from the file.
5790         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5791         the object when doing deferred section layout.
5792
5793 2010-11-03  Nick Clifton  <nickc@redhat.com>
5794
5795         PR gold/12001
5796         * script.h (class Symbol_assignment: name): New member.  Returns
5797         the name of the symbol.
5798         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5799         Returns true if the given symbol name is on the list of
5800         assignments wating to be processed.
5801         * archive.cc (should_incldue_member): If the symbol is undefined,
5802         check to see if it is on the list of symbols pending assignment.
5803
5804 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5805
5806         * script-sections.cc (Script_sections::find_memory_region): Check
5807         for a NULL output section pointer.
5808
5809 2010-10-29  Doug Kwan  <dougkwan@google.com>
5810
5811         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5812         Output_section::add_relaxed_input_section.
5813         * output.cc (Output_section::add_relaxed_input_section): Add new
5814         arguments LAYOUT and NAME.  Set section order index.
5815         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5816         Copy section order index.
5817         * output.h (Output_section::add_relaxed_input_section): Add new
5818         arguments LAYOUT and NAME.
5819
5820 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5821
5822         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5823         NATIVE_OR_CROSS_LINKER.
5824         * testsuite/Makefile.in: Regenerate.
5825
5826 2010-10-20  Doug Kwan  <dougkwan@google.com>
5827
5828         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5829         without SHF_LINK_ORDER flags.
5830         * layout.cc (Layout::choose_output_section): Do not filter
5831         SHF_LINK_ORDER flag in a relocatable link.
5832
5833 2010-10-17  Cary Coutant  <ccoutant@google.com>
5834
5835         * output.h (Output_segment::set_section_addresses): Change function
5836         signature.  Update all callers.
5837         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5838         sections.
5839         (Output_segment::set_section_addresses): Align after last TLS
5840         section.  Add padding before last relro section instead of after.
5841
5842 2010-10-17  Doug Kwan  <dougkwan@google.com>
5843
5844         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5845         GOT output section to be writable.
5846
5847 2010-10-14  Cary Coutant  <ccoutant@google.com>
5848
5849         * debug.h (DEBUG_INCREMENTAL): New flag.
5850         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5851         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5852         mode.
5853         * incremental.cc (report_command_line): Ignore all forms of
5854         --incremental.
5855         * layout.cc (Layout::Layout): Check parameters for incremental link
5856         mode.
5857         * options.cc (General_options::parse_incremental): New function.
5858         (General_options::parse_no_incremental): New function.
5859         (General_options::parse_incremental_full): New function.
5860         (General_options::parse_incremental_update): New function.
5861         (General_options::incremental_mode_): New data member.
5862         (General_options::finalize): Check incremental_mode_.
5863         * options.h (General_options): Update help text for --incremental.
5864         Add --no-incremental, --incremental-full, --incremental-update.
5865         (General_options::Incremental_mode): New enum type.
5866         (General_options::incremental_mode): New function.
5867         (General_options::incremental_mode_): New data member.
5868         * parameters.cc (Parameters::incremental_mode_): New data member.
5869         (Parameters::set_options): Set incremental_mode_.
5870         (Parameters::set_incremental_full): New function.
5871         (Parameters::incremental): New function.
5872         (Parameters::incremental_update): New function.
5873         (set_parameters_incremental_full): New function.
5874         * parameters.h (Parameters::set_incremental_full): New function.
5875         (Parameters::incremental): New function.
5876         (Parameters::incremental_update): New function.
5877         (Parameters::incremental_mode_): New data member.
5878         (set_parameters_incremental_full): New function.
5879         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5880         incremental link mode.
5881         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5882         (Sized_relobj::do_relocate_sections): Likewise.
5883         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5884         option.
5885         * testsuite/Makefile.in: Regenerate.
5886         * testsuite/incremental_test.sh: Filter all forms of --incremental.
5887
5888 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5889
5890         * script-sections.h (class Script_sections): Make
5891         Sections_elements typedef public.
5892         * script-sections.cc (class Sort_output_sections): Add elements_
5893         field.  Add constructor which sets it; change all callers.
5894         (Sort_output_sections::is_before): New function.
5895         (Sort_output_sections::operator()): Call is_before.
5896         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
5897         conditional.
5898         * testsuite/script_test_10.sh: New test. Test script section
5899         order.
5900         * testsuite/script_test_10.t: Likewise.
5901         * testsuite/script_test_10.s: Likewise.
5902         * testsuite/Makefile.am: Wrap the cross linker tests and the
5903         common tests into NATIVE_OR_CROSS_LINKER.
5904         (check_SCRIPTS): Add script_test_10.sh.
5905         (check_DATA): Add script_test_10.stdout.
5906         (script_test_10.o, script_test_10): New targets.
5907         (script_test_10.stdout): New target.
5908         * configure, testsuite/Makefile.in: Regenerate.
5909
5910 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5911
5912         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
5913         error for the deprecated relocations.
5914         (Target_arm::Scan::global): Likewise.
5915         (Target_arm::Relocate::relocate): Likewise.
5916
5917 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
5918
5919         * fileread.cc (Input_file::find_file): Initialize *found_name
5920         and *namep when using the fallback search for case 4.
5921
5922 2010-10-11  Cary Coutant  <ccoutant@google.com>
5923
5924         * options.h (class General_options): Redefine -z lazy as an alias for
5925         the negation of -z now.
5926
5927 2010-10-11  Ian Lance Taylor  <iant@google.com>
5928
5929         * resolve.cc (symbol_to_bits): Report the value of the unsupported
5930         binding.
5931
5932 2010-10-06  Nick Clifton  <nickc@redhat.com>
5933
5934         * script-sections.cc(class Memory_region): Remove
5935         current_lma_offset_ field.  Rename current_vma_offset_ to
5936         current_offset_.  Add last_section_ field.
5937         (Memory_region::get_current_vma_address): Rename to
5938         get_current_address.
5939         (Memory_region::get_current_lma_address): Delete.
5940         (Memory_region::increment_vma_offset): Rename to
5941         increment_offset.
5942         (Memory_region::increment_lma_offset): Delete.
5943         (Memory_region::attributes_compatible): New method.  Returns
5944         true if the provided section is compatible with the region.
5945         (Memory_region::get_last_section): New method.  Returns the last
5946         section to use the region.
5947         (Memory_region::set_last_section): New method.  Stores the last
5948         section to use the region.
5949         (Script_sections::block_in_region): New method.  Returns true if
5950         a block of memory is contained within a region.
5951         (Script_sections::find_memory_region): New method.  Locates a
5952         memory region to be used to set a VMA or LMA address.
5953         (Output_section_definition::set_section_addresses): Add code to
5954         check for addresses set by memory regions.
5955         (Output_segment::set_section_addresses): Remove memory region
5956         walking code.
5957         (Script_sections::create_segment): Add a warning if a header
5958         segment is created outside of any region.
5959         * script-sections.h (class Script_sections): Add prototypes for
5960         find_memory_region and block_in_region methods.
5961         * testsuite/memory_test.s: Use .long instead of .word.
5962         * testsuite/memory_test.t: Add some more output sections.
5963         * testsuite/memory_test.sh: Update expected output.
5964
5965 2010-10-02  Doug Kwan  <dougkwan@google.com>
5966
5967         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
5968         defintion to symtab.h
5969         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
5970         declaration to defintion.
5971
5972 2010-10-01  Nick Clifton  <nickc@redhat.com>
5973
5974         * expression.cc (eval): Replace dummy argument with NULL.
5975         (eval_maybe_dot): Check for a NULL result section pointer.
5976         (Symbol_expression::value): Likewise.
5977         (Dot_expression::value): Likewise.
5978         (BINARY_EXPRESSION): Likewise.
5979         (Max_expression::value): Likewise.
5980         (Min_expression::value): Likewise.
5981         (Absolute_expression::value): Likewise.
5982         (Addr_expression::value_from_output_section): Likewise.
5983         (Loaddddr_expression::value_from_output_section): Likewise.
5984         (Segment_start_expression::value): Likewise.
5985         * script-sections.cc
5986         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
5987         argument with NULL.
5988         (Sections_elememt_dot_assignment::set_section_addresses):
5989         Likewise.
5990         (Output_data_expression::do_write_to_buffer): Likewise.
5991         (Output_section_definition::finalize_symbols): Likewise.
5992         (Output_section_definition::set_section_addresses): Likewise.
5993
5994 2010-09-30  Doug Kwan  <dougkwan@google.com>
5995
5996         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
5997
5998 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
5999
6000         * target.h (Target::can_icf_inline_merge_sections): New virtual
6001         function.
6002         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6003         virtual function.
6004         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6005         virtual function.
6006         * icf.cc (get_section_contents): Inline merge sections only when
6007         target allows it.
6008
6009 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6010
6011         * configure: Regenerate.
6012
6013 2010-09-17  Ian Lance Taylor  <iant@google.com>
6014
6015         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6016         * testsuite/Makefile.am (memory_test.o): New target.
6017         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6018         memory_test.t.
6019         * testsuite/Makefile.in: Rebuild.
6020
6021 2010-09-17  Doug Kwan  <dougkwan@google.com>
6022
6023         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6024         defintion if relocation uses GOT entries of the symbol.
6025         * testsuite/icf_safe_test.sh: Fix test.
6026         * testsuite/icf_safe_so_test.sh: Fix test.
6027
6028 2010-09-16  Cary Coutant  <ccoutant@google.com>
6029
6030         * script_sections.cc (class Memory_region): Remove "NULL" from
6031         vector initializations.
6032
6033 2010-09-15  Cary Coutant  <ccoutant@google.com>
6034
6035         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6036         Resolve forwarding symbols.
6037
6038 2010-09-15  Doug Kwan  <dougkwan@google.com>
6039
6040         * gold/testsuite/script_test_3.t: Add ARM special sections.
6041         * gold/testsuite/script_test_4.t: Same.
6042         * gold/testsuite/script_test_5.t: Same.
6043         * gold/testsuite/script_test_6.t: Same.
6044         * gold/testsuite/script_test_7.t: Same.
6045         * gold/testsuite/script_test_7.t: Same.
6046         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6047
6048 2010-09-14  Cary Coutant  <ccoutant@google.com>
6049
6050         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6051         (Target_x86_64::Relocate::relocate_tls): Replace check for
6052         saw_tls_block_reloc_ with test for executable section.
6053
6054 2010-09-12  Cary Coutant  <ccoutant@google.com>
6055
6056         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6057         position-independent executables to shared libraries need dynamic
6058         relocations.
6059         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6060         position-independent executables.
6061         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6062         * testsuite/Makefile.in: Regenerate.
6063
6064 2010-09-10  Nick Clifton  <nickc@redhat.com>
6065
6066         PR gold/11997
6067         * testsuite/memory_test.t: Discard any sections that are not
6068         needed.
6069
6070 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6071
6072         PR gold/11996
6073         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6074         "This::" to work around a bug in gcc 4.2.
6075
6076         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6077
6078 2010-09-09  Rafael Espindola  <espindola@google.com>
6079
6080         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6081         sections with different PF_X flags in the same segment.
6082         (Layout::find_first_load_seg): Search all segments to find the first
6083         one.
6084         * options.h (rosegment): New.
6085
6086 2010-09-08  Rafael Espindola  <espindola@google.com>
6087
6088         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6089
6090 2010-09-08  Doug Kwan  <dougkwan@google.com>
6091
6092         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6093         (Arm_relobj::do_relocate_sections): Add new parameter for output
6094         file to match the parent.
6095         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6096         of local symbols instead of input values.  Update code to track
6097         changes in gold::relocate_section.
6098         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6099         (Sized_relobj::compute_final_local_value_internal): New methods.
6100         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6101         body into private version of Sized_relobj::compute_final_local_value.
6102         Call the inline method.
6103         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6104         merged symbol value if there is one.
6105         (Symbol_value::has_output_value): New method defintiion.
6106         (Sized_relobj::Compute_final_local_value_status): New enum type.
6107         (Sized_relobj::compute_final_local_value): New methods.
6108         (Sized_relobj::compute_final_local_value_internal): New methods.
6109         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6110         and arm_cortex_a8.sh.
6111         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6112         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6113         New tests.
6114         * Makefile.in: Regenerate.
6115         * testsuite/arm_bl_out_of_range.s: Update test.
6116         * testsuite/thumb_bl_out_of_range.s: Ditto.
6117         * testsuite/thumb_blx_out_of_range.s: Ditto.
6118         * testsuite/arm_branch_out_of_range.sh: New file.
6119         * testsuite/arm_cortex_a8.sh: Ditto.
6120         * testsuite/arm_cortex_a8_b.s: Ditto.
6121         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6122         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6123         * testsuite/arm_cortex_a8_bl.s: Ditto.
6124         * testsuite/arm_cortex_a8_blx.s: Ditto.
6125         * testsuite/arm_cortex_a8_local.s: Ditto.
6126         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6127         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6128
6129 2010-09-08  Rafael Espindola  <espindola@google.com>
6130
6131         * Makefile.am (memory_test.stdout): Run readelf with -W.
6132         * Makefile.in: Regenerate.
6133         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6134         64 bit output.
6135
6136 2010-09-08  Rafael Espindola  <espindola@google.com>
6137
6138         * script-sections.cc (Script_sections::add_memory_region): Convert
6139         field precision to int.
6140         * script.cc (script_set_section_region, script_set_section_region):
6141         Convert field precision to int.
6142
6143 2010-09-08  Rafael Espindola  <espindola@google.com>
6144
6145         * arm.cc (do_finalize_sections): Create the __exidx_start and
6146         __exdix_end symbols even when the section is missing.
6147
6148 2010-09-08  Nick Clifton  <nickc@redhat.com>
6149
6150         * README: Remove claim that MEMORY is not supported.
6151         * expression.cc (script_exp_function_origin)
6152         (script_exp_function_length): Move from here to ...
6153         * script.cc: ... here.
6154         (script_set_section_region, script_add_memory)
6155         (script_parse_memory_attr, script_include_directive): New
6156         functions.
6157         * script-sections.cc
6158         (class Memory_region): New class.
6159         (class Output_section_definition): Add set_memory_region,
6160         set_section_vma, set_section_lma and get_section_name methods.
6161         (class Script_Sections): Add add_memory_region,
6162         find_memory_region, find_memory_region_origin,
6163         find_memory_region_length and set_memory_region methods.
6164         Have set_section_addresses method walk the list of set memory
6165         regions.
6166         Extend the print methos to display memory regions.
6167         * script-sections.h: Add prototypes for new methods.
6168         Add enum for MEMORY region attributes.
6169         * yyscript.y: Add support for parsing MEMORY regions.
6170         * script-c.h: Add prototypes for new functions.
6171         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6172         * testsuite/Makefile.in: Regenerate.
6173         * testsuite/memory_test.sh: New script.
6174         * testsuite/memory_test.s: New assembler source file.
6175         * testsuite/memory_test.t: New linker script.
6176
6177 2010-08-27  Doug Kwan  <dougkwan@google.com>
6178
6179         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6180         reference override an existing dynamic weak reference.
6181         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6182         * testsuite/Makefile.in: Regenerate.
6183         * testsuite/dyn_weak_ref.sh: New file.
6184         * testsuite/dyn_weak_ref_1.c: Ditto.
6185         * testsuite/dyn_weak_ref_2.c: Ditto.
6186
6187 2010-08-27  Ian Lance Taylor  <iant@google.com>
6188
6189         * incremental.h (class Incremental_input_entry): Add virtual
6190         destructor.
6191
6192 2010-08-27  Ian Lance Taylor  <iant@google.com>
6193
6194         * testsuite/start_lib_test_3.c: Mark t3 as used.
6195
6196 2010-08-27  Nick Clifton  <nickc@redhat.com>
6197
6198         * options.cc (version_script): Fix small typo in previous
6199         whitespace tidyup.
6200
6201 2010-08-25  Nick Clifton  <nickc@redhat.com>
6202
6203         * archive.cc: Formatting fixes: Remove whitespace between
6204         typename and following asterisk.  Remove whitespace between
6205         function name and opening parenthesis.
6206         * archive.h: Likewise.
6207         * arm.cc: Likewise.
6208         * attributes.cc: Likewise.
6209         * attributes.h: Likewise.
6210         * common.cc: Likewise.
6211         * copy-relocs.cc: Likewise.
6212         * dirsearch.h: Likewise.
6213         * dynobj.cc: Likewise.
6214         * ehframe.cc: Likewise.
6215         * ehframe.h: Likewise.
6216         * expression.cc: Likewise.
6217         * fileread.cc: Likewise.
6218         * fileread.h: Likewise.
6219         * gc.h: Likewise.
6220         * gold-threads.cc: Likewise.
6221         * gold.cc: Likewise.
6222         * i386.cc: Likewise.
6223         * icf.h: Likewise.
6224         * incremental-dump.cc: Likewise.
6225         * incremental.cc: Likewise.
6226         * layout.cc: Likewise.
6227         * layout.h: Likewise.
6228         * main.cc: Likewise.
6229         * merge.cc: Likewise.
6230         * merge.h: Likewise.
6231         * object.cc: Likewise.
6232         * object.h: Likewise.
6233         * options.cc: Likewise.
6234         * options.h: Likewise.
6235         * output.cc: Likewise.
6236         * output.h: Likewise.
6237         * plugin.cc: Likewise.
6238         * plugin.h: Likewise.
6239         * powerpc.cc: Likewise.
6240         * reloc.cc: Likewise.
6241         * script-c.h: Likewise.
6242         * script-sections.cc: Likewise.
6243         * script.cc: Likewise.
6244         * stringpool.cc: Likewise.
6245         * symtab.cc: Likewise.
6246         * symtab.h: Likewise.
6247         * target.cc: Likewise.
6248         * timer.cc: Likewise.
6249         * timer.h: Likewise.
6250         * version.cc: Likewise.
6251         * x86_64.cc: Likewise.
6252
6253 2010-08-24  Nick Clifton  <nickc@redhat.com>
6254
6255         PR 11899
6256         * layout.cc (segment_precedes): Sort segments by their physical
6257         addresses, if they have been set.
6258
6259 2010-08-23  Cary Coutant  <ccoutant@google.com>
6260
6261         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6262         symbols data.
6263         (Lib_group::include_member): Unlock object after deleting its
6264         symbols data.
6265         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6266         the bug fixed here.
6267
6268 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6269             Cary Coutant  <ccoutant@google.com>
6270
6271         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6272         constructor, and set_blocker.
6273         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6274         readsyms_blocker_.
6275         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6276         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6277         * testsuite/Makefile.am (start_lib_test): New test case.
6278         * testsuite/Makefile.in: Regenerate.
6279         * testsuite/start_lib_test_main.c: New file.
6280         * testsuite/start_lib_test_1.c: New file.
6281         * testsuite/start_lib_test_2.c: New file.
6282         * testsuite/start_lib_test_3.c: New file.
6283
6284 2010-08-19  Ian Lance Taylor  <iant@google.com>
6285
6286         * Makefile.in: Rebuild with automake 1.11.1.
6287         * aclocal.m4: Likewise.
6288         * testsuite/Makefile.in: Likewise.
6289
6290 2010-08-19  Ian Lance Taylor  <iant@google.com>
6291
6292         PR 10893
6293         * i386.cc (class Output_data_plt_i386): Update declarations.
6294         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6295         local_ifuncs_ fields.
6296         (Target_i386::do_plt_section_for_global): New function.
6297         (Target_i386::do_plt_section_for_local): New function.
6298         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6299         parameter; change all callers.  Initialize global_ifuncs_ and
6300         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6301         __rel_iplt_end.
6302         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6303         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6304         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6305         symbols.
6306         (Target_i386::make_plt_section): New function, broken out of
6307         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6308         (Target_i386::make_plt_entry): Call make_plt_section.
6309         (Target_i386::make_local_ifunc_plt_entry): New function.
6310         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6311         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6312         R_386_IRELATIVE to switch.
6313         (Target_i386::Scan::global): Likewise.
6314         (Target_i386::Relocate::relocate): Likewise.
6315         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6316         switch.
6317         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6318         (Target_x86_64::do_plt_section_for_global): New function.
6319         (Target_x86_64::do_plt_section_for_local): New function.
6320         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6321         parameter; change all callers.  If doing a static link define
6322         __rela_iplt_start and __rela_iplt_end.
6323         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6324         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6325         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6326         to point to .plt.
6327         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6328         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6329         switch.
6330         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6331         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6332         R_X86_64_IRELATIVE to switch.
6333         (Target_x86_64::Scan::global): Likewise.
6334         (Target_x86_64::Relocate::relocate): Likewise.
6335         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6336         switch.
6337         * target.h (class Target): Add plt_section_for_global and
6338         plt_section_for_local functions.  Add do_plt_section_for_global
6339         and do_plt_section_for_local virtual functions.
6340         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6341         clarifying comments.
6342         (Symbol::use_plt_offset): Handle IFUNC symbol.
6343         * object.cc (Sized_relobj::Sized_relobj): Initialize
6344         local_plt_offsets_.
6345         (Sized_relobj::local_has_plt_offset): New function.
6346         (Sized_relobj::local_plt_offset): New function.
6347         (Sized_relobj::set_local_plt_offset): New function.
6348         (Sized_relobj::do_count): Handle IFUNC symbol.
6349         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6350         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6351         is_ifunc_symbol functions.
6352         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6353         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6354         local_plt_offsets_ field.
6355         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6356         * output.h (class Output_section_data): Add non-const
6357         output_section function.
6358         (class Output_data_got): Update declarations.
6359         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6360         Add use_plt_offset parameter to global and local constructors.
6361         Change all callers.  Change local_sym_index_ field to 31 bits.
6362         Change GSYM_CODE and CONSTANT_CODE accordingly.
6363         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6364         doing a static link don't set sh_link field.
6365         (Output_data_got::Got_entry::write): Use PLT offset if
6366         appropriate.
6367         (Output_data_got::add_global_plt): New function.
6368         (Output_data_got::add_local_plt): New function.
6369         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6370         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6371         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6372         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6373         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6374         IFUNC conditional.
6375         * testsuite/ifunc-sel.h: New file.
6376         * testsuite/ifuncmain1.c: New file.
6377         * testsuite/ifuncmain1vis.c: New file.
6378         * testsuite/ifuncmod1.c: New file.
6379         * testsuite/ifuncdep2.c: New file.
6380         * testsuite/ifuncmain2.c: New file.
6381         * testsuite/ifuncmain3.c: New file.
6382         * testsuite/ifuncmod3.c: New file.
6383         * testsuite/ifuncmain4.c: New file.
6384         * testsuite/ifuncmain5.c: New file.
6385         * testsuite/ifuncmod5.c: New file.
6386         * testsuite/ifuncmain6pie.c: New file.
6387         * testsuite/ifuncmod6.c: New file.
6388         * testsuite/ifuncmain7.c: New file.
6389         * configure, testsuite/Makefile.in: Rebuild.
6390
6391 2010-08-18  Ian Lance Taylor  <iant@google.com>
6392
6393         * incremental.cc
6394         (Output_section_incremental_inputs::write_input_files): Add cast
6395         to avoid signed/unsigned comparison warning.
6396         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6397
6398 2010-08-12  Cary Coutant  <ccoutant@google.com>
6399
6400         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6401
6402 2010-08-13  Ian Lance Taylor  <iant@google.com>
6403
6404         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6405
6406 2010-08-12  Cary Coutant  <ccoutant@google.com>
6407             Doug Kwan  <dougkwan@google.com>
6408
6409         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6410         defintion overrides non-weak undef, remember that the original undef
6411         is not weak.
6412         * symtab.cc (Symbol_table::sized_write_global): For undef without
6413         an original weak binding, set binding to global in output.
6414         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6415         * testsuite/Makefile.in: Regenerate.
6416         * testsuite/strong_ref_weak_def.sh: New file.
6417         * testsuite/strong_ref_weak_def_1.c: Ditto.
6418         * testsuite/strong_ref_weak_def_2.c: Ditto.
6419
6420 2010-08-12  Cary Coutant  <ccoutant@google.com>
6421
6422         * testsuite/incremental_test.sh: Rewrite.
6423         * testsuite/incremental_test_1.c: Rewrite.
6424         * testsuite/incremental_test_2.c: Rewrite.
6425
6426 2010-08-12  Cary Coutant  <ccoutant@google.com>
6427
6428         * arm.cc (Target_arm::got_size): Add const.
6429         (Target_arm::got_entry_count): New function.
6430         (Target_arm::plt_entry_count): New function.
6431         (Target_arm::first_plt_entry_offset): New function.
6432         (Target_arm::plt_entry_size): New function.
6433         (Output_data_plt_arm::entry_count): New function.
6434         (Output_data_plt_arm::first_plt_entry_offset): New function.
6435         (Output_data_plt_arm::get_plt_entry_size): New function.
6436         * i386.cc (Target_i386::got_size): Add const.
6437         (Target_i386::got_entry_count): New function.
6438         (Target_i386::plt_entry_count): New function.
6439         (Target_i386::first_plt_entry_offset): New function.
6440         (Target_i386::plt_entry_size): New function.
6441         (Output_data_plt_i386::entry_count): New function.
6442         (Output_data_plt_i386::first_plt_entry_offset): New function.
6443         (Output_data_plt_i386::get_plt_entry_size): New function.
6444         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6445         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6446         * incremental.cc: Include target.h.
6447         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6448         parameter.  Adjust all callers.  Find incremental_got_plt section.
6449         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6450         section.
6451         (Output_section_incremental_inputs::set_final_data_size): Calculate
6452         size of incremental_got_plt section.
6453         (Output_section_incremental_inputs::do_write): Write the
6454         incremental_got_plt section.
6455         (Got_plt_view_info): New struct.
6456         (Local_got_offset_visitor): New class.
6457         (Global_got_offset_visitor): New class.
6458         (Global_symbol_visitor_got_plt): New class.
6459         (Output_section_incremental_inputs::write_got_plt): New function.
6460         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6461         Add parameter.  Adjust all callers.
6462         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6463         (Incremental_inputs::got_plt_section): New function.
6464         (Incremental_inputs::got_plt_section_): New data member.
6465         (Incremental_got_plt_reader): New class.
6466         * layout.cc (Layout::create_incremental_info_sections): Add the
6467         incremental_got_plt section.
6468         * object.h (Got_offset_list::get_list): New function.
6469         (Got offset_list::for_all_got_offsets): New function.
6470         (Sized_relobj::local_got_offset_list): New function.
6471         * powerpc.cc (Target_powerpc::got_size): Add const.
6472         (Target_powerpc::got_entry_count): New function.
6473         (Target_powerpc::plt_entry_count): New function.
6474         (Target_powerpc::first_plt_entry_offset): New function.
6475         (Target_powerpc::plt_entry_size): New function.
6476         (Output_data_plt_powerpc::entry_count): New function.
6477         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6478         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6479         * sparc.cc (Target_sparc::got_size): Add const.
6480         (Target_sparc::got_entry_count): New function.
6481         (Target_sparc::plt_entry_count): New function.
6482         (Target_sparc::first_plt_entry_offset): New function.
6483         (Target_sparc::plt_entry_size): New function.
6484         (Output_data_plt_sparc::entry_count): New function.
6485         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6486         (Output_data_plt_sparc::get_plt_entry_size): New function.
6487         * symtab.h (Symbol::got_offset_list): New function.
6488         (Symbol_table::for_all_symbols): New function.
6489         * target.h (Sized_target::got_entry_count): New function.
6490         (Sized_target::plt_entry_count): New function.
6491         (Sized_target::plt_entry_size): New function.
6492         * x86_64.cc (Target_x86_64::got_size): Add const.
6493         (Target_x86_64::got_entry_count): New function.
6494         (Target_x86_64::plt_entry_count): New function.
6495         (Target_x86_64::first_plt_entry_offset): New function.
6496         (Target_x86_64::plt_entry_size): New function.
6497         (Output_data_plt_x86_64::entry_count): New function.
6498         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6499         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6500
6501 2010-08-12  Cary Coutant  <ccoutant@google.com>
6502
6503         * archive.cc: Include incremental.h.
6504         (Archive::Archive): Initialize incremental_info_.
6505         (Archive::include_member): Record archive members in incremental info.
6506         (Add_archive_symbols::run): Record begin and end of an archive in
6507         incremental info.
6508         (Lib_group::include_member): Record objects in incremental info.
6509         * archive.h (Incremental_archive_entry): Forward declaration.
6510         (Archive::set_incremental_info): New member function.
6511         (Archive::incremental_info): New member function.
6512         (Archive::Unused_symbol_iterator): New class.
6513         (Archive::unused_symbols_begin): New member function.
6514         (Archive::unused_symbols_end): New member function.
6515         (Archive::incremental_info_): New data member.
6516         * incremental-dump.cc (find_input_containing_global): New function.
6517         (dump_incremental_inputs): Dump new incremental info sections.
6518         * incremental.cc: Include symtab.h.
6519         (Output_section_incremental_inputs): New class.
6520         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6521         new incremental info sections.
6522         (Sized_incremental_binary::do_check_inputs): Likewise.
6523         (Incremental_inputs::report_archive): Remove.
6524         (Incremental_inputs::report_archive_begin): New function.
6525         (Incremental_inputs::report_archive_end): New function.
6526         (Incremental_inputs::report_object): New function.
6527         (Incremental_inputs::finalize_inputs): Remove.
6528         (Incremental_inputs::report_input_section): New function.
6529         (Incremental_inputs::report_script): Rewrite.
6530         (Incremental_inputs::finalize): Do nothing but finalize string table.
6531         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6532         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6533         (Incremental_inputs::create_data_sections): New function.
6534         (Incremental_inputs::relocs_entsize): New function.
6535         (Output_section_incremental_inputs::set_final_data_size): New function.
6536         (Output_section_incremental_inputs::do_write): New function.
6537         (Output_section_incremental_inputs::write_header): New function.
6538         (Output_section_incremental_inputs::write_input_files): New function.
6539         (Output_section_incremental_inputs::write_info_blocks): New function.
6540         (Output_section_incremental_inputs::write_symtab): New function.
6541         * incremental.h (Incremental_script_entry): Forward declaration.
6542         (Incremental_object_entry): Forward declaration.
6543         (Incremental_archive_entry): Forward declaration.
6544         (Incremental_inputs): Forward declaration.
6545         (Incremental_inputs_header_data): Remove.
6546         (Incremental_inputs_header): Remove.
6547         (Incremental_inputs_header_write): Remove.
6548         (Incremental_inputs_entry_data): Remove.
6549         (Incremental_inputs_entry): Remove.
6550         (Incremental_inputs_entry_write): Remove.
6551         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6552         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6553         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6554         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6555         Likewise.
6556         (Incremental_input_entry): New class.
6557         (Incremental_script_entry): New class.
6558         (Incremental_object_entry): New class.
6559         (Incremental_archive_entry): New class.
6560         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6561         (Incremental_inputs::report_inputs): Remove.
6562         (Incremental_inputs::report_archive): Remove.
6563         (Incremental_inputs::report_archive_begin): New function.
6564         (Incremental_inputs::report_archive_end): New function.
6565         (Incremental_inputs::report_object): Change prototype.
6566         (Incremental_inputs::report_input_section): New function.
6567         (Incremental_inputs::report_script): Change prototype.
6568         (Incremental_inputs::get_reloc_count): New function.
6569         (Incremental_inputs::set_reloc_count): New function.
6570         (Incremental_inputs::create_data_sections): New function.
6571         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6572         (Incremental_inputs::inputs_section): New function.
6573         (Incremental_inputs::symtab_section): New function.
6574         (Incremental_inputs::relocs_section): New function.
6575         (Incremental_inputs::get_stringpool): Add const.
6576         (Incremental_inputs::command_line): Add const.
6577         (Incremental_inputs::inputs): Remove.
6578         (Incremental_inputs::command_line_key): New function.
6579         (Incremental_inputs::input_file_count): New function.
6580         (Incremental_inputs::input_files): New function.
6581         (Incremental_inputs::relocs_entsize): New function.
6582         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6583         (Incremental_inputs::finalize_inputs): Remove.
6584         (Incremental_inputs::Input_info): Remove.
6585         (Incremental_inputs::lock_): Remove.
6586         (Incremental_inputs::inputs_): Change type.
6587         (Incremental_inputs::inputs_map_): Remove.
6588         (Incremental_inputs::current_object_entry_): New data member.
6589         (Incremental_inputs::inputs_section_): New data member.
6590         (Incremental_inputs::symtab_section_): New data member.
6591         (Incremental_inputs::relocs_section_): New data member.
6592         (Incremental_inputs::reloc_count_): New data member.
6593         (Incremental_inputs_reader): New class.
6594         (Incremental_symtab_reader): New class.
6595         (Incremental_relocs_reader): New class.
6596         * layout.cc (Layout::finalize): Move finalization of incremental info
6597         and creation of incremental info sections to follow finalization of
6598         symbol table.  Set offsets for postprocessing sections.
6599         (Layout::create_incremental_info_sections): Call
6600         Incremental_inputs::create_data_sections.  Add incremental symtab
6601         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6602         sections to layout after input sections.
6603         * layout.h (struct Timespec): Forward declaration.
6604         (Layout::incremental_inputs): Add const.
6605         (Layout::create_incremental_info_sections): Add parameter.
6606         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6607         * object.cc: Include incremental.h.
6608         (Relobj::finalize_incremental_relocs): New function.
6609         (Sized_relobj::do_layout): Record input sections in incremental info.
6610         * object.h (Object::output_section): New function.
6611         (Object::output_section_offset): Moved from Relobj.
6612         (Object::get_incremental_reloc_base): New function.
6613         (Object::get_incremental_reloc_count): New function.
6614         (Object::do_output_section): New function.
6615         (Object::do_output_section_offset): Moved from Relobj.
6616         (Object::do_get_incremental_reloc_base): New function.
6617         (Object::do_get_incremental_reloc_count): New function.
6618         (Object::Object): Initialize new data members.
6619         (Relobj::output_section): Renamed do_output_section and moved to
6620         protected.
6621         (Relobj::output_section_offset): Moved to Object.
6622         (Relobj::do_get_incremental_reloc_base): New function.
6623         (Relobj::do_get_incremental_reloc_count): New function.
6624         (Relobj::allocate_incremental_reloc_counts): New function.
6625         (Relobj::count_incremental_reloc): New function.
6626         (Relobj::finalize_incremental_relocs): New function.
6627         (Relobj::next_incremental_reloc_index): New function.
6628         (Relobj::reloc_counts_): New data member.
6629         (Relobj::reloc_bases_): New data member.
6630         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6631         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6632         (Sized_relobj::incremental_relocs_scan): New function.
6633         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6634         (Sized_relobj::incremental_relocs_write): New function.
6635         (Sized_relobj::incremental_relocs_write_reltype): New function.
6636         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6637         incremental link.
6638         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6639         archives and object files elsewhere.
6640         (Add_symbols::run): Report object files here.
6641         (Finish_group::run): Report end of archive at end of group.
6642         * reloc.cc: Include layout.h, incremental.h.
6643         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6644         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6645         (Sized_relobj::incremental_relocs_scan): New function.
6646         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6647         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6648         (Sized_relobj::incremental_relocs_write): New function.
6649         (Sized_relobj::incremental_relocs_write_reltype): New function.
6650         * script.cc (read_input_script): Rewrite test for incremental link.
6651         Change call to Incremental_inputs::report_script.
6652         * symtab.h (Symbol_table::first_global_index): New function.
6653         (Symbol_table::output_count): New function.
6654
6655 2010-08-12  Doug Kwan  <dougkwan@google.com>
6656
6657         * arm.cc (Target_arm::merge_object_attributes): Check command line
6658         options --no-wchar-size-warning and --no-enum-size-warning.
6659         * options.h (General_options): Add ld-compatible options
6660         --no-enum-size-warning and --no-wchar-size-warning.
6661
6662 2010-08-04  Ian Lance Taylor  <iant@google.com>
6663
6664         * x86_64.cc (Target_x86_64::Scan::local): Use
6665         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6666         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6667         (Target_x86_64::Scan::global): Likewise.
6668         (Target_x86_64::Relocate::relocate): Likewise.
6669         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6670         Likewise.
6671
6672 2010-08-03  Cary Coutant  <ccoutant@google.com>
6673
6674         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6675         to reserve space in merged_strings vector. Keep total input size
6676         for stats.
6677         (Output_merge_string::do_print_merge_stats): Print total input size.
6678         * merge.h (Output_merge_string): Add input_size_ field.
6679         * stringpool.cc (Stringpool_template::string_length): Move
6680         implementations out of Stringpool_template class and place in
6681         stringpool.h.
6682         * stringpool.h (string_length): Move out of Stringpool_template.
6683
6684 2010-08-03  Ian Lance Taylor  <iant@google.com>
6685
6686         PR 11712
6687         * layout.cc (relaxation_loop_body): If address of load segment is
6688         set, adjust address to include headers if possible.
6689
6690 2010-08-03  Ian Lance Taylor  <iant@google.com>
6691
6692         * version.cc (version_string): Bump to 1.10.
6693
6694 2010-08-03  Ian Lance Taylor  <iant@google.com>
6695
6696         PR 11805
6697         * layout.h (enum Output_section_order): Define.
6698         (class Layout): Update declarations.
6699         * layout.cc (Layout::get_output_section): Add order parameter.
6700         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6701         is_first_non_relro parameters.  Change all callers.
6702         (Layout::choose_output_section): Likewise.
6703         (Layout::add_output_section_data): Likewise.
6704         (Layout::make_output_section): Likewise.  Set order.
6705         (Layout::default_section_order): New function.
6706         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6707         * output.cc (Output_section::Output_section): Initialize order_.
6708         Don't initialize deleted fields.
6709         (Output_segment::Output_segment): Don't initialize deleted
6710         fields.
6711         (Output_segment::add_output_section_to_load): New function
6712         replacing add_output_section.  Change all callers to call this or
6713         add_output_section_to_nonload.
6714         (Output_segment::add_output_section_to_nonload): New function.
6715         (Output_segment::remove_output_section): Rewrite.
6716         (Output_segment::add_initial_output_data): Likewise.
6717         (Output_segment::has_any_data_sections): Likewise.
6718         (Output_segment::is_first_section_relro): Likewise.
6719         (Output_segment::maximum_alignment): Likewise.
6720         (Output_segment::has_dynamic_reloc): New function replacing
6721         dynamic_reloc_count.  Change all callers.
6722         (Output_segment::has_dynamic_reloc_list): New function replacing
6723         dynamic_reloc_count_list.  Change all callers.
6724         (Output_segment::set_section_addresses): Rewrite.
6725         (Output_segment::set_offset): Rewrite.
6726         (Output_segment::find_first_and_last_list): Remove.
6727         (Output_segment::set_tls_offsets): Rewrite.
6728         (Output_segment::first_section_load_address): Likewise.
6729         (Output_segment::output_section_count): Likewise.
6730         (Output_segment::section_with_lowest_load_address): Likewise.
6731         (Output_segment::write_section_headers): Likewise.
6732         (Output_segment::print_sections_to_map): Likewise.
6733         * output.h (class Output_data): Remove dynamic_reloc_count_
6734         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6735         (Output_data::add_dynamic_reloc): Rewrite.
6736         (Output_data::has_dynamic_reloc): New function.
6737         (Output_data::dynamic_reloc_count): Remove.
6738         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6739         is_last_relro_, is_first_non_relro_, is_interp_,
6740         is_dynamic_linker_section_ fields.  Add order and set_order
6741         functions.  Remove is_relro_local, set_is_relro_local,
6742         is_last_relro, set_is_last_relro, is_first_non_relro,
6743         set_is_first_non_relro functions, is_interp, set_is_interp,
6744         is_dynamic_linker_section, and set_is_dynamic_linker_section
6745         functions.
6746         (class Output_segment): Change Output_data_list from std::list to
6747         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6748         output_bss_ fields.  Update declarations.
6749
6750 2010-08-02  Ian Lance Taylor  <iant@google.com>
6751
6752         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6753         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6754         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6755
6756 2010-08-02  Ian Lance Taylor  <iant@google.com>
6757
6758         PR 11855
6759         * script.cc (Script_options::Script_options): Initialize
6760         symbol_definitions_ and symbol_references_.
6761         (Script_options::add_symbol_assignment): Update
6762         symbol_definitions_ and symbol_references_.
6763         (Script_options::add_symbol_reference): New function.
6764         (script_symbol): New function.
6765         * script.h (class Script_options): Add symbol_definitions_ and
6766         symbol_references_ fields.
6767         (Script_options::referenced_const_iterator): New type.
6768         (Script_options::referenced_begin): New function.
6769         (Script_options::referenced_end): New function.
6770         (Script_options::is_referenced): New function.
6771         (Script_options::any_unreferenced): New function.
6772         * script-c.h (script_symbol): Declare.
6773         * yyscript.y (exp): Call script_symbol.
6774         * symtab.cc: Include "script.h".
6775         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6776         Change all callers.  Check symbols referenced by scripts.
6777         (Symbol_table::add_undefined_symbols_from_command_line): Add
6778         layout parameter.  Change all callers.
6779         (Symbol_table::do_add_undefined_symbols_from_command_line):
6780         Likewise.  Break out loop body.  Check symbols referenced by
6781         scripts.
6782         (Symbol_table::add_undefined_symbol_from_command_line): New
6783         function broken out of
6784         do_add_undefined_symbols_from_command_line.
6785         * symtab.h (class Symbol_table): Update declarations.
6786         * archive.cc: Include "layout.h".
6787         (Archive::should_include_member): Add layout parameter.  Change
6788         all callers.  Check for symbol mentioned in expression.
6789         * archive.h (class Archive): Update declaration.
6790         * object.cc (Sized_relobj::do_should_include_member): Add layout
6791         parameter.
6792         * object.h (Object::should_include_member): Add layout parameter.
6793         Change all callers.
6794         (Object::do_should_include_member): Add layout parameter.
6795         (class Sized_relobj): Update declaration.
6796         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6797         parameter.
6798         * dynobj.h (class Sized_dynobj): Update declaration.
6799         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6800         layout parameter.
6801         * plugin.h (class Sized_pluginobj): Update declaration.
6802
6803 2010-08-02  Ian Lance Taylor  <iant@google.com>
6804
6805         PR 11866
6806         * output.cc (Output_segment::set_offset): Search for the first and
6807         last sections rather than assuming that the list is in order.
6808         (Output_segment::find_first_and_last_list): New function.
6809         * output.h (class Output_segment): Update declarations.
6810         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6811         (relro_strip_test_SOURCES): New variable.
6812         (relro_strip_test_DEPENDENCIES): New variable.
6813         (relro_strip_test_LDFLAGS): New variable.
6814         (relro_strip_test_LDADD): New variable.
6815         (relro_strip_test.so): New target.
6816
6817 2010-08-02  Ian Lance Taylor  <iant@google.com>
6818
6819         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6820         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6821         (Target_i386::got_tlsdesc_section): New function.
6822         (Target_i386::got_section): Create space for GOT entries for
6823         TLSDESC relocations.
6824         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6825         R_386_TLS_GOTDESC.
6826         (Target_i386::Scan::global): Likewise.
6827         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6828         using TLSDESC GOT.
6829         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6830         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6831         (Target_x86_64::got_tlsdesc_section): New function.
6832         (Target_x86_64::got_section): Create space for GOT entries for
6833         TLSDESC relocations.
6834         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6835         R_386_TLS_GOTDESC.
6836         (Target_x86_64::Scan::global): Likewise.
6837         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6838         using TLSDESC GOT.
6839
6840 2010-08-02  Ian Lance Taylor  <iant@google.com>
6841
6842         * testsuite/final_layout.sh: Use dc to convert from hex to
6843         decimal.
6844
6845 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6846
6847         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6848         paramter to the call to gold::gc_process_relocs.
6849         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6850         paramter to the call to gold::gc_process_relocs.
6851         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6852         parameter to the call to gold::gc_process_relocs.
6853         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6854         template parameter to the call to gold::gc_process_relocs.
6855         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6856         paramter to the call to gold::gc_process_relocs.
6857         * gc.h (get_embedded_addend_size): New function.
6858         (gc_process_relocs): Save the size of the reloc for use by ICF.
6859         * icf.cc (get_section_contents): Get the addend from the text section
6860         for SHT_REL relocation sections.
6861         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6862         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6863         * int_encoding.h (read_from_pointer): New overloaded function.
6864         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6865         * testsuite/icf_sht_rel_addend_test.sh: New file.
6866         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6867         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6868
6869 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6870
6871         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6872         * Makefile.in: Regenerate.
6873         * testsuite/Makefile.in: Regenerate.
6874
6875 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6876
6877         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6878         * gold/testsuite/debug_msg.cc: Likewise.
6879         * gold/testsuite/odr_violation1.cc
6880         * gold/testsuite/odr_violation2.cc
6881
6882 2010-07-21  Cary Coutant  <ccoutant@google.com>
6883
6884         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6885         string, and length fields.
6886         (Output_merge_string::Merged_strings_list): New type.
6887         (Output_merge_string::Merged_strings_lists): New typedef.
6888         (Output_merge_string): Replace merged_strings_ with
6889         merged_strings_lists_.
6890         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
6891         Merged_strings_list per input object and section.  Don't store pointer
6892         to the string.  Don't store length with each merged string entry.
6893         (Output_merge_string::finalize_merged_data): Loop over list of merged
6894         strings lists.  Recompute length of each merged string.
6895
6896 2010-07-15  Cary Coutant  <ccoutant@google.com>
6897
6898         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
6899         here.
6900
6901 2010-07-14  Ian Lance Taylor  <iant@google.com>
6902
6903         * descriptors.cc (Descriptors::open): Report correct name in error
6904         message.
6905
6906 2010-07-13  Doug Kwan  <dougkwan@google.com>
6907
6908         * arm.cc (Arm_input_section::Arm_input_section): For a
6909         SHT_ARM_EXIDX section, always keeps the input sections.
6910         (Arm_input_section::set_exidx_section_link): New method.
6911         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
6912         has_errors_ to false.
6913         (Arm_exidx_input_section::has_errors,
6914         Arm_exidx_input_section::set_has_errors): New methods.
6915         (Arm_exidx_input_section::has_errors_): New data member.
6916         (Arm_relobj::get_exidx_shndx_list): New method.
6917         (Arm_output_section::append_text_sections_to_list): Do not skip
6918         section without SHF_EXECINSTR.
6919         (Arm_output_section::fix_exidx_coverage): Skip input sections with
6920         errors.
6921         (Arm_relobj::make_exidx_input_section): Add new parameter for text
6922         section header.  Make error messages more verbose.  Check for
6923         a non-executable section linked to an EXIDX section.
6924         (Arm_relobj::do_read_symbols): Remove error checking, which has been
6925         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
6926         check that there is no deferred EXIDX section if we exit early.
6927         Instead of not making an EXIDX section in case of an error, make one
6928         and set the has_errors flag of it.
6929         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
6930         in a relocatable link.
6931         (Target_arm::do_relax): Look for the EXIDX output section instead of
6932         assuming that it is called .ARM.exidx.
6933         (Target_arm::fix_exidx_coverage): Add a new parameter for input
6934         section list.  Do not check for SHF_EXECINSTR section flags but
6935         skip any input section with errors.
6936         * output.cc (Output_section::Output_section): Initialize
6937         always_keeps_input_sections_ to false.
6938         (Output_section::add_input_section): Check for
6939         always_keeps_input_sections_.
6940         *  output.h (Output_section::always_keeps_input_sections,
6941         Output_section::set_always_keeps_input_sections): New methods.
6942         (Output_section::always_keeps_input_sections): New data member.
6943
6944 2010-07-13  Rafael Espindola  <espindola@google.com>
6945
6946         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
6947         * fileread.h (Input_file): Add try_extra_search_path and find_file.
6948
6949 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
6950             Ian Lance Taylor  <iant@google.com>
6951
6952         * output.h (Output_section_lookup_maps::add_merge_section):
6953         Correct check of whether value was inserted.
6954         (Output_section_lookup_maps::add_merge_input_section): Likewise.
6955         (Output_section_lookup_maps::add_relaxed_input_section):
6956         Likewise.
6957         * arm.cc (Target_arm::got_section): Remove used local os.
6958         * i386.cc (Target_i386::got_section): Likewise.
6959         * x86_64.cc (Target_x86_64::got_section): Likewise.
6960         * sparc.cc (Target_sparc::got_section): Likewise.
6961         (Target_sparc::relocate): Remove unused local have_got_offset.
6962         * powerpc.cc (Target_powerpc::relocate): Likewise.
6963
6964 2010-07-13  Ian Lance Taylor  <iant@google.com>
6965
6966         * compressed_output.cc (zlib_decompress): Fix signature in
6967         !HAVE_ZLIB_H case.
6968
6969         * archive.cc (Archive::include_member): Unlock an external member
6970         of a thin archive.  Don't bother to delete an object we know is
6971         NULL.
6972
6973 2010-07-12  Cary Coutant  <ccoutant@google.com>
6974
6975         * compressed_output.cc (zlib_decompress): New function.
6976         (get_uncompressed_size): New function.
6977         (decompress_input_section): New function.
6978         * compressed_output.h (get_uncompressed_size): New function.
6979         (decompress_input_section): New function.
6980         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
6981         Handle compressed debug sections.
6982         * layout.cc (is_compressed_debug_section): New function.
6983         (Layout::output_section_name): Map compressed section names to
6984         canonical names.
6985         * layout.h (is_compressed_debug_section): New function.
6986         (is_debug_info_section): Recognize compressed debug sections.
6987         * merge.cc: Include compressed_output.h.
6988         (Output_merge_data::do_add_input_section): Handle compressed
6989         debug sections.
6990         (Output_merge_string::do_add_input_section): Handle compressed
6991         debug sections.
6992         * object.cc: Include compressed_output.h.
6993         (Sized_relobj::Sized_relobj): Initialize new data members.
6994         (build_compressed_section_map): New function.
6995         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
6996         * object.h (Object::section_is_compressed): New method.
6997         (Object::do_section_is_compressed): New method.
6998         (Sized_relobj::Compressed_section_map): New type.
6999         (Sized_relobj::do_section_is_compressed): New method.
7000         (Sized_relobj::compressed_sections_): New data member.
7001         * output.cc (Output_section::add_input_section): Handle compressed
7002         debug sections.
7003         * reloc.cc: Include compressed_output.h.
7004         (Sized_relobj::write_sections): Handle compressed debug sections.
7005
7006 2010-07-08  Cary Coutant  <ccoutant@google.com>
7007
7008         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7009         weak when resolving to a dynamic def.
7010         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7011         for weak undef/dynamic def cases. Adjust callers.
7012         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7013         undef_binding_weak_.
7014         (Symbol_table::sized_write_globals): Adjust symbol binding.
7015         (Symbol_table::sized_write_symbol): Add binding parameter.
7016         * symtab.h (Symbol::set_undef_binding): New method.
7017         (Symbol::is_undef_binding_weak): New method.
7018         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7019         (Symbol_table::should_override): Add new parameter.
7020         (Symbol_table::sized_write_symbol): Add new parameter.
7021
7022         * testsuite/weak_undef_file1.cc: Add new test case.
7023         * testsuite/weak_undef_file2.cc: Fix header comment.
7024         * testsuite/weak_undef_test.cc: Add new test case.
7025
7026 2010-06-29  Doug Kwan  <dougkwan@google.com>
7027
7028         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7029         Initialize USE_SYMBOL_.
7030         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7031         definition.
7032         (Arm_reloc_property::uses_symbol_): New data member declaration.
7033         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7034         uses symbol value and symbol is undefined but not weakly undefined.
7035
7036 2010-06-28  Rafael Espindola  <espindola@google.com>
7037
7038         * plugin.cc (Plugin::load): Use dlerror.
7039
7040 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7041
7042         * symtab.cc (detect_odr_violations): When reporting an ODR
7043         violation, report an object where the symbol is defined.
7044
7045 2010-06-25  Doug Kwan  <dougkwan@google.com>
7046
7047         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7048         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7049         definition.
7050         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7051         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7052         target hook to detect function points.
7053         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7054         * icf.h (Icf::check_section_for_function_pointers): Change type of
7055         parameter SECTION_NAME to const reference to std::string.  Use
7056         target hook to determine if section may have unsafe pointers.
7057         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7058         method definition.
7059
7060 2010-06-21  Rafael Espindola  <espindola@google.com>
7061
7062         * fileread.cc (Input_file::find_fie): New
7063         (Input_file::open): Use Input_file::find_fie.
7064         * fileread.h (Input_file::find_fie): New
7065         * plugin.cc (set_extra_library_path): New.
7066         (Plugin::load): Add set_extra_library_path to the transfer vector.
7067         (Plugin_manager::set_extra_library_path): New.
7068         (Plugin_manager::add_input_file): Use the extra search path if set.
7069         (set_extra_library_path(): New.
7070         * plugin.h (Plugin_manager): Add set_extra_library_path and
7071         extra_search_path_.
7072
7073 2010-06-19  Cary Coutant  <ccoutant@google.com>
7074
7075         * layout.cc (gdb_sections): Add .debug_types.
7076         (lines_only_debug_sections): Likewise.
7077
7078 2010-06-18  Rafael Espindola  <espindola@google.com>
7079
7080         * plugin.cc (add_input_file,add_input_library)
7081         (Plugin_manager::add_input_file): Make filename arguments const.
7082         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7083         const.
7084
7085 2010-06-16  Doug Kwan  <dougkwan@google.com>
7086
7087         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7088         .ARM.attributes section if we have not merged any input
7089         attributes sections.
7090
7091 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7092
7093         * arm.cc: Allow combining objects with no EABI version
7094         information.
7095
7096 2010-06-15  Rafael Espindola  <espindola@google.com>
7097
7098         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7099
7100 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7101
7102         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7103         (struct iovec): Correct !HAVE_READV definition.
7104
7105 2010-06-10  Cary Coutant  <ccoutant@google.com>
7106
7107         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7108         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7109         reloc sections.
7110         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7111
7112         PR 11683
7113         * symtab.h (Symbol::is_placeholder): New member function.
7114         * target-reloc.h (relocate_section): Check for placeholder symbols.
7115
7116         * testsuite/Makefile.am (plugin_test_8): New test.
7117         (plugin_test_9): New test.
7118         * testsuite/Makefile.in: Regenerate.
7119
7120 2010-06-09  Nick Clifton  <nickc@redhat.com>
7121
7122         * yyscript.y (input_list_element): Allow strings prefixed with
7123         the '-' character.  Treat these as libraries.
7124         * script.cc (script_add_library): New function.  Adds a library
7125         specified by "-l<name>" found in an input script.
7126         * script-c.h: Add prototype for script_add_library.
7127
7128 2010-06-07  Doug Kwan  <dougkwan@google.com>
7129
7130         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7131         Restrict stub-group size to be within long conditional branch
7132         range when working around cortex-A8 erratum.
7133
7134 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7135
7136         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7137         #ifdef typo.
7138
7139 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7140
7141         PR gold/11658
7142         * output.cc
7143         (Output_section::Input_section_sort_entry::compare_section_ordering):
7144         Change to return non-zero correctly.
7145         (Output_section::Input_section_sort_section_order_index_compare
7146         ::operator()): Change to fix ambiguity in comparisons.
7147
7148 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7149
7150         * gold.h (is_wildcard_string): New function.
7151         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7152         (Layout::layout_eh_frame): Ditto.
7153         (Layout::find_section_order_index): New method.
7154         (Layout::read_layout_from_file): New method.
7155         * layout.h (Layout::find_section_order_index): New method.
7156         (Layout::read_layout_from_file): New method.
7157         (Layout::input_section_position_): New private member.
7158         (Layout::input_section_glob_): New private member.
7159         * main.cc (main): Call read_layout_from_file here.
7160         * options.h (--section-ordering-file): New option.
7161         * output.cc (Output_section::input_section_order_specified_): New
7162         member.
7163         (Output_section::Output_section): Initialize new member.
7164         (Output_section::add_input_section): Add new parameter.
7165         Keep input sections when --section-ordering-file is used.
7166         (Output_section::set_final_data_size): Sort input sections when
7167         section ordering file is specified.
7168         (Output_section::Input_section_sort_entry): Add new parameter.
7169         Check sorting type.
7170         (Output_section::Input_section_sort_entry::compare_section_ordering):
7171         New method.
7172         (Output_section::Input_section_sort_compare::operator()): Change to
7173         consider section_order_index.
7174         (Output_section::Input_section_sort_init_fini_compare::operator()):
7175         Change to consider section_order_index.
7176         (Output_section::Input_section_sort_section_order_index_compare
7177         ::operator()): New method.
7178         (Output_section::sort_attached_input_sections): Change to sort
7179         according to section order when specified.
7180         (Output_section::add_input_section<32, true>): Add new parameter.
7181         (Output_section::add_input_section<64, true>): Add new parameter.
7182         (Output_section::add_input_section<32, false>): Add new parameter.
7183         (Output_section::add_input_section<64, false>): Add new parameter.
7184         * output.h (Output_section::add_input_section): Add new parameter.
7185         (Output_section::input_section_order_specified): New
7186         method.
7187         (Output_section::set_input_section_order_specified): New method.
7188         (Input_section::Input_section): Initialize section_order_index_.
7189         (Input_section::section_order_index): New method.
7190         (Input_section::set_section_order_index): New method.
7191         (Input_section::section_order_index_): New member.
7192         (Input_section::Input_section_sort_section_order_index_compare): New
7193         struct.
7194         (Output_section::input_section_order_specified_): New member.
7195         * script-sections.cc (is_wildcard_string): Delete and move modified
7196         method to gold.h.
7197         (Output_section_element_input::Output_section_element_input): Modify
7198         call to is_wildcard_string.
7199         (Output_section_element_input::Input_section_pattern
7200         ::Input_section_pattern): Ditto.
7201         (Output_section_element_input::Output_section_element_input): Ditto.
7202         * testsuite/Makefile.am (final_layout): New test case.
7203         * testsuite/Makefile.in: Regenerate.
7204         * testsuite/final_layout.cc: New file.
7205         * testsuite/final_layout.sh: New file.
7206
7207 2010-06-01  Rafael Espindola  <espindola@google.com>
7208
7209         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7210
7211 2010-06-01  Rafael Espindola  <espindola@google.com>
7212
7213         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7214         visibility of symbols.
7215
7216 2010-05-27  Doug Kwan  <dougkwan@google.com>
7217
7218         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7219         from start of output section instead of address for a local symbol
7220         in a merged or relaxed section when doing a relocatable link.
7221
7222 2010-05-26  Rafael Espindola  <espindola@google.com>
7223
7224         PR 11604
7225         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7226         adding sections the garbage collector removed.
7227         * gold/testsuite/Makefile.am: Add test.
7228         * gold/testsuite/Makefile.in: Regenerate.
7229         * gold/testsuite/plugin_test_7.sh: New.
7230         * gold/testsuite/plugin_test_7_1.c: New.
7231         * gold/testsuite/plugin_test_7_2.c: New.
7232
7233 2010-05-26  Rafael Espindola  <espindola@google.com>
7234
7235         * script-sections.cc (Output_section_definition::set_section_addresses):
7236         Check for --section-start.
7237
7238 2010-05-26  Doug Kwan  <dougkwan@google.com>
7239
7240         * arm.cc (Arm_scan_relocatable_relocs): New class.
7241         (Target_arm::relocate_special_relocatable): New method.
7242         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7243         (Arm_relocate_functions::thumb_branch_common): Same.
7244         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7245         instead of Default_scan_relocatable_relocs.
7246         * target-reloc.h (relocate_for_relocatable): Let target handle
7247         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7248         * target.h (Sized_target::relocate_special_relocatable): New method.
7249
7250 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7251
7252         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7253
7254 2010-05-23  Doug Kwan  <dougkwan@google.com>
7255
7256         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7257         instead of a cast.
7258         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7259         with a direct branch, not a conditional branch, to a stub.
7260         * merge.cc (Output_merge_base::record_input_section): New method
7261         defintion.
7262         (Output_merge_data::do_add_input_section): Record input section if
7263         keeps-input-sections flag is set.
7264         (Output_merge_string::do_add_input_section): Ditto.
7265         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7266         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7267         INPUT_SECTIONS_.
7268         (Output_merge_base::keeps_input_sections,
7269         Output_merge_base::set_keeps_input_sections,
7270         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7271         method definitions.
7272         (Output_merge_base::Input_sections): New type declaration.
7273         (Output_merge_base::input_sections_begin,
7274         Output_merge_base::input_sections_end,
7275         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7276         (Output_merge_base::bool keeps_input_sections_,
7277         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7278         Output_merge_base::input_sections_): New data members.
7279         (Output_merge_data::do_set_keeps_input_sections): New method
7280         defintion.
7281         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7282         * output.cc (Output_section::Input_section::relobj): Move method
7283         defintion from class declaration to here and handle merge sections.
7284         (Output_section::Input_section::shndx): Ditto.
7285         (Output_section::Output_section): Remove initializations of removed
7286         data members and initialize new data member LOOKUP_MAPS_.
7287         (Output_section::add_input_section): Set keeps-input-sections flag
7288         for a newly created merge output section as appropriate.  Adjust code
7289         to use Output_section_lookup_maps class.
7290         (Output_section::add_relaxed_input_section): Adjst code for lookup
7291         maps code refactoring.
7292         (Output_section::add_merge_input_section): Add a new parameter
7293         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7294         class.  If adding input section to a newly created merge output
7295         section fails, remove the new merge section.
7296         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7297         Adjust code for use of the Output_section_lookup_maps class.
7298         (Output_section::find_merge_section): Ditto.
7299         (Output_section::build_lookup_maps): New method defintion.
7300         (Output_section::find_relaxed_input_section): Adjust code to use
7301         Output_section_lookup_maps class.
7302         (Output_section::get_input_sections): Export merge sections.  Adjust
7303         code to use Output_section_lookup_maps class.
7304         (Output_section:::add_script_input_section): Adjust code to use
7305         Output_section_lookup_maps class.  Update lookup maps for merge
7306         sections also.
7307         (Output_section::discard_states): Use Output_section_lookup_maps.
7308         (Output_section::restore_states): Same.
7309         * output.h (Merge_section_properties): Move class defintion out of
7310         Output_section.
7311         (Output_section_lookup_maps): New class.
7312         (Output_section::Input_section::is_merge_section): New method
7313         defintion.
7314         (Output_section::Input_section::relobj): Move defintion out of class
7315         defintion.  Declare method only.
7316         (Output_section::Input_section::shndx): Ditto.
7317         (Output_section::Input_section::output_merge_base): New method defintion.
7318         (Output_section::Input_section::u2_.pomb): New union field.
7319         (Output_section::Merge_section_by_properties_map,
7320         Output_section::Output_section_data_by_input_section_map,
7321         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7322         Remove types.
7323         (Output_section::add_merge_input_section): Add new parameter
7324         KEEPS_INPUT_SECTIONS.
7325         (Output_section::build_lookup_maps): New method declaration.
7326         (Output_section::merge_section_map_,
7327         Output_section::merge_section_by_properties_map_,
7328         Output_section::relaxed_input_section_map_,
7329         Output_section::is_relaxed_input_section_map_valid_): Remove data
7330         members.
7331         (Output_section::lookup_maps_): New data member.
7332
7333 2010-05-21  Doug Kwan  <dougkwan@google.com>
7334
7335         PR gold/11619
7336         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7337         avoid a compilation error.
7338
7339 2010-05-19  Rafael Espindola  <espindola@google.com>
7340
7341         * script-sections.cc (Output_section_definition::allocate_to_segment):
7342         Update the phdrs_list even when the output section is NULL.
7343         * testsuite/Makefile.am: Add test.
7344         * testsuite/Makefile.in: Regenerate.
7345         * testsuite/script_test_9.cc: New.
7346         * testsuite/script_test_9.sh: New.
7347         * testsuite/script_test_9.t: New.
7348
7349 2010-05-19  Doug Kwan  <dougkwan@google.com>
7350
7351         * arm.cc (Arm_input_section::original_size): New method.
7352         (Arm_input_section::do_addralign): Add a cast.
7353         (Arm_input_section::do_output_offset): Remove static cast.
7354         (Arm_input_section::original_addralign,
7355          Arm_input_section::original_size_): Change type to uint32_t.
7356         (Arm_input_section::init): Add safe casts for section alignment
7357         and size.
7358         (Arm_input_section::set_final_data_size): Do not set address and
7359         offset of stub table.
7360         (Arm_output_section::fix_exidx_coverage): Change use of of
7361         Output_section::Simple_input_section to that of
7362         Output_section::Input_section.
7363         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7364         except for the first pass.
7365         * output.cc (Output_section::get_input_sections): Change type of
7366         input_sections to std::list<Input_section>.
7367         (Output_section::add_script_input_section): Rename from
7368         Output_section::add_simple_input_section.  Change type of SIS
7369         parameter from Simple_input_section to Input_section.
7370         * output.h (Output_section::Simple_input_section): Remove class.
7371         (Output_section::Input_section): Change class visibility to public.
7372         (Output_section::Input_section::addralign): Use stored alignments
7373         for special input sections if set.
7374         (Output_section::Input_section::set_addralign): New method.
7375         (Output_section::get_input_sections): Change parameter type from
7376         list of Simple_input_section to list of Input_section.
7377         (Output_section::add_script_input_section): Rename from
7378         Output_section::add_simple_input_section. Change first parameter's
7379         type from Simple_input_section to Input_section and remove the
7380         second and third parameters.
7381         * script-sections.cc (Input_section::Input_section_list): Change
7382         type to list of Output_section::Input_section/
7383         (Input_section_info::Input_section_info): Change parameter type of
7384         INPUT_SECTION to Output_section::Input_section.
7385         (Input_section_info::input_section): Change return type.
7386         (Input_section_info::input_section_): Change type to
7387         Output_section::Input_section.
7388         (Output_section_element_input::set_section_addresses): Adjust code
7389         to use Output_section::Input_section instead of
7390         Output_section::Simple_input_section.  Adjust code for renaming
7391         of Output_section::add_simple_input_section.
7392         (Orphan_output_section::set_section_addresses): Ditto.
7393
7394 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7395
7396         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7397         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7398
7399 2010-05-18  Rafael Espindola  <espindola@google.com>
7400
7401         * options.cc (General_options::finalize): Handle -nostdlib.
7402         * options.h (nostdlib): New option.
7403         * script.cc (script_add_search_dir): Handle -nostdlib.
7404
7405 2010-05-12  Doug Kwan  <dougkwan@google.com>
7406
7407         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7408         attributes section only if there no attributes section after merging.
7409         (Target_arm::merge_object_attributes): Move value of
7410         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7411         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7412         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7413         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7414         and arm_attr_merge_7.stdout.
7415         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7416         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7417         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7418         arm_attr_merge_7b.o): New rules.
7419         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7420         arm_attr_merge_7
7421         * testsuite/Makefile.in: Regenerate.
7422         * testsuite/arm_attr_merge.sh: New file.
7423         * testsuite/arm_attr_merge_[67][ab].s: Same.
7424
7425 2010-05-05  Nick Clifton  <nickc@redhat.com>
7426
7427         * po/es.po: Updated Spanish translation.
7428
7429 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7430
7431         * Makefile.am (install-exec-local): Properly install gold as
7432         default cross linker.
7433         * Makefile.in: Regenerated.
7434
7435 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7436             Nick Clifton  <nickc@redhat.com>
7437
7438         * configure.ac (install_as_default): Define and set to false
7439         unless --enable-gold or --enable-gold=both/gold has been
7440         specified.
7441         * configure: Regenerate.
7442
7443         * Makefile.am (install-exec-local): Install the executable as
7444         'ld.gold'.  If install_as_default is true then also install it as
7445         'ld'.
7446         * Makefile.in: Regenerated.
7447
7448 2010-04-24  Ian Lance Taylor  <iant@google.com>
7449
7450         * layout.cc (Layout::layout_reloc): In relocatable link don't
7451         combine reloc sections for grouped sections.
7452
7453 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7454
7455         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7456         sections that are not ordinary to icf.
7457         * icf.cc (get_section_contents): Handle relocation pointing to section
7458         with no object or shndx information.
7459         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7460         * testsuite/Makefile.in: Regenerate.
7461         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7462         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7463
7464 2010-04-22  Ian Lance Taylor  <iant@google.com>
7465
7466         * expression.cc (Expression::Expression_eval_info): Add
7467         result_alignment_pointer field.
7468         (Expression::eval_with_dot): Add result_alignment_pointer
7469         parameter.  Change all callers.
7470         (Expression::eval_maybe_dot): Likewise.
7471         (class Binary_expression): Add alignment_pointer parameter to
7472         left_value and right_value.  Change all callers.
7473         (BINARY_EXPRESSION): Set result alignment.
7474         (class Trinary_expression): Add alignment_pointer parameter to
7475         arg2_value and arg3_value.  Change all callers.
7476         (Trinary_cond::value): Set result alignment.
7477         (Max_expression::value, Min_expression::value): Likewise.
7478         (Align_expression::value): Likewise.
7479         * script-sections.cc (class Sections_element): Add dot_alignment
7480         parameter to set_section_addresses virtual function.  Update
7481         instantiations.
7482         (class Output_section_element): Likewise.
7483         (Script_sections::create_segments): Add dot_alignment parameter.
7484         Change all callers.
7485         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7486         (Script_sections::set_phdrs_clause_addresses): Likewise.
7487         * script-sections.h: Update declarations.
7488         * script.h: Update declarations.
7489         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7490         min_p_align.
7491         * testsuite/script_test_3.t: Set large alignment.
7492         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7493         segment has expected alignment.
7494
7495 2010-04-22  Nick Clifton  <nickc@redhat.com>
7496
7497         * po/gold.pot: Updated by the Translation project.
7498         * po/vi.po: Updated Vietnamese translation.
7499
7500 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7501
7502         * testsuite/Makefile.am (check_PROGRAMS): Add
7503         icf_virtual_function_folding_test.
7504         * testsuite/Makefile.in: Regenerated.
7505
7506 2010-04-15  Andrew Haley  <aph@redhat.com>
7507
7508         * options.h (merge_exidx_entries): New option.
7509         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7510         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7511         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7512         (Target_arm::merge_exidx_entries): New function.
7513         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7514         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7515         to Arm_exidx_fixup constructor.
7516         Add new arg, merge_exidx_entries.
7517         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7518         Arm_output_section::fix_exidx_coverage.
7519
7520 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7521
7522         * icf.cc (get_section_contents): Check for preemptible functions.
7523         Ignore addend when appropriate.
7524         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7525         section folded.
7526         (add_from_relobj): Check for section folded.
7527         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7528         * symtab.h (should_add_dynsym_entry): Add new parameter.
7529         * target-reloc.h (scan_relocs): Check for section folded.
7530         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7531         Check reloc types for function pointers in shared objects.
7532         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7533         case.
7534         (icf_preemptible_functions_test): New test case.
7535         (icf_string_merge_test): New test case.
7536         * testsuite.Makefile.in: Regenerate.
7537         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7538         bar_glob.  Refactor code.
7539         * testsuite/icf_preemptible_functions_test.cc: New file.
7540         * testsuite/icf_preemptible_functions_test.sh: New file.
7541         * testsuite/icf_string_merge_test.cc: New file.
7542         * testsuite/icf_string_merge_test.sh: New file.
7543         * testsuite/icf_virtual_function_folding_test.cc: New file.
7544         * testsuite/icf_virtual_function_folding_test.sh: New file.
7545
7546 2010-04-14  Doug Kwan  <dougkwan@google.com>
7547
7548         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7549         for local symbol recounting if we remove a section due to ICF.
7550         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7551         there are no regular objects in input.
7552
7553 2010-04-13  Doug Kwan  <dougkwan@google.com>
7554
7555         * arm.cc (Arm_input_section::set_final_data_size): Compute
7556         accurate final data size instead of using current data size.
7557
7558 2010-04-09  Doug Kwan  <dougkwan@google.com>
7559
7560         * layout.cc (Layout::choose_output_section): Handle script section
7561         types.
7562         (Layout::make_output_section_for_script): Add section type parameter.
7563         Handle script section types.
7564         * layout.h (Layout::make_output_section_for_script): Add section
7565         type parameter.
7566         * output.cc (Output_section::Output_section): Initialize data member
7567         is_noload_.
7568         (Output_section::do_reset_address_and_file_offset): Do not set address
7569         to 0 if section is a NOLOAD section.
7570         * output.h (Output_section::is_noload): New method.
7571         (Output_section::set_is_noload): Ditto.
7572         (Output_section::is_noload_): New data member.
7573         * script-c.h (Script_section_type): New enum type.
7574         (struct Parser_output_section_header): Add new file section_type.
7575         * script-sections.cc (Sections_element::output_section_name): Add
7576         parameter for returning script section type.
7577         (Output_section_definition::output_section_name): Ditto.
7578         (Output_section_definition::section_type)P; New method.
7579         (Output_section_definiton::script_section_type_name): Ditto.
7580         (Output_section_definition::script_section_type_): New data member.
7581         (Output_section_definition::Output_section_definition): Initialize
7582         data member Output_section_definition::script_section_type_.
7583         (Output_section_definition::create_sections): Pass script section type
7584         to Layout::make_output_section_for_script.
7585         (Output_section_definition::output_section_name): Return script
7586         section type to caller.
7587         (Output_section_definition::set_section_address): Do not advance
7588         dot value and load address if section type is NOLOAD.  Set address
7589         of NOLOAD sections regardless of section flags.
7590         (Output_section_definition::print): Print section type if it is
7591         not SCRIPT_SECTION_TYPE_NONE.
7592         (Output_section_definition::section_type): New method.
7593         (Output_section_definition::script_section_type_name): Ditto.
7594         (Script_sections::output_section_name): Add new parameter
7595         PSECTION_TYPE for returning script section type.  Pass it to
7596         section elements.  Handle discard sections.
7597         (Sort_output_sections::operator()): Handle NOLOAD sections.
7598         * script-sections.h (Script_sections::Section_type): New enum type.
7599         (Script_sections::output_section_name): Add a new parameter for
7600         returning script section type.
7601         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7602         INFO and NOLOAD.
7603         * yyscript.y (union): Add new field SECTION_TYPE.
7604         (COPY, DSECT, INFO, NOLOAD): New tokens.
7605         (opt_address_and_section_type): Change type to output_section_header.
7606         (section_type): New non-terminal
7607         (section_header): Handle section type.
7608         (opt_address_and_section_type): Return section type value.
7609
7610 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7611
7612         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7613         * testsuite/plugin_common_test_2.c (foo): Likewise.
7614
7615 2010-04-08  Doug Kwan  <dougkwan@google.com>
7616
7617         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7618         Output_merge_data.
7619         * output.cc (Output_section::add_merge_input_section): Simplify
7620         code and return status of Output_merge_base::add_input_section.
7621         Update merge section map only if Output_merge_base::add_input_section
7622         returns true.
7623
7624 2010-04-07  Doug Kwan  <dougkwan@google.com>
7625
7626         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7627         if section is marked as containing instructions but has no mapping
7628         symbols.
7629         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7630         correct section index.
7631         (Arm_relobj::find_linked_text_section): Ditto.
7632
7633 2010-04-07  Cary Coutant  <ccoutant@google.com>
7634
7635         * archive.cc (include_member): Destroy Read_symbols_data object before
7636         releasing file.
7637         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7638         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7639         (Read_symbols_data::~Read_symbols_data) New destructor.
7640         (Section_relocs::Section_relocs) New constructor.
7641         (Section_relocs::~Section_relocs) New destructor.
7642         (Read_relocs_data::Read_relocs_data) New constructor.
7643         (Read_relocs_data::~Read_relocs_data) New destructor.
7644         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7645         pointers to NULL after deleting.
7646
7647 2010-04-07  Doug Kwan  <dougkwan@google.com>
7648
7649         * arm.cc: Replace "endianity" with "endianness" in comments.
7650         (Arm_exidx_cantunwind): Ditto.
7651         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7652         (Arm_relobj::merge_flags_and_attributes): New method.
7653         (Arm_relobj::merge_flags_and_attributes_): New data member.
7654         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7655         (Arm_relobj::scan_sections_for_stubs): Ditto.
7656         (Arm_relobj::do_read_symbols): Check to see if we really want to
7657         merge processor-specific flags and attributes.  Exit early if
7658         an object is empty except for section names and the undefined symbol.
7659         (Target_arm::do_finalize_sections): Move check for ELF format to
7660         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7661         attributes from a regular object only when we have determined that
7662         it is aapropriate.  Do not create an .ARM.attributes section in
7663         output if there is no regular input object.
7664         (Target_arm::merge_processor_specific_flags): Check
7665         --warn-mismatch before printing any error.
7666         (Target_arm::merge_object_attributes): Ditto.
7667         * gold.cc (queue_middle_tasks): Handle the case in which there is
7668         no regular object in input.
7669         * options.cc (General_options::parse_EB): New method.
7670         (General_options::parse_EL): Same.
7671         (General_options::General_options): Initialize endianness_.
7672         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7673         New options.
7674         (General_options::Endianness): New enum.
7675         (General_options::endianness): New method.
7676         (General_options::endianness_): New data member.
7677         * parameters.cc (Parameters::set_options): Check target endianness.
7678         (Parameters::set_target_once): Ditto.
7679         (Parameters::check_target_endianness): New method.
7680         (parameters_force_valid_target): If either -EL or -EB is specified,
7681         use it to define endianness of default target.
7682         * parameters.h (Parameters::check_target_endianness): New method
7683         declaration.
7684         * target.h (class Target): Change "endianity" to "endianness"
7685         in comments.
7686
7687 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7688
7689         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7690         * configure: Regenerate.
7691         * Makefile.in: Regenerate.
7692         * testsuite/Makefile.in: Regenerate.
7693
7694 2010-04-06  Cary Coutant  <ccoutant@google.com>
7695
7696         gcc PR lto/42757
7697         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7698         prevailing definitions of common symbols.
7699         * testsuite/plugin_test_6.sh: New test case.
7700         * testsuite/plugin_common_test_1.c: New test case.
7701         * testsuite/plugin_common_test_2.c: New test case.
7702         * testsuite/Makefile.am (plugin_test_6): New test case.
7703         * testsuite/Makefile.in: Regenerate.
7704
7705 2010-04-06  Nick Clifton  <nickc@redhat.com>
7706
7707         * po/vi.po: New Vietnamese translation.
7708
7709 2010-03-30  Doug Kwan  <dougkwan@google.com>
7710
7711         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7712
7713 2010-03-25  Doug Kwan  <dougkwan@google.com>
7714
7715         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7716         to avoid a conversion warning on a 32-bit host.
7717
7718 2010-03-24  Ian Lance Taylor  <iant@google.com>
7719
7720         * testsuite/script_test_3.t: Add a TLS segment.
7721         * testsuite/Makefile.am (check_PROGRAMS): Add
7722         tls_phdrs_script_test.
7723         (tls_phdrs_script_test_SOURCES): Define.
7724         (tls_phdrs_script_test_DEPENDENCIES): Define.
7725         (tls_phdrs_script_test_LDFLAGS): Define.
7726         (tls_phdrs_script_test_LDADD): Define.
7727         * testsuite/Makefile.in: Rebuild.
7728
7729 2010-03-23  Cary Coutant  <ccoutant@google.com>
7730
7731         * fileread.cc (find_or_make_view): Fix comment.
7732
7733 2010-03-23  Ian Lance Taylor  <iant@google.com>
7734
7735         * script-sections.cc (class Orphan_section_placement): Define
7736         PLACE_TLS and PLACE_TLS_BSS.
7737         (Orphan_section_placement::Orphan_section_placement): Initialize
7738         new places.
7739         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7740         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7741         (tls_script_test_SOURCES): Define.
7742         (tls_script_test_DEPENDENCIES): Define.
7743         (tls_script_test_LDFLAGS): Define.
7744         (tls_script_test_LDADD): Define.
7745         * testsuite/Makefile.in: Rebuild.
7746
7747 2010-03-22  Doug Kwan  <dougkwan@google.com>
7748
7749         * arm.cc (Arm_relocate_functions::abs8,
7750         Arm_relocate_functions::abs16): Use correct check for overflow
7751         specified in the ARM ELF specs.
7752         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7753         target of a BLX instruction specially.
7754         (Reloc_stub::stub_type_for_reloc): Ditto.
7755         (Relocate::relocate): Use symbolic names instead of numeric relocation
7756         codes to report error.
7757         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7758         workaround.
7759         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7760         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7761         thumb2_blx_out_of_range.stdout
7762         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7763         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7764         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7765         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7766         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7767         thumb2_blx_in_range, thumb2_blx_in_range.o,
7768         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7769         thumb2_blx_out_of_range.o): New rules.
7770         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7771         thumb2_blx_in_range and thumb2_blx_out_of_range.
7772         * testsuite/Makefile.in: Regenerate.
7773         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7774         * testsuite/thumb_blx_in_range.s: New file.
7775         * testsuite/thumb_blx_out_of_range.s: New file.
7776
7777 2010-03-22  Rafael Espindola  <espindola@google.com>
7778
7779         * archive.cc (Should_include): Move to archive.h.
7780         (should_include_member): Make it a member of Archive.
7781         (Lib_group): New.
7782         (Add_lib_group_symbols): New.
7783         * archive.h: Include options.h.
7784         (Archive_member): Moved from Archive.
7785         (Should_include): Moved from archive.cc.
7786         (Lib_group): New.
7787         (Add_lib_group_symbols): New.
7788         * dynobj.cc (do_should_include_member): New.
7789         * dynobj.h (do_should_include_member): New.
7790         * gold.cc (queue_initial_tasks): Update call to queue.
7791         * main.cc (main): Print lib group stats.
7792         * object.cc (do_should_include_member): New.
7793         * object.h: Include archive.h.
7794         (Object::should_include_member): New.
7795         (Object::do_should_include_member): New.
7796         (Sized_relobj::do_should_include_member): New.
7797         * options.cc (General_options::parse_start_lib): New.
7798         (General_options::parse_end_lib): New.
7799         (Input_arguments::add_file): Handle lib groups.
7800         (Input_arguments::start_group): Check we are not in a lib.
7801         (Input_arguments::start_lib): New.
7802         (Input_arguments::end_lib): New.
7803         * options.h (General_options): Add start_lib and end_lib.
7804         (Input_argument::lib_): New.
7805         (Input_argument::lib): New.
7806         (Input_argument::is_lib): New.
7807         (Input_file_lib): New.
7808         (Input_arguments::in_lib_): New.
7809         (Input_arguments::in_lib): New.
7810         (Input_arguments::start_lib): New.
7811         (Input_arguments::end_lib_): New.
7812         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7813         in unused members as preempted.
7814         (Sized_pluginobj::do_should_include_member): New.
7815         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7816         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7817         return the blocker.
7818         (Read_symbols::do_whole_lib_group): New.
7819         (Read_symbols::do_lib_group): New.
7820         (Read_symbols::do_read_symbols): Handle lib groups.
7821         (Read_symbols::get_name): Handle lib groups.
7822         * readsyms.h (Read_symbols): Add an archive member pointer.
7823         (Read_symbols::do_whole_lib_group): New.
7824         (Read_symbols::do_lib_group): New.
7825         (Read_symbols::member_): New.
7826         * script.cc (read_input_script): Update call to queue_soon.
7827
7828 2010-03-19  Doug Kwan  <dougkwan@google.com>
7829
7830         * arm.cc (Stub_table::Stub_table): Initialize new data members
7831         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7832         (Stub_table::add_reloc_stub): Assign stub offset and update
7833         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7834         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7835         New data members.
7836         (Stub_table::update_data_size_and_addralign): Use
7837         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7838         instead of going over all reloc stubs.
7839         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7840         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7841         Stringpool_template::offset_ to size of Stringpool_char.
7842         (Stringpool_template::new_key_offset): Remove code to initialize
7843         Stringpool_template::offset_.
7844         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7845         Stringpool_template::offset_ to zero.
7846
7847 2010-03-15  Doug Kwan  <dougkwan@google.com>
7848
7849         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7850         offset_.
7851         (Stringpool_template::new_key_offset): New method.
7852         (Stringpool_template::add_string): Assign offsets when adding new
7853         strings.
7854         (Stringpool_template::set_string_offsets): Do not set string offsets
7855         when not optimizing.
7856         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7857         member size_.
7858         (Chunked_vector::clear): Clear size_.
7859         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7860         (Chunked_vector::size): Return size_.
7861         (Chunked_vector::push_back): Use size_ to find insert position.
7862         (Chunked_vector::size_): New data member.
7863         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7864         (Stringpool_template::new_key_offset): New method declaration.
7865         (Stringpool_template::offset_): New data member.
7866
7867 2010-03-15   Rafael Espindola  <espindola@google.com>
7868
7869         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7870         Add_symbols' constructor.
7871         * readsyms.h (Add_symbols): Remove the input_group member.
7872
7873 2010-03-10  Ian Lance Taylor  <iant@google.com>
7874
7875         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7876         target to ask whether a reference to a symbol requires a stack
7877         split.
7878         * target.h (Target::is_call_to_non_split): New function.
7879         (Target::do_is_call_to_non_split): Declare virtual function.
7880         * target.cc: Include "symtab.h".
7881         (Target::do_is_call_to_non_split): New function.
7882         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7883
7884 2010-03-10  Cary Coutant  <ccoutant@google.com>
7885
7886         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
7887         (File_read::open[1]): Remove initial mapping of whole_file_view_.
7888         (File_read::open[2]): Add whole_file_view_ to list of views.
7889         (File_read::make_view): Remove test of whole_file_view_.
7890         (File_read::find_or_make_view): Create whole_file_view_ if
7891         necessary.
7892         (File_read::clear_views): Replace bool parameter with enum;
7893         adjust all callers.  Don't delete views with permanent data;
7894         do delete cached views and views from archives if
7895         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
7896         if clearing the corresponding view.
7897         * fileread.h (File_read::Clear_views_mode): New enum.
7898         (File_read::View::is_permanent_view): New method.
7899         (File_read::clear_views): Replace bool parameter
7900         with enum; adjust all callers.
7901         * options.h (General_options): Change keep_files_mapped option;
7902         add map_whole_files.
7903         * readsyms.cc (Add_symbols::run): Delete sd_ object before
7904         releasing the file.
7905         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
7906         the file.
7907
7908 2010-03-10  David S. Miller  <davem@davemloft.net>
7909
7910         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
7911
7912 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
7913
7914         * icf.cc (get_section_contents): Add '@' marker after processing the
7915         merge reloc.
7916
7917 2010-03-08  Doug Kwan  <dougkwan@google.com>
7918
7919         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
7920         due to a conversion warning.
7921         (Arm_relobj::update_output_local_symbol_count): Check for local
7922         symbol with unset output index.
7923
7924 2010-03-05  Ian Lance Taylor  <iant@google.com>
7925
7926         * options.h (class General_options): Add --spare-dynamic-tags.
7927         * output.cc (Output_data_dynamic::set_final_data_size): Implement
7928         --spare-dynamic-tags.
7929
7930 2010-03-05  Ian Lance Taylor  <iant@google.com>
7931
7932         * incremental.cc: Include "libiberty.h".
7933
7934 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
7935
7936         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
7937         function, is_info_ member.
7938         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
7939         (Versions::Versions): Update caller.
7940         (Versions::define_base_version): Likewise.
7941         (Versions::add_def): Likewise.
7942
7943 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
7944
7945         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
7946         (Scan::possible_function_pointer_reloc): New function.
7947         (Scan::local_reloc_may_be_function_pointer): Change to call
7948         possible_function_pointer_reloc.
7949         (Scan::global_reloc_may_be_function_pointer): Ditto.
7950         * icf.h (Icf::check_section_for_function_pointers): Change to reject
7951         relocations in ".data.rel.ro._ZTV" section.
7952         * testsuite/icf_safe_so_test.sh: Change to pass i386.
7953         * testsuite/icf_safe_so_test.cc: Ditto.
7954         * testsuite/icf_safe_test.cc: Ditto.
7955         * testsuite/icf_safe_test.sh: Ditto.
7956
7957 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7958             Ian Lance Taylor  <iant@google.com>
7959
7960         * target-reloc.h (relocate_section): Check the symbol table index
7961         for -1U before setting the local symbol index.
7962         (scan_relocatable_relocs): If copying the relocation, record that
7963         the local symbol is required.
7964         * object.h (Symbol_value::is_output_symtab_index_set): New
7965         function.
7966         (Symbol_value::may_be_discarded_from_output_symtab): New
7967         function.
7968         (Symbol_value::has_output_symtab_entry): New function.
7969         (Symbol_value::needs_output_symtab_entry): Remove.
7970         (Symbol_value::output_symtab_index): Make sure the symbol index is
7971         set.
7972         (Symbol_value::set_output_symtab_index): Make sure the symbol
7973         index is not set.  Make sure the new index is valid.
7974         (Symbol_value::set_must_have_output_symtab_entry): New function.
7975         (Symbol_value::has_output_dynsym_entry): New function.
7976         (Symbol_value::set_output_dynsym_index): Make sure the new index
7977         is valid.
7978         (Sized_relobj::set_must_have_output_symtab_entry): New function.
7979         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
7980         local symbol if permitted.
7981         (Sized_relobj::do_finalize_local_symbols): Call
7982         is_output_symtab_index_set rather than needs_output_symtab_entry.
7983         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
7984         rather than needs_output_symtab_entry.  Call
7985         has_output_dynsym_entry rather than needs_output_dynsym_entry.
7986         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
7987         is_output_symtab_index_set rather than needs_output_symtab_entry.
7988         * testsuite/discard_locals_relocatable_test.c: New file.
7989         * testsuite/discard_locals_test.sh: Test -r.
7990         * testsuite/Makefile.am (check_DATA): Add
7991         discard_locals_relocatable_test1.syms,
7992         discard_local_relocatable_test2.syms.
7993         (MOSTLYCLEANFILES): Likewise.  Also add
7994         discard_locals_relocatable_test1.lout and
7995         discard_locals_relocatable_test2.out.
7996         (discard_locals_relocatable_test1.syms): New target.
7997         (discard_locals_relocatable_test.o): New target.
7998         (discard_locals_relocatable_test1.out): New target.
7999         (discard_locals_relocatable_test2.syms): New target.
8000         (discard_locals_relocatable_test2.out): New target.
8001         (various): Add missing ../ld-new dependencies.
8002         * testsuite/Makefile.in: Rebuild.
8003
8004 2010-03-03  Nick Clifton  <nickc@redhat.com>
8005
8006         * po/fi.po: New Finnish translation.
8007
8008 2010-03-01  Doug Kwan  <dougkwan@google.com>
8009
8010         * layout.cc (Layout::Layout): Force section types of .init_array*,
8011         .preinit_array* and .fini_array* sections.
8012         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8013         Fix check of return value of std::string::find.().
8014         (Output_section::Input_section_sort_compare::operator()): Remove
8015         comment about .init_array.
8016         (Output_section::Input_section_sort_init_fini_compare::operator()):
8017         New method.
8018         (Output_section::sort_attached_input_sections): Handle .init_array
8019         and .fini_array specially.
8020         * output.h (Output_section::Inut_section_sort_compare): Update
8021         comment.
8022         (Output_section::Input_section_sort_init_fini_compare): New struct.
8023
8024 2010-02-26  Doug Kwan  <dougkwan@google.com>
8025
8026         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8027         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8028         * testsuite/debug_msg.sh: Avoid matching source line number for
8029         use of global variable undef_int.
8030
8031 2010-02-26  Doug Kwan  <dougkwan@google.com>
8032
8033         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8034         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8035         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8036         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8037         * options.cc (General_options::General_options): Initialize member
8038         fix_v4bx_.
8039         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8040         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8041         and rm_no_fix_v4bx.stdout
8042         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8043         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8044         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8045         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8046         and arm_no_fix_v4bx.
8047         * Makefile.in: Regenerate.
8048         * testsuite/arm_fix_v4bx.s: New file.
8049         * testsuite/arm_fix_v4bx.sh: Ditto.
8050
8051 2010-02-24  Doug Kwan  <dougkwan@google.com>
8052
8053         * arm.cc (Target_arm::got_section): Make the .got section the first
8054         non RELRO section in the data segment.
8055         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8056         suffixes of section names.
8057
8058 2010-02-24  Doug Kwan  <dougkwan@google.com>
8059
8060         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8061         flags and attributes merging if an input file is a binary file.
8062         * fileread.cc (Input_file::open): Record format of original file.
8063         * fileread.h (Input_file::Format): New enum type.
8064         (Input_file::Input_file): Initialize data member format_.
8065         (Input_file::format): New method definition.
8066         (Input_file::format_):: New data member.
8067
8068 2010-02-24  Doug Kwan  <dougkwan@google.com>
8069
8070         * arm.cc (Arm_output_data_got): New class.
8071         (ARM_TCB_SIZE): New constant
8072         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8073         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8074         If user uses a script with a SECTIONS clause, issue only a warning
8075         for a misplaced EXIDX input section.  Otherwise, issue an error.
8076         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8077         garbage collection.
8078         (Target_arm::got_mode_index_entry): Handle static linking.
8079         (Target_arm::Scan::local): Ditto.
8080         (Target_arm::Scan::global): Ditto.
8081         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8082         all incorrectly implemented relocations.
8083         (Target_arm::fix_exidx_coverage): Pass layout to
8084         Arm_output_section::fix_exidx_coverage.
8085         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8086         from ".ARM.exidx." and ".ARM.extab.".
8087
8088 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8089
8090         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8091         section if it does not already exist.
8092         * attributes.cc (Attributes_section_data::Attributes_section_data):
8093         Don't crash if size is zero.
8094
8095 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8096             Ian Lance Taylor  <iant@google.com>
8097
8098         * gold.cc (queue_middle_tasks): If no input files were opened,
8099         exit.
8100         * workqueue.h (Task_function::Task_function): Assert that there is
8101         a blocker.
8102
8103 2010-02-22  Doug Kwan  <dougkwan@google.com>
8104
8105         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8106         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8107         types to avoid warnings due to different uint64_t implementations
8108         on different hosts.
8109
8110 2010-02-21  Doug Kwan  <dougkwan@google.com>
8111
8112         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8113         handling of the maximum backward branch offset.
8114         (Arm_relocate_functions::thumb_branch_common): Ditto.
8115         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8116         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8117         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8118         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8119         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8120         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8121         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8122         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8123         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8124         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8125         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8126         thumb2_bl_out_of_range.o): New rules.
8127         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8128         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8129         thumb2_bl_out_of_range
8130         * testsuite/Makefile.in: Regenerate.
8131         * testsuite/arm_bl_in_range.s: New file.
8132         * testsuite/arm_bl_out_of_range.s: Ditto.
8133         * testsuite/arm_branch_in_range.sh: Ditto.
8134         * testsuite/arm_branch_range.t: Ditto.
8135         * testsuite/thumb2_branch_range.t: Ditto.
8136         * testsuite/thumb_bl_in_range.s: Ditto.
8137         * testsuite/thumb_bl_out_of_range.s: Ditto.
8138         * testsuite/thumb_branch_range.t: Ditto.
8139
8140 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8141
8142         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8143         Add reloc offset information.
8144         * icf.cc (get_section_contents): Change iterators to point to the new
8145         vectors. Add reloc offset information to the contents.
8146         * icf.h (Icf::Sections_reachable_info): New typedef.
8147         (Icf::Sections_reachable_list): New typedef.
8148         (Icf::Offset_info): New typedef.
8149         (Icf::Reloc_info): New struct typedef.
8150         (Icf::Reloc_info_list): New typedef.
8151         (Icf::symbol_reloc_list): Delete method.
8152         (Icf::addend_reloc_list): Delete method.
8153         (Icf::section_reloc_list): Delete method.
8154         (Icf::reloc_info_list): New method.
8155         (Icf::reloc_info_list_): New member.
8156
8157 2010-02-19  Doug Kwan  <dougkwan@google.com>
8158
8159         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8160         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8161         * arm.cc (Arm_relocation_functions): New forward declaration.
8162         (Target_arm::Target_arm): Initialize new data members
8163         got_mod_index_offset_ and tls_base_symbol_defined_.
8164         (Target_arm::Relocate::relocate_tls): New method.
8165         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8166          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8167         New methods.
8168         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8169         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8170         (Target_arm::got_mod_index_offset_,
8171         Target_arm::tls_base_symbol_defined_): New data members.
8172         (Target_arm::Scan::local, Target::Scan::global,
8173         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8174         relocations.
8175
8176 2010-02-18  Doug Kwan  <dougkwan@google.com>
8177
8178         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8179         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8180         text section as a parameter becuase some broken tools may not set
8181         the link in section header.
8182         (Target_arm::has_got_section): New method.
8183         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8184         without any mapping symbol as data only.  Remove warning.
8185         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8186         link in its section header, try to discover the link by inspecting the
8187         REL31 relocation at the beginning of the section.
8188         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8189         in error message.
8190         (Target_arm::Scan::global): Treat any reference to the symbol
8191         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8192
8193 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8194
8195         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8196         (Scan::global_reloc_may_be_function_pointer): New function.
8197         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8198         (Scan::global_reloc_may_be_function_pointer): New function.
8199         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8200         (Scan::global_reloc_may_be_function_pointer): New function.
8201         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8202         (Scan::global_reloc_may_be_function_pointer): New function.
8203         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8204         (Scan::global_reloc_may_be_function_pointer): New function.
8205         (Scan::possible_function_pointer_reloc): New function.
8206         (Target_x86_64::can_check_for_function_pointers): New function.
8207         * gc.h (gc_process_relocs): Scan relocation types to determine if
8208         function pointers were taken for targets that support it.
8209         * icf.cc (Icf::find_identical_sections): Include functions for
8210         folding in safe ICF whose pointer is not taken.
8211         * icf.h (Secn_fptr_taken_set): New typedef.
8212         (fptr_section_id_): New member.
8213         (section_has_function_pointers): New function.
8214         (set_section_has_function_pointers): New function.
8215         (check_section_for_function_pointers): New function.
8216         * options.h: Fix comment for safe ICF option.
8217         * target.h (can_check_for_function_pointers): New function.
8218         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8219         Modify icf_safe_test for X86-64.
8220         * testsuite/Makefile.in: Regenerate.
8221         * testsuite/icf_safe_so_test.cc: New file.
8222         * testsuite/icf_safe_so_test.sh: New file.
8223         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8224         (main): Change to take pointer to function kept_func_3.
8225         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8226         folding is done correctly for X86-64.
8227
8228 2010-02-12  David S. Miller  <davem@davemloft.net>
8229
8230         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8231         is_symbolless parameter.
8232         (Output_reloc<SHT_REL>::is_symbolless): New.
8233         (Output_reloc<SHT_REL>::is_symbolless_): New.
8234         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8235         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8236         (Output_reloc<SHT_RELA>::is_symbolless): New.
8237         (Output_data_reloc::add_global): Handle is_symbolless.
8238         (Output_data_reloc::add_global_relative): Likewise.
8239         (Output_data_reloc::add_local): Likewise.
8240         (Output_data_reloc::add_local_relative): Likewise.
8241         (Output_data_reloc::add_symbolless_global_addend): New.
8242         (Output_data_reloc::add_symbolless_local_addend): New.
8243         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8244         is_symbolless.
8245         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8246         instead of ->is_relative_
8247         (Output_reloc::write): Likewise.
8248         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8249         (Output_reloc::write_rel): Simplify.
8250
8251         * sparc.cc (Target_sparc::Scan::local): Use
8252         ->add_symbolless_local_addend as needed.
8253         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8254         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8255         based upon relocation offset.
8256
8257 2010-02-11  Doug Kwan  <dougkwan@google.com>
8258
8259         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8260         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8261         beginning of function.
8262         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8263         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8264         parameter is_32bit in calls to should_apply_static_reloc.
8265         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8266         (check_DATA): Add arm_abs_global.stdout.
8267         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8268         arm_abs_global.stdout): New rules.
8269         (MOSTLLYCLEANFILES): Add arm_abs_global
8270         * Makefile.in: Regenerate.
8271         * testsuite/arm_abs_global.s: New file.
8272         * testsuite/arm_abs_global.sh: Ditto.
8273         * testsuite/arm_abs_lib.s: Ditto.
8274
8275 2010-02-11  Ian Lance Taylor  <iant@google.com>
8276
8277         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8278         Read_relocs task.
8279         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8280         Allocate_commons_task first.
8281         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8282         task, rather than symtab_lock_.
8283         (Gc_process_relocs::~Gc_process_relocs): New function.
8284         (Gc_process_relocs::is_runnable): Check this_blocker_.
8285         (Gc_process_relocs::locks): Use next_blocker_ rather than
8286         blocker_.
8287         (Scan_relocs::~Scan_relocs): New function.
8288         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8289         symtab_lock_.
8290         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8291         next_blocker_.
8292         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8293         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8294         constructor accordingly.
8295         (class Gc_process_relocs): Likewise.
8296         (class Scan_relocs): Likewise.
8297         * common.h (class Allocate_commons_task): Remove symtab_lock_
8298         field, and corresponding constructor parameter.
8299         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8300         symtab_lock_.
8301         (Allocate_commons_task::locks): Likewise.
8302
8303 2010-02-11  Ian Lance Taylor  <iant@google.com>
8304
8305         * gold-threads.h (class Once): Define.
8306         (class Initialize_lock): Rewrite as child of Once.
8307         * gold-threads.cc (class Once_initialize): Define.
8308         (once_pointer_control): New static variable.
8309         (once_pointer, once_arg): New static variables.
8310         (c_run_once): New static function.
8311         (Once::Once, Once::run_once, Once::internal_run): New functions.
8312         (class Initialize_lock_once): Remove.
8313         (initialize_lock_control): Remove.
8314         (initialize_lock_pointer): Remove.
8315         (initialize_lock_once): Remove.
8316         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8317         (Initialize_lock::initialize): Rewrite.
8318         (Initialize_lock::do_run_once): New function.
8319         * archive.cc (Archive::interpret_header): Only clear name if it is
8320         not already empty.
8321         * fileread.cc: Include "gold-threads.h"
8322         (file_counts_lock): New static variable.
8323         (file_counts_initialize_lock): Likewise.
8324         (File_read::release): Only increment counts when using --stats.
8325         Use a lock around the increment.
8326         * parameters.cc (class Set_parameters_target_once): Define.
8327         (set_parameters_target_once): New static variable.
8328         (Parameters::Parameters): Move here from parameters.h.
8329         (Parameters::set_target): Rewrite.
8330         (Parameters::set_target_once): New function.
8331         (Parameters::clear_target): Move here and rewrite.
8332         * parameters.h (class Parameters): Update declarations.  Add
8333         set_parameters_target_once_ field.
8334         (Parameters::Parameters): Move to parameters.cc.
8335         (Parameters::clear_target): Likewise.
8336         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8337         task.
8338         (Start_group::~Start_group): New function.
8339         (Start_group::is_runnable): New function.
8340         (Start_group::locks, Start_group::run): New functions.
8341         (Finish_group::run): Change saw_undefined to size_t.
8342         * readsyms.h (class Start_group): Define.
8343         (class Finish_group): Change saw_undefined_ field to size_t.
8344         (Finish_group::Finish_group): Remove saw_undefined and
8345         this_blocker parameters.  Change all callers.
8346         (Finish_group::set_saw_undefined): New function.
8347         (Finish_group::set_blocker): New function.
8348         * symtab.h (class Symbol_table): Change saw_undefined to return
8349         size_t.  Change saw_undefined_ field to size_t.
8350         * target-select.cc (Set_target_once::do_run_once): New function.
8351         (Target_selector::Target_selector): Initialize set_target_once_
8352         field.  Don't initialize lock_ and initialize_lock_ fields.
8353         (Target_selector::instantiate_target): Rewrite.
8354         (Target_selector::set_target): New function.
8355         * target-select.h (class Set_target_once): Define.
8356         (class Target_selector): Update declarations.  Make
8357         Set_target_once a friend.  Remove lock_ and initialize_lock_
8358         fields.  Add set_target_once_ field.
8359
8360 2010-02-10  Ian Lance Taylor  <iant@google.com>
8361
8362         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8363         queueing any tasks.
8364         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8365         (queue_middle_tasks): Add all blockers before queueing any tasks.
8366         (queue_final_tasks): Likewise.
8367         * token.h (Task_token::add_blockers): New function.
8368         * object.h (Input_objects::number_of_relobjs): New function.
8369
8370 2010-02-10  Ian Lance Taylor  <iant@google.com>
8371
8372         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8373         shared, not if not position independent.
8374         * x86_64.cc (Relocate::relocate_tls): Likewise.
8375         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8376         (tls_pie_pic_test): New target.
8377         * testsuite/Makefile.in: Rebuild.
8378
8379         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8380         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8381         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8382         * testsuite/Makefile.in: Rebuild.
8383
8384 2010-02-09  David S. Miller  <davem@davemloft.net>
8385
8386         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8387         R_SPARC_RELATIVE using ->add_local_relative().
8388         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8389
8390         * output.h (Output_data_dynamic::add_section_size): New method
8391         that takes two Output_data objects.
8392         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8393         entry param.  Handle it in initializers.
8394         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8395         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8396         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8397         arg.
8398         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8399         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8400         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8401         for dynrel_includes_plt.
8402         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8403         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8404         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8405         before .rela.plt
8406         (Target_sparc::do_finalize_sections): Update to pass true for
8407         dynrel_includes_plt.
8408         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8409         output before .rela.plt
8410         (Target_powerpc::do_finalize_sections): Update to pass true for
8411         dynrel_includes_plt when 32-bit.
8412
8413 2010-02-08  Doug Kwan  <dougkwan@google.com>
8414
8415         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8416         method.
8417         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8418         Arm_relobj::scan_section_for_cortex_a8_stubs,
8419         Arm_relobj::do_relocation_section): Instead of calling
8420         Output_section::output_address, use faster
8421         Arm_relobj::simple_input_section_output_address.
8422
8423 2010-02-08  David S. Miller  <davem@davemloft.net>
8424
8425         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8426         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8427         relocation helper function.
8428
8429         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8430         just like R_SPARC_GOT{10,13,22}.
8431         (Target_sparc::Scan::local): Likewise.
8432         (Target_sparc::Relocate:relocate): Likewise.
8433
8434 2010-02-06  Ian Lance Taylor  <iant@google.com>
8435
8436         * configure.ac: Rewrite targetobjs duplicate removal code to use
8437         only shell constructs.
8438         * configure: Rebuild.
8439
8440 2010-02-05  Doug Kwan  <dougkwan@google.com>
8441
8442         PR 11247
8443         * arm.cc (Arm_relobj::section_is_scannable): New method.
8444         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8445         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8446
8447 2010-02-04  Doug Kwan  <dougkwan@google.com>
8448
8449         PR 11247
8450         * arm-reloc-property.cc (cstdio): Include.
8451         * configure.ac (targetobjs): Remove duplicates.
8452         * configure: Regenerate.
8453         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8454         big and little endian version for a given address size.
8455
8456 2010-02-03  Doug Kwan  <dougkwan@google.com>
8457
8458         * arm-reloc-property.cc
8459         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8460         definition.
8461         * arm-reloc-property.h
8462         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8463         New method definition.
8464         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8465         declaration.
8466         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8467         overflow to N.
8468         (GOT_PREL): Change implemented to Y.
8469         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8470         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8471         (Arm_relocate_functions::movw_abs_nc): Remove method.
8472         (Arm_relocate_functions::movt_abs): Ditto.
8473         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8474         (Arm_relocate_functions::thm_movt_abs): Ditto.
8475         (Arm_relocate_functions::movw_rel_nc): Ditto.
8476         (Arm_relocate_functions::movw_rel): Ditto.
8477         (Arm_relocate_functions::movt_rel): Ditto.
8478         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8479         (Arm_relocate_functions:thm_movw_rel): Ditto.
8480         (Arm_relocate_functions:thm_movt_rel): Ditto.
8481         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8482         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8483         New method definitions.
8484         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8485         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8486         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8487         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8488         (Target_arm::Relocate::relocate): Check for non-static or
8489         unimplemented relocation code and exit early.  Change calls to
8490         Target_arm::reloc_uses_thumb_bit and
8491         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8492         instead.  Refactor code to handle similar relocations to increase
8493         code sharing.  Remove check for unsupported relocation code in switch
8494         statement.
8495         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8496         relocation property table to find out size.  Change error message to
8497         print out the name of a relocation code instead of the numeric value.
8498         (Target_arm::scan_reloc_for_stub): Use relocation property table
8499         instead of calling Target_arm::reloc_uses_thumb_bit().
8500
8501 2010-02-02  Doug Kwan  <dougkwan@google.com>
8502
8503         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8504         types of relaxed input section.
8505
8506 2010-02-02  Doug Kwan  <dougkwan@google.com>
8507
8508         * Makefile.am (HFILES): Add arm-reloc-property.h.
8509         (DEFFILES): New.
8510         (TARGETSOURCES): Add arm-reloc-property.cc
8511         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8512         (libgold_a_SOURCES): $(DEFFILES)
8513         * Makefile.in: Regenerate.
8514         * arm-reloc-property.cc: New file.
8515         * arm-reloc-property.h: New file.
8516         * arm-reloc.def: New file.
8517         * arm.cc: Update comments.
8518         (arm-reloc-property.h): New included header.
8519         (arm_reloc_property_table): New global variable.
8520         (Target_arm::do_select_as_default_target): New method definition.
8521         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8522         arm-reloc-property to targ_extra_obj.
8523         * parameters.cc (set_parameters_target): Call
8524         Target::select_as_default_target().
8525         * target.h (Target::select_as_default_target): New method definition.
8526         (Target::do_select_as_default_target): Same.
8527
8528 2010-02-01  Doug Kwan  <dougkwan@google.com>
8529
8530         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8531         first_output_text_section_.
8532         (Arm_exidx_fixup::first_output_text_section): New method definition.
8533         (Arm_exidx_fixup::first_output_text_section_): New data member.
8534         (Arm_exidx_fixup::process_exidx_section): Record the first text
8535         output section seen.
8536         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8537         and entsize in output section header.
8538
8539 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8540
8541         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8542         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8543         (Arm_relocate_functions::thm_alu11): New Method.
8544         (Arm_relocate_functions::thm_pc8): New Method.
8545         (Arm_relocate_functions::thm_pc12): New Method.
8546         (Target_arm::Scan::local): Handle the relocations.
8547         (Target_arm::Scan::global): Likewise.
8548         (Target_arm::Relocate::relocate): Likewise.
8549         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8550
8551 2010-01-29  Doug Kwan  <dougkwan@google.com>
8552
8553         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8554         of relocation types as ld.
8555
8556 2010-01-29  Doug Kwan  <dougkwan@google.com>
8557
8558         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8559         to public.
8560         (Arm_relocate_functions::thumb_branch_common): Ditto.
8561         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8562         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8563         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8564         Arm_relocate_functions::jump24): Remove.
8565         (Target_arm::Relocate::relocate): Adjust code to call
8566         Arm_relocation_functions::arm_branch_common and
8567         Arm_relocation_functions::thumb_branch_common instead of their removed
8568         wrappers.  Merge switch-cases together to reduce source code size.
8569
8570 2010-01-29  Doug Kwan  <dougkwan@google.com>
8571
8572         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8573         output_local_symbol_count_needs_update_.
8574         (Arm_relobj::output_local_symbol_count_needs_update,
8575          Arm_relobj::set_output_local_symbol_count_needs_update,
8576          Arm_relobj::update_output_local_symbol_count): New methods.
8577         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8578         member.
8579         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8580         of pointed function as in a R_ARM_PREL31 relocation.
8581         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8582         for output local symbol count updating.
8583         (Target_arm::do_relax): Update output local symbol counts in objects
8584         if necessary.
8585         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8586
8587 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8588
8589         * arm.cc: Added support for the ARM relocations:
8590         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8591         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8592         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8593         movw_prel_nc).
8594         (Arm_relocate_functions::movw_rel): New method.
8595         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8596         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8597         thm_movw_prel_nc).
8598         (Arm_relocate_functions::thm_movw_rel): New method.
8599         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8600         thm_movt_prel).
8601         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8602         relocations.
8603         (Target_arm::Scan::global): Likewise.
8604         (Target_arm::Relocate::relocate): Likewise.
8605         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8606         Likewise.
8607
8608 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8609
8610         * arm.cc: Added support for ARM group relocations.
8611         (Target_arm::reloc_needs_sym_origin): New method.
8612         (Arm_relocate_functions::calc_grp_kn): New method.
8613         (Arm_relocate_functions::calc_grp_residual): New method.
8614         (Arm_relocate_functions::calc_grp_gn): New method.
8615         (Arm_relocate_functions::arm_grp_alu): New Method.
8616         (Arm_relocate_functions::arm_grp_ldr): New Method.
8617         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8618         (Arm_relocate_functions::arm_grp_ldc): New Method.
8619         (Target_arm::Scan::local): Handle the ARM group relocations.
8620         (Target_arm::Scan::global): Likewise.
8621         (Target_arm::Relocate::relocate): Likewise.
8622         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8623         Likewise.
8624
8625 2010-01-26  Doug Kwan  <dougkwan@google.com>
8626
8627         * arm.cc (set): Include.
8628         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8629         pointer type.
8630         (Arm_output_section::Text_section_list): New type.
8631         (Arm_output_section::append_text_sections_to_list): New method.
8632         (Arm_output_section::fix_exidx_coverage): Ditto.
8633         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8634         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8635         Relobj::set_section_offset() instead of
8636         Sized_relobj::invalidate_section_offset().
8637         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8638         parameter for section headers. Ignore relocation sections for
8639         unallocated sections and EXIDX sections.
8640         (Target_arm::fix_exidx_coverage): New method.
8641         (Target_arm::output_section_address_less_than): New type.
8642         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8643         linked text section instead of the EXIDX section.
8644         (Arm_output_section::create_stub_group): Add an assertion to check
8645         that this is not an EXIDX output section.
8646         (Arm_output_section::append_text_sections_to_list): New method.
8647         (Arm_output_section::fix_exidx_coverage): Ditto.
8648         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8649         Arm_relobj::section_needs_reloc_stub_scanning.
8650         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8651         first pass.
8652         (Target_arm::fix_exidx_coverage): New method.
8653         * object.h (Relobj::set_output_section): New method.
8654         (Sized_relobj::invalidate_section_offset): Remove method.
8655         (Sized_relobj::do_invalidate_section_offset): Remove method.
8656         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8657
8658 2010-01-25  Doug Kwan  <dougkwan@google.com>
8659
8660         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8661         Fix warning due to signed and unsigned comparison on a 32-bit host.
8662
8663 2010-01-22  Doug Kwan  <dougkwan@google.com>
8664
8665         * arm.cc (Target_arm::do_relax): Record an output section for section
8666         offset adjustment it contains any stub table that has changed.
8667         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8668         offsets in an output section if necessary.
8669         * output.cc (Output_section::Output_section): Initialize
8670         section_offsets_need_adjustments_.
8671         (Output_section::add_input_section_for_script): Renamed to
8672         Output_section::add_simple_input_section.
8673         (Output_section::save_states): Add a comment.
8674         (Output_section::discard_states): New method defintion.
8675         (Output_section::adjust_section_offsets): Same.
8676         * output.h (Output_section::add_input_section_for_script): Renamed to
8677         Output_section::add_simple_input_section.
8678         (Output_section::discard_states): New method declaration.
8679         (Output_section::adjust_section_offsets): Same.
8680         (Output_section::section_offsets_need_adjustment,
8681         Output_section::set_section_offsets_need_adjustment): New method
8682         definitions.
8683         (Output_section::section_offsets_need_adjustment_): New data member.
8684         * script-sections.cc
8685         (Output_section_element_input::set_section_address): Adjust code for
8686         renaming of Output_section::add_input_section_for_script.
8687         (Orphan_output_section::set_section_address): Same.
8688
8689 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8690
8691         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8692         Fix_v4bx enum values .
8693         * gold/options.h (General_options): New option definitions.
8694         (General_options::fix_v4bx): New method.
8695         (General_options::Fix_v4bx): New enum.
8696         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8697         (General_options::parse_fix_v4bx_interworking): New method.
8698
8699 2010-01-22  Doug Kwan  <dougkwan@google.com>
8700
8701         * arm.cc (Arm_exidx_fixup): New class.
8702
8703 2010-01-21  Doug Kwan  <dougkwan@google.com>
8704
8705         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8706         classes.
8707         (Arm_exidx_section_offset_map): New type.
8708
8709 2010-01-21  Doug Kwan  <dougkwan@google.com>
8710
8711         * arm.cc (Arm_exidx_input_section): New class.
8712         (Arm_relobj::exidx_input_section_by_link,
8713         Arm_relobj::exidx_input_section_by_shndx,
8714         Arm_relobj::make_exidx_input_section): New methods.
8715         (read_arm_attributes_section): Remove.
8716         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8717         information about them.
8718         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8719         to here.
8720
8721 2010-01-20  Doug Kwan  <dougkwan@google.com>
8722
8723         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8724         Input_section_specifier to Section_id.
8725         (Target_arm::new_arm_input_section: Adjust code for change of key
8726         type.
8727         (Target_arm::find_arm_input_section): Ditto.
8728         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8729         (Section_id): Remove.
8730         (Garbage_collection::Section_id_hash): Remove.
8731         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8732         (Section_id): Remove.
8733         (Icf::Section_id_hash): Remove.
8734         * object.h (Section_id, Const_section_id, Section_id_hash,
8735         Const_section_id_hash): New type definitions.
8736         * output.cc (Output_section::add_relaxed_input_section): Change to
8737         use Const_section_id instead of Input_section_specifier as key type.
8738         (Output_section::add_merge_input_section): Ditto.
8739         (Output_section::build_relaxation_map): Change to use Section_id
8740         instead of Input_section_specifier as key type.
8741         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8742         Ditto.
8743         (Output_section::convert_input_sections_to_relaxed_sections): Change
8744         to use Const_section_id instead of Input_section_specifier as key type.
8745         (Output_section::find_merge_section): Ditto.
8746         (Output_section::find_relaxed_input_section): Ditto.
8747         * output.h (Input_section_specifier): Remove class.
8748         (Output_section::Output_section_data_by_input_section_map): Change
8749         key type to Const_section_id.
8750         (Output_section::Output_relaxed_input_section_by_input_section_map):
8751         Ditto.
8752         (Output_section::Relaxation_map): Change key type to Section_id.
8753
8754 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8755
8756         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8757         (class Arm_v4bx_stub): New class.
8758         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8759         (Stub_factory::make_arm_v4bx_stub): New method.
8760         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8761         (Stub_table::empty): Handle v4bx stubs.
8762         (Stub_table::add_arm_v4bx_stub): New method.
8763         (Stub_table::find_arm_v4bx_stub): New method.
8764         (Arm_relocate_functions::v4bx): New method.
8765         (Target_arm::fix_v4bx): New method.
8766         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8767         (Stub_table::relocate_stubs): Likewise.
8768         (Stub_table::do_write): Likewise.
8769         (Stub_table::update_data_size_and_addralign): Likewise.
8770         (Stub_table::finalize_stubs):  Likewise.
8771         (Target_arm::Scan::local): Likewise.
8772         (Target_arm::Scan::global): Likewise.
8773         (Target_arm::do_finalize_sections): Likewise.
8774         (Target_arm::Relocate::relocate): Likewise.
8775         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8776         Likewise.
8777         (Target_arm::scan_reloc_for_stub): Likewise.
8778         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8779
8780 2010-01-19  Ian Lance Taylor  <iant@google.com>
8781
8782         * output.cc (Output_section_headers::do_sized_write): Write large
8783         segment count to sh_info field.
8784         (Output_file_header::do_sized_write): For large segment count,
8785         write PN_XNUM to e_phnum field.
8786
8787 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8788
8789         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8790         (Arm_relocate_functions::thm_jump8): New function.
8791         (Arm_relocate_functions::thm_jump11): New function.
8792         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8793         R_ARM_THM_JUMP11.
8794         (Target_arm::Scan::global): Likewise.
8795         (Target_arm::Relocate::relocate): Likewise.
8796         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8797         Likewise.
8798
8799 2010-01-14  Doug Kwan  <dougkwan@google.com>
8800
8801         * arm.cc (map, utility): Include headers.
8802         (Target_arm::apply_cortex_a8_workaround): New method.
8803         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8804         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8805         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8806         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8807         the --[no-]fix-cortex-a8 command line options.
8808         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8809         (Target_arm::relocate_stub): Use addend in instruction template.
8810         * options.h (DEFINE_bool): Set the user-set flag.
8811         (General_options): Add --[no-]-fix-cortex options.
8812         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8813         : Update fast look-up map after conversion.
8814
8815 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8816
8817         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8818         in the first pass of do_layout.
8819
8820 2010-01-13  Doug Kwan  <dougkwan@google.com>
8821
8822         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8823         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8824         apparent compiler problem of not folding static constant integral
8825         data members of elfcpp::Elf_sizes<32>.
8826
8827 2010-01-13  Doug Kwan  <dougkwan@google.com>
8828
8829         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8830         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8831         Arm_relobj::scan_section_for_cortex_a8_erratum,
8832         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8833         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8834         sections to scan for relocation stubs into a new method
8835         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8836         relocation and Cortex-A8 stub scanning.
8837         (Target_arm::do_relax): Force stubs to be after stubbed sections
8838         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8839         the beginning of a new relaxation pass.  Update a comment.
8840         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8841
8842 2010-01-12  Ian Lance Taylor  <iant@google.com>
8843
8844         * target-reloc.h (visibility_error): New inline function.
8845         (relocate_section): Call visibility_error.
8846         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8847         (MOSTLYCLEANFILES): Likewise.
8848         (protected_4_pic.o, protected_3.err): New targets.
8849         * testsuite/protected_4.cc: New file.
8850
8851 2010-01-12  Doug Kwan  <dougkwan@google.com>
8852
8853         * arm.cc (Cortex_a8_reloc): New class.
8854         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8855         and cortex_a8_relocs_info_.
8856         (Target_arm::fix_cortex_a8): New method definition.
8857         (Target_arm::Cortex_a8_relocs_info): New type.
8858         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8859         New data member declarations.
8860         (Target_arm::scan_reloc_for_stub): Record information about
8861         relocations for THUMB branches that might be exempted from the
8862         Cortex-A8 workaround.
8863         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8864         at the beginning of a relaxation pass.
8865
8866 2010-01-12  Doug Kwan  <dougkwan@google.com>
8867
8868         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8869         (Arm_relobj::Mapping_symbol_position,
8870          Arm_reloj::Mapping_symbol_position_less,
8871          Arm_relobj::Mapping_symbols_info): New types.
8872         (Target_arm::is_mapping_symbol_name): New method definition.
8873         (Arm_relobj::do_count_local_symbols): Save information about mapping
8874         symbols.
8875
8876 2010-01-11  Doug Kwan  <dougkwan@google.com>
8877
8878         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8879         Arm_relocate_functions::thumb32_branch_upper,
8880         Arm_relocate_functions::thumb32_branch_lower,
8881         Arm_relocate_functions::thumb32_cond_branch_offset,
8882         Arm_relocate_functions::thumb32_cond_branch_upper,
8883         Arm_relocate_functions::thumb32_cond_branch_lower,
8884         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8885         branch offset encoding.
8886         (Arm_relocate_functions::thumb_branch_common): Use new branch
8887         offset encoding methods to avoid code duplication.
8888         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
8889         (Stub_addend_reader::operator()): Use new branch encoding method
8890         to avoid code duplication.
8891
8892 2010-01-11  Doug Kwan  <dougkwan@google.com>
8893
8894         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
8895         (Target_arm::do_finalize_sections): Define special EXIDX section
8896         symbols only if referenced.
8897         * gc.h (Garbage_collection::add_reference): New method.
8898         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
8899         code duplication.
8900
8901 2010-01-11  Ian Lance Taylor  <iant@google.com>
8902
8903         * script.cc (Version_script_info::build_expression_list_lookup):
8904         Change complaing about duplicate wildcard match from error to
8905         warning.
8906
8907         * script.cc (class Lazy_demangler): Recreate--revert part of patch
8908         of 2009-12-30.
8909         (Version_script_info::Version_script_info): Initialize globs_,
8910         default_version_, default_is_global_, and exact_.  Don't
8911         initialize globals_ or locals_.
8912         (Version_script_info::build_lookup_tables): Build local symbols
8913         first.
8914         (Version_script_info::unquote): New function.
8915         (Version_script_info::add_exact_match): New function.
8916         (Version_script_info::build_expression_list_lookup): Remove lookup
8917         parameter.  Add is_global parameter.  Change all callers.  Handle
8918         wildcard pattern specially.  Unquote pattern.  Call
8919         add_exact_match.
8920         (Version_script_info::get_name_to_match): New function.
8921         (Version_script_info::get_symbol_version): New function.
8922         (Version_script_info::get_symbol_version_helper): Remove.
8923         (Version_script_info::check_unmatched_names): Call unquote.
8924         * script.h (class Version_script_info): Change get_symbol_version
8925         to be non-inline and add is_global parameter; change all callers.
8926         Rewrite symbol_is_local.  Update declarations.  Define struct
8927         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
8928         Remove globals_ and locals_ members.  Add exact_, globs_,
8929         default_version_, is_global_.
8930         (Version_script_info::Glob): Remove pattern, add expression and
8931         is_global.  Update constructor.  Change all callers.
8932         * dynobj.cc (Versions::finalize): Mark the version symbol as the
8933         default version.
8934         (Versions::symbol_section_contents): If a symbol is undefined, or
8935         defined in a dynamic object, set the version index to
8936         VER_NDX_LOCAL.
8937         * symtab.cc (Symbol_table::add_from_relobj): Don't call
8938         symbol_is_local.
8939         (Symbol_table::add_from_pluginobj): Likewise.
8940         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
8941
8942 2010-01-11  Doug Kwan  <dougkwan@google.com>
8943
8944         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
8945         (incremental_dump_LDADD): Add linking option for libintl.
8946         * Makefile.in: Regenerate.
8947
8948 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
8949
8950         PR gold/11144
8951         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
8952         instead of -Ds.
8953         * testsuite/Makefile.in: Regenerated.
8954
8955 2010-01-10  Doug Kwan  <dougkwan@google.com>
8956
8957         * options.h (DEFINE_var): Use parentheses around argument varname__
8958         in macro body to avoid any unintended subsequent substitutions.
8959
8960 2010-01-10  Ian Lance Taylor  <iant@google.com>
8961
8962         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
8963         candidates before doing symbol resolution.
8964
8965         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
8966         ODR candidates if only one is weak.
8967
8968 2010-01-08  Ian Lance Taylor  <iant@google.com>
8969
8970         * script.cc (Version_script_info::build_expression_list_lookup):
8971         Don't warn about ambiguous version, just record the ambiguity.
8972         (Version_script_info::get_symbol_version_helper): Give error if
8973         version is ambiguous.
8974
8975 2010-01-08  Doug Kwan  <dougkwan@google.com>
8976
8977         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
8978         prev_data_size_ and prev_addralign_.  Remove initializer for
8979         deleted data member has_been_changed_.
8980         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
8981         to determine if the table is empty.
8982         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
8983         Remove.
8984         (Stub_table::add_reloc_stub): Define method in class definition
8985         instead of just declaring it there.
8986         (Stub_table::add_cortex_a8_stub): New method definition.
8987         (Stub_table::update_data_size_and_addralign): Ditto.
8988         (Stub_table::finalize_stubs): Ditto.
8989         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
8990         (Stub_table::do_addralign_): Return address alignment in the
8991         (Stub_table::do_reset_address_and_file_offset): Define method in
8992         class definition instead of declaring it there.  Set current data
8993         size to be the data size of the previous pass.
8994         (Stub_table::set_final_data_size): Use current data size as the
8995         final data size.
8996         (Stub_table::relocate_stub): Change parameter type of stub from
8997         Reloc_stub pointer to Stub pointer.
8998         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
8999         (Stub_table::Cortex_a8_stub_list): New typedef.
9000         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9001          Stub_table::prev_addralign_): New data member.
9002         (Arm_relobj::Arm_relobj): Initialize data member
9003         section_has_cortex_a8_workaround_.
9004         (Arm_relobj::section_has_cortex_a8_workaround,
9005          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9006          definitions.
9007         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9008         declarations.
9009         (Target_arm::relocate_stub): Change parameter type of stub from
9010         Reloc_stub pointer to Stub pointer.
9011         (Insn_template::size, Insn_template::alignment): Handle
9012         THUMB16_SPECIAL_TYPE.
9013         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9014          Stub_table::update_data_size_and_addralign,
9015          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9016         definitions.
9017         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9018         (Stub_table::do_write): Ditto.
9019         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9020
9021 2010-01-08  Ian Lance Taylor  <iant@google.com>
9022
9023         PR 11108
9024         * symtab.h (class Symbol): Remove fields is_target_special_ and
9025         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9026         (Symbol::is_defined_in_discarded_section): New function.
9027         (Symbol::set_is_defined_in_discarded_section): New function.
9028         (Symbol::has_plt_offset): Rewrite.
9029         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9030         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9031         Don't initialize is_target_special_ or has_plt_offset_.
9032         Initialize is_defined_in_discarded_section_.
9033         (Symbol_table::add_from_relobj): If appropriate, set
9034         is_defined_in_discarded_section.
9035         * resolve.cc (Symbol::override_base_with_special): Don't test
9036         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9037         * target-reloc.h (relocate_section): Do special handling for
9038         symbols defined in discarded sections for global symbols as well
9039         as local symbols.
9040
9041 2010-01-08  Ian Lance Taylor  <iant@google.com>
9042
9043         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9044         the SHT_SYMTAB case.
9045
9046 2010-01-08  Ian Lance Taylor  <iant@google.com>
9047
9048         * object.cc (Sized_relobj::do_layout): Don't get confused if
9049         layout_eh_frame returns NULL.
9050
9051 2010-01-08  Ian Lance Taylor  <iant@google.com>
9052
9053         PR 11084
9054         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9055         dynamic symbol table, use the normal symbol table.
9056         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9057         symbol table.
9058
9059 2010-01-08  Ian Lance Taylor  <iant@google.com>
9060
9061         PR 11072
9062         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9063         sections.
9064
9065 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9066
9067         * version.cc (print_version): Change to "Copyright 2010".
9068
9069 2010-01-08  Ian Lance Taylor  <iant@google.com>
9070
9071         PR 10287
9072         PR 11063
9073         * i386.cc (class Target_i386): Change return type of plt_section
9074         to be non-const.
9075         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9076         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9077         tls_desc_rel_ field.
9078         (Output_data_plt_i386::rel_tls_desc): New function.
9079         (Target_i386::rel_tls_desc_section): New function.
9080         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9081         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9082         R_386_TLS_DESC reloc in rel_tls_desc_section.
9083         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9084         Define struct Tlsdesc_info.
9085         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9086         (Target_x86_64::do_reloc_symbol_index): New function.
9087         (Target_x86_64::add_tlsdesc_info): New function.
9088         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9089         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9090         tlsdesc_rel_ field.
9091         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9092         all callers.
9093         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9094         (Target_x86_64::rela_tlsdesc_section): New function.
9095         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9096         handling.
9097         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9098         (Target_x86_64::do_reloc_addend): New function.
9099         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9100         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9101         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9102         (Output_reloc::type): New function.
9103         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9104         (Output_reloc::is_target_specific): New function.
9105         (Output_reloc::target_arg): New function.
9106         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9107         absolute relocs and target specific relocs.
9108         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9109         add_target_specific.
9110         (class Output_data_reloc) [SHT_RELA]: Likewise.
9111         * output.cc (Output_reloc::Output_reloc): Add four new versions
9112         for absolute relocs and target specific relocs.
9113         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9114         (Output_reloc::get_symbol_index): Likewise.
9115         (Output_reloc::local_section_offset): Check that local_sym_index_
9116         is not TARGET_CODE or 0.
9117         (Output_reloc::symbol_value): Likewise.
9118         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9119         reloc.
9120         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9121         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9122         functions.
9123         * layout.cc (add_target_dynamic_tags): Use output section for
9124         DT_PLTRELSZ and DT_JMPREL.
9125
9126 2010-01-07  Ian Lance Taylor  <iant@google.com>
9127
9128         PR 11061
9129         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9130         function.
9131         (class Output_data_reloc_generic): Define.
9132         (class Output_data_reloc_base): Change base class to
9133         Output_data_reloc_generic.  Change add() method to call
9134         bump_relative_reloc_count for a relative reloc.  Remove
9135         sort_relocs_ field.
9136         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9137         to sort_relocs().
9138         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9139         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9140         appropriate.
9141         * layout.h (class Layout): Update declaration.
9142
9143 2010-01-07  Ian Lance Taylor  <iant@google.com>
9144
9145         * output.h (class Output_data): Add const version of
9146         output_section and do_output_section.
9147         (class Output_section_data): Add const version of
9148         do_output_section.
9149         (class Output_section): Likewise.
9150         * layout.cc (Layout::add_target_dynamic_tags): New function.
9151         * layout.h (class Layout): Update declarations.
9152         * arm.cc (Target_arm::do_finalize_sections): Use
9153         add_target_dynamic_tags.
9154         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9155         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9156         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9157         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9158
9159 2010-01-07  Ian Lance Taylor  <iant@google.com>
9160
9161         PR 11042
9162         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9163         object as needed.
9164
9165 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9166             Ian Lance Taylor  <iant@google.com>
9167
9168         PR 11019
9169         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9170         Xindex::read_symtab_xindex.
9171
9172 2010-01-07  Doug Kwan  <dougkwan@google.com>
9173
9174         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9175         (Insn_template::thumb16_bcond_insn): New method declaration.
9176         (Insn_template): Fix spelling.
9177         (Stub::thumb16_special): New method declaration.
9178         (Stub::do_write): Define virtual method which was previously pure
9179         virtual.
9180         (Stub::do_thumb16_special): New method declaration.
9181         (Stub::do_fixed_endian_write): New template member.
9182         (Reloc_stub::do_write): Remove.
9183         (Reloc_stub::do_fixed_endian_write): Remove.
9184         (Cortex_a8_stub): New class definition.
9185         (Stub_factory::make_cortex_a8_stub): New method definition.
9186         (Stub_factory::Stub_factory): Add missing static storage class
9187         qualifier for elf32_arm_stub_a8_veneer_blx.
9188
9189 2010-01-07  Ian Lance Taylor  <iant@google.com>
9190
9191         PR 10980
9192         * options.h (class General_options): Add --warn-unresolved-symbols
9193         and --error-unresolved-symbols.
9194         * errors.cc (Errors::undefined_symbol): Implement
9195         --warn-unresolved-symbols.
9196
9197         * options.h (class General_options): Add -z text and -z textoff.
9198         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9199
9200 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9201
9202         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9203         (Garbage_collection::cident_sections): New function.
9204         (Garbage_collection::add_cident_section): New function.
9205         (Garbage_collection::cident_sections_): New member.
9206         (gc_process_relocs): Add references to sections whose names are C
9207         identifiers.
9208         * gold.h (cident_section_start_prefix): New constant.
9209         (cident_section_stop_prefix): New constant.
9210         (is_cident): New function.
9211         * layout.cc (Layout::define_section_symbols): Replace string constants
9212         with the newly defined constants.
9213         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9214         C identifiers.
9215         * testsuite/Makefile.am: Add gc_orphan_section_test.
9216         * testsuite/Makefile.in: Regenerate.
9217         * testsuite/gc_orphan_section_test.cc: New file.
9218         * testsuite/gc_orphan_section_test.sh: New file.
9219
9220 2010-01-06  Ian Lance Taylor  <iant@google.com>
9221
9222         PR 10980
9223         * options.h (class General_options): Add --warn-shared-textrel.
9224         * layout.cc (Layout::finish_dynamic_section): Implement
9225         --warn-shared-textrel.
9226
9227         PR 10980
9228         * options.h (class General_options): Add --warn-multiple-gp.
9229
9230 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9231
9232         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9233         $(THREADSLIB) and $(LIBDL).
9234         * Makefile.in: Rebuild.
9235
9236 2010-01-06  Ian Lance Taylor  <iant@google.com>
9237
9238         PR 10980
9239         * options.cc (General_options::parse_section_start): New function.
9240         (General_options::section_start): New function.
9241         (General_options::General_options): Initialize all members.
9242         * options.h: Include <map>
9243         (class General_options): Add --section-start.  Add section_starts_
9244         member.
9245         * layout.cc (Layout::attach_allocated_section_to_segment): If
9246         --section-start was used, set the address of the segment.  Remove
9247         local sort_sections.
9248         (Layout::relaxation_loop_body): If the address of the load segment
9249         has been set by --section-start, don't use it.
9250         * output.h (Output_segment::update_flags_for_output_section): New
9251         function.
9252         * output.cc (Output_segment::add_output_section): Call
9253         update_flags_for_output_section.
9254
9255 2010-01-05  Ian Lance Taylor  <iant@google.com>
9256
9257         PR 10980
9258         * options.h (class General_options): Add --undefined-version.
9259         * script.cc (struct Version_expression): Add was_matched_by_symbol
9260         field.
9261         (Version_script_info::matched_symbol): New function.
9262         (Version_script_info::get_symbol_version_helper): Call
9263         matched_symbol.
9264         (Version_script_info::check_unmatched_names): New function.
9265         * script.h (class Version_script_info): Update declarations.
9266         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9267
9268         * options.h (class General_options): Use DEFINE_bool_alias for
9269         allow_multiple_definition.
9270         * resolve.cc (Symbol_table::should_override): Don't test
9271         allow_multiple_definition.
9272
9273         PR 10980
9274         * options.h (class General_options): Add --cref.
9275         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9276         until after printing cref table.
9277         * cref.cc: Include "symtab.h".
9278         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9279         (Cref_table_compare::operator()): New function.
9280         (Cref_inputs::gather_cref): New function.
9281         (filecol): New static const.
9282         (Cref_inputs::print_cref): New function.
9283         (Cref::print_cref): New function.
9284         * cref.h: Include <cstdio>.
9285         (class Cref): Update declarations.
9286         * mapfile.h (Mapfile::file): New function.
9287         * object.h (class Object): Define Symbols.  Declare virtual
9288         do_get_global_symbols.
9289         (Object::get_global_symbols): New function.
9290         * object.cc (Input_objects::add_object): Pass object to cref_ if
9291         --cref.
9292         (Input_objects::archive_start): Likewise.
9293         (Input_objects::archive_stop): Likewise.
9294         (Input_objects::print_cref): New function.
9295         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9296         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9297         --cref.
9298         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9299         function.
9300         * plugin.h (class Sized_pluginobj): Update declarations.
9301
9302 2010-01-05  Ian Lance Taylor  <iant@google.com>
9303
9304         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9305         to is_default_version.  Rename insdef to insdefault.
9306         (Symbol_table::add_from_relobj): Rename def to is_default_version
9307         and local to is_forced_local.
9308         (Symbol_table::add_from_pluginobj): Likewise.
9309         (Symbol_table::add_from_dynobj): Likewise.
9310         (Symbol_table::define_special_symbol): Rename insdef to
9311         insdefault.
9312
9313 2010-01-04  Ian Lance Taylor  <iant@google.com>
9314
9315         PR 10980
9316         * options.h (class General_options): Add
9317         --allow-multiple-definition and -z muldefs.
9318         * resolve.cc (Symbol_table::should_override): Don't warn about a
9319         multiple symbol definition if --allow-multiple-definition or -z
9320         muldefs.
9321
9322         PR 10980
9323         * options.h (class General_options): Add --add-needed and
9324         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9325         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9326         error if --copy-dt-needed-entries aka --add-needed is used and
9327         would cause a change in behaviour.
9328
9329         PR 10980
9330         * options.h (class General_options): Add -G as a short version of
9331         --shared.  Add no-op options -assert, -g, and -i.
9332
9333 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9334
9335         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9336         check for .text or .gnu.linkonce.t sections.
9337         * icf.cc (Icf::find_identical_sections): Ditto.
9338         Change the detection for mangled function name within the section
9339         name.
9340         * icf.h (is_section_foldable_candidate): New function.
9341
9342 2009-12-30  Ian Lance Taylor  <iant@google.com>
9343
9344         PR 10980
9345         * options.h (class General_options): Permit two dashes with
9346         --retain-symbols-file.
9347
9348 2009-12-30  Ian Lance Taylor  <iant@google.com>
9349
9350         PR 10979
9351         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9352         don't put the file header and segment headers in the text
9353         segment.
9354
9355         PR 10979
9356         * common.cc (Sort_commons::operator()): Stabilize sort when both
9357         entries are NULL.
9358         (Symbol_table::do_allocate_commons_list): When allocating common
9359         symbols, skip a symbol which is no longer common.
9360         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9361         an object before checking its type.
9362         * testsuite/common_test_2.c: New file.
9363         * testsuite/common_test_3.c: New file.
9364         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9365         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9366         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9367         (common_test_2_pic.o, common_test_2.so): New targets.
9368         (common_test_3_pic.o, common_test_3.so): New targets.
9369         * testsuite/Makefile.in: Rebuild.
9370
9371         PR 10979
9372         * script.cc (read_input_script): If we see a new SECTIONS clause,
9373         and we have added an input section, give an error.
9374         * layout.h (class Layout): Add have_added_input_section function.
9375         Add have_added_input_section_ field.
9376         * layout.cc (Layout::Layout): Initialize
9377         have_added_input_section_.
9378         (Layout::layout): Set have_added_input_section_.
9379         (Layout::layout_eh_frame): Likewise.
9380
9381 2009-12-30  Ian Lance Taylor  <iant@google.com>
9382
9383         PR 10931
9384         * options.h (class General_options): Add --sort-common option.
9385         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9386         * common.cc (Sort_common): Add sort_order parameter to
9387         constructor.  Add sort_order_ field.
9388         (Sort_commons::operator): Check sort_order_.
9389         (Symbol_table::allocate_commons): Determine the sort order.
9390         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9391         Change all callers.
9392         (Symbol_table::do_allocate_commons_list): Likewise.
9393
9394 2009-12-30  Ian Lance Taylor  <iant@google.com>
9395
9396         PR 10916
9397         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9398         symbols from this object, don't change the visibility of an
9399         undefined symbol.
9400         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9401
9402 2009-12-30  Ian Lance Taylor  <iant@google.com>
9403
9404         PR 10861
9405         * script.h (class Version_script_info): Define Language enum.
9406         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9407         new fields globals_, locals_, and is_finalized_.
9408         * script.cc: Various formatting fixes.
9409         (class Parser_closure): Change language_stack_ from a vector of
9410         std::string to one of Version_script_info::Language.  Adjust all
9411         uses accordingly.
9412         (class Lazy_demangler): Remove.
9413         (struct Version_expression): Change language from std::string to
9414         Version_script_info::Language.
9415         (Version_script_info::Version_script_info): New function.
9416         (Version_script_info::~Version_script_info): Don't call clear.
9417         (Version_script_info::finalize): New function.
9418         (Version_script_info::build_lookup_tables): New function.
9419         (Version_script_info::build_expression_list_lookup): New
9420         function.
9421         (Version_script_info::get_symbol_version_helper): Rewrite to use
9422         lookup tables.
9423         (Version_script_info::print_expression_list): Adjust to use
9424         Version_script_info::Language.
9425         (script_push_lex_into_version_mode): Check that the version script
9426         has not been finalized.
9427         (version_script_push_lang): Change language string to
9428         Version_script_info::Language.
9429         * options.cc (Command_line::version_script): New function.
9430         * options.h (class General_options): Add finalize_dynamic_list
9431         function.  Change version_script from declaration to definition.
9432         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9433         * testsuite/version_script.map: Remove duplicate def of foo.
9434         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9435         version_script.map.
9436         * testsuite/Makefile.in: Rebuild.
9437
9438 2009-12-30  Ian Lance Taylor  <iant@google.com>
9439
9440         PR 10843
9441         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9442         if the input symbol index is 0, make the output symbol index 0.
9443
9444 2009-12-30  Ian Lance Taylor  <iant@google.com>
9445
9446         PR 10670
9447         * options.h (class General_options): Add -x/--discard-all.
9448         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9449         --discard-all.  If the local symbol needs a dynamic entry, check
9450         that before handling --discard-locals.
9451
9452 2009-12-30  Ian Lance Taylor  <iant@google.com>
9453
9454         PR 10450
9455         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9456         flags to PF_R.
9457         (Output_segment::add_output_section): Don't change the flags if
9458         the type is PT_TLS.
9459
9460         PR 10450
9461         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9462         GNU hash table if they need a dynamic value.  Otherwise, don't add
9463         them if they are defined in a dynamic object or are forced local.
9464
9465 2009-12-29  Ian Lance Taylor  <iant@google.com>
9466
9467         PR 10450
9468         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9469         .gnu.hash table for a 32-bit target.
9470
9471         PR 10450
9472         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9473         regular and a dynamic object only needs a dynamic symbol table
9474         entry if it is externally visible.
9475
9476         PR 10450
9477         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9478         constructor.  Add global_offset_table_ field.
9479         (Target_i386::got_section): Set global_offset_table_.
9480         (Target_i386::do_finalize_sections): Set global_offset_table_
9481         size.
9482         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9483         in constructor.  Add global_offset_table_ field.
9484         (Target_x86_64::got_section): Set global_offset_table_.
9485         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9486         size.
9487
9488         * layout.cc (Layout::Layout): Initialize increase_relro_.
9489         (Layout::get_output_section): Add is_relro, is_last_relro, and
9490         is_first_non_relro parameters.  Change all callers.
9491         (Layout::choose_output_section): Likewise.
9492         (Layout::add_output_section_data): Likewise.
9493         (Layout::make_output_section): Likewise.
9494         (Layout::set_segment_offsets): Clear increase_relro when using a
9495         linker script.
9496         * layout.h (class Layout): Add increase_relro method.  Add
9497         increase_relro_ field.  Update declarations.
9498         * output.cc (Output_section::Output_section): Initialize
9499         is_last_relro_ and is_first_non_relro_.
9500         (Output_segment::add_output_section): Group relro sections is
9501         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9502         (Output_segment::maximum_alignment): Remove relro handling.
9503         (Output_segment::set_section_addresses): Add increase_relro
9504         parameter.  Change all callers.  Add initial alignment to align
9505         relro sections on separate page.  Remove old relro handling.
9506         (Output_segment::set_section_list_addresses): Remove in_relro
9507         parameter.  Change all callers.
9508         (Output_segment::set_offset): Add increase parameter.  Change all
9509         callers.  Remove old relro handling.
9510         * output.h (class Output_section): Add new methods: is_last_relro,
9511         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9512         Add is_last_relro_ and is_first_non_relro_ fields.
9513         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9514         Create separate .got.plt section.  Call increase_relro.
9515         * x86_64.cc (Target_x86_64::got_section): Likewise.
9516         * testsuite/relro_script_test.t: Add .got.plt.
9517
9518         PR 10450
9519         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9520         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9521         (Layout::finalize): Call set_dynamic_symbol_size.
9522         (Layout::set_dynamic_symbol_size): New function.
9523         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9524         set_dynamic_symbol_size.
9525
9526         PR 10450
9527         * output.h (class Output_section): Add is_entsize_zero_ field.
9528         * output.cc (Output_section::Output_section): Initialize
9529         is_entsize_zero_.
9530         (Output_section::set_entsize): If two different entsizes are
9531         requested, force it to zero.
9532         (Output_section::add_input_section): Set flags for .debug_str
9533         before updating section flags.  Set entsize.
9534         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9535         and SHF_STRING if all input sections have those flags.
9536
9537 2009-12-29   Rafael Espindola  <espindola@google.com>
9538
9539         * main.cc (main): Fix the sys time reporting.
9540         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9541         reporting.
9542
9543 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9544
9545         * options.cc (General_options::parse_version): Allow -v to exit
9546         without an error if there is nothing to link.
9547
9548 2009-12-29  Ian Lance Taylor  <iant@google.com>
9549
9550         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9551         using a version of gcc before 4.1.
9552         * configure: Rebuild.
9553
9554 2009-12-28  Chris Demetriou  <cgd@google.com>
9555
9556         * attributes.cc (Output_attributes_section_data::do_write): Use
9557         std::vector::front rather than std::vector::data.
9558
9559 2009-12-28  Ian Lance Taylor  <iant@google.com>
9560
9561         * symtab.h (class Symbol_table): Add enum Defined.
9562         * resolve.cc (Symbol_table::should_override): Add defined
9563         parameter.  Change all callers.  Test whether object is NULL
9564         before calling a method on it.
9565         (Symbol_table::report_resolve_problem): Add defined parameter.
9566         Change all callers.
9567         (Symbol_table::should_override_with_special): Likewise.
9568         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9569         parameter.  Change all callers.
9570         (Symbol_table::do_define_in_output_data): Likewise.
9571         (Symbol_table::define_in_output_segment): Likewise.
9572         (Symbol_table::do_define_in_output_segment): Likewise.
9573         (Symbol_table::define_as_constant): Likewise.
9574         (Symbol_table::do_define_as_constant): Likewise.
9575         * script.h (class Symbol_assignment): Add is_defsym parameter to
9576         constructor; change all callers.
9577         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9578         parameter.  Change all callers.  Add is_defsym_ field.
9579         (class Parser_closure): Add parsing_defsym parameter to
9580         constructor; change all callers.  Add parsing_defsym accessor
9581         function.  Add parsing_defsym_ field.
9582
9583 2009-12-28  Ian Lance Taylor  <iant@google.com>
9584
9585         * gold.cc (queue_middle_tasks): Fix formatting.
9586         * object.cc (Relobj::is_section_name_included): Likewise.
9587
9588 2009-12-23  Ian Lance Taylor  <iant@google.com>
9589
9590         * i386.cc (Target_i386::do_calls_non_split): Recognize
9591         -fsplit-stack prologue for a function with a static chain.
9592         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9593         -fsplit-stack prologue when using %r11.
9594
9595 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9596
9597         * options.cc (General_options::parse_version): Make -v continue and do
9598         the link like GNU ld does.
9599
9600 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9601
9602         * Makefile.am (CCFILES): Add timer.cc.
9603         (HFILES): Add timer.h.
9604         * configure.ac: Check for sysconf and times.
9605         * main.cc: include timer.h.
9606         (main): Use Timer instead of get_run_time.
9607         * timer.cc: New.
9608         * timer.h: New.
9609         * workqueue.cc: include timer.h.
9610         (Workqueue::find_and_run_task):
9611         Report user, sys and wall time.
9612         * Makefile.in: Regenerate.
9613         * config.in: Regenerate.
9614         * configure: Regenerate.
9615
9616 2009-12-16  Doug Kwan  <dougkwan@google.com>
9617
9618         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9619         sections.
9620         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9621         relaxed input sections.
9622         * output.cc (Output_section::find_relaxed_input_section): Change
9623         return type to Output_relaxed_input_section pointer.  Adjust code
9624         for new type of relaxed_input_section_map_.
9625         * output.h (Output_section::find_relaxed_input_section): Change
9626         return type to Output_relaxed_input_section pointer.
9627         (Output_section::Output_relaxed_input_section_by_input_section_map):
9628         New type.
9629         (Output_section::relaxed_input_section_map_): Change type to
9630         Output_section::Output_relaxed_input_section_by_input_section_map.
9631         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9632         input section.
9633
9634 2009-12-15  Ian Lance Taylor  <iant@google.com>
9635
9636         * layout.cc (Layout::create_shstrtab): Only write out after input
9637         sections if we are compressing debug sections.
9638
9639 2009-12-15  Ian Lance Taylor  <iant@google.com>
9640
9641         * archive.cc (Archive::add_symbols): Only look up a symbol without
9642         a version if there is, in fact, a version.
9643
9644 2009-12-14  Ian Lance Taylor  <iant@google.com>
9645
9646         Revert -Wshadow changes, all changes from:
9647         2009-12-11  Doug Kwan  <dougkwan@google.com>
9648         2009-12-11  Nick Clifton  <nickc@redhat.com>
9649         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9650
9651 2009-12-11  Doug Kwan  <dougkwan@google.com>
9652
9653         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9654         due to -Wshadow.
9655         * attributes.cc (Object_attribute::size): Ditto.
9656         (Attributes_section_data::size): Ditto.
9657         (Attributes_section_data::Attributes_section_data): Ditto.
9658         (Output_attributes_section_data::do_write): Ditto.
9659         * attributes.h (Object_attribute::set_type): Ditto.
9660         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9661
9662 2009-12-11  Nick Clifton  <nickc@redhat.com>
9663
9664         * archive.cc: Fix shadowed variable warnings.
9665         * arm.cc: Likewise.
9666         * compressed_output.cc: Likewise.
9667         * compressed_output.h: Likewise.
9668         * configure: Likewise.
9669         * dwarf_reader.cc: Likewise.
9670         * dynobj.cc: Likewise.
9671         * dynobj.h: Likewise.
9672         * ehframe.cc: Likewise.
9673         * ehframe.h: Likewise.
9674         * errors.cc: Likewise.
9675         * expression.cc: Likewise.
9676         * fileread.cc: Likewise.
9677         * fileread.h: Likewise.
9678         * freebsd.h: Likewise.
9679         * i386.cc: Likewise.
9680         * icf.cc: Likewise.
9681         * incremental.h: Likewise.
9682         * layout.cc: Likewise.
9683         * layout.h: Likewise.
9684         * mapfile.cc: Likewise.
9685         * merge.cc: Likewise.
9686         * merge.h: Likewise.
9687         * object.cc: Likewise.
9688         * object.h: Likewise.
9689         * options.h: Likewise.
9690         * output.cc: Likewise.
9691         * output.h: Likewise.
9692         * parameters.cc: Likewise.
9693         * plugin.cc: Likewise.
9694         * powerpc.cc: Likewise.
9695         * reduced_debug_output.cc: Likewise.
9696         * reduced_debug_output.h: Likewise.
9697         * reloc.cc: Likewise.
9698         * reloc.h: Likewise.
9699         * resolve.cc: Likewise.
9700         * script-sections.cc: Likewise.
9701         * script.cc: Likewise.
9702         * script.h: Likewise.
9703         * sparc.cc: Likewise.
9704         * symtab.cc: Likewise.
9705         * symtab.h: Likewise.
9706         * target-select.cc: Likewise.
9707         * target-select.h: Likewise.
9708         * token.h: Likewise.
9709         * workqueue.cc: Likewise.
9710         * workqueue.h: Likewise.
9711         * x86_64.cc: Likewise.
9712
9713 2009-12-10  Doug Kwan  <dougkwan@google.com>
9714
9715         * arm.cc (attributes.h): New include.
9716         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9717         (Arm_relobj::~Arm_relobj): Delete object pointed by
9718         attributes_section_data_.
9719         (Arm_relobj::attributes_section_data): New method definition.
9720         (Arm_relobj::attributes_section_data_): New data member declaration.
9721         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9722         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9723         attributes_section_data_.
9724         (Arm_dynobj::attributes_section_data): New method definition.
9725         (Arm_dynobj::attributes_section_data_): New data member declaration.
9726         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9727         initialization value of may_use_blx_ to false.
9728         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9729         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9730         object attributes to compute results instead of hard-coding.
9731         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9732         Target_arm::get_secondary_compatible_arch,
9733         Target_arm::set_secondary_compatible_arch
9734         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9735         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9736         New method declarations.
9737         (Target_arm::get_aeabi_object_attribute): New method definition.
9738         (Target_arm::attributes_section_data_): New data member declaration.
9739         (read_arm_attributes_section): New template definition.
9740         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9741         (Arm_dynobj::do_read_symbols): Ditto.
9742         (Target_arm::do_finalize_sections): Merge attributes sections from
9743         input.  Check for BLX use after attributes section merging.
9744         Fix __exidx_start and __exidx_end visibility.  Create an
9745         .ARM.attributes section if necessary.
9746         (Target_arm::get_secondary_compatible_arch,
9747         Target_arm::set_secondary_compatible_arch,
9748         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9749         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9750         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9751         New method definitions.
9752
9753 2009-12-09  Ian Lance Taylor  <iant@google.com>
9754
9755         * plugin.cc (Plugin::load): Don't cast from void* to a function
9756         pointer.
9757
9758 2009-12-09  Ian Lance Taylor  <iant@google.com>
9759
9760         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9761         information fields.
9762
9763 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9764
9765         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9766         Replace two_file_shared_1.so with two_file_shared_2.so.
9767         * testsuite/Makefile.in: Regenerated.
9768
9769 2009-12-08  Doug Kwan  <dougkwan@google.com>
9770
9771         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9772         (HFILES): Add attributes.h and int_encoding.h.
9773         * Makefile.in: Regenerate.
9774         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9775         function definitions to int_encoding.cc
9776         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9777         prototypes to int_encoding.h
9778         * reduced_debug_output.cc (int_encoding.h): New include.
9779         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9780         function definitions to int_encoding.cc
9781         (insert_into_vector, read_from_pointer): Move template definitions to
9782         int_encoding.h
9783         * attributes.cc: New file.
9784         * attributes.h: New file.
9785         * int_encoding.cc: New file.
9786         * int_encoding.h: New file.
9787
9788 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9789
9790         PR gold/11055
9791         * incremental-dump.cc (dump_incremental_inputs): New.
9792         (main): Use dump_incremental_inputs.
9793
9794 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9795
9796         PR gold/10893
9797         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9798         checking elfcpp::STT_FUNC.
9799         (Target_i386::Relocate::relocate): Likewise.
9800         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9801
9802         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9803         symbols from shared libraries into normal FUNC symbols.
9804
9805         * symtab.h (Symbol): Add is_func and use it.
9806
9807 2009-12-05  Doug Kwan  <dougkwan@google.com>
9808
9809         * arm.cc (Target_arm::arm_info): Initialize new fields
9810         attributes_section and attributes_vendor.
9811         * i386.cc (Target_i386::i386_info): Same.
9812         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9813         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9814         fields attributes_section and attributes_vendor.
9815         * sparc.cc (Target_sparc::sparc_info): Same.
9816         * target.h (Target::attributes_section, Target::attributes_vendor,
9817         Target::is_attributes_section, Target::attribute_arg_type,
9818         Target::attributes_order): New method definitions.
9819         (Target::Target_info::attributes_section,
9820         Target::Target_info::attributes_vendor): New fields.
9821         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9822         virtual method definitions.
9823         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9824         attributes_section and attributes_vendor.
9825         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9826
9827 2009-12-05  Doug Kwan  <dougkwan@google.com>
9828
9829         * arm.cc: Update comments about interworking and stub generation.
9830         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9831         considered as non-PIC.
9832         (Arm_relocate_functions::base_abs): Fix formatting.
9833         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9834         of function to use GOT entry address instead of offset.
9835         (Target_arm::Scan::global): Issue an error if a symbol would need a
9836         PLT does not get one because it is untyped.  Remove code to create
9837         dynamic symbols for relative branches.
9838         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9839         takes unsigned integer instead of boolean.
9840
9841 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9842
9843         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9844         (two_file_test_LDADD): Likewise.
9845         (common_test_1_LDADD): Likewise.
9846         (exception_test_LDADD) Likewise.
9847         (weak_test_LDADD): Likewise.
9848         (many_sections_test_LDADD): Likewise.
9849         (initpri1_LDADD): Likewise.
9850         (script_test_1_LDADD): Likewise.
9851         (script_test_2_LDADD): Likewise.
9852         (justsyms_LDADD): Likewise.
9853         (binary_test_LDADD): Likewise.
9854         (large_LDADD): Likewise.
9855         * testsuite/Makefile.in: Regenerated.
9856
9857 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9858
9859         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9860         (Symbol_table::override_with_special): Likewise.
9861         (Symbol_table::add_from_object): Likewise.
9862
9863 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9864
9865         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9866         Don't set the data_offset twice.
9867
9868 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9869
9870         * testsuite/Makefile.in: Regenerate.
9871
9872 2009-12-03  Doug Kwan  <dougkwan@google.com>
9873
9874         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9875         (Target_arm::do_finalize_sections): Add parameter for symbol table
9876         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9877         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9878         parameter for symbol table pointer.
9879         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9880         an additional parameter for a pointer to symbol table.
9881         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9882         parameter for a symbol table pointer.
9883         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9884         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9885         Ditto.
9886         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
9887         parameter for a symbol table pointer.
9888
9889 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
9890
9891         * incremental.cc (Incremental_inputs_header)
9892         (Incremental_inputs_header_write, Incremental_inputs_entry)
9893         (Incremental_inputs_entry_write): Move ...
9894         * incremental.h (Incremental_inputs_header)
9895         (Incremental_inputs_header_write, Incremental_inputs_entry)
9896         (Incremental_inputs_entry_write): here.
9897
9898 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9899
9900         * incremental.cc (make_sized_incremental_binary): Set the target.
9901         Error if it is incompatible.
9902         * output.h (Output_file): Add filename method.
9903
9904 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9905
9906         * incremental.cc (Incremental_inputs_entry): Remove unused argument
9907         from the get_* methods.
9908
9909 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9910
9911         * incremental-dump.cc (main): Check that the offeset of a script is 0.
9912         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9913         Write 0 for the data_offset of scripts.
9914
9915 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
9916
9917         * testsuite/Makefile.am: Add the incremental_test.sh test.
9918         * testsuite/incremental_test.sh: New.
9919         * testsuite/incremental_test_1.c: New.
9920         * testsuite/incremental_test_2.c: New.
9921
9922 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
9923
9924         * incremental-dump.cc (main): Fix typos.
9925
9926 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
9927
9928         PR gold/11025
9929         * incremental-dump.cc (main): Use llu to print 64 bit values.
9930
9931 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
9932             H.J. Lu  <hongjiu.lu@intel.com>
9933
9934         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
9935         $(LIBDL).
9936         (incremental_dump_LDADD): Likewise.
9937         * Makefile.in: Regenerated.
9938
9939 2009-11-25  Doug Kwan  <dougkwan@google.com>
9940
9941         Revert:
9942
9943         2009-11-25  Doug Kwan  <dougkwan@google.com>
9944
9945                 * arm.cc (Target_arm::Target_arm): Move method definition
9946                 outside of class definition.  Add code to handle
9947                 --target1-rel, --target1-abs and --target2= options.
9948                 (Target_arm::get_reloc_reloc_type): Change method to be
9949                 non-static and const.
9950                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
9951                 New data member declaration.
9952                 (Target_arm::Scan::local, Target_arm::Scan::global,
9953                 Target_arm::Relocate::relocate,
9954                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9955                 Adjust call to Target_arm::get_real_reloc_type.
9956                 (Target_arm::get_real_reloc_type): Use command line options
9957                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9958                 * options.h (--target1-rel, --target1-abs, --target2): New
9959                 ARM-only options.
9960
9961 2009-11-25  Doug Kwan  <dougkwan@google.com>
9962
9963         * arm.cc (Target_arm::Target_arm): Move method definition outside of
9964         class definition.  Add code to handle --target1-rel, --target1-abs
9965         and --target2= options.
9966         (Target_arm::get_reloc_reloc_type): Change method to be non-static
9967         and const.
9968         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
9969         member declaration.
9970         (Target_arm::Scan::local, Target_arm::Scan::global,
9971         Target_arm::Relocate::relocate,
9972         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
9973         call to Target_arm::get_real_reloc_type.
9974         (Target_arm::get_real_reloc_type): Use command line options to
9975         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
9976         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
9977         options.
9978
9979 2009-11-25  Doug Kwan  <dougkwan@google.com>
9980
9981         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
9982         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
9983         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
9984         formatting.
9985         (Arm_relocate_functions::thm_call): Replace body with a call to
9986         Arm_relocate_functions::thumb_branch_common.
9987         (Arm_relocate_functions::thm_jump24,
9988         Arm_relocate_functions::thm_xpc22): New method definitions.
9989         (Arm_relocate_functions::thumb_branch_common): New method definition.
9990         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
9991         operator.
9992         (Target_arm::Relocate::relocate): Adjust call to thm_call.
9993         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
9994
9995 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
9996
9997         * Makefile.am: Build incremental-dump
9998         * Makefile.in: Regenerate.
9999         * incremental-dump.cc: New.
10000         * incremental.cc (Incremental_inputs_header_data,
10001         Incremental_inputs_entry_data): Move to incremental.h
10002         * incremental.h: (Incremental_inputs_header_data,
10003         Incremental_inputs_entry_data): Move from incremental.cc
10004
10005 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10006
10007         * incremental.cc (Incremental_inputs_header,
10008         Incremental_inputs_header_write, Incremental_inputs_entry,
10009         Incremental_inputs_entry_write): Add a typedef with the data type.
10010
10011 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10012
10013         * incremental.cc (Incremental_inputs_header,
10014         Incremental_inputs_header_write, Incremental_inputs_entry,
10015         Incremental_inputs_entry_write): Update comment about which
10016         type has the filed descriptions.
10017
10018 2009-11-15  Doug Kwan  <dougkwan@google.com>
10019
10020         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10021         (Arm_relocate_functions::arm_branch_common): Change method defintion
10022         in class definition to a method declaration and update list of formal
10023         parameters.
10024         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10025         Arm_relocation_functions::jump24): Adjust call to
10026         Arm_relocate_functions::arm_branch_common.  Update list of formal
10027         parameters.
10028         (Arm_relocate_functions::xpc25): New method definition.
10029         (Arm_relocate_functions::arm_branch_common): Move method defintion
10030         out from class definition.  Use stubs for mode-switching and extending
10031         branch ranges.
10032         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10033         specially.  Change code to enable use of stubs in ARM branches.
10034
10035 2009-11-10  Doug Kwan  <dougkwan@google.com>
10036
10037         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10038         in method declaration.
10039         (Target_arm::relocate_stub): New method declaration.
10040         (Target_arm::default_target): Change to return a pointer instead of
10041         a const reference.
10042         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10043         Target_arm::default_target.
10044         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10045         method definition.
10046         (Target_arm::relocate_section): Adjust view.
10047         (Target_arm::relocate_stub): New method definition.
10048
10049 2009-11-10  Doug Kwan  <dougkwan@google.com>
10050
10051         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10052         a format warning.
10053         * incremental.cc (open_incremental_binary): Initialized local
10054         variables to avoid warnings.
10055         * object.cc (make_elf_object): Ditto.
10056         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10057         a format warning.
10058
10059 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10060
10061         PR gold/10930
10062         * testsuite/plugin_test.c: Include "config.h".
10063
10064 2009-11-09  Doug Kwan  <dougkwan@google.com>
10065
10066         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10067         (arm_symbol_value): Remove.
10068         (Arm_relocate_functions::arm_branch_common,
10069         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10070         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10071         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10072         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10073         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10074         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10075         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10076         Arm_relocate_functions::thm_mobw_abs_nc,
10077         Arm_relocate_functions::thm_mov_abs,
10078         Arm_relocate_functions::movw_prel_nc,
10079         Arm_relocate_functions::thm_movt_abs,
10080         Arm_relocate_functions::movt_prel,
10081         Arm_relocate_functions::thm_movw_prel_nc,
10082         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10083         (Target_arm::Relocate::relocate): Only decompose address into two
10084         parts if relocation type uses the thumb-bit and pass the actual
10085         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10086         calls to methods in Arm_relocate_functions for this change.
10087
10088 2009-11-08  Ian Lance Taylor  <iant@google.com>
10089
10090         PR 10925
10091         * reloc.cc: Instantiate
10092         Sized_relobj::initialize_input_to_output_maps and
10093         Sized_relobj:free_input_to_output_maps.
10094
10095 2009-11-06  Ian Lance Taylor  <iant@google.com>
10096
10097         PR 10876
10098         * defstd.cc (in_segment): Set only_if_ref true for "end".
10099
10100 2009-11-06  Doug Kwan  <dougkwan@google.com>
10101
10102         * arm.cc (class Reloc_stub): Correct a comment.
10103         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10104         (Target_arm::scan_section_for_stubs): New method declaration.
10105         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10106         Change methods from private to protected.
10107         (Target_arm::do_may_relax): New method definition.
10108         (Target_arm::do_relax, Target_arm::group_sections,
10109         Target_arm::scan_reloc_for_stub,
10110         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10111         (Target_arm::arm_input_section_map_): New data member declaration.
10112         (Target_arm::scan_reloc_for_stub,
10113         Target_arm::scan_reloc_section_for_stubs,
10114         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10115         Target_arm::do_relax): New method definitions.
10116
10117 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10118
10119         * configure.ac: Check for (struct stat)::st_mtim
10120         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10121         * config.in: Regenerate.
10122         * configure: Regenerate.
10123
10124 2009-11-05  Ian Lance Taylor  <iant@google.com>
10125
10126         PR 10910
10127         * output.cc (Output_segment::add_output_section): Add missing
10128         return statement.
10129
10130 2009-11-04  Ian Lance Taylor  <iant@google.com>
10131
10132         PR 10880
10133         * object.h (class Object): Add is_needed and set_is_needed
10134         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10135         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10136         defined in a dynamic object and referenced by a regular object,
10137         set is_needed for the dynamic object.
10138         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10139         if the file is marked with as_needed and it is not needed.
10140
10141 2009-11-04  Ian Lance Taylor  <iant@google.com>
10142
10143         PR 10887
10144         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10145         tags if data is discarded by linker script.
10146         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10147         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10148         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10149         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10150
10151 2009-11-04  Ian Lance Taylor  <iant@google.com>
10152
10153         * layout.cc (Layout::get_output_section): Add is_interp and
10154         is_dynamic_linker_section parameters.  Change all callers.
10155         (Layout::choose_output_section): Likewise.
10156         (Layout::make_output_section): Likewise.
10157         (Layout::add_output_section_data): Add is_dynamic_linker_section
10158         parameter.  Change all callers.
10159         * layout.h (class Layout): Update declarations.
10160         * output.h (class Output_section): Add is_interp, set_is_interp,
10161         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10162         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10163         generate_code_fills_at_write_ to a bitfield.
10164         * output.cc (Output_section::Output_sections): Initialize new
10165         fields.
10166         (Output_segment::add_output_section): Add do_sort parameter.
10167         Change all callers.
10168
10169 2009-11-03  Ian Lance Taylor  <iant@google.com>
10170
10171         PR 10860
10172         * options.h (class General_options): Add --warn-common.
10173         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10174         merging two common symbols.
10175         (Symbol_table::should_override): Handle --warn-common when merging
10176         a common symbol with a defined symbol.  Use report_resolve_problem
10177         for multiple definitions.
10178         (Symbol_table::report_resolve_problem): New function.
10179         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10180
10181 2009-11-03  Doug Kwan  <dougkwan@google.com>
10182
10183         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10184         stub_factory_.
10185         (Target_arm::stub_factory): New method definition.
10186         (Target_arm::new_arm_input_section,
10187         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10188         Target_arm::reloc_uses_thumb_bit): New method declarations.
10189         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10190         New type definitions.
10191         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10192         member declarations.
10193         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10194         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10195         New method definitions.
10196
10197 2009-11-03  Ian Lance Taylor  <iant@google.com>
10198
10199         * options.h (class General_options): Add --warn_constructors.
10200
10201 2009-11-03  Ian Lance Taylor  <iant@google.com>
10202
10203         PR 10893
10204         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10205         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10206
10207 2009-11-03  Ian Lance Taylor  <iant@google.com>
10208
10209         PR 10895
10210         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10211         --msgid-bugs-address.
10212         (install-pdf): New target.
10213         (install-data_yes): Look up one directory to find mkinstalldirs.
10214
10215 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10216
10217         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10218         tree.
10219
10220 2009-10-30  Doug Kwan  <dougkwan@google.com>
10221
10222         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10223
10224 2009-10-30  Doug Kwan  <dougkwan@google.com>
10225
10226         * arm.cc (Stub_addend_reader): New struct template definition
10227         and partial specializations.
10228         (Stub_addend_reader::operator()): New method definition for a
10229         partially specialized template.
10230
10231 2009-10-30  Doug Kwan  <dougkwan@google.com>
10232
10233         * arm.cc (Arm_relobj::processor_specific_flags): New method
10234         definition.
10235         (Arm_relobj::do_read_symbols): New method declaration.
10236         (Arm_relobj::processor_specific_flags_): New data member declaration.
10237         (Arm_dynobj): New class definition.
10238         (Target_arm::do_finalize_sections): Add input_objects parameter.
10239         (Target_arm::do_adjust_elf_header): New method declaration.
10240         (Target_arm::are_eabi_versions_compatible,
10241         (Target_arm::merge_processor_specific_flags): New method declaration.
10242         (Target_arm::do_make_elf_object): New overloaded method definitions
10243         and declaration.
10244         (Arm_relobj::do_read_symbols): New method definition.
10245         (Arm_dynobj::do_read_symbols): Ditto.
10246         (Target_arm::do_finalize_sections): Add input_objects parameters.
10247         Merge processor-specific flags from all input objects.
10248         (Target_arm::are_eabi_versions_compatible,
10249         Target_arm::merge_processor_specific_flags,
10250         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10251         New method definitions.
10252         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10253         Input_objects pointer type parameter.
10254         * layout.cc (Layout::finalize): Pass input objects to target's.
10255         finalize_sections function.
10256         * output.cc (Output_file_header::do_sized_write): Set ELF file
10257         header's processor-specific flags.
10258         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10259         Input_objects pointer type parameter.
10260         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10261         * target.h (Input_objects): New forward class declaration.
10262         (Target::processor_specific_flags,
10263         Target::are_processor_specific_flags_sect): New method definitions.
10264         (Target::finalize_sections): Add input_objects parameter.
10265         (Target::Target): Initialize processor_specific_flags_ and
10266         are_processor_specific_flags_set_.
10267         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10268         parameter.
10269         (Target::set_processor_specific_flags): New method definition.
10270         (Target::processor_specific_flags_,
10271         Target::are_processor_specific_flags_set_): New data member
10272         declarations.
10273         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10274         Input_objects pointer type parameter.
10275
10276 2009-10-30  Doug Kwan  <dougkwan@google.com>
10277
10278         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10279
10280 2009-10-28  Ian Lance Taylor  <iant@google.com>
10281
10282         * object.h (class Relobj): Drop options parameter from
10283         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10284         do_scan_relocs, do_relocate.  Change all callers.
10285         (class Sized_relobj): Drop options parameters from
10286         do_gc_process_relocs, do_scan_relocs, do_relocate,
10287         do_relocate_sections, relocate_sections, emit_relocs_scan,
10288         emit_relocs_scan_reltype.  Change all callers.
10289         (struct Relocate_info): Remove options field and all references to
10290         it.
10291         * reloc.h (class Read_relocs): Remove options constructor
10292         parameter and options_ field.  Change all callers.
10293         (class Gc_process_relocs, class Scan_relocs): Likewise.
10294         (class Relocate_task): Likewise.
10295         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10296         all callers.
10297         (scan_relocatable_relocs): Likewise.
10298         * target.h (class Sized_target): Remove options parameter from
10299         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10300         all callers.
10301         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10302         callers.
10303         * arm.cc: Update functions to remove options parameters.
10304         * i386.cc: Likewise.
10305         * powerpc.cc: Likewise.
10306         * sparc.cc: Likewise.
10307         * x86_64.cc: Likewise.
10308         * testsuite/testfile.cc: Likewise.
10309
10310 2009-10-28  Doug Kwan  <dougkwan@google.com>
10311
10312         * arm.cc (Arm_relobj): New class definition.
10313         (Arm_relobj::scan_sections_for_stubs,
10314         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10315         New method definitions.
10316
10317 2009-10-28  Cary Coutant  <ccoutant@google.com>
10318
10319         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10320         (Plugin::cleanup_done_): New member.
10321         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10322         (Plugin_manager::cleanup_done_): Remove.
10323         (Plugin_manager::add_input_file): Edit error message.
10324         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10325         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10326
10327 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10328
10329         * fileread.cc: (File_read::View::~View): Use the new
10330         data_ownership_ filed.
10331         (File_read::~File_read): Dispose the new whole_file_view_.
10332         (File_read::open): Mmap the whole file if needed.
10333         (File_read::open): Use whole_file_view_ instead of contents_.
10334         (File_read::find_view): Use whole_file_view_ if applicable.
10335         (File_read::do_read): Use whole_file_view_ instead of contents_.
10336         (File_read::make_view): Use whole_file_view_ instead of contents_,
10337         update File_read::View::View call.
10338         (File_read::find_or_make_view): Update File_read::View::View
10339         call.
10340         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10341         remove contents_
10342         (File_read::View::Data_ownership): New enum.
10343         (File_read::View::View): Replace bool mapped_ with Data_ownership
10344         argument.
10345         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10346         (File_read::View::data_ownership_): New field.
10347         (File_read::contents_): Remove (replaced by whole_file_view_).
10348         (File_read::whole_file_view_): New field.
10349         * options.h (class General_options): Add --keep-files-mapped.
10350
10351 2009-10-27  Cary Coutant  <ccoutant@google.com>
10352
10353         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10354         * testsuite/Makefile.am (plugin_test_5): New test case.
10355         * testsuite/Makefile.in: Regenerate.
10356
10357 2009-10-25  Doug Kwan  <dougkwan@google.com>
10358
10359         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10360         from private to protected to allow access by child class.
10361         (Sized_relobj::do_relocate_sections): New method declaration.
10362         (Sized_relobj::relocate_sections): Virtualize.
10363         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10364         Sized_relobj::relocate_sections.  Instantiate template explicitly
10365         for different target sizes and endianity.
10366
10367 2009-10-24  Doug Kwan  <dougkwan@google.com>
10368
10369         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10370         (Arm_input_section::as_arm_input_section): New method.
10371         (Arm_output_section): New class definition.
10372         (Arm_output_section::create_stub_group,
10373         Arm_output_section::group_sections): New method definitions.
10374
10375 2009-10-22  Doug Kwan  <dougkwan@google.com>
10376
10377         * arm.cc (Arm_input_section): New class definition.
10378         (Arm_input_section::init, Arm_input_section:do_write,
10379         Arm_input_section::set_final_data_size,
10380         Arm_input_section::do_reset_address_and_file_offset): New method
10381         definitions.
10382
10383 2009-10-21  Doug Kwan  <dougkwan@google.com>
10384
10385         * arm.cc (Stub_table, Arm_input_section): New forward class
10386         declarations.
10387         (Stub_table): New class defintion.
10388         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10389         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10390         New method definition.
10391
10392 2009-10-21  Doug Kwan  <dougkwan@google.com>
10393
10394         * arm.cc: Update copyright comments.
10395         (Target_arm): New forward class template declaration.
10396         (Arm_address): New type.
10397         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10398         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10399         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10400         constants.
10401         (Insn_template): Same.
10402         (DEF_STUBS): New macro.
10403         (Stub_type): New enum type.
10404         (Stub_template): New class definition.
10405         (Stub): Same.
10406         (Reloc_stub): Same.
10407         (Stub_factory): Same.
10408         (Target_arm::Target_arm): Initialize may_use_blx_ and
10409         should_force_pic_veneer_.
10410         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10411         Target_arm::should_force_pic_veneer,
10412         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10413         Target_arm::using_thumb_only, Target_arm:;default_target): New
10414         method defintions.
10415         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10416         New data member declarations.
10417         (Insn_template::size, Insn_template::alignment): New method defintions.
10418         (Stub_template::Stub_template): New method definition.
10419         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10420         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10421         (Stub_factory::Stub_factory): New method definition.
10422         * gold.h (string_hash): New template.
10423         * output.h (Input_section_specifier::hash_value): Use
10424         gold::string_hash.
10425         (Input_section_specifier::string_hash): Remove.
10426         * stringpool.cc (Stringpool_template::string_hash): Use
10427         gold::string_hash.
10428
10429 2009-10-20  Doug Kwan  <dougkwan@google.com>
10430
10431         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10432         symbols of relaxed input sections.
10433         * output.h (Output_section::find_relaxed_input_section): Make
10434         method public.
10435
10436 2009-10-16  Doug Kwan  <dougkwan@google.com>
10437
10438         * dynobj.cc (Versions::Versions): Initialize version_script_.
10439         Only insert base version symbol definition for a shared object
10440         if version script defines any version versions.
10441         (Versions::define_base_version): New method definition.
10442         (Versions::add_def): Check that base version is not needed.
10443         (Versions::add_need): Define base version lazily.
10444         * dynobj.h (Versions::define_base_version): New method declaration.
10445         (Versions::needs_base_version_): New data member declaration.
10446         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10447         (check_DATA): Add no_version_test.stdout.
10448         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10449         New make rules.
10450         * testsuite/Makefile.in: Regenerate.
10451         * testsuite/no_version_test.c: New file.
10452         * testsuite/no_version_test.sh: Ditto.
10453
10454 2009-10-16  Doug Kwan  <dougkwan@google.com>
10455
10456         * expression.cc (class Segment_start_expression): New class definition.
10457         (Segment_start_expression::value): New method definition.
10458         (script_exp_function_segment_start): Return a new
10459         Segment_start_expression.
10460         * gold/script-c.h (script_saw_segment_start_expression): New function
10461         prototype.
10462         * script-sections.cc (Script_sections::Script_sections): Initialize
10463         SAW_SEGMENT_START_EXPRESSION_ to false.
10464         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10465         and -Tbbs options to specify section addresses if given in
10466         command line and no SEGMENT_START expression is seen in a script.
10467         * script-sections.h (Script_sections::saw_segment_start_expression,
10468         Script_sections::set_saw_segment_start_expression): New method
10469         definition.
10470         (Script_sections::saw_segment_start_expression_): New data member
10471         declaration.
10472         * script.cc (script_saw_segment_start_expression): New function.
10473         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10474         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10475         script_test_7.sh and script_test_8.sh.
10476         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10477         script_test_8.stdout.
10478         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10479         (script_test_6, script_test_6.stdout, script_test_7,
10480         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10481         * Makefile.in: Regenerate.
10482         * testsuite/script_test_6.sh: New file.
10483         * testsuite/script_test_6.t: Same.
10484         * testsuite/script_test_7.sh: Same.
10485         * testsuite/script_test_7.t: Same.
10486         * testsuite/script_test_8.sh: Same.
10487
10488 2009-10-16  Doug Kwan  <dougkwan@google.com>
10489
10490         * output.cc (Output_segment::set_section_list_address): Cast
10491         expressions to unsigned long long type to avoid format warnings.
10492
10493 2009-10-15  Ian Lance Taylor  <iant@google.com>
10494
10495         * script.cc (Script_options::add_symbol_assignment): Always add a
10496         dot assignment to script_sections_.
10497         * script-sections.cc (Script_sections::add_dot_assignment):
10498         Initialize if necessary.
10499
10500         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10501         program headers with no load segment if there is a linker script.
10502
10503         * layout.cc (Layout::set_segment_offsets): Align the file offset
10504         to the segment aligment for -N or -n with no load segment.
10505         * output.cc (Output_segment::add_output_section): Don't crash if
10506         the first section is a TLS section.
10507         (Output_segment::set_section_list_addresses): Print an error
10508         message if the address moves backward in a linker script.
10509         * script-sections.cc
10510         (Output_section_element_input::set_section_addresses): Don't
10511         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10512         (Orphan_output_section::set_section_addresses): Likewise.
10513
10514 2009-10-15  Doug Kwan  <dougkwan@google.com>
10515
10516         * layout.cc (Layout::finish_dynamic_section): Generate tags
10517         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10518         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10519         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10520
10521 2009-10-14  Ian Lance Taylor  <iant@google.com>
10522
10523         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10524         fields.
10525         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10526         data_shdr fields of relinfo.
10527         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10528         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10529         R_386_TLS_LDO_32, adjust based on section flags.
10530         (Target_i386::Relocate::fix_up_ldo): Remove.
10531
10532 2009-10-13  Ian Lance Taylor  <iant@google.com>
10533
10534         Add support for -pie.
10535         * options.h (class General_options): Add -pie and
10536         --pic-executable.
10537         (General_options::output_is_position_independent): Test -pie.
10538         (General_options::output_is_executable): Return true if not shared
10539         and not relocatable.
10540         (General_options::output_is_pie): Remove.
10541         * options.cc (General_options::finalize): Reject incompatible uses
10542         of -pie.
10543         * gold.cc (queue_middle_tasks): A -pie link is not static.
10544         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10545         * symtab.cc (Symbol::final_value_is_known): Return false if
10546         output_is_position_independent.
10547         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10548         output_is_position_independent.
10549         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10550         output_is_position_independent.
10551         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10552         output_is_position_independent.
10553         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10554         two_file_pie_test.
10555         (basic_pie_test.o, basic_pie_test): New targets.
10556         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10557         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10558         (two_file_pie_test): New target.
10559         * testsuite/Makefile.in: Rebuild.
10560         * README: Remove note saying that -pie is not supported.
10561
10562 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10563
10564         * options.h (class General_options): Add -init and -fini.
10565         * layout.cc (Layout::finish_dynamic_section): Emit
10566         given init and fini functions.
10567
10568 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10569
10570         * gc.h (gc_process_relocs): Check if icf is enabled using new
10571         function.
10572         * gold.cc (queue_initial_tasks): Likewise.
10573         (queue_middle_tasks): Likewise.
10574         * object.cc (do_layout): Likewise.
10575         * symtab.cc (is_section_folded): Likewise.
10576         * main.cc (main): Likewise.
10577         * reloc.cc (Read_relocs::run): Likewise.
10578         (Sized_relobj::do_scan_relocs): Likewise.
10579         * icf.cc (is_function_ctor_or_dtor): New function.
10580         (Icf::find_identical_sections): Check if function is ctor or dtor when
10581         safe icf is chosen.
10582         * options.h (General_options::icf): Change option to be an enum.
10583         (Icf_status): New enum.
10584         (icf_enabled): New method.
10585         (icf_safe_folding): New method.
10586         (set_icf_status): New method.
10587         (icf_status_): New variable.
10588         * (options.cc) (General_options::finalize): Set icf_status_.
10589         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10590         icf_test and icf_keep_unique_test to use the --icf enum flag.
10591         * testsuite/icf_safe_test.sh: New file.
10592         * testsuite/icf_safe_test.cc: New file.
10593
10594 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10595
10596         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10597         includes to gc.h and icf.h.
10598         * arm.cc: Include gc.h.
10599         * gold.cc: Likewise.
10600         * i386.cc: Likewise.
10601         * powerpc.cc: Likewise.
10602         * sparc.cc: Likewise.
10603         * x86_64.cc: Likewise.
10604         * gc.h: Include icf.h.
10605
10606 2009-10-11  Ian Lance Taylor  <iant@google.com>
10607
10608         * plugin.cc: Include "gold.h" before other header files.
10609
10610 2009-10-10  Chris Demetriou  <cgd@google.com>
10611
10612         * options.h (Input_file_argument::Input_file_type): New enum.
10613         (Input_file_argument::is_lib_): Replace with...
10614         (Input_file_argument::type_): New member.
10615         (Input_file_argument::Input_file_argument): Take Input_file_type
10616         'type' rather than boolean 'is_lib' as second argument.
10617         (Input_file_argument::is_lib): Use type_.
10618         (Input_file_argument::is_searched_file): New function.
10619         (Input_file_argument::may_need_search): Handle is_searched_file.
10620         * options.cc (General_options::parse_library): Support -l:filename.
10621         (General_options::parse_just_symbols): Update for Input_file_argument
10622         changes.
10623         (Command_line::process): Likewise.
10624         * archive.cc (Archive::get_file_and_offset): Likewise.
10625         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10626         * script.cc (read_script_file, script_add_file): Likewise.
10627         * fileread.cc (Input_file::Input_file): Likewise.
10628         (Input_file::will_search_for): Handle is_searched_file.
10629         (Input_file::open): Likewise.
10630         * readsyms.cc (Read_symbols::get_name): Likewise.
10631         * testsuite/Makefile.am (searched_file_test): New test.
10632         * testsuite/Makefile.in: Regenerate.
10633         * testsuite/searched_file_test.cc: New file.
10634         * testsuite/searched_file_test_lib.cc: New file.
10635
10636 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10637             Ian Lance Taylor  <iant@google.com>
10638
10639         * descriptor.cc: Include <cstdio> and "binary-io.h".
10640         (Descriptors::open): Open the files in binary mode always.
10641         * script.cc (Lex::get_token): Treat \r as whitespace.
10642
10643 2009-10-09  Ian Lance Taylor  <iant@google.com>
10644
10645         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10646
10647 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10648             Ian Lance Taylor  <iant@google.com>
10649
10650         * configure.ac: Check for readv function also.
10651         * fileread.cc (readv): Define if not HAVE_READV.
10652         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10653         does not exist.
10654         * config.in: Regenerate.
10655         * configure: Regenerate.
10656
10657 2009-10-09  Doug Kwan  <dougkwan@google.com>
10658
10659         * layout.cc (Layout::make_output_section): Call target hook to make
10660         ordinary output section.
10661         (Layout::finalize): Adjust parameter list of call the
10662         Target::may_relax().
10663         * layout.h (class Layout::section_list): New method.
10664         * merge.h (Output_merge_base::entsize): Change visibility to public.
10665         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10666         New methods.
10667         (Output_merge_string::do_is_string): New method.
10668         * object.cc (Sized_relobj::do_setup): renamed from
10669         Sized_relobj::set_up.
10670         * object.h (Sized_relobj::adjust_shndx,
10671         Sized_relobj::initializ_input_to_output_maps,
10672         Sized_relobj::free_input_to_output_maps): Change visibilities to
10673         protected.
10674         (Sized_relobj::setup): Virtualize.
10675         (Sized_relobj::do_setup): New method declaration.
10676         (Sized_relobj::invalidate_section_offset,
10677         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10678         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10679         * options.cc (parse_int): New function.
10680         * options.h (parse_int): New declaration.
10681         (DEFINE_int): New macro.
10682         (stub_group_size): New option.
10683         * output.cc (Output_section::Output_section): Initialize memebers
10684         merge_section_map_, merge_section_by_properties_map_,
10685         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10686         (Output_section::add_input_section): Handled deferred code-fill
10687         generation and remove an old comment.
10688         (Output_section::add_relaxed_input_section): New method definition.
10689         (Output_section::add_merge_input_section): Use merge section by
10690         properties map to speed to search.  Update merge section maps
10691         as appropriate.
10692         (Output_section::build_relaxation_map): New method definition.
10693         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10694         Same.
10695         (Output_section::relax_input_section): Renamed to
10696         Output_section::convert_input_sections_to_relaxed_sections and change
10697         interface to take a vector of pointers to relaxed sections.
10698         (Output_section::find_merge_section,
10699         Output_section::find_relaxed_input_section): New method definitions.
10700         (Output_section::is_input_address_mapped,
10701         Output_section::output_offset, Output_section::output_address):
10702         Use output section data maps to speed up searching.
10703         (Output_section::find_starting_output_address): Add comments.
10704         (Output_section::do_write,
10705         Output_section::write_to_postprocessing_buffer): Do code-fill
10706         generation as appropriate.
10707         (Output_section::get_input_sections): Invalidate relaxed input section
10708         map.
10709         (Output_section::restore_states): Adjust type of checkpoint .
10710         Invalidate relaxed input section map.
10711         * output.h (Output_merge_base): New class declaration.
10712         (Input_section_specifier): New class defintion.
10713         (class Output_relaxed_input_section) Change base class to
10714         Output_section_data_build.
10715         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10716         base class initializer.
10717         (Output_section::add_relaxed_input_section): New method declaration.
10718         (Output_section::Input_section): Change visibility to protected.
10719         (Output_section::Input_section::relobj,
10720         Output_section::Input_section::shndx): Handle relaxed input sections.
10721         Output_section::input_sections) Change visibility to protected.  Also
10722         define overload to return a non-const pointer.
10723         (Output_section::Merge_section_properties): New class defintion.
10724         (Output_section::Merge_section_by_properties_map,
10725         Output_section::Output_section_data_by_input_section_map,
10726         Output_section::Relaxation_map): New types.
10727         (Output_section::relax_input_section): Rename method to
10728         Output_section::convert_input_sections_to_relaxed_sections and change
10729         interface to take a vector of relaxed section pointers.
10730         (Output_section::find_merge_section,
10731         Output_section::find_relaxed_input_section,
10732         Output_section::build_relaxation_map,
10733         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10734         New method declarations.
10735         (Output_section::merge_section_map_
10736         Output_section::merge_section_by_properties_map_,
10737         Output_section::relaxed_input_section_map_,
10738         Output_section::is_relaxed_input_section_map_valid_,
10739         Output_section::generate_code_fills_at_write_): New data members.
10740         * script-sections.cc
10741         (Output_section_element_input::set_section_addresses): Call
10742         current_data_size and addralign methods of relaxed input sections.
10743         (Orphan_output_section::set_section_addresses): Call current_data_size
10744         and addralign methods of relaxed input sections.
10745         * symtab.cc (Symbol_table::compute_final_value): Extract template
10746         from the body of Symbol_table::sized_finalize_symbol.
10747         (Symbol_table::sized_finalized_symbol): Call
10748         Symbol_table::compute_final_value.
10749         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10750         (Symbol_table::compute_final_value): New templated method declaration.
10751         * target.cc (Target::do_make_output_section): New method defintion.
10752         * target.h (Target::make_output_section): New method declaration.
10753         (Target::relax): Add more parameters for input objects, symbol table
10754         and layout.  Adjust call to do_relax.
10755         (Target::do_make_output_section): New method declaration.
10756         (Target::do_relax): Add parameters for input objects, symbol table
10757         and layout.
10758
10759 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10760
10761         * pread.c: Include stdio.h.
10762
10763 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10764
10765         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10766         defined.
10767
10768 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10769
10770         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10771         Change read_shndx type to unsigned int.
10772         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10773         int.
10774         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10775         * dwarf_reader.h (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         * layout.cc (Layout::create_symtab_sections): Cast the result of
10781         local_symcount * symsize to off_t in the gold_assert.
10782
10783 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10784
10785         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10786         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10787         R_ARM_BASE_ABS.
10788         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10789         (Arm_relocate_functions::thm_abs5): New function.
10790         (Arm_relocate_functions::abs12): New function.
10791         (Arm_relocate_functions::abs16): New function.
10792         (Arm_relocate_functions::base_abs): New function.
10793         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10794         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10795         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10796         R_ARM_BASE_ABS.
10797         (Scan::global): Likewise.
10798         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10799         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10800         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10801         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10802         R_ARM_BASE_ABS.
10803
10804 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10805
10806         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10807         (Arm_relocate_functions::movt_prel): New function.
10808         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10809         (Arm_relocate_functions::thm_movt_prel): New function.
10810         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10811         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10812         (Scan::global, Relocate::relocate): Likewise.
10813         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10814
10815 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10816
10817         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10818         Incremental_checker.
10819         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10820         unsigned int.
10821         (class Incremental_inputs_header): New class.
10822         (Incremental_inputs_header_writer): Edit comment.
10823         (Incremental_inputs_entry): New class.
10824         (Incremental_inputs_entry_writer): Edit comment.
10825         (Sized_incremental_binary::do_find_incremental_inputs_section):
10826         Add *strtab_shndx parameter, fill it.
10827         (Sized_incremental_binary::do_check_inputs): New method.
10828         (Incremental_checker::can_incrementally_link_output_file): Use
10829         Sized_incremental_binary::check_inputs.
10830         (Incremental_inputs::report_command_line): Save command line in
10831         command_line_.
10832         * incremental.h:
10833         (Incremental_binary::find_incremental_inputs_section): New
10834         method.
10835         (Incremental_binary::do_find_incremental_inputs_section): Add
10836         strtab_shndx parameter.
10837         (Incremental_binary::do_check_inputs): New pure virtual method.
10838         (Sized_incremental_binary::do_check_inputs): Declare.
10839         (Incremental_checker::Incremental_checker): Add incremental_inputs
10840         parameter, use it to initialize incremental_inputs_.
10841         (Incremental_checker::incremental_inputs_): New field.
10842         (Incremental_checker::command_line): New method.
10843         (Incremental_checker::inputs): New method.
10844         (Incremental_checker::command_line_): New field.
10845
10846 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10847
10848         * incremental.cc: Include <cstdarg> and "target-select.h".
10849         (vexplain_no_incremental): New function.
10850         (explain_no_incremental): New function.
10851         (Incremental_binary::error): New method.
10852         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10853         method.
10854         (make_sized_incremental_binary): New function.
10855         (open_incremental_binary): New function.
10856         (can_incrementally_link_file): Add checks if output is ELF and has
10857         inputs section.
10858         * incremental.h: Include "elfcpp_file.h" and "output.h".
10859         (Incremental_binary): New class.
10860         (Sized_incremental_binary): New class.
10861         (open_incremental_binary): Declare.
10862         * object.cc (is_elf_object): Use
10863         elfcpp::Elf_recognizer::is_elf_file.
10864         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10865         * output.h (Output_file::filesize): New method.
10866
10867 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10868
10869         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10870         New function.
10871         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10872         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10873         function.
10874         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10875         function.
10876         (Arm_relocate_functions::movw_abs_nc): New function.
10877         (Arm_relocate_functions::movt_abs): New function.
10878         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10879         (Arm_relocate_functions::thm_movt_abs): New function.
10880         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10881         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10882         (Scan::global): Likewise.
10883         (Relocate::relocate): Likewise.
10884         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10885
10886 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10887
10888         * arm.cc (Arm_relocate_functions::got_prel) New function.
10889         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
10890         (Relocate::relocate): Likewise.
10891         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10892
10893 2009-10-06  Ian Lance Taylor  <iant@google.com>
10894
10895         * options.h (class General_options): Define
10896         split_stack_adjust_size parameter.
10897         * object.h (class Object): Add uses_split_stack_ and
10898         has_no_split_stack_ fields.  Add uses_split_stack and
10899         has_no_split_stack accessor functions.  Declare
10900         handle_split_stack_section.
10901         (class Reloc_symbol_changes): Define.
10902         (class Sized_relobj): Define Function_offsets.  Declare
10903         split_stack_adjust, split_stack_adjust_reltype, and
10904         find_functions.
10905         * object.cc (Object::handle_split_stack_section): New function.
10906         (Sized_relobj::do_layout): Call handle_split_stack_section.
10907         * dynobj.cc (Sized_dynobj::do_layout): Call
10908         handle_split_stack_section.
10909         * reloc.cc (Sized_relobj::relocate_sections): Call
10910         split_stack_adjust for executable sections in split_stack
10911         objects.  Pass reloc_map to relocate_section.
10912         (Sized_relobj::split_stack_adjust): New function.
10913         (Sized_relobj::split_stack_adjust_reltype): New function.
10914         (Sized_relobj::find_functions): New function.
10915         * target-reloc.h: Include "object.h".
10916         (relocate_section): Add reloc_symbol_changes parameter.  Change
10917         all callers.
10918         * target.h (class Target): Add calls_non_split method.  Declare
10919         do_calls_non_split virtual method.  Declare match_view and
10920         set_view_to_nop.
10921         * target.cc: Include "elfcpp.h".
10922         (Target::do_calls_non_split): New function.
10923         (Target::match_view): New function.
10924         (Target::set_view_to_nop): New function.
10925         * gold.cc (queue_middle_tasks): Give an error if mixing
10926         split-stack and non-split-stack objects with -r.
10927         * i386.cc (Target_i386::relocate_section): Add
10928         reloc_symbol_changes parameter.
10929         (Target_i386::do_calls_non_split): New function.
10930         * x86_64.cc (Target_x86_64::relocate_section): Add
10931         reloc_symbol_changes parameter.
10932         (Target_x86_64::do_calls_non_split): New function.
10933         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
10934         parameter.
10935         * powerpc.cc (Target_powerpc::relocate_section): Add
10936         reloc_symbol_changes parameter.
10937         * sparc.cc (Target_sparc::relocate_section): Add
10938         reloc_symbol_changes parameter.
10939         * configure.ac: Call AM_CONDITIONAL for the default target.
10940         * configure: Rebuild.
10941         * testsuite/Makefile.am (TEST_AS): New variable.
10942         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
10943         (check_DATA): Add split_i386 and split_x86_64 files.
10944         (SPLIT_DEFSYMS): Define.
10945         (split_i386_[1234n].o): New targets.
10946         (split_i386_[124]): New targets.
10947         (split_i386_[1234r].stdout): New targets.
10948         (split_x86_64_[1234n].o): New targets.
10949         (split_x86_64_[124]): New targets.
10950         (split_x86_64_[1234r].stdout): New targets.
10951         (MOSTLYCLEANFILES): Add new executables.
10952         * testsuite/split_i386.sh: New file.
10953         * testsuite/split_x86_64.sh: New file.
10954         * testsuite/split_i386_1.s: New file.
10955         * testsuite/split_i386_2.s: New file.
10956         * testsuite/split_i386_3.s: New file.
10957         * testsuite/split_i386_4.s: New file.
10958         * testsuite/split_i386_n.s: New file.
10959         * testsuite/split_x86_64_1.s: New file.
10960         * testsuite/split_x86_64_2.s: New file.
10961         * testsuite/split_x86_64_3.s: New file.
10962         * testsuite/split_x86_64_4.s: New file.
10963         * testsuite/split_x86_64_n.s: New file.
10964         * testsuite/testfile.cc (Target_test): Update relocation_section
10965         function.
10966         * testsuite/Makefile.in: Rebuild.
10967
10968 2009-10-06  Ian Lance Taylor  <iant@google.com>
10969
10970         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
10971         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
10972         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
10973         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
10974         the address on ldo_addrs_.
10975         (Target_i386::Relocate::fix_up_ldo): New function.
10976
10977 2009-10-06   Rafael Espindola  <espindola@google.com>
10978
10979         * plugin.cc (add_input_library): New.
10980         (Plugin::load): Add add_input_library to tv.
10981         (Plugin_manager::add_input_file): Add the is_lib argument.
10982         (add_input_file): Update call to Plugin_manager::add_input_file.
10983         (add_input_library): New.
10984         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
10985
10986 2009-09-30  Doug Kwan  <dougkwan@google.com>
10987
10988         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
10989         symbol and call Symbol::may_need_copy_reloc to determine if
10990         a copy reloc is needed.
10991         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
10992         nocopyreloc is given in command line.
10993         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
10994         given in command line.
10995         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
10996         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
10997         of the removed Target_i386::may_need_copy_reloc.
10998         * options.h (copyreloc): New option with default value false.
10999         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11000         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11001         instead of the removed Target_powerpc::may_need_copy_reloc.
11002         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11003         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11004         instead of the removed Target_sparc::may_need_copy_reloc.
11005         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11006         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11007         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11008         instead of the removed Target_x86_64::may_need_copy_reloc.
11009
11010 2009-09-30  Ian Lance Taylor  <iant@google.com>
11011
11012         * object.h (class Object): Remove target_ field, and target,
11013         sized_target, and set_target methods.
11014         (Object::sized_target): Remove.
11015         (class Sized_relobj): Update declarations.  Remove sized_target.
11016         * object.cc (Sized_relobj::setup): Remove target parameter.
11017         Change all callers.
11018         (Input_objects::add_object): Don't do anything with the target.
11019         (make_elf_sized_object): Add punconfigured parameter.  Change all
11020         callers.  Set or test parameter target.
11021         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11022         Change all callers.
11023         * parameters.cc (Parameters::set_target): Change parameter type to
11024         be non-const.
11025         (Parameters::default_target): Remove.
11026         (set_parameters_target): Change parameter type to be non-const.
11027         (parameters_force_valid_target): New function.
11028         (parameters_clear_target): New function.
11029         * parameters.h (class Parameters): Update declarations.  Remove
11030         default_target method.  Add sized_target and clear_target
11031         methods.  Change target_ to be non-const.
11032         (set_parameters_target): Update declaration.
11033         (parameters_force_valid_target): Declare.
11034         (parameters_clear_target): Declare.
11035         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11036         as NULL if we aren't searching.
11037         (Add_symbols::run): Don't check for compatible target.
11038         * fileread.cc (Input_file::open_binary): Call
11039         parameters_force_valid_target.
11040         * gold.cc (queue_middle_tasks): Likewise.
11041         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11042         set_target on object.
11043         * dynobj.h (class Sized_dynobj): Update declarations.
11044         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11045         make_elf_object returns NULL.
11046         (Archive::include_member): Don't check whether object target is
11047         compatible.
11048         * output.cc (Output_section::add_input_section): Get target from
11049         parameters.
11050         (Output_section::relax_input_section): Likewise.
11051         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11052         parameters.
11053         (Sized_relobj::do_scan_relocs): Likewise.
11054         (Sized_relobj::relocate_sections): Likewise.
11055         * resolve.cc (Symbol_table::resolve): Likewise.
11056         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11057         parameter.  Change all callers.
11058         (Symbol_table::add_from_object): Get target from parameters.
11059         (Symbol_table::add_from_relobj): Don't check object target.
11060         (Symbol_table::add_from_dynobj): Likewise.
11061         (Symbol_table::define_special_symbol): Get target from
11062         parameters.
11063         * symtab.h (class Symbol_table): Update declaration.
11064         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11065         parameter.  Change all callers.  Clear parameter target.
11066         (Binary_test): Test target here.
11067         * testsuite/object_unittest.cc (gold_testsuite): Remove
11068         target_test_pointer parameter.  Change all callers.
11069         (Object_test): Test target here.
11070
11071 2009-09-26  Ian Lance Taylor  <iant@google.com>
11072
11073         * testsuite/initpri1.c: Don't try to use constructor priorities if
11074         compiling with gcc before 4.3.
11075
11076 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11077
11078         * testsuite/retain_symbols_file_test.sh (check_present): Change
11079         output file name to retain_symbols_file_test.stdout.
11080         (check_absent): Likewise.
11081
11082 2009-09-18  Craig Silverstein  <csilvers@google.com>
11083
11084         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11085         * options.cc: Include <cerrno> and <fstream>.
11086         (General_options::finalize): Parse -retain-symbols-file tag.
11087         * options.h: New flag.
11088         (General_options): New method should_retain_symbol, new
11089         variable symbols_to_retain.
11090         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11091         should_retain_symbol map.
11092         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11093         * testsuite/Makefile.in: Regenerate.
11094         * testsuite/retain_symbols_file_test.sh: New file.
11095
11096 2009-09-18  Nick Clifton  <nickc@redhat.com>
11097
11098         * po/es.po: Updated Spanish translation.
11099
11100 2009-09-17  Doug Kwan  <dougkwan@google.com>
11101
11102         * debug.h (DEBUG_RELAXATION): New constant.
11103         (DEBUG_ALL): Add DEBUG_RELAXATION.
11104         (debug_string_to_enum): Add relaxation debug option.
11105         * layout.cc
11106         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11107         Layout::Relaxation_debug_check::read_sections,
11108         Layout::Relaxation_debug_check::read_sections): New method definitions.
11109         (Layout::Layout): Initialize data members
11110         record_output_section_data_from_scrips_,
11111         script_output_section_data_list_ and relaxation_debug_check_.
11112         (Layout::save_segments, Layout::restore_segments,
11113         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11114         Layout::relaxation_loop_body): New method definitions.
11115         (Layout::finalize): Support relaxation.  Move section layout code to
11116         Layout::relaxation_loop_body.
11117         (Layout::set_asection_address_from_script): Move code for orphan
11118         section placement out.
11119         (Layout::place_orphan_sections_in_script): New method definition.
11120         * layout.h (Output_segment_headers, Output_file_header):
11121         New forward class declarations.
11122         (Layout::~Layout): Define.
11123         (Layout::new_output_section_data_from_script): New method definition.
11124         (Layout::place_orphan_sections_in_script): New method declaration.
11125         (Layout::Segment_states): New type declaration.
11126         (Layout::save_segments, Layout::restore_segments,
11127         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11128         Layout::relaxation_loop_body): New method declarations.
11129         (Layout::Output_section_data_list): New type declaration.
11130         (Layout::Relaxation_debug_check): New class definition.
11131         (Layout::record_output_section_data_from_script_,
11132         Layout::script_output_section_data_list_, Layout::segment_states_,
11133         Layout::relaxation_debug_check_): New data members.
11134         * output.cc: (Output_section_headers::do_size): New method definition.
11135         (Output_section_headers::Output_section_headers): Move size
11136         computation to Output_section_headers::do_size.
11137         (Output_segment_headers::do_size): New method definition.
11138         (Output_file_header::Output_file_header): Move size computation to
11139         Output_file_header::do_size and call it.
11140         (Output_file_header::do_size): New method definition.
11141         (Output_data_group::Output_data_group): Adjust call to
11142         Output_section_data.
11143         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11144         (Output_symtab_xindex::do_write): Add array bound check.
11145         (Output_section::Input_section::print_to_mapfile): Handle
11146         RELAXED_INPUT_SECTION_CODE.
11147         (Output_section::Output_section): Initialize data member checkpoint_.
11148         (Output_section::~Output_section): Delete checkpoint object pointed
11149         by checkpoint_.
11150         (Output_section::add_input_section): Always add an Input_section if
11151         relaxing.
11152         (Output_section::add_merge_input_section): Add assert.
11153         (Output_section::relax_input_section): New method definition.
11154         (Output_section::set_final_data_size): Set load address to zero for
11155         an unallocated section.
11156         (Output_section::do_address_and_file_offset_have_reset_values):
11157         New method definition.
11158         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11159         Handle relaxed input section.
11160         (Output_section::sort_attached_input_sections): Checkpoint input
11161         section list lazily.
11162         (Output_section::get_input_sections): Change type of input_sections to
11163         list of Simple_input_section pointers.  Checkpoint input section list
11164         lazily.  Also handle relaxed input sections.
11165         (Output_section::add_input_section_for_script): Take a reference to
11166         a Simple_input_section object instead of Relobj pointer and section
11167         index as parameter.  Handle relaxed input sections.
11168         (Output_section::save_states, Output_section::restore_states): New
11169         method definitions.
11170         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11171         (Output_data::is_data_size_fixed): New method definition.
11172         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11173         if it is fixed.
11174         (Output_data::address_and_file_offset_have_reset_values): New method
11175         definition.
11176         (Output_data::do_address_and_file_offset_have_reset_values): New method
11177         definition.
11178         (Output_data::set_data_size): Check that data size is not fixed.
11179         (Output_data::fix_data_size): New method definition.
11180         (Output_data::is_data_size_fixed_): New data member.
11181         (Output_section_headers::set_final_data_size): New method definition.
11182         (Output_section_headers::do_size): New method declaration.
11183         (Output_segment_headers::set_final_data_size): New method definition.
11184         (Output_segment_headers::do_size): New method declaration.
11185         (Output_file_header::set_final_data_size)::New method definition.
11186         (Output_file_header::do_size)::New method declaration.
11187         (Output_section_data::Output_section_data): Add new parameter
11188         is_data_size_fixed and use it to fix data size.
11189         (Output_data_const::Output_data_const): Adjust call to base class
11190         constructor and fix data size.
11191         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11192         base class constructor and fix data size.
11193         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11194         base class constructor and fix data size.
11195         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11196         class constructor and fix data size.
11197         (Output_data_group::set_final_data_size): New method definition.
11198         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11199         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11200         class constructor and fix data size.
11201         (Output_relaxed_input_section): New class definition.
11202         (Output_section::Simple_input_section): New class definition.
11203         (Output_section::get_input_sections): Adjust parameter list.
11204         (Output_section::add_input_section_for_script): Same.
11205         (Output_section::save_states, Output_section::restore_states,
11206         Output_section::do_address_and_file_offset_have_reset_values,
11207         (Output_section::Input_section::Input_section): Handle
11208         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11209         Output_relaxed_input_section.
11210         (Output_section::Input_section::is_input_section,
11211         Output_section::Input_section::set_output_section): Handle relaxed
11212         input section.
11213         (Output_section::Input_section::is_relaxed_input_section,
11214         Output_section::Input_section::output_section_data,
11215         Output_section::Input_section::relaxed_input_section): New method
11216         definitions.
11217         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11218         value.
11219         (Output_section::Input_section::u1_): Update comments.
11220         (Output_section::Input_section::u2_): Add new union member poris.
11221         (Output_section::Checkpoint_output_section): New classs definition.
11222         (Output_section::relax_input_section): New method declaration.
11223         (Output_section::checkpoint_): New data member.
11224         (Output_segment): Update comments.
11225         (Output_segment::Output_segment): Un-privatize copy constructor.
11226         (Output_segment::operator=): Un-privatize.
11227         * script-sections.cc (Output_section_element::Input_section_list):
11228         Change element type to Output_section::Simple_input_section.
11229         (Output_section_element_dot_assignment::set_section_addresses):
11230         Register output section data for relaxation clean up.
11231         (Output_data_exression::Output_data_expression): Adjust call to base
11232         constructor to fix data size.
11233         (Output_section_element_data::set_section_addresses): Register
11234         Output_data_expression object for relaxation clean up.
11235         (struct Input_section_info): Replace Relobj pointer and section index
11236         pair with Output_section::Simple_input_section and Convert struct to a
11237         class.
11238         (Input_section_sorter::operator()): Adjust access to
11239         Input_section_info data member to use accessors.
11240         (Output_section_element_input::set_section_addresses): Use layout
11241         parameter.  Adjust code to use Output_section::Simple_input_section
11242         and Input_secction_info classes.  Register filler for relaxation
11243         clean up.
11244         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11245         and section index pair with Output_section::Simple_input_section
11246         class.  Adjust code accordingly.
11247         (Phdrs_element::release_segment): New method definition.
11248         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11249         segment list.
11250         (Script_sections::release_segments): New method definition.
11251         * gold/script-sections.h (Script_sections::release_segments): New
11252         method declaration.
11253         * gold/target.h (Target::may_relax, Target::relax,
11254         Target::do_may_relax, Target::do_relax): New method definitions.
11255
11256 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11257
11258         * arm.cc (has_signed_unsigned_overflow): New function.
11259         (Arm_relocate_functions::abs8): New function.
11260         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11261         (Target_arm::Scan::global): Likewise.
11262         (Target_arm::relocate::relocate): Likewise.
11263         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11264         Likewise.
11265
11266 2009-09-16  Cary Coutant  <ccoutant@google.com>
11267
11268         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11269         * testsuite/Makefile.in: Regenerate.
11270
11271 2009-09-11  Nick Clifton  <nickc@redhat.com>
11272
11273         * po/gold.pot: Updated by the Translation project.
11274
11275 2009-09-08  Cary Coutant  <ccoutant@google.com>
11276
11277         * output.cc (Output_file::open): Add execute permission to empty file.
11278         * testsuite/Makefile.am (permission_test): New test.
11279         * testsuite/Makefile.in: Regenerate.
11280
11281 2009-09-02  Ian Lance Taylor  <iant@google.com>
11282
11283         * output.cc (Output_file::resize): Call map_no_anonymous rather
11284         than map.
11285
11286 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11287
11288         * gold.cc: Include "incremental.h".
11289         (queue_initial_tasks): Call Incremental_checker methods.
11290         * incremental.cc: Include "output.h".
11291         (Incremental_checker::can_incrementally_link_output_file): New
11292         method.
11293         * incremental.h (Incremental_checker): New class.
11294
11295         * output.cc (Output_file::open_for_modification): New method.
11296         (Output_file::map_anonymous): Changed return type to bool.  Record
11297         map in base_ field.
11298         (Output_file::map_no_anonymous): New method, broken out of map.
11299         (Output_file::map): Use map_no_anonymous and map_anonymous.
11300         * output.h (class Output_file): Update declarations.
11301
11302 2009-08-24  Cary Coutant  <ccoutant@google.com>
11303
11304         * options.h (Command_line::Pre_options): New class.
11305         (Command_line::pre_options): New member.
11306         * options.cc (gold::options::ready_to_register): New variable.
11307         (One_option::register_option): Do nothing if not registering options.
11308         Assert if same short option registered twice.
11309         (General_options::General_options): Turn off option registration when
11310         done constructing.
11311         (Command_line::Pre_options::Pre_options): New constructor.
11312
11313 2009-08-24  Cary Coutant  <ccoutant@google.com>
11314
11315         * options.h (General_options::no_keep_memory): Remove incorrect
11316         short option.
11317
11318 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11319
11320         * Makefile.am (am__skiplex, am__skipyacc): New.
11321         * Makefile.in: Regenerate.
11322
11323 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11324
11325         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11326         (INCLUDES): ... this.
11327         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11328         (AM_CPPFLAGS): Renamed from ...
11329         (INCLUDE): ... this.
11330         * Makefile.in, testsuite/Makefile.in: Regenerate.
11331
11332         * Makefile.in: Regenerate.
11333         * aclocal.m4: Likewise.
11334         * config.in: Likewise.
11335         * configure: Likewise.
11336         * testsuite/Makefile.in: Likewise.
11337
11338         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11339         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11340         * Makefile.in: Regenerate.
11341         * testsuite/Makefile.in: Regenerate.
11342
11343 2009-08-19  Cary Coutant  <ccoutant@google.com>
11344
11345         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11346         symbols in shared libraries overridden by hidden or internal symbols
11347         in the main program.
11348
11349 2009-08-19  Chris Demetriou  <cgd@google.com>
11350
11351         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11352         checking source file names in error messages.
11353
11354 2009-08-18  Doug Kwan  <dougkwan@google.com>
11355
11356         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11357         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11358         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11359         an elfcpp::Ehdr as parameter.
11360         * object.cc (Object::set_target): Remove the version that looks up
11361         a target and sets it.
11362         (Sized_relobj::setup): Take a Target object instead of
11363         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11364         (make_elf_sized_object): Find target and ask target to
11365         make an ELF object.
11366         * object.h: (Object::set_target): Remove the version that looks up
11367         a target and sets it.
11368         (Sized_relobj::setup): Take a Target object instead of
11369         an elfcpp:Ehdr as parameter.
11370         * target.cc: Include dynobj.h.
11371         (Target::do_make_elf_object_implementation): New.
11372         (Target::do_make_elf_object): New.
11373         * target.h (Target::make_elf_object): New template declaration.
11374         (Target::do_make_elf_object): New method declarations.
11375         (Target::do_make_elf_object_implementation): New template declaration.
11376
11377 2009-08-14  Ian Lance Taylor  <iant@google.com>
11378
11379         * gold.h (FUNCTION_NAME): Define.
11380         (gold_unreachable): Use FUNCTION_NAME.
11381
11382 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11383
11384         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11385         symbol in the --keep-unique list is not found.
11386
11387 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11388
11389         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11390         been maked as --keep-unique.
11391         (Icf::unfold_section): New function.
11392         * icf.h (Icf::unfold_section): New function.
11393         * options.h (General_options::keep_unique): New option.
11394         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11395         * testsuite/Makefile.in: Regenerate.
11396         * testsuite/icf_keep_unique_test.sh: New file.
11397         * testsuite/icf_keep_unique_test.cc: New file.
11398
11399 2009-08-12  Cary Coutant  <ccoutant@google.com>
11400
11401         PR 10471
11402         * resolve.cc (Symbol_table::resolve): Check for references from
11403         dynamic objects to hidden and internal symbols.
11404         * testsuite/Makefile.am (hidden_test.sh): New test.
11405         * testsuite/Makefile.in: Regenerate.
11406         * testsuite/hidden_test.sh: New script.
11407         * testsuite/hidden_test_1.c: New test source.
11408         * testsuite/hidden_test_main.c: New test source.
11409
11410 2009-08-11  Doug Kwan  <dougkwan@google.com>
11411
11412         * arm.cc: Update comments.
11413         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11414         segment to locate the .ARM.exidx section if present.
11415
11416 2009-08-09  Doug Kwan  <dougkwan@google.com>
11417
11418         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11419         patch.
11420
11421 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11422         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11423         compiler warnings.
11424
11425 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11426
11427         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11428         valid tls_segment only for non-debug-section relocations.
11429         * testsuite/Makefile.am: Add gc_tls_test.
11430         * testsuite/Makefile.in: Regenerate.
11431         * testsuite/gc_tls_test.cc: New file.
11432         * testsuite/gc_tls_test.sh: New file.
11433
11434 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11435
11436         * icf.cc: New file.
11437         * icf.h: New file.
11438         * Makefile.am (CCFILES): Add icf.cc.
11439         (HFILES): Add icf.h
11440         * Makefile.in: Regenerate.
11441         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11442         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11443         section, symbol and addend information for the relocs.
11444         * gold.cc (queue_middle_tasks): Call identical code folding.
11445         * gold.h: Add defines for multimap.
11446         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11447         to the call of finalize_local_symbols.
11448         * main.cc (main): Create object of class Icf.
11449         * object.cc (Sized_relobj::do_layout): Allow this function to be
11450         called twice during icf.
11451         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11452         to sections marked as identical by icf.
11453         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11454         when available.
11455         (Sized_relobj::do_section_entsize): New function.
11456         * object.h (Object::section_entsize): New function.
11457         (Object::do_section_entsize): New pure virtual function.
11458         (Relobj::finalize_local_symbols): Add new parameter.
11459         (Relobj::do_section_entsize): New function.
11460         * options.h (General_options::icf): New option.
11461         (General_options::icf_iterations): New option.
11462         (General_options::print_icf_sections): New option.
11463         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11464         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11465         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11466         icf.
11467         * symtab.cc (Symbol_table::is_section_folded): New function.
11468         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11469         to sections marked as identical by icf.
11470         * symtab.h (Symbol_table::set_icf): New function.
11471         (Symbol_table::icf): New function.
11472         (Symbol_table::is_section_folded): New function.
11473         (Symbol_table::icf_): New data member.
11474         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11475         * testsuite/Makefile.am: Add commands to build icf_test.
11476         * testsuite/Makefile.in: Regenerate.
11477         * testsuite/icf_test.sh: New file.
11478         * testsuite/icf_test.cc: New file.
11479
11480 2009-07-24  Chris Demetriou  <cgd@google.com>
11481
11482         * layout.cc (is_compressible_debug_section): Fix incorrect
11483         comment about compressed section names.
11484
11485 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11486
11487         PR 10419
11488         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11489
11490 2009-07-16  Ian Lance Taylor  <iant@google.com>
11491
11492         PR 10400
11493         * layout.h: #include <map>.
11494         (class Kept_section): Change from struct to class.  Add accessors
11495         and setters.  Add section size to Comdat_group mapping.  Change
11496         Comdat_group to std::map.  Add is_comdat_ field.  Add
11497         linkonce_size field in union.
11498         (class Layout): Update declaration of find_or_add_kept_section.
11499         Don't declare find_kept_object.
11500         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11501         parameter.  Add object, shndx, is_comdat, and is_group_name
11502         parameters.  Change all callers.  Adjust for new Kept_section.
11503         (Layout::find_kept_object): Remove.
11504         * object.cc (Sized_relobj::include_section_group): Update use of
11505         Kept_section.  Rename secnum to shndx.  Only record
11506         Kept_comdat_section if sections are the same size.
11507         (Sized_relobj::include_linkonce_section): Update use of
11508         Kept_section.  Only record Kept_comdat_section if sections are the
11509         same size.  Set size of linkonce section.
11510         (Sized_relobj::map_to_kept_section): Update call to
11511         get_kept_comdat_section.
11512         * object.h (class Sized_relobj): Rename fields in
11513         Kept_comdat_section to drop trailing underscores; change object
11514         field to Relobj*.  Change Kept_comdat_section_table to store
11515         struct rather than pointer.
11516         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11517         Add kept_object and kept_shndx parameters.  Change all callers.
11518         (Sized_relobj::get_kept_comdat_section): Change return type to
11519         bool.  Add kept_object and kept_shndx parameters.  Change all
11520         callers.
11521         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11522         Layout::find_or_add_kept_section.
11523
11524 2009-07-09  Ian Lance Taylor  <iant@google.com>
11525
11526         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11527         Reserve space in the hash table.
11528
11529 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11530
11531         * fileread.cc (File_read::get_mtime): New method.
11532         * fileread.h (Timespec): New structure.
11533         (File_read::get_mtime): New method.
11534         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11535         Renamed from timestamp_nsec.
11536         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11537         Elf_Xword.
11538         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11539         timestamp_nsec.
11540         (Incremental_inputs::report_archive): Save mtime; style fix.
11541         (Incremental_inputs::report_obejct): Save mtime; style fix.
11542         (Incremental_inputs::report_script): Save mtime; style fix.
11543         (Incremental_inputs::finalize_inputs): Style fix.
11544         (Incremental_inputs::finalize): Style fix.
11545         (Incremental_inputs::create_input_section_data): Store inputs
11546         mtime.
11547         * incremental.h (Incremental_inputs::report_script): Add mtime
11548         argument.
11549         (Incremental_inputs::Input_info::Input_info): Intialize only one
11550         union member.
11551         (Incremental_inputs::Input_info::archive): Move to nameless
11552         union.
11553         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11554         (Incremental_inputs::Input_info::script): Move to nameless union.
11555         (Incremental_inputs::mtime): New field.
11556         * script.cc (read_input_script): Pass file mtime to
11557         Incremental_input.
11558         * script.h (Script_info::inputs): Style fix.
11559
11560 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11561
11562         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11563         instead of 32.
11564
11565 2009-06-24  Ian Lance Taylor  <iant@google.com>
11566
11567         PR 10156
11568         * layout.cc (Layout::choose_output_section): If we find an
11569         existing section, update the flags.
11570         (Layout::create_notes): New function, broken out of
11571         Layout::finalize.
11572         (Layout::finalize): Don't create note sections.
11573         (Layout::create_note): Don't crash if linker script discards
11574         section.
11575         (Layout::create_gold_note): Likewise.
11576         (Layout::create_build_id): Likewise.  Don't set
11577         after_input_sections on the section.
11578         (Layout::create_executable_stack_info): Remove target parameter.
11579         Change caller.
11580         * layout.h (class Layout): Declare create_notes.  Update
11581         declaration of create_executable_stack_info.
11582         * gold.cc (queue_middle_tasks): Call create_notes.
11583         * output.cc (Output_section::update_flags_for_input_section): Move
11584         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11585         invalid.
11586         * output.h (Output_data::mark_address_invalid): New function.
11587         (class Output_section): Only declare, not define,
11588         update_flags_for_input_section.  Remove set_flags.
11589
11590 2009-06-24  Ian Lance Taylor  <iant@google.com>
11591
11592         * script-sections.cc (Output_section_definition::
11593         set_section_addresses): Rename shadowing local load_address to
11594         laddr.
11595
11596 2009-06-24  Ian Lance Taylor  <iant@google.com>
11597
11598         PR 10244
11599         * reloc.cc (relocate_sections): Skip empty relocation sections.
11600
11601 2009-06-23  Ian Lance Taylor  <iant@google.com>
11602
11603         PR 10156
11604         * layout.cc (Layout::create_note): Use choose_output_section
11605         rather than make_output_section.
11606
11607 2009-06-23  Ian Lance Taylor  <iant@google.com>
11608
11609         PR 10237
11610         * options.cc (General_options::parse_V): Set printed_version_.
11611         (General_options::General_options): Initialize printed_version_.
11612         * options.h (class General_options): Add printed_version_ field.
11613         * gold.cc (queue_initial_tasks): If there are no input files,
11614         don't give a fatal error if we printed the version information.
11615         (queue_middle_tasks): If using -r with a shared object, give a
11616         fatal error rather than an ordinary error.
11617
11618 2009-06-23  Ian Lance Taylor  <iant@google.com>
11619
11620         PR 10219
11621         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11622         (Layout::make_output_section): Set have_stabstr_section_ if we see
11623         a .stab*str section.
11624         (Layout::finalize): Call link_stabs_sections.
11625         (Layout::link_stabs_sections): New file.
11626         * layout.h (class Layout): Add have_stabstr_section_ field.
11627         Declare link_stabs_sections.
11628
11629 2009-06-23  Doug Kwan  <dougkwan@google.com>
11630
11631         * Makefile.am (libgold_a_LIBADD): New.
11632         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11633         * Makefile.in: Regenerate.
11634         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11635         * configure: Regenerate.
11636         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11637         * fileread.cc: Include sys/state.h
11638         * gold.h: Declare memmem and strndup if found missing.
11639         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11640
11641 2009-06-23  Ian Lance Taylor  <iant@google.com>
11642
11643         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11644         * configure: Rebuild.
11645
11646 2009-06-23  Ian Lance Taylor  <iant@google.com>
11647
11648         PR 10147
11649         * object.cc (Object::section_contents): Don't try to get a view if
11650         the section has length zero.
11651         (Object::handle_gnu_warning_section): If the section is empty, use
11652         the name of the section as the warning.
11653
11654 2009-06-23  Ian Lance Taylor  <iant@google.com>
11655
11656         PR 10133
11657         * stringpool.h (class Stringpool_template): Add optimize_ field.
11658         (Stringpool_template::set_optimize): New function.
11659         * stringpool.cc (Stringpool_template::Stringpool_template):
11660         Initialize optimize_ field.
11661         (Stringpool_template::set_string_offsets): Test local optimize
11662         fild rather than parameter.
11663         * layout.cc (Layout::Layout): Call set_optimize on the section
11664         name stringpool.
11665
11666 2009-06-22  Ian Lance Taylor  <iant@google.com>
11667
11668         PR 10030
11669         * yyscript.y: Parse TARGET.
11670         * script.cc (script_set_target): New function.
11671         * script-c.h (script_set_target): Declare.
11672         * options.cc (General_options::string_to_object_format): Rename
11673         from string_to_object_format in anonymous namespace.  Change
11674         callers.
11675         * options.h (class General_options): Declare
11676         string_to_object_format.
11677
11678 2009-06-22  Ian Lance Taylor  <iant@google.com>
11679
11680         * script-sections.cc (Script_sections::create_segments): Don't put
11681         program headers in a PT_LOAD segment if -n or -N.
11682
11683 2009-06-22  Ian Lance Taylor  <iant@google.com>
11684
11685         PR 10141
11686         * options.h (class General_options): Add -z lazy and -z now.  Sort
11687         -z options into alphabetical order.
11688         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11689
11690 2009-06-21  Ian Lance Taylor  <iant@google.com>
11691
11692         * layout.cc (Layout::make_output_section): Call
11693         Target::new_output_section.
11694         (Layout::attach_allocated_section_to_segment): Put large section
11695         sections in a separate load segment with the large segment flag
11696         set.
11697         (Layout::segment_precedes): Sort large data segments after other
11698         load segments.
11699         (align_file_offset): New static function.
11700         (Layout::set_segment_offsets): Use align_file_offset.
11701         * output.h (class Output_section): Add is_small_section_ and
11702         is_large_section_ fields.
11703         (Output_section::is_small_section): New function.
11704         (Output_section::set_is_small_section):  New function.
11705         (Output_section::is_large_section): New function.
11706         (Output_section::set_is_large_section): New function.
11707         (Output_section::is_large_data_section): New function.
11708         (class Output_segment): Add is_large_data_segment_ field.
11709         (Output_segment::is_large_data_segment): New function.
11710         (Output_segment::set_is_large_data_segment): New function.
11711         * output.cc (Output_section::Output_section): Initialize new
11712         fields.
11713         (Output_segment::Output_segment): Likewise.
11714         (Output_segment::add_output_section): Add assertion that large
11715         data sections always go in large data segments.  Force small data
11716         sections to the end of the list of data sections.  Force small BSS
11717         sections to the start of the list of BSS sections.  For large BSS
11718         sections to the end of the list of BSS sections.
11719         * symtab.h (class Symbol): Declare is_common_shndx.
11720         (Symbol::is_defined): Check Symbol::is_common_shndx.
11721         (Symbol::is_common): Likewise.
11722         (class Symbol_table): Define enum Commons_section_type.  Update
11723         declarations.  Add small_commons_ and large_commons_ fields.
11724         * symtab.cc (Symbol::is_common_shndx): New function.
11725         (Symbol_table::Symbol_table): Initialize new fields.
11726         (Symbol_table::add_from_object): Put small and large common
11727         symbols in the right list.
11728         (Symbol_table::sized_finalized_symbol): Check
11729         Symbol::is_common_shndx.
11730         (Symbol_table::sized_write_globals): Likewise.
11731         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11732         common symbol lists.  Don't call do_allocate_commons_list if the
11733         list is empty.
11734         (Symbol_table::do_allocate_commons_list): Remove is_tls
11735         parameter.  Add comons_section_type parameter.  Change all
11736         callers.  Handle small and large common symbols.
11737         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11738         Symbol::is_common_shndx.
11739         * resolve.cc (symbol_to_bits): Likewise.
11740         * target.h (Target::small_common_shndx): New function.
11741         (Target::small_common_section_flags): New function.
11742         (Target::large_common_shndx): New function.
11743         (Target::large_common_section_flags): New function.
11744         (Target::new_output_section): New function.
11745         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11746         small_common_section_flags, and large_common_section_flags
11747         fields.
11748         (Target::do_new_output_section): New virtual function.
11749         * arm.cc (Target_arm::arm_info): Initialize new fields.
11750         * i386.cc (Target_i386::i386_info): Likewise.
11751         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11752         Likewise.
11753         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11754         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11755         (Target_x86_64::do_new_output_section): New function.
11756         * configure.ac: Define conditional MCMODEL_MEDIUM.
11757         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11758         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11759         (large_LDFLAGS): Define.
11760         * testsuite/large.c: New file.
11761         * testsuite/testfile.cc (Target_test::test_target_info):
11762         Initialize new fields.
11763         * configure, testsuite/Makefile.in: Rebuild.
11764
11765 2009-06-05  Doug Kwan  <dougkwan@google.com>
11766
11767         * Makefile.am (CCFILES): Add target.cc.
11768         * Makefile.in: Regenerate.
11769         * i386.cc (class Target_i386): Define new virtual method to
11770         override do_is_local_label_name in parent.
11771         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11772         local symbols if --discard-locals or -X is given.
11773         * options.h (class General_options): Declare new options
11774         '--discard-locals' and '-X' for discarding locals.
11775         * target.h (class Target): Define new methods is_local_label_name.
11776         Declare new virtual method do_is_local_label_name.
11777         * target.cc: New file.
11778         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11779         (check_SCRIPTS): Add discard_locals_test.sh.
11780         (check_DATA): Add discard_local_tests.syms.
11781         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11782         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11783         * testsuite/Makefile.in: Regenerate.
11784         * testsuite/discard_locals_test.c: New file.
11785         * testsuite/discard_locals_test.sh: Same.
11786
11787 2009-06-05  Doug Kwan  <dougkwan@google.com>
11788
11789         * object.cc (Sized_relobj::Sized_relobj): Initialize
11790         discarded_eh_frame_shndx_ to -1U.
11791         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11792         section.
11793         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11794         a discarded .eh_frame section.
11795         (Sized_relobj::do_finalize_local_symbols): Ditto.
11796         * object.h (class Sized_relobj): Declare new member
11797         discarded_eh_frame_shndx_.
11798         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11799         (local_labels_test.o, local_labels_test): New rules.
11800         * testsuite/Makefile.in: Regenerate.
11801
11802 2009-06-04  Doug Kwan  <dougkwan@google.com>
11803
11804         * layout.cc (Layout::section_name_mapping): Add mapping for
11805         special ARM sections.
11806
11807 2009-06-03  Doug Kwan  <dougkwan@google.com>
11808
11809         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11810         (utils::has_overflow): Same.
11811
11812 2009-06-03  Ian Lance Taylor  <iant@google.com>
11813
11814         * layout.cc (Layout::section_name_mapping): New array, replacing
11815         Layout::linkonce_mapping.
11816         (Layout::section_name_mapping_count): New variable, replacing
11817         Layout::linkonce_mapping_count.
11818         (Layout::linkonce_output_name): Remove.
11819         (Layout::output_section_name): Rewrite.
11820         * layout.h (class Layout): Rename Linkonce_mapping to
11821         Section_name_mapping, linkonce_mapping to section_name_mapping,
11822         linkonce_mapping_count to section_name_mapping_count.  Don't
11823         declare linkonce_output_name.
11824
11825 2009-06-03  Doug Kwan  <dougkwan@google.com>
11826
11827         * gold/arm.cc (namespace utils): New.
11828         (Target_arm::reloc_is_non_pic): Define new method.
11829         (class Arm_relocate_functions): New.
11830         (Target_arm::Relocate::relocate): Handle relocation types used by
11831         Android.
11832
11833 2009-06-03  Ian Lance Taylor  <iant@google.com>
11834
11835         * arm.cc (Target_arm::scan::global): Use || instead of |.
11836
11837 2009-06-02  Doug Kwan  <dougkwan@google.com>
11838
11839         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11840         issued_non_pic_error_.
11841         (class Target_arm::Scan): Declare new method check_non_pic.
11842         Define new method symbol_needs_plt_entry.
11843         Declare new data member issued_non_pic_error_.
11844         (class Target_arm::Relocate): Declare new method
11845         should_apply_static_reloc.
11846         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11847         (Target_arm::Scan::check_non_pic): Define new method.
11848         (Target_arm::Scan::local): Handle a small subset of reloc types used
11849         by Android.
11850         (Target_arm::Scan::local): Same.
11851         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11852
11853 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11854
11855         * incremental.cc (Incremental_inputs::report_command_line): Filter
11856         out --incremental-* options.
11857
11858 2009-05-29  Doug Kwan  <dougkwan@google.com>
11859
11860         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11861         template class.
11862         (class Target_arm): Update comment.
11863         (Target_arm::Target_arm): Initialize new data members GOT_,
11864         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11865         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11866         and Target_arm::rel_dyn_section.
11867         Declare new_enum Target_arm::Got_type.
11868         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11869         and DYNBSS_.
11870         Update commments for member do_dynsym_value.
11871         (Target_arm::got_size, Target_arm::plt_section,
11872         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11873         new methods inside class defintion.
11874         (Target_arm::got_section): Define new method.
11875         (Target_arm::rel_dyn_section): Same.
11876         (Output_data_plt_arm): New template class.
11877         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11878         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11879         (Output_data_plt_arm::add_entry): Same.
11880         (Output_data_plt_arm::first_plt_entry): Define new
11881         static data member for PLT instruction template.
11882         (Output_data_plt_arm::plt_entry): Same.
11883         (Output_data_plt_arm::do_write): Define new method.
11884         (Target_arm::make_plt_entry): Same.
11885         (Target_arm::do_finalize_sections): Same.
11886         (Target_arm::do_dynsym_value): Same.
11887
11888 2009-05-28  Doug Kwan  <dougkwan@google.com>
11889
11890         * Makefile.am (TARGETSOURCES): Add arm.cc.
11891         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
11892         * Makefile.in: Regenerate.
11893         * arm.cc: New file.
11894         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
11895
11896 2009-05-26  Doug Kwan  <dougkwan@google.com>
11897
11898         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
11899         (General_options::check_excluded_libs): Strip off directories in
11900         archive name before matching like GNU ld does.
11901         * testsuite/Makefile.am (MOSTLYCLEANFILES,
11902         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
11903         (exclude_libs_test_LDFLAGS): Add linker option
11904         -Wl,--exclude-libs,libexclude_libs_test_3
11905         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
11906         an explicit archive without using -l.
11907         (alt/libexclude_libs_test_3.a): New make rule.
11908         * testsuite/Makefile.in: Regenerate.
11909         * testsuite/exclude_libs_test.c : Declare lib3_default().
11910         (main): Call it.
11911         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
11912         * exclude_libs_test_3.c: New file.
11913
11914 2009-05-26  Nick Clifton  <nickc@redhat.com>
11915
11916         * po/id.po: New Indonesian translation.
11917         * po/gold.pot: Updated template file.
11918
11919 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
11920
11921         * testsuite/Makefile.am: Add -ffunction-sections to compile
11922         gc_comdat_test files.  Add -Wl,--gc-sections to build
11923         gc_comdat_test.
11924         * testsuite/Makefile.in: Regenerate.
11925         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
11926
11927 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
11928
11929         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
11930         kept comdat section was garbage collected.
11931         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
11932         * testsuite/Makefile.in: Regenerate.
11933         * testsuite/gc_comdat_test.sh: New file.
11934         * testsuite/gc_comdat_test_1.cc: New file.
11935         * testsuite/gc_comdat_test_2.cc: New file.
11936
11937 2009-05-19  Doug Kwan  <dougkwan@google.com>
11938
11939         * archive.cc (Archive::Archive): Move constructor from archive.h
11940         to here.  Initialize no_export_.
11941         (Archive::get_elf_object_for_member): Set no_export flag of object.
11942         * archive.h (Archive::Archive): Move constructor body to
11943         archive.cc.
11944         (Archive::no_export): New method.
11945         (Archive::no_export_): New field.
11946         * object.h (Object::Object): Initialize no_export_ to false.
11947         (Object::no_export, Object::set_no_export): New methods.
11948         (Object::no_export_): New field.
11949         * options.cc (General_options::parse_exclude_libs): New method.
11950         (General_options::check_excluded_libs) Same.
11951         * options.h (exclude_libs): New option.
11952         (General_options::check_excluded_libs): New method declaration.
11953         (General_options::excluded_libs_): New field.
11954         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
11955         default or protected visibility if an object has no-export flag set.
11956         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
11957         (check_SCRIPTS): Add exclude_libs_test.sh.
11958         (check_DATA): Add exclude_libs_test.syms.
11959         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
11960         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
11961         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
11962         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
11963         (exclude_libs_test.syms, libexclude_libs_test_1.a,
11964         libexclude_libs_test_2.a): New rules.
11965         * testsuite/Makefile.in: Regenerate.
11966         * testsuite/exclude_libs_test.c: New file.
11967         * testsuite/exclude_libs_test.sh: Ditto.
11968         * testsuite/exclude_libs_test_1.c: Ditto.
11969         * testsuite/exclude_libs_test_2.c: Ditto.
11970
11971 2009-05-15  Ian Lance Taylor  <iant@google.com>
11972
11973         * configure.ac: Check for declarations for cases where libiberty.h
11974         checks HAVE_DECL_xxx.
11975         * configure, config.in: Rebuild.
11976
11977 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
11978
11979         * gold.h (Incremental_argument_list): Remove (invalid) forward
11980         declaration.
11981         * incremental.cc (Incremental_inputs::report_achive): New method.
11982         (Incremental_inputs::report_object): New method.
11983         (Incremental_inputs::report_script): New method.
11984         (Incremental_inputs::finalize_inputs): New method.
11985         (Incremental_inputs::finalize): Call finalize_inputs().
11986         (Incremental_inputs::sized_create_incremental_inputs_section_data):
11987         Create inputs entries.
11988         * incremental.h (Incremental_input_type): New enum.
11989         (Incremental_inputs::Incremental_input): Initialize new fields.
11990         (Incremental_inputs::report_inputs): New method.
11991         (Incremental_inputs::report_achive): New method.
11992         (Incremental_inputs::report_object): New method.
11993         (Incremental_inputs::report_script): New method.
11994         (Incremental_inputs::finalize_inputs): New method.
11995         (Incremental_inputs::Input_info): New struct.
11996         (Incremental_inputs::Input_info_map): New typedef.
11997         (Incremental_inputs::lock_): New field.
11998         (Incremental_inputs::Inputs_): New field.
11999         (Incremental_inputs::Inputs_map): New field.
12000         * main.cc (main): Call Incremental_input::report_inputs.
12001         * options.h (Input_argument_list): Typedef moved from
12002         Input_arguments.
12003         (Input_file_group::Files): Remove, use ::Input_argument_list.
12004         (Input_file_group::Input_argument_list): Remove, use
12005         ::Input_argument_list.
12006         * plugin.cc (Plugin_manager::add_input_file): Add error in
12007         incremental build.
12008         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12009         functions.
12010         * script.cc (read_input_script): Call
12011         Incremental_input::report_script.
12012         * script.h (Script_info): New class.
12013
12014 2009-04-27  Ian Lance Taylor  <iant@google.com>
12015
12016         * x86_64.cc (do_adjust_output_section): Set entsize to
12017         plt_entry_size.
12018
12019 2009-04-23  Elliott Hughes  <enh@google.com>
12020
12021         * output.cc (Output_file::close): After short writes, continue
12022         writing from the correct offset in the buffer being written.
12023
12024 2009-04-23  Chris Demetriou  <cgd@google.com>
12025
12026         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12027         * configure: Regenerate.
12028         * config.in: Regenerate.
12029         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12030         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12031
12032 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12033
12034         * incremental.cc (Incremental_inputs_header_data): Renamed from
12035         Incremental_input_header_data.
12036         (Incremental_inputs_header_data::data_size): New field.
12037         (Incremental_inputs_header_data::put_input_file_count): Renamed
12038         from input_file_count.
12039         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12040         from command_line_offset.
12041         (Incremental_inputs_header_data::put_reserved): Renamed from
12042         put_reserved.
12043         (Incremental_inputs_entry_data): Renamed from
12044         Incremental_input_entry_data.
12045         (Incremental_inputs_entry_data::data_size): New field.
12046         (Incremental_inputs::report_command_line): New method.
12047         (Incremental_inputs::finalize): New method.
12048         (Incremental_inputs::create_incremental_inputs_data): New method.
12049         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12050         * incremental.h: New file.
12051         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12052         (Layout::finalize): Create incremental inputs section in
12053         incremental builds.
12054         (Layout::create_incremental_info_sections): New method.
12055         * layout.h (Layout::incremental_inputs): New method.
12056         (Layout::create_incremental_info_sections): New method.
12057         (Layout::incremental_inputs_): New field.
12058         * main.cc (main): Notify Incremental_input of the command line.
12059
12060 2009-04-01  Ian Lance Taylor  <iant@google.com>
12061             Mikolaj Zalewski  <mikolajz@google.com>
12062
12063         * gold.h (reserve_unordered_map): Define, three versions, one for
12064         each version of Unordered_map.
12065         * layout.cc (Layout::Layout): Remove options parameter.  Add
12066         number_of_input_files parameter.  Don't initialize options_.
12067         Initialize number_of_input_files_ and resized_signatures_.  Move
12068         sections_are_attached_.
12069         (Layout::layout_group): Reserve space for group_signatures_.
12070         (Layout::find_or_add_kept_section): Change name parameter to be a
12071         reference.  Resize signatures_ map when it gets large enough.
12072         (Layout::layout_eh_frame): Use parameters->options() instead of
12073         this->options_.
12074         (Layout::make_output_section): Likewise.
12075         (Layout::attach_allocated_section_to_segment): Likewise.
12076         (Layout::finalize, Layout::create_executable_stack): Likewise.
12077         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12078         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12079         * layout.h (class Layout): Update declarations.  Remove options_
12080         field.  Add number_of_input_files_ and resized_signatures_
12081         fields.  Move sections_are_attached_ field.
12082         * main.cc (main): Pass number of input files to Layout
12083         constructor.  Don't pass options.
12084
12085 2009-03-30  Ian Lance Taylor  <iant@google.com>
12086
12087         * ffsll.c (ffsll): Correct implementation.
12088
12089 2009-03-27  Ian Lance Taylor  <iant@google.com>
12090
12091         * ffsll.c: New file.
12092         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12093         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12094         * ftruncate.c (ftruncate): Declare before definition.
12095         * mremap.c (mremap): Likewise.
12096         * pread.c (pread): Likewise.
12097         * configure, Makefile.in, config.in: Rebuild.
12098
12099         * mremap.c: New file.
12100         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12101         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12102         (mremap): Declare if HAVE_MREMAP is not defined.
12103         * configure, Makefile.in, config.in: Rebuild.
12104
12105 2009-03-27  Cary Coutant  <ccoutant@google.com>
12106
12107         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12108         position independent.
12109         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12110         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12111
12112 2009-03-24  Cary Coutant  <ccoutant@google.com>
12113
12114         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12115         an executable.
12116         (needs_dynamic_reloc): Likewise.
12117
12118 2009-03-24  Ian Lance Taylor  <iant@google.com>
12119
12120         * yyscript.y (file_cmd): Recognize EXTERN.
12121         (extern_name_list, extern_name_list_body): New nonterminals.
12122         * script.cc (script_add_extern): Define.
12123         * script-c.h (script_add_extern): Declare.
12124
12125 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12126
12127         * object.cc (is_elf_object): Define.
12128         * object.h (is_elf_object): Declare.
12129         * archive.cc (Archive::get_elf_object_for_member): Call
12130         is_elf_object.
12131         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12132
12133 2009-03-24  Elliott Hughes  <enh@google.com>
12134
12135         * output.cc (Output_file::map_anonymous): Define.
12136         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12137         try an anonymous one.  Report the size if the mmap fails.
12138         * output.h (class Output_file): Declare map_anonymous.
12139
12140 2009-03-24  Ian Lance Taylor  <iant@google.com>
12141
12142         * target-select.cc (instantiate_target): Don't acquire the lock if
12143         the instantiated_target_ field has already been set.
12144
12145 2009-03-23  Ian Lance Taylor  <iant@google.com>
12146
12147         * gold-threads.h (class Initialize_lock): Define.
12148         * gold-threads.cc (class Initialize_lock_once): Define.
12149         (initialize_lock_control): New static variable.
12150         (initialize_lock_pointer): New static variable.
12151         (initialize_lock_once): New static function.
12152         (Initialize_lock::Initialize_lock): Define.
12153         (Initialize_lock::initialize): Define.
12154         * target-select.h: Include "gold-threads.h".
12155         (class Target_selector): Add lock_ and initialize_lock_ fields.
12156         Don't define instantiate_target, just declare it.
12157         * target-select.cc (Target_selector::Target_selector): Initialize
12158         new fields.
12159         (Target_selector::instantiate_target): Define.
12160         * descriptors.h: Include "gold-threads.h".
12161         (class Descriptors): Add initialize_lock_ field.
12162         * descriptors.cc (Descriptors::Descriptors): Initialize new
12163         field.
12164         (Descriptors::open): Use initialize_lock_ field
12165         * errors.h (class Errors): Add initialize_lock_ field.
12166         * errors.cc (Errors::Errors): Initialize new field.
12167         (Errors::initialize_lock): Use initialize_lock_ field.
12168         * powerpc.cc (class Target_selector_powerpc): Remove
12169         instantiated_target_ field.  In do_recognize call
12170         instantiate_target rather than do_instantiate_target.  In
12171         do_instantiate_target just allocate a new target.
12172         * sparc.cc (class Target_selector_sparc): Likewise.
12173
12174         * freebsd.h: New file.
12175         * i386.cc: Include "freebsd.h".
12176         (Target_i386): Derive from Target_freebsd rather than
12177         Sized_target.
12178         (Target_selector_i386): Derive from Target_selector_freebsd rather
12179         than Target_selector.
12180         * x86_64.cc: Include "freebsd.h".
12181         (Target_x86_64): Derive from Target_freebsd rather than
12182         Sized_target.
12183         (Target_selector_x86_64): Derive from Target_selector_freebsd
12184         rather than Target_selector.
12185         * target.h (class Target): Add adjust_elf_header and
12186         do_adjust_elf_header.
12187         * output.cc (Output_file_header:: do_sized_write): Call target
12188         adjust_elf_header routine.
12189         * configure.tgt: Set targ_osabi.
12190         * configure.ac: Define GOLD_DEFAULT_OSABI.
12191         * parameters.cc (Parameters::default_target): Pass
12192         GOLD_DEFAULT_OSABI to select_target.
12193         * target-select.h (class Target_selector): Make instantiate_target
12194         protected rather than private.
12195         * Makefile.am (HFILES): Add freebsd.h.
12196         * configure, Makefile.in, config.in: Rebuild.
12197
12198         * merge.cc (do_add_input_section): Correct pend value.  Change
12199         message about last entry not being null terminated from error to
12200         warning.
12201
12202 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12203
12204         * incremental.cc: New file.
12205         * Makefile.am (CCFILES): Add incremental.cc.
12206         * Makefile.in: Rebuild.
12207
12208 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12209
12210         * layout.cc (Layout::output_section_name): Preserve names
12211         of '.note.' sections.
12212
12213 2009-03-19  Ian Lance Taylor  <iant@google.com>
12214
12215         * descriptors.cc (Descriptors::open): Check that the options are
12216         valid before using them.
12217
12218 2009-03-18  Ian Lance Taylor  <iant@google.com>
12219
12220         * script-sections.h: Include <list>.
12221         (class Script_sections): Change Sections_elements from std::vector
12222         to std::list.  Typedef public Elements_iterator.  Add
12223         orphan_section_placement_, data_segment_align_start_, and
12224         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12225         field.
12226         * script-sections.cc (class Orphan_section_placement): New class.
12227         (class Sections_element): Add virtual functions is_relro and
12228         orphan_section_init.  Remove virtual function place_orphan_here.
12229         (class Output_section_definition): Add is_relro and
12230         orphan_section_init.  Remove place_orphan_here.
12231         (class Orphan_output_section): Likewise.
12232         (Script_sections::Script_sections): Update for field changes.
12233         (Script_sections::data_segment_align): Set saw_data_segment_align_
12234         and data_segment_align_start_, not data_segment_align_index.
12235         (Script_sections::data_segment_relro_end): Check
12236         saw_data_segment_align_.  Use data_segment_align_start_ rather
12237         than data_segment_align_index_.
12238         (Script_sections::place_orphan): Rewrite to use
12239         Orphan_section_placement.
12240
12241 2009-03-17  Ian Lance Taylor  <iant@google.com>
12242
12243         * archive.cc (Archive::add_symbols): Check for a version attached
12244         to the symbol name in the archive map.
12245         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12246         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12247         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12248         (ver_test_11.a): New target.
12249         * testsuite/Makefile.in: Rebuild.
12250
12251         * configure.ac: Check for chsize and posix_fallocate.  Replace
12252         ftruncate.
12253         * ftruncate.c: New file, from gnulib.
12254         * output.cc (posix_fallocate): Define dummy version if not
12255         HAVE_POSIX_FALLOCATE.
12256         (Output_file::map): Call posix_fallocate rather than lseek and
12257         write.
12258         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12259         * configure, Makefile.in, config.in: Rebuild.
12260
12261 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12262
12263         * layout.h (Layout::create_note): Add section_name parameter.
12264         * layout.cc (Layout::create_note): Likewise.
12265         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12266
12267 2009-03-17  Ian Lance Taylor  <iant@google.com>
12268
12269         * descriptors.cc: Include "options.h".
12270         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12271         (Descriptors::open): Always use O_CLOEXEC when opening a new
12272         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12273         then set FD_CLOEXEC.
12274
12275         * sparc.cc (class Target_sparc): Add has_got_section.
12276         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12277         make sure we have a GOT section.
12278
12279         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12280         (Target_sparc::Scan::local): Likewise.
12281         (Target_sparc::Scan::global): Likewise.
12282         (Target_sparc::Relocate::relocate): Likewise.
12283         (Target_sparc::Relocate::relocate_tls): Likewise.
12284
12285         * symtab.cc (Symbol_table::define_default_version): New function,
12286         broken out of add_from_object.
12287         (Symbol_table::add_from_object): Call define_default_version.
12288         (Symbol_table::define_special_symbol): Add resolve_oldsym
12289         parameter.  Change all callers.  If the version for a symbol comes
12290         from a version script, resolve it with the symbol with the same
12291         name with no version.  Also add the symbol without a version if
12292         appropriate.
12293         (do_define_in_output_data): If resolving with oldsym, don't delete
12294         sym.
12295         (do_define_in_output_segment): Likewise.
12296         (do_define_as_constant): Likewise.
12297         * symtab.h (class Symbol_table): Update declarations.
12298
12299 2009-03-13  Ian Lance Taylor  <iant@google.com>
12300
12301         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12302         (Read_symbols::requeue): New function.
12303         (Read_symbols::do_read_symbols): If make_elf_object fails because
12304         the target type is not configured, and the file was searched for,
12305         issue a warning and retry with the next directory.
12306         (Add_symbols::run): If the file has an incompatible format, and
12307         it was searched for, requeue the Read_symbols task.  On error,
12308         release the object.
12309         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12310         dirindex parameter to constructor.  Change all callers.  Declare
12311         incompatible_warning and requeue.
12312         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12313         input_argument_ and input_group_ fields.  Add them to
12314         constructor.  Change all callers.
12315         (class Read_script): Add dirindex_ field.  Add it to constructor.
12316         Change all callers.
12317         * archive.cc (Archive::setup): Remove input_objects parameter.
12318         Change all callers.
12319         (Archive::get_file_and_offset): Likewise.
12320         (Archive::read_all_symbols): Likewise.
12321         (Archive::read_symbols): Likewise.
12322         (Archive::get_elf_object_for_member): Remove input_objects
12323         parameter.  Add punconfigured parameter.  Change all callers.
12324         (Archive::add_symbols): Change return type to bool.  Check return
12325         value of include_member.
12326         (Archive::include_all_members): Likewise.
12327         (Archive::include_member): Change return type to bool.  Return
12328         false if first included object has incompatible target.  Set
12329         included_member_ field.
12330         (Add_archive_symbols::run): If add_symbols returns false, requeue
12331         Read_symbols task.
12332         * archive.h (class Archive): Add included_member_ field.
12333         Initialize it in constructor.  Add input_file and searched_for
12334         methods.  Update declarations.
12335         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12336         input_argument_ fields.  Add them to constructor.  Change all
12337         callers.
12338         * script.cc: Include "target-select.h".
12339         (class Parser_closure): Add skip_on_incompatible_target_ and
12340         found_incompatible_target_ fields.  Add
12341         skip_on_incompatible_target parameter to constructor.  Change all
12342         callers.  Add methods skip_on_incompatible_target,
12343         clear_skip_on_incompatible_target, found_incompatible_target, and
12344         set_found_incompatible_target.
12345         (read_input_script): Add dirindex parameter.  Change all callers.
12346         If parser finds an incompatible target, requeue Read_symbols
12347         task.
12348         (script_set_symbol): Clear skip_on_incompatible_target in
12349         closure.
12350         (script_add_assertion, script_parse_option): Likewise.
12351         (script_start_sections, script_add_phdr): Likewise.
12352         (script_check_output_format): New function.
12353         * script.h (read_input_script): Update declaration.
12354         * script-c.h (script_check_output_format): Declare.
12355         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12356         (ignore_cmd): Remove OUTPUT_FORMAT.
12357         * fileread.cc (Input_file::Input_file): Add explicit this.
12358         (Input_file::will_search_for): New function.
12359         (Input_file::open): Add pindex parameter.  Change all callers.
12360         * fileread.h (class Input_file): Add input_file_argument method.
12361         Declare will_search_for.  Update declarations.
12362         * object.cc (make_elf_object): Add punconfigured parameter.
12363         Change all callers.
12364         * object.h (class Object): Make input_file public.  Add
12365         searched_for method.
12366         (make_elf_object): Update declaration.
12367         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12368         restart search.
12369         * dirsearch.h (class Dirsearch): Update declaration.
12370         * options.h (class General_options): Add --warn-search-mismatch.
12371         * parameters.cc (Parameters::is_compatible_target): New function.
12372         * parameters.h (class Parameters): Declare is_compatible_target.
12373         * workqueue.cc (Workqueue::add_blocker): New function.
12374         * workqueue.h (class Workqueue): Declare add_blocker.
12375
12376         * fileread.cc (Input_file::open): Remove options parameter.
12377         Change all callers.
12378         (Input_file::open_binary): Likewise.
12379         * script.cc (read_input_script): Likewise.
12380         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12381         options parameter from constructor.  Change all callers.
12382         (class Read_script): Likewise.
12383         * fileread.h (class Input_file): Update declarations.
12384         * script.h (read_input_script): Update declaration.
12385
12386 2009-03-10  Nick Clifton  <nickc@redhat.com>
12387
12388         * po/es.po: New Spanish translation.
12389
12390 2009-03-06  Cary Coutant  <ccoutant@google.com>
12391
12392         * options.cc (parse_short_option): Keep dash_z from registering itself.
12393
12394 2009-03-03  Ian Lance Taylor  <iant@google.com>
12395
12396         PR 9918
12397         * target-reloc.h (relocate_section): Pass output_section to
12398         relocate.
12399         * i386.cc (Target_i386::should_apply_static_reloc): Add
12400         output_section parameter.  Change all callers.
12401         (Target_i386::Relocate::relocate): Add output_section parameter.
12402         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12403         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12404         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12405         * testsuite/two_file_shared.sh: New script.
12406         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12407         (check_DATA): Add two_file_shared.dbg.
12408         (two_file_shared.dbg): New target.
12409         * testsuite/Makefile.in: Rebuild.
12410
12411 2009-03-01  Ian Lance Taylor  <iant@google.com>
12412
12413         * configure.ac: Check for byteswap.h.
12414         * configure: Rebuild.
12415         * config.in: Rebuild.
12416
12417 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12418
12419         * layout.cc (Layout::find_or_add_kept_section): New function.
12420         (Layout::add_comdat): Removed.
12421         * layout.h (struct Kept_section): Move out of class Layout.
12422         Remove trailing underscores from field names.  Add group_sections
12423         field.  Rename group_ field to is_group.  Change all uses.
12424         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12425         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12426         comdat_groups_ field.
12427         (Sized_relobj::include_section_group): Use
12428         find_or_add_kept_section and Kept_section::group_sections.
12429         (Sized_relobj::include_linkonce_section): Likewise.
12430         * object.cc (class Sized_relobj): Don't define Comdat_group or
12431         Comdat_group_table.  Remove find_comdat_group and
12432         add_comdat_group.  Remove comdat_groups_ field.
12433         * plugin.cc (include_comdat_group): Use
12434         Layout::find_or_add_kept_section.
12435
12436 2009-02-28  Ian Lance Taylor  <iant@google.com>
12437
12438         * README: --gc-sections and map files are now supported.  Document
12439         some build requirements.
12440
12441         PR 6992
12442         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12443         relocatable link set the value of the section symbol to zero.
12444         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12445         relocatable link don't include the section address in the local
12446         symbol value.
12447
12448 2009-02-27  Ian Lance Taylor  <iant@google.com>
12449
12450         PR 6811
12451         * options.h (class Search_directory): Add is_system_directory.
12452         (class General_options): Declare is_in_system_directory.
12453         * options.cc (get_relative_sysroot): Make static.
12454         (get_default_sysroot): Make static.
12455         (General_optoins::is_in_system_directory): New function.
12456         * fileread.cc (Input_file::is_in_system_directory): New function.
12457         * fileread.h (class Input_file): Declare is_in_system_directory.
12458         * object.h (class Object): Add is_in_system_directory.
12459         (class Input_objects): Remove system_library_directory_ field.
12460         * object.cc (Input_objects::add_object): Don't set
12461         system_library_directory_.
12462         (input_objects::found_in_system_library_directory): Remove.
12463         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12464         parameter.  Change all callers.
12465         (Symbol_table::sized_write_globals): Likewise.
12466         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12467         Call Object::is_in_system_directory.
12468         * symtab.h (class Symbol_table): Update declarations.
12469
12470         PR 5990
12471         * descriptors.h (Open_descriptor): Add is_on_stack field.
12472         * descriptors.cc (Descriptors::open): If the descriptor is on the
12473         top of the stack, remove it.  Initialize is_on_stack field.
12474         (Descriptors::release): Only add pod to stack if it is not on the
12475         stack already.
12476         (Descriptors::close_some_descriptor): Clear stack_next and
12477         is_on_stack fields.
12478
12479         PR 7091
12480         * output.cc (Output_section::find_starting_output_address): Rename
12481         from starting_output_address; add PADDR parameter; change return
12482         type.
12483         * output.h (class Output_section): Declare
12484         find_starting_output_address instead of starting_output_address.
12485         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12486         section symbol for which we can't find a merge section.
12487
12488         PR 9836
12489         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12490         hidden or internal, force the symbol to be local.
12491         * resolve.cc (Symbol::override_visibility): Define.
12492         (Symbol::override_base): Use override_visibility.
12493         (Symbol_table::resolve): Likewise.
12494         (Symbol::override_base_with_special): Likewise.
12495         (Symbol_table::override_with_special): If the visibility is hidden
12496         or internal, force the symbol to be local.
12497         * symtab.h (class Symbol): Add set_visibility and
12498         override_visibility.
12499         * testsuite/ver_test_1.sh: New file.
12500         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12501         (check_DATA): Add ver_test_1.syms.
12502         (ver_test_1.syms): New target.
12503         * testsuite/Makefile.in: Rebuild.
12504
12505 2009-02-25  Cary Coutant  <ccoutant@google.com>
12506
12507         * layout.cc (Layout::choose_output_section): Don't rename sections
12508         when using a linker script that has a SECTIONS clause.
12509         * Makefile.in: Regenerate.
12510
12511         * testsuite/Makefile.am (script_test_5.sh): New test case.
12512         * testsuite/Makefile.in: Regenerate.
12513         * testsuite/script_test_5.cc: New file.
12514         * testsuite/script_test_5.sh: New file.
12515         * testsuite/script_test_5.t: New file.
12516
12517 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12518
12519         * archive.cc (Archive::include_member): Update calls to add_symbols.
12520         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12521         the Layout argument.
12522         * dynobj.h (do_add_symbols): Add the Layout argument.
12523         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12524         Layout argument.
12525         * object.h (Object::add_symbols): Add the Layout argument.
12526         (Object::do_add_symbols): Add the Layout argument.
12527         (Sized_relobj::do_add_symbols): Add the Layout argument.
12528         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12529         Unify the two versions.
12530         (Add_plugin_symbols): Remove.
12531         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12532         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12533         (Add_plugin_symbols): Remove.
12534         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12535         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12536         (Add_symbols::run): Make it work with Pulginobj.
12537
12538 2009-02-06  Ian Lance Taylor  <iant@google.com>
12539
12540         * object.cc (Sized_relobj::do_layout): Make info message start
12541         with lower case letter.
12542
12543 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12544
12545         * binary.cc: Fix file comment.
12546
12547         * options.h (enum Incremental_disposition): Define.
12548         (class General_options): Add new options: --incremental,
12549         --incremental_changed, --incremental_unchanged,
12550         --incremental_unknown.  Add incremental_disposition_ and
12551         implicit_incremental_ fields.
12552         (General_options::incremental_disposition): New function.
12553         (class Position_dependent_options): Add incremental_disposition
12554         option.
12555         (Position_dependent_options::copy_from_options): Set incremental
12556         dispositions.
12557         * options.cc (General_options::parse_incremental_changed): New
12558         function.
12559         (General_options::parse_incremental_unchanged): New function.
12560         (General_options::parse_incremental_unknown): New function.
12561         (General_options::General_options): Initialize new fields
12562         incremental_disposition_ and implicit_incremental_.
12563         (General_options::finalize): Check for uasge of --incremental-*
12564         without --incremental.
12565
12566 2009-02-06  Chris Demetriou  <cgd@google.com>
12567
12568         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12569         pointer and to report location as the file name associated with
12570         the symbol.
12571         (gold_undefined_symbol_at_location): New function to replace the
12572         old gold_undefined_symbol functionality.
12573         * target-reloc.h (relocate_section): Update to use
12574         gold_undefined_symbol_at_location.
12575         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12576         Call gold_undefined_symbol function rather than gold_error.
12577         * errors.h (Errors::undefined_symbol): Take location as a
12578         string, rather than calculating it from a relocation.
12579         * errors.cc (Errors::fatal): Print "fatal error:" before the
12580         formatted message.
12581         (Errors::error, Errors::error_at_location): Print "error: "
12582         before the formatted message.
12583         (Errors::undefined_symbol): Take location as a string, rather
12584         than calculating it from a relocation.
12585         (gold_undefined_symbol_at_location): New function akin to
12586         old gold_undefined_symbol, calculates location from relocation.
12587         (gold_undefined_symbol): Change to take only a Symbol pointer
12588         and to report location as the file name associated with the symbol.
12589         * testsuite/debug_msg.sh: Update for changed error messages.
12590         * testsuite/undef_symbol.sh: Likewise.
12591
12592 2009-02-04  Duncan Sands  <baldrick@free.fr>
12593
12594         PR 9812
12595         * reduced_debug_output.h
12596         (Output_reduced_debug_abbrev_section::failed): Use format for
12597         gold_warning.
12598         (Output_reduced_debug_info_section::faild): Likewise.
12599
12600 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12601
12602         * script.cc (Lazy_demangler): New class.
12603         (Version_script_info::get_symbol_version_helper): Demangle a
12604         symbol only once.
12605
12606 2009-01-29  Cary Coutant  <ccoutant@google.com>
12607
12608         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12609         to __tls_get_addr.
12610         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12611
12612 2009-01-28  Ian Lance Taylor  <iant@google.com>
12613
12614         * version.cc (version_string): Bump to 1.9.
12615
12616         * gold.h: Include <cstring> and <stdint.h>.
12617         * version.cc: Include <cstdio>.
12618         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12619         warning.
12620         * reduced_debug_output.cc (insert_into_vector): Rename from
12621         Insert_into_vector; change all callers.  Use Swap_unaligned to
12622         avoid aliasing issue; remove union since it is unnecessary.
12623
12624 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12625
12626         * Makefile.am (CCFILES): Add gc.cc.
12627         (HFILES): Add gc.h.
12628         * Makefile.in: Regenerate.
12629         * gold.cc (Gc_runner): New class.
12630         (queue_initial_tasks): Call garbage collection related tasks
12631         when corresponding options are invoked.
12632         (queue_middle_gc_tasks): New function.
12633         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12634         processed early before laying out sections during garbage collection.
12635         * gold.h (queue_middle_gc_tasks): New function.
12636         (is_prefix_of): Move from "layout.cc".
12637         * i386.cc (Target_i386::gc_process_relocs): New function.
12638         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12639         * main.cc (main): Create object of class "Garbage_collection".
12640         * object.cc (Relobj::copy_symbols_data): New function.
12641         (Relobj::is_section_name_included): New function.
12642         (Sized_relobj::do_layout): Allow this function to be called twice
12643         during garbage collection and defer layout of section during the
12644         first call.
12645         * object.h (Relobj::get_symbols_data): New function.
12646         (Relobj::is_section_name_included): New function.
12647         (Relobj::copy_symbols_data): New function.
12648         (Relobj::set_symbols_data): New function.
12649         (Relobj::get_relocs_data): New function.
12650         (Relobj::set_relocs_data): New function.
12651         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12652         (Relobj::gc_process_relocs): New function.
12653         (Relobj::do_gc_process_relocs): New pure virtual function.
12654         (Relobj::sd_): New data member.
12655         (Sized_relobj::is_output_section_offset_invalid): New function.
12656         (Sized_relobj::do_gc_process_relocs): New function.
12657         * options.h (General_options::gc_sections): Modify to not be a no-op.
12658         (General_options::print_gc_sections): New option.
12659         * plugin.cc (Plugin_finish::run): Remove function call to
12660         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12661         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12662         * reloc.cc (Read_relocs::run): Add task to process relocs and
12663         determine unreferenced sections when doing garbage collection.
12664         (Gc_process_relocs): New class.
12665         (Sized_relobj::do_gc_process_relocs): New function.
12666         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12667         sections that are garbage collected.
12668         * reloc.h (Gc_process_relocs): New class.
12669         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12670         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12671         symbols whose corresponding sections are garbage collected.
12672         (Symbol_table::Symbol_table): Add new parameter for the garbage
12673         collection object.
12674         (Symbol_table::gc_mark_undef_symbols): New function.
12675         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12676         (Symbol_table::gc_mark_dyn_syms): New function.
12677         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12678         as garbage.
12679         (Symbol_table::add_from_object): Likewise.
12680         (Symbol_table::add_from_relobj): When building shared objects, do not
12681         treat externally visible symbols as garbage.
12682         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12683         table information for static and relocatable links.
12684         * symtab.h (Symbol_table::set_gc): New function.
12685         (Symbol_table::gc): New function.
12686         (Symbol_table::gc_mark_undef_symbols): New function.
12687         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12688         (Symbol_table::gc_mark_dyn_syms): New function.
12689         (Symbol_table::gc_): New data member.
12690         * target.h (Sized_target::gc_process_relocs): New pure virtual
12691         function.
12692         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12693         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12694
12695 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12696
12697         * options.h (General_options::gc_sections): Define as a no-op for now.
12698         (General_options::no_keep_memory): Ditto.
12699         (General_options::Bshareable): Define.
12700         * options.cc (General_options::finalize): Honor -Bshareable.
12701
12702 2009-01-20  Andreas Schwab  <schwab@suse.de>
12703
12704         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12705         read the value in the contents, since we don't use it.  Use the
12706         template endianness when writing.
12707         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12708
12709 2009-01-19  Andreas Schwab  <schwab@suse.de>
12710
12711         * configure.tgt (powerpc64-*): Fix targ_obj.
12712
12713 2009-01-15  Ian Lance Taylor  <iant@google.com>
12714
12715         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12716         local symbols when stripping all symbols.
12717
12718 2009-01-14  Cary Coutant  <ccoutant@google.com>
12719
12720         * output.cc (Output_reloc): Add explicit instantiations.
12721
12722 2009-01-14  Cary Coutant  <ccoutant@google.com>
12723
12724         * archive.cc (Archive::get_elf_object_for_member): Remove call
12725         to File_read::claim_for_plugin.
12726         * descriptors.cc (Descriptors::open): Remove reference to
12727         is_claimed.
12728         (Descriptors::claim_for_plugin): Remove.
12729         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12730         (Descriptors::is_claimed): Remove.
12731         (claim_descriptor_for_plugin): Remove.
12732         * fileread.cc (File_read::claim_for_plugin): Remove.
12733         * fileread.h (File_read::claim_for_plugin): Remove.
12734         (File_read::descriptor): Reopen descriptor if necessary.
12735         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12736         (Plugin_manager::all_symbols_read): Add task parameter. Change
12737         all callers.
12738         (Plugin_manager::get_input_file): New function.
12739         (Plugin_manager::release_input_file): New function.
12740         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12741         corresponding data member.
12742         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12743         and pass to base constructor. Change all callers.
12744         (get_input_file, release_input_file): New functions.
12745         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12746         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12747         (Plugin_manager::all_symbols_read): Add task parameter.
12748         (Plugin_manager::get_input_file): New function.
12749         (Plugin_manager::release_input_file): New function.
12750         (Plugin_manager::task_): New data member.
12751         (Pluginobj::Pluginobj): Add filesize parameter.
12752         (Pluginobj::filename): New function.
12753         (Pluginobj::descriptor): New function.
12754         (Pluginobj::filesize): New function.
12755         (Pluginobj::filesize_): New data member.
12756         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12757         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12758         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12759
12760         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12761         with archive libraries.
12762         * testsuite/Makefile.in: Regenerate.
12763         * testsuite/plugin_test.c (struct sym_info): New type.
12764         (get_input_file, release_input_file): New static variables.
12765         (onload): Capture new transfer vector entries.
12766         (claim_file_hook): Stop reading at end of file according to filesize.
12767         Factor out parsing of readelf output into separate function.
12768         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12769         APIs and get the source file name from the symbol table.  Convert
12770         source file name to corresponding object file name.  Print info
12771         message when adding new input files.
12772         (parse_readelf_line): New function.
12773         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12774         * testsuite/plugin_test_2.sh: Likewise.
12775         * testsuite/plugin_test_3.sh: Likewise.
12776         * testsuite/plugin_test_4.sh: New test case.
12777
12778 2009-01-07  Ian Lance Taylor  <iant@google.com>
12779
12780         * version.cc (version_string): Bump to 1.8.
12781
12782 2008-12-23  Cary Coutant  <ccoutant@google.com>
12783
12784         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12785         * plugin.cc (Plugin_manager::finish): Rename as
12786         layout_deferred_objects.  Move cleanup to separate function.
12787         (Plugin_manager::cleanup): New function.
12788         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12789         separately.
12790         * plugin.h (Plugin_manager::finish): Rename as
12791         layout_deferred_objects.
12792         (Plugin_manager::cleanup): New function.
12793         (Plugin_manager::cleanup_done): New field.
12794
12795 2008-12-23  Cary Coutant  <ccoutant@google.com>
12796
12797         * plugin.cc (is_visible_from_outside): New function.
12798         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12799         so we don't return "IR only" status for exported symbols or -r links.
12800
12801         * testsuite/Makefile.am (plugin_test_3): New test case.
12802         * testsuite/Makefile.in: Regenerate.
12803         * testsuite/plugin_test_3.sh: New file.
12804
12805 2008-12-22  Cary Coutant  <ccoutant@google.com>
12806
12807         * object.cc (Sized_relobj::layout_section): New function.
12808         (Sized_relobj::do_layout): Defer layout of input sections until after
12809         plugin has provided replacement files.
12810         (Sized_relobj::do_layout_deferred_sections): New function.
12811         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12812         (Relobj::layout_deferred_sections): New function.
12813         (Relobj::do_layout_deferred_sections): New function.
12814         (Sized_relobj::do_layout_deferred_sections): New function.
12815         (Sized_relobj::layout_section): New function.
12816         (Sized_relobj::Deferred_layout): New structure.
12817         (Sized_relobj::deferred_layout_): New field.
12818         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12819         Change all callers.  Layout deferred sections.
12820         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12821         references.
12822         (Plugin_hook::run): Move code from do_plugin_hook inline.
12823         (Plugin_hook::do_plugin_hook): Remove.
12824         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12825         (Plugin_manager::finish): Renamed, was cleanup.
12826         (Plugin_manager::should_defer_layout): New function.
12827         (Plugin_manager::add_deferred_layout_object): New function.
12828         (Plugin_manager::Deferred_layout_list): New type.
12829         (Plugin_manager::deferred_layout_objects_): New field.
12830         (Plugin_hook::do_plugin_hook): Remove.
12831
12832 2008-12-17  Ian Lance Taylor  <iant@google.com>
12833
12834         * options.h (class General_options): Add --no case for
12835         --export-dynamic.
12836
12837 2008-12-16  Cary Coutant  <ccoutant@google.com>
12838
12839         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12840         vector.
12841         (Plugin_manager::claim_file): Create plugin object even if
12842         plugin did not call the add_symbols callback.
12843         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12844         asking for more symbols than were added.
12845         * testsuite/Makefile.am (plugin_test_1): Add test case with
12846         no global symbols.
12847         (empty.syms): New target.
12848         * testsuite/Makefile.in: Regenerate.
12849         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12850         message. Don't call add_symbols if no globals.
12851         (all_symbols_read_hook): Don't provide replacement for empty
12852         claimed file.
12853
12854 2008-12-12  Ian Lance Taylor  <iant@google.com>
12855
12856         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12857         r_type == 0 for a local symbol with r_sym == 0.
12858         (scan_relocatable_relocs): Pass r_sym to
12859         local_non_section_strategy.
12860         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12861         r_sym parameter.
12862
12863         * configure.ac: Update test for TLS descriptors: they are
12864         supported as of glibc 2.9.
12865         * configure: Rebuild.
12866
12867 2008-12-11  Ian Lance Taylor  <iant@google.com>
12868
12869         PR 7091
12870         * target-reloc.h (Default_scan_relocatable_relocs): For each
12871         function, map r_type == 0 to RELOC_DISCARD.
12872
12873 2008-12-10  Cary Coutant  <ccoutant@google.com>
12874
12875         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12876         object to override a kept COMDAT group from a plugin object.
12877
12878 2008-12-09  Ian Lance Taylor  <iant@google.com>
12879
12880         PR 7088
12881         * yyscript.y (file_cmd): Handle INPUT.
12882
12883         * testsuite/initpri1.c: Change all declarations to be full
12884         prototypes by adding void, to avoid compiler warnings.
12885
12886 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
12887
12888         * options.cc (General_options::parse_plugin_opt): New.
12889         (General_options::add_plugin): The argument now is just the filename.
12890         (General_options::add_plugin_option): New.
12891         * options.h (plugin_opt): New.
12892         (add_plugin): Change argument name.
12893         (add_plugin_option): New.
12894         * plugin.cc (Plugin::load): Don't parse the plugin option.
12895         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
12896         (Plugin::add_option): New.
12897         (Plugin::args_): Change type.
12898         (Plugin::filename_): New.
12899         (Plugin_manager::add_plugin_option): New.
12900         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
12901         * testsuite/Makefile.in: Regenerate.
12902
12903 2008-12-05  Cary Coutant  <ccoutant@google.com>
12904
12905         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
12906         Handle --strip-lto-sections option.
12907         * options.h (strip_lto_sections): New option.
12908
12909 2008-12-01  Cary Coutant  <ccoutant@google.com>
12910
12911         * plugin.cc (ld_plugin_message): Change format parameter to const.
12912         Fix mismatch between new[] and delete.
12913
12914 2008-11-14  Cary Coutant  <ccoutant@google.com>
12915
12916         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
12917         instead of -1U.
12918
12919 2008-11-05  Craig Silverstein  <csilvers@google.com>
12920
12921         * options.cc (General_options::parse_dynamic_list): New function.
12922         * options.h (General_options): New flags dynamic_list,
12923         dynamic_list_data, dynamic_list_cpp_new, and
12924         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
12925         (General_options::in_dynamic_list): New function.
12926         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
12927         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
12928         (Lex::can_continue_name): Likewise.
12929         (yylex): Likewise.
12930         (read_script_file): New parameter script_options.
12931         (read_dynamic_list): New function.
12932         (Script_options::define_dynamic_list): New function.
12933         (dynamic_list_keyword_parsecodes): New variable.
12934         (dynamic_list_keywords): New variable.
12935         * script.h (Script_options::define_dynamic_list): New function
12936         prototype.
12937         (read_dynamic_list): New function prototype.
12938         * symtab.cc (strprefix): New macro.
12939         (Symbol::should_add_dynsym_entry): Support dynamic_list,
12940         dynamic_list_data, dynamic_list_cpp_new, and
12941         dynamic_list_cpp_typeinfo.
12942         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
12943         (dynamic_list_expr): New rule.
12944         (dynamic_list_nodes): Likewise.
12945         (dynamic_list_node): Likewise.
12946         * testsuite/Makefile.am (dynamic_list): New test.
12947         * testsuite/Makefile.in: Regenerated.
12948         * testsuite/dynamic_list.t: New file.
12949         * testsuite/dynamic_list.sh: New file.
12950
12951 2008-11-05  Craig Silverstein  <csilvers@google.com>
12952
12953         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
12954         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
12955         (t11_last): Likewise.
12956         * testsuite/ver_test_6.c (main): Likewise.
12957
12958 2008-10-07  Cary Coutant  <ccoutant@google.com>
12959
12960         * options.c (General_options::finalize): Add check for -static and
12961         -shared.
12962         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
12963         is not empty.
12964
12965 2008-10-02  Cary Coutant  <ccoutant@google.com>
12966
12967         * plugin.cc (make_sized_plugin_object): Fix conditional
12968         compilation to work when not all targets are enabled.
12969
12970 2008-09-29  Cary Coutant  <ccoutant@google.com>
12971
12972         * archive.cc (Archive::get_file_and_offset): Use filename instead
12973         of name to get library path.
12974         (Archive::include_member): Unlock external member of a thin archive.
12975
12976         * testsuite/Makefile.am (TEST_AR): New variable.
12977         (thin_archive_test_1): New test.
12978         (thin_archive_test_2): New test.
12979         * testsuite/Makefile.in: Regenerate.
12980         * testsuite/thin_archive_main.cc: New file.
12981         * testsuite/thin_archive_test_1.cc: New file.
12982         * testsuite/thin_archive_test_2.cc: New file.
12983         * testsuite/thin_archive_test_3.cc: New file.
12984         * testsuite/thin_archive_test_4.cc: New file.
12985
12986 2008-09-29  Cary Coutant  <ccoutant@google.com>
12987
12988         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
12989         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
12990         instead of -1U.
12991         (Sized_relobj::do_finalize_local_symbols): Likewise.
12992         (Sized_relobj::map_to_kept_section): Likewise.
12993         * object.h (Sized_relobj::invalid_address): New constant.
12994         (Sized_relobj::do_output_section_offset): Check for invalid_address
12995         and return -1ULL.
12996         * output.cc (Output_reloc::local_section_offset): Use constant
12997         invalid_address instead of -1U.
12998         (Output_reloc::get_address): Likewise.
12999         (Output_section::output_address): Change -1U to -1ULL.
13000         * output.h (Output_reloc::invalid_address): New constant.
13001         * reloc.cc (Sized_relobj::write_sections): Use constant
13002         invalid_address instead of -1U.
13003         (Sized_relobj::relocate_sections): Likewise.
13004         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13005         values for merge sections.
13006         * target-reloc.h (relocate_for_relocatable): Use constant
13007         invalid_address instead of -1U.
13008
13009 2008-09-19  Cary Coutant  <ccoutant@google.com>
13010
13011         Add plugin functionality for link-time optimization (LTO).
13012         * configure.ac (plugins): Add --enable-plugins option.
13013         * configure: Regenerate.
13014         * config.in: Regenerate.
13015         * Makefile.am (LIBDL): New variable.
13016         (CCFILES): Add plugin.cc.
13017         (HFILES): Add plugin.h.
13018         (ldadd_var): Add LIBDL.
13019         * Makefile.in: Regenerate.
13020
13021         * archive.cc: Include "plugin.h".
13022         (Archive::setup): Don't preread archive symbols when using a plugin.
13023         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13024         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13025         files.
13026         (Archive::include_member): Add symbols from plugin objects.
13027         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13028         * descriptors.cc (Descriptors::open): Check for file descriptors
13029         abandoned by plugins.
13030         (Descriptors::claim_for_plugin): New function.
13031         * descriptors.h (Descriptors::claim_for_plugin): New function.
13032         (Open_descriptor::is_claimed): New field.
13033         (claim_descriptor_for_plugin): New function.
13034         * fileread.cc (File_read::claim_for_plugin): New function.
13035         * fileread.h (File_read::claim_for_plugin): New function.
13036         (File_read::descriptor): New function.
13037         * gold.cc: Include "plugin.h".
13038         (queue_initial_tasks): Add task to call plugin hooks for generating
13039         new object files.
13040         * main.cc: Include "plugin.h".
13041         (main): Load plugin libraries.
13042         * object.h (Pluginobj): Declare.
13043         (Object::pluginobj): New function.
13044         (Object::do_pluginobj): New function.
13045         (Object::set_target): New function.
13046         * options.cc: Include "plugin.h".
13047         (General_options::parse_plugin): New function.
13048         (General_options::General_options): Initialize plugins_ field.
13049         (General_options::add_plugin): New function.
13050         * options.h (Plugin_manager): Declare.
13051         (General_options): Add --plugin option.
13052         (General_options::has_plugins): New function.
13053         (General_options::plugins): New function.
13054         (General_options::add_plugin): New function.
13055         (General_options::plugins_): New field.
13056         * plugin.cc: New file.
13057         * plugin.h: New file.
13058         * readsyms.cc: Include "plugin.h".
13059         (Read_symbols::do_read_symbols): Check for archive before checking
13060         for ELF file.  Call plugin hooks to claim files.
13061         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13062         from a real object file; force override when processing replacement
13063         files.
13064         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13065         (Symbol::init_base_object): Likewise.
13066         (Symbol::init_base_output_data): Likewise.
13067         (Symbol::init_base_output_segment): Likewise.
13068         (Symbol::init_base_constant): Likewise.
13069         (Symbol::init_base_undefined): Likewise.
13070         (Symbol::output_section): Assert that object is not a plugin.
13071         (Symbol_table::add_from_pluginobj): New function.
13072         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13073         undefined.
13074         (Symbol_table::sized_write_globals): Likewise.
13075         (Symbol_table::add_from_pluginobj): Instantiate template.
13076         * symtab.h (Sized_pluginobj): Declare.
13077         (Symbol::in_real_elf): New function.
13078         (Symbol::set_in_real_elf): New function.
13079         (Symbol::in_real_elf_): New field.
13080         (Symbol_table::add_from_pluginobj): New function.
13081
13082         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13083         (LIBDL): New variable.
13084         (LDADD): Add LIBDL.
13085         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13086         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13087         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13088         (MOSTLYCLEANFILES): Likewise.
13089         * testsuite/Makefile.in: Regenerate.
13090         * testsuite/plugin_test.c: New file.
13091         * testsuite/plugin_test_1.sh: New file.
13092         * testsuite/plugin_test_2.sh: New file.
13093
13094 2008-09-16  Ian Lance Taylor  <iant@google.com>
13095
13096         * target-reloc.h (relocate_section): Check whether a symbol is
13097         defined by the ABI before reporting an undefined symbol error.
13098         * target.h (Target::is_defined_by_abi): Make parameter const.
13099         (Target::do_is_defined_by_abi): Likewise.
13100         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13101         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13102         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13103         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13104         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13105         * testsuite/Makefile.in: Rebuild.
13106
13107         * fileread.cc (make_view): Add casts to avoid warning.
13108
13109 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13110
13111         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13112         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13113
13114 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13115
13116         * options.h (General_options::output_is_executable): New.
13117         (General_options::output_is_pie): New.
13118         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13119         for shared libraries.
13120         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13121
13122 2008-09-11  Chris Demetriou  <cgd@google.com>
13123
13124         * options.h (origin): New -z option.
13125         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13126         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13127         in DT_FLAGS_1.
13128
13129 2008-09-05  Cary Coutant  <ccoutant@google.com>
13130
13131         * fileread.cc (File_read::make_view): Add check for attempt to map
13132         beyond end of file.
13133
13134 2008-09-05  Cary Coutant  <ccoutant@google.com>
13135
13136         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13137         explicit instantiations.
13138
13139 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13140
13141         PR gold/6858
13142         * options.cc (General_options::finalize): Allow undefined symbols
13143         in shlibs if linking -shared.
13144
13145         PR gold/6859
13146         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13147         symbols as not needing a dynsym entry.
13148
13149 2008-08-20  Craig Silverstein  <csilvers@google.com>
13150
13151         * fileread.cc (File_read::open): Do not lock the file unless it
13152         was successfully opened.
13153
13154 2008-08-14  Cary Coutant  <ccoutant@google.com>
13155
13156         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13157         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13158         * testsuite/tls_test.cc (struct int128): 128-bit struct
13159         for testing TLS relocs with non-zero addend.
13160         (v12): New TLS variable.
13161         (t12): New test.
13162         (t_last): Add check for v12.
13163         * testsuite/tls_test.h (t12): New function.
13164         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13165
13166 2008-08-13  Ian Lance Taylor  <iant@google.com>
13167
13168         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13169         set tls_segment_ or relro_segment_.
13170         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13171         when appropriate.
13172         * output.h (Output_section::clear_is_relro): New function.
13173         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13174         sections specially even when output_data_ is empty.
13175         (Output_segment::maximum_alignment): When first section is relro,
13176         only force alignment for PT_LOAD segments.
13177         * script.cc (script_data_segment_align): New function.
13178         (script_data_segment_relro_end): New function.
13179         * script-c.h (script_data_segment_align): Declare.
13180         (script_data_segment_relro_end): Declare.
13181         * script-sections.h (class Script_sections): Declare
13182         data_segment_align and data_segment_relro_end.  Add fields
13183         segment_align_index_ and saw_relro_end_.
13184         * script-sections.cc (class Sections_element): Add set_is_relro
13185         virtual function.  Add new bool* parameter to place_orphan_here.
13186         Add get_output_section virtual function.
13187         (class Output_section_definition): Add set_is_relro.  Add new
13188         bool* parameter to place_orphan_here.  Add get_output_section.
13189         Add is_relro_ field.
13190         (Output_section_definition::Output_section_definition): Initialize
13191         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13192         and is_relro_ fields.
13193         (Output_section_definition::place_orphan_here): Add is_relro
13194         parameter.
13195         (Output_section_definition::set_section_addresses): Set relro for
13196         output section.
13197         (Output_section_definition::alternate_constraint): Likewise.
13198         (class Orphan_output_section): Add new bool* parameter to
13199         place_orphan_here.  Add get_output_section.
13200         (Orphan_output_section::place_orphan_here): Add is_relro
13201         parameter.
13202         (Script_sections::Script_sections): Initialize
13203         data_segment_align_index_ and saw_relro_end_.
13204         (Script_sections::data_segment_align): New function.
13205         (Script_sections::data_segment_relro_end): New function.
13206         (Script_sections::place_orphan): Set or clear is_relro.
13207         (Script_sections::set_section_addresses): Force alignment of first
13208         TLS section.
13209         * yyscript.y (exp): Call script_data_segment_align and
13210         script_data_segment_relro_end.
13211         * testsuite/relro_script_test.t: New file.
13212         * testsuite/relro_test.cc (using_script): Declare.
13213         (t1, t2): Test using_script.
13214         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13215         (relro_script_test_SOURCES): Define.
13216         (relro_script_test_DEPENDENCIES): Define.
13217         (relro_script_test_LDFLAGS): Define.
13218         (relro_script_test_LDADD): Define.
13219         (relro_script_test.so): New target.
13220         * testsuite/Makefile.in: Rebuild.
13221
13222 2008-08-06  Cary Coutant <ccoutant@google.com>
13223
13224         * archive.cc (Archive::total_archives, Archive::total_members)
13225         (Archive::total_members_loaded): New variables.
13226         (Archive::setup): Add parameter.  Add option to preread
13227         archive symbols.
13228         (Archive::read_armap): Add counter.
13229         (Archive::get_file_and_offset): New function.
13230         (Archive::get_elf_object_for_member): New function.
13231         (Archive::read_all_symbols): New function.
13232         (Archive::read_symbols): New function.
13233         (Archive::add_symbols): Add counters.
13234         (Archive::include_all_members): Use armap to find members if it's
13235         already built.
13236         (Archive::include_member): Skip reading symbols if already read.
13237         Factored code into Archive::get_file_and_offset and
13238         Archive::get_elf_object_for_member.  Changed call to
13239         Mapfile::report_include_archive_member.
13240         (Archive::print_stats): New function.
13241         * archive.h: Declare Object and Read_symbols_data classes.
13242         (Archive::Archive): Add initializers for new members.
13243         (Archive::setup): Add parameter.
13244         (Archive::print_stats): New function.
13245         (Archive::total_archives, Archive::total_members)
13246         (Archive::total_members_loaded): New variables.
13247         (Archive::get_file_and_offset): New function.
13248         (Archive::get_elf_object_for_member): New function.
13249         (Archive::read_all_symbols): New function.
13250         (Archive::read_symbols): New function.
13251         (Archive::Archive_member): New class.
13252         (Archive::members_): New member.
13253         (Archive::num_members_): New member.
13254         * main.cc: Include archive.h.
13255         (main): Call Archive::print_stats.
13256         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13257         archive parameter; member_name is now the fully-decorated name.
13258         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13259         * options.h: (General_options): Add --preread-archive-symbols option.
13260         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13261         Archive::setup.
13262
13263 2008-08-04  Ian Lance Taylor  <iant@google.com>
13264
13265         * symtab.h (Symbol::use_plt_offset): New function.
13266         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13267         * powerpc.cc (Relocate::relocate): Likewise.
13268         * sparc.cc (Relocate::relocate): Likewise.
13269         * x86_64.cc (Relocate::relocate): Likewise.
13270         * testsuite/weak_plt.sh: New test.
13271         * testsuite/weak_plt_main.cc: New test.
13272         * testsuite/weak_plt_shared.cc: New test.
13273         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13274         (check_PROGRAMS): Add weak_plt.
13275         (check_DATA): Add weak_plt_shared.so.
13276         (weak_plt_main_pic.o, weak_plt): New targets.
13277         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13278         * testsuite/Makefile.in: Rebuild.
13279
13280         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13281         gcctestdir/ld.
13282         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13283         * testsuite/Makefile.in: Rebuild.
13284
13285 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13286
13287         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13288         * Makefile.in: Regenerate.
13289         * po/POTFILES.in: Regenerate.
13290
13291 2008-07-29  Ian Lance Taylor  <iant@google.com>
13292
13293         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13294         symbols before other symbols.
13295         * testsuite/script_test_2.cc (test_addr): Declare.
13296         (test_addr_alias): Declare.
13297         (main): Check that test_addr and test_addr_alias have the right
13298         values.
13299         * testsuite/script_test_2.t: Define test_addr_alias and
13300         test_addr.
13301
13302 2008-07-24  Ian Lance Taylor  <iant@google.com>
13303
13304         PR 5990
13305         * descriptors.cc: New file.
13306         * descriptors.h: New file.
13307         * gold-threads.h (class Hold_optional_lock): New class.
13308         * fileread.cc: Include "descriptors.h".
13309         (File_read::~File_read): Release descriptor rather than closing
13310         it.
13311         (File_read::open) [file]: Call open_descriptor rather than open.
13312         Set is_descriptor_opened_.
13313         (File_read::open) [memory]: Assert that descriptor is not open.
13314         (File_read::reopen_descriptor): New function.
13315         (File_read::release): Release descriptor.
13316         (File_read::do_read): Make non-const.  Reopen descriptor.
13317         (File_read::read): Make non-const.
13318         (File_read::make_view): Reopen descriptor.
13319         (File_read::do_readv): Likewise.
13320         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13321         Update declarations.
13322         * layout.cc: Include "descriptors.h".
13323         (Layout::create_build_id): Use open_descriptor rather than open.
13324         * output.cc: Include "descriptors.h".
13325         (Output_file::open): Use open_descriptor rather than open.
13326         * archive.cc (Archive::const_iterator): Change Archive to be
13327         non-const.
13328         (Archive::begin, Archive::end): Make non-const.
13329         (Archive::count_members): Likewise.
13330         * archive.h (class Archive): Update declarations.
13331         * object.h (Object::read): Make non-const.
13332         * Makefile.am (CCFILES): Add descriptors.cc.
13333         (HFILES): Add descriptors.h.
13334         * Makefile.in: Rebuild.
13335
13336         PR 6716
13337         * gold.h: Always include <clocale>.  Add Solaris workarounds
13338         following code in binutils/sysdep.h.
13339
13340         PR 6048
13341         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13342         this->eh_frame_hdr_ is NULL before using it.
13343
13344         * dynobj.cc (Versions::Versions): Update comment.
13345
13346         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13347         the base version name.
13348
13349         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13350         array size plus one.
13351         (Stringpool_template::set_string_offsets): Subtract one from key
13352         before using it as an array index.
13353         (Stringpool_template::get_offset_with_length): Likewise.
13354         (Stringpool_template::write_to_buffer): Likewise.
13355         * stringpool.h (Stringpool_template::get_offset_from_key):
13356         Likewise.
13357
13358 2008-07-23  Ian Lance Taylor  <iant@google.com>
13359
13360         PR 6658
13361         * object.h (Merged_symbol_value::value): Do our best to handle a
13362         negative addend.
13363
13364         PR 6647
13365         * script.cc (Version_script_info::get_versions): Don't add empty
13366         version tag to return value.
13367         (Version_script_info::get_symbol_version_helper): Change return
13368         type to bool.  Add pversion parameter.  Change all callers.
13369         (script_register_vers_node): Don't require a non-NULL tag.
13370         * script.h (class Version_script_info): Update declarations.
13371         (Version_script_info::get_symbol_version): Change return type to
13372         bool.  Add version parameter.  Change all callers.
13373         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13374         handling.  Handle an empty version from a version script.
13375         (Symbol_table::define_special_symbol): Likewise.
13376         * testsuite/ver_test_10.script: New file.
13377         * testsuite/ver_test_10.sh: New file.
13378         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13379         (check_DATA): Add ver_test_10.syms.
13380         (ver_test_10.syms, ver_test_10.so): New target.
13381         * testsuite/Makefile.in: Rebuild.
13382
13383 2008-07-23  Simon Baldwin  <simonb@google.com>
13384
13385         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13386         to zero for undefined symbols from dynamic libraries.
13387
13388 2008-07-23  Ian Lance Taylor  <iant@google.com>
13389
13390         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13391         Change all callers.
13392         * symtab.h (class Symbol_table): Update declaration.
13393         * testsuite/ver_test_9.cc: New file.
13394         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13395         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13396         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13397         (ver_test_9.so, ver_test_9.o): New targets.
13398         * testsuite/Makefile.in: Rebuild.
13399
13400 2008-07-22  Ian Lance Taylor  <iant@google.com>
13401
13402         * options.h (class General_options): Define --check-sections.
13403         * layout.cc (Layout::set_segment_offsets): Handle
13404         --check-sections.
13405
13406         * options.h (class General_options): Define -n/--nmagic and
13407         -N/--omagic.
13408         * options.cc (General_options::finalize): For -n/--nmagic or
13409         -N/--omagic, set -static.
13410         * layout.cc (Layout::attach_allocated_section_to_segment): If
13411         -N/--omagic, don't put read-only and read-write sections in
13412         different segments.
13413         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13414         finding a read-only segment.
13415         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13416         don't set the minimum segment alignment to the common page size,
13417         and don't set the file offset to the address modulo the page size.
13418         * script-sections.cc (Script_sections::create_segments): If
13419         -n/--omagic, don't put read-only and read-write sections in
13420         different segments.
13421
13422         * cref.cc: New file.
13423         * cref.h: New file.
13424         * options.h (class General_options): Add --print-symbol-counts.
13425         * main.cc (main): Issue defined symbol report if requested.
13426         * archive.cc (Archive::interpret_header): Make into a const member
13427         function.
13428         (Archive::add_symbols): Call Input_objects::archive_start and
13429         archive_stop.
13430         (Archive::const_iterator): Define new class.
13431         (Archive::begin, Archive::end): New functions.
13432         (Archive::include_all_members): Rewrite to use iterator.
13433         (Archive::count_members): New function.
13434         * archive.h (class Archive): Update declarations.
13435         (Archive::filename): New function.
13436         * object.cc: Include "cref.h".
13437         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13438         (Sized_relobj::do_get_global_symbol_counts): New function.
13439         (Input_objects::add_object): Add object to cross-referencer.
13440         (Input_objects::archive_start): New function.
13441         (Input_objects::archive_stop): New function.
13442         (Input_objects::print_symbol_counts): New function.
13443         * object.h: Declare Cref and Archive.
13444         (Object::get_global_symbol_counts): New function.
13445         (Object::do_get_global_symbol_counts): New pure virtual function.
13446         (class Sized_relobj): Add defined_count_ field.  Update
13447         declarations.
13448         (class Input_objects): Add cref_ field.  Update constructor.
13449         Update declarations.
13450         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13451         defined_count_.
13452         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13453         symbol counts.
13454         (Sized_dynobj::do_get_global_symbol_counts): New function.
13455         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13456         defined_count_.  Update declarations.  Define Symbols typedef.
13457         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13458         parameter.  Change all callers.
13459         (Symbol_table::add_from_dynobj): Add sympointers and defined
13460         parameters.  Change all callers.
13461         * symtab.h (class Symbol_table): Update declarations.
13462         * Makefile.am (CCFILES): Add cref.cc.
13463         (HFILES): Add cref.h.
13464         * Makefile.in: Rebuild.
13465
13466 2008-07-22  Simon Baldwin  <simonb@google.com>
13467
13468         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13469         to zero when writing undefined symbols.
13470
13471 2008-07-22  Ian Lance Taylor  <iant@google.com>
13472
13473         * output.cc (Output_section::add_input_section): Don't try to
13474         merge empty merge sections.
13475
13476 2008-07-21  Craig Silverstein  <csilvers@google.com>
13477
13478         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13479         Include symbol version in error message.
13480
13481 2008-07-20  Chris Demetriou  <cgd@google.com>
13482
13483         * configure.ac (gold_cv_c_random_seed): New configured variable.
13484         (RANDOM_SEED_CFLAGS): New substituted variable.
13485         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13486         * configure: Rebuild.
13487         * Makefile.in: Likewise.
13488         * testsuite/Makefile.in: Likewise.
13489
13490 2008-07-18  Ian Lance Taylor  <iant@google.com>
13491
13492         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13493         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13494         * testsuite/ver_test_main.cc (main): Call t4.
13495         (t4, t4_2a): Define.
13496         * testsuite/ver_test_2.cc (t4_2): Define.
13497         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13498         * testsuite/ver_test_4.cc (t4_2a): Define.
13499         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13500         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13501
13502 2008-07-17  Ian Lance Taylor  <iant@google.com>
13503
13504         * dynobj.cc (Versions::add_def): If we give an error about a
13505         missing version, go ahead and create the version anyhow.
13506
13507 2008-07-10  Ian Lance Taylor  <iant@google.com>
13508
13509         Handle output sections with more than 0x7fffffff bytes.
13510         * object.h (class Relobj): Change map_to_output_ to
13511         output_sections_, and just keep a section pointer.  Change all
13512         uses.  Move comdat group support to Sized_relobj.
13513         (Relobj::is_section_specially_mapped): Remove.
13514         (Relobj::output_section): Remove poff parameter.  Change all
13515         callers.
13516         (Relobj::output_section_offset): New function.
13517         (Relobj::set_section_offset): Rewrite.
13518         (Relobj::map_to_output): Remove.
13519         (Relobj::output_sections): New function.
13520         (Relobj::do_output_section_offset): New pure virtual function.
13521         (Relobj::do_set_section_offset): Likewise.
13522         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13523         group support from Relobj.  Update declarations.
13524         (Sized_relobj::get_output_section_offset): New function.
13525         (Sized_relobj::do_output_section_offset): New function.
13526         (Sized_relobj::do_set_section_offset): New function.
13527         * object.cc (Relobj::output_section_address): Remove.
13528         (Sized_relobj::Sized_relobj): Initialize new fields.
13529         (Sized_relobj::include_section_group): Cast find_kept_object to
13530         Sized_relobj.
13531         (Sized_relobj::include_linkonce_section): Likewise.
13532         (Sized_relobj::do_layout): Use separate arrays for output section
13533         and output offset.
13534         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13535         output_sections.
13536         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13537         output_sections and section_offsets.
13538         (Sized_relobj::write_local_symbols): Likewise.
13539         (map_to_kept_section): Compute output address directly.
13540         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13541         output_sections and section_offsets.
13542         (Sized_relobj::write_sections): Likewise.
13543         (Sized_relobj::relocate_sections): Likewise.
13544         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13545         * output.h (class Output_reloc): Update declarations.  Change
13546         u2_.relobj to Sized_relobj*.
13547         (class Output_data_reloc): Change add functions to use
13548         Sized_relobj*.
13549         * output.cc (Output_reloc::Output_reloc): Change relobj to
13550         Sized_relobj*.
13551         (Output_reloc::local_section_offset): Change return type to
13552         Elf_Addr.  Use get_output_section_offset.
13553         (Output_reloc::get_address): Likewise.
13554         (Output_section::is_input_address_mapped): Don't call
13555         is_section_specially_mapped.
13556         (Output_section::output_offset): Likewise.
13557         (Output_section::output_address): Likewise.
13558         (Output_section::starting_output_address): Likewise.
13559         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13560         parameter to Sized_relobj*.
13561         (Copy_relocs::need_copy_reloc): Likewise.
13562         (Copy_relocs::save): Likewise.
13563         * copy-relocs.h (class Copy_relocs): Update declarations.
13564         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13565         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13566         * target-reloc.h (relocate_for_relocatable): Change
13567         offset_in_output_section type to Elf_Addr.  Change code that uses
13568         it as well.
13569         * layout.cc (Layout::layout): Always set *off.
13570         * mapfile.cc (Mapfile::print_input_section): Use
13571         output_section_offset.
13572         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13573         Sized_relobj*.
13574         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13575         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13576         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13577
13578 2008-07-03  Ian Lance Taylor  <iant@google.com>
13579
13580         * layout.cc (Layout::include_section): Do not discard unrecognized
13581         SHT_STRTAB sections.
13582
13583 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13584
13585         * script.cc (Lex::can_continue_name): Make '?' allowable in
13586         version-script names.
13587         * testsuite/version_script.map: Change glob pattern to use '?'
13588
13589 2008-06-30  Manish Singh  <yosh@gimp.org>
13590
13591         PR 6585
13592         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13593         Correct typo.
13594
13595 2008-06-30  Ian Lance Taylor  <iant@google.com>
13596
13597         PR 6660
13598         PR 6682
13599         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13600         versions]: Don't try to read the value in the contents, since we
13601         don't use it.  Use the template endianness when writing.
13602
13603 2008-06-25  Cary Coutant  <ccoutant@google.com>
13604
13605         * fileread.cc (File_read::make_view): Assert on zero-length view.
13606         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13607         symbol table when there are no symbols to read.
13608
13609 2008-06-23  Craig Silverstein  <csilvers@google.com>
13610
13611         * version.cc (version_string): Bump to 1.7
13612
13613 2008-06-18  Craig Silverstein  <csilvers@google.com>
13614
13615         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13616         constant 0xFFFF to type Valtype.
13617         (Powerpc_relocate_functions::rel16_ha): Likewise.
13618
13619 2008-06-17  Ian Lance Taylor  <iant@google.com>
13620
13621         * output.h (Output_section::Input_section): Initialize p2align_ to
13622         zero for Output_section_data constructors.
13623         (Output_section::Input_section::addralign): If not an input
13624         section, return the alignment of the Output_section_data.
13625         * testsuite/copy_test.cc: New file.
13626         * testsuite/copy_test_1.cc: New file.
13627         * testsuite/copy_test_2.cc: New file.
13628         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13629         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13630         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13631         (copy_test_1_pic.o, copy_test_1.so): New targets.
13632         (copy_test_2_pic.o, copy_test_2.so): New targets.
13633         * testsuite/Makefile.in: Rebuild.
13634
13635         * script-sections.cc (Script_sections::place_orphan): Initialize
13636         local variable exact.
13637
13638 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13639
13640         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13641
13642 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13643             David S. Miller  <davem@davemloft.net>
13644
13645         * powerpc.cc: New file.
13646         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13647         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13648         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13649         * Makefile.in: Rebuild.
13650
13651 2008-06-09  Ian Lance Taylor  <iant@google.com>
13652
13653         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13654         <exception>.
13655         (throwing, orig_terminate): New static variables.
13656         (terminate_handler): New static function.
13657         (t2): Set terminate handler.
13658
13659 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13660
13661         PR 6584
13662         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13663         alignment.
13664
13665 2008-05-30  Cary Coutant  <ccoutant@google.com>
13666
13667         * archive.cc (Archive::include_all_members) Correct to step
13668         over symbol table and extended name table in thin archives.
13669
13670 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13671
13672         PR 6407
13673         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13674         calculation.
13675
13676 2008-05-28  Caleb Howe  <cshowe@google.com>
13677
13678         * reduced_debug_output.cc: New file.
13679         * reduced_debug_output.h: New file.
13680         * options.h (class General_options): Add --strip-debug-non-line.
13681         * options.cc (General_options::finalize): Add strip_debug_non_line
13682         to the strip heirarchy.
13683         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13684         fields.
13685         * layout.cc: Include "reduced_debug_output.h".
13686         (Layout::Layout): Initialize new fields.
13687         (line_only_debug_sections): New static array.
13688         (is_lines_only_debug_sections): New static inline function.
13689         (Layout::include_section): Handle --strip-debug-non-line.
13690         (Layout::make_output_section): If --strip-debug-non-line, build
13691         new output sections for .debug_abbrev and .debug_info.
13692         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13693         gold.  Warn about possible overflow.
13694         (read_signed_LEB_128): Likewise.
13695         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13696         (read_signed_LEB_128): Declare.
13697         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13698         (HFILES): Add reduced_debug_output.h.
13699         * Makefile.in: Rebuild.
13700
13701 2008-05-21  Ian Lance Taylor  <iant@google.com>
13702
13703         * mapfile.cc: New file.
13704         * mapfile.h: New file.
13705         * options.h (class General_options): Add -M/--print-map and -Map.
13706         * options.cc (General_options::finalize): Make -M equivalent to
13707         -Map -.
13708         * main.cc: Include <cstdio> and "mapfile.h".
13709         (main): Open mapfile if requested.
13710         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13711         constructor.  Change caller.
13712         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13713         (queue_middle_tasks): Likewise.
13714         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13715         declarations.
13716         * archive.cc: Include "mapfile.h".
13717         (Archive::add_symbols): Add mapfile parameter.  Change all
13718         callers.  Pass mapfile, symbol, and reason to include_member.
13719         (Archive::include_all_members): Add mapfile parameter.  Change all
13720         callers.
13721         (Archive::include_member): Add mapfile, sym, and why parameters.
13722         Change all callers.  Report inclusion to map file.
13723         * archive.h: Include "fileread.h".
13724         (class Archive): Update declarations.
13725         (Archive::file): New const method.
13726         (class Add_archive_symbols): Add mapfile_ field.  Update
13727         constructor.  Change all callers.
13728         * readsyms.h (class Read_symbols): Likewise.
13729         (class Finish_group): Likewise.
13730         (class Read_script): Likewise.
13731         * common.cc: Include "mapfile.h".
13732         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13733         all callers.
13734         (Symbol_table::do_allocate_commons): Likewise.
13735         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13736         symbol allocation to mapfile.
13737         * common.h (class Allocate_commons_task): Add mapfile_ field.
13738         Update constructor.  Change all callers.
13739         * symtab.h (class Symbol_table): Update declarations.
13740         * layout.cc: Include "mapfile.h".
13741         (Layout_task_runner::run): Print information to mapfile.
13742         (Layout::create_gold_note): Change Output_data_fixed_space to
13743         Output_data_zero_fill.
13744         (Layout::create_build_id): Likewise.
13745         (Layout::print_to_mapfile): New function.
13746         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13747         constructor.  Change caller.
13748         (class Layout): Declare print_to_mapfile.
13749         * output.cc (Output_section::Input_section::print_to_mapfile): New
13750         function.
13751         (Output_section::add_input_section): If producing a map, always
13752         add to input_sections_ list.
13753         (Output_section::do_print_to_mapfile): New function.
13754         (Output_segment::print_sections_to_mapfile): New function.
13755         (Output_segment::print_section_list_to_mapfile): New function.
13756         * output.h: Include "mapfile.h".
13757         (Output_data::print_to_mapfile): New function.
13758         (Output_data::do_print_to_mapfile): New virtual function.
13759         (Output_segment_headers::do_print_to_mapfile): New function.
13760         (Output_file_header::do_print_to_mapfile): New function.
13761         (Output_data_const::do_print_to_mapfile): New function.
13762         (class Output_data_const_buffer): Add map_name_ field.  Update
13763         constructor.  Change all callers.  Add do_print_to_mapfile
13764         function.
13765         (class Output_data_fixed_space): Likewise.
13766         (class Output_data_space): Likewise.
13767         (class Output_data_zero_fill): New class.
13768         (Output_data_strtab::do_print_to_mapfile): New function.
13769         (Output_data_reloc_base::do_print_to_mapfile): New function.
13770         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13771         (Output_data_group::do_print_to_mapfile): New function.
13772         (Output_data_got::do_print_to_mapfile): New function.
13773         (Output_data_dynamic::do_print_to_mapfile): New function.
13774         (Output_symtab_xindex::do_print_to_mapfile): New function.
13775         (class Output_section): Declare do_print_to_mapflie.  Declare
13776         print_to_mapfile in Input_section.
13777         (class Output_segment): Declare new functions.
13778         * object.h (Sized_relobj::symbol_count): New function.
13779         * script-sections.cc
13780         (Output_section_element_dot_assignment::set_section_addresses):
13781         Change Output_data_fixed_space to Output_data_zero_fill.
13782         (Output_data_expression::do_print_to_mapfile): New function.
13783         * script.cc (read_input_script): Add mapfile parameter.  Change
13784         all callers.
13785         * script.h (read_input_script): Update declaration.
13786         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13787         (Eh_frame::do_print_to_mapfile): New function.
13788         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13789         (Output_merge_string::do_print_to_mapfile): New function.
13790         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13791         function.
13792         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13793         function.
13794         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13795         function.
13796         * Makefile.am (CCFILES): Add mapfile.cc.
13797         (HFILES): Add mapfile.h.
13798         * Makefile.in: Rebuild.
13799
13800 2008-05-19  Ian Lance Taylor  <iant@google.com>
13801
13802         * options.h (class General_options): Add -z relro.
13803         * layout.cc (Layout::Layout): Initialize relro_segment_.
13804         (Layout::add_output_section_data): Return the output section.
13805         (Layout::make_output_section): Rcognize relro sections and mark
13806         them appropriately.
13807         (Layout::attach_allocated_section_to_segment): Put relro sections
13808         in a PT_GNU_RELRO segment.
13809         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13810         section as relro.
13811         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13812         PT_TLS segments.
13813         (Layout::linkonce_mapping): Map d.rel.ro.local to
13814         .data.rel.ro.local.
13815         (Layout::output_section_name): Us .data.rel.ro.local for any
13816         section which begins with that.
13817         * layout.h (class Layout): Update add_output_section_data
13818         declaration.  Add relro_segment_ field.
13819         * output.cc (Output_section::Output_section): Initialize is_relro_
13820         and is_relro_local_ fields.
13821         (Output_segment::add_output_section): Group relro sections.
13822         (Output_segment::is_first_section_relro): New function.
13823         (Output_segment::maximum_alignment): If there is a relro section,
13824         align the segment to the common page size.
13825         (Output_segment::set_section_addresses): Track whether we are
13826         looking at relro sections.  If the last section is a relro
13827         section, align to the common page size.
13828         (Output_segment::set_section_list_addresses): Add in_relro
13829         parameter.  Change all callers.  Align to the page size when
13830         moving from relro to non-relro section.
13831         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13832         segment.
13833         * output.h (class Output_section): Add is_relro_ and
13834         is_relro_local_ fields.
13835         (Output_section::is_relro): New function.
13836         (Output_section::set_is_relro): New function.
13837         (Output_section::is_relro_local): New function.
13838         (Output_section::set_is_relro_local): New function.
13839         (class Output_segment): Update declarations.
13840         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13841         * sparc.cc (Target_sparc::got_section): Likewise.
13842         * x86_64.cc (Target_x86_64::got_section): Likewise.
13843         * testsuite/relro_test_main.cc: New file.
13844         * testsuite/relro_test.cc: New file.
13845         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13846         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13847         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13848         (relro_test.so, relro_test_pic.o): New targets.
13849         * testsuite/Makefile.in: Rebuild.
13850
13851 2008-05-16  Ian Lance Taylor  <iant@google.com>
13852
13853         * output.cc (Output_segment::add_output_section): Remove front
13854         parameter.
13855         * output.h (class Output_segment): Remove
13856         add_initial_output_section and overloaded add_output_section.
13857         Update declaration of remaining add_output_section.
13858         * layout.cc (Layout::create_interp): Call add_output_section
13859         rather than add_initial_output_section.
13860         (Layout::finish_dynamic_section): Likewise.
13861
13862         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13863         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13864         know the dynamic type.
13865         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13866         field.  Initialize it in constructor.
13867         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13868         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13869         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13870         reloc.
13871
13872         * output.cc (Output_reloc::get_address): Change return type to
13873         Elf_Addr.
13874         * output.h (class Output_reloc): Update get_address declaration.
13875         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13876         for section addresses.
13877
13878 2008-05-09  Ian Lance Taylor  <iant@google.com>
13879
13880         PR 6493
13881         * gold.cc (gold_nomem): Use return value of write.
13882
13883 2008-05-08  Ian Lance Taylor  <iant@google.com>
13884
13885         * symtab.c (Symbol::init_base_output_data): Add version
13886         parameter.  Change all callers.
13887         (Symbol::init_base_output_segment): Likewise.
13888         (Symbol::init_base_constant): Likewise.
13889         (Symbol::init_base_undefined): Likewise.
13890         (Sized_symbol::init_output_data): Likewise.
13891         (Sized_symbol::init_output_segment): Likewise.
13892         (Sized_symbol::init_constant): Likewise.
13893         (Sized_symbol::init_undefined): Likewise.
13894         (Symbol_table::do_define_in_output_data): If the new symbol has a
13895         version, mark it as the default.
13896         (Symbol_table::do_define_in_output_segment): Likewise.
13897         (Symbol_table::do_define_as_constant): Likewise.
13898         * symtab.h (class Symbol): Update declarations.
13899         (class Sized_symbol): Likewise.
13900         * resolve.cc (Symbol::override_version): New function.
13901         (Symbol::override_base): Call override_version.
13902         (Symbol::override_base_with_special): Likewise.
13903         * testsuite/ver_script_8.script: New file.
13904         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
13905         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
13906         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
13907         (ver_test_8_1.so, ver_test_8_2.so): New targets.
13908
13909 2008-05-06  Ian Lance Taylor  <iant@google.com>
13910
13911         PR 6049
13912         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
13913         functions.
13914         (class General_options): Remove existing --undefined, and add
13915         --no-undefined instead.  Add new --undefined as synonym for -u.
13916         * archive.cc (Archive::add_symbols): Check whether symbol was
13917         named with -u.
13918         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
13919         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
13920         all uses.  Add IS_UNDEFINED.  Update declarations to split
13921         different versions of init_base.  Declare init_base_undefined.
13922         (Symbol::is_defined): Handle IS_UNDEFINED.
13923         (Symbol::is_undefined): Likewise.
13924         (Symbol::is_weak_undefined): Call is_undefined.
13925         (Symbol::is_absolute): Handle IS_CONSTANT.
13926         (class Sized_symbol): Update declarations to split different
13927         versions of init.  Declare init_undefined.
13928         (class Symbol_table): Declare new functions.
13929         * symtab.cc (Symbol::init_base_object): Rename from init_base.
13930         Change all callers.
13931         (Symbol::init_base_output_data): Likewise.
13932         (Symbol::init_base_output_segment): Likewise.
13933         (Symbol::init_base_constant): Likewise.
13934         (Symbol::init_base_undefined): New function.
13935         (Sized_symbol::init_object): Rename from init.  Change all
13936         callers.
13937         (Sized_symbol::init_output_data): Likewise.
13938         (Sized_symbol::init_output_segment): Likewise.
13939         (Sized_symbol::init_constant): Likewise.
13940         (Sized_symbol::init_undefined): New function.
13941         (Symbol_table::add_undefined_symbols_from_command_line): New
13942         function.
13943         (Symbol_table::do_add_undefined_symbols_from_command_line): New
13944         function.
13945         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
13946         (Symbol::output_section): Likewise.
13947         (Symbol::set_output_section): Likewise.
13948         (Symbol_table::sized_finalize_symbol): Likewise.
13949         (Symbol_table::sized_write_globals): Likewise.
13950         * resolve.cc (Symbol_table::should_override): Likewise.
13951         (Symbol::override_base_with_special): Likewise.
13952
13953         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
13954         symbol, change it to have default visibility.
13955         * testsuite/protected_1.cc: New file.
13956         * testsuite/protected_2.cc: New file.
13957         * testsuite/protected_3.cc: New file.
13958         * testsuite/protected_main_1.cc: New file.
13959         * testsuite/protected_main_2.cc: New file.
13960         * testsuite/protected_main_3.cc: New file.
13961         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
13962         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
13963         (protected_1_LDFLAGS, protected_1_LDADD): Define.
13964         (protected_1.so): New target.
13965         (protected_1_pic.o, protected_2_pic.o): New targets.
13966         (protected_3_pic.o): New target.
13967         (check_PROGRAMS): Add protected_2.
13968         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
13969         (protected_2_LDFLAGS, protected_2_LDADD): Define.
13970         * testsuite/Makefile.in: Rebuild.
13971
13972         * options.h (DEFINE_var): Add set_user_set_##varname__.
13973         (DEFINE_bool_alias): New macro.
13974         (class General_options): Define -Bstatic using DEFINE_bool_alias
13975         rather than DEFINE_special.  Add --undefined as an alias for -z
13976         defs.
13977         * options.cc (General_options::parse_Bstatic): Remove.
13978
13979         * options.h (class General_options): Add --fatal-warnings.
13980         * main.cc (main): Implement --fatal-warnings.
13981         * errors.h (Errors::warning_count): New function.
13982
13983         * options.h (class General_options): Add -Bsymbolic-functions.
13984         * symtab.h (Symbol::is_preemptible): Check for
13985         -Bsymbolic-functions.
13986
13987 2008-05-05  Ian Lance Taylor  <iant@google.com>
13988
13989         * options.h (DEFINE_bool): For DASH_Z, create the negative option
13990         as noVARNAME rather than no-VARNAME.
13991         (class General_options): Add option -z combreloc.
13992         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
13993         get_address.
13994         (Output_reloc::sort_before) [SHT_REL]: New function.
13995         (Output_reloc::sort_before) [SHT_RELA]: New function.
13996         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
13997         Sort_relocs_comparison.
13998         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
13999         parameter.  Change all callers.
14000         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14001         sort_relocs parameter.  Change all callers.
14002         * output.cc (Output_reloc::get_address): New function, broken out
14003         of write_rel.
14004         (Output_reloc::write_rel): Call it.
14005         (Output_reloc::compare): New function.
14006         (Output_data_reloc_base::do_write): Optionally sort relocs.
14007
14008         * configure.ac: If targ_extra_obj is set, link it in.
14009         * configure.tgt: Initialize all variables.
14010         (x86_64*): Set targ_extra_obj and targ_extra_size.
14011         * configure: Rebuild.
14012
14013         * object.cc (Sized_relobj::include_section_group): Adjust section
14014         indexes read from group data.  Build vector to pass to
14015         layout_group.
14016         * layout.cc (Layout::layout_group): Add flags and shndxes
14017         parameters.  Remove contents parameter.  Change caller.  Update
14018         explicit instantiations.
14019         * layout.h (class Layout): Update layout_group declaration.
14020         * output.cc (Output_data_group::Output_data_group): Add flags and
14021         input_shndxes parameters.  Remove contents parameter.  Change
14022         caller.
14023         (Output_data_group::do_write): Change input_sections_ to
14024         input_shndxes_.
14025         * output.h (class Output_data_group): Update constructor
14026         declaration.  Rename input_sections_ to input_shndxes_.
14027         * testsuite/many_sections_test.cc: Add template.
14028
14029 2008-04-30  Cary Coutant  <ccoutant@google.com>
14030
14031         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14032
14033         * layout.cc (Layout::include_section): Refactored check for debug
14034         info section.
14035         (Layout::add_comdat): Add new parameters.  Change type
14036         of signature parameter.  Add object and shndx to signatures table.
14037         (Layout::find_kept_object): New function.
14038         * layout.h: Include <cstring>.
14039         (Layout::is_debug_info_section): New function.
14040         (Layout::add_comdat): Add new parameters.
14041         (Layout::find_kept_object): New function.
14042         (Layout::Kept_section): New struct.
14043         (Layout::Signatures): Change type of map range.
14044         * object.cc (Relobj::output_section_address): New function.
14045         (Sized_relobj::include_section_group): Add new parameters.  Change
14046         calls to Layout::add_comdat.  Change to build table of kept comdat
14047         groups and table mapping discarded sections to kept sections.
14048         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14049         (Sized_relobj::do_layout): Change calls to include_section_group and
14050         include_linkonce_section.
14051         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14052         value to zero when section is discarded.
14053         (Sized_relobj::map_to_kept_section): New function.
14054         * object.h (Relobj::output_section_address): New function.
14055         (Relobj::Comdat_group): New type.
14056         (Relobj::find_comdat_group): New function.
14057         (Relobj::Comdat_group_table): New type.
14058         (Relobj::Kept_comdat_section): New type.
14059         (Relobj::Kept_comdat_section_table): New type.
14060         (Relobj::add_comdat_group): New function.
14061         (Relobj::set_kept_comdat_section): New function.
14062         (Relobj::get_kept_comdat_section): New function.
14063         (Relobj::comdat_groups_): New field.
14064         (Relobj::kept_comdat_sections_): New field.
14065         (Symbol_value::input_value): Update comment.
14066         (Sized_relobj::map_to_kept_section) New function.
14067         (Sized_relobj::include_linkonce_section): Add new parameter.
14068         * target-reloc.h (Comdat_behavior): New type.
14069         (get_comdat_behavior): New function.
14070         (relocate_section): Add code to map a discarded section to the
14071         corresponding kept section when applying a relocation.
14072
14073 2008-04-30  Craig Silverstein  <csilvers@google.com>
14074
14075         * dwarf_reader.cc (next_generation_count): New static var.
14076         (Addr2line_cache_entry): New struct.
14077         (addr2line_cache): New static var.
14078         (Dwarf_line_info::one_addr2line): Added caching.
14079         (Dwarf_line_info::clear_addr2line_cache): New function.
14080         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14081         cache-size parameter.
14082         (Dwarf_line_info::one_addr2line_cache): New function.
14083         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14084         new cache-size argument to one_addr2line(), and clear cache.
14085
14086 2008-04-28  Cary Coutant  <ccoutant@google.com>
14087
14088         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14089         R_386_PC8 relocations.
14090
14091 2008-04-23  Ian Lance Taylor  <iant@google.com>
14092
14093         * object.cc (Sized_relobj::include_section_group): Check for
14094         invalid section group.
14095
14096         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14097         header size.
14098
14099         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14100         than read for file header.
14101         * archive.cc (Archive::include_member): Likewise.
14102
14103 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14104
14105         * aclocal.m4: Regenerate.
14106         * configure: Regenerate.
14107
14108 2008-04-19  Ian Lance Taylor  <iant@google.com>
14109
14110         * version.cc (version_string): Bump to 1.6.
14111
14112         * testsuite/Makefile.am (many_sections_r_test): New target.
14113         (many_sections_r_test_SOURCES): Remove.
14114         (many_sections_r_test_DEPENDENCIES): Remove.
14115         (many_sections_r_test_LDFLAGS): Remove.
14116         (many_sections_r_test_LDADD): Remove.
14117
14118         * object.cc (Sized_relobj::do_add_symbols): Always pass
14119         local_symbol_count_ to add_from_relobj.
14120
14121         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14122         every thousand variables.
14123         * testsuite/Makefile.in: Rebuild.
14124
14125         * object.cc (Xindex::initialize_symtab_xindex): New function.
14126         (Xindex::read_symtab_xindex): New function.
14127         (Xindex::sym_xindex_to_shndx): New function.
14128         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14129         available.
14130         (Sized_relobj::do_initialize_xindex): New function.
14131         (Sized_relobj::do_read_symbols): Adjust section links.
14132         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14133         parameter.  Change all callers.
14134         (Sized_relobj::include_section_group): Adjust section links and
14135         symbol section indexes.
14136         (Sized_relobj::do_layout): Adjust section links.
14137         (Sized_relobj::do_count_local_symbols): Adjust section links and
14138         symbol section indexes.
14139         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14140         ordinary and special symbols.
14141         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14142         dynsym_xindex parameters.  Change all callers.  Adjust section
14143         links.  Use SHN_XINDEX when needed.
14144         (Sized_relobj::get_symbol_location_info): Adjust section links.
14145         Don't get fooled by special symbols.
14146         * object.h (class Xindex): Define.
14147         (class Object): Add xindex_ parameter.  Declare virtual functoin
14148         do_initialize_xindex.
14149         (Object::adjust_sym_shndx): New function.
14150         (Object::set_xindex): New protected function.
14151         (class Symbol_value): Add is_ordinary_shndx_ field.
14152         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14153         (Symbol_value::value): Assert ordinary section.
14154         (Symbol_value::initialize_input_to_output_map): Likewise.
14155         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14156         Change all callers.
14157         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14158         all callers.
14159         (class Sized_relobj): Update declarations.
14160         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14161         parameter.  Change all callers.
14162         (Sized_relobj::adjust_shndx): New function.
14163         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14164         field.
14165         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14166         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14167         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14168         (Sized_dynobj::read_dynsym_section): Adjust section links.
14169         (Sized_dynobj::read_dynamic): Likewise.
14170         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14171         section links.
14172         (Sized_dynobj::do_initialize_xindex): New function.
14173         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14174         do_initialize_xindex.
14175         (Sized_dynobj::adjust_shndx): New function.
14176         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14177         dynsym_xindex_ fields.
14178         (Layout::finalize): Add a call to set_section_indexes before
14179         creating the symtab sections.
14180         (Layout::set_section_indexes): Don't do anything if the section
14181         already has a section index.
14182         (Layout::create_symtab_sections): Add shnum parameter.  Change
14183         caller.  Create .symtab_shndx section if needed.
14184         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14185         caller.
14186         (Layout::allocated_output_section_count): New function.
14187         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14188         needed.
14189         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14190         fields.  Update declarations.
14191         (Layout::symtab_xindex): New function.
14192         (Layout::dynsym_xindex): New function.
14193         (class Write_symbols_task): Add layout_ field.
14194         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14195         Change caller.
14196         * output.cc (Output_section_headers::Output_section_headers): Add
14197         shstrtab_section parameter.  Change all callers.
14198         (Output_section_headers::do_sized_write): Store overflow values
14199         for section count and section string table section index in
14200         section header zero.
14201         (Output_file_header::do_sized_write): Check for overflow of
14202         section count and section string table section index.
14203         (Output_symtab_xindex::do_write): New function.
14204         (Output_symtab_xindex::endian_do_write): New function.
14205         * output.h (class Output_section_headers): Add shstrtab_section_.
14206         Update declarations.
14207         (class Output_symtab_xindex): Define.
14208         (Output_section::has_out_shndx): New function.
14209         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14210         field.
14211         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14212         Change all callers.
14213         (Sized_symbol::init): Likewise.
14214         (Symbol::output_section): Check for ordinary symbol.
14215         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14216         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14217         callers.
14218         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14219         Change all callers.  Simplify handling of symbols from sections
14220         not included in the link.
14221         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14222         distinction.
14223         (Weak_alias_sorter::operator()): Assert that symbols are
14224         ordinary.
14225         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14226         distinction.
14227         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14228         parameters.  Change all callers.
14229         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14230         symbol distinction.  Use SHN_XINDEX when needed.
14231         (Symbol_table::write_section_symbol): Add symtab_xindex
14232         parameter.  Change all callers.
14233         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14234         SHN_XINDEX when needed.
14235         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14236         declarations.
14237         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14238         (Symbol::is_defined): Check is_ordinary.
14239         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14240         (Symbol::is_absolute, Symbol::is_common): Likewise.
14241         (class Sized_symbol): Update declarations.
14242         (class Symbol_table): Update declarations.
14243         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14244         parameters.  Change all callers.
14245         (Sized_symbol::override): Likewise.
14246         (Symbol_table::override): Likewise.
14247         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14248         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14249         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14250         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14251         to be in an ordinary section.
14252         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14253         object and is_ordinary parameters.  Change all callers.
14254         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14255         Change all callers.  Don't add undefined or non-ordinary symbols
14256         to reloc_map_.
14257         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14258         Change all callers.
14259         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14260         declarations.
14261         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14262         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14263         (Sized_relobj::relocate_sections): Likewise.
14264         * target-reloc.h (scan_relocs): Adjust section symbol index.
14265         (scan_relocatable_relocs): Likewise.
14266         * i386.cc (Scan::local): Check for ordinary symbols.
14267         * sparc.cc (Scan::local): Likewise.
14268         * x86_64.cc (Scan::local): Likewise.
14269         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14270         to symbol_section_and_value.
14271         * testsuite/many_sections_test.cc: New file.
14272         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14273         (check_PROGRAMS): Add many_sections_test.
14274         (many_sections_test_SOURCES): Define.
14275         (many_sections_test_DEPENDENCIES): Define.
14276         (many_sections_test_LDFLAGS): Define.
14277         (BUILT_SOURCES): Add many_sections_define.h.
14278         (many_sections_define.h): New target.
14279         (BUILT_SOURCES): Add many_sections_check.h.
14280         (many_sections_check.h): New target.
14281         (check_PROGRAMS): Add many_sections_r_test.
14282         (many_sections_r_test_SOURCES): Define.
14283         (many_sections_r_test_DEPENDENCIES): Define.
14284         (many_sections_r_test_LDFLAGS): Define.
14285         (many_sections_r_test_LDADD): Define.
14286         (many_sections_r_test.o): New target.
14287         * testsuite/Makefile.in: Rebuild.
14288
14289 2008-04-17  Cary Coutant  <ccoutant@google.com>
14290
14291         * errors.cc (Errors::info): New function.
14292         (gold_info): New function.
14293         * errors.h (Errors::info): New function.
14294         * gold.h (gold_info): New function.
14295         * object.cc (Input_objects::add_object): Print trace output.
14296         * options.cc (options::parse_set): New function.
14297         (General_options::parse_wrap): Deleted.
14298         (General_options::General_options): Deleted initializer.
14299         * options.h (options::String_set): New typedef.
14300         (options::parse_set): New function.
14301         (DEFINE_set): New macro.
14302         (General_options::wrap): Changed to use DEFINE_set. Changed
14303         callers of any_wrap_symbols and is_wrap_symbol.
14304         (General_options::trace, General_options::trace_symbol):
14305         New options.
14306         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14307         (General_options::wrap_symbols_): Deleted.
14308         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14309
14310 2008-04-17  David S. Miller  <davem@davemloft.net>
14311
14312         * options.cc (General_options::parse_V): New function.
14313         * options.h: Add entries for -V and -Qy.
14314
14315 2008-04-17  Ian Lance Taylor  <iant@google.com>
14316
14317         * common.cc (Symbol_table::allocate_commons): Remove options
14318         parameter.  Change caller.
14319         (Symbol_table::do_allocate_commons): Remove options parameter.
14320         Change caller.  Just call do_allocate_commons_list twice.
14321         (Symbol_table::do_allocate_commons_list): New function, broken out
14322         of do_allocate_commons.
14323         * common.h (class Allocate_commons_task): Remove options_ field.
14324         Update constructor.
14325         * symtab.cc (Symbol_table::Symbol_table): Initialize
14326         tls_commons_.
14327         (Symbol_table::add_from_object): Put TLS common symbols on
14328         tls_commons_ list.
14329         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14330         which are IN_OUTPUT_DATA.
14331         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14332         allocate_commons and do_allocate_commons declarations.  Declare
14333         do_allocate_commons_list.
14334         * gold.cc (queue_middle_tasks): Update creation of
14335         Allocate_commons_task to not pass options.
14336         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14337         (TLS_TEST_C_FLAGS): New variable.
14338         (tls_test_c_pic.o): New target.
14339         (tls_test_shared.so): Link in tls_test_c_pic.o.
14340         (tls_test_c_pic_ie.o): New target.
14341         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14342         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14343         (tls_test_c.o): New target.
14344         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14345         (tls_pic_test_LDADD): Likewise.
14346         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14347         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14348         (tls_test_c_gnu2.o): New target.
14349         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14350         tls_test_c_gnu2.o.
14351         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14352         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14353         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14354         * testsuite/tls_test.cc: Include "config.h".
14355         (t_last): Call t11_last.
14356         * testsuite/tls_test.h (t11, t11_last): Declare.
14357         * testsuite/tls_test_c.c: New file.
14358         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14359         * configure.ac: Check for OpenMP support.
14360         * configure, config.in, Makefile.in: Rebuild.
14361         * testsuite/Makefile.in: Rebuild.
14362
14363 2008-04-16  Cary Coutant  <ccoutant@google.com>
14364
14365         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14366         (Target_i386::tls_base_symbol_defined_): New field.
14367         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14368         (Target_i386::Scan::global): Likewise.
14369         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14370         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14371         (Target_x86_64::tls_base_symbol_defined_): New field.
14372         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14373         (Target_x86_64::Scan::global): Likewise.
14374
14375 2008-04-16  Cary Coutant  <ccoutant@google.com>
14376
14377         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14378         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14379         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14380         building shared libraries.
14381         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14382         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14383         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14384         * testsuite/Makefile.in: Rebuild.
14385         * testsuite/weak_undef.h: New file.
14386         * testsuite/weak_undef_file1.cc: Add extra test cases.
14387         * testsuite/weak_undef_file2.cc: Likewise.
14388         * testsuite/weak_undef_test.cc: Likewise.
14389
14390 2008-04-16  David S. Miller  <davem@davemloft.net>
14391
14392         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14393         Add issued_non_pic_error_ field.  Declare check_non_pic.
14394         (Target_sparc::Scan::check_non_pic): New function.
14395         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14396         (Target_sparc::Scan::global): Likewise.
14397
14398         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14399         * configure: Rebuild.
14400
14401         * options.h (DEFINE_enable): New macro.
14402         (new_dtags): New enable option.
14403         (initfirst, interpose, loadfltr, nodefaultlib,
14404         nodelete, nodlopen, nodump): New -z options.
14405         * layout.cc (Layout:finish_dynamic_section): If new
14406         dtags enabled, emit DT_RUNPATH.  Also, emit a
14407         DT_FLAGS_1 containing any specified -z flags.
14408
14409 2008-04-16  Ian Lance Taylor  <iant@google.com>
14410
14411         * copy-relocs.cc: New file.
14412         * copy-relocs.h: New file.
14413         * reloc.cc: Remove Copy_relocs code.
14414         * reloc.h: Likewise.
14415         * reloc-types.h (struct Reloc_types) [both versions]: Add
14416         get_reloc_addend_noerror.
14417         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14418         variants of add_global which take an addend which must be zero.
14419         * i386.cc: Include "copy-relocs.h".
14420         (class Target_i386): Change type of copy_relocs_ to variable,
14421         update initializer.
14422         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14423         Change all callers.
14424         (Target_i386::do_finalize_sections): Change handling of
14425         copy_relocs_.
14426         * sparc.cc: Include "copy-relocs.h".
14427         (class Target_sparc): Change type of copy_relocs_ to variable,
14428         update initializer.
14429         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14430         Change all callers.
14431         (Target_sparc::do_finalize_sections): Change handling of
14432         copy_relocs_.
14433         * x86_64.cc: Include "copy-relocs.h".
14434         (class Target_x86_64): Change type of copy_relocs_ to variable,
14435         update initializer.
14436         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14437         class.  Change all callers.
14438         (Target_x86_64::do_finalize_sections): Change handling of
14439         copy_relocs_.
14440         * Makefile.am (CCFILES): Add copy-relocs.cc.
14441         (HFILES): Add copy-relocs.h.
14442
14443         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14444
14445         * testsuite/script_test_4.sh: Permit leading zeroes.
14446
14447 2008-04-15  Ian Lance Taylor  <iant@google.com>
14448
14449         * script-sections.cc (Script_sections::create_segments): Use
14450         header_size_adjustment even when there is enough room for the
14451         headers.
14452         * testsuite/script_test_4.sh: New file.
14453         * testsuite/script_test_4.t: New file.
14454         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14455         (check_DATA): Add script_test_4.stdout.
14456         (MOSTLYCLEANFILES): Likewise.
14457         (script_test_4): New target.
14458         (script_test_4.stdout): New target.
14459         * testsuite/Makefile.in: Rebuild.
14460
14461         * sparc.cc: Add definitions for Output_data_plt_sparc class
14462         constants.
14463
14464 2008-04-14  David S. Miller  <davem@davemloft.net>
14465
14466         * sparc.cc: New file.
14467         * Makefile.am (TARGETSOURCES): Add sparc.cc
14468         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14469         * configure.tgt: Document targ_extra_size and
14470         targ_extra_big_endian.  Add entries for sparc-* and
14471         sparc64-*.
14472         * configure.ac: Handle targ_extra_size and
14473         targ_extra_big_endian.
14474         * Makefile.in: Rebuild.
14475         * configure: Likewise.
14476         * po/POTFILES.in: Likewise.
14477         * po/gold.pot: Likewise.
14478
14479 2008-04-14  Ian Lance Taylor  <iant@google.com>
14480
14481         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14482         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14483         in the name/type/flags to section mapping.  Don't call
14484         allocate_output_section.
14485         (Layout::choose_output_section): Change parameter from adjust_name
14486         to is_input_section.  Don't permit input sections after sections
14487         are attached to segments.  Don't call allocate_output_section.
14488         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14489         not write_enable_output_section.
14490         (Layout::make_output_section): Don't push to
14491         unattached_section_list_ nor call attach_to_segment.  Call
14492         attach_section_to_segment if sections are attached.
14493         (Layout::attach_sections_to_segments): New function.
14494         (Layout::attach_section_to_segment): New function.
14495         (Layout::attach_allocated_section_to_segment): Rename from
14496         attach_to_segment.  Remove flags parameter.
14497         (Layout::allocate_output_section): Remove function.
14498         (Layout::write_enable_output_section): Remove function.
14499         * layout.h (class Layout): Update for above changes.  Add new
14500         field sections_are_attached_.
14501         * output.h (Output_section::update_flags_for_input_section): New
14502         function.
14503         * output.cc (Output_section::add_input_section): Call
14504         update_flags_for_input_section.
14505         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14506
14507 2008-04-11  Cary Coutant  <ccoutant@google.com>
14508
14509         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14510         thought unnecessary.
14511         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14512
14513 2008-04-11  Ian Lance Taylor  <iant@google.com>
14514
14515         * output.h (class Output_section_data): Remove inline definition
14516         of set_addralign.
14517         * output.cc (Output_section_data::set_addralign): New function.
14518
14519 2008-04-11  Cary Coutant  <ccoutant@google.com>
14520
14521         Add support for TLS descriptors for i386 and x86_64.
14522         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14523         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14524         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14525         GOT_TYPE_TLS_DESC.
14526         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14527         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14528         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14529         relocations.
14530         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14531         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14532         Fix problem with initial-exec relocations.
14533         (Target_i386::Relocate::relocate_tls): Likewise.
14534         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14535         relaxation.
14536         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14537         support for section-plus-offset dynamic table entries.
14538         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14539         (Output_data_dynamic::Dynamic_entry): Add support for
14540         section-plus-offset dynamic table entries.
14541         (Output_data_dynamic::Classification): Likewise.
14542         (Output_data_dynamic::classification_): Renamed offset_.
14543         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14544         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14545         (Target_x86_64::make_plt_section): New function.
14546         (Target_x86_64::reserve_tlsdesc_entries): New function.
14547         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14548         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14549         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14550         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14551         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14552         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14553         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14554         add extra PLT entry for TLS descriptors.
14555         (Output_data_plt_x86_64::got_): New field.
14556         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14557         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14558         fields.
14559         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14560         descriptors.
14561         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14562         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14563         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14564         R_386_TLS_DESC_CALL relocations.
14565         (Target_x86_64::Scan::global): Likewise.
14566         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14567         for TLS descriptors.
14568         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14569         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14570         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14571         GD-to-IE relaxation.
14572         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14573         and TLS_DESCRIPTORS.
14574         * Makefile.in: Rebuild.
14575         * configure: Rebuild.
14576         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14577         (tls_test_shared2.so): New target.
14578         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14579         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14580         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14581         (tls_shared_gd_to_ie_test_LDADD): New variable.
14582         (tls_shared_gnu2_gd_to_ie_test): New target.
14583         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14584         New targets.
14585         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14586         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14587         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14588         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14589         (tls_shared_gnu2_test): New target.
14590         (tls_test_gnu2_shared.so): New target.
14591         (tls_shared_gnu2_test_SOURCES): New variable.
14592         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14593         (tls_shared_gnu2_test_LDFLAGS): New variable.
14594         (tls_shared_gnu2_test_LDADD): New variable.
14595         * testsuite/Makefile.in: Rebuild.
14596         * testsuite/Makefile.
14597
14598 2008-04-11  Ian Lance Taylor  <iant@google.com>
14599
14600         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14601         justsyms.t.
14602         * testsuite/Makefile.in: Rebuild.
14603
14604         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14605         long.
14606         * testsuite/script_test_2.cc (main): Adjust test.
14607
14608 2008-04-11  David S. Miller  <davem@davemloft.net>
14609             Ian Lance Taylor  <iant@google.com>
14610
14611         * options.h (General_options): Add entries for '-Y' and
14612         '-relax'.
14613         * options.cc (General_options:finalize): If -Y was used, add those
14614         entries to the library path instead of the default "/lib" and
14615         "/usr/lib".
14616
14617 2008-04-11  David S. Miller  <davem@davemloft.net>
14618
14619         * testsuite/justsyms.t: Start at 0x100.
14620         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14621         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14622         long.
14623         * testsuite/script_test_2.cc: Adjust string and section length
14624         checks.
14625
14626 2008-04-09  Ian Lance Taylor  <iant@google.com>
14627
14628         PR gold/5996
14629         * script-sections.cc (Sections_element::allocate_to_segment): Add
14630         orphan parameter.
14631         (Output_section_definition::allocate_to_segment): Likewise.
14632         (Orphan_output_section::allocate_to_segment): Likewise.
14633         (Script_sections::attach_sections_using_phdrs_clause): Don't
14634         propagate non-PT_LOAD segments to orphan sections.
14635         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14636         readelf rather than objdump.
14637         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14638         .interp section and PT_INTERP segment are the same size.
14639         * testsuite/Makefile.in: Rebuild.
14640
14641         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14642         aliases for symbols defined in the same object.
14643         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14644         (weak_alias_test_SOURCES): New variable.
14645         (weak_alias_test_DEPENDENCIES): New variable.
14646         (weak_alias_test_LDFLAGS): New variable.
14647         (weak_alias_test_LDADD): New variable.
14648         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14649         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14650         (weak_alias_test_3.o): New target.
14651         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14652         * testsuite/weak_alias_test_main.cc: New file.
14653         * testsuite/weak_alias_test_1.cc: New file.
14654         * testsuite/weak_alias_test_2.cc: New file.
14655         * testsuite/weak_alias_test_3.cc: New file.
14656
14657 2008-04-08  Ian Lance Taylor  <iant@google.com>
14658
14659         * options.h (class General_options): Add --noinhibit-exec option.
14660         * main.cc (main): Check --noinhibit-exec.
14661
14662         * options.h (class General_options): Define --wrap as a special
14663         option.  Add wrap_symbols_ field.
14664         (General_options::any_wrap_symbols): New function.
14665         (General_options::is_wrap_symbol): New function.
14666         * options.cc (General_options::parse_wrap): New function.
14667         (General_options::General_options): Initialize wrap_symbols_.
14668         * symtab.cc (Symbol_table::wrap_symbol): New function.
14669         (Symbol_table::add_from_object): Handle --wrap.
14670         * symtab.h (class Symbol_table): Declare wrap_symbol.
14671         * target.h (Target::wrap_char): New function.
14672         (Target::Target_info): Add wrap_char field.
14673         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14674         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14675         * testsuite/testfile.cc (Target_test::test_target_info):
14676         Likewise.
14677
14678         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14679         there is one.
14680
14681         * layout.h (class Layout): Add added_eh_frame_data_ field.
14682         * layout.cc (Layout::Layout): Initialize new field.
14683         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14684         output section until we find a section we merged successfully.
14685         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14686         that the size be non-zero.
14687
14688         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14689         qualifier.
14690
14691 2008-04-08  Craig Silverstein  <csilvers@google.com>
14692
14693         * configure.ac: Export new conditional variable HAVE_ZLIB.
14694         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14695         on HAVE_ZLIB.
14696         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14697         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14698
14699 2008-04-07  Ian Lance Taylor  <iant@google.com>
14700
14701         * version.cc (version_string): Set to "1.5".
14702
14703         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14704         Add issued_non_pic_error_ field.  Declare check_non_pic.
14705         (Target_x86_64::Scan::check_non_pic): New function.
14706         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14707         (Target_x86_64::Scan::global): Likewise.
14708
14709         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14710         addend parameter.  Change caller.  Handle merge sections.
14711         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14712         Address to Addend.  Don't add in the result of
14713         local_section_offset, pass down the addend and use the returned
14714         value.
14715         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14716         Update declarations of local_section_offset and symbol_value.
14717         * testsuite/two_file_test_1.cc (t18): New function.
14718         * testsuite/two_file_test_2.cc (f18): New function.
14719         * testsuite/two_file_test_main.cc (main): Call t18.
14720         * testsuite/two_file_test.h (t18, f18): Declare.
14721
14722         * configure.ac: Don't test for objdump, c++filt, or readelf.
14723         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14724         conditionals.
14725         (TEST_READELF): New variable.
14726         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14727         (check_PROGRAMS): Add two_file_strip_test.
14728         (two_file_strip_test): New target.
14729         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14730         (two_file_same_shared_strip_test_SOURCES): New variable.
14731         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14732         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14733         (two_file_same_shared_strip_test_LDADD): New variable.
14734         (two_file_shared_strip.so): New target.
14735         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14736         (ver_test_5.syms, ver_test_7.syms): Likewise.
14737         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14738         (strip_test_3.stdout): Use TEST_OBJDUMP.
14739         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14740
14741 2008-04-04  Cary Coutant  <ccoutant@google.com>
14742
14743         * symtab.h (Symbol::is_weak_undefined): New function.
14744         (Symbol::is_strong_undefined): New function.
14745         (Symbol::is_absolute): New function.
14746         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14747         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14748         absolute symbols.
14749         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14750         (weak_undef_test): New target.
14751         * testsuite/Makefile.in: Rebuild.
14752         * testsuite/weak_undef_file1.cc: New file.
14753         * testsuite/weak_undef_file2.cc: New file.
14754         * testsuite/weak_undef_test.cc: New file.
14755
14756 2008-04-03  Craig Silverstein  <csilvers@google.com>
14757
14758         * compressed_output.h (class Output_compressed_section): Use
14759         unsigned buffer.
14760         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14761         add zlib header.
14762         (zlib_compressed_suffix): Removed.
14763         (Output_compressed_section::set_final_data_size): Use unsigned
14764         buffers.
14765         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14766         Fix linker invocation.
14767         (flagstest_o_specialfile_and_compress_debug_sections):
14768         Likewise.
14769         * testsuite/Makefile.in: Regenerated.
14770
14771 2008-04-02  David S. Miller  <davem@davemloft.net>
14772
14773         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14774         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14775
14776 2008-04-02  Craig Silverstein  <csilvers@google.com>
14777
14778         * TODO: New file.
14779
14780 2008-04-02  Ian Lance Taylor  <iant@google.com>
14781
14782         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14783         parameters.  Update for new key type to views_.  Change all
14784         callers.
14785         (File_read::read): Adjust for byteshift in returned view.
14786         (File_read::add_view): New function, broken out of
14787         find_and_make_view.
14788         (File_read::make_view): New function, broken out of
14789         find_and_make_view.
14790         (File_read::find_or_make_view): Add offset and aligned
14791         parameters.  Rewrite accordingly.  Change all callers.
14792         (File_read::get_view): Add offset and aligned parameters.  Adjust
14793         for byteshift in return value.
14794         (File_read::get_lasting_view): Likewise.
14795         * fileread.h (class File_read): Update declarations.
14796         (class File_read::View): Add byteshift_ field.  Add byteshift to
14797         constructor.  Add byteshift method.
14798         * archive.h (Archive::clear_uncached_views): New function.
14799         (Archive::get_view): Add aligned parameter.  Change all callers.
14800         * object.h (Object::get_view): Add aligned parameter.  Change all
14801         callers.
14802         (Object::get_lasting_view): Likewise.
14803
14804         * fileread.cc (File_read::release): Don't call clear_views if
14805         there are multiple objects.
14806         * fileread.h (File_read::clear_uncached_views): New function.
14807         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14808         on the archive.
14809
14810 2008-03-31  Cary Coutant  <ccoutant@google.com>
14811
14812         Add thin archive support.
14813         * archive.cc (Archive::armagt): New const.
14814         (Archive::setup): Remove task parameter and calls to unlock.
14815         (Archive::unlock_nested_archives): New function.
14816         (Archive::read_header): Add nested_off parameter. Change
14817         all callers.
14818         (Archive::interpret_header): Likewise.
14819         (Archive::include_all_members): Change to handle thin
14820         archives.
14821         (Archive::include_member): Likewise.
14822         * archive.h (Archive::Archive): Add new parameters and
14823         initializers.
14824         (Archive::armagt): New const.
14825         (Archive::setup): Remove task parameter.
14826         (Archive::unlock_nested_archives): New function.
14827         (Archive::read_header): Add nested_off parameter.
14828         (Archive::interpret_header): Likewise.
14829         (Archive::Nested_archive_table): New typedef.
14830         (Archive::is_thin_archive_): New field.
14831         (Archive::nested_archives_): New field.
14832         (Archive::options_): New field.
14833         (Archive::dirpath_): New field.
14834         (Archive::task_): New field.
14835         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14836         for thin archives.  Pass additional parameters to
14837         Archive::Archive.  Unlock the archive file after calling
14838         Archive::setup.
14839
14840 2008-03-29  Ian Lance Taylor  <iant@google.com>
14841
14842         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14843         version symbol to be local.
14844         * testsuite/ver_test_4.sh: New file.
14845         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14846         (check_DATA): Add ver_test_4.syms.
14847         (ver_test_4.syms): New target.
14848         * testsuite/Makefile.in: Rebuild.
14849
14850         * output.cc
14851         (Output_section::Input_section_sort_entry::has_priority): New
14852         function.
14853         (Output_section::Input_section_sort_entry::match_file_name): New
14854         function.
14855         (Output_section::Input_section_sort_entry::match_section_name):
14856         Remove.
14857         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14858         Remove.
14859         (Output_section::Input_section_sort_entry::match_section_file):
14860         Remove.
14861         (Output_section::Input_section_sort_compare::operator()): Rewrite
14862         using new Input_section_sort_entry functions.  Sort crtbegin and
14863         crtend first.  Sort sections with no priority before sections with
14864         a priority.
14865         * testsuite/initpri1.c (d3): Check j != 4.
14866         (cd5): New constructor/destructor function.
14867         (main): Check j != 2.
14868
14869         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14870         new symbol when resolving, don't call set_is_default.
14871         * testsuite/ver_test_7.cc: New file.
14872         * testsuite/ver_test_7.sh: New file.
14873         * testsuite/Makefile.am (ver_test_7.so): New target.
14874         (ver_test_7.o): New target.
14875         (check_SCRIPTS): Add ver_test_7.sh.
14876         (check_DATA): Add ver_test_7.syms.
14877         (ver_test_7.syms): New target.
14878
14879 2008-03-28  Ian Lance Taylor  <iant@google.com>
14880
14881         * layout.cc (Layout::layout): If we see an input section with a
14882         name that needs sorting, set the must_sort flag for the output
14883         section.
14884         (Layout::make_output_section): If the name of the output section
14885         indicates that it might require sorting, set the may_sort flag.
14886         * output.h (Output_section::may_sort_attached_input_sections): New
14887         function.
14888         (Output_section::set_may_sort_attached_input_sections): New
14889         function.
14890         (Output_section::must_sort_attached_input_sections): New
14891         function.
14892         (Output_section::set_must_sort_attached_input_sections): New
14893         function.
14894         (class Output_section): Declare Input_section_sort_entry.  Define
14895         Input_section_sort_compare.  Declare
14896         sort_attached_input_sections.  Add new fields:
14897         may_sort_attached_input_sections_,
14898         must_sort_attached_input_sections_,
14899         attached_input_sections_are_sorted_.
14900         * output.cc (Output_section::Output_section): Initialize new
14901         fields.
14902         (Output_section::add_input_section): Add an entry to
14903         input_sections_ if may_sort or must_sort are true.
14904         (Output_section::set_final_data_size): Call
14905         sort_attached_input_sections if necessary.
14906         (Output_section::Input_section_sort_entry): Define new class.
14907         (Output_section::Input_section_sort_compare::operator()): New
14908         function.
14909         (Output_section::sort_attached_input_sections): New function.
14910         * configure.ac: Check whether the compiler supports constructor
14911         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
14912         * testsuite/initpri1.c: New file.
14913         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
14914         CONSTRUCTOR_PRIORITY.
14915         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
14916         (initpri1_LDFLAGS): New variable.
14917         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14918
14919 2008-03-27  Ian Lance Taylor  <iant@google.com>
14920
14921         * common.cc (Sort_commons::operator): Correct sorting algorithm.
14922         * testsuite/common_test_1.c: New file.
14923         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
14924         (common_test_1_SOURCES): New variable.
14925         (common_test_1_DEPENDENCIES): New variable.
14926         (common_test_1_LDFLAGS): New variable.
14927
14928         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
14929         and commons_ correctly when NAME/VERSION does not override
14930         NAME/NULL.
14931         * testsuite/ver_test_6.c: New file.
14932         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
14933         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
14934         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
14935
14936 2008-03-26  Ian Lance Taylor  <iant@google.com>
14937
14938         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
14939         of an undefined symbol from a version script.
14940         * testsuite/Makefile.am (ver_test_5.so): New target.
14941         (ver_test_5.o): New target.
14942         (check_SCRIPTS): Add ver_test_5.sh.
14943         (check_DATA): Add ver_test_5.syms.
14944         (ver_test_5.syms): New target.
14945         * testsuite/ver_test_5.cc: New file.
14946         * testsuite/ver_test_5.script: New file.
14947         * testsuite/ver_test_5.sh: New file.
14948         * Makefile.in, testsuite/Makefile.in: Rebuild.
14949
14950         PR gold/5986
14951         Fix problems building gold with gcc 4.3.0.
14952         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
14953         (gold_error_at_location, gold_warning_at_location): Use it.
14954         * configure.ac: Check whether we can compile and use a template
14955         function with a printf attribute.
14956         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
14957         when jumping over bytes.
14958         * object.cc: Instantiate Object::read_section_data.
14959         * debug.h: Include <cstring>
14960         * dwarf_reader.cc: Include <algorithm>
14961         * main.cc: Include <cstring>.
14962         * options.cc: Include <cstring>.
14963         * output.cc: Include <cstring>.
14964         * script.cc: Include <cstring>.
14965         * script.h: Include <string>.
14966         * symtab.cc: Include <cstring> and <algorithm>.
14967         * target-select.cc: Include <cstring>.
14968         * version.cc: Include <string>.
14969         * testsuite/testmain.cc: Include <cstdlib>.
14970         * configure, config.in: Rebuild.
14971
14972 2008-03-25  Ian Lance Taylor  <iant@google.com>
14973
14974         * options.cc: Include "../bfd/bfdver.h".
14975         (options::help): Print bug reporting address.
14976
14977         * version.cc (print_version): Adjust output for current value of
14978         BFD_VERSION_STRING.
14979
14980         * NEWS: New file.
14981
14982         * options.cc (options::help): Print list of supported targets.
14983         * target-select.h: Include <vector>.
14984         (class Target_selector): Make machine_, size_, and is_big_endian_
14985         fields const.  Add bfd_name_ and instantiated_target_ fields.
14986         (Target_selector::Target_selector): Add bfd_name parameter.
14987         (Target_selector::recognize): Make non-virtual, call
14988         do_recognize.
14989         (Target_selector::recognize_by_name): Make non-virtual, call
14990         do_recognize_by_name.
14991         (Target_selector::supported_names): New function.
14992         (Target_selector::bfd_name): New function.
14993         (Target_selector::do_instantiate_target): New pure virtual
14994         function.
14995         (Target_selector::do_recognize): New virtual function.
14996         (Target_selector::do_recognize_by_name): New virtual function.
14997         (Target_selector::instantiate_target): New private function.
14998         (supported_target_names): Declare.
14999         * target-select.cc (Target_selector::Target_selector): Update for
15000         new parameter and fields.
15001         (select_target_by_name): Check that the name matches before
15002         calling recognize_by_name.
15003         (supported_target_names): New function.
15004         * i386.cc (class Target_selector_i386): Update Target_selector
15005         constructor call.  Remove recognize and recognize_by_name.  Add
15006         do_instantiate_target.
15007         * x86_64.cc (class Target_selector_x86_64): Likewise.
15008         * testsuite/testfile.cc (class Target_selector_test): Update for
15009         changes to Target_selector.
15010
15011         * README: Rewrite, with some notes on unsupported features.
15012
15013 2008-03-24  Cary Coutant  <ccoutant@google.com>
15014
15015         * i386.cc (Target_i386::Got_type): New enum declaration.
15016         (Target_i386::Scan::local): Updated callers of Output_data_got
15017         member functions.
15018         (Target_i386::Scan::global): Likewise.
15019         (Target_i386::Relocate::relocate): Likewise.
15020         (Target_i386::Relocate::relocate_tls): Likewise.
15021         * object.h (Got_offset_list): New class.
15022         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15023         (Sized_relobj::local_got_offset): Likewise.
15024         (Sized_relobj::set_local_got_offset): Likewise.
15025         (Sized_relobj::local_has_tls_got_offset): Removed.
15026         (Sized_relobj::local_tls_got_offset): Removed.
15027         (Sized_relobj::set_local_tls_got_offset): Removed.
15028         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15029         * output.cc (Output_data_got::add_global): Added got_type parameter.
15030         (Output_data_got::add_global_with_rel): Likewise.
15031         (Output_data_got::add_global_with_rela): Likewise.
15032         (Output_data_got::add_global_pair_with_rel): New function.
15033         (Output_data_got::add_global_pair_with_rela): New function.
15034         (Output_data_got::add_local): Added got_type parameter.
15035         (Output_data_got::add_local_with_rel): Likewise.
15036         (Output_data_got::add_local_with_rela): Likewise.
15037         (Output_data_got::add_local_pair_with_rel): New function.
15038         (Output_data_got::add_local_pair_with_rela): New function.
15039         (Output_data_got::add_global_tls): Removed.
15040         (Output_data_got::add_global_tls_with_rel): Removed.
15041         (Output_data_got::add_global_tls_with_rela): Removed.
15042         (Output_data_got::add_local_tls): Removed.
15043         (Output_data_got::add_local_tls_with_rel): Removed.
15044         (Output_data_got::add_local_tls_with_rela): Removed.
15045         * output.h (Output_data_got::add_global): Added got_type parameter.
15046         (Output_data_got::add_global_with_rel): Likewise.
15047         (Output_data_got::add_global_with_rela): Likewise.
15048         (Output_data_got::add_global_pair_with_rel): New function.
15049         (Output_data_got::add_global_pair_with_rela): New function.
15050         (Output_data_got::add_local): Added got_type parameter.
15051         (Output_data_got::add_local_with_rel): Likewise.
15052         (Output_data_got::add_local_with_rela): Likewise.
15053         (Output_data_got::add_local_pair_with_rel): New function.
15054         (Output_data_got::add_local_pair_with_rela): New function.
15055         (Output_data_got::add_global_tls): Removed.
15056         (Output_data_got::add_global_tls_with_rel): Removed.
15057         (Output_data_got::add_global_tls_with_rela): Removed.
15058         (Output_data_got::add_local_tls): Removed.
15059         (Output_data_got::add_local_tls_with_rel): Removed.
15060         (Output_data_got::add_local_tls_with_rela): Removed.
15061         * resolve.cc (Symbol::override_base_with_special): Removed
15062         reference to has_got_offset_ field.
15063         * symtab.cc (Symbol::init_fields): Replaced initialization
15064         of got_offset_ with got_offsets_.  Removed initialization
15065         of has_got_offset_
15066         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15067         (Symbol::got_offset): Likewise.
15068         (Symbol::set_got_offset): Likewise.
15069         (Symbol::has_tls_got_offset): Removed.
15070         (Symbol::tls_got_offset): Removed.
15071         (Symbol::set_tls_got_offset): Removed.
15072         (Symbol::got_offset_): Removed.
15073         (Symbol::tls_mod_got_offset_): Removed.
15074         (Symbol::tls_pair_got_offset_): Removed.
15075         (Symbol::got_offsets_): New field.
15076         (Symbol::has_got_offset): Removed.
15077         (Symbol::has_tls_mod_got_offset): Removed.
15078         (Symbol::has_tls_pair_got_offset): Removed.
15079         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15080         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15081         member functions.
15082         (Target_x86_64::Scan::global): Likewise.
15083         (Target_x86_64::Relocate::relocate): Likewise.
15084         (Target_x86_64::Relocate::relocate_tls): Likewise.
15085
15086 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15087
15088         * yyscript.y: Fix spelling error in comment.
15089
15090 2008-03-24  Ian Lance Taylor  <iant@google.com>
15091
15092         * options.h (class General_options): Define build_id option.
15093         * layout.h (class Layout): Declare write_build_id, create_note,
15094         create_build_id.  Add build_id_note_ member.
15095         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15096         "libiberty.h", "md5.h", "sha1.h".
15097         (Layout::Layout): Initialize eh_frame_data_,
15098         eh_frame_hdr_section_, and build_id_note_.
15099         (Layout::finalize): Call create_build_id.
15100         (Layout::create_note): New function, broken out of
15101         Layout::create_gold_note.
15102         (Layout::create_gold_note): Call create_note.
15103         (Layout::create_build_id): New function.
15104         (Layout::write_build_id): New function.
15105         (Close_task_runner::run): Call write_build_id.
15106
15107         * x86_64.cc: Correct license to GPLv3.
15108
15109 2008-03-23  Ian Lance Taylor  <iant@google.com>
15110
15111         * options.cc: Include "demangle.h".
15112         (parse_optional_string): New function.
15113         (parse_long_option): Handle takes_optional_argument.
15114         (parse_short_option): Update dash_z initializer.  Handle
15115         takes_optional_argument.
15116         (General_options::General_options): Initialize do_demangle_.
15117         (General_options::finalize): Set do_demangle_.  Handle demangling
15118         style.
15119         * options.h (parse_optional_string): Declare.
15120         (struct One_option): Add optional_arg field.  Update constructor.
15121         Update call constructor calls.  Add takes_optional_argument
15122         function.
15123         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15124         (DEFINE_optional_string): Define.
15125         (General_options::demangle): Change from DEFINE_bool to
15126         DEFINE_optional_string.
15127         (General_options::no_demangle): New function.
15128         (General_options::do_demangle): New function.
15129         (General_options::set_do_demangle): New function.
15130         (General_options::execstack_status_): Move definition to end of
15131         class definition.
15132         (General_options::static_): Likewise.
15133         (General_options::do_demangle_): New field.
15134         * object.cc (big_endian>::get_symbol_location_info): Call
15135         Options::do_demangle, not Options::demangle.
15136         * symtab.cc (demangle): Likewise.
15137
15138 2008-03-22  Ian Lance Taylor  <iant@google.com>
15139
15140         * gold.h: Include <cstddef> and <sys/types.h>
15141         * options.h: Include <cstring>.
15142
15143 2008-03-21  Ian Lance Taylor  <iant@google.com>
15144
15145         * Added source code to GNU binutils.
15146 \f
15147 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15148
15149 Copying and distribution of this file, with or without modification,
15150 are permitted in any medium without royalty provided the copyright
15151 notice and this notice are preserved.
15152
15153 Local Variables:
15154 mode: change-log
15155 left-margin: 8
15156 fill-column: 74
15157 version-control: never
15158 End: