gold: x86_64-nacl: Correct 9-byte nop sequence to match what the assembler generates.
[external/binutils.git] / gold / ChangeLog
1 2013-10-30  Roland McGrath  <mcgrathr@google.com>
2
3         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
4         Correct 9-byte nop sequence to match what the assembler generates.
5
6 2013-10-30  Alan Modra  <amodra@gmail.com>
7
8         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
9         ppc64_local_entry_offset, ppc64_local_entry_offset,
10         do_read_symbols): New functions.
11         (Powerpc_relobj::e_flags_, st_other_): New vars.
12         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
13         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
14         (Powerpc_relobj::e_flags_): New var.
15         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
16         and adjust for ELFv2.
17         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
18         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
19         (Powerpc_dynobj::do_find_special_sections): Likewise.
20         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
21         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
22         to ELFv2 local entry.
23         (Target_powerpc::do_relax): No thread safe barriers needed for
24         ELFv2.
25         (Output_data_plt_powerpc::initial_plt_entry_size_,
26         plt_entry_size): Delete.  Replace all uses with
27         first_plt_entry_offset() and plt_entry_size().
28         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
29         reserved_size parm.  Update callers.
30         (Output_data_plt_powerpc::entry_count): Update.
31         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
32         and use Target_powerpc::first_plt_entry_offset().
33         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
34         rename to plt_entry_size.
35         (Output_data_plt_powerpc::add_ifunc_entry,
36         add_local_ifunc_entry): Adjust reloc for ELFv2.
37         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
38         (glink_eh_frame_fde_64v2): New.
39         (Stub_table::plt_call_size): Support ELFv2 sizing.
40         (Output_data_glink::add_eh_frame): Use the new FDE.
41         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
42         (Stub_table::do_write): Write ELFv2 stubs and glink.
43         (Target_powerpc::Relocate::relocate): Replaces nop after call
44         with ld 2,24(1) and adjust local offset destination for ELFv2.
45
46 2013-10-30  Alan Modra  <amodra@gmail.com>
47
48         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
49         (Target_powerpc::Scan::global, local): Likewise.
50         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
51         on all ppc64 @h and @ha relocs.
52
53 2013-10-14  Alan Modra  <amodra@gmail.com>
54
55         * output.h (Output_data_got::add_constant): Tidy.
56         (Output_data_got::add_constant_pair): New function.
57         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
58         methods used so as to first call reserve_ent().
59
60 2013-10-11  Roland McGrath  <mcgrathr@google.com>
61
62         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
63         add_got_entry and add_got_entry_pair.
64
65         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
66         (HAVE_PUBNAMES): Likewise.
67         * configure: Regenerate.
68
69         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
70         * testsuite/Makefile.in: Regenerate.
71
72         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
73         Remove const from declaration.
74         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
75         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
76         * output.h (Output_file_header): Remove const from member target_
77         and corresponding constructor argument.
78         * output.cc (Output_file_header::Output_file_header): Update prototype.
79         (Output_file_header::do_sized_write): Use this->target_ in place
80         of parameters()->target().
81
82         * testsuite/undef_symbol.cc (Foo::get_a): New method.
83
84         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
85         * configure: Regenerate.
86         * Makefile.in: Regenerate.
87         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
88         * testsuite/merge_string_literals_2.c: Likewise.
89         * testsuite/Makefile.am
90         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
91         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
92         literal -fmerge-constants.
93         * testsuite/Makefile.in: Regenerate.
94
95         * i386.cc (Target_i386): Remove unused member dynbss_.
96         * arm.cc (Target_arm): Likewise.
97         * powerpc.cc (Target_powerpc): Likewise.
98         * sparc.cc (Target_sparc): Likewise.
99         * tilegx.cc (Target_tilegx): Likewise.
100         * x86_64.cc (Target_x86_64): Likewise.
101         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
102         type_signature_, type_offset_.
103         * plugin.h (Plugin_hook): Remove unused member layout_.
104         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
105         mapfile_.
106         (Read_member): Remove unused members input_objects_, symtab_,
107         mapfile_, layout_.
108         (Check_library): Remove unused member symtab_.
109         * archive.h (Lib_group): Remove unused member lib_.
110         * archive.cc (Lib_group::Lib_group): Update initializer.
111         * incremental.h (Incremental_binary): Remove unused member target_.
112         (Incremental_script_entry): Removed unused member script_.
113         * layout.h (Write_symbols_task): Remove unused member input_objects_.
114         * icf.h (Icf): Remove unused member num_tracked_relocs.
115
116         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
117         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
118         its only use.
119         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
120
121         * archive.h: Use struct rather than class for forward declaration
122         of Read_symbols_data.
123
124 2013-10-07  Cary Coutant  <ccoutant@google.com>
125
126         PR gold/16010
127         * testsuite/Makefile.am (icf_test): Fix dependencies.
128         (icf_safe_test): Likewise.
129         (icf_safe_so_test): Likewise.
130         (large_symbol_alignment): Add empty _LDADD rule.
131         * testsuite/Makefile.in: Regenerate.
132
133 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
134
135         PR gold/15927
136         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
137         relocation for R_X86_64_32 on x32.
138
139 2013-08-27  Roland McGrath  <mcgrathr@google.com>
140
141         * output.cc (Output_segment::set_section_addresses): Take new
142         Target* argument.  If target->isolate_execinstr() and the segment
143         is executable and starts at a target->abi_pagesize() boundary,
144         pad its end out to a target->abi_pagesize() boundary with code fill.
145         * output.h (Output_segment::set_section_addresses): Update decl.
146         * layout.h (Layout::check_output_data_for_reset_values): Take new
147         argument RELAX_OUTPUTS.
148         (Layout): New member relax_output_list_.
149         (Layout::add_relax_output): New method.
150         * layout.cc (Layout::Layout): Update constructor.
151         (Layout::reset_relax_output): New method.
152         (Layout::clean_up_after_relaxation): Call it.
153         (Layout::prepare_for_relaxation): Update caller.
154         (Layout::set_segment_offsets): Update callers of set_section_addresses.
155         Call reset_relax_output before re-processing segments for
156         isolate_execinstr case.
157         (Layout::write_data): Handle relax_output_list_.
158         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
159         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
160
161 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
162
163         PR binutils/15834
164         * object.h: Fix typos.
165
166 2013-08-16  Roland McGrath  <mcgrathr@google.com>
167
168         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
169         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
170
171 2013-08-07  Cary Coutant  <ccoutant@google.com>
172
173         Revert support for v2 DWP files:
174
175         2013-03-01  Cary Coutant  <ccoutant@google.com>
176
177             Add dwp support for v2 DWARF package file format.
178             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
179             tu_length parameter.  Adjust all callers.
180             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
181             * dwp.cc: Include dwarf.h.
182             (Section_bounds): New struct type.
183             (Unit_set): New struct type.
184             (Dwo_file::Dwo_file): Initialize new data member.
185             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
186             Combine and rename to...
187             (Dwo_file::read_unit_index): ...this.
188             (Dwo_file::sized_read_compunit_index)
189             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
190             (Dwo_file::sized_read_unit_index): ...this.
191             (Dwo_file::copy_section): Remove section_name, is_str_offsets
192             parameters; add section_id parameter.
193             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
194             (Dwo_file::add_unit_set): ...this.
195             (Dwo_file::shndx_map_): Remove.
196             (Dwo_file::sect_offsets_): New data member.
197             (Dwp_output_file::Dwp_output_file): Initialize new data members.
198             (Dwp_output_file::add_section): Rename to...
199             (Dwp_output_file::add_contribution): ...this.
200             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
201             (Dwp_output_file::add_tu_set): Likewise.
202             (Dwp_output_file::Contribution): New type.
203             (Dwp_output_file::Section::contributions): New data member.
204             (Dwp_output_file::Cu_or_tu_set): Remove.
205             (Dwp_output_file::Section::Section): New ctor.
206             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
207             (Dwp_output_file::Dwp_index::Section_table): New type.
208             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
209             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
210             parameter.
211             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
212             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
213             (Dwp_output_file::Dwp_index::section_table): New member function.
214             (Dwp_output_file::Dwp_index::section_table_end): New member function.
215             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
216             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
217             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
218             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
219             (Dwp_output_file::Dwp_index::section_table_): New data member.
220             (Dwp_output_file::Dwp_index::section_mask_): New data member.
221             (Dwp_output_file::add_output_section): New member function.
222             (Dwp_output_file::write_new_section): New member function.
223             (Dwp_output_file::write_contributions): New member function.
224             (Dwp_output_file::section_id_map_): New data member.
225             (class Dwo_id_info_reader): Remove.
226             (class Unit_reader): New class.
227             (get_dwarf_section_name): New function.
228             (Dwo_file::read_executable): Adjust initializations of class data.
229             (Dwo_file::read): Add support for v2 package file format.
230             (Dwo_file::read_unit_index): Likewise.
231             (Dwo_file::sized_read_unit_index): Likewise.
232             (Dwo_file::copy_section): Likewise.
233             (Dwo_file::add_unit_set): Likewise.
234             (Dwp_output_file::add_output_section): Likewise.
235             (Dwp_output_file::add_contribution): Likewise.
236             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
237             for empty slot.
238             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
239             file format.
240             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
241             slot.
242             (Dwp_output_file::initialize): Remove unused function.
243             (Dwp_output_file::finalize): Add support for v2 package file format.
244             (Dwp_output_file::write_index): Likewise.
245             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
246             function prototype.
247
248 2013-07-31  Cary Coutant  <ccoutant@google.com>
249
250         * object.cc (Sized_relobj::do_output_section_address): New function.
251         (Sized_relobj): Instantiate explicitly.
252         * object.h (Object::output_section_address): New function.
253         (Object::do_output_section_address): New function.
254         (Sized_relobj::do_output_section_address): New function.
255         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
256
257 2013-07-30  Cary Coutant  <ccoutant@google.com>
258             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
259
260         * parameters.cc (Parameters::entry): Return target-specific entry
261         symbol name.
262         * target.h (Target::entry_symbol_name): New function.
263         (Target_info::entry_symbol_name): New data member.
264
265         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
266         * i386.cc (Target_i386::i386_info): Likewise.
267         (Target_i386_nacl::i386_nacl_info): Likewise.
268         * sparc.cc (Target_sparc::sparc_info): Likewise.
269         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
270         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
271         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
272         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
273
274 2013-07-22  Sterling Augustine  <saugustine@google.com>
275
276         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
277         Convert parameter shndx to local variable. Add parameters symtab
278         and symtab_size.  Scan over section names.  Find relocation
279         section corresponding to current section.  Create and initialize
280         reloc_mapper_ and reloc_type_.
281         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
282         unit_length to off_t.  Initialize member unit_length_.  Fill in field
283         cu_offset_.
284         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
285         Initialize new fields unit_length_ and cu_offset_.
286         (Dwarf_pubnames_table::read_section): Update prototype.
287         (Dwarf_pubnames_table::cu_offset): New member function.
288         (Dwarf_pubnames_table::subsection_size): Likewise.
289         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
290         New fields.
291         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
292         member functions public.
293         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
294         Update comment.  Rework logic.  Move repeated parts to...
295         (Gdb_index_info_reader::read_pubtable): ...here. New function.
296         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
297         pubtypes_table_, and stmt_list_offset.
298         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
299         Gdb_index::find_pubtype_offset,
300         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
301         (Gdb_index::pubnames_read): Update prototype and rework logic.
302         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
303         Forward declare.
304         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
305         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
306         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
307         Gdb_index::map_pubtable_to_dies):
308         Declare functions.
309         (Gdb_index::pubnames_read): Update declaration.
310         (Gdb_index::Pubname_offset_map): New type.
311         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
312         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
313         Gdb_index::stmt_list_offset): Declare.
314         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
315         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
316         Gdb_index::pubtypes_offset_): Remove.
317
318 2013-07-19  Roland McGrath  <mcgrathr@google.com>
319
320         * options.h (General_options): Add -Trodata-segment option.
321         * parameters.cc (Parameters::check_rodata_segment): New function.
322         (Parameters::set_target_once): Call it.
323         * parameters.h (Parameters): Declare it (private member function).
324         * layout.cc (load_seg_unusable_for_headers): New function, broken
325         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
326         then validate rodata segment rather than text segment.
327         (relaxation_loop_body): Call that.
328         (is_text_segment): New function.  Don't admit a non-executable
329         segment if TARGET->isolate_execinstr().
330         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
331
332 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
333
334         PR gold/15070
335         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
336         * nacl.h (Sniff_file::View::View): Request aligned view.
337
338 2013-07-11  Cary Coutant  <ccoutant@google.com>
339
340         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
341         correct BRLT entry size.
342
343 2013-07-03  Alan Modra  <amodra@gmail.com>
344
345         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
346         comment.
347
348 2013-07-01  Cary Coutant  <ccoutant@google.com>
349
350         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
351         reloc_type_.
352         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
353         (Dwarf_ranges_table::lookup_reloc): New function.
354         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
355         reloc_type_.
356         (Dwarf_ranges_table::lookup_reloc): New function.
357         (Dwarf_ranges_table::reloc_type_): New data member.
358
359 2013-06-27  Jing Yu  <jingyu@google.com>
360
361         PR gold/15662
362         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
363         function.
364         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
365         (Target_powerpc::do_relax): Call the above.
366
367 2013-06-27  Cary Coutant  <ccoutant@google.com>
368
369         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
370         on garbage collected .opd section.
371
372 2013-06-27  Alan Modra  <amodra@gmail.com>
373
374         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
375         is non-zero.
376         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
377         (Target_powerpc::do_function_location): Likewise for loc->shndx.
378
379 2013-06-14  Cary Coutant  <ccoutant@google.com>
380
381         * resolve.cc (Symbol::override_base): Don't override st_type
382         from plugin placeholder symbols.
383         (Symbol_table::resolve): Likewise.
384         (Symbol_table::should_override): Don't complain about TLS mismatch
385         if the TO symbol is a plugin placeholder.
386         * testsuite/Makefile.am (plugin_test_tls): New test.
387         * testsuite/Makefile.in: Regenerate.
388         * testsuite/plugin_test_tls.sh: New test script.
389         * testsuite/two_file_test_2_tls.cc: New test source.
390         * testsuite/two_file_test_tls.cc: New test source.
391
392 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
393
394         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
395         the maximum segment alignment is larger than the page size.
396         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
397         correctly aligns the symbols with large alignemnt.
398         * testsuite/Makefile.in: Regenerate.
399         * testsuite/large_symbol_alignment.cc: New file.
400
401 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
402             Sriraman Tallam  <tmsriram@google.com>
403
404         * options.h (sort_section): New option.
405         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
406         Rename from Input_section_sort_section_name_special_ordering_compare.
407         (Input_section_sort_section_name_compare): New struct.
408         * output.cc (Output_section::Input_section_sort_section_name_compare::
409         operator()): New function.
410         (Output_section::sort_attached_input_sections): Use new sort function
411         for .text if --sort-section=name is specified.
412         * layout.cc (Layout::make_output_section):
413         Add sorting by name when --sort-section=name is specified.
414         * testsuite/Makefile.am (text_section_grouping): Test option
415         --sort-section=name.
416         * testsuite/Makefile.in: Regenerate.
417         * testsuite/section_sorting_name.cc: New file.
418         * testsuite/section_sorting_name.sh: New file.
419
420 2013-05-21  Cary Coutant  <ccoutant@google.com>
421
422         * symtab.h (Symbol::is_cxx_vtable): New function.
423         * target-reloc.h (relocate_section): Check for vtable symbol.
424         * testsuite/Makefile.am (missing_key_func.sh): New test case.
425         * testsuite/Makefile.in: Regenerate.
426         * testsuite/missing_key_func.cc: New test source.
427         * testsuite/missing_key_func.sh: New test script.
428
429 2013-05-21  Cary Coutant  <ccoutant@google.com>
430
431         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
432         type of enclosing symbol.
433         (Relocate_info::location): Check symbol type when describing symbol.
434         * object.h (Symbol_location_info): Remove unused line_number;
435         add enclosing_symbol_type.
436         * testsuite/debug_msg.sh: Adjust expected output.
437
438 2013-05-13  Cary Coutant  <ccoutant@google.com>
439
440         * configure.ac: Export DEFAULT_TARGET.
441         * configure: Regenerate.
442         * Makefile.in: Regenerate.
443         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
444         * testsuite/Makefile.in: Regenerate.
445         * testsuite/debug_msg.sh: Delete duplicate tests.
446         Don't check undef_int error message match for powerpc where the
447         source file and line number aren't available.
448
449 2013-05-10  Roland McGrath  <mcgrathr@google.com>
450
451         * options.h (General_options): Add --rosegment-gap option.
452         * options.cc (finalize): --rosegment-gap implies --rosegment.
453         * layout.cc (set_segment_offsets): Let user option override
454         target->rosegment_gap().
455
456 2013-05-10  Roland McGrath  <mcgrathr@google.com>
457
458         * options.h (General_options): Remove leading space from help
459         messages for -nostdlib and --rosegment.
460
461 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
462
463         PR ld/15365
464         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
465
466 2013-05-03  Alan Modra  <amodra@gmail.com>
467
468         * merge.cc (Output_merge_string::do_add_input_section): Correct
469         scan for number of strings.  Rename vars to avoid shadowing.
470         Include missing terminator in input_size_.
471
472 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
473
474         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
475         Restore empty string handling.
476
477 2013-05-01  Cary Coutant  <ccoutant@google.com>
478
479         * stringpool.cc (Stringpool_template::new_key_offset): Fix
480         uninitialized warning.
481
482 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
483
484         * output.cc (Output_section::add_merge_input_section): Allow
485         to merge sections if the alignment is more than character size.
486         * merge.h (Output_merge_string::Output_merge_string): Remove
487         assert.
488         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
489         only not-null strings. Check the alignment of strings.
490         * stringpool.h
491         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
492         alignment as the argument.
493         (Stringpool_template<Stringpool_char>::addralign_): New class member.
494         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
495         Align non-zero length strings according to the addralign_.
496         (Stringpool_template<Stringpool_char>::set_string_offsets):
497         Updating offsets according to the given alignment.
498         * testsuite/Makefile.am (text_section_grouping): Test if string
499         literals are getting merged.
500         * testsuite/Makefile.in: Regenerate.
501         * testsuite/merge_string_literals_1.c: New file.
502         * testsuite/merge_string_literals_2.c: Ditto.
503         * testsuite/merge_string_literals.sh: Ditto.
504
505 2013-04-26  Ian Lance Taylor  <iant@google.com>
506
507         * target-reloc.h (relocate_section): If the reloc offset is out of
508         range, pass VIEW as NULL to relocate.relocate.
509         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
510         * i386.cc (Target_i386::Relocate::relocate): Likewise.
511         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
512         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
513         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
514         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
515
516 2013-04-26  Geoff Pike  <gpike@chromium.org>
517
518         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
519         * layout.cc (Hash_task): New class.
520         (Layout::queue_build_id_tasks): New function.
521         (Layout::write_build_id): Handle single-thread portion of build ID
522         computation.  (In some cases, all of it is single-threaded.)  Replace
523         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
524         functionality in fewer lines of code.
525         * layout.h (Layout::queue_build_id_tasks): New function declaration.
526         * options.h (General_options): make "--build-id" default to tree
527         rather than sha1.  Add two new options related to --build-id=tree:
528         --build-id-chunk-size-for-treehash and
529         --build-id-min-file-size-for-treehash.
530         * Makefile.am: add testing of --build-id=tree and related new options
531         (these tests will be invoked by "make check").
532         * Makefile.in: Regenerate.
533
534 2013-04-25  Alan Modra  <amodra@gmail.com>
535
536         * configure.tgt: Add powerpcle and powerpc64le.
537
538 2013-04-22  Alan Modra  <amodra@gmail.com>
539
540         PR gold/15355
541         * layout.cc (Layout::segment_precedes): Allow more than one
542         segment with the same type and flags.
543
544 2013-04-15  Cary Coutant  <ccoutant@google.com>
545
546         * layout.cc (Layout::set_relocatable_section_offsets): Don't
547         allocate space in file for BSS sections.
548
549 2013-04-15  Cary Coutant  <ccoutant@google.com>
550
551         * script-sections.cc (Orphan_output_section): Reset address
552         to zero after each orphaned section for relocatable links.
553
554 2013-04-15  Cary Coutant  <ccoutant@google.com>
555
556         * symtab.cc (Symbol_table::sized_write_globals): Subtract
557         section starting address for relocatable link.
558         * testsuite/Makefile.am (script_test_11): New test.
559         * testsuite/Makefile.in: Regenerate.
560         * testsuite/script_test_11.c: New source file.
561         * testsuite/script_test_11.t: New linker script.
562
563 2013-04-13  Alan Modra  <amodra@gmail.com>
564
565         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
566         owner when sections are not adjacent and exceed group size.
567         (Target_powerpc::group_sections): Handle corner case.
568         (Target_powerpc::Branch_info::make_stub): Handle case where
569         stub table doesn't exist due to branches in non-exec sections.
570         (Target_powerpc::Relocate::relocate): Likewise.
571
572 2013-04-11  Alan Modra  <amodra@gmail.com>
573
574         PR gold/15354
575         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
576         .branch_lt to match bfd ld.  Adjust comments throughout file.
577
578 2013-04-04  Ian Lance Taylor  <iant@google.com>
579
580         GCC PR c++/56840
581         * object.cc (do_layout_deferred_sections): Handle .eh_frame
582         sections before checking whether they are included in the link.
583
584 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
585
586         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
587         object before calling the plugin claim_file handler.  Pass the elf
588         object of the archive to the plugin. Delete the elf object if the
589         plugin claims the file.
590
591 2013-03-21  Alan Modra  <amodra@gmail.com>
592
593         * layout.cc (Layout::set_segment_offsets): Accept writable .text
594         segment when omagic.
595
596 2013-03-21  Alan Modra  <amodra@gmail.com>
597
598         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
599         comparison warning.
600         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
601         uninitialized" warning.
602
603 2013-03-20  Alan Modra  <amodra@gmail.com>
604
605         * symtab.h (Symbol::clear_version): New function.
606         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
607         is_needed by weak references.  Clear version for symbols defined
608         in as-needed objects that are not needed.
609
610 2013-03-15  Alan Modra  <amodra@gmail.com>
611
612         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
613         static and public.  Add report_err param.  Return false for data refs.
614         (Target_powerpc::rela_dyn_section): New overloaded function.
615         (Target_powerpc::plt_, iplt_): Elucidate.
616         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
617         (Output_data_plt_powerpc::do_write): Don't write .iplt.
618         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
619         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
620         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
621         push_branch and make_plt_entry for ifunc syms when
622         reloc_needs_plt_for_ifunc.
623         (Target_powerpc::Relocate::relocate): Don't use plt entry value
624         for ifunc unless reloc_needs_plt_for_ifunc.
625
626 2013-03-15  Alan Modra  <amodra@gmail.com>
627
628         * gc.h (gc_process_relocs): Don't look through function descriptors.
629         * icf.cc (get_section_contents): Do so here instead.
630
631 2013-03-13  Alan Modra  <amodra@gmail.com>
632
633         * powerpc.cc (is_branch_reloc): Forward declare.
634         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
635         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
636         false for 64-bit, true for 32-bit non-branch relocs.
637         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
638         * testsuite/Makefile.am (icf_test): Use linker map file instead of
639         nm output.
640         (icf_safe_test): Generate linker map file as well as nm output.
641         (icf_safe_so_test): Likewise.
642         * testsuite/Makefile.in: Regenerate.
643         * testsuite/icf_test.sh: Parse linker map file to determine
644         section folding.
645         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
646         * testsuite/icf_safe_so_test.sh: Likewise.
647         (X86_32_or_ARM_specific_safe_fold): Merge into..
648         (arch_specific_safe_fold): ..this.
649         (X86_64_specific_safe_fold): Delete unused function.
650
651 2013-03-12  Alan Modra  <amodra@gmail.com>
652
653         * gc.h (gc_process_relocs): Look through function descriptors
654         to determine shndx, symvalue and addend used by ICF.  Tidy
655         variable duplication.
656
657 2013-03-11  Alan Modra  <amodra@gmail.com>
658
659         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
660         * layout.cc (Layout_task_runner::run): ..to here.
661         * symtab.h (struct Symbol_location): Extract from..
662         (class Symbol_table): ..here.
663         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
664         * target.h (class Target): Add function_location and
665         do_function_location functions.
666         (class Sized_target): Add do_function_location.
667         * object.h (class Sized_relobj_file): Move find_shdr..
668         (class Object): ..to here.
669         * object.cc: Likewise.  Update to suit.  Instantiate.
670         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
671         * powerpc.cc (class Powerpc_dynobj): New.
672         (Target_powerpc::do_function_location): New function.
673         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
674         (Powerpc_dynobj::do_read_symbols): New function.
675         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
676
677 2013-03-08  Ian Lance Taylor  <iant@google.com>
678
679         * options.cc (General_options::string_to_object_format): Accept
680         "default".
681
682 2013-03-08  Alan Modra  <amodra@gmail.com>
683
684         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
685         pointer to Post_fde.
686         (struct Post_fde): Move definition to here..
687         * ehframe.cc (struct Post_fde): ..from here.
688         (Cie::write): Don't alloc Post_fde.
689         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
690
691 2013-03-07  Alan Modra  <amodra@gmail.com>
692
693         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
694         relocation referencing .LC0.
695         * testsuite/discard_locals_test.sh: Remove FIXMEs.
696
697 2013-03-07  Alan Modra  <amodra@gmail.com>
698
699         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
700         always_inline.  Add assembly for powerpc to avoid GOT.
701
702 2013-03-07  Alan Modra  <amodra@gmail.com>
703
704         * testsuite/script_test_10.sh: Don't test .bss section
705         header number.
706
707 2013-03-06  Alan Modra  <amodra@gmail.com>
708
709         * powerpc.cc (class Powerpc_relobj): Move some member functions.
710         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
711         all callers.  Handle folded sections.
712         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
713         to Powerpc_relobj.
714         (Global_symbol_visitor_opd::operator()): Likewise.
715
716 2013-03-04  Alan Modra  <amodra@gmail.com>
717
718         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
719         * testsuite/Makefile.in: Regenerate.
720
721 2013-03-01  Cary Coutant  <ccoutant@google.com>
722
723         Add dwp support for v2 DWARF package file format.
724         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
725         tu_length parameter.  Adjust all callers.
726         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
727         * dwp.cc: Include dwarf.h.
728         (Section_bounds): New struct type.
729         (Unit_set): New struct type.
730         (Dwo_file::Dwo_file): Initialize new data member.
731         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
732         Combine and rename to...
733         (Dwo_file::read_unit_index): ...this.
734         (Dwo_file::sized_read_compunit_index)
735         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
736         (Dwo_file::sized_read_unit_index): ...this.
737         (Dwo_file::copy_section): Remove section_name, is_str_offsets
738         parameters; add section_id parameter.
739         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
740         (Dwo_file::add_unit_set): ...this.
741         (Dwo_file::shndx_map_): Remove.
742         (Dwo_file::sect_offsets_): New data member.
743         (Dwp_output_file::Dwp_output_file): Initialize new data members.
744         (Dwp_output_file::add_section): Rename to...
745         (Dwp_output_file::add_contribution): ...this.
746         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
747         (Dwp_output_file::add_tu_set): Likewise.
748         (Dwp_output_file::Contribution): New type.
749         (Dwp_output_file::Section::contributions): New data member.
750         (Dwp_output_file::Cu_or_tu_set): Remove.
751         (Dwp_output_file::Section::Section): New ctor.
752         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
753         (Dwp_output_file::Dwp_index::Section_table): New type.
754         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
755         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
756         parameter.
757         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
758         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
759         (Dwp_output_file::Dwp_index::section_table): New member function.
760         (Dwp_output_file::Dwp_index::section_table_end): New member function.
761         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
762         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
763         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
764         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
765         (Dwp_output_file::Dwp_index::section_table_): New data member.
766         (Dwp_output_file::Dwp_index::section_mask_): New data member.
767         (Dwp_output_file::add_output_section): New member function.
768         (Dwp_output_file::write_new_section): New member function.
769         (Dwp_output_file::write_contributions): New member function.
770         (Dwp_output_file::section_id_map_): New data member.
771         (class Dwo_id_info_reader): Remove.
772         (class Unit_reader): New class.
773         (get_dwarf_section_name): New function.
774         (Dwo_file::read_executable): Adjust initializations of class data.
775         (Dwo_file::read): Add support for v2 package file format.
776         (Dwo_file::read_unit_index): Likewise.
777         (Dwo_file::sized_read_unit_index): Likewise.
778         (Dwo_file::copy_section): Likewise.
779         (Dwo_file::add_unit_set): Likewise.
780         (Dwp_output_file::add_output_section): Likewise.
781         (Dwp_output_file::add_contribution): Likewise.
782         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
783         for empty slot.
784         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
785         file format.
786         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
787         slot.
788         (Dwp_output_file::initialize): Remove unused function.
789         (Dwp_output_file::finalize): Add support for v2 package file format.
790         (Dwp_output_file::write_index): Likewise.
791         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
792         function prototype.
793
794 2013-03-01  Cary Coutant  <ccoutant@google.com>
795
796         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
797         function into class definition in header file.
798         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
799         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
800         New function.
801         (Dwarf_info_reader::check_buffer): Move here from .cc file.
802
803 2013-02-28  Alan Modra  <amodra@gmail.com>
804
805         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
806         * target.cc (Target::do_plt_fde_location): New function.
807         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
808         accessor function, and constructor param.
809         (struct Post_fde, Post_fdes): Declare.
810         (Cie::write): Add post_fdes param.
811         * ehframe.cc (Fde::write): Use plt_fde_location.
812         (struct Post_fde): Define.
813         (Cie::write): Stash FDEs added post merge mapping.
814         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
815         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
816         (Eh_frame::do_sized_write): Arrange to write post map FDES after
817         other FDEs.
818         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
819         (Target_powerpc::has_glink): New function.
820         (Target_powerpc::do_relax): Add eh_frame info for stubs.
821         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
822         glink_eh_frame_fde_32, default_fde): New data.
823         (Stub_table::eh_frame_added_): New var.
824         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
825         Make const.
826         (Stub_table::add_eh_frame): New function.
827         (Output_data_glink::add_eh_frame): New function.
828         (Target_powerpc::make_glink_section): Call add_eh_frame.
829
830 2013-02-15  Ian Lance Taylor  <iant@google.com>
831
832         * options.h (DEFINE_uint64_alias): Define.
833         (class General_options): Add -Ttext-segment as an alias for
834         -Ttext.
835
836 2013-02-15  Alan Modra  <amodra@gmail.com>
837
838         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
839         (Stub_table::do_write): ..here, two places.
840         (Stub_table::plt_call_size): Use it here too.
841
842 2013-02-11  Ian Lance Taylor  <iant@google.com>
843
844         * descriptors.cc (Descriptors::close_all): New function.
845         * descriptors.h (class Descriptors): Declare close_all.
846         (close_all_descriptors): New inline function.
847         * plugin.cc: Include "descriptors.h".
848         (Plugin_manager::cleanup): Call close_all_descriptors.
849
850 2013-02-06  Alan Modra  <amodra@gmail.com>
851
852         * README: Update coding style link.
853
854 2013-01-28  Cary Coutant  <ccoutant@google.com>
855
856         * dwp.cc (File_list): New typedef.
857         (Dwo_name_info_reader): New class.
858         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
859         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
860         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
861         (Dwo_file::read_executable): New function.
862         (Dwo_file::read): Move common setup code to ...
863         (Dwo_file::make_object): ... here.
864         (dwp_options): Add --exec/-e.
865         (usage): Likewise.
866         (main): Likewise.
867
868 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
869
870         * layout.cc (Layout::layout): Check for option text_reorder.
871         (Layout::make_output_section): Ditto.
872         * options.h (text_reorder): New option.
873         * output.cc (Input_section_sort_compare): Remove special ordering
874         of section names.
875         (Output_section::
876          Input_section_sort_section_name_special_ordering_compare::
877          operator()): New function.
878         (Output_section::sort_attached_input_sections): Use new sort function
879         for .text.
880         * output.h (Input_section_sort_section_name_special_ordering_compare):
881         New struct.
882         * testsuite/Makefile.am (text_section_grouping): Test option
883         --no-text-reorder
884         * testsuite/Makefile.in: Regenerate.
885         * testsuite/text_section_grouping.sh: Check order of functions without
886         default text reordering.
887
888 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
889
890         * options.h (General_options): Change default to true for new_dtags.
891
892 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
893
894         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
895         when enable_new_dtags is false.  Only add DT_RUNPATH when
896         enable_new_dtags is true.
897
898 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
899
900         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
901         used in declaration and definition consistent.
902         (Target_powerpc::symval_for_branch): Ditto.
903
904 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
905
906         * testsuite/plugin_final_layout.cc: Fix comment.
907
908 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
909
910         * layout.cc (Layout::layout): Do not do default sorting for
911         text sections when section ordering is specified.
912         (make_output_section): Ditto.
913         * testsuite/plugin_final_layout.cc: Name the function sections
914         to catch reordering issues.
915
916 2013-01-15  Alan Modra  <amodra@gmail.com>
917
918         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
919         plt-thread-safe.
920
921 2013-01-15  Alan Modra  <amodra@gmail.com>
922
923         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
924         * testsuite/Makefile.in: Regenerate.
925
926 2013-01-14  Alan Modra  <amodra@gmail.com>
927
928         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
929         * testsuite/Makefile.in: Regenerate.
930
931 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
932
933         PR bfd/14430
934         Fix mingw gold build with plugins enabled
935         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
936         * configure.ac: Export DLOPEN_LIBS and add headers check.
937         * plugin.cc: Handle non-dlfcn case.
938         * Makefile.in: Regenerate.
939         * config.in: Regenerate.
940         * configure: Regenerate.
941         * testsuite/Makefile.in: Regenerate.
942
943 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
944
945         * output.h (sort_attached_input_sections): Change to be public.
946         * script-sections.cc
947         (Output_section_definition::set_section_addresses): Sort
948         attached input sections according to section order before linker
949         script assigns section addresses.
950         (Orphan_output_section::set_section_addresses): Sort
951         attached input sections according to section order before linker
952         script assigns section addresses.
953         * Makefile.am (final_layout.sh): Use a simple linker script to
954         check if section ordering still works.
955         * Makefile.in: Regenerate.
956
957 2013-01-09  Ben Cheng  <bccheng@google.com>
958
959         * arm.cc (Target_arm::attributes_accept_div): New function.
960         (Target_arm::attributes_forbid_div): New function.
961         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
962         attribute using the same new functions as what bfd/elf32_arm.c
963         does.
964
965 2013-01-07  Cary Coutant  <ccoutant@google.com>
966
967         PR gold/14993
968         * output.cc (Output_section::add_input_section): For incremental
969         updates, don't track input sections that are allocated from patch
970         space.
971
972 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
973             Ian Lance Taylor  <iant@google.com>
974
975         PR gold/14897
976         * configure.ac (--enable-ld): Removed.
977         (install_as_default): Set to yes only for --enable-gold=default
978         or --disable-ld.
979         * configure: Regenerated.
980
981 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
982
983         * options.h (General_options): Add -fuse-ld= for GCC linker
984         option compatibility.
985
986 2013-01-04  Cary Coutant  <ccoutant@google.com>
987
988         * configure.ac: Fix typo restoring CXXFLAGS.
989         * configure: Regenerate.
990
991 2013-01-04  Cary Coutant  <ccoutant@google.com>
992
993         * testsuite/Makefile.am (CXXLINK_S): New macro.
994         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
995         * testsuite/Makefile.in: Regenerate.
996
997 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
998
999         * version.cc (print_version): Update copyright year to 2013.
1000
1001 2012-12-20  Ian Lance Taylor  <iant@google.com>
1002
1003         * layout.cc (Layout::special_ordering_of_input_section): New
1004         function.
1005         (Layout::layout): If input section requires special ordering, must
1006         sort input sections.
1007         (Layout::make_output_section): May sort .text input sections.
1008         (Layout::is_section_name_prefix_grouped): Remove.
1009         * layout.h (class Layout): Declare
1010         special_ordering_of_input_section.  Don't declare
1011         is_section_name_prefix_grouped.
1012         * output.cc (Output_section::add_input_section): Revert last
1013         change.
1014         (Output_section::Input_section_sort::match_file_name): Don't crash
1015         if called on output section data.
1016         (Output_section::Input_section_sort_compare): Sort based on
1017         special ordering.
1018         (Output_section::Input_section_sort_section_order_index_compare):
1019         Revert last patch.
1020         (Output_section::sort_attached_input_sections): Likewise.
1021
1022 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1023
1024         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1025         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1026         * output.cc (Output_section::add_input_section): Check if section
1027         name contains special prefix.  Keep input sections to sort such
1028         sections.
1029         (Output_section::Input_section_sort_section_order_index_compare
1030          ::operator()): Group sections according to prefixes.
1031         (Output_section::sort_attached_input_sections): Add condition to
1032         Input_section_entry constructor call.
1033         * testsuite/Makefile.am (text_section_grouping): New test.
1034         * testsuite/Makefile.in: Regenerate.
1035         * testsuite/text_section_grouping.cc: New file.
1036         * testsuite/text_section_grouping.sh: New file.
1037
1038 2012-12-17  Nick Clifton  <nickc@redhat.com>
1039
1040         * Makefile.am: Add copyright notice.
1041         * NEWS: Likewise.
1042         * README: Likewise.
1043         * configure.ac: Likewise.
1044         * ftruncate.c: Likewise.
1045         * Makefile.in: Regenerate.
1046
1047 2012-12-14  Cary Coutant  <ccoutant@google.com>
1048
1049         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1050         --no-as-needed flag.
1051         (exception_separate_shared_12_test): Likewise.
1052         (incremental_copy_test): Likewise.
1053         * testsuite/Makefile.in: Regenerate.
1054
1055 2012-12-14  Cary Coutant  <ccoutant@google.com>
1056
1057         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1058         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1059
1060 2012-12-12  Alan Modra  <amodra@gmail.com>
1061
1062         * powerpc.cc (class Track_tls): New.
1063         (class Relocate, class Scan): Inherit Track_tls.
1064         (Target_powerpc::Scan::local, global): Track tls optimization
1065         and avoid creating plt entry for __tls_get_addr if all uses
1066         are optimized away.
1067         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1068
1069 2012-12-12  Alan Modra  <amodra@gmail.com>
1070
1071         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1072         Replace no_toc_optimize with toc_optimize.
1073         * output.h (Output_section::input_sections): Provide non-const variant.
1074         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1075         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1076         accessors.
1077         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1078         (class Sort_toc_sections): New.
1079         (Target_powerpc::do_finalize_sections): Sort toc sections.
1080         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1081
1082 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1083
1084         * testsuite/binary_unittest.cc (read_all): New function.
1085         (Sized_binary_test): Use it instead of ::read.
1086         * fileread.cc (do_read): Don't assume pread always reads the whole
1087         amount in a single call.
1088
1089 2012-12-10  Alan Modra  <amodra@gmail.com>
1090
1091         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1092         Set EM_PPC64 or EM_PPC here.
1093         (Target_selector_powerpc::do_recognize): Delete.
1094
1095 2012-12-10  Alan Modra  <amodra@gmail.com>
1096
1097         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1098         stub_table_.
1099         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1100
1101 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1102
1103         * testsuite/binary_unittest.cc (Sized_binary_test):
1104         Use open_descriptor rather than ::open.
1105
1106 2012-12-07  Alan Modra  <amodra@gmail.com>
1107
1108         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1109         typedef and invalid_address constant.
1110         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1111         instantiate constants.
1112
1113 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1114
1115         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1116         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1117         * aclocal.m4: Regenerate.
1118         * configure: Regenerate.
1119         * Makefile.in: Regenerate.
1120         * testsuite/Makefile.in: Regenerate.
1121
1122 2012-12-07  Alan Modra  <amodra@gmail.com>
1123
1124         * options.h (General_options): Add no_toc_optimize.
1125         * powerpc.cc (ok_lo_toc_insn): New function.
1126         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1127
1128 2012-12-06  Alan Modra  <amodra@gmail.com>
1129
1130         * options.h (General_options): Add plt_align, plt_static_chain,
1131         plt_thread_safe.  Update stub_group_size help text.
1132         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1133         for new plt_thread_safe_ var.
1134         (use_plt_offset): Correct comments.
1135         (Target_powerpc::do_relax): Look for thread creation symbols to
1136         determine default plt_thread_safe value.  Clear plt call stubs
1137         as well as branch stubs each iteration.
1138         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1139         insn constants.
1140         (l, hi, ha, write_insn): Move earlier.
1141         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1142         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1143         plt stubs too.
1144         (Stub_table::update_size): Adjust.
1145         (Stub_table::prev_size, set_prev_size): Delete.
1146         (Stub_table::stub_align): Let --plt-align affect result.
1147         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1148         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1149         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1150         (Stub_table::do_write): Support more stub variants.
1151
1152 2012-12-04  Alan Modra  <amodra@gmail.com>
1153
1154         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1155         (Target_powerpc::do_define_standard_symbols): New function.
1156
1157 2012-12-03  Alan Modra  <amodra@gmail.com>
1158
1159         * output.h: Formatting, whitespace.
1160
1161 2012-12-03  Alan Modra  <amodra@gmail.com>
1162
1163         * layout.h (Layout::get_executable_sections): Declare.
1164         * layout.cc (Layout::get_executable_sections): New function.
1165         * arm.cc (Target_arm::group_sections): Use it.
1166         (Arm_output_section::group_sections): Delete now redundant test.
1167         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1168         param to handle relative relocs.
1169         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1170         (Output_data_reloc::add_absolute): Adjust.
1171         (Output_data_reloc::add_relative): New function.
1172         (Output_data::reset_data_size): New function.
1173         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1174         (Output_section::set_addralign): New function.
1175         (Output_section::checkpoint_set_addralign): New function.
1176         (Output_section::clear_section_offsets_need_adjustment): New function.
1177         (Output_section::input_sections): Make public.
1178         * powerpc.cc (class Output_data_brlt_powerpc): New.
1179         (class Stub_table, class Stub_control): New.
1180         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1181         stub_table_, set_stub_table, stub_table): New vectors and accessor
1182         functions.
1183         (Target_powerpc::do_may_relax, do_relax, push_branch,
1184         new_stub_table, stub_tables, brlt_section, group_sections,
1185         add_branch_lookup_table, find_branch_lookup_table,
1186         write_branch_lookup_table, make_brlt_section): New functions.
1187         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1188         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1189         branch_info_): New vars.
1190         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1191         make call stubs here.
1192         (Output_data_glink): Remove all call stub handling from this class.
1193         (Target_powerpc::Scan::local, global): Save interesting branch
1194         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1195         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1196         functions on final link.
1197         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1198         Handle long branch destinations too.
1199         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1200         do_plt_address_for_local): Adjust lookup of plt call stubs.
1201
1202 2012-11-30  Alan Modra  <amodra@gmail.com>
1203
1204         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1205         relocs against protected symbols when building 32-bit shared libs.
1206
1207 2012-11-30  Alan Modra  <amodra@gmail.com>
1208
1209         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1210         param.  Call got_section() to make .got.  Update all callers
1211         and their callers and so on.
1212
1213 2012-11-30  Alan Modra  <amodra@gmail.com>
1214
1215         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1216         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1217         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1218         value if it already exists.
1219
1220 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1221
1222         PR gold/14858
1223         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1224
1225 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1226
1227         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1228         than bfc instruction for data sandboxing.
1229
1230 2012-11-08  Alan Modra  <amodra@gmail.com>
1231
1232         * po/POTFILES.in: Regenerate.
1233
1234 2012-11-05  Alan Modra  <amodra@gmail.com>
1235
1236         * configure.ac: Apply 2012-09-10 change to config.in here.
1237         * configure: Regenerate.
1238
1239 2012-11-05  Alan Modra  <amodra@gmail.com>
1240
1241         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1242         (struct Opd_ent): Use "Address" rather than "Offset".
1243         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1244         (Target_powerpc::got_section): Make public.
1245         (Target_powerpc::scan_relocs): Move code setting symbols..
1246         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1247         Create _SDA_BASE_ only when referenced.
1248
1249 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1250
1251         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1252         from last change.
1253
1254 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1255
1256         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1257         for offset_in_output_section parameter.
1258         (Sized_target::relocate_special_relocatable): Likewise.
1259         * arm.cc (Target_arm::relocate_relocs): Likewise.
1260         (Target_arm::relocate_special_relocatable): Likewise.
1261         * i386.cc (Target_i386::relocate_relocs): Likewise.
1262         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1263         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1264         * target-reloc.h (relocate_relocs): Likewise.
1265         * testsuite/testfile.cc (Target_test): Likewise.
1266         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1267         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1268
1269         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1270         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1271
1272         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1273         parameter, which is unused in the [!F_SETFD] case.
1274
1275         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1276         SYMNDX to off_t before comparing it to this->data_size().
1277         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1278         * incremental.cc (Output_section_incremental_inputs::do_write):
1279         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1280
1281         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1282
1283 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1284
1285         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1286         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1287         in EABI_VER5.
1288
1289 2012-10-29  Cary Coutant  <ccoutant@google.com>
1290
1291         * dwp.cc (usage): Add file and exit status parameters;
1292         add --help and --version options.
1293         (print_version): New function.
1294         (main): Add --help and --version options.
1295
1296 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1297
1298         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1299         final_layout_sequence.txt.
1300         * testsuite/Makefile.in: Regenerated.
1301
1302 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1303
1304         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1305         COMPILE generated by automake.
1306         (LINK1): Likewise.
1307         (CXXCOMPILE1): Likewise.
1308         (CXXLINK1): Likewise.
1309         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1310         (LINK): Likewise.
1311         (CXXCOMPILE): Likewise.
1312         (CXXLINK): Likewise.
1313         * testsuite/Makefile.in: Regenerated.
1314
1315 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1316
1317         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1318         on bad fwrite return.
1319
1320 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1321
1322         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1323         on val.
1324
1325 2012-10-23  Cary Coutant  <ccoutant@google.com>
1326
1327         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1328         * testsuite/Makefile.in: Regenerate.
1329         * testsuite/dwp_test.h: New source file.
1330         * testsuite/dwp_test_1.cc: New source file.
1331         * testsuite/dwp_test_1.s: New source file.
1332         * testsuite/dwp_test_1.sh: New source file.
1333         * testsuite/dwp_test_1b.cc: New source file.
1334         * testsuite/dwp_test_1b.s: New source file.
1335         * testsuite/dwp_test_2.cc: New source file.
1336         * testsuite/dwp_test_2.s: New source file.
1337         * testsuite/dwp_test_2.sh: New source file.
1338         * testsuite/dwp_test_main.cc: New source file.
1339         * testsuite/dwp_test_main.s: New source file.
1340
1341 2012-10-23  Cary Coutant  <ccoutant@google.com>
1342
1343         * dwp.h: New header file.
1344         * dwp.cc: New source file.
1345         * gold.h: Move shared declarations to system.h.
1346         * system.h: New header file.
1347         * Makefile.am: Add dwp.
1348         * Makefile.in: Regenerate.
1349
1350 2012-10-23  Cary Coutant  <ccoutant@google.com>
1351
1352         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1353         Dwarf_info_reader::read_from_pointer.
1354         (Dwarf_pubnames_table::read_header): Likewise.
1355         (Dwarf_pubnames_table::next_name): Likewise.
1356         (Dwarf_die::read_attributes): Likewise.
1357         (Dwarf_die::skip_attributes): Likewise.
1358         (Dwarf_info_reader::read_from_pointer): New function template.
1359         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1360         (Dwarf_pubnames_table): Likewise.
1361         (Dwarf_info_reader::read_from_pointer): New function template.
1362         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1363         Dwarf_pubnames_table ctor.
1364
1365 2012-10-23  Cary Coutant  <ccoutant@google.com>
1366
1367         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1368         abbrev_shndx.
1369         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1370         abbrev_shndx_.
1371         (Dwarf_info_reader::set_abbrev_shndx): New method.
1372         (Dwarf_info_reader::abbrev_shndx_): New data member.
1373
1374 2012-10-23  Cary Coutant  <ccoutant@google.com>
1375
1376         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1377         from object, not parameters.
1378         (Dwarf_info_reader::parse): Likewise.
1379         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1380         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1381         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1382         methods.
1383
1384 2012-10-23  Cary Coutant  <ccoutant@google.com>
1385
1386         * fileread.cc (Input_file::Input_file): New constructor.
1387         * fileread.h (class Input_file): Add new constructor.
1388
1389 2012-10-18  Alan Modra  <amodra@gmail.com>
1390
1391         PR gold/14727
1392         * object.cc (Relobj::is_section_name_included): Also match
1393         .sdata personality section.
1394
1395 2012-10-18  Alan Modra  <amodra@gmail.com>
1396
1397         * target-reloc.h (class Default_comdat_behavior): New, package up..
1398         (get_comdat_behaviour): ..this.
1399         (relocate_section): Add Relocate_comdat_behavior template arg,
1400         adjust code to suit.
1401         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1402         (Target_arm::scan_reloc_section): Likewise.
1403         * i386.cc (Target_i386::relocate_section): Likewise.
1404         * sparc.cc (Target_sparc::relocate_section): Likewise.
1405         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1406         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1407         * powerpc.cc (class Relocate_comdat_behavior): New.
1408         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1409         gold::relocate_section with new template arg.
1410
1411 2012-10-18  Alan Modra  <amodra@gmail.com>
1412
1413         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1414         dynamic relocs for GOT_TPREL got entries, without symbol if
1415         resolving locally.
1416         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1417         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1418         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1419
1420 2012-10-17  Alan Modra  <amodra@gmail.com>
1421
1422         PR gold/14726
1423         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1424
1425 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1426
1427         * layout.cc (Layout::include_section): Keep sections marked
1428         SHF_EXCLUDE when doing relocatable links.
1429
1430 2012-10-16  Alan Modra  <amodra@gmail.com>
1431
1432         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1433         (Target_powerpc::do_finalize_sections): Call it.
1434         (Output_data_save_res): New class and supporting functions.
1435         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1436         normal symbols defined in object files.
1437
1438 2012-10-12  Alan Modra  <amodra@gmail.com>
1439
1440         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1441         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1442         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1443         section if scan_opd_relocs not yet called.
1444         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1445
1446 2012-10-12  Alan Modra  <amodra@gmail.com>
1447
1448         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1449         add_local_ifunc_entry): Revert last change.
1450         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1451
1452 2012-10-05  Alan Modra  <amodra@gmail.com>
1453
1454         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1455         do_plt_address_for_global): New functions.
1456         (Output_data_got_powerpc::do_write): Don't segfault when linking
1457         statically.
1458         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1459         add_local_ifunc_entry): Return true on adding entry..
1460         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1461         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1462         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1463         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1464         set up symbols here.
1465         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1466         syms here.  Do so even when no .iplt.  Don't segfault when linking
1467         statically.
1468         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1469         new variants without reloc param.
1470         (Glink_sym_ent::Glink_sym_ent): Likewise.
1471         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1472         reloc when refs will resolve to plt call stub.
1473         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1474         R_PPC_PLTREL24 to resolve locally.
1475         (Target_powerpc::Scan::global): Correct ifunc handling.
1476         (Target_powerpc::Relocate::relocate): Correct local sym glink
1477         lookup.  Don't destroy "value" when we have a plt call stub,
1478         and when checking plt call validity.
1479         (Target_powerpc::do_dynsym_value): Simplify.
1480
1481 2012-10-05  Alan Modra  <amodra@gmail.com>
1482
1483         * i386.cc (Output_data_plt_i386::address_for_global,
1484         address_for_local): Add plt offset to returned value.  Adjust uses.
1485         * sparc.cc (Output_data_plt_sparc::address_for_global,
1486         address_for_local): Likewise.
1487         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1488         address_for_local): Likewise.
1489         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1490         address_for_local): Likewise.
1491         * target.h (Target::plt_address_for_global, plt_address_for_local):
1492         Update comment.
1493         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1494         (Output_data_got::Got_entry::write): Nor here.
1495         * output.h: Comment fix.
1496
1497 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1498
1499         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1500         global_offset_table_ value for larget got.
1501         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1502
1503 2012-09-29  Alan Modra  <amodra@gmail.com>
1504
1505         * powerpc.cc (Target_powerpc::iplt_): New output section.
1506         (Target_powerpc::iplt_section, make_iplt_section,
1507         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1508         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1509         Target_powerpc::plt_entry_count): Count iplt entries too.
1510         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1511         reloc section in constructor.  New params.
1512         (Target_powerpc::make_plt_section): Create reloc section here instead.
1513         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1514         functions.
1515         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1516         (Output_data_glink::add_entry, find_entry): New functions to
1517         deal with local syms.
1518         (Glink_sym_ent): Add support for local syms.
1519         (Output_data_glink::do_write): Handle ifunc plt entries.
1520         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1521         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1522         (Target_powerpc::Relocate::relocate): Likewise.
1523         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1524
1525 2012-09-25  Alan Modra  <amodra@gmail.com>
1526
1527         * object.h (Sized_relobj_file::adjust_local_symbol,
1528         do_adjust_local_symbol): New functions.
1529         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1530         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1531         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1532         and irregular opd entry spacing.
1533         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1534         (Global_symbol_visitor_opd): New functor.
1535         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1536         on deleted opd entries.
1537
1538 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1539
1540         * tilegx.cc: New file.
1541         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1542         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1543         * configure.tgt: Add entries for tilegx*.
1544         * configure.ac: Likewise.
1545         * Makefile.in: Rebuild.
1546         * configure: Likewise.
1547         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1548         tilegx.
1549
1550 2012-09-13  Alan Modra  <amodra@gmail.com>
1551
1552         * target-reloc.h (scan_relocs): Call scan.local for relocs
1553         against symbols in discarded sections.  Pass is_discarded
1554         param.
1555         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1556         Add is_discarded param.
1557         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1558         is_discarded to flag opd entry as discarded.  Don't emit dyn
1559         relocs on such entries.
1560         (Target_powerpc::Scan::global): Similarly detect and handle
1561         such opd entries.
1562         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1563         opd_ent_.  Update all uses.
1564         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1565         (Target_powerpc::relocate_section): Zero out discarded opd
1566         entry relocs.
1567
1568 2012-09-12  Ian Lance Taylor  <iant@google.com>
1569
1570         PR gold/14570
1571         * output.cc: Rename Output_data_got template parameter from size
1572         to got_size for all functions.  Compile all variants of
1573         Output_data_got.
1574         (Output_data_got::Got_entry::write): Correct use of size for
1575         symbol value.  Use local_is_tls rather than casting to
1576         Sized_relobj_file.
1577         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1578         (class Sized_relobj_file): Add do_local_is_tls.
1579         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1580
1581 2012-09-11  Alan Modra  <amodra@gmail.com>
1582
1583         PR gold/14566
1584         * layout.cc (Layout::set_segment_offsets): When using
1585         common-page-size alignment, ensure we are on a new max-page-size
1586         page.
1587         * output.cc (Output_segment::set_section_addresses): Use
1588         abi_pagesize, not common_pagesize for relro boundary.
1589         (Output_segment::set_offset): Likewise.
1590
1591 2012-09-11  Alan Modra  <amodra@gmail.com>
1592
1593         * output.h (Output_data_got::add_global_tls, add_local_tls,
1594         add_local_tls_pair): New functions.
1595         (Output_data_got::add_local_pair_with_rel): Remove second
1596         reloc param.  Expand comment.
1597         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1598         use_plt_or_tls_offset_, similarly for constructor param.
1599         (Output_data_got::Got_entry::write): Add got_index param.
1600         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1601         add_local_tls_pair): New functions.
1602         (Output_data_got::Got_entry::write): Handle tls symbols
1603         with use_plt_or_tls_offset_ set specially.
1604         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1605         (Output_data_got::do_write): Replace iterator with index, pass
1606         index to entry write function.
1607         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1608         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1609         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1610         call.
1611         * i386.cc (Target_i386::Scan::local): Likewise.
1612         * sparc.cc (Target_sparc::Scan::local): Likewise.
1613         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1614         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1615         do_tls_offset_for_global): New functions.
1616         (Target_powerpc::Scan::local): Correct TLS relocations and got
1617         entry values.
1618         (Target_powerpc::Scan::global): Don't emit unnecessary
1619         dynamic relocations on TLS GOT entries.
1620
1621 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1622
1623         * config.in: Disable sanity check for kfreebsd.
1624
1625 2012-09-10  Sterling Augustine  <saugustine@google.com>
1626
1627         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1628         (Gdb_index::pubtypes_read): New parameter.
1629         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1630         to calls.
1631         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1632         pubtypes_object_.
1633
1634 2012-09-09  Alan Modra  <amodra@gmail.com>
1635
1636         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1637         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1638         * gc.h (gc_process_relocs): Call target gc_add_reference.
1639         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1640         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1641         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1642         unnecessary cast.
1643         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1644         to cater for when we don't need code offset.  Update use.
1645         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1646         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1647         set_opd_valid): New functions.
1648         (Target_powerpc::do_gc_add_reference): New function.
1649         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1650         stashed refs.
1651         (Target_powerpc::do_gc_mark_symbol): New function.
1652
1653 2012-09-06  Cary Coutant  <ccoutant@google.com>
1654
1655         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1656         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1657         (Dwarf_die::skip_attributes): Likewise.
1658         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1659         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1660         (main): Call it.
1661         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1662
1663 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1664
1665         * testsuite/script_test_3.t: Add .got.plt output section
1666         statement.
1667         * testsuite/script_test_4.t: Likewise.
1668
1669 2012-09-05  Alan Modra  <amodra@gmail.com>
1670
1671         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1672         update all uses and lose "enum" when using type.
1673
1674 2012-09-05  Alan Modra  <amodra@gmail.com>
1675
1676         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1677         * configure: Regenerate.
1678         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1679         (plugin_final_layout.stdout): Likewise.
1680         (memory_test): Set page sizes to 0x1000.
1681         * testsuite/Makefile.in: Regenerate.
1682         * testsuite/discard_locals_test.sh: Add FIXME comment.
1683         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1684         * testsuite/pr14265.t: Add .got output section statement.
1685         * testsuite/script_test_2.t: Likewise.
1686         * testsuite/script_test_3.t: Likewise.
1687         * testsuite/script_test_4.t: Likewise.
1688         * testsuite/script_test_5.t: Likewise.
1689         * testsuite/script_test_6.t: Likewise.
1690         * testsuite/script_test_7.t: Likewise.
1691         * testsuite/script_test_9.t: Likewise.
1692
1693 2012-09-05  Alan Modra  <amodra@gmail.com>
1694
1695         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1696         (Powerpc_relocate_functions::Status): New typedef.
1697         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1698         (Target_powerpc::Scan::local): Handle REL64.
1699         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1700         for REL32 and REL64.
1701         (Target_powerpc::symval_for_branch): New function, extracted from..
1702         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1703         checks.  Report overflow errors.
1704
1705 2012-09-05  Alan Modra  <amodra@gmail.com>
1706
1707         * object.h (Sized_relobj_file::emit_relocs): Delete.
1708         (Sized_relobj_file::emit_relocs_reltype): Delete.
1709         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1710         relocate_relocs for --emit-relocs.
1711         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1712         * output.h: Update comment.
1713         (Output_segment::first_section): New function.
1714         (Output_segment::first_section_load_address): Use first_section.
1715         * output.cc (Output_segment::first_section): New function extracted..
1716         (Output_segment::first_section_load_address): ..from here.  Delete.
1717         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1718         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1719         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1720         adjust call to target.h function.
1721         * i386.cc (Target_i386): Likewise.
1722         * sparc.cc (Target_sparc): Likewise.
1723         * x86_64.cc (Target_x86_64): Likewise.
1724         * powerpc.cc (Target_powerpc): Likewise.
1725         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1726         first tls section has section symbol for optimised local dynamic
1727         output relocs.
1728         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1729         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1730         optimised tls code.
1731         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1732         Rename to relocate_relocs.  Update error message.
1733
1734 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1735
1736         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1737         --just-symbols.
1738
1739 2012-08-31  Alan Modra  <amodra@gmail.com>
1740
1741         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1742         (Powerpc_relobj::toc_base_offset): New stub function.
1743         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1744         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1745         (Target_powerpc::Relocate::enum skip_tls): New.
1746         (Target_powerpc::call_tls_get_addr_): New var.
1747         (Target_powerpc::is_branch_reloc): Move to file scope.
1748         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1749         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1750         New functions.
1751         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1752         (powerpc_info): Correct common_pagesize for ppc64.
1753         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1754         (Powerpc_relocate_functions): Add overflow check enums and functions.
1755         Add non-shift version of rela, rela_ua.  Delete all rel public
1756         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1757         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1758         addr16_ha3, addr14 functions.
1759         (Output_data_got_powerpc::add_constant_pair): New function.
1760         (Output_data_got_powerpc::got_base_offset): Likewise.
1761         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1762         (instruction constants): Sort, add some more.
1763         (Output_data_glink::do_write): Add and use Address typedef.  Use
1764         object->toc_base_offset() stub for 64-bit.
1765         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1766         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1767         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1768         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1769         Always treat .opd relocs as against locally defined symbol.
1770         Correct condition for RELATIVE relocs.
1771         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1772         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1773         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1774         calculations.  Handle TLS relocs, and more.  Add overflow
1775         checking and adjust for Powerpc_relocate_functions changes.
1776         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1777         Reinstate --emit-relocs code with FIXME.
1778
1779 2012-08-30  Alan Modra  <amodra@gmail.com>
1780
1781         * layout.cc (Layout::set_segment_offsets): Set p_align to
1782         abi_pagesize, not common_pagesize.
1783         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1784         to determine whether file header can go in segment.
1785
1786 2012-08-30  Alan Modra  <amodra@gmail.com>
1787
1788         * output.h (Output_reloc::Output_reloc <output section>): Add
1789         is_relative param.  Adjust calls.
1790         (Output_reloc::add_output_section_relative): New functions.
1791         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1792         is_relative.
1793         (Output_reloc::symbol_value): Handle SECTION_CODE.
1794
1795 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1796
1797         * gold.cc (queue_middle_tasks): Call layout again when unique
1798         segments for sections is desired.
1799         * layout.cc (Layout::Layout): Initialize new members.
1800         (Layout::get_output_section_flags): New function.
1801         (Layout::choose_output_section): Call get_output_section_flags.
1802         (Layout::layout): Make output section for mapping to a unique segment.
1803         (Layout::insert_section_segment_map): New function.
1804         (Layout::attach_allocated_section_to_segment): Make unique segment for
1805         output sections marked so.
1806         (Layout::segment_precedes): Check for unique segments when sorting.
1807         * layout.h (Layout::Unique_segment_info): New struct.
1808         (Layout::Section_segment_map): New typedef.
1809         (Layout::insert_section_segment_map): New function.
1810         (Layout::get_output_section_flags): New function.
1811         (Layout::is_unique_segment_for_sections_specified): New function.
1812         (Layout::set_unique_segment_for_sections_specified): New function.
1813         (Layout::unique_segment_for_sections_specified_): New member.
1814         (Layout::section_segment_map_): New member.
1815         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1816         Rename is_gc_pass_one to is_pass_one.
1817         Rename is_gc_pass_two to is_pass_two.
1818         Rename is_gc_or_icf to is_two_pass.
1819         Check for which pass based on whether symbols data is present.
1820         Make it two pass when unique segments for sections is desired.
1821         * output.cc (Output_section::Output_section): Initialize new
1822         members.
1823         * output.h (Output_section::is_unique_segment): New function.
1824         (Output_section::set_is_unique_segment): New function.
1825         (Output_section::is_unique_segment_): New member.
1826         (Output_section::extra_segment_flags): New function.
1827         (Output_section::set_extra_segment_flags): New function.
1828         (Output_section::extra_segment_flags_): New member.
1829         (Output_section::segment_alignment): New function.
1830         (Output_section::set_segment_alignment): New function.
1831         (Output_section::segment_alignment_): New member.
1832         (Output_segment::Output_segment): Initialize is_unique_segment_.
1833         (Output_segment::is_unique_segment): New function.
1834         (Output_segment::set_is_unique_segment): New function.
1835         (Output_segment::is_unique_segment_): New member.
1836         * plugin.cc (allow_unique_segment_for_sections): New function.
1837         (unique_segment_for_sections): New function.
1838         (Plugin::load): Add new functions to transfer vector.
1839         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1840         * Makefile.in: Regenerate.
1841         * testsuite/plugin_final_layout.sh: Check if unique segment
1842         functionality works.
1843         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1844         are available.
1845         (allow_unique_segment_for_sections): New global.
1846         (unique_segment_for_sections): New global.
1847         (claim_file_hook): Call allow_unique_segment_for_sections.
1848         (all_symbols_read_hook): Call unique_segment_for_sections.
1849
1850 2012-08-22  Cary Coutant  <ccoutant@google.com>
1851
1852         * layout.cc (Layout::include_section): Don't assert on GROUP
1853         sections with --emit-relocs.
1854
1855 2012-08-21  Cary Coutant  <ccoutant@google.com>
1856
1857         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1858         if --export-dynamic-symbol names an undef symbol.
1859
1860 2012-08-18  Alan Modra  <amodra@gmail.com>
1861
1862         * powerpc.cc: Formatting and white space.
1863         (Powerpc_relobj): Rename got2_section_ to special_.
1864         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1865         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1866         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1867         (Target_powerpc): Add Address typedef and invalid_address.  Use
1868         throughout.
1869         (Target_powerpc::is_branch_reloc): New function.
1870         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1871         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1872         for dst_mask, value and addend.
1873         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1874         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1875         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1876         uint16_t for 24-bit offset.  Use get_output_section_offset and
1877         check return.
1878         (Target_powerpc::Scan::local): Handle more relocs.
1879         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1880         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1881         Plug in toc restoring insn after plt calls.  Translate branches
1882         to function descriptor symbols to corresponding entry point.
1883         (Target_powerpc::relocate_for_relocatable): Check return from
1884         get_output_section_offset.
1885         * symtab.h: Comment typo.
1886
1887 2012-08-14  Ian Lance Taylor  <iant@google.com>
1888
1889         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1890         unsupported_relocal_local to call unsupported_reloc_global.
1891
1892 2012-08-14  Nick Clifton  <nickc@redhat.com>
1893
1894         PR ld/14265
1895         * script-sections.cc (Sections_element::output_section_name): Add
1896         keep return parameter.
1897         (Output_section_element::match_name): Add keep return parameter.
1898         Return the value of the keep_ member.
1899         * script-sections.h (class Output_section): Update
1900         output_section_name prototype.
1901         * layout.cc (Layout::keep_input_section): New public member
1902         function.
1903         (Layout::choose_output_section): Pass keep parameter to
1904         output_section_name.
1905         * layout.h (class Layout): Add keep_input_section.
1906         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1907         sections.
1908         * testsuite/Makefile.am: Add a test.
1909         * testsuite/Makefile.in: Regenerate.
1910         * testsuite/pr14265.c: Source file for the test.
1911         * testsuite/pr14265.t: Linker script for the test.
1912         * testsuite/pr14265.sh: Shell script for the test.
1913
1914 2012-08-14  Alan Modra  <amodra@gmail.com>
1915
1916         * target.h (Target::output_section_name): New function.
1917         (Target::do_output_section_name): New function.
1918         * layout.cc (Layout::choose_output_section): Call the above.
1919         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1920
1921 2012-08-14  Alan Modra  <amodra@gmail.com>
1922
1923         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1924         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1925         for replace_constant call.
1926         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1927         (Output_data_glink::do_print_to_mapfile): New function.
1928         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1929         (Target_powerpc::Relocate::relocate): Likewise.
1930
1931 2012-08-14  Alan Modra  <amodra@gmail.com>
1932
1933         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1934         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1935         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1936         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1937         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1938         here.
1939         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1940         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1941         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1942         here.
1943         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1944         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1945
1946 2012-08-12  Alan Modra  <amodra@gmail.com>
1947
1948         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1949         (glink insn constants): Use uint32_t.
1950         (Output_data_glink::add_entry): Use insert, not [] operator.
1951
1952 2012-08-11  Alan Modra  <amodra@gmail.com>
1953
1954         * object.h (Sized_relobj_file::find_shdr): New function.
1955         (Sized_relobj_file::find_special_sections): New function.
1956         * object.cc (Sized_relobj_file::find_shdr): New function.
1957         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1958         (Sized_relobj_file::find_special_sections): New function, split out..
1959         (Sized_relobj_file::do_read_symbols): ..from here.
1960         * output.h (Output_data_got::replace_constant): New function.
1961         (Output_data_got::num_entries): New function.
1962         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1963         (Output_data_got::got_offset): Protected rather than private.
1964         (Output_data_got::replace_got_entry): New function.
1965         * output.cc (Output_data_got::replace_got_entry): New function.
1966         * powerpc.cc (class Powerpc_relobj): New.
1967         (class Powerpc_relocate_functions): Delete all psymval variants or
1968         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1969         Implement _ha functions using corresponding _hi function.
1970         (Powerpc_relobj::find_special_sections): New function.
1971         (Target_powerpc::do_make_elf_object): New function.
1972         (class Output_data_got_powerpc): New.
1973         (class Output_data_glink): New.
1974         (class Powerpc_scan_relocatable_reloc): New.
1975         Many more changes througout file.
1976
1977 2012-08-09  Nick Clifton  <nickc@redhat.com>
1978
1979         * po/vi.po: Updated Vietnamese translation.
1980
1981 2012-08-07  Ian Lance Taylor  <iant@google.com>
1982
1983         * layout.cc (Layout::add_target_dynamic_tags): If
1984         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1985         plt_rel.
1986
1987 2012-07-30  Nick Clifton  <nickc@redhat.com>
1988
1989         * po/gold.pot: Updated template.
1990         * po/es.po: Updated Spanish translation.
1991
1992 2012-07-18  Cary Coutant  <ccoutant@google.com>
1993
1994         PR gold/14344
1995         * configure.ac: Add check for -gpubnames support.
1996         * configure: Regenerate.
1997         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1998         support; force -gno-pubnames.
1999         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2000         support.
2001         (gdb_index_test_4): New test.
2002         * testsuite/Makefile.in: Regenerate.
2003         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2004         * testsuite/gdb_index_test_2.sh: Likewise.
2005         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2006         * testsuite/gdb_index_test_4.sh: New script.
2007         * testsuite/gdb_index_test_comm.sh: New script with common code;
2008         don't look for space after colon.
2009
2010 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2011
2012         * gold.cc (queue_middle_tasks): Update function order only after
2013         deferred objects due to plugins are processed.
2014
2015 2012-07-11  Ian Lance Taylor  <iant@google.com>
2016
2017         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2018         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2019         (Target_arm::scan_reloc_for_stub): Likewise.
2020         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2021         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2022         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2023         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2024         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2025
2026 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2027             Ian Lance Taylor  <iant@google.com>
2028
2029         PR gold/14309
2030         * configure.ac: Test whether std::tr1::hash<off_t> works.
2031         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2032         needed.
2033         * output.h (class Output_fill): Add virtual destructor.
2034         * configure, config.in: Rebuild.
2035
2036 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2037
2038         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2039
2040 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2041
2042         * plugin.cc (Plugin::load): Handle position independent executables.
2043
2044 2012-06-06  Cary Coutant  <ccoutant@google.com>
2045
2046         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2047         add .debug_macro.
2048         (lines_only_debug_sections): Likewise.
2049         (gdb_fast_lookup_sections): New static array.
2050         (is_gdb_debug_section): Rename formal parameter.
2051         (is_lines_only_debug_section): Likewise.
2052         (is_gdb_fast_lookup_section): New function.
2053         (Layout::include_section): Check for ".zdebug_" prefix; pass
2054         section name suffix to is_gdb_debug_section, et al.; check for
2055         fast-lookup sections when building .gdb_index.
2056         * options.h (--strip-debug-gdb): Update GDB version number.
2057
2058 2012-06-06  Cary Coutant  <ccoutant@google.com>
2059
2060         * configure.ac: Add check for fallocate.
2061         * configure: Regenerate.
2062         * config.in: Regenerate.
2063
2064         * options.h (class General_options): Add --mmap-output-file and
2065         --posix-fallocate options.
2066         * output.cc: (posix_fallocate): Remove; replace with...
2067         (gold_fallocate): New function.
2068         (Output_file::map_no_anonymous): Call gold_fallocate.
2069         (Output_file::map): Check --mmap-output-file option.
2070
2071 2012-06-05  Jing Yu  <jingyu@google.com>
2072
2073         * gold.h (textdomain): Add do {} to empty while(0).
2074         (bindtextdomain): Likewise.
2075
2076 2012-06-04  Cary Coutant  <ccoutant@google.com>
2077
2078         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2079         has_dynsym_index.
2080
2081 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2082
2083         * symtab.cc (Symbol_table::define_special_symbol):
2084         Initialize *poldsym to prevent uninitialized variable errors.
2085
2086 2012-05-23  Cary Coutant  <ccoutant@google.com>
2087
2088         * layout.cc (Layout::section_name_mapping): Add rules to handle
2089         exact match on .data.rel.ro.local or .data.rel.ro.
2090         (Layout::output_section_name): Check for exact matches.
2091
2092 2012-05-23  Cary Coutant  <ccoutant@google.com>
2093
2094         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2095         more carefully.
2096
2097 2012-05-22  Cary Coutant  <ccoutant@google.com>
2098
2099         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2100         object before exporting symbol.
2101
2102 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2103
2104         * testsuite/tls_test.cc: Include "config.h" first.
2105         * testsuite/tls_test_c.c: Likewise.
2106
2107 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2108             Nick Clifton  <nickc@redhat.com>
2109
2110         PR 14072
2111         * configure.in: Add check that sysdep.h has been included before
2112         any system header files.
2113         * configure: Regenerate.
2114         * config.in: Regenerate.
2115
2116 2012-05-14  Cary Coutant  <ccoutant@google.com>
2117
2118         * layout.cc (Layout::make_output_section): Mark .tdata section
2119         as RELRO.
2120         * testsuite/relro_test.cc: Add a TLS variable.
2121
2122 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2123
2124         PR gold/14091
2125         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2126         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2127         R_X86_64_64.
2128
2129 2012-05-08  Cary Coutant  <ccoutant@google.com>
2130
2131         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2132         (lines_only_debug_sections): Likewise.
2133
2134 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2135
2136         * nacl.cc: New file.
2137         * nacl.h: New file.
2138         * Makefile.am (CCFILES, HFILES): Add them.
2139         * Makefile.in: Regenerate.
2140         * i386.cc (Output_data_plt_i386_nacl): New class.
2141         (Output_data_plt_i386_nacl_exec): New class.
2142         (Output_data_plt_i386_nacl_dyn): New class.
2143         (Target_i386_nacl): New class.
2144         (Target_selector_i386_nacl): New class.
2145         (target_selector_i386): Use it instead of Target_selector_i386.
2146         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2147         (Target_x86_64_nacl): New class.
2148         (Target_selector_x86_64_nacl): New class.
2149         (target_selector_x86_64, target_selector_x32): Use it instead of
2150         Target_selector_x86_64.
2151         * arm.cc (Output_data_plt_arm_nacl): New class.
2152         (Target_arm_nacl): New class.
2153         (Target_selector_arm_nacl): New class.
2154         (target_selector_arm, target_selector_armbe): Use it instead of
2155         Target_selector_arm.
2156
2157         * target-select.cc (select_target): Take new Input_file* and off_t
2158         arguments, pass them on to recognize method of selector.
2159         * object.cc (make_elf_sized_object): Update caller.
2160         * parameters.cc (parameters_force_valid_target): Likewise.
2161         * incremental.cc (make_sized_incremental_binary): Likewise.
2162         * target-select.h: Update decl.
2163         (Target_selector::recognize): Take new Input_file* argument,
2164         pass it on to do_recognize.
2165         (Target_selector::do_recognize): Take new Input_file* argument.
2166         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2167         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2168         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2169         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2170
2171         * target.h (Target::Target_info): New members isolate_execinstr
2172         and rosegment_gap.
2173         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2174         * arm.cc (Target_arm::arm_info): Update initializer.
2175         * i386.cc (Target_i386::i386_info): Likewise.
2176         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2177         * sparc.cc (Target_sparc::sparc_info): Likewise.
2178         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2179         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2180         * layout.cc (Layout::attach_allocated_section_to_segment):
2181         Take new const Target* argument.  If target->isolate_execinstr(), act
2182         like --rosegment.
2183         (Layout::find_first_load_seg): Take new const Target* argument;
2184         if target->isolate_execinstr(), reject PF_X segments.
2185         (Layout::relaxation_loop_body): Update caller.
2186         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2187         reset file offset to zero when we hit LOAD_SEG, and then do a second
2188         loop over the segments before LOAD_SEG to reassign offsets after
2189         addresses have been determined.  Handle target->rosegment_gap().
2190         (Layout::attach_section_to_segment): Take new const Target* argument;
2191         pass it to attach_allocated_section_to_segment.
2192         (Layout::make_output_section): Update caller.
2193         (Layout::attach_sections_to_segments): Take new const Target* argument;
2194         pass it to attach_section_to_segment.
2195         * gold.cc (queue_middle_tasks): Update caller.
2196         * layout.h (Layout): Update method decls with new arguments.
2197
2198         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2199         Target_info pointer to use.
2200         (Target_arm::do_make_data_plt): New virtual method.
2201         (Target_arm::make_data_plt): New method that calls it.
2202         (Target_arm::make_plt_entry): Use it.
2203         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2204         for the section alignment.
2205         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2206         method.
2207         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2208         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2209         method.
2210         (Output_data_plt_arm::get_plt_entry_size): Call it.
2211         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2212         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2213         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2214         method.
2215         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2216         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2217         method instead of sizeof(plt_entry).
2218         (Output_data_plt_arm::add_entry): Likewise.
2219         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2220         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2221         than static method.
2222         (Target_arm::plt_entry_size): Likewise.
2223         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2224         Move to ...
2225         (Output_data_plt_arm_standard): ... here, new class.
2226         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2227         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2228         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2229
2230         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2231         Take additional argument for the PLT entry size.
2232         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2233         Use get_plt_entry_size method rather than plt_entry_size variable.
2234         (Output_data_plt_x86_64::reserve_slot): Likewise.
2235         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2236         (Output_data_plt_x86_64::add_entry): Likewise.
2237         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2238         (Output_data_plt_x86_64::address_for_global): Likewise.
2239         (Output_data_plt_x86_64::address_for_local): Likewise.
2240         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2241         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2242         Make method non-static.
2243         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2244         method.
2245         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2246         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2247         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2248         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2249         virtual method.
2250         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2251         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2252         virtual method.
2253         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2254         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2255         virtual method.
2256         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2257         (Output_data_plt_x86_64::plt_entry_size)
2258         (Output_data_plt_x86_64::first_plt_entry)
2259         (Output_data_plt_x86_64::plt_entry)
2260         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2261         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2262         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2263         (Output_data_plt_x86_64_standard): ... here, new class.
2264         (Target_x86_64::Target_x86_64): Take optional argument for the
2265         Target_info pointer to use.
2266         (Target_x86_64::do_make_data_plt): New virtual method.
2267         (Target_x86_64::make_data_plt): New method to call it.
2268         (Target_x86_64::init_got_plt_for_update): Use that.
2269         Call this->plt_->add_eh_frame method here.
2270         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2271         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2272         rather than static method.
2273         (Target_x86_64::plt_entry_size): Likewise.
2274         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2275         rather than plt_entry_size variable.  Move guts of PLT filling to...
2276         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2277         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2278         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2279
2280         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2281         additional argument for the section alignment.
2282         Don't do add_eh_frame_for_plt here.
2283         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2284         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2285         variable.
2286         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2287         method.
2288         (Output_data_plt_i386::get_plt_entry_size): Call it.
2289         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2290         (Output_data_plt_i386::add_eh_frame): New method to call it.
2291         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2292         method.
2293         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2294         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2295         method.
2296         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2297         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2298         method instead of plt_entry_size.
2299         (Output_data_plt_i386::plt_entry_size)
2300         (Output_data_plt_i386::plt_eh_frame_fde_size)
2301         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2302         (Output_data_plt_i386_standard): ... here, new class.
2303         (Output_data_plt_i386_exec): New class.
2304         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2305         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2306         (Output_data_plt_i386::exec_plt_entry): Move to ...
2307         (Output_data_plt_i386_exec::plt_entry): ... here.
2308         (Output_data_plt_i386_dyn): New class.
2309         (Output_data_plt_i386::first_plt_entry): Move to ...
2310         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2311         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2312         (Output_data_plt_i386_dyn::plt_entry): ... here.
2313         (Target_i386::Target_i386): Take optional argument for the Target_info
2314         pointer to use.
2315         (Target_i386::do_make_data_plt): New virtual method.
2316         (Target_i386::make_data_plt): New method to call it.
2317         (Target_i386::make_plt_section): Use that.
2318         Call this->plt_->add_eh_frame method here.
2319         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2320         rather than plt_entry_size variable.
2321         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2322         (Output_data_plt_i386::address_for_local): Likewise.
2323         (Output_data_plt_i386::do_write): Likewise.
2324         Move guts of PLT filling to...
2325         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2326         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2327         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2328         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2329
2330 2012-05-01  Cary Coutant  <ccoutant@google.com>
2331
2332         * dwarf_reader.cc (Dwarf_die::read_attributes)
2333         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2334         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2335         * reduced_debug_output.cc
2336         (Output_reduced_debug_info_section::get_die_end): Remove
2337         DW_FORM_GNU_ref_index.  Add default case.
2338
2339 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2340
2341         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2342         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2343         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2344         DW_AT_high_pc as offset from DW_AT_low_pc.
2345
2346         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2347         * testsuite/Makefile.in: Regenerate.
2348         * testsuite/gdb_index_test_3.c: New test source file.
2349         * testsuite/gdb_index_test_3.sh: New test source file.
2350
2351 2012-04-25  Ian Lance Taylor  <iant@google.com>
2352
2353         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2354         pointer.
2355         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2356         as a class, not a struct.
2357         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2358         (Target_arm::apply_cortex_a8_workaround): Likewise.
2359         * gc.h: Declare Reloc_types as a struct, not a class.
2360         * object.h: Declare Symbols_data as a struct.
2361         * reloc.h: Declare Read_relocs_data as a struct.
2362         * target.h: Declare Relocate_info as a struct.
2363
2364 2012-04-24  David S. Miller  <davem@davemloft.net>
2365
2366         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2367         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2368         and R_SPARC_WPLT30.
2369
2370 2012-04-24  Cary Coutant  <ccoutant@google.com>
2371
2372         * incremental-dump.cc (find_input_containing_global): Replace
2373         magic number with symbolic constant.
2374         (dump_incremental_inputs): Update version number.
2375         * incremental.cc (Output_section_incremental_inputs): Update version
2376         number; import symbolic constants from Incremental_inputs_reader.
2377         (Incremental_inputs::create_data_sections): Align relocations
2378         section correctly for 64-bit targets.
2379         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2380         constants; add padding.
2381         (Output_section_incremental_inputs::write_header): Add assert for
2382         header_size.
2383         (Output_section_incremental_inputs::write_input_files): Add assert
2384         for input_entry_size.
2385         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2386         add assert for object_info_size, input_section_entry_size,
2387         global_sym_entry_size.
2388         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2389         for data structure sizes; use them.
2390         (Incremental_input_entry_reader): Import symbolic constants from
2391         Incremental_inputs_reader; use them.
2392
2393 2012-04-23  David S. Miller  <davem@davemloft.net>
2394
2395         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2396         and elf_flags_set_.
2397         (Target_sparc::Target_sparc): Initialize new fields.
2398         (Target_sparc::do_make_elf_object): New function.
2399         (Target_sparc::do_adjust_elf_header): New function.
2400
2401 2012-04-23  Cary Coutant  <ccoutant@google.com>
2402
2403         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2404         CU range table of gdb index.
2405
2406 2012-04-20  David S. Miller  <davem@davemloft.net>
2407
2408         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2409         instead of false.
2410
2411 2012-04-16  David S. Miller  <davem@davemloft.net>
2412
2413         * sparc.cc (Target_sparc::got_address): New function.
2414         (Sparc_relocate_functions::gdop_hix22): New function.
2415         (Sparc_relocate_functions::gdop_lox10): New function.
2416         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2417         relocs.
2418         (Target_sparc::Scan::local): Likewise if the global symbol is not
2419         preemptible and is not IFUNC.
2420         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2421         transformations for local and non-preemptible non-IFUNC global
2422         symbols.
2423
2424         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2425         writing out 64-bit part of ranges.
2426
2427         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2428         -fpic and -fpie respectively.
2429         * Makefile.in: Regenerate.
2430
2431         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2432         (Target_sparc::Target_sparc): Initialize new field.
2433         (Target_sparc::do_plt_section_for_global): New function.
2434         (Target_sparc::do_plt_section_for_local): New function.
2435         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2436         (Target_sparc::make_plt_section): New function, broken out of
2437         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2438         (Target_sparc::make_plt_entry): Call make_plt_section.
2439         (Target_sparc::make_local_ifunc_plt_entry): New function.
2440         (Target_sparc::rela_ifunc_section): New function.
2441         (Target_sparc::plt_section): Remove const.
2442         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2443         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2444         and ifunc_count_ fields.
2445         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2446         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2447         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2448         (Output_data_plt_sparc::rela_ifunc): New function.
2449         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2450         (Output_data_plt_sparc::has_ifunc_section): New function.
2451         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2452         (Output_data_plt_sparc::address_for_global): New function.
2453         (Output_data_plt_sparc::address_for_local): New function.
2454         (Output_data_plt_sparc::plt_index_to_offset): New function.
2455         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2456         and entry_count.
2457         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2458         entry_count.
2459         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2460         R_SPARC_JMP_IREL to switch.
2461         (Target_sparc::Scan::check_non_pic): Likewise.
2462         (Target_sparc::Scan::local): Handle IFUNC symbols.
2463         (Target_sparc::Scan::local): Likewise.
2464         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2465         and plt_address_for_local.
2466         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2467         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2468
2469         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2470         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2471         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2472         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2473         global relocs too.
2474         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2475         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2476         calls.
2477         * sparc.cc (Target_sparc::Scan::global): Likewise.
2478         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2479
2480 2012-04-16  Cary Coutant  <ccoutant@google.com>
2481
2482         * archive.cc (Library_base::should_include_member): Check for
2483         --export-dynamic-symbol.
2484         * options.h (class General_options): Add --export-dynamic-symbol.
2485         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2486         --export-dynamic-symbol.
2487         (Symbol_table::gc_mark_undef_symbols): Likewise.
2488         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2489
2490 2012-04-12  David S. Miller  <davem@davemloft.net>
2491
2492         * sparc.cc (Reloc::wdisp10): New relocation method.
2493         (Reloc::h34): Likewise.
2494         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2495         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2496         R_SPARC_WDISP10.
2497         (Target_sparc::Scan::local): Likewise.
2498         (Target_sparc::Scan::global): Likewise.
2499         (Target_sparc::Relocate::relocate): Likewise.
2500
2501 2012-04-09  Cary Coutant  <ccoutant@google.com>
2502
2503         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2504         low_pc == 0.
2505
2506 2012-04-06  Ian Lance Taylor  <iant@google.com>
2507
2508         * timer.cc: #include <unistd.h>.
2509
2510 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2511
2512         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2513         * config.in: Regenerate.
2514         * configure: Regenerate.
2515
2516 2012-04-05  Nick Clifton  <nickc@redhat.com>
2517
2518         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2519         (AM_LC_MESSAGES): Add.
2520         * aclocal.m4: Regenerate.
2521         * config.in: Regenerate.
2522         * configure: Regenerate.
2523
2524 2012-03-21  Cary Coutant  <ccoutant@google.com>
2525
2526         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2527         * Makefile.in: Regenerate.
2528         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2529         (Sized_elf_reloc_mapper::symbol_section): New function.
2530         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2531         (make_elf_reloc_mapper): New function.
2532         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2533         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2534         (Dwarf_abbrev_table::do_get_abbrev): New function.
2535         (Dwarf_ranges_table::read_ranges_table): New function.
2536         (Dwarf_ranges_table::read_range_list): New function.
2537         (Dwarf_pubnames_table::read_section): New function.
2538         (Dwarf_pubnames_table::read_header): New function.
2539         (Dwarf_pubnames_table::next_name): New function.
2540         (Dwarf_die::Dwarf_die): New function.
2541         (Dwarf_die::read_attributes): New function.
2542         (Dwarf_die::skip_attributes): New function.
2543         (Dwarf_die::set_name): New function.
2544         (Dwarf_die::set_linkage_name): New function.
2545         (Dwarf_die::attribute): New function.
2546         (Dwarf_die::string_attribute): New function.
2547         (Dwarf_die::int_attribute): New function.
2548         (Dwarf_die::uint_attribute): New function.
2549         (Dwarf_die::ref_attribute): New function.
2550         (Dwarf_die::child_offset): New function.
2551         (Dwarf_die::sibling_offset): New function.
2552         (Dwarf_info_reader::check_buffer): New function.
2553         (Dwarf_info_reader::parse): New function.
2554         (Dwarf_info_reader::do_parse): New function.
2555         (Dwarf_info_reader::do_read_string_table): New function.
2556         (Dwarf_info_reader::lookup_reloc): New function.
2557         (Dwarf_info_reader::get_string): New function.
2558         (Dwarf_info_reader::visit_compilation_unit): New function.
2559         (Dwarf_info_reader::visit_type_unit): New function.
2560         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2561         Sized_elf_reloc_mapper.
2562         (Sized_dwarf_line_info::symbol_section): Remove function.
2563         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2564         (Sized_dwarf_line_info::read_line_mappings): Remove object
2565         parameter, adjust callers.
2566         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2567         * dwarf_reader.h: Include <sys/types.h>.
2568         (class Track_relocs): Remove forward declaration.
2569         (class Elf_reloc_mapper): New class.
2570         (class Sized_elf_reloc_mapper): New class.
2571         (class Dwarf_abbrev_table): New class.
2572         (class Dwarf_range_list): New class.
2573         (class Dwarf_ranges_table): New class.
2574         (class Dwarf_pubnames_table): New class.
2575         (class Dwarf_die): New class.
2576         (class Dwarf_info_reader): New class.
2577         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2578         (Sized_dwarf_line_info::symbol_section): Remove member function.
2579         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2580         base class.
2581         * gdb-index.cc: New source file.
2582         * gdb-index.h: New source file.
2583         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2584         and .debug_types sections, call Layout::add_to_gdb_index.
2585         (Sized_relobj_incr::do_section_name): Implement.
2586         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2587         return type; Implement.
2588         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2589         return type.
2590         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2591         parameter list and return type.
2592         (Sized_incr_dynobj::do_section_contents): Likewise.
2593         * layout.cc: Include gdb-index.h.
2594         (Layout::Layout): Initialize gdb_index_data_.
2595         (Layout::init_fixed_output_section): Check for .gdb_index section.
2596         (Layout::add_to_gdb_index): New function. Instantiate.
2597         * layout.h: Add forward declaration for class Gdb_index.
2598         (Layout::add_to_gdb_index): New member function.
2599         (Layout::gdb_index_data_): New data member.
2600         * main.cc: Include gdb-index.h.
2601         (main): Print statistics for gdb index.
2602         * object.cc (Object::section_contents): Move code into
2603         do_section_contents.
2604         (need_decompressed_section): Check for sections needed when building
2605         gdb index.
2606         (build_compressed_section_map): Likewise.
2607         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2608         gdb index.
2609         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2610         sections; call Layout::add_to_gdb_index.
2611         (Sized_relobj_file::do_decompressed_section_contents): Call
2612         do_section_contents directly.
2613         * object.h (Object::do_section_contents): Adjust parameter list and
2614         return type.
2615         (Object::do_decompressed_section_contents): Call do_section_contents
2616         directly.
2617         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2618         return type.
2619         * options.h (class General_options): Add --gdb-index option.
2620         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2621         list and return type.
2622         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2623         * reloc.h (Track_relocs::checkpoint): New function.
2624         (Track_relocs::reset): New function.
2625
2626         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2627         New test cases.
2628         * testsuite/Makefile.in: Regenerate.
2629         * testsuite/gdb_index_test.cc: New test source file.
2630         * testsuite/gdb_index_test_1.sh: New test source file.
2631         * testsuite/gdb_index_test_2.sh: New test source file.
2632
2633 2012-03-19  Doug Kwan  <dougkwan@google.com>
2634
2635         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2636         (Target_arm::do_finalize_sections): Remove code which defines
2637         __exidx_start and __exidx_end.  Make symbol table parameter
2638         anonymous as it is not used.
2639         * gold.cc (queue_middle_tasks): Call target hook to define any
2640         target-specific symbols.
2641         * target.h (Target::define_standard_symbols): New method.
2642         (Target::do_define_standard_symbols): Same.
2643         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2644         * testsuite/Makefile.in: Regenerate.
2645         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2646         and __exidx_end.
2647         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2648         relocations are generated for __exidx_start and __exidx_end.
2649
2650 2012-03-16  Doug Kwan  <dougkwan@google.com>
2651
2652         * testsuite/Makefile.am: Disable test initpri3b.
2653         * testsuite/Makefile.in: Regenerate.
2654
2655 2012-03-15  Doug Kwan  <dougkwan@google.com>
2656
2657         * arm.cc (Target_arm::got_section): Make .got section read-only
2658         if -z now is given.
2659
2660 2012-03-15  Ian Lance Taylor  <iant@google.com>
2661
2662         PR gold/13850
2663         * layout.cc (Layout::make_output_section): Correctly mark
2664         SHT_INIT_ARRAY, et. al., as relro.
2665
2666 2012-03-14  Doug Kwan  <dougkwan@google.com>
2667
2668         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2669         dynamic relocations for protected symbols in shared objects.
2670
2671 2012-03-13  Ian Lance Taylor  <iant@google.com>
2672
2673         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2674         keep the larger alignment.
2675
2676 2012-03-12  Cary Coutant  <ccoutant@google.com>
2677
2678         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2679         handling of DW_LNE_define_file.
2680
2681 2012-03-12  Cary Coutant  <ccoutant@google.com>
2682
2683         * reduced_debug_output.cc
2684         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2685         codes to switch.
2686
2687 2012-02-29  Cary Coutant  <ccoutant@google.com>
2688
2689         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2690
2691 2012-02-29  Cary Coutant  <ccoutant@google.com>
2692
2693         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2694         Call Object::decompressed_section_contents.
2695         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2696         New dtor.
2697         (Sized_dwarf_line_info::buffer_start_): New data member.
2698         * merge.cc (Output_merge_data::do_add_input_section): Call
2699         Object::decompressed_section_contents.
2700         (Output_merge_string::do_add_input_section): Likewise.
2701         * object.cc (need_decompressed_section): New function.
2702         (build_compressed_section_map): Decompress sections needed later.
2703         (Sized_relobj_file::do_decompressed_section_contents): New function.
2704         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2705         * object.h (Object::decompressed_section_contents): New function.
2706         (Object::discard_decompressed_sections): New function.
2707         (Object::do_decompressed_section_contents): New function.
2708         (Object::do_discard_decompressed_sections): New function.
2709         (Compressed_section_info): New type.
2710         (Compressed_section_map): Include decompressed section contents.
2711         (Sized_relobj_file::do_decompressed_section_contents): New function.
2712         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2713
2714 2012-02-16  Cary Coutant  <ccoutant@google.com>
2715
2716         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2717         * testsuite/Makefile.in: Regenerate.
2718
2719 2012-02-14  Cary Coutant  <ccoutant@google.com>
2720
2721         * options.cc (General_options::finalize): Disallow -pie and -static.
2722
2723 2012-02-03  Doug Kwan  <dougkwan@google.com>
2724
2725         * arm.cc (Arm_relocate_functions::abs8,
2726         Arm_relocate_functions::abs16): Use
2727         Bits::has_signed_unsigned_overflow32.
2728         (Arm_relocate_functions::thm_abs8): Correct range of
2729         overflow check.
2730         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2731         in assertions.
2732
2733 2012-02-02  Doug Kwan  <dougkwan@google.com>
2734
2735         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2736         position independent outputs, not just shared objects.
2737
2738 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2739
2740         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2741         * configure: Regenerated.
2742
2743 2012-01-27  Ian Lance Taylor  <iant@google.com>
2744
2745         * reloc.h (Bits): New class with static functions, copied from
2746         namespace utils in arm.cc.
2747         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2748         instead.
2749
2750 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2751
2752         * incremental.cc (write_info_blocks): Correct relocation offset.
2753
2754 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2755
2756         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2757         (Relocate::tls_gd_to_le): Likewise.
2758
2759 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2760
2761         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2762
2763 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2764
2765         * configure.ac: Check if -mcmodel=medium works.
2766         * configure: Regenerated.
2767
2768 2012-01-24  Cary Coutant  <ccoutant@google.com>
2769
2770         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2771         definition and ...
2772         (read_unsigned_LEB_128_x): ... this new function.
2773         (read_signed_LEB_128): Replaced with inline definition and ...
2774         (read_signed_LEB_128_x): ... this new function.
2775         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2776         (read_unsigned_LEB_128): Add inline definition.
2777         (read_signed_LEB_128_x): New function.
2778         (read_signed_LEB_128): Add inline definition.
2779         * testsuite/Makefile.am (leb128_unittest): New unit test.
2780         * testsuite/Makefile.in: Regenerate.
2781         * testsuite/leb128_unittest.cc: New unit test.
2782
2783 2012-01-23  Ian Lance Taylor  <iant@google.com>
2784
2785         PR gold/13617
2786         * i386.cc (Target_i386::do_code_fill): When using a jmp
2787         instruction, pad with nop instructions.
2788         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2789
2790 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2791
2792         * x86_64.cc (gc_process_relocs): Add typename on types used in
2793         template.
2794         (scan_relocs): Likewise.
2795         (relocate_section): Likewise.
2796         (apply_relocation): Likewise.
2797
2798 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2799
2800         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2801         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2802         under x32.
2803
2804 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2805
2806         * x86_64.cc: Initial support for x32.
2807
2808 2012-01-03  Cary Coutant  <ccoutant@google.com>
2809
2810         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2811         Use abstract base class for GOT.
2812         * gold/output.h (class Output_data_got_base): New abstract base class.
2813         (class Output_data_got): Derive from new base class, adjust ctors.
2814         (Output_data_got::reserve_slot): Make virtual; rename to
2815         do_reserve_slot; Adjust callers.
2816         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2817         pointer to abstract base class.
2818         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2819
2820 2011-12-18  Ian Lance Taylor  <iant@google.com>
2821
2822         * object.h (Relobj::local_symbol_value): New function.
2823         (Relobj::local_plt_offset): New function.
2824         (Relobj::local_has_got_offset): New function.
2825         (Relobj::local_got_offset): New function.
2826         (Relobj::set_local_got_offset): New function.
2827         (Relobj::do_local_symbol_value): New pure virtual function.
2828         (Relobj::do_local_plt_offset): Likewise.
2829         (Relobj::do_local_has_got_offset): Likewise.
2830         (Relobj::do_local_got_offset): Likewise.
2831         (Relobj::do_set_local_got_offset): Likewise.
2832         (Sized_relobj::do_local_has_got_offset): Rename from
2833         local_has_got_offset.
2834         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2835         (Sized_relobj::do_set_local_got_offset): Rename from
2836         set_local_got_offset.
2837         (Sized_relobj_file::do_local_plt_offset): Rename from
2838         local_plt_offset.
2839         (Sized_relobj_file::do_local_symbol_value): New function.
2840         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2841         local_plt_offset.
2842         * output.cc (Output_data_got::Got_entry::write): Change object to
2843         Relobj.  Use local_symbol_value.
2844         (Output_data_got::add_global_with_rel): Change rel_dyn to
2845         Output_data_reloc_generic*.  Use add_global_generic.
2846         (Output_data_got::add_global_with_rela): Remove.  Change all
2847         callers to use add_global_with_rel.
2848         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2849         Output_data_reloc_generic*.  Use add_global_generic.
2850         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2851         callers to use add_global_pair_with_rel.
2852         (Output_data_got::add_local): Change object to Relobj*.
2853         (Output_data_got::add_local_plt): Likewise.
2854         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2855         change rel_dyn to Output_data_reloc_generic*.  Use
2856         add_local_generic.
2857         (Output_data_got::add_local_with_rela): Remove.  Change all
2858         callers to use all_local_with_rel.
2859         (Output_data_got::add_local_pair_with_rel): Change object to
2860         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2861         add_output_section_generic.
2862         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2863         callers to use add_local_pair_with_rel.
2864         (Output_data_got::reserve_local): Change object to Relobj*.
2865         * output.h: (class Output_data_reloc_generic): Add pure virtual
2866         declarations for add_global_generic, add_local_generic,
2867         add_output_section_generic.
2868         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2869         functions for Output_data_reloc_generic.  Update declarations for
2870         changes listed in output.cc.
2871         (class Output_data_got): Change template parameter to got_size.
2872         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2873         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2874         function.
2875         (Sized_relobj_incr::do_local_plt_offset): New function.
2876         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2877         add_global_generic.
2878
2879 2011-12-17  Cary Coutant  <ccoutant@google.com>
2880
2881         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2882         * resolve.cc (Symbol_table::resolve): Likewise.
2883         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2884         arrays.
2885         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2886
2887 2011-12-16  Ian Lance Taylor  <iant@google.com>
2888
2889         * output.h (Output_data_reloc_generic::add): Only call
2890         add_dynamic_reloc if this is a dynamic reloc section.
2891
2892 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2893
2894         PR gold/13505
2895         * target-reloc.h (apply_relocation): Replace <64, false> with
2896         <size, big_endian>.
2897
2898 2011-11-25  Nick Clifton  <nickc@redhat.com>
2899
2900         * po/it.po: New Italian translation.
2901
2902 2011-11-17  Sterling Augustine  <saugustine@google.com>
2903
2904         * script.cc (script_include_directive): Implement.
2905         (read_script_file): New local variables name and search_path. Update
2906         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2907         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2908         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2909
2910 2011-11-11  Sterling Augustine  <saugustine@google.com>
2911
2912         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2913         (file_or_sections_cmd): Likewise.
2914
2915 2011-11-11  Doug Kwan  <dougkwan@google.com>
2916
2917         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2918         if --just-symbols is given.
2919
2920 2011-11-10  Doug Kwan  <dougkwan@google.com>
2921
2922         PR gold/13362
2923         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2924         when processing data relocs.
2925         * reloc.h (Relocate_functions::rel_unaligned): New method.
2926         (Relocate_functions::pcrel_unaligned): Ditto.
2927         (Relocate_functions::rel32_unaligned): Ditto.
2928         (Relocate_functions::pcrel32_unaligned): Ditto.
2929
2930 2011-11-09  Doug Kwan  <dougkwan@google.com>
2931
2932         PR gold/13362
2933         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2934         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2935         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2936         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2937         (Relocate_functions::rel_unaligned): New.
2938         (Relocate_functions::rel32_unaligned): New.
2939         * target-reloc.h (relocate_for_relocatable): Add code to handle
2940         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2941         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2942         arm_unaligned_reloc_r): New targets.
2943         * testsuite/Makefile.in: Regenerate.
2944         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2945         linking.
2946
2947 2011-11-02  Ian Lance Taylor  <iant@google.com>
2948
2949         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2950         NATIVE_LINKER.
2951         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2952         * options.cc (General_options::finalize): Use library search path
2953         from configure script if specified.  If not native and no sysroot,
2954         only search TOOLLIBDIR.
2955         * options.h (Search_directory::Search_directory): Change name to
2956         const std::string&.
2957         (General_options::add_to_library_path_with_sysroot): Change arg to
2958         const std::string&.
2959         * configure, Makefile.in, config.in: Rebuild.
2960
2961 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2962
2963         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2964         we are working around the ARM1176 Erratum.
2965         * options.h (General_options::fix_arm1176): Add option.
2966         * testsuite/Makefile.am: Add testcases, and keep current ones
2967         working.
2968         * testsuite/Makefile.in: Regenerate.
2969         * testsuite/arm_fix_1176.s: New file.
2970         * testsuite/arm_fix_1176.sh: Likewise.
2971
2972 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2973
2974         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2975         may_use_blx_.
2976         (Target_arm::may_use_blx): Remove method.
2977         (Target_arm::set_may_use_blx): Likewise.
2978         (Target_arm::may_use_v4t_interworking): New method.
2979         (Target_arm::may_use_v5t_interworking): Likewise.
2980         (Target_arm::may_use_blx_): Remove member variable.
2981         (Arm_relocate_functions::arm_branch_common): Check for v5T
2982         interworking.
2983         (Arm_relocate_functions::thumb_branch_common): Likewise.
2984         (Reloc_stub::stub_type_for_reloc): Likewise.
2985         (Target_arm::do_finalize_sections): Correct interworking checks.
2986         * testsuite/Makefile.am: Add new tests.
2987         * testsuite/Makefile.in: Regenerate.
2988         * testsuite/arm_farcall_arm_arm.s: New test.
2989         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2990         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2991         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2992         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2993         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2994         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2995         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2996
2997 2011-10-31  Cary Coutant  <ccoutant@google.com>
2998
2999         PR gold/13023
3000         * expression.cc (Expression::eval_with_dot): Add
3001         is_section_dot_assignment parameter.
3002         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3003         absolute and assigning to dot within a section.
3004         * script-sections.cc
3005         (Output_section_element_assignment::set_section_addresses): Pass
3006         dot_section to set_if_absolute.
3007         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3008         as is_section_dot_assignment flag to eval_with_dot.
3009         (Output_section_element_dot_assignment::set_section_addresses):
3010         Likewise.
3011         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3012         parameter.  Also set value if relative to dot_section; set the
3013         symbol's output_section.
3014         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3015         parameter.  Adjust all callers.
3016         (Expression::eval_maybe_dot): Likewise.
3017         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3018         Adjust all callers.
3019         * testsuite/script_test_2.t: Test assignment of an absolute value
3020         to dot within an output section element.
3021
3022 2011-10-31  Cary Coutant  <ccoutant@google.com>
3023
3024         * options.h (class General_options): Add --[no-]gnu-unique options.
3025         * symtab.cc (Symbol_table::sized_write_globals): Convert
3026         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3027
3028 2011-10-31  Cary Coutant  <ccoutant@google.com>
3029
3030         PR gold/13359
3031         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3032         unnecessary assertion.
3033         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3034
3035 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3036
3037         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3038         gc_mark_symbol.
3039         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3040         gc_mark_symbol.
3041         Change to just keep the section associated with symbol.
3042         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3043         they are externally visible and --export-dynamic is turned on.
3044         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3045
3046 2011-10-19  Ian Lance Taylor  <iant@google.com>
3047
3048         PR gold/13163
3049         * script-sections.cc
3050         (Output_section_element_dot_assignment::needs_output_section): New
3051         function.
3052
3053 2011-10-19  Ian Lance Taylor  <iant@google.com>
3054
3055         PR gold/13204
3056         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3057         --section-start option was seen.
3058         * options.h (General_options::any_section_start): New function.
3059
3060 2011-10-18  David S. Miller  <davem@davemloft.net>
3061
3062         PR binutils/13301
3063         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3064         member to track relocation locations that have moved during TLS
3065         reloc optimizations.
3066         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3067         (Target_sparc::Relocate::relocate): Adjust view down by 4
3068         bytes if it matches reloc_adjust_addr_.
3069         (Target_sparc::Relocate::relocate_tls): Always move the
3070         __tls_get_addr call delay slot instruction forward 4 bytes when
3071         performing relaxation.
3072
3073 2011-10-18  Cary Coutant  <ccoutant@google.com>
3074
3075         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3076         (Output_file::map_no_anonymous): Check for non-zero
3077         return code from posix_fallocate.
3078
3079 2011-10-17  Cary Coutant  <ccoutant@google.com>
3080
3081         PR gold/13245
3082         * plugin.cc (is_visible_from_outside): Check for symbols
3083         referenced from dynamic objects.
3084         * resolve.cc (Symbol_table::resolve): Don't count references
3085         from dynamic objects as references from real ELF files.
3086         * testsuite/plugin_test_2.sh: Adjust expected result.
3087
3088 2011-10-17  Cary Coutant  <ccoutant@google.com>
3089
3090         * gold.cc: Include timer.h.
3091         (queue_middle_tasks): Stamp time.
3092         (queue_final_tasks): Likewise.
3093         * main.cc (main): Store timer in parameters.  Print timers
3094         for each pass.
3095         * parameters.cc (Parameters::Parameters): Initialize timer_.
3096         (Parameters::set_timer): New function.
3097         (set_parameters_timer): New function.
3098         * parameters.h (Parameters::set_timer): New function.
3099         (Parameters::timer): New function.
3100         (Parameters::timer_): New data member.
3101         (set_parameters_timer): New function.
3102         * timer.cc (Timer::stamp): New function.
3103         (Timer::get_pass_time): New function.
3104         * timer.h (Timer::stamp): New function.
3105         (Timer::get_pass_time): New function.
3106         (Timer::pass_times_): New data member.
3107
3108 2011-10-17  Cary Coutant  <ccoutant@google.com>
3109
3110         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3111         task for members of lib groups.
3112
3113 2011-10-17  Cary Coutant  <ccoutant@google.com>
3114
3115         PR gold/13288
3116         * fileread.cc (File_read::find_view): Add assert.
3117         (File_read::make_view): Move bounds check (replace with assert)...
3118         (File_read::find_or_make_view): ... to here.
3119
3120 2011-10-12  Cary Coutant  <ccoutant@google.com>
3121
3122         * output.cc (Output_file::open_base_file): Handle case where
3123         ::read returns less than requested size.
3124
3125 2011-10-10  Cary Coutant  <ccoutant@google.com>
3126
3127         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3128         Initialize defined_count_.
3129         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3130         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3131         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3132         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3133         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3134         * incremental.h (Sized_relobj_incr::defined_count_): New data
3135         member.
3136         (Sized_incr_dynobj::defined_count_): New data member.
3137         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3138         Return zeroes instead of internal error.
3139
3140 2011-10-10  Cary Coutant  <ccoutant@google.com>
3141
3142         PR gold/13249
3143         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3144         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3145         * output.h (class Output_reloc): Add use_plt_offset flag.
3146         (Output_reloc::type_): Adjust size of bit field.
3147         (Output_reloc::use_plt_offset_): New bit field.
3148         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3149         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3150         flag.  Adjust all callers.
3151         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3152         creating RELATIVE relocations.
3153
3154 2011-10-10  Nick Clifton  <nickc@redhat.com>
3155
3156         * po/es.po: Updated Spanish translation.
3157         * po/fi.po: Updated Finnish translation.
3158
3159 2011-10-03   Diego Novillo  <dnovillo@google.com>
3160
3161         * options.cc (parse_uint): Fix dereference of RETVAL.
3162
3163 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3164
3165         * layout.h (section_order_map_): New member.
3166         (get_section_order_map): New member function.
3167         * output.cc (Output_section::add_input_section): Check for patterns
3168         only when --section-ordering-file is specified.
3169         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3170         output_sections have been formed.
3171         * layout.cc (Layout_Layout): Initialize section_order_map_.
3172         * plugin.cc (update_section_order): Store order in order_map. Do not
3173         update the order.
3174         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3175         * testsuite/Makefile.in: Regenerate.
3176         * testsuite/plugin_section_order.c: New file.
3177         * testsuite/plugin_final_layout.cc: New file.
3178         * testsuite/plugin_final_layout.sh: New file.
3179
3180 2011-09-29  Cary Coutant  <ccoutant@google.com>
3181
3182         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3183         Check for NULL.
3184         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3185         symbols during incremental update.
3186         (Symbol_table::add_from_dynobj): Likewise.
3187
3188 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3189             Ian Lance Taylor  <iant@google.com>
3190
3191         * symtab.cc (Symbol_table::define_special_symbol): Always
3192         canonicalize version string.
3193
3194 2011-09-26  Cary Coutant  <ccoutant@google.com>
3195
3196         * gold.cc (queue_initial_tasks): Move option checks ...
3197         * options.cc (General_options::finalize): ... to here. Disable
3198         some options; make others fatal.
3199
3200 2011-09-26  Cary Coutant  <ccoutant@google.com>
3201
3202         gcc PR lto/47247
3203         * plugin.cc (get_symbols_v2): New function.
3204         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3205         (is_referenced_from_outside): New function.
3206         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3207         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3208         (get_symbols): Pass version parameter.
3209         (get_symbols_v2): New function.
3210         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3211         parameter.
3212         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3213         (onload): Add LDPT_GET_SYMBOLS_V2.
3214         (all_symbols_read_hook): Use get_symbols_v2; check for
3215         LDPR_PREVAILING_DEF_IRONLY_EXP.
3216         * testsuite/plugin_test_3.sh: Update expected results.
3217
3218 2011-09-23  Simon Baldwin  <simonb@google.com>
3219
3220         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3221         configuration options.
3222         * configure: Regenerate.
3223         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3224         * Makefile.in: Regenerate.
3225         * testsuite/Makefile.in: Regenerate.
3226
3227 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3228
3229         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3230
3231 2011-09-19  Cary Coutant  <ccoutant@google.com>
3232
3233         * incremental.cc (can_incremental_update): Fix typo in comment.
3234         * incremental.h (can_incremental_update): Likewise.
3235
3236 2011-09-18  Cary Coutant  <ccoutant@google.com>
3237
3238         * incremental.cc (can_incremental_update): New function.
3239         * incremental.h (can_incremental_update): New function.
3240         * layout.cc (Layout::init_fixed_output_section): Call it.
3241         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3242         * object.cc (Sized_relobj_file::do_layout): Call
3243         can_incremental_update.
3244
3245 2011-09-13  Cary Coutant  <ccoutant@google.com>
3246
3247         * configure.ac: Check for glibc support for gnu_indirect_function
3248         support with static linking, setting automake conditional
3249         IFUNC_STATIC.
3250         * Makefile.in: Regenerate.
3251         * configure: Regenerate.
3252
3253         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3254         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3255         for IFUNC_STATIC.
3256         * testsuite/Makefile.in: Regenerate.
3257
3258 2011-09-13  Cary Coutant  <ccoutant@google.com>
3259
3260         * incremental.cc (Sized_relobj_incr::do_layout): Call
3261         report_comdat_group for kept comdat sections.
3262         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3263         * testsuite/Makefile.in: Regenerate.
3264         * testsuite/incr_comdat_test_1.cc: New source file.
3265         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3266         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3267         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3268
3269 2011-09-13  Ian Lance Taylor  <iant@google.com>
3270
3271         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3272         variable external_symbols_offset.
3273
3274 2011-09-12  Ian Lance Taylor  <iant@google.com>
3275
3276         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3277         triggered if object has no symbols.
3278
3279 2011-09-09  David S. Miller  <davem@davemloft.net>
3280
3281         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3282         (Output_fill_debug_line::do_write): Likewise.
3283
3284 2011-08-29  Cary Coutant  <ccoutant@google.com>
3285
3286         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3287         casts to match formatting specs.
3288         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3289
3290 2011-08-26  Cary Coutant  <ccoutant@google.com>
3291
3292         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3293         remaining hole size when allocating.
3294         (Layout::make_output_section): Set fill methods for debug sections.
3295         * layout.h (Free_list::Free_list_node): Move from private to
3296         public.
3297         (Free_list::set_min_hole_size): New function.
3298         (Free_list::begin, Free_list::end): New functions.
3299         (Free_list::min_hole_): New data member.
3300         * output.cc: Include dwarf.h.
3301         (Output_fill_debug_info::do_minimum_hole_size): New function.
3302         (Output_fill_debug_info::do_write): New function.
3303         (Output_fill_debug_line::do_minimum_hole_size): New function.
3304         (Output_fill_debug_line::do_write): New function.
3305         (Output_section::Output_section): Initialize new data member.
3306         (Output_section::set_final_data_size): Ensure patch space is larger
3307         than minimum hole size.
3308         (Output_section::do_write): Fill holes in debug sections.
3309         * output.h (Output_fill): New class.
3310         (Output_fill_debug_info): New class.
3311         (Output_fill_debug_line): New class.
3312         (Output_section::set_free_space_fill): New function.
3313         (Output_section::free_space_fill_): New data member.
3314         * testsuite/Makefile.am (incremental_test_3): Add
3315         --incremental-patch option.
3316         (incremental_test_4): Likewise.
3317         (incremental_test_5): Likewise.
3318         (incremental_test_6): Likewise.
3319         (incremental_copy_test): Likewise.
3320         (incremental_common_test_1): Likewise.
3321         * testsuite/Makefile.in: Regenerate.
3322
3323 2011-08-26  Nick Clifton  <nickc@redhat.com>
3324
3325         * po/es.po: Updated Spanish translation.
3326
3327 2011-08-01  Cary Coutant  <ccoutant@google.com>
3328
3329         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3330         * gold/testsuite/Makefile.in: Regenerate.
3331         * gold/testsuite/justsyms_exec.c: New source file.
3332         * gold/testsuite/justsyms_lib.c: New source file.
3333
3334 2011-08-01  Cary Coutant  <ccoutant@google.com>
3335
3336         * layout.cc (Layout::set_segment_offsets): Don't realign text
3337         segment if -Ttext was specified.
3338         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3339         file type.
3340         * object.h (Sized_relobj_file::e_type): New function.
3341         (Sized_relobj_file::e_type_): New data member.
3342         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3343         base address for ET_EXEC files.
3344         * target.cc (Target::do_make_elf_object_implementation): Allow
3345         ET_EXEC files with --just-symbols option.
3346
3347 2011-07-28  Cary Coutant  <ccoutant@google.com>
3348
3349         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3350         Add thread_number parameter.
3351         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3352         * workqueue-threads.cc
3353         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3354         current thread if its thread number is greater than desired thread
3355         count.
3356         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3357         Add thread_number parameter.
3358         (Workqueue::should_cancel_thread): Likewise.
3359         (Workqueue::find_runnable_or_wait): Pass thread_number to
3360         should_cancel_thread.
3361         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3362         parameter.
3363
3364 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3365
3366         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3367         only after checking if it cannot be forced local.
3368         * symtab.h (is_externally_visible): Check if the symbol is not forced
3369         local.
3370
3371 2011-07-15  Ian Lance Taylor  <iant@google.com>
3372
3373         * options.h (class General_options): Add --print-output-format.
3374         Move -EL next to -EB, for  better --help output.
3375         * target-select.cc: Include <cstdio>, "options.h", and
3376         "parameters.h".
3377         (Target_selector::do_target_bfd_name): New function.
3378         (print_output_format): New function.
3379         * target-select.h (class Target_selector): Update declarations.
3380         (Target_selector::target_bfd_name): New function.
3381         (print_output_format): Declare.
3382         * main.cc: Include "target-select.h".
3383         (main): Handle --print-output-format.
3384         * gold.cc: Include "target-select.h".
3385         (queue_initial_tasks): Handle --print-output-format when there are
3386         no input files.
3387         * parameters.cc (parameters_force_valid_target): Give a better
3388         error message if -EB/-EL does not match target.
3389         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3390         function.
3391
3392 2011-07-15  Ian Lance Taylor  <iant@google.com>
3393
3394         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3395         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3396         (Output_data_plt_i386::do_write): Write address of .dynamic
3397         section to first entry in .got.plt section.
3398         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3399         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3400         Initialize layout_.
3401         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3402         section to first entry in .got.plt section.
3403         * layout.h (Layout::dynamic_section): New function.
3404
3405 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3406
3407         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3408         to claim_file call.
3409         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3410         input_section_position_, and input_section_glob_.
3411         (read_layout_from_file): Call function section_ordering_specified.
3412         * layout.h (is_section_ordering_specified): New function.
3413         (section_ordering_specified): New function.
3414         (section_ordering_specified_): New boolean member.
3415         * main.cc(main): Call load_plugins after layout object is defined.
3416         * output.cc (Output_section::add_input_section): Use
3417         function section_ordering_specified to check if section ordering is
3418         needed.
3419         * output.cc (Output_section::add_relaxed_input_section): Use
3420         function section_ordering_specified to check if section ordering is
3421         needed.
3422         (Output_section::update_section_layout): New function.
3423         (Output_section::sort_attached_input_sections): Check if input section
3424         must be reordered.
3425         * output.h (Output_section::update_section_layout): New function.
3426         * plugin.cc (get_section_count): New function.
3427         (get_section_type): New function.
3428         (get_section_name): New function.
3429         (get_section_contents): New function.
3430         (update_section_order): New function.
3431         (allow_section_ordering): New function.
3432         (Plugin::load): Add the new interfaces to the transfer vector.
3433         (Plugin_manager::load_plugins): New parameter.
3434         (Plugin_manager::all_symbols_read): New parameter.
3435         (Plugin_manager::claim_file): New parameter. Save the elf object for
3436         unclaimed objects.
3437         (Plugin_manager::get_elf_object): New function.
3438         (Plugin_manager::get_view): Change to directly use the bool to check
3439         if get_view is called from claim_file_hook.
3440         * plugin.h (input_objects): New function
3441         (Plugin__manager::load_plugins): New parameter.
3442         (Plugin_manager::claim_file): New parameter.
3443         (Plugin_manager::get_elf_object): New function.
3444         (Plugin_manager::in_claim_file_handler): New function.
3445         (Plugin_manager::in_claim_file_handler_): New member.
3446         (layout): New function.
3447         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3448         handler with an extra parameter. Make the elf object before calling
3449         claim_file handler.
3450         * testsuite/plugin_test.c (get_section_count): New function pointer.
3451         (get_section_type): New function pointer.
3452         (get_section_name): New function pointer.
3453         (get_section_contents): New function pointer.
3454         (update_section_order): New function pointer.
3455         (allow_section_ordering): New function pointer.
3456         (onload): Check if the new interfaces exist.
3457
3458 2011-07-13  Ian Lance Taylor  <iant@google.com>
3459
3460         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3461         relro section.
3462         * x86_64.cc (Target_x86_64::got_section): Likewise.
3463         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3464         (relro_now_test_SOURCES): New variable.
3465         (relro_now_test_DEPENDENCIES): New variable.
3466         (relro_now_test_LDFLAGS): New variable.
3467         (relro_now_test_LDADD): New variable.
3468         (relro_now_test.so): New target.
3469         * testsuite/Makefile.in: Rebuild.
3470
3471 2011-07-12  Ian Lance Taylor  <iant@google.com>
3472
3473         PR gold/12980
3474         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3475         GLOB_DAT relocation rather than a RELATIVE relocation for a
3476         protected symbol when creating a shared library.
3477         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3478         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3479         * testsuite/protected_main_1.cc (main): Test that protected
3480         function has same address.
3481
3482 2011-07-11  Ian Lance Taylor  <iant@google.com>
3483
3484         PR gold/12979
3485         * options.h (class General_options): Add -Bgroup.
3486         * options.cc (General_options::finalize): If -Bgroup is set,
3487         default to --unresolved-symbols=report-all.
3488         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3489         * target-reloc.h (issue_undefined_symbol_error): Handle
3490         --unresolved-symbols=report-all.
3491
3492 2011-07-08  Ian Lance Taylor  <iant@google.com>
3493
3494         PR gold/11985
3495         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3496         if linker script discards key sections.
3497         (Layout::create_dynamic_symtab): Likewise.
3498         (Layout::assign_local_dynsym_offsets): Likewise.
3499         (Layout::sized_create_version_sections): Likewise.
3500         (Layout::create_interp): Likewise.
3501         (Layout::finish_dynamic_section): Likewise.
3502         (Layout::set_dynamic_symbol_size): Likewise.
3503
3504 2011-07-08  Ian Lance Taylor  <iant@google.com>
3505
3506         PR gold/12386
3507         * options.h (class General_options): Add --unresolved-symbols.
3508         * target-reloc.h (issue_undefined_symbol_error): Check
3509         --unresolved-symbols.  Add comments.
3510
3511 2011-07-08  Ian Lance Taylor  <iant@google.com>
3512
3513         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3514         expression more complex.
3515
3516 2011-07-08  Ian Lance Taylor  <iant@google.com>
3517
3518         PR gold/11317
3519         * target-reloc.h (issue_undefined_symbol_error): New inline
3520         function, broken out of relocate_section.
3521         (relocate_section): Call issue_undefined_symbol_error.
3522         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3523         there is no TLS segment if we are about to issue an undefined
3524         symbol error.
3525         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3526
3527 2011-07-08  Ian Lance Taylor  <iant@google.com>
3528
3529         PR gold/12279
3530         * resolve.cc (Symbol_table::should_override): Add fromtype
3531         parameter.  Change all callers.  Give error when linking together
3532         TLS and non-TLS symbol.
3533         (Symbol_table::should_override_with_special): Add fromtype
3534         parameter.  Change all callers.
3535         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3536         there is no TLS segment if we have reported some errors.
3537         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3538
3539 2011-07-08  Ian Lance Taylor  <iant@google.com>
3540
3541         PR gold/12372
3542         * target.h (Target::plt_address_for_global): New function.
3543         (Target::plt_address_for_local): New function.
3544         (Target::plt_section_for_global): Remove.
3545         (Target::plt_section_for_local): Remove.
3546         (Target::do_plt_address_for_global): New virtual function.
3547         (Target::do_plt_address_for_local): New virtual function.
3548         (Target::do_plt_section_for_global): Remove.
3549         (Target::do_plt_section_for_local): Remove.
3550         (Target::register_global_plt_entry): Add Symbol_table and Layout
3551         parameters.
3552         * output.cc (Output_data_got::Got_entry::write): Use
3553         plt_address_for_global and plt_address_for_local.
3554         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3555         address of output section.
3556         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3557         got_irelative_, and irelative_count_ fields.  Update
3558         declarations.
3559         (Output_data_plt_i386::has_irelative_section): New function.
3560         (Output_data_plt_i386::entry_count): Add irelative_count_.
3561         (Output_data_plt_i386::set_final_data_size): Likewise.
3562         (class Target_i386): Add got_irelative_ and rel_irelative_
3563         fields.  Update declarations.
3564         (Target_i386::Target_i386): Initialize new fields.
3565         (Target_i386::do_plt_address_for_global): New function replacing
3566         do_plt_section_for_global.
3567         (Target_i386::do_plt_address_for_local): New function replacing
3568         do_plt_section_for_local.
3569         (Target_i386::got_section): Create got_irelative_.
3570         (Target_i386::rel_irelative_section): New function.
3571         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3572         fields.  Don't define __rel_iplt_{start,end}.
3573         (Output_data_plt_i386::add_entry): Add symtab and layout
3574         parameters.  Change all callers.  Use different PLT and GOT for
3575         IFUNC symbols.
3576         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3577         layout parameters.  Change all callers.  Use different PLT and
3578         GOT.
3579         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3580         (Output_data_plt_i386::rel_irelative): New function.
3581         (Output_data_plt_i386::address_for_global): New function.
3582         (Output_data_plt_i386::address_for_local): New function.
3583         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3584         IRELATIVE GOT when changing IFUNC GOT entries.
3585         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3586         reloc.
3587         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3588         if we didn't create an IRELATIVE GOT.
3589         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3590         plt_address_for_local.
3591         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3592         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3593         got_irelative_, and irelative_count_ fields.  Update
3594         declarations.
3595         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3596         Initialize new fields.  Remove symtab parameter.  Change all
3597         callers.
3598         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3599         irelative_count_.
3600         (Output_data_plt_x86_64::has_irelative_section): New function.
3601         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3602         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3603         fields.  Update declarations.
3604         (Target_x86_64::Target_x86_64): Initialize new fields.
3605         (Target_x86_64::do_plt_address_for_global): New function replacing
3606         do_plt_section_for_global.
3607         (Target_x86_64::do_plt_address_for_local): New function replacing
3608         do_plt_section_for_local.
3609         (Target_x86_64::got_section): Create got_irelative_.
3610         (Target_x86_64::rela_irelative_section): New function.
3611         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3612         all callers.  Don't create __rel_iplt_{start,end}.
3613         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3614         parameters.  Change all callers.  Use different PLT and GOT for
3615         IFUNC symbols.
3616         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3617         layout parameters.  Change all callers.  Use different PLT and
3618         GOT.
3619         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3620         parameters.  Change all callers.  Use different PLT and GOT for
3621         IFUNC symbols.
3622         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3623         (Output_data_plt_x86_64::rela_irelative): New function.
3624         (Output_data_plt_x86_64::address_for_global): New function.
3625         (Output_data_plt_x86_64::address_for_local): New function.
3626         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3627         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3628         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3629         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3630         parameters.
3631         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3632         reloc.
3633         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3634         symbols if we didn't create an IRELATIVE GOT.
3635         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3636         plt_address_for_local.
3637         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3638         * testsuite/ifuncvar1.c: New test file.
3639         * testsuite/ifuncvar2.c: New test file.
3640         * testsuite/ifuncvar3.c: New test file.
3641         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3642         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3643         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3644         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3645         * testsuite/Makefile.in: Rebuild.
3646
3647 2011-07-07  Cary Coutant  <ccoutant@google.com>
3648
3649         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3650         (two_file_test_1_ndebug.o): Likewise.
3651         (two_file_test_1b_ndebug.o): Likewise.
3652         (two_file_test_2_ndebug.o): Likewise.
3653         (two_file_test_main_ndebug.o): Likewise.
3654         (incremental_test_2): Link with no-debug versions.
3655
3656 2011-07-06  Cary Coutant  <ccoutant@google.com>
3657
3658         * gold/incremental.cc
3659         (Output_section_incremental_inputs::write_info_blocks): Check for
3660         hidden and internal symbols.
3661
3662 2011-07-06  Cary Coutant  <ccoutant@google.com>
3663
3664         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3665         Check disposition for startup file.
3666         (Incremental_inputs::report_command_line): Ignore
3667         --incremental-startup-unchanged option.
3668         * options.cc (General_options::parse_incremental_startup_unchanged):
3669         New function.
3670         (General_options::General_options): Initialize new data member.
3671         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3672         (General_options): Add --incremental-startup-unchanged option.
3673         (General_options::incremental_startup_disposition): New function.
3674         (General_options::incremental_startup_disposition_): New data member.
3675
3676 2011-07-06  Cary Coutant  <ccoutant@google.com>
3677
3678         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3679         input file index to Script_info ctor.
3680         (Sized_incremental_binary::do_file_has_changed): Find the
3681         command-line argument for files named in scripts.
3682         * incremental.h (Script_info::Script_info): New ctor
3683         with input file index.
3684         (Script_info::input_file_index): New function.
3685         (Script_info::input_file_index_): New data member.
3686         (Incremental_binary::get_library): Add const.
3687         (Incremental_binary::get_script_info): Add const.
3688         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3689         * testsuite/Makefile.am (incremental_test_5): New test case.
3690         (incremental_test_6): New test case.
3691         * testsuite/Makefile.in: Regenerate.
3692
3693 2011-07-06  Cary Coutant  <ccoutant@google.com>
3694
3695         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3696         debug output when command lines differ.
3697
3698 2011-07-06  Cary Coutant  <ccoutant@google.com>
3699
3700         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3701         --incremental-patch option.
3702         * layout.cc (Free_list::allocate): Extend allocation beyond original
3703         end if enabled.
3704         (Layout::make_output_section): Mark sections that should get
3705         patch space.
3706         * options.cc (parse_percent): New function.
3707         * options.h (parse_percent): New function.
3708         (DEFINE_percent): New macro.
3709         (General_options): Add --incremental-patch option.
3710         * output.cc (Output_section::Output_section): Initialize new data
3711         members.
3712         (Output_section::add_input_section): Print section name when out
3713         of patch space.
3714         (Output_section::add_output_section_data): Likewise.
3715         (Output_section::set_final_data_size): Add patch space when
3716         doing --incremental-full.
3717         (Output_section::do_reset_address_and_file_offset): Remove patch
3718         space.
3719         (Output_segment::set_section_list_addresses): Print debug output
3720         only if --incremental-update.
3721         * output.h (Output_section::set_is_patch_space_allowed): New function.
3722         (Output_section::is_patch_space_allowed_): New data member.
3723         (Output_section::patch_space_): New data member.
3724         * parameters.cc (Parameters::incremental_full): New function.
3725         * parameters.h (Parameters::incremental_full): New function
3726         * testsuite/Makefile.am (incremental_test_2): Add test for
3727         --incremental-patch option.
3728         * testsuite/Makefile.in: Regenerate.
3729         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3730         (t18): Remove function body.
3731
3732 2011-07-05  Doug Kwan  <dougkwan@google.com>
3733
3734         PR gold/12771
3735         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3736         Arm_Address type for relocation result.
3737         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3738         overflow check.
3739         (Arm_relocate_functions::abs32): Use unaligned access.
3740         (Arm_relocate_functions::rel32): Ditto.
3741         (Arm_relocate_functions::prel31): Ditto.
3742         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3743         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3744         static data relocations.
3745         * testsuite/Makefile.in: Regnerate.
3746         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3747
3748 2011-07-05  Ian Lance Taylor  <iant@google.com>
3749
3750         PR gold/12392
3751         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3752         symbols if necessary.
3753         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3754
3755 2011-07-05  Ian Lance Taylor  <iant@google.com>
3756
3757         PR gold/12952
3758         * resolve.cc (Symbol::override_base_with_special): Simply override
3759         version with special symbol version, ignoring previous version.
3760
3761 2011-07-05  Ian Lance Taylor  <iant@google.com>
3762
3763         * object.cc (Sized_relobj_file::include_section_group): Add
3764         information to comment about signature location.
3765
3766 2011-07-02  Ian Lance Taylor  <iant@google.com>
3767
3768         PR gold/12957
3769         * options.h (class General_options): Add -f and -F.
3770         * options.cc (General_options::finalize): Fatal error if -f/-F
3771         are used without -shared.
3772         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3773
3774 2011-07-02  Ian Lance Taylor  <iant@google.com>
3775
3776         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3777
3778 2011-07-01  Ian Lance Taylor  <iant@google.com>
3779
3780         PR gold/12525
3781         PR gold/12952
3782         * resolve.cc (Symbol::override_base_with_special): Don't override
3783         the version if the overriding symbol has a different name.
3784         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3785         all callers.  If we give an error about an undefined version,
3786         define the base version if necessary.
3787         * dynobj.h (class Versions): Update declaration.
3788         * testsuite/weak_alias_test_5.cc: New file.
3789         * testsuite/weak_alias_test.script: New file.
3790         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3791         and versioned_alias have the right value, and call t2.
3792         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3793         weak_alias_test_5.so.
3794         (weak_alias_test_LDADD): Likewise.
3795         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3796         * testsuite/Makefile.in: Rebuild.
3797
3798 2011-07-01  Ian Lance Taylor  <iant@google.com>
3799
3800         PR gold/12525
3801         * options.h (class General_options): Support -z notext.
3802         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3803         -Wl,-z,notext.
3804         (two_file_shared_nonpic.so): Likewise.
3805         (two_file_shared_mixed.so): Likewise.
3806         (two_file_shared_mixed_1.so): Likewise.
3807         (weak_undef_lib_nonpic.so): Likewise.
3808         (alt/weak_undef_lib_nonpic.so): Likewise.
3809         (tls_test_shared_nonpic.so): Likewise.
3810         * testsuite/Makefile.in: Rebuild.
3811
3812 2011-07-01  Ian Lance Taylor  <iant@google.com>
3813
3814         PR gold/12525
3815         * configure.ac: Test whether static linking works, setting
3816         the automake conditional HAVE_STATIC.
3817         * testsuite/Makefile.am: Disable tests using -static if
3818         HAVE_STATIC is not true.
3819         * configure, testsuite/Makefile.in: Rebuild.
3820
3821 2011-07-01  Ian Lance Taylor  <iant@google.com>
3822
3823         PR gold/12525
3824         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3825         Assert if we see DW_EH_PE_indirect.
3826         * target.h (Target::ehframe_datarel_base): New function.
3827         (Target::do_ehframe_datarel_base): New target function.
3828         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3829         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3830         function.
3831
3832 2011-07-01  Ian Lance Taylor  <iant@google.com>
3833
3834         PR gold/12571
3835         * options.h (class General_options): Add
3836         --ld-generated-unwind-info.
3837         * ehframe.cc (Fde::write): Add address parameter.  Change all
3838         callers.  If associated with PLT, fill in address and size.
3839         (Cie::set_output_offset): Only add merge mapping if there is an
3840         object.
3841         (Cie::write): Add address parameter.  Change all callers.
3842         (Eh_frame::add_ehframe_for_plt): New function.
3843         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3844         input_offset_ fields into union u_, with new plt field.
3845         (Fde::Fde): Adjust for new union field.
3846         (Fde::Fde) [Output_data version]: New constructor.
3847         (Fde::add_mapping): Only add merge mapping if there is an object.
3848         (class Cie): Update declarations.
3849         (class Eh_frame): Declare add_ehframe_for_plt.
3850         * layout.cc (Layout::layout_eh_frame): Break out code into
3851         make_eh_frame_section, and call it.
3852         (Layout::make_eh_frame_section): New function.
3853         (Layout::add_eh_frame_for_plt): New function.
3854         * layout.h (class Layout): Update declarations.
3855         * merge.cc (Merge_map::add_mapping): Add assertion.
3856         * i386.cc: Include "dwarf.h".
3857         (class Output_data_plt_i386): Make first_plt_entry,
3858         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3859         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3860         and plt_eh_frame_fde.
3861         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3862         boundary.  Call add_eh_frame_for_plt if appropriate.
3863         * x86_64.cc: Include "dwarf.h".
3864         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3865         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3866         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3867         and plt_eh_frame_fde.
3868         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3869         appropriate.
3870
3871 2011-06-29  Ian Lance Taylor  <iant@google.com>
3872
3873         PR gold/12629
3874         * object.cc (Sized_relobj_file::layout_section): Change shdr
3875         parameter to be const.
3876         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3877         out of do_layout.
3878         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3879         appropriate.  Call layout_eh_frame_section.
3880         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3881         sections.
3882         * object.h (class Sized_relobj_file): Update declarations.
3883
3884 2011-06-29  Ian Lance Taylor  <iant@google.com>
3885
3886         PR gold/12652
3887         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3888         modifier.
3889         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3890
3891 2011-06-29  Ian Lance Taylor  <iant@google.com>
3892
3893         PR gold/12675
3894         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3895         SHT_X86_64_UNWIND.
3896         * layout.cc (Layout::layout_eh_frame): Likewise.
3897
3898 2011-06-29  Ian Lance Taylor  <iant@google.com>
3899
3900         PR gold/12695
3901         * layout.cc (Layout::symtab_section_shndx): New function.
3902         * layout.h (class Layout): Declare symtab_section_shndx.
3903         * output.cc (Output_section::write_header): Call it.
3904
3905 2011-06-29  Ian Lance Taylor  <iant@google.com>
3906
3907         PR gold/12818
3908         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3909         symbols which are not used in a relocation.
3910
3911 2011-06-28  Ian Lance Taylor  <iant@google.com>
3912
3913         PR gold/12898
3914         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3915         script create indistinguishable segments.
3916         (Layout::set_segment_offsets): Use stable_sort when sorting
3917         segments.  Pass this to Compare_segments constructor.
3918         * layout.h (class Layout): Make segment_precedes non-static.
3919         (class Compare_segments): Change from struct to class.  Add
3920         layout_ field.  Add constructor.
3921         * script-sections.cc
3922         (Script_sections::attach_sections_using_phdrs_clause): Rename
3923         local orphan to is_orphan.  Don't report failure to put empty
3924         section in segment.  On attachment failure, report name of
3925         section, and attach to first PT_LOAD segment.
3926
3927 2011-06-28  Ian Lance Taylor  <iant@google.com>
3928
3929         PR gold/12934
3930         * target-select.cc (Target_selector::Target_selector): Add
3931         emulation parameter.  Change all callers.
3932         (select_target_by_bfd_name): Rename from select_target_by_name.
3933         Change all callers.
3934         (select_target_by_emulation): New function.
3935         (supported_emulation_names): New function.
3936         * target-select.h (class Target_selector): Add emulation_ field.
3937         Update declarations.
3938         (Target_selector::recognize_by_bfd_name): Rename from
3939         recognize_by_name.  Change all callers.
3940         (Target_selector::supported_bfd_names): Rename from
3941         supported_names.  Change all callers.
3942         (Target_selector::recognize_by_emulation): New function.
3943         (Target_selector::supported_emulations): New function.
3944         (Target_selector::emulation): New function.
3945         (Target_selector::do_recognize_by_bfd_name): Rename from
3946         do_recognize_by_name.  Change all callers.
3947         (Target_selector::do_supported_bfd_names): Rename from
3948         do_supported_names.  Change all callers.
3949         (Target_selector::do_recognize_by_emulation): New function.
3950         (Target_selector::do_supported_emulations): New function.
3951         (select_target_by_bfd_name): Change name in declaration.
3952         (select_target_by_emulation): Declare.
3953         (supported_emulation_names): Declare.
3954         * parameters.cc (parameters_force_valid_target): Try to find
3955         target based on emulation from -m option.
3956         * options.h (class General_options): Change doc string for -m.
3957         * options.cc (help): Print emulations.
3958         (General_options::parse_V): Likewise.
3959         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3960         Add emulation parameter.  Change all callers.
3961
3962 2011-06-28  Ian Lance Taylor  <iant@google.com>
3963
3964         * target.h (class Target): Add osabi_ field.
3965         (Target::osabi): New function.
3966         (Target::set_osabi): New function.
3967         (Target::Target): Initialize osabi_.
3968         (Target::do_adjust_elf_header): Make pure virtual.
3969         (Sized_target::do_adjust_elf_header): Declare.
3970         * target.cc (Sized_target::do_adjust_elf_header): New function.
3971         (class Sized_target): Instantiate all versions.
3972         * freebsd.h (class Target_freebsd): Remove.
3973         (Target_selector_freebsd::do_recognize): Call set_osabi on
3974         Target.
3975         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3976         (Target_selector_freebsd::set_osabi): Remove.
3977         * i386.cc (class Target_i386): Inherit from Sized_target rather
3978         than Target_freebsd.
3979         * x86_64.cc (class Target_x86_64): Likewise.
3980
3981 2011-06-28  Ian Lance Taylor  <iant@google.com>
3982
3983         * target.h (Target::can_check_for_function_pointers): Rewrite.
3984         Make non-virtual.
3985         (Target::can_icf_inline_merge_sections): Likewise.
3986         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3987         (Target::Target_info): Add can_icf_inline_merge_sections field.
3988         (Target::do_can_check_for_function_pointers): New virtual
3989         function.
3990         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3991         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3992         from can_check_for_function_pointers, move in file.
3993         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3994         section_may_have_icf_unsafe_poineters, move in file.
3995         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3996         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3997         Rename from can_check_for_function_pointers, move in file.
3998         (Target_i386::can_icf_inline_merge_sections): Remove.
3999         (Target_i386::i386_info): Initialize
4000         can_icf_inline_merge_sections.
4001         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4002         Initialize can_icf_inline_merge_sections.
4003         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4004         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4005         Rename from can_check_for_function_pointers, move in file.
4006         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4007         (Target_x86_64::x86_64_info): Initialize
4008         can_icf_inline_merge_sections.
4009         * testsuite/testfile.cc (Target_test::test_target_info):
4010         Likewise.
4011         * icf.cc (get_section_contents): Correct formatting.
4012
4013 2011-06-27  Ian Lance Taylor  <iant@google.com>
4014
4015         * symtab.cc (Symbol::versioned_name): New function.
4016         (Symbol_table::add_to_final_symtab): Use versioned_name when
4017         appropriate.
4018         (Symbol_table::sized_write_symbol): Likewise.
4019         * symtab.h (class Symbol): Declare versioned_name.
4020         * stringpool.h (class Stringpool_template): Add variant of add
4021         which takes a std::basic_string.
4022         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4023         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4024         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4025         (ver_test_12.o): New target.
4026         * testsuite/Makefile.in: Rebuild.
4027
4028 2011-06-27  Doug Kwan  <dougkwan@google.com>
4029
4030         * arm.cc (Arm_relocate_functions::thm_jump8,
4031         Arm_relocate_functions::thm_jump11): Use a wider signed
4032         type to compute offset.
4033         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4034         arm_thm_jump8.
4035         * testsuite/Makefile.in: Regenerate.
4036         * testsuite/arm_branch_in_range.sh: Check test results of
4037         arm_thm_jump11 and arm_thm_jump8.
4038         * testsuite/arm_thm_jump11.s: New test source file.
4039         * testsuite/arm_thm_jump11.t: New linker script.
4040         * testsuite/arm_thm_jump8.s: New test source file.
4041         * testsuite/arm_thm_jump8.t: New linker script.
4042
4043 2011-06-24  Ian Lance Taylor  <iant@google.com>
4044
4045         * layout.cc: Include "object.h".
4046         (ctors_sections_in_init_array): New static variable.
4047         (Layout::is_ctors_in_init_array): New function.
4048         (Layout::layout): Add entry to ctors_sections_in_init_array if
4049         appropriate.
4050         * layout.h (class Layout): Declare is_ctors_in_init_array.
4051         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4052         is_ctors_reverse_view is set.
4053         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4054         all callers.  Set is_ctors_reverse_view field of View_size.
4055         (Sized_relobj_file::reverse_words): New function.
4056         * object.h (Sized_relobj_file::View_size): Add
4057         is_ctors_reverse_view field.
4058         (class Sized_relobj_file): Update declarations.
4059         * testsuite/initpri3.c: New test.
4060         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4061         initpri3b.
4062         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4063         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4064         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4065         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4066         * testsuite/Makefile.in: Rebuild.
4067
4068 2011-06-24  Cary Coutant  <ccoutant@google.com>
4069
4070         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4071         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4072         (debug_msg_cdebug.err): New targets.
4073         * testsuite/Makefile.in: Regenerate.
4074         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4075         Fix checks for link with shared library.
4076
4077 2011-06-24  Doug Kwan  <dougkwan@google.com>
4078
4079         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4080         skip empty text sections.
4081         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4082
4083 2011-06-22  Ian Lance Taylor  <iant@google.com>
4084
4085         PR gold/12910
4086         * options.h (class General_options): Add --ctors-in-init-array.
4087         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4088         friends as SHT_PROGBITS for merging sections.
4089         (Layout::layout): Remove special handling of .init_array and
4090         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4091         and .dtors if ctors_in_init_array.
4092         (Layout::make_output_section): Force correct section types for
4093         .init_array and friends.  Don't sort if doing relocatable link,
4094         Don't sort .ctors and .dtors if ctors_in_init_array.
4095         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4096         (Layout::output_section_name): Add relobj parameter.  Change all
4097         callers.  Handle .ctors. and .dtors. in code rather than table.
4098         Handle .ctors and .dtors if ctors_in_init_array.
4099         (Layout::match_file_name): New function, moved from output.cc.
4100         * layout.h (class Layout): Update declarations.
4101         * output.cc: Include "layout.h".
4102         (Input_section_sort_entry::get_priority): New function.
4103         (Input_section_sort_entry::match_file_name): Just call
4104         Layout::match_file_name.
4105         (Output_section::Input_section_sort_init_fini_compare::operator()):
4106         Handle .ctors and .dtors.  Sort by explicit priority rather than
4107         by name.
4108         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4109         * testsuite/initpri2.c: New test.
4110         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4111         (check_PROGRAMS): Add initpri2.
4112         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4113         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4114         * configure, testsuite/Makefile.in: Rebuild.
4115
4116 2011-06-19  Ian Lance Taylor  <iant@google.com>
4117
4118         PR gold/12880
4119         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4120         .interp section to a PT_INTERP segment even if we have seen a
4121         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4122         clause in a linker script.
4123         (Layout::finalize): Don't create a .interp section if we've
4124         already create a PT_INTERP segment.
4125         (Layout::create_interp): Always call choose_output_section (revert
4126         patch of 2011-06-17).  Don't create PT_INTERP segment.
4127         * script-sections.cc
4128         (Script_sections::create_note_and_tls_segments): Add a .interp
4129         section to a PT_INTERP segment even if we have seen a
4130         --dynamic-linker option.
4131
4132 2011-06-18  Ian Lance Taylor  <iant@google.com>
4133
4134         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4135         merely because a non-PT_LOAD segment has a dynamic reloc.
4136
4137 2011-06-18  Ian Lance Taylor  <iant@google.com>
4138
4139         * layout.cc (Layout::finish_dynamic_section): Don't create
4140         DT_FLAGS entry if not needed.
4141
4142 2011-06-18  Ian Lance Taylor  <iant@google.com>
4143
4144         PR gold/12745
4145         * layout.cc (Layout::layout_eh_frame): Correct handling of
4146         writable .eh_frame section.
4147
4148 2011-06-17  Ian Lance Taylor  <iant@google.com>
4149
4150         PR gold/12893
4151         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4152         symbol is redefined with the exact same object and value.
4153
4154 2011-06-17  Ian Lance Taylor  <iant@google.com>
4155
4156         PR gold/12880
4157         * layout.h (class Layout): Add interp_segment_ field.
4158         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4159         (Layout::attach_allocated_section_to_segment): If making shared
4160         library, put .interp section in PT_INTERP segment.
4161         (Layout::finalize): Also call create_interp if -dynamic-linker
4162         option was used.
4163         (Layout::create_interp): Assert that there is no PT_INTERP
4164         segment.  If not using a SECTIONS clause, use make_output_section.
4165         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4166         * script-sections.cc
4167         (Script_sections::create_note_and_tls_segments): If making shared
4168         library, put .interp section in PT_INTERP segment.
4169
4170 2011-06-17  Ian Lance Taylor  <iant@google.com>
4171
4172         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4173         when making a shared library.
4174
4175 2011-06-17  Ian Lance Taylor  <iant@google.com>
4176
4177         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4178         parameter.  Change all callers.  Don't issue warning about PC32
4179         against locally defined symbol.
4180
4181 2011-06-16  Ian Lance Taylor  <iant@google.com>
4182
4183         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4184         occurs in same object.
4185
4186 2011-06-14  Alan Modra  <amodra@gmail.com>
4187
4188         * po/POTFILES.in: Regenerate.
4189
4190 2011-06-09  Ian Lance Taylor  <iant@google.com>
4191
4192         * script-sections.cc
4193         (Orphan_output_section::set_section_addresses): For a relocatable
4194         link set address to 0.
4195
4196 2011-06-09  Cary Coutant  <ccoutant@google.com>
4197
4198         PR gold/12804
4199         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4200         used with --compress-debug-sections.
4201         * gold/object.cc (Sized_relobj_file::do_layout): Report
4202         uncompressed size of compressed input sections.
4203
4204 2011-06-08  Cary Coutant  <ccoutant@google.com>
4205
4206         PR gold/12804
4207         * testsuite/two_file_test_2_v1.cc: Change initialization of
4208         v2 to keep it in .data.
4209
4210 2011-06-07  Cary Coutant  <ccoutant@google.com>
4211
4212         * common.cc (Symbol_table::do_allocate_commons_list): Call
4213         gold_fallback.
4214         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4215         (Errors::fallback): New function.
4216         (gold_fallback): New function.
4217         * errors.h (Errors::fallback): New function.
4218         * gold.cc (gold_exit): Change status parameter to enum; adjust
4219         all callers.
4220         (queue_initial_tasks): Call gold_fallback.
4221         * gold.h: Include cstdlib.
4222         (Exit_status): New enum type.
4223         (gold_exit): Change status parameter to enum.
4224         (gold_fallback): New function.
4225         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4226         (Layout::create_symtab_sections): Likewise.
4227         (Layout::create_shdrs): Likewise.
4228         * main.cc (main): Adjust call to gold_exit.
4229         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4230         (Output_data_got::add_got_entry_pair): Likewise.
4231         (Output_section::add_input_section): Likewise.
4232         (Output_section::add_output_section_data): Likewise.
4233         (Output_segment::set_section_list_addresses): Likewise.
4234         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4235
4236 2011-06-07  Cary Coutant  <ccoutant@google.com>
4237
4238         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4239         for incremental links.
4240         * output.cc (Output_segment::set_section_list_addresses): Remove
4241         FIXME and test for TLS or BSS.
4242
4243 2011-06-07  Cary Coutant  <ccoutant@google.com>
4244
4245         * testsuite/Makefile.am: Add incremental_copy_test,
4246         incremental_common_test_1.
4247         * testsuite/Makefile.in: Regenerate.
4248         * testsuite/common_test_1_v1.c: New source file.
4249         * testsuite/common_test_1_v2.c: New source file.
4250         * testsuite/copy_test_v1.cc: New source file.
4251
4252 2011-06-07  Cary Coutant  <ccoutant@google.com>
4253
4254         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4255         update, allocate common from bss section's free list.
4256         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4257         linker-defined symbols.
4258         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4259         Skip GOT and PLT entries that are no longer referenced.
4260         (Output_section_incremental_inputs::write_info_blocks): Mark
4261         linker-defined symbols.
4262         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4263         * output.cc (Output_section::allocate): New function.
4264         * output.h (Output_section::allocate): New function.
4265         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4266         linker-defined symbols.
4267         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4268         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4269         (Symbol::init_base_output_data): Likewise.
4270         (Symbol::init_base_output_segment): Likewise.
4271         (Symbol::init_base_constant): Likewise.
4272         (Sized_symbol::init_output_data): Likewise.
4273         (Sized_symbol::init_output_segment): Likewise.
4274         (Sized_symbol::init_constant): Likewise.
4275         (Symbol_table::do_define_in_output_data): Likewise.
4276         (Symbol_table::do_define_in_output_segment): Likewise.
4277         (Symbol_table::do_define_as_constant): Likewise.
4278         * symtab.h (Symbol::is_predefined): New function.
4279         (Symbol::init_base_output_data): Add is_predefined parameter.
4280         (Symbol::init_base_output_segment): Likewise.
4281         (Symbol::init_base_constant): Likewise.
4282         (Symbol::is_predefined_): New data member.
4283         (Sized_symbol::init_output_data): Add is_predefined parameter.
4284         (Sized_symbol::init_output_segment): Likewise.
4285         (Sized_symbol::init_constant): Likewise.
4286         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4287
4288 2011-06-07  Cary Coutant  <ccoutant@google.com>
4289
4290         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4291         instead of emit_copy_reloc.
4292         (Copy_relocs::emit_copy_reloc): Refactor.
4293         (Copy_relocs::make_copy_reloc): New function.
4294         (Copy_relocs::add_copy_reloc): Remove.
4295         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4296         section.
4297         (Copy_relocs::make_copy_reloc): New function.
4298         (Copy_relocs::add_copy_reloc): Remove.
4299         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4300         unchanged input files.
4301         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4302         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4303         Reserve BSS space for COPY relocations.
4304         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4305         (Output_section_incremental_inputs::write_info_blocks): Record
4306         whether a symbol is copied from a shared object.
4307         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4308         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4309         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4310         (Incremental_input_entry_reader::get_output_symbol_index): Add
4311         is_copy parameter.
4312         (Incremental_binary::emit_copy_relocs): New function.
4313         (Incremental_binary::do_emit_copy_relocs): New function.
4314         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4315         new data member.
4316         (Sized_incremental_binary::add_copy_reloc): New function.
4317         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4318         (Sized_incremental_binary::Copy_reloc): New struct.
4319         (Sized_incremental_binary::Copy_relocs): New typedef.
4320         (Sized_incremental_binary::copy_relocs_): New data member.
4321         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4322         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4323         * target.h (Sized_target::emit_copy_reloc): New function.
4324         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4325
4326 2011-06-02  Cary Coutant  <ccoutant@google.com>
4327
4328         PR gold/12163
4329         * gold/archive.cc (Archive::Archive): Initialize new data member.
4330         (Archive::include_all_members): Return if archive has already been
4331         included.
4332         * gold/archive.h (Archive::include_all_members_): New data member.
4333
4334 2011-06-02  Nick Clifton  <nickc@redhat.com>
4335
4336         * dynobj.h: Fix spelling mistake in comment.
4337         * output.cc: Likewise.
4338
4339 2011-05-31  Doug Kwan  <dougkwan@google.com>
4340             Asier Llano
4341
4342         PR gold/12826
4343         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4344         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4345         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4346         redundant arm_exidx_test.so.
4347         * testsuite/Makefile.in: Regenerate.
4348         (check_SCRIPTS): Add pr12826.sh
4349         (check_DATA): Add pr12826.stdout
4350         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4351         * testsuite/pr12826.sh: New file.
4352         * testsuite/pr12826_1.s: Ditto.
4353         * testsuite/pr12826_1.s: Ditto.
4354
4355 2011-05-30  Ian Lance Taylor  <iant@google.com>
4356
4357         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4358         sections.
4359
4360 2011-05-29  Ian Lance Taylor  <iant@google.com>
4361
4362         PR gold/12804
4363         * testsuite/Makefile.am: Use different file name for two_file_test
4364         temporary file for each incremental test.
4365         * testsuite/Makefile.in: Rebuild.
4366
4367 2011-05-29  Ian Lance Taylor  <iant@google.com>
4368
4369         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4370         binary input file is empty.
4371
4372 2011-05-27  Ian Lance Taylor  <iant@google.com>
4373
4374         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4375         (ver_test_9.so): Likewise.
4376         * testsuite/Makefile.in: Rebuild.
4377
4378 2011-05-26 Cary Coutant  <ccoutant@google.com>
4379
4380         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4381         * incremental.cc (Incremental_inputs::report_input_section): Fix
4382         comment, indentation.
4383         (Incremental_inputs::report_comdat_group): New function.
4384         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4385         of data for incremental input file entry.
4386         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4387         group count, COMDAT group signatures.
4388         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4389         an unchanged input file.
4390         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4391         Initialize new data member.
4392         (Incremental_object_entry::add_comdat_group): New function.
4393         (Incremental_object_entry::get_comdat_group_count): New function.
4394         (Incremental_object_entry::get_comdat_signature_key): New function.
4395         (Incremental_object_entry::groups_): New data member.
4396         (Incremental_inputs::report_comdat_group): New function.
4397         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4398         data for incremental input file entry.
4399         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4400         (Incremental_input_entry_reader::get_input_section): Adjust size of
4401         data for incremental input file entry.
4402         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4403         (Incremental_input_entry_reader::get_comdat_group_signature): New
4404         function.
4405         * object.cc (Sized_relobj::include_section_group): Report kept
4406         COMDAT groups for incremental links.
4407
4408 2011-05-24  David Meyer  <pdox@google.com>
4409
4410         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4411         with name parameter.  Add found_name parameter.
4412         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4413         * dirsearch.h (class Dirsearch): Update declaration.
4414
4415 2011-05-24  Ian Lance Taylor  <iant@google.com>
4416
4417         * archive.cc (Library_base::should_include_member): Pull in object
4418         from archive if it defines the entry symbol.
4419         * parameters.cc (Parameters::entry): New function.
4420         * parameters.h (class Parameters): Declare entry.
4421         * output.h (class Output_file_header): Remove entry_ field.
4422         * output.cc (Output_file_header::Output_file_header): Remove entry
4423         parameter.  Change all callers.
4424         (Output_file_header::entry): Use parameters->entry.
4425         * gold.cc (queue_middle_tasks): Likewise.
4426         * plugin.cc (Plugin_hook::run): Likewise.
4427
4428 2011-05-24 Cary Coutant  <ccoutant@google.com>
4429
4430         * gold.cc (queue_initial_tasks): Pass incremental base filename
4431         to Output_file::open_base_file; don't print error message.
4432         * incremental-dump.cc (main): Adjust call to
4433         Output_file::open_for_modification.
4434         * incremental-dump.cc (main): Likewise.
4435         * incremental.cc (Incremental_inputs::report_command_line):
4436         Ignore --incremental-base option when comparing command lines.
4437         Ignore parameter when given as separate argument.
4438         * options.h (class General_options): Add --incremental-base.
4439         * output.cc (Output_file::Output_file):
4440         (Output_file::open_base_file): Add base_name and writable parameters;
4441         read base file into new file; print error message here.
4442         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4443         callers.
4444         * output.h (Output_file::open_for_modification): Rename to...
4445         (Output_file::open_base_file): ...this; add base_name and
4446         writable parameters; adjust all callers.
4447         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4448         callers.
4449         * testsuite/Makefile.am (incremental_test_4): Test
4450         --incremental-base.
4451         * testsuite/Makefile.in: Regenerate.
4452
4453 2011-05-24 Cary Coutant  <ccoutant@google.com>
4454
4455         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4456         incremental_test_4.
4457         * testsuite/Makefile.in: Regenerate.
4458         * testsuite/two_file_test_1_v1.cc: New test source file.
4459         * testsuite/two_file_test_1b_v1.cc: New test source file.
4460         * testsuite/two_file_test_2_v1.cc: New test source file.
4461
4462 2011-05-24 Cary Coutant  <ccoutant@google.com>
4463
4464         * dynobj.h (Dynobj::do_dynobj): New function.
4465         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4466         flag and soname for shared objects.
4467         * incremental.cc (Incremental_inputs::report_object): Make
4468         either Incremental_object_entry or Incremental_dynobj_entry; add
4469         soname to string table.
4470         (Incremental_inputs::report_input_section): Add assertion.
4471         (Output_section_incremental_inputs::set_final_data_size): Adjust
4472         type of input file entry for shared libraries; adjust size of
4473         shared library info entry.
4474         (Output_section_incremental_inputs::write_input_files): Write
4475         as_needed flag for shared libraries.
4476         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4477         of input file entry for shared libraries; write soname.
4478         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4479         soname from incremental info.
4480         * incremental.h (enum Incremental_input_flags): Add
4481         INCREMENTAL_INPUT_AS_NEEDED.
4482         (Incremental_input_entry::Incremental_input_entry): Initialize new
4483         data member.
4484         (Incremental_input_entry::set_as_needed): New function.
4485         (Incremental_input_entry::as_needed): New function.
4486         (Incremental_input_entry::do_dynobj_entry): New function.
4487         (Incremental_input_entry::as_needed_): New data member.
4488         (Incremental_object_entry::Incremental_object_entry): Don't check
4489         for shared library.
4490         (Incremental_object_entry::do_type): Likewise.
4491         (class Incremental_dynobj_entry): New class.
4492         (Incremental_input_entry_reader::as_needed): New function.
4493         (Incremental_input_entry_reader::get_soname): New function.
4494         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4495         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4496         size of shared library info entry.
4497         * layout.cc (Layout::finish_dynamic_section): Don't test for
4498         incremental link when adding DT_NEEDED entries.
4499         * object.h (Object::Object): Initialize new data member.
4500         (Object::dynobj): New function.
4501         (Object::set_as_needed): New function.
4502         (Object::as_needed): New function.
4503         (Object::do_dynobj): New function.
4504         (Object::as_needed_): New data member.
4505
4506 2011-05-24 Cary Coutant  <ccoutant@google.com>
4507
4508         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4509         info; adjust display of GOT entries.
4510         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4511         vector of input objects; remove file_status_.
4512         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4513         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4514         got_plt reader; call target hooks to reserve GOT entries.
4515         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4516         of input file info header and GOT info entry.
4517         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4518         relocation info.
4519         (Got_plt_view_info::got_descriptor): Remove.
4520         (Got_plt_view_info::sym_index): New data member.
4521         (Got_plt_view_info::input_index): New data member.
4522         (Local_got_offset_visitor::visit): Write input file index.
4523         (Global_got_offset_visitor::visit): Write 0 for input file index.
4524         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4525         with sym_index and input_index.
4526         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4527         incremental info GOT entry; replace got_descriptor with input_index.
4528         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4529         map from input file index to object.
4530         (Sized_relobj_incr::do_layout): Replace direct data member reference
4531         with accessor function.
4532         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4533         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4534         Adjust size of input file info header.
4535         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4536         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4537         (Incremental_input_entry_reader::get_input_section): Adjust size of
4538         input file info header.
4539         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4540         of incremental info GOT entry.
4541         (Incremental_got_plt_reader::get_got_desc): Remove.
4542         (Incremental_got_plt_reader::get_got_symndx): New function.
4543         (Incremental_got_plt_reader::get_got_input_index): New function.
4544         (Sized_incremental_binary::Sized_incremental_binary): Remove
4545         file_status_; add input_objects_.
4546         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4547         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4548         (Sized_incremental_binary::file_is_unchanged): Remove.
4549         (Sized_incremental_binary::set_input_object): New function.
4550         (Sized_incremental_binary::input_object): New function.
4551         (Sized_incremental_binary::file_status_): Remove.
4552         (Sized_incremental_binary::input_objects_): New data member.
4553         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4554         references.
4555         (Sized_relobj_incr::invalid_address): Move to base class.
4556         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4557         class.
4558         (Sized_relobj_incr::do_output_section_offset): Likewise.
4559         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4560         (Sized_relobj_incr::section_offsets_): Likewise.
4561         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4562         function.
4563         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4564         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4565         with accessor function.
4566         (Sized_relobj_file::do_layout): Likewise.
4567         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4568         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4569         (Sized_relobj_file::compute_final_local_value): Replace refs to
4570         section_offsets_ with accessor function.
4571         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4572         * object.h (Relobj::Relobj): Initialize new data members.
4573         (Relobj::add_dyn_reloc): New function.
4574         (Relobj::first_dyn_reloc): New function.
4575         (Relobj::dyn_reloc_count): New function.
4576         (Relobj::first_dyn_reloc_): New data member.
4577         (Relobj::dyn_reloc_count_): New data member.
4578         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4579         references.
4580         (Sized_relobj::Address): New typedef.
4581         (Sized_relobj::invalid_address): Move here from child class.
4582         (Sized_relobj::Sized_relobj): Initialize new data members.
4583         (Sized_relobj::sized_relobj): New function.
4584         (Sized_relobj::is_output_section_offset_invalid): Move here from
4585         child class.
4586         (Sized_relobj::get_output_section_offset): Likewise.
4587         (Sized_relobj::local_has_got_offset): Likewise.
4588         (Sized_relobj::local_got_offset): Likewise.
4589         (Sized_relobj::set_local_got_offset): Likewise.
4590         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4591         (Sized_relobj::clear_got_offsets): New function.
4592         (Sized_relobj::section_offsets): Move here from child class.
4593         (Sized_relobj::do_output_section_offset): Likewise.
4594         (Sized_relobj::do_set_section_offset): Likewise.
4595         (Sized_relobj::Local_got_offsets): Likewise.
4596         (Sized_relobj::local_got_offsets_): Likewise.
4597         (Sized_relobj::section_offsets_): Likewise.
4598         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4599         references.
4600         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4601         class.
4602         (Sized_relobj_file::sized_relobj): New function
4603         (Sized_relobj_file::local_has_got_offset): Move to base class.
4604         (Sized_relobj_file::local_got_offset): Likewise.
4605         (Sized_relobj_file::set_local_got_offset): Likewise.
4606         (Sized_relobj_file::get_output_section_offset): Likewise.
4607         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4608         (Sized_relobj_file::do_output_section_offset): Likewise.
4609         (Sized_relobj_file::do_set_section_offset): Likewise.
4610         (Sized_relobj_file::Local_got_offsets): Likewise.
4611         (Sized_relobj_file::local_got_offsets_): Likewise.
4612         (Sized_relobj_file::section_offsets_): Likewise.
4613         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4614         (all constructors).
4615         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4616         (Output_reloc::get_symbol_index): Likewise.
4617         (Output_reloc::local_section_offset): Likewise.
4618         (Output_reloc::get_address): Likewise.
4619         (Output_reloc::symbol_value): Likewise.
4620         (Output_data_got::reserve_slot): Move to class definition.
4621         (Output_data_got::reserve_local): New function.
4622         (Output_data_got::reserve_slot_for_global): Remove.
4623         (Output_data_got::reserve_global): New function.
4624         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4625         (all constructors, two instantiations).
4626         (Output_reloc::get_relobj): New function (two instantiations).
4627         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4628         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4629         (Output_data_reloc::add_global): Adjust type of relobj.
4630         (Output_data_reloc::add_global_relative): Likewise.
4631         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4632         (Output_data_reloc::add_local): Likewise.
4633         (Output_data_reloc::add_local_relative): Likewise.
4634         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4635         (Output_data_reloc::add_local_section): Likewise.
4636         (Output_data_reloc::add_output_section): Likewise.
4637         (Output_data_reloc::add_absolute): Likewise.
4638         (Output_data_reloc::add_target_specific): Likewise.
4639         (Output_data_got::reserve_slot): Move definition here.
4640         (Output_data_got::reserve_local): New function.
4641         (Output_data_got::reserve_global): New function.
4642         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4643         section_offsets_ with accessor function.
4644         (Sized_relobj_file::write_sections): Likewise.
4645         (Sized_relobj_file::do_relocate_sections): Likewise.
4646         * target.h (Sized_target::reserve_local_got_entry): New function.
4647         (Sized_target::reserve_global_got_entry): New function.
4648         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4649         (Target_x86_64::reserve_global_got_entry): New function.
4650         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4651
4652 2011-05-23 Cary Coutant  <ccoutant@google.com>
4653
4654         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4655         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4656         bit when checking got_type.
4657         * incremental.cc (Sized_incremental_binary::setup_readers):
4658         Store symbol table and string table locations; initialize bit vector
4659         of file status flags.
4660         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4661         unchanged files.
4662         (Sized_incremental_binary::do_process_got_plt): New function.
4663         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4664         (Output_section_incremental_inputs::set_final_data_size): Record
4665         file index for each input file.
4666         (Output_section_incremental_inputs::write_got_plt): Store file index
4667         instead of input entry offset for each GOT entry.
4668         * incremental.h
4669         (Incremental_input_entry::Incremental_input_entry): Initialize new
4670         data member.
4671         (Incremental_input_entry::set_offset): Store file index.
4672         (Incremental_input_entry::get_file_index): New function.
4673         (Incremental_input_entry::file_index_): New data member.
4674         (Incremental_binary::process_got_plt): New function.
4675         (Incremental_binary::do_process_got_plt): New function.
4676         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4677         data members.
4678         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4679         (Sized_incremental_binary::set_file_is_unchanged): New function.
4680         (Sized_incremental_binary::file_is_unchanged): New function.
4681         (Sized_incremental_binary::do_process_got_plt): New function.
4682         (Sized_incremental_binary::file_status_): New data member.
4683         (Sized_incremental_binary::main_symtab_loc_): New data member.
4684         (Sized_incremental_binary::main_strtab_loc_): New data member.
4685         * output.cc (Output_data_got::Got_entry::write): Add case
4686         RESERVED_CODE.
4687         (Output_data_got::add_global): Call add_got_entry.
4688         (Output_data_got::add_global_plt): Likewise.
4689         (Output_data_got::add_global_with_rel): Likewise.
4690         (Output_data_got::add_global_with_rela): Likewise.
4691         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4692         (Output_data_got::add_global_pair_with_rela): Likewise.
4693         (Output_data_got::add_local): Call add_got_entry.
4694         (Output_data_got::add_local_plt): Likewise.
4695         (Output_data_got::add_local_with_rel): Likewise.
4696         (Output_data_got::add_local_with_rela): Likewise.
4697         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4698         (Output_data_got::add_local_pair_with_rela): Likewise.
4699         (Output_data_got::reserve_slot): New function.
4700         (Output_data_got::reserve_slot_for_global): New function.
4701         (Output_data_got::add_got_entry): New function.
4702         (Output_data_got::add_got_entry_pair): New function.
4703         (Output_section::add_output_section_data): Edit FIXME.
4704         * output.h
4705         (Output_section_data_build::Output_section_data_build): New
4706         constructor with size parameter.
4707         (Output_data_space::Output_data_space): Likewise.
4708         (Output_data_got::Output_data_got): Initialize new data member; new
4709         constructor with size parameter.
4710         (Output_data_got::add_constant): Call add_got_entry.
4711         (Output_data_got::reserve_slot): New function.
4712         (Output_data_got::reserve_slot_for_global): New function.
4713         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4714         (Output_data_got::add_got_entry): New function.
4715         (Output_data_got::add_got_entry_pair): New function.
4716         (Output_data_got::free_list_): New data member.
4717         * target.h (Sized_target::init_got_plt_for_update): New function.
4718         (Sized_target::register_global_plt_entry): New function.
4719         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4720         Initialize new data member; call init; add constructor with PLT count.
4721         (Output_data_plt_x86_64::init): New function.
4722         (Output_data_plt_x86_64::add_relocation): New function.
4723         (Output_data_plt_x86_64::reserve_slot): New function.
4724         (Output_data_plt_x86_64::free_list_): New data member.
4725         (Target_x86_64::init_got_plt_for_update): New function.
4726         (Target_x86_64::register_global_plt_entry): New function.
4727         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4728         incremental updates.
4729         (Output_data_plt_x86_64::add_relocation): New function.
4730         * testsuite/object_unittest.cc (Object_test): Set default options.
4731
4732 2011-05-16  Ian Lance Taylor  <iant@google.com>
4733
4734         * options.h (class General_options): Make -i a synonym for -r.
4735
4736 2011-05-16  Ian Lance Taylor  <iant@google.com>
4737
4738         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4739
4740 2011-05-10 Cary Coutant  <ccoutant@google.com>
4741
4742         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4743         strip_all (-s).
4744
4745 2011-05-06  Ian Lance Taylor  <iant@google.com>
4746
4747         * layout.cc (Layout::layout): If the output section flags change,
4748         update the ordering.
4749
4750 2011-04-25 Cary Coutant  <ccoutant@google.com>
4751
4752         * incremental-dump.cc (dump_incremental_inputs): Print local
4753         symbol info for each input file.
4754         * incremental.cc
4755         (Output_section_incremental_inputs::set_final_data_size): Add local
4756         symbol info to input file entries in incremental info.
4757         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4758         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4759         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4760         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4761         implementation.
4762         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4763         (Sized_incr_relobj::do_relocate): Write the local symbols.
4764         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4765         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4766         Adjust size of input file header.
4767         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4768         (Incremental_inputs_reader::get_local_symbol_count): New function.
4769         (Incremental_inputs_reader::get_input_section): Adjust size of input
4770         file header.
4771         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4772         (Sized_incr_relobj::This): New typedef.
4773         (Sized_incr_relobj::sym_size): New const data member.
4774         (Sized_incr_relobj::Local_symbol): New struct.
4775         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4776         (Sized_incr_relobj::do_local_symbol_offset): New function.
4777         (Sized_incr_relobj::local_symbol_count_): New data member.
4778         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4779         (Sized_incr_relobj::local_symbol_index_): New data member.
4780         (Sized_incr_relobj::local_symbol_offset_): New data member.
4781         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4782         (Sized_incr_relobj::local_symbols_): New data member.
4783         * object.h (Relobj::output_local_symbol_count): New function.
4784         (Relobj::local_symbol_offset): New function.
4785         (Relobj::do_output_local_symbol_count): New function.
4786         (Relobj::do_local_symbol_offset): New function.
4787         (Sized_relobj::do_output_local_symbol_count): New function.
4788         (Sized_relobj::do_local_symbol_offset): New function.
4789
4790 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4791
4792         * descriptors.cc (set_close_on_exec): New function.
4793         (Descriptors::open): Use set_close_on_exec.
4794         * output.cc (S_ISLNK): Define if not defined.
4795
4796 2011-04-22 Cary Coutant  <ccoutant@google.com>
4797
4798         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4799         global symbol map.
4800         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4801         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4802         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4803         relocations.
4804         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4805         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4806         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4807         * incremental.h
4808         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4809         function.
4810         (Incremental_binary::apply_incremental_relocs): New function.
4811         (Incremental_binary::do_apply_incremental_relocs): New function.
4812         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4813         data member.
4814         (Sized_incremental_binary::add_global_symbol): New function.
4815         (Sized_incremental_binary::global_symbol): New function.
4816         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4817         (Sized_incremental_binary::symbol_map_): New data member.
4818         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4819         * target.h (Sized_target::apply_relocation): New function.
4820         * target-reloc.h (apply_relocation): New function.
4821         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4822
4823 2011-04-22  Doug Kwan  <dougkwan@google.com>
4824
4825         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4826         flag of a SHT_ARM_EXIDX section.
4827         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4828         * testsuite/Makefile.in: Regenerate.
4829         * testsuite/arm_exidx_test.s: New file.
4830         * testsuite/arm_exidx_test.sh: Same.
4831
4832 2011-04-20 Cary Coutant  <ccoutant@google.com>
4833
4834         PR gold/12689
4835         * archive.h (Incremental_archive_entry::Archive_member):
4836         Initialize arg_serial_ (second constructor).
4837
4838 2011-04-17  Ian Lance Taylor  <iant@google.com>
4839
4840         * object.cc (Relocate_info::location): Simplify location string.
4841         * errors.cc (Errors::error_at_location): Don't print program
4842         name.
4843         (Errors::warning_at_location): Likewise.
4844         (Errors::undefined_symbol): Likewise.
4845         * testsuite/debug_msg.sh: Update accordingly.
4846
4847 2011-04-14 Cary Coutant  <ccoutant@google.com>
4848
4849         * gold/layout.cc (Layout::symtab_section_offset): New function.
4850         * gold/layout.h (Layout::symtab_section_offset): New function.
4851         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4852
4853 2011-04-12  Ian Lance Taylor  <iant@google.com>
4854
4855         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4856         with MREMAP_MAYMOVE.
4857         * output.h (class Output_file): Add map_is_allocated_ field.
4858         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4859         not available, provide stubs.  If mremap is not available, #define
4860         it to gold_mremap.
4861         (MREMAP_MAYMOVE): Define if not defined.
4862         (Output_file::Output_file): Initialize map_is_allocated_.
4863         (Output_file::resize): Check map_is_allocated_.
4864         (Output_file::map_anonymous): If mmap fails, use malloc.
4865         (Output_file::unmap): Don't do anything for an anonymous map.
4866         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4867         is not available, provide stubs.
4868         (File_read::View::~View): Use free rather than delete[].
4869         (File_read::make_view): Use malloc rather than new[].  If mmap
4870         fails, use malloc.
4871         (File_read::find_or_make_view): Use malloc rather than new[].
4872         * gold.h: Remove HAVE_REMAP code.
4873         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4874         exists.  Rename mremap to gold_mremap.  If mmap is not available
4875         don't do anything.
4876         * configure, config.in: Rebuild.
4877
4878 2011-04-11  Ian Lance Taylor  <iant@google.com>
4879
4880         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4881         initialize local variable v.
4882
4883 2011-04-11  Cary Coutant  <ccoutant@google.com>
4884
4885         * archive.cc (Archive::include_member): Adjust call to
4886         report_object.
4887         (Add_archive_symbols::run): Track argument serial numbers.
4888         (Lib_group::include_member): Likewise.
4889         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4890         * archive.h (Incremental_archive_entry::Archive_member):
4891         Initialize arg_serial_.
4892         (Archive_member::arg_serial_): New data member.
4893         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4894         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4895         incremental link.
4896         (Sized_dynobj::do_for_all_local_got_entries): New function.
4897         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4898         function.
4899         * fileread.cc (get_mtime): New function.
4900         * fileread.h (get_mtime): New function.
4901         * gold.cc (queue_initial_tasks): Check for incremental update.
4902         (process_incremental_input): New function.
4903         (queue_middle_tasks): Don't force valid target for incremental
4904         update.
4905         * incremental-dump.cc (find_input_containing_global): Adjust
4906         size of symbol info entry.
4907         (dump_incremental_inputs): Dump argument serial number and
4908         in_system_directory flag; bias shndx by 1; print symbol names
4909         when dumping per-file symbol lists; use new symbol info readers.
4910         * incremental.cc
4911         (Output_section_incremental_inputs:update_data_size): New function.
4912         (Sized_incremental_binary::setup_readers): Setup input readers
4913         for each input file; build maps for files added from libraries
4914         and scripts.
4915         (Sized_incremental_binary::check_input_args): New function.
4916         (Sized_incremental_binary::do_check_inputs): Build map of argument
4917         serial numbers to input arguments.
4918         (Sized_incremental_binary::do_file_has_changed): Rename
4919         do_file_is_unchanged to this; compare file modification times.
4920         (Sized_incremental_binary::do_init_layout): New function.
4921         (Sized_incremental_binary::do_reserve_layout): New function.
4922         (Sized_incremental_binary::do_get_input_reader): Remove.
4923         (Sized_incremental_binary::get_symtab_view): New function.
4924         (Incremental_checker::can_incrementally_link_output_file): Remove.
4925         (Incremental_inputs::report_command_line): Exclude --debug options.
4926         (Incremental_inputs::report_archive_begin): Add parameter; track
4927         argument serial numbers; don't put input file entry for archive
4928         before archive members.
4929         (Incremental_inputs::report_archive_end): Put input file entry
4930         for archive after archive members.
4931         (Incremental_inputs::report_object): Add parameter; track argument
4932         serial numbers and in_system_directory flag.
4933         (Incremental_inputs::report_script): Add parameter; track argument
4934         serial numbers.
4935         (Output_section_incremental_inputs::set_final_data_size): Adjust
4936         size of symbol info entry; check for forwarding symbols.
4937         (Output_section_incremental_inputs::write_input_files): Write
4938         in_system_directory flag and argument serial number.
4939         (Output_section_incremental_inputs::write_info_blocks): Map section
4940         indices between incremental info and original input file; store
4941         input section index for each symbol.
4942         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4943         change operator() to visit().
4944         (class Global_got_offset_visitor): Likewise.
4945         (class Global_symbol_visitor_got_plt):
4946         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4947         classes.
4948         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4949         (Sized_incr_relobj::do_read_symbols): New function.
4950         (Sized_incr_relobj::do_layout): New function.
4951         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4952         (Sized_incr_relobj::do_add_symbols): New function.
4953         (Sized_incr_relobj::do_should_include_member): New function.
4954         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4955         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4956         (Sized_incr_relobj::do_section_size): New function.
4957         (Sized_incr_relobj::do_section_name): New function.
4958         (Sized_incr_relobj::do_section_contents): New function.
4959         (Sized_incr_relobj::do_section_flags): New function.
4960         (Sized_incr_relobj::do_section_entsize): New function.
4961         (Sized_incr_relobj::do_section_address): New function.
4962         (Sized_incr_relobj::do_section_type): New function.
4963         (Sized_incr_relobj::do_section_link): New function.
4964         (Sized_incr_relobj::do_section_info): New function.
4965         (Sized_incr_relobj::do_section_addralign): New function.
4966         (Sized_incr_relobj::do_initialize_xindex): New function.
4967         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4968         (Sized_incr_relobj::do_read_relocs): New function.
4969         (Sized_incr_relobj::do_gc_process_relocs): New function.
4970         (Sized_incr_relobj::do_scan_relocs): New function.
4971         (Sized_incr_relobj::do_count_local_symbols): New function.
4972         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4973         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4974         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4975         (Sized_incr_relobj::do_relocate): New function.
4976         (Sized_incr_relobj::do_set_section_offset): New function.
4977         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4978         (Sized_incr_dynobj::do_read_symbols): New function.
4979         (Sized_incr_dynobj::do_layout): New function.
4980         (Sized_incr_dynobj::do_add_symbols): New function.
4981         (Sized_incr_dynobj::do_should_include_member): New function.
4982         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4983         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4984         (Sized_incr_dynobj::do_section_size): New function.
4985         (Sized_incr_dynobj::do_section_name): New function.
4986         (Sized_incr_dynobj::do_section_contents): New function.
4987         (Sized_incr_dynobj::do_section_flags): New function.
4988         (Sized_incr_dynobj::do_section_entsize): New function.
4989         (Sized_incr_dynobj::do_section_address): New function.
4990         (Sized_incr_dynobj::do_section_type): New function.
4991         (Sized_incr_dynobj::do_section_link): New function.
4992         (Sized_incr_dynobj::do_section_info): New function.
4993         (Sized_incr_dynobj::do_section_addralign): New function.
4994         (Sized_incr_dynobj::do_initialize_xindex): New function.
4995         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4996         (make_sized_incremental_object): New function.
4997         (Incremental_library::copy_unused_symbols): New function.
4998         (Incremental_library::do_for_all_unused_symbols): New function.
4999         * incremental.h (enum Incremental_input_flags): New type.
5000         (class Incremental_checker): Remove.
5001         (Incremental_input_entry::Incremental_input_entry): Add argument
5002         serial number.
5003         (Incremental_input_entry::arg_serial): New function.
5004         (Incremental_input_entry::set_is_in_system_directory): New function.
5005         (Incremental_input_entry::is_in_system_directory): New function.
5006         (Incremental_input_entry::arg_serial_): New data member.
5007         (Incremental_input_entry::is_in_system_directory_): New data member.
5008         (class Script_info): Move here from script.h.
5009         (Script_info::Script_info): Add filename parameter.
5010         (Script_info::filename): New function.
5011         (Script_info::filename_): New data member.
5012         (Incremental_script_entry::Incremental_script_entry): Add argument
5013         serial number.
5014         (Incremental_object_entry::Incremental_object_entry): Likewise.
5015         (Incremental_object_entry::add_input_section): Build list of input
5016         sections with map to original shndx.
5017         (Incremental_object_entry::get_input_section_index): New function.
5018         (Incremental_object_entry::shndx_): New data member.
5019         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5020         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5021         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5022         serial number.
5023         (Incremental_inputs::report_archive_begin): Likewise.
5024         (Incremental_inputs::report_object): Likewise.
5025         (Incremental_inputs::report_script): Likewise.
5026         (class Incremental_global_symbol_reader): New class.
5027         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5028         and store flags and input file type.
5029         (Incremental_input_entry_reader::arg_serial): New function.
5030         (Incremental_input_entry_reader::type): Extract type from flags.
5031         (Incremental_input_entry_reader::is_in_system_directory): New function.
5032         (Incremental_input_entry_reader::get_input_section_count): Call
5033         accessor function for type.
5034         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5035         function for type; adjust size of global symbol entry.
5036         (Incremental_input_entry_reader::get_global_symbol_count): Call
5037         accessor function for type.
5038         (Incremental_input_entry_reader::get_object_count): Likewise.
5039         (Incremental_input_entry_reader::get_object_offset): Likewise.
5040         (Incremental_input_entry_reader::get_member_count): Likewise.
5041         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5042         (Incremental_input_entry_reader::get_member_offset): Likewise.
5043         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5044         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5045         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5046         (Incremental_input_entry_reader::get_global_symbol_reader): New
5047         function.
5048         (Incremental_input_entry_reader::get_output_symbol_index): New
5049         function.
5050         (Incremental_input_entry_reader::type_): Remove.
5051         (Incremental_input_entry_reader::flags_): New data member.
5052         (Incremental_inputs_reader::input_file_offset): New function.
5053         (Incremental_inputs_reader::input_file_index): New function.
5054         (Incremental_inputs_reader::input_file): Call input_file_offset.
5055         (Incremental_inputs_reader::input_file_at_offset): New function.
5056         (Incremental_relocs_reader::get_r_type): Reformat.
5057         (Incremental_relocs_reader::get_r_shndx): Reformat.
5058         (Incremental_relocs_reader::get_r_offset): Reformat.
5059         (Incremental_relocs_reader::data): New function.
5060         (Incremental_binary::Incremental_binary): Initialize new data members.
5061         (Incremental_binary::check_inputs): Add cmdline parameter.
5062         (Incremental_binary::file_is_unchanged): Remove.
5063         (Input_reader::arg_serial): New function.
5064         (Input_reader::get_unused_symbol_count): New function.
5065         (Input_reader::get_unused_symbol): New function.
5066         (Input_reader::do_arg_serial): New function.
5067         (Input_reader::do_get_unused_symbol_count): New function.
5068         (Input_reader::do_get_unused_symbol): New function.
5069         (Incremental_binary::input_file_count): New function.
5070         (Incremental_binary::get_input_reader): Change signature to use
5071         index instead of filename.
5072         (Incremental_binary::file_has_changed): New function.
5073         (Incremental_binary::get_input_argument): New function.
5074         (Incremental_binary::get_library): New function.
5075         (Incremental_binary::get_script_info): New function.
5076         (Incremental_binary::init_layout): New function.
5077         (Incremental_binary::reserve_layout): New function.
5078         (Incremental_binary::output_file): New function.
5079         (Incremental_binary::do_check_inputs): New function.
5080         (Incremental_binary::do_file_is_unchanged): Remove.
5081         (Incremental_binary::do_file_has_changed): New function.
5082         (Incremental_binary::do_init_layout): New function.
5083         (Incremental_binary::do_reserve_layout): New function.
5084         (Incremental_binary::do_input_file_count): New function.
5085         (Incremental_binary::do_get_input_reader): Change signature.
5086         (Incremental_binary::input_args_map_): New data member.
5087         (Incremental_binary::library_map_): New data member.
5088         (Incremental_binary::script_map_): New data member.
5089         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5090         new data members.
5091         (Sized_incremental_binary::output_section): New function.
5092         (Sized_incremental_binary::inputs_reader): Add const.
5093         (Sized_incremental_binary::symtab_reader): Add const.
5094         (Sized_incremental_binary::relocs_reader): Add const.
5095         (Sized_incremental_binary::got_plt_reader): Add const.
5096         (Sized_incremental_binary::get_symtab_view): New function.
5097         (Sized_incremental_binary::Inputs_reader): New typedef.
5098         (Sized_incremental_binary::Input_entry_reader): New typedef.
5099         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5100         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5101         (Sized_incremental_binary::do_file_has_changed): New function.
5102         (Sized_incremental_binary::do_init_layout): New function.
5103         (Sized_incremental_binary::do_reserve_layout): New function.
5104         (Sized_input_reader::Inputs_reader): Remove.
5105         (Sized_input_reader::Input_entry_reader): Remove.
5106         (Sized_input_reader::do_arg_serial): New function.
5107         (Sized_input_reader::do_get_unused_symbol_count): New function.
5108         (Sized_input_reader::do_get_unused_symbol): New function.
5109         (Sized_incremental_binary::do_input_file_count): New function.
5110         (Sized_incremental_binary::do_get_input_reader): Change signature;
5111         use index instead of filename.
5112         (Sized_incremental_binary::section_map_): New data member.
5113         (Sized_incremental_binary::input_entry_readers_): New data member.
5114         (class Sized_incr_relobj): New class.
5115         (class Sized_incr_dynobj): New class.
5116         (make_sized_incremental_object): New function.
5117         (class Incremental_library): New class.
5118         * layout.cc (Free_list::num_lists): New static data member.
5119         (Free_list::num_nodes): New static data member.
5120         (Free_list::num_removes): New static data member.
5121         (Free_list::num_remove_visits): New static data member.
5122         (Free_list::num_allocates): New static data member.
5123         (Free_list::num_allocate_visits): New static data member.
5124         (Free_list::init): New function.
5125         (Free_list::remove): New function.
5126         (Free_list::allocate): New function.
5127         (Free_list::dump): New function.
5128         (Free_list::print_stats): New function.
5129         (Layout_task_runner::run): Resize output file for incremental updates.
5130         (Layout::Layout): Initialize new data members.
5131         (Layout::set_incremental_base): New function.
5132         (Layout::init_fixed_output_section): New function.
5133         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5134         incremental updates.
5135         (Layout::create_gold_note): Do not create gold note section for
5136         incremental updates.
5137         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5138         for incremental updates.
5139         (Layout::set_section_offsets): For incremental updates, allocate space
5140         from free list.
5141         (Layout::create_symtab_sections): Layout with offsets relative to
5142         start of section; for incremental updates, allocate space from free
5143         list.
5144         (Layout::create_shdrs): For incremental updates, allocate space from
5145         free list.
5146         (Layout::finish_dynamic_section): For incremental updates, do not
5147         check --as-needed (fixed in subsequent patch).
5148         * layout.h (class Free_list): New class.
5149         (Layout::set_incremental_base): New function.
5150         (Layout::incremental_base): New function.
5151         (Layout::init_fixed_output_section): New function.
5152         (Layout::allocate): New function.
5153         (Layout::incremental_base_): New data member.
5154         (Layout::free_list_): New data member.
5155         * main.cc (main): Print Free_list statistics.
5156         * object.cc (Relobj::finalize_incremental_relocs): Add
5157         clear_counts parameter; clear counts only when clear_counts is set.
5158         (Sized_relobj::Sized_relobj): Initialize new base class.
5159         (Sized_relobj::do_layout): Don't report special sections.
5160         (Sized_relobj::do_for_all_local_got_entries): New function.
5161         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5162         symtab_off to all symbol table offsets.
5163         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5164         * object.h (class Got_offset_list): Move to top of file.
5165         (Object::Object): Allow case where input_file == NULL.
5166         (Object::~Object): Likewise.
5167         (Object::input_file): Assert that input_file != NULL.
5168         (Object::lock): Allow case where input_file == NULL.
5169         (Object::unlock): Likewise.
5170         (Object::is_locked): Likewise.
5171         (Object::token): Likewise.
5172         (Object::release): Likewise.
5173         (Object::is_incremental): New function.
5174         (Object::get_mtime): New function.
5175         (Object::for_all_local_got_entries): New function.
5176         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5177         (Object::set_is_in_system_directory): New function.
5178         (Object::is_in_system_directory): New function.
5179         (Object::do_is_incremental): New function.
5180         (Object::do_get_mtime): New function.
5181         (Object::do_for_all_local_got_entries): New function.
5182         (Object::is_in_system_directory_): New data member.
5183         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5184         (class Sized_relobj_base): New class.
5185         (class Sized_relobj): Derive from Sized_relobj_base.
5186         (class Sized_relobj::Symbols): Redeclare from base class.
5187         (class Sized_relobj::local_got_offset_list): Remove.
5188         (class Sized_relobj::Output_sections): Redeclare from base class.
5189         (class Sized_relobj::do_for_all_local_got_entries): New function.
5190         (class Sized_relobj::write_local_symbols): Add offset parameter.
5191         (class Sized_relobj::local_symbol_offset_): Update comment.
5192         (class Sized_relobj::local_dynsym_offset_): Update comment.
5193         * options.cc (Input_arguments::add_file): Remove const.
5194         * options.h (Input_file_argument::Input_file_argument):
5195         Initialize arg_serial_ (all constructors).
5196         (Input_file_argument::set_arg_serial): New function.
5197         (Input_file_argument::arg_serial): New function.
5198         (Input_file_argument::arg_serial_): New data member.
5199         (Input_arguments::Input_arguments): Initialize file_count_.
5200         (Input_arguments::add_file): Remove const.
5201         (Input_arguments::number_of_input_files): New function.
5202         (Input_arguments::file_count_): New data member.
5203         (Command_line::number_of_input_files): Call
5204         Input_arguments::number_of_input_files.
5205         * output.cc (Output_segment_headers::Output_segment_headers):
5206         Set current size.
5207         (Output_section::Input_section::current_data_size): New function.
5208         (Output_section::Output_section): Initialize new data members.
5209         (Output_section::add_input_section): Don't do merge sections for
5210         an incremental link; allocate space from free list for an
5211         incremental update.
5212         (Output_section::add_output_section_data): Allocate space from
5213         free list for an incremental update.
5214         (Output_section::update_data_size): New function.
5215         (Output_section::set_fixed_layout): New function.
5216         (Output_section::reserve): New function.
5217         (Output_segment::set_section_addresses): Remove const.
5218         (Output_segment::set_section_list_addresses): Remove const; allocate
5219         space from free list for an incremental update.
5220         (Output_segment::set_offset): Adjust size of RELRO segment for an
5221         incremental update.
5222         * output.h (Output_data::current_data_size): Move here from
5223         child classes.
5224         (Output_data::pre_finalize_data_size): New function.
5225         (Output_data::update_data_size): New function.
5226         (Output_section_headers::update_data_size): new function.
5227         (Output_section_data_build::current_data_size): Move to Output_data.
5228         (Output_data_strtab::update_data_size): New function.
5229         (Output_section::current_data_size): Move to Output_data.
5230         (Output_section::set_fixed_layout): New function.
5231         (Output_section::has_fixed_layout): New function.
5232         (Output_section::reserve): New function.
5233         (Output_section::update_data_size): New function.
5234         (Output_section::has_fixed_layout_): New data member.
5235         (Output_section::free_list_): New data member.
5236         (Output_segment::set_section_addresses): Remove const.
5237         (Output_segment::set_section_list_addresses): Remove const.
5238         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5239         New function.
5240         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5241         New function.
5242         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5243         parameter when calling Add_symbols constructor; store argument
5244         serial number for members of a lib group.
5245         (Add_symbols::locks): Allow case where token == NULL.
5246         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5247         (Read_member::~Read_member): New function.
5248         (Read_member::is_runnable): New function.
5249         (Read_member::locks): New function.
5250         (Read_member::run): New function.
5251         (Check_script::~Check_script): New function.
5252         (Check_script::is_runnable): New function.
5253         (Check_script::locks): New function.
5254         (Check_script::run): New function.
5255         (Check_library::~Check_library): New function.
5256         (Check_library::is_runnable): New function.
5257         (Check_library::locks): New function.
5258         (Check_library::run): New function.
5259         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5260         (Add_symbols::library_): New data member.
5261         (class Read_member): New class.
5262         (class Check_script): New class.
5263         (class Check_library): New class.
5264         * reloc.cc (Read_relocs::is_runnable): Allow case where
5265         token == NULL.
5266         (Read_relocs::locks): Likewise.
5267         (Scan_relocs::locks): Likewise.
5268         (Relocate_task::locks): Likewise.
5269         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5270         to clear counters.
5271         (Sized_relobj::incremental_relocs_scan): Fix comment.
5272         (Sized_relobj::do_relocate): Pass output file offset to
5273         write_local_symbols.
5274         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5275         from class declaration.
5276         * script.cc (read_input_script): Allocate Script_info; pass
5277         argument serial number to report_script.
5278         * script.h (class Script_info): Move to incremental.h.
5279         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5280         * symtab.h (Symbol_table::add_from_incrobj): New function.
5281         (Symbol_table::set_file_offset): New function.
5282
5283 2011-04-05  Cary Coutant  <ccoutant@google.com>
5284
5285         * incremental-dump.cc (dump_incremental_inputs): Change signature
5286         to take a Sized_incremental_binary; change caller.  Use readers
5287         in Sized_incremental_binary.
5288         * incremental.cc
5289         (Sized_incremental_binary::find_incremental_inputs_sections):
5290         Rename do_find_incremental_inputs_sections to this.
5291         (Sized_incremental_binary::setup_readers): New function.
5292         (Sized_incremental_binary::do_check_inputs): Check
5293         has_incremental_info_ flag; move setup code to setup_readers;
5294         use input readers.
5295         (Sized_incremental_binary::do_file_is_unchanged): New function.
5296         (Sized_incremental_binary::do_get_input_reader): New function.
5297         * incremental.h (class Incremental_binary): Move to end of file.
5298         (Incremental_binary::file_is_unchanged): New function.
5299         (Incremental_binary::do_file_is_unchanged): New function.
5300         (Incremental_binary::Input_reader): New class.
5301         (Incremental_binary::get_input_reader): New function.
5302         (class Sized_incremental_binary): Move to end of file.
5303         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5304         input section reader classes.
5305         (Sized_incremental_binary::has_incremental_info): New function.
5306         (Sized_incremental_binary::inputs_reader): New function.
5307         (Sized_incremental_binary::symtab_reader): New function.
5308         (Sized_incremental_binary::relocs_reader): New function.
5309         (Sized_incremental_binary::got_plt_reader): New function.
5310         (Sized_incremental_binary::do_file_is_unchanged): New function.
5311         (Sized_incremental_binary::Sized_input_reader): New class.
5312         (Sized_incremental_binary::get_input_reader): New function.
5313         (Sized_incremental_binary::find_incremental_inputs_sections):
5314         Rename do_find_incremental_inputs_sections to this.
5315         (Sized_incremental_binary::setup_readers): New function.
5316         (Sized_incremental_binary::has_incremental_info_): New data member.
5317         (Sized_incremental_binary::inputs_reader_): New data member.
5318         (Sized_incremental_binary::symtab_reader_): New data member.
5319         (Sized_incremental_binary::relocs_reader_): New data member.
5320         (Sized_incremental_binary::got_plt_reader_): New data member.
5321         (Sized_incremental_binary::current_input_file_): New data member.
5322
5323 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5324
5325         PR gold/12640
5326         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5327         violation.
5328
5329 2011-03-30  Cary Coutant  <ccoutant@google.com>
5330
5331         * archive.cc (Archive::include_member): Adjust call to report_object.
5332         (Add_archive_symbols::run): Add script_info to call to
5333         report_archive_begin.
5334         (Lib_group::include_member): Adjust call to report_object.
5335         (Add_lib_group_symbols::run): Adjust call to report_object.
5336         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5337         blocks.  Add object count for script input files.
5338         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5339         script_info parameter; change all callers.
5340         (Incremental_inputs::report_object): Add script_info parameter;
5341         change all callers.
5342         (Incremental_inputs::report_script): Store backpointer to
5343         incremental info entry.
5344         (Output_section_incremental_inputs::set_final_data_size): Record
5345         additional information for scripts.
5346         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5347         * incremental.h (Incremental_script_entry::add_object): New function.
5348         (Incremental_script_entry::get_object_count): New function.
5349         (Incremental_script_entry::get_object): New function.
5350         (Incremental_script_entry::objects_): New data member; adjust
5351         constructor.
5352         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5353         (Incremental_inputs::report_object): Add script_info parameter.
5354         (Incremental_inputs_reader::get_object_count): New function.
5355         (Incremental_inputs_reader::get_object_offset): New function.
5356         * options.cc (Input_arguments::add_file): Return reference to
5357         new input argument.
5358         * options.h (Input_argument::set_script_info): New function.
5359         (Input_argument::script_info): New function.
5360         (Input_argument::script_info_): New data member; adjust all
5361         constructors.
5362         (Input_file_group::add_file): Return reference to new input argument.
5363         (Input_file_lib::add_file): Likewise.
5364         (Input_arguments::add_file): Likewise.
5365         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5366         * script.cc (Parser_closure::Parser_closure): Add script_info
5367         parameter; adjust all callers.
5368         (Parser_closure::script_info): New function.
5369         (Parser_closure::script_info_): New data member.
5370         (read_input_script): Report scripts earlier to incremental info.
5371         (script_add_file): Set script_info in Input_argument.
5372         (script_add_library): Likewise.
5373         * script.h (Script_options::Script_info): Rewrite class.
5374
5375 2011-03-29  Cary Coutant  <ccoutant@google.com>
5376
5377         * archive.cc (Library_base::should_include_member): Move
5378         method here from class Archive.
5379         (Archive::Archive): Initialize base class.
5380         (Archive::should_include_member): Move to base class.
5381         (Archive::do_for_all_unused_symbols): New function.
5382         (Add_archive_symbols::run): Remove redundant access to
5383         incremental_inputs.
5384         (Lib_group::Lib_group): Initialize base class.
5385         (Lib_group::do_filename): New function.
5386         (Lib_group::include_member): Pass pointer to Lib_group to
5387         report_object.
5388         (Lib_group::do_for_all_unused_symbols): New function.
5389         (Add_lib_group_symbols::run): Report archive information for
5390         incremental links.
5391         * archive.h (class Library_base): New base class.
5392         (class Archive): Derive from Library_base.
5393         (Archive::filename): Move to base class.
5394         (Archive::set_incremental_info): Likewise.
5395         (Archive::incremental_info): Likewise.
5396         (Archive::Should_include): Likewise.
5397         (Archive::should_include_member): Likewise.
5398         (Archive::Armap_entry): Remove.
5399         (Archive::Unused_symbol_iterator): Remove.
5400         (Archive::unused_symbols_begin): Remove.
5401         (Archive::unused_symbols_end): Remove.
5402         (Archive::do_filename): New function.
5403         (Archive::do_get_mtime): New function.
5404         (Archive::do_for_all_unused_symbols): New function.
5405         (Archive::task_): Move to base class.
5406         (Archive::incremental_info_): Likewise.
5407         (class Lib_group): Derive from Library_base.
5408         (Lib_group::do_filename): New function.
5409         (Lib_group::do_get_mtime): New function.
5410         (Lib_group::do_for_all_unused_symbols): New function.
5411         (Lib_group::task_): Move to base class.
5412         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5413         function.
5414         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5415         function.
5416         * incremental.cc (Incremental_inputs::report_archive_begin):
5417         Use Library_base; call library's get_mtime; add incremental inputs
5418         entry before members.
5419         (class Unused_symbol_visitor): New class.
5420         (Incremental_inputs::report_archive_end): Use Library_base; use
5421         visitor class to record unused symbols; don't add incremental inputs
5422         entry after members.
5423         (Incremental_inputs::report_object): Use Library_base.
5424         * incremental.h
5425         (Incremental_archive_entry::Incremental_archive_entry): Remove
5426         unused Archive parameter.
5427         (Incremental_inputs::report_archive_begin): Use Library_base.
5428         (Incremental_inputs::report_archive_end): Likewise.
5429         (Incremental_inputs::report_object): Likewise.
5430         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5431         function.
5432         * object.h (Object::for_all_global_symbols): New function.
5433         (Object::do_for_all_global_symbols): New function.
5434         (Sized_relobj::do_for_all_global_symbols): New function.
5435         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5436         function.
5437         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5438         function.
5439
5440 2011-03-27  Ian Lance Taylor  <iant@google.com>
5441
5442         * archive.cc (Archive::interpret_header): Return -1 if something
5443         goes wrong.  Change callers accordingly.
5444
5445 2011-03-25  Cary Coutant  <ccoutant@google.com>
5446
5447         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5448         * testsuite/Makefile.in: Regenerate.
5449
5450 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5451
5452         * plugin.cc (get_view): New.
5453         (Plugin::load): Pass get_view to the plugin.
5454         (Plugin_manager::get_view): New.
5455
5456 2011-03-21  Ian Lance Taylor  <iant@google.com>
5457
5458         * testsuite/final_layout.sh: Rewrite to not use dc.
5459         * testsuite/relro_test.sh: Fail if dc is not present.
5460
5461 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5462
5463         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5464         Change == to -eq.
5465         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5466         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5467         Change == to -eq.
5468         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5469         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5470
5471 2011-03-14  Ian Lance Taylor  <iant@google.com>
5472
5473         * script-sections.cc (Sort_output_sections::script_compare):
5474         Rename from is_before, change return type.
5475         (Sort_output_sections::operator()): Adjust accordingly.
5476
5477 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5478
5479         PR gold/12572
5480         * testsuite/odr_violation2.cc: Add comment to make all error line
5481         numbers double digits.
5482         * testsuite/debug_msg.sh: Adjust expected errors.
5483
5484 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5485
5486         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5487         but mark earlier ones as non-canonical
5488         (offset_to_iterator): Update search target and example
5489         (do_addr2line): Return extra lines in a vector*
5490         (format_file_lineno): Extract from do_addr2line
5491         (one_addr2line): Add vector* out-param
5492         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5493         when a lineno entry appeared last for its instruction
5494         (Dwarf_line_info): Add vector* out-param
5495         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5496         * symtab.cc (Odr_violation_compare): Include the lineno in the
5497         comparison again.
5498         (linenos_from_loc): New. Combine the canonical line for an
5499         address with its other lines.
5500         (True_if_intersect): New. Helper functor to make
5501         std::set_intersection a query.
5502         (detect_odr_violations): Compare sets of lines instead of just
5503         one line for each function. This became less deterministic, but
5504         has fewer false positives.
5505         * symtab.h: Declarations.
5506         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5507         mix an optimized and non-optimized object in the same binary
5508         (odr_violation2.so): Same.
5509         * testsuite/Makefile.in: Regenerate from Makefile.am.
5510         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5511         * testsuite/debug_msg.sh: Update line numbers and add
5512         assertions.
5513         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5514         non-optimized context.
5515         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5516         isn't inlined, and use OdrDerived in an optimized context.
5517         * testsuite/odr_header1.h: Defines OdrDerived, where
5518         optimization will change the
5519         first-instruction-in-the-destructor's file and line number.
5520         * testsuite/odr_header2.h: Defines OdrBase.
5521
5522 2011-03-09  Ian Lance Taylor  <iant@google.com>
5523
5524         * fileread.cc (File_read::clear_views): Don't delete the whole
5525         file view.
5526
5527 2011-03-08  Ian Lance Taylor  <iant@google.com>
5528
5529         PR gold/12525
5530         * fileread.cc: #include <climits>.
5531         (GOLD_IOV_MAX): Define.
5532         (File_read::read_multiple): Limit number of entries by iov_max.
5533         * fileread.h (class File_read): Always set max_readv_entries to
5534         128.
5535
5536 2011-03-07  Ian Lance Taylor  <iant@google.com>
5537
5538         PR gold/12525
5539         * options.h (class General_options): Add -dy and -dn.
5540
5541 2011-03-02  Cary Coutant  <ccoutant@google.com>
5542
5543         * testsuite/script_test_9.t: Add TLS segment.
5544
5545 2011-03-02  Simon Baldwin  <simonb@google.com>
5546
5547         * configure.ac: Add check for gnu_indirect_function support in
5548         the toolchain building binutils.
5549         * configure: Rebuild.
5550
5551 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5552
5553         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5554         plugin only symbols.
5555         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5556         in plugin files as not needed in the symbol table.
5557
5558 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5559
5560         * output.cc (Output_section::add_input_section): Delay fill
5561         generation for section ordering.
5562
5563 2011-02-09  Ian Lance Taylor  <iant@google.com>
5564
5565         PR gold/12316
5566         * object.h (class Sized_relobj): Remove clear_local_symbols.
5567         * reloc.cc (Sized_relobj::do_relocate): Don't call
5568         clear_local_symbols.
5569
5570 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5571
5572         * plugin.cc (is_visible_from_outside): Return true for symbols
5573         in the -u option.
5574
5575 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5576
5577         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5578         filename.
5579
5580 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5581
5582         * icf.h (is_section_foldable_candidate): Change type of parameter
5583         to std::string.
5584         * icf.cc (Icf::find_identical_sections): Change type of local variable
5585         section_name to be std::string.
5586         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5587
5588 2011-01-25  Ian Lance Taylor  <iant@google.com>
5589
5590         * script.cc (script_add_extern): Rewrite to use
5591         add_symbol_reference.
5592
5593 2011-01-25  Doug Kwan  <dougkwan@google.com>
5594
5595         * icf.cc (get_section_contents): Always lock section's object.
5596
5597 2011-01-24  Ian Lance Taylor  <iant@google.com>
5598
5599         * options.h (class General_options): Accept
5600         --no-detect-odr-violations.
5601
5602 2011-01-24  Ian Lance Taylor  <iant@google.com>
5603
5604         * version.cc (version_string): Bump to 1.11.
5605
5606 2011-01-24  Ian Lance Taylor  <iant@google.com>
5607
5608         * plugin.cc (class Plugin_rescan): Define new class.
5609         (Plugin_manager::claim_file): Set any_claimed_.
5610         (Plugin_manager::save_archive): New function.
5611         (Plugin_manager::save_input_group): New function.
5612         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5613         necessary.
5614         (Plugin_manager::new_undefined_symbol): New function.
5615         (Plugin_manager::rescan): New function.
5616         (Plugin_manager::rescannable_defines): New function.
5617         (Plugin_manager::add_input_file): Set any_added_.
5618         * plugin.h (class Plugin_manager): define new fields rescannable_,
5619         undefined_symbols_, any_claimed_, and any_added_.  Declare
5620         Plugin_rescan as friend.  Declare new functions.
5621         (Plugin_manager::Rescannable): Define type.
5622         (Plugin_manager::Rescannable_list): Define type.
5623         (Plugin_manager::Undefined_symbol_list): Define type.
5624         (Plugin_manager::Plugin_manager): Initialize new fields.
5625         * archive.cc (Archive::defines_symbol): New function.
5626         (Add_archive_symbols::run): Pass archive to plugins if any.
5627         * archive.h (class Archive): Declare defines_symbol.
5628         * readsyms.cc (Input_group::~Input_group): New function.
5629         (Finish_group::run): Pass input_group to plugins if any.
5630         * readsyms.h (class Input_group): Declare destructor.
5631         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5632         any.
5633
5634 2011-01-10  Ian Lance Taylor  <iant@google.com>
5635
5636         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5637         section as relro.
5638         (Layout::set_segment_offsets): Reset increase_relro before calling
5639         set_section_addresses a second time.
5640
5641 2011-01-04  Cary Coutant  <ccoutant@google.com>
5642
5643         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5644         sections before NOBITS sections.
5645
5646 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5647
5648         * version.cc (print_version): Update copyright to 2011.
5649
5650 2010-12-23  Cary Coutant  <ccoutant@google.com>
5651
5652         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5653         of OS to this->add.  Add OD parameter to second form of the function.
5654
5655 2010-12-20  Ian Lance Taylor  <iant@google.com>
5656
5657         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5658         second of two consecutive entries with same offset.
5659
5660 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5661
5662         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5663         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5664         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5665         to avoid unneeded links against $(LDADD).
5666         * testsuite/Makefile.in: Regenerate.
5667
5668 2010-12-15  Ian Lance Taylor  <iant@google.com>
5669
5670         PR gold/12324
5671         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5672         for R_X86_64_32 and R_X86_64_PC32.
5673         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5674         ver_matching_def_pic.o.
5675         (ver_matching_def_pic.o): New target.
5676
5677 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5678
5679         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5680         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5681         Move definition before File_read::View member definitions.
5682         (File_read::View::~View): Initialize and hold lock before
5683         updating current_mapped_bytes.
5684
5685 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5686
5687         * dwarf_reader.cc: Remove outdated comment.
5688         * gold-threads.cc: Fix typo in error message.
5689         * archive.cc: Fix typos in comments.
5690         * archive.h: Likewise.
5691         * arm-reloc-property.cc: Likewise.
5692         * arm-reloc-property.h: Likewise.
5693         * arm-reloc.def: Likewise.
5694         * arm.cc: Likewise.
5695         * attributes.h: Likewise.
5696         * cref.cc: Likewise.
5697         * ehframe.cc: Likewise.
5698         * fileread.h: Likewise.
5699         * gold.h: Likewise.
5700         * i386.cc: Likewise.
5701         * icf.cc: Likewise.
5702         * incremental.h: Likewise.
5703         * int_encoding.cc: Likewise.
5704         * layout.h: Likewise.
5705         * main.cc: Likewise.
5706         * merge.h: Likewise.
5707         * object.cc: Likewise.
5708         * object.h: Likewise.
5709         * options.cc: Likewise.
5710         * readsyms.cc: Likewise.
5711         * reduced_debug_output.cc: Likewise.
5712         * reloc.cc: Likewise.
5713         * script-sections.cc: Likewise.
5714         * sparc.cc: Likewise.
5715         * symtab.h: Likewise.
5716         * target-reloc.h: Likewise.
5717         * target.cc: Likewise.
5718         * target.h: Likewise.
5719         * timer.cc: Likewise.
5720         * timer.h: Likewise.
5721         * x86_64.cc: Likewise.
5722
5723 2010-12-09  Cary Coutant  <ccoutant@google.com>
5724
5725         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5726         stack.
5727         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5728         parameter; change all callers.
5729         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5730         * options.h (warn_execstack): New option.
5731
5732 2010-12-07  Doug Kwan  <dougkwan@google.com>
5733
5734         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5735         like function call relocations.
5736
5737 2010-12-07  Ian Lance Taylor  <iant@google.com>
5738
5739         * archive.cc (Archive::get_elf_object_for_member): Permit
5740         punconfigured to be NULL.
5741         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5742         (Archive::include_member): Pass NULL to get_elf_object_for_member
5743         if we searched for the archive and this is the first included
5744         object.
5745
5746 2010-12-01  Ian Lance Taylor  <iant@google.com>
5747
5748         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5749         track_relocs_type_ field.
5750         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5751         Set track_relocs_type_.
5752         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5753         contents when using RELA relocs.
5754         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5755         reloc_map_.
5756         * reloc.cc (Track_relocs::next_addend): New function.
5757         * reloc.h (class Track_relocs): Declare next_addend.
5758
5759 2010-12-01  Ian Lance Taylor  <iant@google.com>
5760
5761         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5762         virtual destructor.
5763
5764 2010-12-01  Ian Lance Taylor  <iant@google.com>
5765
5766         * README: Update compilers known to work and fail.
5767
5768 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5769
5770         * configure.in: For --enable-gold, handle value `default' instead of
5771         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5772         not the default.
5773         * configure: Regenerate.
5774
5775 2010-11-18  Doug Kwan  <dougkwan@google.com>
5776
5777         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5778         and right_alignment to be zero.  Store result alignment only if it is
5779         greater than existing alignment.
5780
5781 2010-11-16  Cary Coutant  <ccoutant@google.com>
5782
5783         PR gold/12220
5784         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5785         Check for ".zdebug_line".
5786
5787 2010-11-16  Doug Kwan  <dougkwan@google.com>
5788             Cary Coutant  <ccoutant@google.com>
5789
5790         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5791         by reference; adjust all callers.
5792         * output.cc (Output_segment::set_section_addresses): Adjust references
5793         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5794         list is empty.
5795         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5796         end at page boundary.
5797
5798 2010-11-16  Cary Coutant  <ccoutant@google.com>
5799
5800         PR gold/12220
5801         * layout.cc (Layout::choose_output_section): Transform names of
5802         compressed sections even when using a script with a SECTIONS clause.
5803         (Layout::output_section_name): Remove code to transform
5804         compressed debug section names.
5805         * output.cc (Output_section::add_input_section): Use uncompressed
5806         section size when tracking input sections.
5807
5808 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5809
5810         * symtab.h (Symbol::NON_PIC_REF): Remove.
5811         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5812         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5813         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5814         (Symbol::use_plt_offset): Take a flags argument and pass it
5815         directly to needs_dynamic_reloc.  Restrict check for undefined
5816         weak symbols to function calls.
5817         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5818         (Target_arm::Scan::global): Use it.
5819         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5820         (Target_arm::Relocate::relocate): Likewise.
5821         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5822         parameter with an r_type parameter.  Use get_reference_flags
5823         to get the flags.
5824         (Target_arm::Relocate::relocate): Update accordingly.
5825         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5826         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5827         (Target_i386::Scan::global): Likewise.
5828         (Target_i386::Relocate::relocate): Likewise.
5829         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5830         parameter with an r_type parameter.  Use get_reference_flags
5831         to get the flags.
5832         (Target_i386::Relocate::relocate): Update accordingly.
5833         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5834         (Target_powerpc::Scan::global): Use it.
5835         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5836         (Target_powerpc::Relocate::relocate): Likewise.
5837         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5838         (Target_sparc::Scan::global): Use it.
5839         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5840         (Target_sparc::Relocate::relocate): Likewise.
5841         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5842         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5843         (Target_x86_64::Scan::global): Likewise.
5844         (Target_x86_64::Relocate::relocate): Likewise.
5845
5846 2010-11-08  Doug Kwan  <dougkwan@google.com>
5847             Cary Coutant  <ccoutant@google.com>
5848
5849         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5850         (Arm_exidx_merge_section::section_contents_): New data member.
5851         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5852         (Arm_input_section::~Arm_input_section): De-allocate memory.
5853         (Arm_input_section::original_contents_): New data member.
5854         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5855         in parameters instead of calling Object::section_contents without
5856         locking.
5857         (Arm_output_section::group_section): New parameter TASK.  Pass it
5858         to callees that need locking objects.
5859         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5860         to lock EXIDX input sections.  Fix a formatting issue.  Call
5861         Arm_exidx_merged_section::build_contents to create merged section
5862         contents.
5863         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5864         to lock object of stub table owner.
5865         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5866         TEXT_SIZE to initialize data member TEXT_SIZE_.
5867         (Arm_exidx_input_section::addralign): Fix typo in comment.
5868         (Arm_exidx_input_section::text_size): New method.
5869         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5870         that require locking objects.  Lock objects before scanning for stubs
5871         and updating local symbols.
5872         (Arm_input_section<big_endian>::init): Copy contents of original
5873         input section.
5874         (Arm_input_section<big_endian>::do_write): Use saved contents of
5875         original input section instead of calling Object::section_contents
5876         without locking.
5877         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5878         size without calling Object::section_size().
5879         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5880         for size.  Allocate a buffer for merged EXIDX entries.
5881         (Arm_exidx_merged_section::build_contents): New method.
5882         (Arm_exidx_merged_section::do_write): Move merge section contents
5883         building code to Arm_exidx_merged_section::build_contetns.  Write
5884         out contetns in buffer instead of building it on the fly.
5885         (Arm_relobj::make_exidx_input_section): Also pass text section size
5886         to Arm_exidx_input_section constructor.
5887         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5888         (Arm_dynobj::do_read_symbols): Fix memory leak.
5889         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5890         * target.h: (class Task): Add forward declaration.
5891         (Target::relax): Add new parameter TASK and pass it to
5892         Target::do_relax().
5893         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5894
5895 2010-11-05  Cary Coutant  <ccoutant@google.com>
5896
5897         PR gold/10708
5898         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5899         object when reading from the file.
5900         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5901         second layout pass.
5902         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5903         when reading section contents.
5904         (get_section_contents): Likewise.
5905         (icf::find_identical_sections): Likewise.
5906         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5907         object when reading from the file.
5908         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5909         the object when doing deferred section layout.
5910
5911 2010-11-03  Nick Clifton  <nickc@redhat.com>
5912
5913         PR gold/12001
5914         * script.h (class Symbol_assignment: name): New member.  Returns
5915         the name of the symbol.
5916         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5917         Returns true if the given symbol name is on the list of
5918         assignments wating to be processed.
5919         * archive.cc (should_incldue_member): If the symbol is undefined,
5920         check to see if it is on the list of symbols pending assignment.
5921
5922 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5923
5924         * script-sections.cc (Script_sections::find_memory_region): Check
5925         for a NULL output section pointer.
5926
5927 2010-10-29  Doug Kwan  <dougkwan@google.com>
5928
5929         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5930         Output_section::add_relaxed_input_section.
5931         * output.cc (Output_section::add_relaxed_input_section): Add new
5932         arguments LAYOUT and NAME.  Set section order index.
5933         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5934         Copy section order index.
5935         * output.h (Output_section::add_relaxed_input_section): Add new
5936         arguments LAYOUT and NAME.
5937
5938 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5939
5940         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5941         NATIVE_OR_CROSS_LINKER.
5942         * testsuite/Makefile.in: Regenerate.
5943
5944 2010-10-20  Doug Kwan  <dougkwan@google.com>
5945
5946         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5947         without SHF_LINK_ORDER flags.
5948         * layout.cc (Layout::choose_output_section): Do not filter
5949         SHF_LINK_ORDER flag in a relocatable link.
5950
5951 2010-10-17  Cary Coutant  <ccoutant@google.com>
5952
5953         * output.h (Output_segment::set_section_addresses): Change function
5954         signature.  Update all callers.
5955         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5956         sections.
5957         (Output_segment::set_section_addresses): Align after last TLS
5958         section.  Add padding before last relro section instead of after.
5959
5960 2010-10-17  Doug Kwan  <dougkwan@google.com>
5961
5962         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5963         GOT output section to be writable.
5964
5965 2010-10-14  Cary Coutant  <ccoutant@google.com>
5966
5967         * debug.h (DEBUG_INCREMENTAL): New flag.
5968         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5969         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5970         mode.
5971         * incremental.cc (report_command_line): Ignore all forms of
5972         --incremental.
5973         * layout.cc (Layout::Layout): Check parameters for incremental link
5974         mode.
5975         * options.cc (General_options::parse_incremental): New function.
5976         (General_options::parse_no_incremental): New function.
5977         (General_options::parse_incremental_full): New function.
5978         (General_options::parse_incremental_update): New function.
5979         (General_options::incremental_mode_): New data member.
5980         (General_options::finalize): Check incremental_mode_.
5981         * options.h (General_options): Update help text for --incremental.
5982         Add --no-incremental, --incremental-full, --incremental-update.
5983         (General_options::Incremental_mode): New enum type.
5984         (General_options::incremental_mode): New function.
5985         (General_options::incremental_mode_): New data member.
5986         * parameters.cc (Parameters::incremental_mode_): New data member.
5987         (Parameters::set_options): Set incremental_mode_.
5988         (Parameters::set_incremental_full): New function.
5989         (Parameters::incremental): New function.
5990         (Parameters::incremental_update): New function.
5991         (set_parameters_incremental_full): New function.
5992         * parameters.h (Parameters::set_incremental_full): New function.
5993         (Parameters::incremental): New function.
5994         (Parameters::incremental_update): New function.
5995         (Parameters::incremental_mode_): New data member.
5996         (set_parameters_incremental_full): New function.
5997         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5998         incremental link mode.
5999         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6000         (Sized_relobj::do_relocate_sections): Likewise.
6001         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6002         option.
6003         * testsuite/Makefile.in: Regenerate.
6004         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6005
6006 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6007
6008         * script-sections.h (class Script_sections): Make
6009         Sections_elements typedef public.
6010         * script-sections.cc (class Sort_output_sections): Add elements_
6011         field.  Add constructor which sets it; change all callers.
6012         (Sort_output_sections::is_before): New function.
6013         (Sort_output_sections::operator()): Call is_before.
6014         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6015         conditional.
6016         * testsuite/script_test_10.sh: New test. Test script section
6017         order.
6018         * testsuite/script_test_10.t: Likewise.
6019         * testsuite/script_test_10.s: Likewise.
6020         * testsuite/Makefile.am: Wrap the cross linker tests and the
6021         common tests into NATIVE_OR_CROSS_LINKER.
6022         (check_SCRIPTS): Add script_test_10.sh.
6023         (check_DATA): Add script_test_10.stdout.
6024         (script_test_10.o, script_test_10): New targets.
6025         (script_test_10.stdout): New target.
6026         * configure, testsuite/Makefile.in: Regenerate.
6027
6028 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6029
6030         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6031         error for the deprecated relocations.
6032         (Target_arm::Scan::global): Likewise.
6033         (Target_arm::Relocate::relocate): Likewise.
6034
6035 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6036
6037         * fileread.cc (Input_file::find_file): Initialize *found_name
6038         and *namep when using the fallback search for case 4.
6039
6040 2010-10-11  Cary Coutant  <ccoutant@google.com>
6041
6042         * options.h (class General_options): Redefine -z lazy as an alias for
6043         the negation of -z now.
6044
6045 2010-10-11  Ian Lance Taylor  <iant@google.com>
6046
6047         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6048         binding.
6049
6050 2010-10-06  Nick Clifton  <nickc@redhat.com>
6051
6052         * script-sections.cc(class Memory_region): Remove
6053         current_lma_offset_ field.  Rename current_vma_offset_ to
6054         current_offset_.  Add last_section_ field.
6055         (Memory_region::get_current_vma_address): Rename to
6056         get_current_address.
6057         (Memory_region::get_current_lma_address): Delete.
6058         (Memory_region::increment_vma_offset): Rename to
6059         increment_offset.
6060         (Memory_region::increment_lma_offset): Delete.
6061         (Memory_region::attributes_compatible): New method.  Returns
6062         true if the provided section is compatible with the region.
6063         (Memory_region::get_last_section): New method.  Returns the last
6064         section to use the region.
6065         (Memory_region::set_last_section): New method.  Stores the last
6066         section to use the region.
6067         (Script_sections::block_in_region): New method.  Returns true if
6068         a block of memory is contained within a region.
6069         (Script_sections::find_memory_region): New method.  Locates a
6070         memory region to be used to set a VMA or LMA address.
6071         (Output_section_definition::set_section_addresses): Add code to
6072         check for addresses set by memory regions.
6073         (Output_segment::set_section_addresses): Remove memory region
6074         walking code.
6075         (Script_sections::create_segment): Add a warning if a header
6076         segment is created outside of any region.
6077         * script-sections.h (class Script_sections): Add prototypes for
6078         find_memory_region and block_in_region methods.
6079         * testsuite/memory_test.s: Use .long instead of .word.
6080         * testsuite/memory_test.t: Add some more output sections.
6081         * testsuite/memory_test.sh: Update expected output.
6082
6083 2010-10-02  Doug Kwan  <dougkwan@google.com>
6084
6085         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6086         defintion to symtab.h
6087         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6088         declaration to defintion.
6089
6090 2010-10-01  Nick Clifton  <nickc@redhat.com>
6091
6092         * expression.cc (eval): Replace dummy argument with NULL.
6093         (eval_maybe_dot): Check for a NULL result section pointer.
6094         (Symbol_expression::value): Likewise.
6095         (Dot_expression::value): Likewise.
6096         (BINARY_EXPRESSION): Likewise.
6097         (Max_expression::value): Likewise.
6098         (Min_expression::value): Likewise.
6099         (Absolute_expression::value): Likewise.
6100         (Addr_expression::value_from_output_section): Likewise.
6101         (Loaddddr_expression::value_from_output_section): Likewise.
6102         (Segment_start_expression::value): Likewise.
6103         * script-sections.cc
6104         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6105         argument with NULL.
6106         (Sections_elememt_dot_assignment::set_section_addresses):
6107         Likewise.
6108         (Output_data_expression::do_write_to_buffer): Likewise.
6109         (Output_section_definition::finalize_symbols): Likewise.
6110         (Output_section_definition::set_section_addresses): Likewise.
6111
6112 2010-09-30  Doug Kwan  <dougkwan@google.com>
6113
6114         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6115
6116 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6117
6118         * target.h (Target::can_icf_inline_merge_sections): New virtual
6119         function.
6120         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6121         virtual function.
6122         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6123         virtual function.
6124         * icf.cc (get_section_contents): Inline merge sections only when
6125         target allows it.
6126
6127 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6128
6129         * configure: Regenerate.
6130
6131 2010-09-17  Ian Lance Taylor  <iant@google.com>
6132
6133         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6134         * testsuite/Makefile.am (memory_test.o): New target.
6135         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6136         memory_test.t.
6137         * testsuite/Makefile.in: Rebuild.
6138
6139 2010-09-17  Doug Kwan  <dougkwan@google.com>
6140
6141         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6142         defintion if relocation uses GOT entries of the symbol.
6143         * testsuite/icf_safe_test.sh: Fix test.
6144         * testsuite/icf_safe_so_test.sh: Fix test.
6145
6146 2010-09-16  Cary Coutant  <ccoutant@google.com>
6147
6148         * script_sections.cc (class Memory_region): Remove "NULL" from
6149         vector initializations.
6150
6151 2010-09-15  Cary Coutant  <ccoutant@google.com>
6152
6153         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6154         Resolve forwarding symbols.
6155
6156 2010-09-15  Doug Kwan  <dougkwan@google.com>
6157
6158         * gold/testsuite/script_test_3.t: Add ARM special sections.
6159         * gold/testsuite/script_test_4.t: Same.
6160         * gold/testsuite/script_test_5.t: Same.
6161         * gold/testsuite/script_test_6.t: Same.
6162         * gold/testsuite/script_test_7.t: Same.
6163         * gold/testsuite/script_test_7.t: Same.
6164         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6165
6166 2010-09-14  Cary Coutant  <ccoutant@google.com>
6167
6168         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6169         (Target_x86_64::Relocate::relocate_tls): Replace check for
6170         saw_tls_block_reloc_ with test for executable section.
6171
6172 2010-09-12  Cary Coutant  <ccoutant@google.com>
6173
6174         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6175         position-independent executables to shared libraries need dynamic
6176         relocations.
6177         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6178         position-independent executables.
6179         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6180         * testsuite/Makefile.in: Regenerate.
6181
6182 2010-09-10  Nick Clifton  <nickc@redhat.com>
6183
6184         PR gold/11997
6185         * testsuite/memory_test.t: Discard any sections that are not
6186         needed.
6187
6188 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6189
6190         PR gold/11996
6191         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6192         "This::" to work around a bug in gcc 4.2.
6193
6194         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6195
6196 2010-09-09  Rafael Espindola  <espindola@google.com>
6197
6198         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6199         sections with different PF_X flags in the same segment.
6200         (Layout::find_first_load_seg): Search all segments to find the first
6201         one.
6202         * options.h (rosegment): New.
6203
6204 2010-09-08  Rafael Espindola  <espindola@google.com>
6205
6206         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6207
6208 2010-09-08  Doug Kwan  <dougkwan@google.com>
6209
6210         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6211         (Arm_relobj::do_relocate_sections): Add new parameter for output
6212         file to match the parent.
6213         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6214         of local symbols instead of input values.  Update code to track
6215         changes in gold::relocate_section.
6216         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6217         (Sized_relobj::compute_final_local_value_internal): New methods.
6218         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6219         body into private version of Sized_relobj::compute_final_local_value.
6220         Call the inline method.
6221         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6222         merged symbol value if there is one.
6223         (Symbol_value::has_output_value): New method defintiion.
6224         (Sized_relobj::Compute_final_local_value_status): New enum type.
6225         (Sized_relobj::compute_final_local_value): New methods.
6226         (Sized_relobj::compute_final_local_value_internal): New methods.
6227         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6228         and arm_cortex_a8.sh.
6229         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6230         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6231         New tests.
6232         * Makefile.in: Regenerate.
6233         * testsuite/arm_bl_out_of_range.s: Update test.
6234         * testsuite/thumb_bl_out_of_range.s: Ditto.
6235         * testsuite/thumb_blx_out_of_range.s: Ditto.
6236         * testsuite/arm_branch_out_of_range.sh: New file.
6237         * testsuite/arm_cortex_a8.sh: Ditto.
6238         * testsuite/arm_cortex_a8_b.s: Ditto.
6239         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6240         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6241         * testsuite/arm_cortex_a8_bl.s: Ditto.
6242         * testsuite/arm_cortex_a8_blx.s: Ditto.
6243         * testsuite/arm_cortex_a8_local.s: Ditto.
6244         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6245         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6246
6247 2010-09-08  Rafael Espindola  <espindola@google.com>
6248
6249         * Makefile.am (memory_test.stdout): Run readelf with -W.
6250         * Makefile.in: Regenerate.
6251         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6252         64 bit output.
6253
6254 2010-09-08  Rafael Espindola  <espindola@google.com>
6255
6256         * script-sections.cc (Script_sections::add_memory_region): Convert
6257         field precision to int.
6258         * script.cc (script_set_section_region, script_set_section_region):
6259         Convert field precision to int.
6260
6261 2010-09-08  Rafael Espindola  <espindola@google.com>
6262
6263         * arm.cc (do_finalize_sections): Create the __exidx_start and
6264         __exdix_end symbols even when the section is missing.
6265
6266 2010-09-08  Nick Clifton  <nickc@redhat.com>
6267
6268         * README: Remove claim that MEMORY is not supported.
6269         * expression.cc (script_exp_function_origin)
6270         (script_exp_function_length): Move from here to ...
6271         * script.cc: ... here.
6272         (script_set_section_region, script_add_memory)
6273         (script_parse_memory_attr, script_include_directive): New
6274         functions.
6275         * script-sections.cc
6276         (class Memory_region): New class.
6277         (class Output_section_definition): Add set_memory_region,
6278         set_section_vma, set_section_lma and get_section_name methods.
6279         (class Script_Sections): Add add_memory_region,
6280         find_memory_region, find_memory_region_origin,
6281         find_memory_region_length and set_memory_region methods.
6282         Have set_section_addresses method walk the list of set memory
6283         regions.
6284         Extend the print methos to display memory regions.
6285         * script-sections.h: Add prototypes for new methods.
6286         Add enum for MEMORY region attributes.
6287         * yyscript.y: Add support for parsing MEMORY regions.
6288         * script-c.h: Add prototypes for new functions.
6289         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6290         * testsuite/Makefile.in: Regenerate.
6291         * testsuite/memory_test.sh: New script.
6292         * testsuite/memory_test.s: New assembler source file.
6293         * testsuite/memory_test.t: New linker script.
6294
6295 2010-08-27  Doug Kwan  <dougkwan@google.com>
6296
6297         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6298         reference override an existing dynamic weak reference.
6299         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6300         * testsuite/Makefile.in: Regenerate.
6301         * testsuite/dyn_weak_ref.sh: New file.
6302         * testsuite/dyn_weak_ref_1.c: Ditto.
6303         * testsuite/dyn_weak_ref_2.c: Ditto.
6304
6305 2010-08-27  Ian Lance Taylor  <iant@google.com>
6306
6307         * incremental.h (class Incremental_input_entry): Add virtual
6308         destructor.
6309
6310 2010-08-27  Ian Lance Taylor  <iant@google.com>
6311
6312         * testsuite/start_lib_test_3.c: Mark t3 as used.
6313
6314 2010-08-27  Nick Clifton  <nickc@redhat.com>
6315
6316         * options.cc (version_script): Fix small typo in previous
6317         whitespace tidyup.
6318
6319 2010-08-25  Nick Clifton  <nickc@redhat.com>
6320
6321         * archive.cc: Formatting fixes: Remove whitespace between
6322         typename and following asterisk.  Remove whitespace between
6323         function name and opening parenthesis.
6324         * archive.h: Likewise.
6325         * arm.cc: Likewise.
6326         * attributes.cc: Likewise.
6327         * attributes.h: Likewise.
6328         * common.cc: Likewise.
6329         * copy-relocs.cc: Likewise.
6330         * dirsearch.h: Likewise.
6331         * dynobj.cc: Likewise.
6332         * ehframe.cc: Likewise.
6333         * ehframe.h: Likewise.
6334         * expression.cc: Likewise.
6335         * fileread.cc: Likewise.
6336         * fileread.h: Likewise.
6337         * gc.h: Likewise.
6338         * gold-threads.cc: Likewise.
6339         * gold.cc: Likewise.
6340         * i386.cc: Likewise.
6341         * icf.h: Likewise.
6342         * incremental-dump.cc: Likewise.
6343         * incremental.cc: Likewise.
6344         * layout.cc: Likewise.
6345         * layout.h: Likewise.
6346         * main.cc: Likewise.
6347         * merge.cc: Likewise.
6348         * merge.h: Likewise.
6349         * object.cc: Likewise.
6350         * object.h: Likewise.
6351         * options.cc: Likewise.
6352         * options.h: Likewise.
6353         * output.cc: Likewise.
6354         * output.h: Likewise.
6355         * plugin.cc: Likewise.
6356         * plugin.h: Likewise.
6357         * powerpc.cc: Likewise.
6358         * reloc.cc: Likewise.
6359         * script-c.h: Likewise.
6360         * script-sections.cc: Likewise.
6361         * script.cc: Likewise.
6362         * stringpool.cc: Likewise.
6363         * symtab.cc: Likewise.
6364         * symtab.h: Likewise.
6365         * target.cc: Likewise.
6366         * timer.cc: Likewise.
6367         * timer.h: Likewise.
6368         * version.cc: Likewise.
6369         * x86_64.cc: Likewise.
6370
6371 2010-08-24  Nick Clifton  <nickc@redhat.com>
6372
6373         PR 11899
6374         * layout.cc (segment_precedes): Sort segments by their physical
6375         addresses, if they have been set.
6376
6377 2010-08-23  Cary Coutant  <ccoutant@google.com>
6378
6379         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6380         symbols data.
6381         (Lib_group::include_member): Unlock object after deleting its
6382         symbols data.
6383         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6384         the bug fixed here.
6385
6386 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6387             Cary Coutant  <ccoutant@google.com>
6388
6389         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6390         constructor, and set_blocker.
6391         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6392         readsyms_blocker_.
6393         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6394         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6395         * testsuite/Makefile.am (start_lib_test): New test case.
6396         * testsuite/Makefile.in: Regenerate.
6397         * testsuite/start_lib_test_main.c: New file.
6398         * testsuite/start_lib_test_1.c: New file.
6399         * testsuite/start_lib_test_2.c: New file.
6400         * testsuite/start_lib_test_3.c: New file.
6401
6402 2010-08-19  Ian Lance Taylor  <iant@google.com>
6403
6404         * Makefile.in: Rebuild with automake 1.11.1.
6405         * aclocal.m4: Likewise.
6406         * testsuite/Makefile.in: Likewise.
6407
6408 2010-08-19  Ian Lance Taylor  <iant@google.com>
6409
6410         PR 10893
6411         * i386.cc (class Output_data_plt_i386): Update declarations.
6412         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6413         local_ifuncs_ fields.
6414         (Target_i386::do_plt_section_for_global): New function.
6415         (Target_i386::do_plt_section_for_local): New function.
6416         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6417         parameter; change all callers.  Initialize global_ifuncs_ and
6418         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6419         __rel_iplt_end.
6420         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6421         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6422         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6423         symbols.
6424         (Target_i386::make_plt_section): New function, broken out of
6425         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6426         (Target_i386::make_plt_entry): Call make_plt_section.
6427         (Target_i386::make_local_ifunc_plt_entry): New function.
6428         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6429         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6430         R_386_IRELATIVE to switch.
6431         (Target_i386::Scan::global): Likewise.
6432         (Target_i386::Relocate::relocate): Likewise.
6433         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6434         switch.
6435         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6436         (Target_x86_64::do_plt_section_for_global): New function.
6437         (Target_x86_64::do_plt_section_for_local): New function.
6438         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6439         parameter; change all callers.  If doing a static link define
6440         __rela_iplt_start and __rela_iplt_end.
6441         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6442         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6443         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6444         to point to .plt.
6445         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6446         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6447         switch.
6448         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6449         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6450         R_X86_64_IRELATIVE to switch.
6451         (Target_x86_64::Scan::global): Likewise.
6452         (Target_x86_64::Relocate::relocate): Likewise.
6453         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6454         switch.
6455         * target.h (class Target): Add plt_section_for_global and
6456         plt_section_for_local functions.  Add do_plt_section_for_global
6457         and do_plt_section_for_local virtual functions.
6458         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6459         clarifying comments.
6460         (Symbol::use_plt_offset): Handle IFUNC symbol.
6461         * object.cc (Sized_relobj::Sized_relobj): Initialize
6462         local_plt_offsets_.
6463         (Sized_relobj::local_has_plt_offset): New function.
6464         (Sized_relobj::local_plt_offset): New function.
6465         (Sized_relobj::set_local_plt_offset): New function.
6466         (Sized_relobj::do_count): Handle IFUNC symbol.
6467         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6468         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6469         is_ifunc_symbol functions.
6470         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6471         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6472         local_plt_offsets_ field.
6473         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6474         * output.h (class Output_section_data): Add non-const
6475         output_section function.
6476         (class Output_data_got): Update declarations.
6477         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6478         Add use_plt_offset parameter to global and local constructors.
6479         Change all callers.  Change local_sym_index_ field to 31 bits.
6480         Change GSYM_CODE and CONSTANT_CODE accordingly.
6481         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6482         doing a static link don't set sh_link field.
6483         (Output_data_got::Got_entry::write): Use PLT offset if
6484         appropriate.
6485         (Output_data_got::add_global_plt): New function.
6486         (Output_data_got::add_local_plt): New function.
6487         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6488         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6489         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6490         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6491         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6492         IFUNC conditional.
6493         * testsuite/ifunc-sel.h: New file.
6494         * testsuite/ifuncmain1.c: New file.
6495         * testsuite/ifuncmain1vis.c: New file.
6496         * testsuite/ifuncmod1.c: New file.
6497         * testsuite/ifuncdep2.c: New file.
6498         * testsuite/ifuncmain2.c: New file.
6499         * testsuite/ifuncmain3.c: New file.
6500         * testsuite/ifuncmod3.c: New file.
6501         * testsuite/ifuncmain4.c: New file.
6502         * testsuite/ifuncmain5.c: New file.
6503         * testsuite/ifuncmod5.c: New file.
6504         * testsuite/ifuncmain6pie.c: New file.
6505         * testsuite/ifuncmod6.c: New file.
6506         * testsuite/ifuncmain7.c: New file.
6507         * configure, testsuite/Makefile.in: Rebuild.
6508
6509 2010-08-18  Ian Lance Taylor  <iant@google.com>
6510
6511         * incremental.cc
6512         (Output_section_incremental_inputs::write_input_files): Add cast
6513         to avoid signed/unsigned comparison warning.
6514         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6515
6516 2010-08-12  Cary Coutant  <ccoutant@google.com>
6517
6518         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6519
6520 2010-08-13  Ian Lance Taylor  <iant@google.com>
6521
6522         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6523
6524 2010-08-12  Cary Coutant  <ccoutant@google.com>
6525             Doug Kwan  <dougkwan@google.com>
6526
6527         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6528         defintion overrides non-weak undef, remember that the original undef
6529         is not weak.
6530         * symtab.cc (Symbol_table::sized_write_global): For undef without
6531         an original weak binding, set binding to global in output.
6532         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6533         * testsuite/Makefile.in: Regenerate.
6534         * testsuite/strong_ref_weak_def.sh: New file.
6535         * testsuite/strong_ref_weak_def_1.c: Ditto.
6536         * testsuite/strong_ref_weak_def_2.c: Ditto.
6537
6538 2010-08-12  Cary Coutant  <ccoutant@google.com>
6539
6540         * testsuite/incremental_test.sh: Rewrite.
6541         * testsuite/incremental_test_1.c: Rewrite.
6542         * testsuite/incremental_test_2.c: Rewrite.
6543
6544 2010-08-12  Cary Coutant  <ccoutant@google.com>
6545
6546         * arm.cc (Target_arm::got_size): Add const.
6547         (Target_arm::got_entry_count): New function.
6548         (Target_arm::plt_entry_count): New function.
6549         (Target_arm::first_plt_entry_offset): New function.
6550         (Target_arm::plt_entry_size): New function.
6551         (Output_data_plt_arm::entry_count): New function.
6552         (Output_data_plt_arm::first_plt_entry_offset): New function.
6553         (Output_data_plt_arm::get_plt_entry_size): New function.
6554         * i386.cc (Target_i386::got_size): Add const.
6555         (Target_i386::got_entry_count): New function.
6556         (Target_i386::plt_entry_count): New function.
6557         (Target_i386::first_plt_entry_offset): New function.
6558         (Target_i386::plt_entry_size): New function.
6559         (Output_data_plt_i386::entry_count): New function.
6560         (Output_data_plt_i386::first_plt_entry_offset): New function.
6561         (Output_data_plt_i386::get_plt_entry_size): New function.
6562         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6563         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6564         * incremental.cc: Include target.h.
6565         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6566         parameter.  Adjust all callers.  Find incremental_got_plt section.
6567         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6568         section.
6569         (Output_section_incremental_inputs::set_final_data_size): Calculate
6570         size of incremental_got_plt section.
6571         (Output_section_incremental_inputs::do_write): Write the
6572         incremental_got_plt section.
6573         (Got_plt_view_info): New struct.
6574         (Local_got_offset_visitor): New class.
6575         (Global_got_offset_visitor): New class.
6576         (Global_symbol_visitor_got_plt): New class.
6577         (Output_section_incremental_inputs::write_got_plt): New function.
6578         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6579         Add parameter.  Adjust all callers.
6580         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6581         (Incremental_inputs::got_plt_section): New function.
6582         (Incremental_inputs::got_plt_section_): New data member.
6583         (Incremental_got_plt_reader): New class.
6584         * layout.cc (Layout::create_incremental_info_sections): Add the
6585         incremental_got_plt section.
6586         * object.h (Got_offset_list::get_list): New function.
6587         (Got offset_list::for_all_got_offsets): New function.
6588         (Sized_relobj::local_got_offset_list): New function.
6589         * powerpc.cc (Target_powerpc::got_size): Add const.
6590         (Target_powerpc::got_entry_count): New function.
6591         (Target_powerpc::plt_entry_count): New function.
6592         (Target_powerpc::first_plt_entry_offset): New function.
6593         (Target_powerpc::plt_entry_size): New function.
6594         (Output_data_plt_powerpc::entry_count): New function.
6595         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6596         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6597         * sparc.cc (Target_sparc::got_size): Add const.
6598         (Target_sparc::got_entry_count): New function.
6599         (Target_sparc::plt_entry_count): New function.
6600         (Target_sparc::first_plt_entry_offset): New function.
6601         (Target_sparc::plt_entry_size): New function.
6602         (Output_data_plt_sparc::entry_count): New function.
6603         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6604         (Output_data_plt_sparc::get_plt_entry_size): New function.
6605         * symtab.h (Symbol::got_offset_list): New function.
6606         (Symbol_table::for_all_symbols): New function.
6607         * target.h (Sized_target::got_entry_count): New function.
6608         (Sized_target::plt_entry_count): New function.
6609         (Sized_target::plt_entry_size): New function.
6610         * x86_64.cc (Target_x86_64::got_size): Add const.
6611         (Target_x86_64::got_entry_count): New function.
6612         (Target_x86_64::plt_entry_count): New function.
6613         (Target_x86_64::first_plt_entry_offset): New function.
6614         (Target_x86_64::plt_entry_size): New function.
6615         (Output_data_plt_x86_64::entry_count): New function.
6616         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6617         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6618
6619 2010-08-12  Cary Coutant  <ccoutant@google.com>
6620
6621         * archive.cc: Include incremental.h.
6622         (Archive::Archive): Initialize incremental_info_.
6623         (Archive::include_member): Record archive members in incremental info.
6624         (Add_archive_symbols::run): Record begin and end of an archive in
6625         incremental info.
6626         (Lib_group::include_member): Record objects in incremental info.
6627         * archive.h (Incremental_archive_entry): Forward declaration.
6628         (Archive::set_incremental_info): New member function.
6629         (Archive::incremental_info): New member function.
6630         (Archive::Unused_symbol_iterator): New class.
6631         (Archive::unused_symbols_begin): New member function.
6632         (Archive::unused_symbols_end): New member function.
6633         (Archive::incremental_info_): New data member.
6634         * incremental-dump.cc (find_input_containing_global): New function.
6635         (dump_incremental_inputs): Dump new incremental info sections.
6636         * incremental.cc: Include symtab.h.
6637         (Output_section_incremental_inputs): New class.
6638         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6639         new incremental info sections.
6640         (Sized_incremental_binary::do_check_inputs): Likewise.
6641         (Incremental_inputs::report_archive): Remove.
6642         (Incremental_inputs::report_archive_begin): New function.
6643         (Incremental_inputs::report_archive_end): New function.
6644         (Incremental_inputs::report_object): New function.
6645         (Incremental_inputs::finalize_inputs): Remove.
6646         (Incremental_inputs::report_input_section): New function.
6647         (Incremental_inputs::report_script): Rewrite.
6648         (Incremental_inputs::finalize): Do nothing but finalize string table.
6649         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6650         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6651         (Incremental_inputs::create_data_sections): New function.
6652         (Incremental_inputs::relocs_entsize): New function.
6653         (Output_section_incremental_inputs::set_final_data_size): New function.
6654         (Output_section_incremental_inputs::do_write): New function.
6655         (Output_section_incremental_inputs::write_header): New function.
6656         (Output_section_incremental_inputs::write_input_files): New function.
6657         (Output_section_incremental_inputs::write_info_blocks): New function.
6658         (Output_section_incremental_inputs::write_symtab): New function.
6659         * incremental.h (Incremental_script_entry): Forward declaration.
6660         (Incremental_object_entry): Forward declaration.
6661         (Incremental_archive_entry): Forward declaration.
6662         (Incremental_inputs): Forward declaration.
6663         (Incremental_inputs_header_data): Remove.
6664         (Incremental_inputs_header): Remove.
6665         (Incremental_inputs_header_write): Remove.
6666         (Incremental_inputs_entry_data): Remove.
6667         (Incremental_inputs_entry): Remove.
6668         (Incremental_inputs_entry_write): Remove.
6669         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6670         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6671         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6672         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6673         Likewise.
6674         (Incremental_input_entry): New class.
6675         (Incremental_script_entry): New class.
6676         (Incremental_object_entry): New class.
6677         (Incremental_archive_entry): New class.
6678         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6679         (Incremental_inputs::report_inputs): Remove.
6680         (Incremental_inputs::report_archive): Remove.
6681         (Incremental_inputs::report_archive_begin): New function.
6682         (Incremental_inputs::report_archive_end): New function.
6683         (Incremental_inputs::report_object): Change prototype.
6684         (Incremental_inputs::report_input_section): New function.
6685         (Incremental_inputs::report_script): Change prototype.
6686         (Incremental_inputs::get_reloc_count): New function.
6687         (Incremental_inputs::set_reloc_count): New function.
6688         (Incremental_inputs::create_data_sections): New function.
6689         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6690         (Incremental_inputs::inputs_section): New function.
6691         (Incremental_inputs::symtab_section): New function.
6692         (Incremental_inputs::relocs_section): New function.
6693         (Incremental_inputs::get_stringpool): Add const.
6694         (Incremental_inputs::command_line): Add const.
6695         (Incremental_inputs::inputs): Remove.
6696         (Incremental_inputs::command_line_key): New function.
6697         (Incremental_inputs::input_file_count): New function.
6698         (Incremental_inputs::input_files): New function.
6699         (Incremental_inputs::relocs_entsize): New function.
6700         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6701         (Incremental_inputs::finalize_inputs): Remove.
6702         (Incremental_inputs::Input_info): Remove.
6703         (Incremental_inputs::lock_): Remove.
6704         (Incremental_inputs::inputs_): Change type.
6705         (Incremental_inputs::inputs_map_): Remove.
6706         (Incremental_inputs::current_object_entry_): New data member.
6707         (Incremental_inputs::inputs_section_): New data member.
6708         (Incremental_inputs::symtab_section_): New data member.
6709         (Incremental_inputs::relocs_section_): New data member.
6710         (Incremental_inputs::reloc_count_): New data member.
6711         (Incremental_inputs_reader): New class.
6712         (Incremental_symtab_reader): New class.
6713         (Incremental_relocs_reader): New class.
6714         * layout.cc (Layout::finalize): Move finalization of incremental info
6715         and creation of incremental info sections to follow finalization of
6716         symbol table.  Set offsets for postprocessing sections.
6717         (Layout::create_incremental_info_sections): Call
6718         Incremental_inputs::create_data_sections.  Add incremental symtab
6719         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6720         sections to layout after input sections.
6721         * layout.h (struct Timespec): Forward declaration.
6722         (Layout::incremental_inputs): Add const.
6723         (Layout::create_incremental_info_sections): Add parameter.
6724         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6725         * object.cc: Include incremental.h.
6726         (Relobj::finalize_incremental_relocs): New function.
6727         (Sized_relobj::do_layout): Record input sections in incremental info.
6728         * object.h (Object::output_section): New function.
6729         (Object::output_section_offset): Moved from Relobj.
6730         (Object::get_incremental_reloc_base): New function.
6731         (Object::get_incremental_reloc_count): New function.
6732         (Object::do_output_section): New function.
6733         (Object::do_output_section_offset): Moved from Relobj.
6734         (Object::do_get_incremental_reloc_base): New function.
6735         (Object::do_get_incremental_reloc_count): New function.
6736         (Object::Object): Initialize new data members.
6737         (Relobj::output_section): Renamed do_output_section and moved to
6738         protected.
6739         (Relobj::output_section_offset): Moved to Object.
6740         (Relobj::do_get_incremental_reloc_base): New function.
6741         (Relobj::do_get_incremental_reloc_count): New function.
6742         (Relobj::allocate_incremental_reloc_counts): New function.
6743         (Relobj::count_incremental_reloc): New function.
6744         (Relobj::finalize_incremental_relocs): New function.
6745         (Relobj::next_incremental_reloc_index): New function.
6746         (Relobj::reloc_counts_): New data member.
6747         (Relobj::reloc_bases_): New data member.
6748         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6749         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6750         (Sized_relobj::incremental_relocs_scan): New function.
6751         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6752         (Sized_relobj::incremental_relocs_write): New function.
6753         (Sized_relobj::incremental_relocs_write_reltype): New function.
6754         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6755         incremental link.
6756         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6757         archives and object files elsewhere.
6758         (Add_symbols::run): Report object files here.
6759         (Finish_group::run): Report end of archive at end of group.
6760         * reloc.cc: Include layout.h, incremental.h.
6761         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6762         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6763         (Sized_relobj::incremental_relocs_scan): New function.
6764         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6765         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6766         (Sized_relobj::incremental_relocs_write): New function.
6767         (Sized_relobj::incremental_relocs_write_reltype): New function.
6768         * script.cc (read_input_script): Rewrite test for incremental link.
6769         Change call to Incremental_inputs::report_script.
6770         * symtab.h (Symbol_table::first_global_index): New function.
6771         (Symbol_table::output_count): New function.
6772
6773 2010-08-12  Doug Kwan  <dougkwan@google.com>
6774
6775         * arm.cc (Target_arm::merge_object_attributes): Check command line
6776         options --no-wchar-size-warning and --no-enum-size-warning.
6777         * options.h (General_options): Add ld-compatible options
6778         --no-enum-size-warning and --no-wchar-size-warning.
6779
6780 2010-08-04  Ian Lance Taylor  <iant@google.com>
6781
6782         * x86_64.cc (Target_x86_64::Scan::local): Use
6783         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6784         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6785         (Target_x86_64::Scan::global): Likewise.
6786         (Target_x86_64::Relocate::relocate): Likewise.
6787         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6788         Likewise.
6789
6790 2010-08-03  Cary Coutant  <ccoutant@google.com>
6791
6792         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6793         to reserve space in merged_strings vector. Keep total input size
6794         for stats.
6795         (Output_merge_string::do_print_merge_stats): Print total input size.
6796         * merge.h (Output_merge_string): Add input_size_ field.
6797         * stringpool.cc (Stringpool_template::string_length): Move
6798         implementations out of Stringpool_template class and place in
6799         stringpool.h.
6800         * stringpool.h (string_length): Move out of Stringpool_template.
6801
6802 2010-08-03  Ian Lance Taylor  <iant@google.com>
6803
6804         PR 11712
6805         * layout.cc (relaxation_loop_body): If address of load segment is
6806         set, adjust address to include headers if possible.
6807
6808 2010-08-03  Ian Lance Taylor  <iant@google.com>
6809
6810         * version.cc (version_string): Bump to 1.10.
6811
6812 2010-08-03  Ian Lance Taylor  <iant@google.com>
6813
6814         PR 11805
6815         * layout.h (enum Output_section_order): Define.
6816         (class Layout): Update declarations.
6817         * layout.cc (Layout::get_output_section): Add order parameter.
6818         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6819         is_first_non_relro parameters.  Change all callers.
6820         (Layout::choose_output_section): Likewise.
6821         (Layout::add_output_section_data): Likewise.
6822         (Layout::make_output_section): Likewise.  Set order.
6823         (Layout::default_section_order): New function.
6824         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6825         * output.cc (Output_section::Output_section): Initialize order_.
6826         Don't initialize deleted fields.
6827         (Output_segment::Output_segment): Don't initialize deleted
6828         fields.
6829         (Output_segment::add_output_section_to_load): New function
6830         replacing add_output_section.  Change all callers to call this or
6831         add_output_section_to_nonload.
6832         (Output_segment::add_output_section_to_nonload): New function.
6833         (Output_segment::remove_output_section): Rewrite.
6834         (Output_segment::add_initial_output_data): Likewise.
6835         (Output_segment::has_any_data_sections): Likewise.
6836         (Output_segment::is_first_section_relro): Likewise.
6837         (Output_segment::maximum_alignment): Likewise.
6838         (Output_segment::has_dynamic_reloc): New function replacing
6839         dynamic_reloc_count.  Change all callers.
6840         (Output_segment::has_dynamic_reloc_list): New function replacing
6841         dynamic_reloc_count_list.  Change all callers.
6842         (Output_segment::set_section_addresses): Rewrite.
6843         (Output_segment::set_offset): Rewrite.
6844         (Output_segment::find_first_and_last_list): Remove.
6845         (Output_segment::set_tls_offsets): Rewrite.
6846         (Output_segment::first_section_load_address): Likewise.
6847         (Output_segment::output_section_count): Likewise.
6848         (Output_segment::section_with_lowest_load_address): Likewise.
6849         (Output_segment::write_section_headers): Likewise.
6850         (Output_segment::print_sections_to_map): Likewise.
6851         * output.h (class Output_data): Remove dynamic_reloc_count_
6852         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6853         (Output_data::add_dynamic_reloc): Rewrite.
6854         (Output_data::has_dynamic_reloc): New function.
6855         (Output_data::dynamic_reloc_count): Remove.
6856         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6857         is_last_relro_, is_first_non_relro_, is_interp_,
6858         is_dynamic_linker_section_ fields.  Add order and set_order
6859         functions.  Remove is_relro_local, set_is_relro_local,
6860         is_last_relro, set_is_last_relro, is_first_non_relro,
6861         set_is_first_non_relro functions, is_interp, set_is_interp,
6862         is_dynamic_linker_section, and set_is_dynamic_linker_section
6863         functions.
6864         (class Output_segment): Change Output_data_list from std::list to
6865         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6866         output_bss_ fields.  Update declarations.
6867
6868 2010-08-02  Ian Lance Taylor  <iant@google.com>
6869
6870         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6871         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6872         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6873
6874 2010-08-02  Ian Lance Taylor  <iant@google.com>
6875
6876         PR 11855
6877         * script.cc (Script_options::Script_options): Initialize
6878         symbol_definitions_ and symbol_references_.
6879         (Script_options::add_symbol_assignment): Update
6880         symbol_definitions_ and symbol_references_.
6881         (Script_options::add_symbol_reference): New function.
6882         (script_symbol): New function.
6883         * script.h (class Script_options): Add symbol_definitions_ and
6884         symbol_references_ fields.
6885         (Script_options::referenced_const_iterator): New type.
6886         (Script_options::referenced_begin): New function.
6887         (Script_options::referenced_end): New function.
6888         (Script_options::is_referenced): New function.
6889         (Script_options::any_unreferenced): New function.
6890         * script-c.h (script_symbol): Declare.
6891         * yyscript.y (exp): Call script_symbol.
6892         * symtab.cc: Include "script.h".
6893         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6894         Change all callers.  Check symbols referenced by scripts.
6895         (Symbol_table::add_undefined_symbols_from_command_line): Add
6896         layout parameter.  Change all callers.
6897         (Symbol_table::do_add_undefined_symbols_from_command_line):
6898         Likewise.  Break out loop body.  Check symbols referenced by
6899         scripts.
6900         (Symbol_table::add_undefined_symbol_from_command_line): New
6901         function broken out of
6902         do_add_undefined_symbols_from_command_line.
6903         * symtab.h (class Symbol_table): Update declarations.
6904         * archive.cc: Include "layout.h".
6905         (Archive::should_include_member): Add layout parameter.  Change
6906         all callers.  Check for symbol mentioned in expression.
6907         * archive.h (class Archive): Update declaration.
6908         * object.cc (Sized_relobj::do_should_include_member): Add layout
6909         parameter.
6910         * object.h (Object::should_include_member): Add layout parameter.
6911         Change all callers.
6912         (Object::do_should_include_member): Add layout parameter.
6913         (class Sized_relobj): Update declaration.
6914         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6915         parameter.
6916         * dynobj.h (class Sized_dynobj): Update declaration.
6917         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6918         layout parameter.
6919         * plugin.h (class Sized_pluginobj): Update declaration.
6920
6921 2010-08-02  Ian Lance Taylor  <iant@google.com>
6922
6923         PR 11866
6924         * output.cc (Output_segment::set_offset): Search for the first and
6925         last sections rather than assuming that the list is in order.
6926         (Output_segment::find_first_and_last_list): New function.
6927         * output.h (class Output_segment): Update declarations.
6928         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6929         (relro_strip_test_SOURCES): New variable.
6930         (relro_strip_test_DEPENDENCIES): New variable.
6931         (relro_strip_test_LDFLAGS): New variable.
6932         (relro_strip_test_LDADD): New variable.
6933         (relro_strip_test.so): New target.
6934
6935 2010-08-02  Ian Lance Taylor  <iant@google.com>
6936
6937         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6938         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6939         (Target_i386::got_tlsdesc_section): New function.
6940         (Target_i386::got_section): Create space for GOT entries for
6941         TLSDESC relocations.
6942         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6943         R_386_TLS_GOTDESC.
6944         (Target_i386::Scan::global): Likewise.
6945         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6946         using TLSDESC GOT.
6947         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6948         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6949         (Target_x86_64::got_tlsdesc_section): New function.
6950         (Target_x86_64::got_section): Create space for GOT entries for
6951         TLSDESC relocations.
6952         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6953         R_386_TLS_GOTDESC.
6954         (Target_x86_64::Scan::global): Likewise.
6955         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6956         using TLSDESC GOT.
6957
6958 2010-08-02  Ian Lance Taylor  <iant@google.com>
6959
6960         * testsuite/final_layout.sh: Use dc to convert from hex to
6961         decimal.
6962
6963 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6964
6965         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6966         paramter to the call to gold::gc_process_relocs.
6967         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6968         paramter to the call to gold::gc_process_relocs.
6969         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6970         parameter to the call to gold::gc_process_relocs.
6971         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6972         template parameter to the call to gold::gc_process_relocs.
6973         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6974         paramter to the call to gold::gc_process_relocs.
6975         * gc.h (get_embedded_addend_size): New function.
6976         (gc_process_relocs): Save the size of the reloc for use by ICF.
6977         * icf.cc (get_section_contents): Get the addend from the text section
6978         for SHT_REL relocation sections.
6979         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6980         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6981         * int_encoding.h (read_from_pointer): New overloaded function.
6982         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6983         * testsuite/icf_sht_rel_addend_test.sh: New file.
6984         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6985         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6986
6987 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6988
6989         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6990         * Makefile.in: Regenerate.
6991         * testsuite/Makefile.in: Regenerate.
6992
6993 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6994
6995         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6996         * gold/testsuite/debug_msg.cc: Likewise.
6997         * gold/testsuite/odr_violation1.cc
6998         * gold/testsuite/odr_violation2.cc
6999
7000 2010-07-21  Cary Coutant  <ccoutant@google.com>
7001
7002         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7003         string, and length fields.
7004         (Output_merge_string::Merged_strings_list): New type.
7005         (Output_merge_string::Merged_strings_lists): New typedef.
7006         (Output_merge_string): Replace merged_strings_ with
7007         merged_strings_lists_.
7008         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7009         Merged_strings_list per input object and section.  Don't store pointer
7010         to the string.  Don't store length with each merged string entry.
7011         (Output_merge_string::finalize_merged_data): Loop over list of merged
7012         strings lists.  Recompute length of each merged string.
7013
7014 2010-07-15  Cary Coutant  <ccoutant@google.com>
7015
7016         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7017         here.
7018
7019 2010-07-14  Ian Lance Taylor  <iant@google.com>
7020
7021         * descriptors.cc (Descriptors::open): Report correct name in error
7022         message.
7023
7024 2010-07-13  Doug Kwan  <dougkwan@google.com>
7025
7026         * arm.cc (Arm_input_section::Arm_input_section): For a
7027         SHT_ARM_EXIDX section, always keeps the input sections.
7028         (Arm_input_section::set_exidx_section_link): New method.
7029         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7030         has_errors_ to false.
7031         (Arm_exidx_input_section::has_errors,
7032         Arm_exidx_input_section::set_has_errors): New methods.
7033         (Arm_exidx_input_section::has_errors_): New data member.
7034         (Arm_relobj::get_exidx_shndx_list): New method.
7035         (Arm_output_section::append_text_sections_to_list): Do not skip
7036         section without SHF_EXECINSTR.
7037         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7038         errors.
7039         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7040         section header.  Make error messages more verbose.  Check for
7041         a non-executable section linked to an EXIDX section.
7042         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7043         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7044         check that there is no deferred EXIDX section if we exit early.
7045         Instead of not making an EXIDX section in case of an error, make one
7046         and set the has_errors flag of it.
7047         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7048         in a relocatable link.
7049         (Target_arm::do_relax): Look for the EXIDX output section instead of
7050         assuming that it is called .ARM.exidx.
7051         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7052         section list.  Do not check for SHF_EXECINSTR section flags but
7053         skip any input section with errors.
7054         * output.cc (Output_section::Output_section): Initialize
7055         always_keeps_input_sections_ to false.
7056         (Output_section::add_input_section): Check for
7057         always_keeps_input_sections_.
7058         *  output.h (Output_section::always_keeps_input_sections,
7059         Output_section::set_always_keeps_input_sections): New methods.
7060         (Output_section::always_keeps_input_sections): New data member.
7061
7062 2010-07-13  Rafael Espindola  <espindola@google.com>
7063
7064         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7065         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7066
7067 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7068             Ian Lance Taylor  <iant@google.com>
7069
7070         * output.h (Output_section_lookup_maps::add_merge_section):
7071         Correct check of whether value was inserted.
7072         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7073         (Output_section_lookup_maps::add_relaxed_input_section):
7074         Likewise.
7075         * arm.cc (Target_arm::got_section): Remove used local os.
7076         * i386.cc (Target_i386::got_section): Likewise.
7077         * x86_64.cc (Target_x86_64::got_section): Likewise.
7078         * sparc.cc (Target_sparc::got_section): Likewise.
7079         (Target_sparc::relocate): Remove unused local have_got_offset.
7080         * powerpc.cc (Target_powerpc::relocate): Likewise.
7081
7082 2010-07-13  Ian Lance Taylor  <iant@google.com>
7083
7084         * compressed_output.cc (zlib_decompress): Fix signature in
7085         !HAVE_ZLIB_H case.
7086
7087         * archive.cc (Archive::include_member): Unlock an external member
7088         of a thin archive.  Don't bother to delete an object we know is
7089         NULL.
7090
7091 2010-07-12  Cary Coutant  <ccoutant@google.com>
7092
7093         * compressed_output.cc (zlib_decompress): New function.
7094         (get_uncompressed_size): New function.
7095         (decompress_input_section): New function.
7096         * compressed_output.h (get_uncompressed_size): New function.
7097         (decompress_input_section): New function.
7098         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7099         Handle compressed debug sections.
7100         * layout.cc (is_compressed_debug_section): New function.
7101         (Layout::output_section_name): Map compressed section names to
7102         canonical names.
7103         * layout.h (is_compressed_debug_section): New function.
7104         (is_debug_info_section): Recognize compressed debug sections.
7105         * merge.cc: Include compressed_output.h.
7106         (Output_merge_data::do_add_input_section): Handle compressed
7107         debug sections.
7108         (Output_merge_string::do_add_input_section): Handle compressed
7109         debug sections.
7110         * object.cc: Include compressed_output.h.
7111         (Sized_relobj::Sized_relobj): Initialize new data members.
7112         (build_compressed_section_map): New function.
7113         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7114         * object.h (Object::section_is_compressed): New method.
7115         (Object::do_section_is_compressed): New method.
7116         (Sized_relobj::Compressed_section_map): New type.
7117         (Sized_relobj::do_section_is_compressed): New method.
7118         (Sized_relobj::compressed_sections_): New data member.
7119         * output.cc (Output_section::add_input_section): Handle compressed
7120         debug sections.
7121         * reloc.cc: Include compressed_output.h.
7122         (Sized_relobj::write_sections): Handle compressed debug sections.
7123
7124 2010-07-08  Cary Coutant  <ccoutant@google.com>
7125
7126         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7127         weak when resolving to a dynamic def.
7128         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7129         for weak undef/dynamic def cases. Adjust callers.
7130         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7131         undef_binding_weak_.
7132         (Symbol_table::sized_write_globals): Adjust symbol binding.
7133         (Symbol_table::sized_write_symbol): Add binding parameter.
7134         * symtab.h (Symbol::set_undef_binding): New method.
7135         (Symbol::is_undef_binding_weak): New method.
7136         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7137         (Symbol_table::should_override): Add new parameter.
7138         (Symbol_table::sized_write_symbol): Add new parameter.
7139
7140         * testsuite/weak_undef_file1.cc: Add new test case.
7141         * testsuite/weak_undef_file2.cc: Fix header comment.
7142         * testsuite/weak_undef_test.cc: Add new test case.
7143
7144 2010-06-29  Doug Kwan  <dougkwan@google.com>
7145
7146         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7147         Initialize USE_SYMBOL_.
7148         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7149         definition.
7150         (Arm_reloc_property::uses_symbol_): New data member declaration.
7151         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7152         uses symbol value and symbol is undefined but not weakly undefined.
7153
7154 2010-06-28  Rafael Espindola  <espindola@google.com>
7155
7156         * plugin.cc (Plugin::load): Use dlerror.
7157
7158 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7159
7160         * symtab.cc (detect_odr_violations): When reporting an ODR
7161         violation, report an object where the symbol is defined.
7162
7163 2010-06-25  Doug Kwan  <dougkwan@google.com>
7164
7165         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7166         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7167         definition.
7168         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7169         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7170         target hook to detect function points.
7171         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7172         * icf.h (Icf::check_section_for_function_pointers): Change type of
7173         parameter SECTION_NAME to const reference to std::string.  Use
7174         target hook to determine if section may have unsafe pointers.
7175         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7176         method definition.
7177
7178 2010-06-21  Rafael Espindola  <espindola@google.com>
7179
7180         * fileread.cc (Input_file::find_fie): New
7181         (Input_file::open): Use Input_file::find_fie.
7182         * fileread.h (Input_file::find_fie): New
7183         * plugin.cc (set_extra_library_path): New.
7184         (Plugin::load): Add set_extra_library_path to the transfer vector.
7185         (Plugin_manager::set_extra_library_path): New.
7186         (Plugin_manager::add_input_file): Use the extra search path if set.
7187         (set_extra_library_path(): New.
7188         * plugin.h (Plugin_manager): Add set_extra_library_path and
7189         extra_search_path_.
7190
7191 2010-06-19  Cary Coutant  <ccoutant@google.com>
7192
7193         * layout.cc (gdb_sections): Add .debug_types.
7194         (lines_only_debug_sections): Likewise.
7195
7196 2010-06-18  Rafael Espindola  <espindola@google.com>
7197
7198         * plugin.cc (add_input_file,add_input_library)
7199         (Plugin_manager::add_input_file): Make filename arguments const.
7200         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7201         const.
7202
7203 2010-06-16  Doug Kwan  <dougkwan@google.com>
7204
7205         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7206         .ARM.attributes section if we have not merged any input
7207         attributes sections.
7208
7209 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7210
7211         * arm.cc: Allow combining objects with no EABI version
7212         information.
7213
7214 2010-06-15  Rafael Espindola  <espindola@google.com>
7215
7216         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7217
7218 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7219
7220         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7221         (struct iovec): Correct !HAVE_READV definition.
7222
7223 2010-06-10  Cary Coutant  <ccoutant@google.com>
7224
7225         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7226         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7227         reloc sections.
7228         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7229
7230         PR 11683
7231         * symtab.h (Symbol::is_placeholder): New member function.
7232         * target-reloc.h (relocate_section): Check for placeholder symbols.
7233
7234         * testsuite/Makefile.am (plugin_test_8): New test.
7235         (plugin_test_9): New test.
7236         * testsuite/Makefile.in: Regenerate.
7237
7238 2010-06-09  Nick Clifton  <nickc@redhat.com>
7239
7240         * yyscript.y (input_list_element): Allow strings prefixed with
7241         the '-' character.  Treat these as libraries.
7242         * script.cc (script_add_library): New function.  Adds a library
7243         specified by "-l<name>" found in an input script.
7244         * script-c.h: Add prototype for script_add_library.
7245
7246 2010-06-07  Doug Kwan  <dougkwan@google.com>
7247
7248         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7249         Restrict stub-group size to be within long conditional branch
7250         range when working around cortex-A8 erratum.
7251
7252 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7253
7254         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7255         #ifdef typo.
7256
7257 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7258
7259         PR gold/11658
7260         * output.cc
7261         (Output_section::Input_section_sort_entry::compare_section_ordering):
7262         Change to return non-zero correctly.
7263         (Output_section::Input_section_sort_section_order_index_compare
7264         ::operator()): Change to fix ambiguity in comparisons.
7265
7266 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7267
7268         * gold.h (is_wildcard_string): New function.
7269         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7270         (Layout::layout_eh_frame): Ditto.
7271         (Layout::find_section_order_index): New method.
7272         (Layout::read_layout_from_file): New method.
7273         * layout.h (Layout::find_section_order_index): New method.
7274         (Layout::read_layout_from_file): New method.
7275         (Layout::input_section_position_): New private member.
7276         (Layout::input_section_glob_): New private member.
7277         * main.cc (main): Call read_layout_from_file here.
7278         * options.h (--section-ordering-file): New option.
7279         * output.cc (Output_section::input_section_order_specified_): New
7280         member.
7281         (Output_section::Output_section): Initialize new member.
7282         (Output_section::add_input_section): Add new parameter.
7283         Keep input sections when --section-ordering-file is used.
7284         (Output_section::set_final_data_size): Sort input sections when
7285         section ordering file is specified.
7286         (Output_section::Input_section_sort_entry): Add new parameter.
7287         Check sorting type.
7288         (Output_section::Input_section_sort_entry::compare_section_ordering):
7289         New method.
7290         (Output_section::Input_section_sort_compare::operator()): Change to
7291         consider section_order_index.
7292         (Output_section::Input_section_sort_init_fini_compare::operator()):
7293         Change to consider section_order_index.
7294         (Output_section::Input_section_sort_section_order_index_compare
7295         ::operator()): New method.
7296         (Output_section::sort_attached_input_sections): Change to sort
7297         according to section order when specified.
7298         (Output_section::add_input_section<32, true>): Add new parameter.
7299         (Output_section::add_input_section<64, true>): Add new parameter.
7300         (Output_section::add_input_section<32, false>): Add new parameter.
7301         (Output_section::add_input_section<64, false>): Add new parameter.
7302         * output.h (Output_section::add_input_section): Add new parameter.
7303         (Output_section::input_section_order_specified): New
7304         method.
7305         (Output_section::set_input_section_order_specified): New method.
7306         (Input_section::Input_section): Initialize section_order_index_.
7307         (Input_section::section_order_index): New method.
7308         (Input_section::set_section_order_index): New method.
7309         (Input_section::section_order_index_): New member.
7310         (Input_section::Input_section_sort_section_order_index_compare): New
7311         struct.
7312         (Output_section::input_section_order_specified_): New member.
7313         * script-sections.cc (is_wildcard_string): Delete and move modified
7314         method to gold.h.
7315         (Output_section_element_input::Output_section_element_input): Modify
7316         call to is_wildcard_string.
7317         (Output_section_element_input::Input_section_pattern
7318         ::Input_section_pattern): Ditto.
7319         (Output_section_element_input::Output_section_element_input): Ditto.
7320         * testsuite/Makefile.am (final_layout): New test case.
7321         * testsuite/Makefile.in: Regenerate.
7322         * testsuite/final_layout.cc: New file.
7323         * testsuite/final_layout.sh: New file.
7324
7325 2010-06-01  Rafael Espindola  <espindola@google.com>
7326
7327         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7328
7329 2010-06-01  Rafael Espindola  <espindola@google.com>
7330
7331         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7332         visibility of symbols.
7333
7334 2010-05-27  Doug Kwan  <dougkwan@google.com>
7335
7336         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7337         from start of output section instead of address for a local symbol
7338         in a merged or relaxed section when doing a relocatable link.
7339
7340 2010-05-26  Rafael Espindola  <espindola@google.com>
7341
7342         PR 11604
7343         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7344         adding sections the garbage collector removed.
7345         * gold/testsuite/Makefile.am: Add test.
7346         * gold/testsuite/Makefile.in: Regenerate.
7347         * gold/testsuite/plugin_test_7.sh: New.
7348         * gold/testsuite/plugin_test_7_1.c: New.
7349         * gold/testsuite/plugin_test_7_2.c: New.
7350
7351 2010-05-26  Rafael Espindola  <espindola@google.com>
7352
7353         * script-sections.cc (Output_section_definition::set_section_addresses):
7354         Check for --section-start.
7355
7356 2010-05-26  Doug Kwan  <dougkwan@google.com>
7357
7358         * arm.cc (Arm_scan_relocatable_relocs): New class.
7359         (Target_arm::relocate_special_relocatable): New method.
7360         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7361         (Arm_relocate_functions::thumb_branch_common): Same.
7362         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7363         instead of Default_scan_relocatable_relocs.
7364         * target-reloc.h (relocate_for_relocatable): Let target handle
7365         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7366         * target.h (Sized_target::relocate_special_relocatable): New method.
7367
7368 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7369
7370         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7371
7372 2010-05-23  Doug Kwan  <dougkwan@google.com>
7373
7374         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7375         instead of a cast.
7376         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7377         with a direct branch, not a conditional branch, to a stub.
7378         * merge.cc (Output_merge_base::record_input_section): New method
7379         defintion.
7380         (Output_merge_data::do_add_input_section): Record input section if
7381         keeps-input-sections flag is set.
7382         (Output_merge_string::do_add_input_section): Ditto.
7383         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7384         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7385         INPUT_SECTIONS_.
7386         (Output_merge_base::keeps_input_sections,
7387         Output_merge_base::set_keeps_input_sections,
7388         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7389         method definitions.
7390         (Output_merge_base::Input_sections): New type declaration.
7391         (Output_merge_base::input_sections_begin,
7392         Output_merge_base::input_sections_end,
7393         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7394         (Output_merge_base::bool keeps_input_sections_,
7395         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7396         Output_merge_base::input_sections_): New data members.
7397         (Output_merge_data::do_set_keeps_input_sections): New method
7398         defintion.
7399         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7400         * output.cc (Output_section::Input_section::relobj): Move method
7401         defintion from class declaration to here and handle merge sections.
7402         (Output_section::Input_section::shndx): Ditto.
7403         (Output_section::Output_section): Remove initializations of removed
7404         data members and initialize new data member LOOKUP_MAPS_.
7405         (Output_section::add_input_section): Set keeps-input-sections flag
7406         for a newly created merge output section as appropriate.  Adjust code
7407         to use Output_section_lookup_maps class.
7408         (Output_section::add_relaxed_input_section): Adjst code for lookup
7409         maps code refactoring.
7410         (Output_section::add_merge_input_section): Add a new parameter
7411         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7412         class.  If adding input section to a newly created merge output
7413         section fails, remove the new merge section.
7414         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7415         Adjust code for use of the Output_section_lookup_maps class.
7416         (Output_section::find_merge_section): Ditto.
7417         (Output_section::build_lookup_maps): New method defintion.
7418         (Output_section::find_relaxed_input_section): Adjust code to use
7419         Output_section_lookup_maps class.
7420         (Output_section::get_input_sections): Export merge sections.  Adjust
7421         code to use Output_section_lookup_maps class.
7422         (Output_section:::add_script_input_section): Adjust code to use
7423         Output_section_lookup_maps class.  Update lookup maps for merge
7424         sections also.
7425         (Output_section::discard_states): Use Output_section_lookup_maps.
7426         (Output_section::restore_states): Same.
7427         * output.h (Merge_section_properties): Move class defintion out of
7428         Output_section.
7429         (Output_section_lookup_maps): New class.
7430         (Output_section::Input_section::is_merge_section): New method
7431         defintion.
7432         (Output_section::Input_section::relobj): Move defintion out of class
7433         defintion.  Declare method only.
7434         (Output_section::Input_section::shndx): Ditto.
7435         (Output_section::Input_section::output_merge_base): New method defintion.
7436         (Output_section::Input_section::u2_.pomb): New union field.
7437         (Output_section::Merge_section_by_properties_map,
7438         Output_section::Output_section_data_by_input_section_map,
7439         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7440         Remove types.
7441         (Output_section::add_merge_input_section): Add new parameter
7442         KEEPS_INPUT_SECTIONS.
7443         (Output_section::build_lookup_maps): New method declaration.
7444         (Output_section::merge_section_map_,
7445         Output_section::merge_section_by_properties_map_,
7446         Output_section::relaxed_input_section_map_,
7447         Output_section::is_relaxed_input_section_map_valid_): Remove data
7448         members.
7449         (Output_section::lookup_maps_): New data member.
7450
7451 2010-05-21  Doug Kwan  <dougkwan@google.com>
7452
7453         PR gold/11619
7454         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7455         avoid a compilation error.
7456
7457 2010-05-19  Rafael Espindola  <espindola@google.com>
7458
7459         * script-sections.cc (Output_section_definition::allocate_to_segment):
7460         Update the phdrs_list even when the output section is NULL.
7461         * testsuite/Makefile.am: Add test.
7462         * testsuite/Makefile.in: Regenerate.
7463         * testsuite/script_test_9.cc: New.
7464         * testsuite/script_test_9.sh: New.
7465         * testsuite/script_test_9.t: New.
7466
7467 2010-05-19  Doug Kwan  <dougkwan@google.com>
7468
7469         * arm.cc (Arm_input_section::original_size): New method.
7470         (Arm_input_section::do_addralign): Add a cast.
7471         (Arm_input_section::do_output_offset): Remove static cast.
7472         (Arm_input_section::original_addralign,
7473          Arm_input_section::original_size_): Change type to uint32_t.
7474         (Arm_input_section::init): Add safe casts for section alignment
7475         and size.
7476         (Arm_input_section::set_final_data_size): Do not set address and
7477         offset of stub table.
7478         (Arm_output_section::fix_exidx_coverage): Change use of of
7479         Output_section::Simple_input_section to that of
7480         Output_section::Input_section.
7481         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7482         except for the first pass.
7483         * output.cc (Output_section::get_input_sections): Change type of
7484         input_sections to std::list<Input_section>.
7485         (Output_section::add_script_input_section): Rename from
7486         Output_section::add_simple_input_section.  Change type of SIS
7487         parameter from Simple_input_section to Input_section.
7488         * output.h (Output_section::Simple_input_section): Remove class.
7489         (Output_section::Input_section): Change class visibility to public.
7490         (Output_section::Input_section::addralign): Use stored alignments
7491         for special input sections if set.
7492         (Output_section::Input_section::set_addralign): New method.
7493         (Output_section::get_input_sections): Change parameter type from
7494         list of Simple_input_section to list of Input_section.
7495         (Output_section::add_script_input_section): Rename from
7496         Output_section::add_simple_input_section. Change first parameter's
7497         type from Simple_input_section to Input_section and remove the
7498         second and third parameters.
7499         * script-sections.cc (Input_section::Input_section_list): Change
7500         type to list of Output_section::Input_section/
7501         (Input_section_info::Input_section_info): Change parameter type of
7502         INPUT_SECTION to Output_section::Input_section.
7503         (Input_section_info::input_section): Change return type.
7504         (Input_section_info::input_section_): Change type to
7505         Output_section::Input_section.
7506         (Output_section_element_input::set_section_addresses): Adjust code
7507         to use Output_section::Input_section instead of
7508         Output_section::Simple_input_section.  Adjust code for renaming
7509         of Output_section::add_simple_input_section.
7510         (Orphan_output_section::set_section_addresses): Ditto.
7511
7512 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7513
7514         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7515         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7516
7517 2010-05-18  Rafael Espindola  <espindola@google.com>
7518
7519         * options.cc (General_options::finalize): Handle -nostdlib.
7520         * options.h (nostdlib): New option.
7521         * script.cc (script_add_search_dir): Handle -nostdlib.
7522
7523 2010-05-12  Doug Kwan  <dougkwan@google.com>
7524
7525         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7526         attributes section only if there no attributes section after merging.
7527         (Target_arm::merge_object_attributes): Move value of
7528         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7529         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7530         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7531         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7532         and arm_attr_merge_7.stdout.
7533         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7534         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7535         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7536         arm_attr_merge_7b.o): New rules.
7537         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7538         arm_attr_merge_7
7539         * testsuite/Makefile.in: Regenerate.
7540         * testsuite/arm_attr_merge.sh: New file.
7541         * testsuite/arm_attr_merge_[67][ab].s: Same.
7542
7543 2010-05-05  Nick Clifton  <nickc@redhat.com>
7544
7545         * po/es.po: Updated Spanish translation.
7546
7547 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7548
7549         * Makefile.am (install-exec-local): Properly install gold as
7550         default cross linker.
7551         * Makefile.in: Regenerated.
7552
7553 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7554             Nick Clifton  <nickc@redhat.com>
7555
7556         * configure.ac (install_as_default): Define and set to false
7557         unless --enable-gold or --enable-gold=both/gold has been
7558         specified.
7559         * configure: Regenerate.
7560
7561         * Makefile.am (install-exec-local): Install the executable as
7562         'ld.gold'.  If install_as_default is true then also install it as
7563         'ld'.
7564         * Makefile.in: Regenerated.
7565
7566 2010-04-24  Ian Lance Taylor  <iant@google.com>
7567
7568         * layout.cc (Layout::layout_reloc): In relocatable link don't
7569         combine reloc sections for grouped sections.
7570
7571 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7572
7573         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7574         sections that are not ordinary to icf.
7575         * icf.cc (get_section_contents): Handle relocation pointing to section
7576         with no object or shndx information.
7577         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7578         * testsuite/Makefile.in: Regenerate.
7579         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7580         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7581
7582 2010-04-22  Ian Lance Taylor  <iant@google.com>
7583
7584         * expression.cc (Expression::Expression_eval_info): Add
7585         result_alignment_pointer field.
7586         (Expression::eval_with_dot): Add result_alignment_pointer
7587         parameter.  Change all callers.
7588         (Expression::eval_maybe_dot): Likewise.
7589         (class Binary_expression): Add alignment_pointer parameter to
7590         left_value and right_value.  Change all callers.
7591         (BINARY_EXPRESSION): Set result alignment.
7592         (class Trinary_expression): Add alignment_pointer parameter to
7593         arg2_value and arg3_value.  Change all callers.
7594         (Trinary_cond::value): Set result alignment.
7595         (Max_expression::value, Min_expression::value): Likewise.
7596         (Align_expression::value): Likewise.
7597         * script-sections.cc (class Sections_element): Add dot_alignment
7598         parameter to set_section_addresses virtual function.  Update
7599         instantiations.
7600         (class Output_section_element): Likewise.
7601         (Script_sections::create_segments): Add dot_alignment parameter.
7602         Change all callers.
7603         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7604         (Script_sections::set_phdrs_clause_addresses): Likewise.
7605         * script-sections.h: Update declarations.
7606         * script.h: Update declarations.
7607         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7608         min_p_align.
7609         * testsuite/script_test_3.t: Set large alignment.
7610         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7611         segment has expected alignment.
7612
7613 2010-04-22  Nick Clifton  <nickc@redhat.com>
7614
7615         * po/gold.pot: Updated by the Translation project.
7616         * po/vi.po: Updated Vietnamese translation.
7617
7618 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7619
7620         * testsuite/Makefile.am (check_PROGRAMS): Add
7621         icf_virtual_function_folding_test.
7622         * testsuite/Makefile.in: Regenerated.
7623
7624 2010-04-15  Andrew Haley  <aph@redhat.com>
7625
7626         * options.h (merge_exidx_entries): New option.
7627         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7628         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7629         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7630         (Target_arm::merge_exidx_entries): New function.
7631         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7632         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7633         to Arm_exidx_fixup constructor.
7634         Add new arg, merge_exidx_entries.
7635         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7636         Arm_output_section::fix_exidx_coverage.
7637
7638 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7639
7640         * icf.cc (get_section_contents): Check for preemptible functions.
7641         Ignore addend when appropriate.
7642         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7643         section folded.
7644         (add_from_relobj): Check for section folded.
7645         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7646         * symtab.h (should_add_dynsym_entry): Add new parameter.
7647         * target-reloc.h (scan_relocs): Check for section folded.
7648         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7649         Check reloc types for function pointers in shared objects.
7650         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7651         case.
7652         (icf_preemptible_functions_test): New test case.
7653         (icf_string_merge_test): New test case.
7654         * testsuite.Makefile.in: Regenerate.
7655         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7656         bar_glob.  Refactor code.
7657         * testsuite/icf_preemptible_functions_test.cc: New file.
7658         * testsuite/icf_preemptible_functions_test.sh: New file.
7659         * testsuite/icf_string_merge_test.cc: New file.
7660         * testsuite/icf_string_merge_test.sh: New file.
7661         * testsuite/icf_virtual_function_folding_test.cc: New file.
7662         * testsuite/icf_virtual_function_folding_test.sh: New file.
7663
7664 2010-04-14  Doug Kwan  <dougkwan@google.com>
7665
7666         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7667         for local symbol recounting if we remove a section due to ICF.
7668         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7669         there are no regular objects in input.
7670
7671 2010-04-13  Doug Kwan  <dougkwan@google.com>
7672
7673         * arm.cc (Arm_input_section::set_final_data_size): Compute
7674         accurate final data size instead of using current data size.
7675
7676 2010-04-09  Doug Kwan  <dougkwan@google.com>
7677
7678         * layout.cc (Layout::choose_output_section): Handle script section
7679         types.
7680         (Layout::make_output_section_for_script): Add section type parameter.
7681         Handle script section types.
7682         * layout.h (Layout::make_output_section_for_script): Add section
7683         type parameter.
7684         * output.cc (Output_section::Output_section): Initialize data member
7685         is_noload_.
7686         (Output_section::do_reset_address_and_file_offset): Do not set address
7687         to 0 if section is a NOLOAD section.
7688         * output.h (Output_section::is_noload): New method.
7689         (Output_section::set_is_noload): Ditto.
7690         (Output_section::is_noload_): New data member.
7691         * script-c.h (Script_section_type): New enum type.
7692         (struct Parser_output_section_header): Add new file section_type.
7693         * script-sections.cc (Sections_element::output_section_name): Add
7694         parameter for returning script section type.
7695         (Output_section_definition::output_section_name): Ditto.
7696         (Output_section_definition::section_type)P; New method.
7697         (Output_section_definiton::script_section_type_name): Ditto.
7698         (Output_section_definition::script_section_type_): New data member.
7699         (Output_section_definition::Output_section_definition): Initialize
7700         data member Output_section_definition::script_section_type_.
7701         (Output_section_definition::create_sections): Pass script section type
7702         to Layout::make_output_section_for_script.
7703         (Output_section_definition::output_section_name): Return script
7704         section type to caller.
7705         (Output_section_definition::set_section_address): Do not advance
7706         dot value and load address if section type is NOLOAD.  Set address
7707         of NOLOAD sections regardless of section flags.
7708         (Output_section_definition::print): Print section type if it is
7709         not SCRIPT_SECTION_TYPE_NONE.
7710         (Output_section_definition::section_type): New method.
7711         (Output_section_definition::script_section_type_name): Ditto.
7712         (Script_sections::output_section_name): Add new parameter
7713         PSECTION_TYPE for returning script section type.  Pass it to
7714         section elements.  Handle discard sections.
7715         (Sort_output_sections::operator()): Handle NOLOAD sections.
7716         * script-sections.h (Script_sections::Section_type): New enum type.
7717         (Script_sections::output_section_name): Add a new parameter for
7718         returning script section type.
7719         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7720         INFO and NOLOAD.
7721         * yyscript.y (union): Add new field SECTION_TYPE.
7722         (COPY, DSECT, INFO, NOLOAD): New tokens.
7723         (opt_address_and_section_type): Change type to output_section_header.
7724         (section_type): New non-terminal
7725         (section_header): Handle section type.
7726         (opt_address_and_section_type): Return section type value.
7727
7728 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7729
7730         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7731         * testsuite/plugin_common_test_2.c (foo): Likewise.
7732
7733 2010-04-08  Doug Kwan  <dougkwan@google.com>
7734
7735         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7736         Output_merge_data.
7737         * output.cc (Output_section::add_merge_input_section): Simplify
7738         code and return status of Output_merge_base::add_input_section.
7739         Update merge section map only if Output_merge_base::add_input_section
7740         returns true.
7741
7742 2010-04-07  Doug Kwan  <dougkwan@google.com>
7743
7744         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7745         if section is marked as containing instructions but has no mapping
7746         symbols.
7747         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7748         correct section index.
7749         (Arm_relobj::find_linked_text_section): Ditto.
7750
7751 2010-04-07  Cary Coutant  <ccoutant@google.com>
7752
7753         * archive.cc (include_member): Destroy Read_symbols_data object before
7754         releasing file.
7755         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7756         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7757         (Read_symbols_data::~Read_symbols_data) New destructor.
7758         (Section_relocs::Section_relocs) New constructor.
7759         (Section_relocs::~Section_relocs) New destructor.
7760         (Read_relocs_data::Read_relocs_data) New constructor.
7761         (Read_relocs_data::~Read_relocs_data) New destructor.
7762         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7763         pointers to NULL after deleting.
7764
7765 2010-04-07  Doug Kwan  <dougkwan@google.com>
7766
7767         * arm.cc: Replace "endianity" with "endianness" in comments.
7768         (Arm_exidx_cantunwind): Ditto.
7769         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7770         (Arm_relobj::merge_flags_and_attributes): New method.
7771         (Arm_relobj::merge_flags_and_attributes_): New data member.
7772         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7773         (Arm_relobj::scan_sections_for_stubs): Ditto.
7774         (Arm_relobj::do_read_symbols): Check to see if we really want to
7775         merge processor-specific flags and attributes.  Exit early if
7776         an object is empty except for section names and the undefined symbol.
7777         (Target_arm::do_finalize_sections): Move check for ELF format to
7778         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7779         attributes from a regular object only when we have determined that
7780         it is aapropriate.  Do not create an .ARM.attributes section in
7781         output if there is no regular input object.
7782         (Target_arm::merge_processor_specific_flags): Check
7783         --warn-mismatch before printing any error.
7784         (Target_arm::merge_object_attributes): Ditto.
7785         * gold.cc (queue_middle_tasks): Handle the case in which there is
7786         no regular object in input.
7787         * options.cc (General_options::parse_EB): New method.
7788         (General_options::parse_EL): Same.
7789         (General_options::General_options): Initialize endianness_.
7790         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7791         New options.
7792         (General_options::Endianness): New enum.
7793         (General_options::endianness): New method.
7794         (General_options::endianness_): New data member.
7795         * parameters.cc (Parameters::set_options): Check target endianness.
7796         (Parameters::set_target_once): Ditto.
7797         (Parameters::check_target_endianness): New method.
7798         (parameters_force_valid_target): If either -EL or -EB is specified,
7799         use it to define endianness of default target.
7800         * parameters.h (Parameters::check_target_endianness): New method
7801         declaration.
7802         * target.h (class Target): Change "endianity" to "endianness"
7803         in comments.
7804
7805 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7806
7807         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7808         * configure: Regenerate.
7809         * Makefile.in: Regenerate.
7810         * testsuite/Makefile.in: Regenerate.
7811
7812 2010-04-06  Cary Coutant  <ccoutant@google.com>
7813
7814         gcc PR lto/42757
7815         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7816         prevailing definitions of common symbols.
7817         * testsuite/plugin_test_6.sh: New test case.
7818         * testsuite/plugin_common_test_1.c: New test case.
7819         * testsuite/plugin_common_test_2.c: New test case.
7820         * testsuite/Makefile.am (plugin_test_6): New test case.
7821         * testsuite/Makefile.in: Regenerate.
7822
7823 2010-04-06  Nick Clifton  <nickc@redhat.com>
7824
7825         * po/vi.po: New Vietnamese translation.
7826
7827 2010-03-30  Doug Kwan  <dougkwan@google.com>
7828
7829         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7830
7831 2010-03-25  Doug Kwan  <dougkwan@google.com>
7832
7833         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7834         to avoid a conversion warning on a 32-bit host.
7835
7836 2010-03-24  Ian Lance Taylor  <iant@google.com>
7837
7838         * testsuite/script_test_3.t: Add a TLS segment.
7839         * testsuite/Makefile.am (check_PROGRAMS): Add
7840         tls_phdrs_script_test.
7841         (tls_phdrs_script_test_SOURCES): Define.
7842         (tls_phdrs_script_test_DEPENDENCIES): Define.
7843         (tls_phdrs_script_test_LDFLAGS): Define.
7844         (tls_phdrs_script_test_LDADD): Define.
7845         * testsuite/Makefile.in: Rebuild.
7846
7847 2010-03-23  Cary Coutant  <ccoutant@google.com>
7848
7849         * fileread.cc (find_or_make_view): Fix comment.
7850
7851 2010-03-23  Ian Lance Taylor  <iant@google.com>
7852
7853         * script-sections.cc (class Orphan_section_placement): Define
7854         PLACE_TLS and PLACE_TLS_BSS.
7855         (Orphan_section_placement::Orphan_section_placement): Initialize
7856         new places.
7857         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7858         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7859         (tls_script_test_SOURCES): Define.
7860         (tls_script_test_DEPENDENCIES): Define.
7861         (tls_script_test_LDFLAGS): Define.
7862         (tls_script_test_LDADD): Define.
7863         * testsuite/Makefile.in: Rebuild.
7864
7865 2010-03-22  Doug Kwan  <dougkwan@google.com>
7866
7867         * arm.cc (Arm_relocate_functions::abs8,
7868         Arm_relocate_functions::abs16): Use correct check for overflow
7869         specified in the ARM ELF specs.
7870         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7871         target of a BLX instruction specially.
7872         (Reloc_stub::stub_type_for_reloc): Ditto.
7873         (Relocate::relocate): Use symbolic names instead of numeric relocation
7874         codes to report error.
7875         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7876         workaround.
7877         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7878         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7879         thumb2_blx_out_of_range.stdout
7880         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7881         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7882         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7883         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7884         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7885         thumb2_blx_in_range, thumb2_blx_in_range.o,
7886         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7887         thumb2_blx_out_of_range.o): New rules.
7888         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7889         thumb2_blx_in_range and thumb2_blx_out_of_range.
7890         * testsuite/Makefile.in: Regenerate.
7891         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7892         * testsuite/thumb_blx_in_range.s: New file.
7893         * testsuite/thumb_blx_out_of_range.s: New file.
7894
7895 2010-03-22  Rafael Espindola  <espindola@google.com>
7896
7897         * archive.cc (Should_include): Move to archive.h.
7898         (should_include_member): Make it a member of Archive.
7899         (Lib_group): New.
7900         (Add_lib_group_symbols): New.
7901         * archive.h: Include options.h.
7902         (Archive_member): Moved from Archive.
7903         (Should_include): Moved from archive.cc.
7904         (Lib_group): New.
7905         (Add_lib_group_symbols): New.
7906         * dynobj.cc (do_should_include_member): New.
7907         * dynobj.h (do_should_include_member): New.
7908         * gold.cc (queue_initial_tasks): Update call to queue.
7909         * main.cc (main): Print lib group stats.
7910         * object.cc (do_should_include_member): New.
7911         * object.h: Include archive.h.
7912         (Object::should_include_member): New.
7913         (Object::do_should_include_member): New.
7914         (Sized_relobj::do_should_include_member): New.
7915         * options.cc (General_options::parse_start_lib): New.
7916         (General_options::parse_end_lib): New.
7917         (Input_arguments::add_file): Handle lib groups.
7918         (Input_arguments::start_group): Check we are not in a lib.
7919         (Input_arguments::start_lib): New.
7920         (Input_arguments::end_lib): New.
7921         * options.h (General_options): Add start_lib and end_lib.
7922         (Input_argument::lib_): New.
7923         (Input_argument::lib): New.
7924         (Input_argument::is_lib): New.
7925         (Input_file_lib): New.
7926         (Input_arguments::in_lib_): New.
7927         (Input_arguments::in_lib): New.
7928         (Input_arguments::start_lib): New.
7929         (Input_arguments::end_lib_): New.
7930         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7931         in unused members as preempted.
7932         (Sized_pluginobj::do_should_include_member): New.
7933         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7934         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7935         return the blocker.
7936         (Read_symbols::do_whole_lib_group): New.
7937         (Read_symbols::do_lib_group): New.
7938         (Read_symbols::do_read_symbols): Handle lib groups.
7939         (Read_symbols::get_name): Handle lib groups.
7940         * readsyms.h (Read_symbols): Add an archive member pointer.
7941         (Read_symbols::do_whole_lib_group): New.
7942         (Read_symbols::do_lib_group): New.
7943         (Read_symbols::member_): New.
7944         * script.cc (read_input_script): Update call to queue_soon.
7945
7946 2010-03-19  Doug Kwan  <dougkwan@google.com>
7947
7948         * arm.cc (Stub_table::Stub_table): Initialize new data members
7949         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7950         (Stub_table::add_reloc_stub): Assign stub offset and update
7951         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7952         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7953         New data members.
7954         (Stub_table::update_data_size_and_addralign): Use
7955         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7956         instead of going over all reloc stubs.
7957         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7958         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7959         Stringpool_template::offset_ to size of Stringpool_char.
7960         (Stringpool_template::new_key_offset): Remove code to initialize
7961         Stringpool_template::offset_.
7962         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7963         Stringpool_template::offset_ to zero.
7964
7965 2010-03-15  Doug Kwan  <dougkwan@google.com>
7966
7967         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7968         offset_.
7969         (Stringpool_template::new_key_offset): New method.
7970         (Stringpool_template::add_string): Assign offsets when adding new
7971         strings.
7972         (Stringpool_template::set_string_offsets): Do not set string offsets
7973         when not optimizing.
7974         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7975         member size_.
7976         (Chunked_vector::clear): Clear size_.
7977         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7978         (Chunked_vector::size): Return size_.
7979         (Chunked_vector::push_back): Use size_ to find insert position.
7980         (Chunked_vector::size_): New data member.
7981         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7982         (Stringpool_template::new_key_offset): New method declaration.
7983         (Stringpool_template::offset_): New data member.
7984
7985 2010-03-15   Rafael Espindola  <espindola@google.com>
7986
7987         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7988         Add_symbols' constructor.
7989         * readsyms.h (Add_symbols): Remove the input_group member.
7990
7991 2010-03-10  Ian Lance Taylor  <iant@google.com>
7992
7993         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7994         target to ask whether a reference to a symbol requires a stack
7995         split.
7996         * target.h (Target::is_call_to_non_split): New function.
7997         (Target::do_is_call_to_non_split): Declare virtual function.
7998         * target.cc: Include "symtab.h".
7999         (Target::do_is_call_to_non_split): New function.
8000         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8001
8002 2010-03-10  Cary Coutant  <ccoutant@google.com>
8003
8004         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8005         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8006         (File_read::open[2]): Add whole_file_view_ to list of views.
8007         (File_read::make_view): Remove test of whole_file_view_.
8008         (File_read::find_or_make_view): Create whole_file_view_ if
8009         necessary.
8010         (File_read::clear_views): Replace bool parameter with enum;
8011         adjust all callers.  Don't delete views with permanent data;
8012         do delete cached views and views from archives if
8013         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8014         if clearing the corresponding view.
8015         * fileread.h (File_read::Clear_views_mode): New enum.
8016         (File_read::View::is_permanent_view): New method.
8017         (File_read::clear_views): Replace bool parameter
8018         with enum; adjust all callers.
8019         * options.h (General_options): Change keep_files_mapped option;
8020         add map_whole_files.
8021         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8022         releasing the file.
8023         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8024         the file.
8025
8026 2010-03-10  David S. Miller  <davem@davemloft.net>
8027
8028         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8029
8030 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8031
8032         * icf.cc (get_section_contents): Add '@' marker after processing the
8033         merge reloc.
8034
8035 2010-03-08  Doug Kwan  <dougkwan@google.com>
8036
8037         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8038         due to a conversion warning.
8039         (Arm_relobj::update_output_local_symbol_count): Check for local
8040         symbol with unset output index.
8041
8042 2010-03-05  Ian Lance Taylor  <iant@google.com>
8043
8044         * options.h (class General_options): Add --spare-dynamic-tags.
8045         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8046         --spare-dynamic-tags.
8047
8048 2010-03-05  Ian Lance Taylor  <iant@google.com>
8049
8050         * incremental.cc: Include "libiberty.h".
8051
8052 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8053
8054         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8055         function, is_info_ member.
8056         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8057         (Versions::Versions): Update caller.
8058         (Versions::define_base_version): Likewise.
8059         (Versions::add_def): Likewise.
8060
8061 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8062
8063         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8064         (Scan::possible_function_pointer_reloc): New function.
8065         (Scan::local_reloc_may_be_function_pointer): Change to call
8066         possible_function_pointer_reloc.
8067         (Scan::global_reloc_may_be_function_pointer): Ditto.
8068         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8069         relocations in ".data.rel.ro._ZTV" section.
8070         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8071         * testsuite/icf_safe_so_test.cc: Ditto.
8072         * testsuite/icf_safe_test.cc: Ditto.
8073         * testsuite/icf_safe_test.sh: Ditto.
8074
8075 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8076             Ian Lance Taylor  <iant@google.com>
8077
8078         * target-reloc.h (relocate_section): Check the symbol table index
8079         for -1U before setting the local symbol index.
8080         (scan_relocatable_relocs): If copying the relocation, record that
8081         the local symbol is required.
8082         * object.h (Symbol_value::is_output_symtab_index_set): New
8083         function.
8084         (Symbol_value::may_be_discarded_from_output_symtab): New
8085         function.
8086         (Symbol_value::has_output_symtab_entry): New function.
8087         (Symbol_value::needs_output_symtab_entry): Remove.
8088         (Symbol_value::output_symtab_index): Make sure the symbol index is
8089         set.
8090         (Symbol_value::set_output_symtab_index): Make sure the symbol
8091         index is not set.  Make sure the new index is valid.
8092         (Symbol_value::set_must_have_output_symtab_entry): New function.
8093         (Symbol_value::has_output_dynsym_entry): New function.
8094         (Symbol_value::set_output_dynsym_index): Make sure the new index
8095         is valid.
8096         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8097         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8098         local symbol if permitted.
8099         (Sized_relobj::do_finalize_local_symbols): Call
8100         is_output_symtab_index_set rather than needs_output_symtab_entry.
8101         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8102         rather than needs_output_symtab_entry.  Call
8103         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8104         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8105         is_output_symtab_index_set rather than needs_output_symtab_entry.
8106         * testsuite/discard_locals_relocatable_test.c: New file.
8107         * testsuite/discard_locals_test.sh: Test -r.
8108         * testsuite/Makefile.am (check_DATA): Add
8109         discard_locals_relocatable_test1.syms,
8110         discard_local_relocatable_test2.syms.
8111         (MOSTLYCLEANFILES): Likewise.  Also add
8112         discard_locals_relocatable_test1.lout and
8113         discard_locals_relocatable_test2.out.
8114         (discard_locals_relocatable_test1.syms): New target.
8115         (discard_locals_relocatable_test.o): New target.
8116         (discard_locals_relocatable_test1.out): New target.
8117         (discard_locals_relocatable_test2.syms): New target.
8118         (discard_locals_relocatable_test2.out): New target.
8119         (various): Add missing ../ld-new dependencies.
8120         * testsuite/Makefile.in: Rebuild.
8121
8122 2010-03-03  Nick Clifton  <nickc@redhat.com>
8123
8124         * po/fi.po: New Finnish translation.
8125
8126 2010-03-01  Doug Kwan  <dougkwan@google.com>
8127
8128         * layout.cc (Layout::Layout): Force section types of .init_array*,
8129         .preinit_array* and .fini_array* sections.
8130         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8131         Fix check of return value of std::string::find.().
8132         (Output_section::Input_section_sort_compare::operator()): Remove
8133         comment about .init_array.
8134         (Output_section::Input_section_sort_init_fini_compare::operator()):
8135         New method.
8136         (Output_section::sort_attached_input_sections): Handle .init_array
8137         and .fini_array specially.
8138         * output.h (Output_section::Inut_section_sort_compare): Update
8139         comment.
8140         (Output_section::Input_section_sort_init_fini_compare): New struct.
8141
8142 2010-02-26  Doug Kwan  <dougkwan@google.com>
8143
8144         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8145         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8146         * testsuite/debug_msg.sh: Avoid matching source line number for
8147         use of global variable undef_int.
8148
8149 2010-02-26  Doug Kwan  <dougkwan@google.com>
8150
8151         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8152         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8153         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8154         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8155         * options.cc (General_options::General_options): Initialize member
8156         fix_v4bx_.
8157         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8158         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8159         and rm_no_fix_v4bx.stdout
8160         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8161         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8162         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8163         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8164         and arm_no_fix_v4bx.
8165         * Makefile.in: Regenerate.
8166         * testsuite/arm_fix_v4bx.s: New file.
8167         * testsuite/arm_fix_v4bx.sh: Ditto.
8168
8169 2010-02-24  Doug Kwan  <dougkwan@google.com>
8170
8171         * arm.cc (Target_arm::got_section): Make the .got section the first
8172         non RELRO section in the data segment.
8173         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8174         suffixes of section names.
8175
8176 2010-02-24  Doug Kwan  <dougkwan@google.com>
8177
8178         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8179         flags and attributes merging if an input file is a binary file.
8180         * fileread.cc (Input_file::open): Record format of original file.
8181         * fileread.h (Input_file::Format): New enum type.
8182         (Input_file::Input_file): Initialize data member format_.
8183         (Input_file::format): New method definition.
8184         (Input_file::format_):: New data member.
8185
8186 2010-02-24  Doug Kwan  <dougkwan@google.com>
8187
8188         * arm.cc (Arm_output_data_got): New class.
8189         (ARM_TCB_SIZE): New constant
8190         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8191         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8192         If user uses a script with a SECTIONS clause, issue only a warning
8193         for a misplaced EXIDX input section.  Otherwise, issue an error.
8194         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8195         garbage collection.
8196         (Target_arm::got_mode_index_entry): Handle static linking.
8197         (Target_arm::Scan::local): Ditto.
8198         (Target_arm::Scan::global): Ditto.
8199         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8200         all incorrectly implemented relocations.
8201         (Target_arm::fix_exidx_coverage): Pass layout to
8202         Arm_output_section::fix_exidx_coverage.
8203         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8204         from ".ARM.exidx." and ".ARM.extab.".
8205
8206 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8207
8208         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8209         section if it does not already exist.
8210         * attributes.cc (Attributes_section_data::Attributes_section_data):
8211         Don't crash if size is zero.
8212
8213 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8214             Ian Lance Taylor  <iant@google.com>
8215
8216         * gold.cc (queue_middle_tasks): If no input files were opened,
8217         exit.
8218         * workqueue.h (Task_function::Task_function): Assert that there is
8219         a blocker.
8220
8221 2010-02-22  Doug Kwan  <dougkwan@google.com>
8222
8223         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8224         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8225         types to avoid warnings due to different uint64_t implementations
8226         on different hosts.
8227
8228 2010-02-21  Doug Kwan  <dougkwan@google.com>
8229
8230         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8231         handling of the maximum backward branch offset.
8232         (Arm_relocate_functions::thumb_branch_common): Ditto.
8233         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8234         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8235         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8236         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8237         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8238         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8239         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8240         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8241         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8242         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8243         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8244         thumb2_bl_out_of_range.o): New rules.
8245         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8246         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8247         thumb2_bl_out_of_range
8248         * testsuite/Makefile.in: Regenerate.
8249         * testsuite/arm_bl_in_range.s: New file.
8250         * testsuite/arm_bl_out_of_range.s: Ditto.
8251         * testsuite/arm_branch_in_range.sh: Ditto.
8252         * testsuite/arm_branch_range.t: Ditto.
8253         * testsuite/thumb2_branch_range.t: Ditto.
8254         * testsuite/thumb_bl_in_range.s: Ditto.
8255         * testsuite/thumb_bl_out_of_range.s: Ditto.
8256         * testsuite/thumb_branch_range.t: Ditto.
8257
8258 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8259
8260         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8261         Add reloc offset information.
8262         * icf.cc (get_section_contents): Change iterators to point to the new
8263         vectors. Add reloc offset information to the contents.
8264         * icf.h (Icf::Sections_reachable_info): New typedef.
8265         (Icf::Sections_reachable_list): New typedef.
8266         (Icf::Offset_info): New typedef.
8267         (Icf::Reloc_info): New struct typedef.
8268         (Icf::Reloc_info_list): New typedef.
8269         (Icf::symbol_reloc_list): Delete method.
8270         (Icf::addend_reloc_list): Delete method.
8271         (Icf::section_reloc_list): Delete method.
8272         (Icf::reloc_info_list): New method.
8273         (Icf::reloc_info_list_): New member.
8274
8275 2010-02-19  Doug Kwan  <dougkwan@google.com>
8276
8277         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8278         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8279         * arm.cc (Arm_relocation_functions): New forward declaration.
8280         (Target_arm::Target_arm): Initialize new data members
8281         got_mod_index_offset_ and tls_base_symbol_defined_.
8282         (Target_arm::Relocate::relocate_tls): New method.
8283         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8284          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8285         New methods.
8286         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8287         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8288         (Target_arm::got_mod_index_offset_,
8289         Target_arm::tls_base_symbol_defined_): New data members.
8290         (Target_arm::Scan::local, Target::Scan::global,
8291         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8292         relocations.
8293
8294 2010-02-18  Doug Kwan  <dougkwan@google.com>
8295
8296         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8297         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8298         text section as a parameter becuase some broken tools may not set
8299         the link in section header.
8300         (Target_arm::has_got_section): New method.
8301         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8302         without any mapping symbol as data only.  Remove warning.
8303         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8304         link in its section header, try to discover the link by inspecting the
8305         REL31 relocation at the beginning of the section.
8306         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8307         in error message.
8308         (Target_arm::Scan::global): Treat any reference to the symbol
8309         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8310
8311 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8312
8313         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8314         (Scan::global_reloc_may_be_function_pointer): New function.
8315         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8316         (Scan::global_reloc_may_be_function_pointer): New function.
8317         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8318         (Scan::global_reloc_may_be_function_pointer): New function.
8319         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8320         (Scan::global_reloc_may_be_function_pointer): New function.
8321         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8322         (Scan::global_reloc_may_be_function_pointer): New function.
8323         (Scan::possible_function_pointer_reloc): New function.
8324         (Target_x86_64::can_check_for_function_pointers): New function.
8325         * gc.h (gc_process_relocs): Scan relocation types to determine if
8326         function pointers were taken for targets that support it.
8327         * icf.cc (Icf::find_identical_sections): Include functions for
8328         folding in safe ICF whose pointer is not taken.
8329         * icf.h (Secn_fptr_taken_set): New typedef.
8330         (fptr_section_id_): New member.
8331         (section_has_function_pointers): New function.
8332         (set_section_has_function_pointers): New function.
8333         (check_section_for_function_pointers): New function.
8334         * options.h: Fix comment for safe ICF option.
8335         * target.h (can_check_for_function_pointers): New function.
8336         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8337         Modify icf_safe_test for X86-64.
8338         * testsuite/Makefile.in: Regenerate.
8339         * testsuite/icf_safe_so_test.cc: New file.
8340         * testsuite/icf_safe_so_test.sh: New file.
8341         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8342         (main): Change to take pointer to function kept_func_3.
8343         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8344         folding is done correctly for X86-64.
8345
8346 2010-02-12  David S. Miller  <davem@davemloft.net>
8347
8348         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8349         is_symbolless parameter.
8350         (Output_reloc<SHT_REL>::is_symbolless): New.
8351         (Output_reloc<SHT_REL>::is_symbolless_): New.
8352         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8353         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8354         (Output_reloc<SHT_RELA>::is_symbolless): New.
8355         (Output_data_reloc::add_global): Handle is_symbolless.
8356         (Output_data_reloc::add_global_relative): Likewise.
8357         (Output_data_reloc::add_local): Likewise.
8358         (Output_data_reloc::add_local_relative): Likewise.
8359         (Output_data_reloc::add_symbolless_global_addend): New.
8360         (Output_data_reloc::add_symbolless_local_addend): New.
8361         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8362         is_symbolless.
8363         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8364         instead of ->is_relative_
8365         (Output_reloc::write): Likewise.
8366         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8367         (Output_reloc::write_rel): Simplify.
8368
8369         * sparc.cc (Target_sparc::Scan::local): Use
8370         ->add_symbolless_local_addend as needed.
8371         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8372         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8373         based upon relocation offset.
8374
8375 2010-02-11  Doug Kwan  <dougkwan@google.com>
8376
8377         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8378         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8379         beginning of function.
8380         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8381         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8382         parameter is_32bit in calls to should_apply_static_reloc.
8383         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8384         (check_DATA): Add arm_abs_global.stdout.
8385         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8386         arm_abs_global.stdout): New rules.
8387         (MOSTLLYCLEANFILES): Add arm_abs_global
8388         * Makefile.in: Regenerate.
8389         * testsuite/arm_abs_global.s: New file.
8390         * testsuite/arm_abs_global.sh: Ditto.
8391         * testsuite/arm_abs_lib.s: Ditto.
8392
8393 2010-02-11  Ian Lance Taylor  <iant@google.com>
8394
8395         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8396         Read_relocs task.
8397         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8398         Allocate_commons_task first.
8399         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8400         task, rather than symtab_lock_.
8401         (Gc_process_relocs::~Gc_process_relocs): New function.
8402         (Gc_process_relocs::is_runnable): Check this_blocker_.
8403         (Gc_process_relocs::locks): Use next_blocker_ rather than
8404         blocker_.
8405         (Scan_relocs::~Scan_relocs): New function.
8406         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8407         symtab_lock_.
8408         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8409         next_blocker_.
8410         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8411         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8412         constructor accordingly.
8413         (class Gc_process_relocs): Likewise.
8414         (class Scan_relocs): Likewise.
8415         * common.h (class Allocate_commons_task): Remove symtab_lock_
8416         field, and corresponding constructor parameter.
8417         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8418         symtab_lock_.
8419         (Allocate_commons_task::locks): Likewise.
8420
8421 2010-02-11  Ian Lance Taylor  <iant@google.com>
8422
8423         * gold-threads.h (class Once): Define.
8424         (class Initialize_lock): Rewrite as child of Once.
8425         * gold-threads.cc (class Once_initialize): Define.
8426         (once_pointer_control): New static variable.
8427         (once_pointer, once_arg): New static variables.
8428         (c_run_once): New static function.
8429         (Once::Once, Once::run_once, Once::internal_run): New functions.
8430         (class Initialize_lock_once): Remove.
8431         (initialize_lock_control): Remove.
8432         (initialize_lock_pointer): Remove.
8433         (initialize_lock_once): Remove.
8434         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8435         (Initialize_lock::initialize): Rewrite.
8436         (Initialize_lock::do_run_once): New function.
8437         * archive.cc (Archive::interpret_header): Only clear name if it is
8438         not already empty.
8439         * fileread.cc: Include "gold-threads.h"
8440         (file_counts_lock): New static variable.
8441         (file_counts_initialize_lock): Likewise.
8442         (File_read::release): Only increment counts when using --stats.
8443         Use a lock around the increment.
8444         * parameters.cc (class Set_parameters_target_once): Define.
8445         (set_parameters_target_once): New static variable.
8446         (Parameters::Parameters): Move here from parameters.h.
8447         (Parameters::set_target): Rewrite.
8448         (Parameters::set_target_once): New function.
8449         (Parameters::clear_target): Move here and rewrite.
8450         * parameters.h (class Parameters): Update declarations.  Add
8451         set_parameters_target_once_ field.
8452         (Parameters::Parameters): Move to parameters.cc.
8453         (Parameters::clear_target): Likewise.
8454         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8455         task.
8456         (Start_group::~Start_group): New function.
8457         (Start_group::is_runnable): New function.
8458         (Start_group::locks, Start_group::run): New functions.
8459         (Finish_group::run): Change saw_undefined to size_t.
8460         * readsyms.h (class Start_group): Define.
8461         (class Finish_group): Change saw_undefined_ field to size_t.
8462         (Finish_group::Finish_group): Remove saw_undefined and
8463         this_blocker parameters.  Change all callers.
8464         (Finish_group::set_saw_undefined): New function.
8465         (Finish_group::set_blocker): New function.
8466         * symtab.h (class Symbol_table): Change saw_undefined to return
8467         size_t.  Change saw_undefined_ field to size_t.
8468         * target-select.cc (Set_target_once::do_run_once): New function.
8469         (Target_selector::Target_selector): Initialize set_target_once_
8470         field.  Don't initialize lock_ and initialize_lock_ fields.
8471         (Target_selector::instantiate_target): Rewrite.
8472         (Target_selector::set_target): New function.
8473         * target-select.h (class Set_target_once): Define.
8474         (class Target_selector): Update declarations.  Make
8475         Set_target_once a friend.  Remove lock_ and initialize_lock_
8476         fields.  Add set_target_once_ field.
8477
8478 2010-02-10  Ian Lance Taylor  <iant@google.com>
8479
8480         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8481         queueing any tasks.
8482         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8483         (queue_middle_tasks): Add all blockers before queueing any tasks.
8484         (queue_final_tasks): Likewise.
8485         * token.h (Task_token::add_blockers): New function.
8486         * object.h (Input_objects::number_of_relobjs): New function.
8487
8488 2010-02-10  Ian Lance Taylor  <iant@google.com>
8489
8490         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8491         shared, not if not position independent.
8492         * x86_64.cc (Relocate::relocate_tls): Likewise.
8493         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8494         (tls_pie_pic_test): New target.
8495         * testsuite/Makefile.in: Rebuild.
8496
8497         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8498         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8499         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8500         * testsuite/Makefile.in: Rebuild.
8501
8502 2010-02-09  David S. Miller  <davem@davemloft.net>
8503
8504         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8505         R_SPARC_RELATIVE using ->add_local_relative().
8506         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8507
8508         * output.h (Output_data_dynamic::add_section_size): New method
8509         that takes two Output_data objects.
8510         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8511         entry param.  Handle it in initializers.
8512         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8513         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8514         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8515         arg.
8516         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8517         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8518         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8519         for dynrel_includes_plt.
8520         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8521         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8522         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8523         before .rela.plt
8524         (Target_sparc::do_finalize_sections): Update to pass true for
8525         dynrel_includes_plt.
8526         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8527         output before .rela.plt
8528         (Target_powerpc::do_finalize_sections): Update to pass true for
8529         dynrel_includes_plt when 32-bit.
8530
8531 2010-02-08  Doug Kwan  <dougkwan@google.com>
8532
8533         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8534         method.
8535         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8536         Arm_relobj::scan_section_for_cortex_a8_stubs,
8537         Arm_relobj::do_relocation_section): Instead of calling
8538         Output_section::output_address, use faster
8539         Arm_relobj::simple_input_section_output_address.
8540
8541 2010-02-08  David S. Miller  <davem@davemloft.net>
8542
8543         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8544         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8545         relocation helper function.
8546
8547         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8548         just like R_SPARC_GOT{10,13,22}.
8549         (Target_sparc::Scan::local): Likewise.
8550         (Target_sparc::Relocate:relocate): Likewise.
8551
8552 2010-02-06  Ian Lance Taylor  <iant@google.com>
8553
8554         * configure.ac: Rewrite targetobjs duplicate removal code to use
8555         only shell constructs.
8556         * configure: Rebuild.
8557
8558 2010-02-05  Doug Kwan  <dougkwan@google.com>
8559
8560         PR 11247
8561         * arm.cc (Arm_relobj::section_is_scannable): New method.
8562         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8563         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8564
8565 2010-02-04  Doug Kwan  <dougkwan@google.com>
8566
8567         PR 11247
8568         * arm-reloc-property.cc (cstdio): Include.
8569         * configure.ac (targetobjs): Remove duplicates.
8570         * configure: Regenerate.
8571         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8572         big and little endian version for a given address size.
8573
8574 2010-02-03  Doug Kwan  <dougkwan@google.com>
8575
8576         * arm-reloc-property.cc
8577         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8578         definition.
8579         * arm-reloc-property.h
8580         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8581         New method definition.
8582         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8583         declaration.
8584         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8585         overflow to N.
8586         (GOT_PREL): Change implemented to Y.
8587         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8588         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8589         (Arm_relocate_functions::movw_abs_nc): Remove method.
8590         (Arm_relocate_functions::movt_abs): Ditto.
8591         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8592         (Arm_relocate_functions::thm_movt_abs): Ditto.
8593         (Arm_relocate_functions::movw_rel_nc): Ditto.
8594         (Arm_relocate_functions::movw_rel): Ditto.
8595         (Arm_relocate_functions::movt_rel): Ditto.
8596         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8597         (Arm_relocate_functions:thm_movw_rel): Ditto.
8598         (Arm_relocate_functions:thm_movt_rel): Ditto.
8599         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8600         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8601         New method definitions.
8602         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8603         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8604         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8605         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8606         (Target_arm::Relocate::relocate): Check for non-static or
8607         unimplemented relocation code and exit early.  Change calls to
8608         Target_arm::reloc_uses_thumb_bit and
8609         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8610         instead.  Refactor code to handle similar relocations to increase
8611         code sharing.  Remove check for unsupported relocation code in switch
8612         statement.
8613         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8614         relocation property table to find out size.  Change error message to
8615         print out the name of a relocation code instead of the numeric value.
8616         (Target_arm::scan_reloc_for_stub): Use relocation property table
8617         instead of calling Target_arm::reloc_uses_thumb_bit().
8618
8619 2010-02-02  Doug Kwan  <dougkwan@google.com>
8620
8621         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8622         types of relaxed input section.
8623
8624 2010-02-02  Doug Kwan  <dougkwan@google.com>
8625
8626         * Makefile.am (HFILES): Add arm-reloc-property.h.
8627         (DEFFILES): New.
8628         (TARGETSOURCES): Add arm-reloc-property.cc
8629         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8630         (libgold_a_SOURCES): $(DEFFILES)
8631         * Makefile.in: Regenerate.
8632         * arm-reloc-property.cc: New file.
8633         * arm-reloc-property.h: New file.
8634         * arm-reloc.def: New file.
8635         * arm.cc: Update comments.
8636         (arm-reloc-property.h): New included header.
8637         (arm_reloc_property_table): New global variable.
8638         (Target_arm::do_select_as_default_target): New method definition.
8639         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8640         arm-reloc-property to targ_extra_obj.
8641         * parameters.cc (set_parameters_target): Call
8642         Target::select_as_default_target().
8643         * target.h (Target::select_as_default_target): New method definition.
8644         (Target::do_select_as_default_target): Same.
8645
8646 2010-02-01  Doug Kwan  <dougkwan@google.com>
8647
8648         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8649         first_output_text_section_.
8650         (Arm_exidx_fixup::first_output_text_section): New method definition.
8651         (Arm_exidx_fixup::first_output_text_section_): New data member.
8652         (Arm_exidx_fixup::process_exidx_section): Record the first text
8653         output section seen.
8654         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8655         and entsize in output section header.
8656
8657 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8658
8659         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8660         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8661         (Arm_relocate_functions::thm_alu11): New Method.
8662         (Arm_relocate_functions::thm_pc8): New Method.
8663         (Arm_relocate_functions::thm_pc12): New Method.
8664         (Target_arm::Scan::local): Handle the relocations.
8665         (Target_arm::Scan::global): Likewise.
8666         (Target_arm::Relocate::relocate): Likewise.
8667         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8668
8669 2010-01-29  Doug Kwan  <dougkwan@google.com>
8670
8671         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8672         of relocation types as ld.
8673
8674 2010-01-29  Doug Kwan  <dougkwan@google.com>
8675
8676         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8677         to public.
8678         (Arm_relocate_functions::thumb_branch_common): Ditto.
8679         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8680         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8681         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8682         Arm_relocate_functions::jump24): Remove.
8683         (Target_arm::Relocate::relocate): Adjust code to call
8684         Arm_relocation_functions::arm_branch_common and
8685         Arm_relocation_functions::thumb_branch_common instead of their removed
8686         wrappers.  Merge switch-cases together to reduce source code size.
8687
8688 2010-01-29  Doug Kwan  <dougkwan@google.com>
8689
8690         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8691         output_local_symbol_count_needs_update_.
8692         (Arm_relobj::output_local_symbol_count_needs_update,
8693          Arm_relobj::set_output_local_symbol_count_needs_update,
8694          Arm_relobj::update_output_local_symbol_count): New methods.
8695         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8696         member.
8697         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8698         of pointed function as in a R_ARM_PREL31 relocation.
8699         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8700         for output local symbol count updating.
8701         (Target_arm::do_relax): Update output local symbol counts in objects
8702         if necessary.
8703         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8704
8705 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8706
8707         * arm.cc: Added support for the ARM relocations:
8708         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8709         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8710         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8711         movw_prel_nc).
8712         (Arm_relocate_functions::movw_rel): New method.
8713         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8714         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8715         thm_movw_prel_nc).
8716         (Arm_relocate_functions::thm_movw_rel): New method.
8717         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8718         thm_movt_prel).
8719         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8720         relocations.
8721         (Target_arm::Scan::global): Likewise.
8722         (Target_arm::Relocate::relocate): Likewise.
8723         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8724         Likewise.
8725
8726 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8727
8728         * arm.cc: Added support for ARM group relocations.
8729         (Target_arm::reloc_needs_sym_origin): New method.
8730         (Arm_relocate_functions::calc_grp_kn): New method.
8731         (Arm_relocate_functions::calc_grp_residual): New method.
8732         (Arm_relocate_functions::calc_grp_gn): New method.
8733         (Arm_relocate_functions::arm_grp_alu): New Method.
8734         (Arm_relocate_functions::arm_grp_ldr): New Method.
8735         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8736         (Arm_relocate_functions::arm_grp_ldc): New Method.
8737         (Target_arm::Scan::local): Handle the ARM group relocations.
8738         (Target_arm::Scan::global): Likewise.
8739         (Target_arm::Relocate::relocate): Likewise.
8740         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8741         Likewise.
8742
8743 2010-01-26  Doug Kwan  <dougkwan@google.com>
8744
8745         * arm.cc (set): Include.
8746         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8747         pointer type.
8748         (Arm_output_section::Text_section_list): New type.
8749         (Arm_output_section::append_text_sections_to_list): New method.
8750         (Arm_output_section::fix_exidx_coverage): Ditto.
8751         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8752         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8753         Relobj::set_section_offset() instead of
8754         Sized_relobj::invalidate_section_offset().
8755         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8756         parameter for section headers. Ignore relocation sections for
8757         unallocated sections and EXIDX sections.
8758         (Target_arm::fix_exidx_coverage): New method.
8759         (Target_arm::output_section_address_less_than): New type.
8760         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8761         linked text section instead of the EXIDX section.
8762         (Arm_output_section::create_stub_group): Add an assertion to check
8763         that this is not an EXIDX output section.
8764         (Arm_output_section::append_text_sections_to_list): New method.
8765         (Arm_output_section::fix_exidx_coverage): Ditto.
8766         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8767         Arm_relobj::section_needs_reloc_stub_scanning.
8768         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8769         first pass.
8770         (Target_arm::fix_exidx_coverage): New method.
8771         * object.h (Relobj::set_output_section): New method.
8772         (Sized_relobj::invalidate_section_offset): Remove method.
8773         (Sized_relobj::do_invalidate_section_offset): Remove method.
8774         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8775
8776 2010-01-25  Doug Kwan  <dougkwan@google.com>
8777
8778         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8779         Fix warning due to signed and unsigned comparison on a 32-bit host.
8780
8781 2010-01-22  Doug Kwan  <dougkwan@google.com>
8782
8783         * arm.cc (Target_arm::do_relax): Record an output section for section
8784         offset adjustment it contains any stub table that has changed.
8785         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8786         offsets in an output section if necessary.
8787         * output.cc (Output_section::Output_section): Initialize
8788         section_offsets_need_adjustments_.
8789         (Output_section::add_input_section_for_script): Renamed to
8790         Output_section::add_simple_input_section.
8791         (Output_section::save_states): Add a comment.
8792         (Output_section::discard_states): New method defintion.
8793         (Output_section::adjust_section_offsets): Same.
8794         * output.h (Output_section::add_input_section_for_script): Renamed to
8795         Output_section::add_simple_input_section.
8796         (Output_section::discard_states): New method declaration.
8797         (Output_section::adjust_section_offsets): Same.
8798         (Output_section::section_offsets_need_adjustment,
8799         Output_section::set_section_offsets_need_adjustment): New method
8800         definitions.
8801         (Output_section::section_offsets_need_adjustment_): New data member.
8802         * script-sections.cc
8803         (Output_section_element_input::set_section_address): Adjust code for
8804         renaming of Output_section::add_input_section_for_script.
8805         (Orphan_output_section::set_section_address): Same.
8806
8807 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8808
8809         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8810         Fix_v4bx enum values .
8811         * gold/options.h (General_options): New option definitions.
8812         (General_options::fix_v4bx): New method.
8813         (General_options::Fix_v4bx): New enum.
8814         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8815         (General_options::parse_fix_v4bx_interworking): New method.
8816
8817 2010-01-22  Doug Kwan  <dougkwan@google.com>
8818
8819         * arm.cc (Arm_exidx_fixup): New class.
8820
8821 2010-01-21  Doug Kwan  <dougkwan@google.com>
8822
8823         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8824         classes.
8825         (Arm_exidx_section_offset_map): New type.
8826
8827 2010-01-21  Doug Kwan  <dougkwan@google.com>
8828
8829         * arm.cc (Arm_exidx_input_section): New class.
8830         (Arm_relobj::exidx_input_section_by_link,
8831         Arm_relobj::exidx_input_section_by_shndx,
8832         Arm_relobj::make_exidx_input_section): New methods.
8833         (read_arm_attributes_section): Remove.
8834         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8835         information about them.
8836         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8837         to here.
8838
8839 2010-01-20  Doug Kwan  <dougkwan@google.com>
8840
8841         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8842         Input_section_specifier to Section_id.
8843         (Target_arm::new_arm_input_section: Adjust code for change of key
8844         type.
8845         (Target_arm::find_arm_input_section): Ditto.
8846         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8847         (Section_id): Remove.
8848         (Garbage_collection::Section_id_hash): Remove.
8849         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8850         (Section_id): Remove.
8851         (Icf::Section_id_hash): Remove.
8852         * object.h (Section_id, Const_section_id, Section_id_hash,
8853         Const_section_id_hash): New type definitions.
8854         * output.cc (Output_section::add_relaxed_input_section): Change to
8855         use Const_section_id instead of Input_section_specifier as key type.
8856         (Output_section::add_merge_input_section): Ditto.
8857         (Output_section::build_relaxation_map): Change to use Section_id
8858         instead of Input_section_specifier as key type.
8859         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8860         Ditto.
8861         (Output_section::convert_input_sections_to_relaxed_sections): Change
8862         to use Const_section_id instead of Input_section_specifier as key type.
8863         (Output_section::find_merge_section): Ditto.
8864         (Output_section::find_relaxed_input_section): Ditto.
8865         * output.h (Input_section_specifier): Remove class.
8866         (Output_section::Output_section_data_by_input_section_map): Change
8867         key type to Const_section_id.
8868         (Output_section::Output_relaxed_input_section_by_input_section_map):
8869         Ditto.
8870         (Output_section::Relaxation_map): Change key type to Section_id.
8871
8872 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8873
8874         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8875         (class Arm_v4bx_stub): New class.
8876         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8877         (Stub_factory::make_arm_v4bx_stub): New method.
8878         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8879         (Stub_table::empty): Handle v4bx stubs.
8880         (Stub_table::add_arm_v4bx_stub): New method.
8881         (Stub_table::find_arm_v4bx_stub): New method.
8882         (Arm_relocate_functions::v4bx): New method.
8883         (Target_arm::fix_v4bx): New method.
8884         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8885         (Stub_table::relocate_stubs): Likewise.
8886         (Stub_table::do_write): Likewise.
8887         (Stub_table::update_data_size_and_addralign): Likewise.
8888         (Stub_table::finalize_stubs):  Likewise.
8889         (Target_arm::Scan::local): Likewise.
8890         (Target_arm::Scan::global): Likewise.
8891         (Target_arm::do_finalize_sections): Likewise.
8892         (Target_arm::Relocate::relocate): Likewise.
8893         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8894         Likewise.
8895         (Target_arm::scan_reloc_for_stub): Likewise.
8896         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8897
8898 2010-01-19  Ian Lance Taylor  <iant@google.com>
8899
8900         * output.cc (Output_section_headers::do_sized_write): Write large
8901         segment count to sh_info field.
8902         (Output_file_header::do_sized_write): For large segment count,
8903         write PN_XNUM to e_phnum field.
8904
8905 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8906
8907         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8908         (Arm_relocate_functions::thm_jump8): New function.
8909         (Arm_relocate_functions::thm_jump11): New function.
8910         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8911         R_ARM_THM_JUMP11.
8912         (Target_arm::Scan::global): Likewise.
8913         (Target_arm::Relocate::relocate): Likewise.
8914         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8915         Likewise.
8916
8917 2010-01-14  Doug Kwan  <dougkwan@google.com>
8918
8919         * arm.cc (map, utility): Include headers.
8920         (Target_arm::apply_cortex_a8_workaround): New method.
8921         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8922         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8923         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8924         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8925         the --[no-]fix-cortex-a8 command line options.
8926         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8927         (Target_arm::relocate_stub): Use addend in instruction template.
8928         * options.h (DEFINE_bool): Set the user-set flag.
8929         (General_options): Add --[no-]-fix-cortex options.
8930         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8931         : Update fast look-up map after conversion.
8932
8933 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8934
8935         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8936         in the first pass of do_layout.
8937
8938 2010-01-13  Doug Kwan  <dougkwan@google.com>
8939
8940         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8941         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8942         apparent compiler problem of not folding static constant integral
8943         data members of elfcpp::Elf_sizes<32>.
8944
8945 2010-01-13  Doug Kwan  <dougkwan@google.com>
8946
8947         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8948         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8949         Arm_relobj::scan_section_for_cortex_a8_erratum,
8950         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8951         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8952         sections to scan for relocation stubs into a new method
8953         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8954         relocation and Cortex-A8 stub scanning.
8955         (Target_arm::do_relax): Force stubs to be after stubbed sections
8956         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8957         the beginning of a new relaxation pass.  Update a comment.
8958         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8959
8960 2010-01-12  Ian Lance Taylor  <iant@google.com>
8961
8962         * target-reloc.h (visibility_error): New inline function.
8963         (relocate_section): Call visibility_error.
8964         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8965         (MOSTLYCLEANFILES): Likewise.
8966         (protected_4_pic.o, protected_3.err): New targets.
8967         * testsuite/protected_4.cc: New file.
8968
8969 2010-01-12  Doug Kwan  <dougkwan@google.com>
8970
8971         * arm.cc (Cortex_a8_reloc): New class.
8972         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8973         and cortex_a8_relocs_info_.
8974         (Target_arm::fix_cortex_a8): New method definition.
8975         (Target_arm::Cortex_a8_relocs_info): New type.
8976         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8977         New data member declarations.
8978         (Target_arm::scan_reloc_for_stub): Record information about
8979         relocations for THUMB branches that might be exempted from the
8980         Cortex-A8 workaround.
8981         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8982         at the beginning of a relaxation pass.
8983
8984 2010-01-12  Doug Kwan  <dougkwan@google.com>
8985
8986         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8987         (Arm_relobj::Mapping_symbol_position,
8988          Arm_reloj::Mapping_symbol_position_less,
8989          Arm_relobj::Mapping_symbols_info): New types.
8990         (Target_arm::is_mapping_symbol_name): New method definition.
8991         (Arm_relobj::do_count_local_symbols): Save information about mapping
8992         symbols.
8993
8994 2010-01-11  Doug Kwan  <dougkwan@google.com>
8995
8996         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8997         Arm_relocate_functions::thumb32_branch_upper,
8998         Arm_relocate_functions::thumb32_branch_lower,
8999         Arm_relocate_functions::thumb32_cond_branch_offset,
9000         Arm_relocate_functions::thumb32_cond_branch_upper,
9001         Arm_relocate_functions::thumb32_cond_branch_lower,
9002         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9003         branch offset encoding.
9004         (Arm_relocate_functions::thumb_branch_common): Use new branch
9005         offset encoding methods to avoid code duplication.
9006         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9007         (Stub_addend_reader::operator()): Use new branch encoding method
9008         to avoid code duplication.
9009
9010 2010-01-11  Doug Kwan  <dougkwan@google.com>
9011
9012         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9013         (Target_arm::do_finalize_sections): Define special EXIDX section
9014         symbols only if referenced.
9015         * gc.h (Garbage_collection::add_reference): New method.
9016         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9017         code duplication.
9018
9019 2010-01-11  Ian Lance Taylor  <iant@google.com>
9020
9021         * script.cc (Version_script_info::build_expression_list_lookup):
9022         Change complaing about duplicate wildcard match from error to
9023         warning.
9024
9025         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9026         of 2009-12-30.
9027         (Version_script_info::Version_script_info): Initialize globs_,
9028         default_version_, default_is_global_, and exact_.  Don't
9029         initialize globals_ or locals_.
9030         (Version_script_info::build_lookup_tables): Build local symbols
9031         first.
9032         (Version_script_info::unquote): New function.
9033         (Version_script_info::add_exact_match): New function.
9034         (Version_script_info::build_expression_list_lookup): Remove lookup
9035         parameter.  Add is_global parameter.  Change all callers.  Handle
9036         wildcard pattern specially.  Unquote pattern.  Call
9037         add_exact_match.
9038         (Version_script_info::get_name_to_match): New function.
9039         (Version_script_info::get_symbol_version): New function.
9040         (Version_script_info::get_symbol_version_helper): Remove.
9041         (Version_script_info::check_unmatched_names): Call unquote.
9042         * script.h (class Version_script_info): Change get_symbol_version
9043         to be non-inline and add is_global parameter; change all callers.
9044         Rewrite symbol_is_local.  Update declarations.  Define struct
9045         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9046         Remove globals_ and locals_ members.  Add exact_, globs_,
9047         default_version_, is_global_.
9048         (Version_script_info::Glob): Remove pattern, add expression and
9049         is_global.  Update constructor.  Change all callers.
9050         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9051         default version.
9052         (Versions::symbol_section_contents): If a symbol is undefined, or
9053         defined in a dynamic object, set the version index to
9054         VER_NDX_LOCAL.
9055         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9056         symbol_is_local.
9057         (Symbol_table::add_from_pluginobj): Likewise.
9058         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9059
9060 2010-01-11  Doug Kwan  <dougkwan@google.com>
9061
9062         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9063         (incremental_dump_LDADD): Add linking option for libintl.
9064         * Makefile.in: Regenerate.
9065
9066 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9067
9068         PR gold/11144
9069         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9070         instead of -Ds.
9071         * testsuite/Makefile.in: Regenerated.
9072
9073 2010-01-10  Doug Kwan  <dougkwan@google.com>
9074
9075         * options.h (DEFINE_var): Use parentheses around argument varname__
9076         in macro body to avoid any unintended subsequent substitutions.
9077
9078 2010-01-10  Ian Lance Taylor  <iant@google.com>
9079
9080         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9081         candidates before doing symbol resolution.
9082
9083         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9084         ODR candidates if only one is weak.
9085
9086 2010-01-08  Ian Lance Taylor  <iant@google.com>
9087
9088         * script.cc (Version_script_info::build_expression_list_lookup):
9089         Don't warn about ambiguous version, just record the ambiguity.
9090         (Version_script_info::get_symbol_version_helper): Give error if
9091         version is ambiguous.
9092
9093 2010-01-08  Doug Kwan  <dougkwan@google.com>
9094
9095         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9096         prev_data_size_ and prev_addralign_.  Remove initializer for
9097         deleted data member has_been_changed_.
9098         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9099         to determine if the table is empty.
9100         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9101         Remove.
9102         (Stub_table::add_reloc_stub): Define method in class definition
9103         instead of just declaring it there.
9104         (Stub_table::add_cortex_a8_stub): New method definition.
9105         (Stub_table::update_data_size_and_addralign): Ditto.
9106         (Stub_table::finalize_stubs): Ditto.
9107         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9108         (Stub_table::do_addralign_): Return address alignment in the
9109         (Stub_table::do_reset_address_and_file_offset): Define method in
9110         class definition instead of declaring it there.  Set current data
9111         size to be the data size of the previous pass.
9112         (Stub_table::set_final_data_size): Use current data size as the
9113         final data size.
9114         (Stub_table::relocate_stub): Change parameter type of stub from
9115         Reloc_stub pointer to Stub pointer.
9116         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9117         (Stub_table::Cortex_a8_stub_list): New typedef.
9118         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9119          Stub_table::prev_addralign_): New data member.
9120         (Arm_relobj::Arm_relobj): Initialize data member
9121         section_has_cortex_a8_workaround_.
9122         (Arm_relobj::section_has_cortex_a8_workaround,
9123          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9124          definitions.
9125         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9126         declarations.
9127         (Target_arm::relocate_stub): Change parameter type of stub from
9128         Reloc_stub pointer to Stub pointer.
9129         (Insn_template::size, Insn_template::alignment): Handle
9130         THUMB16_SPECIAL_TYPE.
9131         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9132          Stub_table::update_data_size_and_addralign,
9133          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9134         definitions.
9135         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9136         (Stub_table::do_write): Ditto.
9137         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9138
9139 2010-01-08  Ian Lance Taylor  <iant@google.com>
9140
9141         PR 11108
9142         * symtab.h (class Symbol): Remove fields is_target_special_ and
9143         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9144         (Symbol::is_defined_in_discarded_section): New function.
9145         (Symbol::set_is_defined_in_discarded_section): New function.
9146         (Symbol::has_plt_offset): Rewrite.
9147         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9148         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9149         Don't initialize is_target_special_ or has_plt_offset_.
9150         Initialize is_defined_in_discarded_section_.
9151         (Symbol_table::add_from_relobj): If appropriate, set
9152         is_defined_in_discarded_section.
9153         * resolve.cc (Symbol::override_base_with_special): Don't test
9154         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9155         * target-reloc.h (relocate_section): Do special handling for
9156         symbols defined in discarded sections for global symbols as well
9157         as local symbols.
9158
9159 2010-01-08  Ian Lance Taylor  <iant@google.com>
9160
9161         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9162         the SHT_SYMTAB case.
9163
9164 2010-01-08  Ian Lance Taylor  <iant@google.com>
9165
9166         * object.cc (Sized_relobj::do_layout): Don't get confused if
9167         layout_eh_frame returns NULL.
9168
9169 2010-01-08  Ian Lance Taylor  <iant@google.com>
9170
9171         PR 11084
9172         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9173         dynamic symbol table, use the normal symbol table.
9174         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9175         symbol table.
9176
9177 2010-01-08  Ian Lance Taylor  <iant@google.com>
9178
9179         PR 11072
9180         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9181         sections.
9182
9183 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9184
9185         * version.cc (print_version): Change to "Copyright 2010".
9186
9187 2010-01-08  Ian Lance Taylor  <iant@google.com>
9188
9189         PR 10287
9190         PR 11063
9191         * i386.cc (class Target_i386): Change return type of plt_section
9192         to be non-const.
9193         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9194         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9195         tls_desc_rel_ field.
9196         (Output_data_plt_i386::rel_tls_desc): New function.
9197         (Target_i386::rel_tls_desc_section): New function.
9198         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9199         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9200         R_386_TLS_DESC reloc in rel_tls_desc_section.
9201         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9202         Define struct Tlsdesc_info.
9203         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9204         (Target_x86_64::do_reloc_symbol_index): New function.
9205         (Target_x86_64::add_tlsdesc_info): New function.
9206         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9207         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9208         tlsdesc_rel_ field.
9209         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9210         all callers.
9211         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9212         (Target_x86_64::rela_tlsdesc_section): New function.
9213         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9214         handling.
9215         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9216         (Target_x86_64::do_reloc_addend): New function.
9217         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9218         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9219         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9220         (Output_reloc::type): New function.
9221         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9222         (Output_reloc::is_target_specific): New function.
9223         (Output_reloc::target_arg): New function.
9224         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9225         absolute relocs and target specific relocs.
9226         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9227         add_target_specific.
9228         (class Output_data_reloc) [SHT_RELA]: Likewise.
9229         * output.cc (Output_reloc::Output_reloc): Add four new versions
9230         for absolute relocs and target specific relocs.
9231         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9232         (Output_reloc::get_symbol_index): Likewise.
9233         (Output_reloc::local_section_offset): Check that local_sym_index_
9234         is not TARGET_CODE or 0.
9235         (Output_reloc::symbol_value): Likewise.
9236         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9237         reloc.
9238         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9239         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9240         functions.
9241         * layout.cc (add_target_dynamic_tags): Use output section for
9242         DT_PLTRELSZ and DT_JMPREL.
9243
9244 2010-01-07  Ian Lance Taylor  <iant@google.com>
9245
9246         PR 11061
9247         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9248         function.
9249         (class Output_data_reloc_generic): Define.
9250         (class Output_data_reloc_base): Change base class to
9251         Output_data_reloc_generic.  Change add() method to call
9252         bump_relative_reloc_count for a relative reloc.  Remove
9253         sort_relocs_ field.
9254         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9255         to sort_relocs().
9256         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9257         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9258         appropriate.
9259         * layout.h (class Layout): Update declaration.
9260
9261 2010-01-07  Ian Lance Taylor  <iant@google.com>
9262
9263         * output.h (class Output_data): Add const version of
9264         output_section and do_output_section.
9265         (class Output_section_data): Add const version of
9266         do_output_section.
9267         (class Output_section): Likewise.
9268         * layout.cc (Layout::add_target_dynamic_tags): New function.
9269         * layout.h (class Layout): Update declarations.
9270         * arm.cc (Target_arm::do_finalize_sections): Use
9271         add_target_dynamic_tags.
9272         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9273         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9274         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9275         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9276
9277 2010-01-07  Ian Lance Taylor  <iant@google.com>
9278
9279         PR 11042
9280         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9281         object as needed.
9282
9283 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9284             Ian Lance Taylor  <iant@google.com>
9285
9286         PR 11019
9287         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9288         Xindex::read_symtab_xindex.
9289
9290 2010-01-07  Doug Kwan  <dougkwan@google.com>
9291
9292         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9293         (Insn_template::thumb16_bcond_insn): New method declaration.
9294         (Insn_template): Fix spelling.
9295         (Stub::thumb16_special): New method declaration.
9296         (Stub::do_write): Define virtual method which was previously pure
9297         virtual.
9298         (Stub::do_thumb16_special): New method declaration.
9299         (Stub::do_fixed_endian_write): New template member.
9300         (Reloc_stub::do_write): Remove.
9301         (Reloc_stub::do_fixed_endian_write): Remove.
9302         (Cortex_a8_stub): New class definition.
9303         (Stub_factory::make_cortex_a8_stub): New method definition.
9304         (Stub_factory::Stub_factory): Add missing static storage class
9305         qualifier for elf32_arm_stub_a8_veneer_blx.
9306
9307 2010-01-07  Ian Lance Taylor  <iant@google.com>
9308
9309         PR 10980
9310         * options.h (class General_options): Add --warn-unresolved-symbols
9311         and --error-unresolved-symbols.
9312         * errors.cc (Errors::undefined_symbol): Implement
9313         --warn-unresolved-symbols.
9314
9315         * options.h (class General_options): Add -z text and -z textoff.
9316         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9317
9318 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9319
9320         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9321         (Garbage_collection::cident_sections): New function.
9322         (Garbage_collection::add_cident_section): New function.
9323         (Garbage_collection::cident_sections_): New member.
9324         (gc_process_relocs): Add references to sections whose names are C
9325         identifiers.
9326         * gold.h (cident_section_start_prefix): New constant.
9327         (cident_section_stop_prefix): New constant.
9328         (is_cident): New function.
9329         * layout.cc (Layout::define_section_symbols): Replace string constants
9330         with the newly defined constants.
9331         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9332         C identifiers.
9333         * testsuite/Makefile.am: Add gc_orphan_section_test.
9334         * testsuite/Makefile.in: Regenerate.
9335         * testsuite/gc_orphan_section_test.cc: New file.
9336         * testsuite/gc_orphan_section_test.sh: New file.
9337
9338 2010-01-06  Ian Lance Taylor  <iant@google.com>
9339
9340         PR 10980
9341         * options.h (class General_options): Add --warn-shared-textrel.
9342         * layout.cc (Layout::finish_dynamic_section): Implement
9343         --warn-shared-textrel.
9344
9345         PR 10980
9346         * options.h (class General_options): Add --warn-multiple-gp.
9347
9348 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9349
9350         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9351         $(THREADSLIB) and $(LIBDL).
9352         * Makefile.in: Rebuild.
9353
9354 2010-01-06  Ian Lance Taylor  <iant@google.com>
9355
9356         PR 10980
9357         * options.cc (General_options::parse_section_start): New function.
9358         (General_options::section_start): New function.
9359         (General_options::General_options): Initialize all members.
9360         * options.h: Include <map>
9361         (class General_options): Add --section-start.  Add section_starts_
9362         member.
9363         * layout.cc (Layout::attach_allocated_section_to_segment): If
9364         --section-start was used, set the address of the segment.  Remove
9365         local sort_sections.
9366         (Layout::relaxation_loop_body): If the address of the load segment
9367         has been set by --section-start, don't use it.
9368         * output.h (Output_segment::update_flags_for_output_section): New
9369         function.
9370         * output.cc (Output_segment::add_output_section): Call
9371         update_flags_for_output_section.
9372
9373 2010-01-05  Ian Lance Taylor  <iant@google.com>
9374
9375         PR 10980
9376         * options.h (class General_options): Add --undefined-version.
9377         * script.cc (struct Version_expression): Add was_matched_by_symbol
9378         field.
9379         (Version_script_info::matched_symbol): New function.
9380         (Version_script_info::get_symbol_version_helper): Call
9381         matched_symbol.
9382         (Version_script_info::check_unmatched_names): New function.
9383         * script.h (class Version_script_info): Update declarations.
9384         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9385
9386         * options.h (class General_options): Use DEFINE_bool_alias for
9387         allow_multiple_definition.
9388         * resolve.cc (Symbol_table::should_override): Don't test
9389         allow_multiple_definition.
9390
9391         PR 10980
9392         * options.h (class General_options): Add --cref.
9393         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9394         until after printing cref table.
9395         * cref.cc: Include "symtab.h".
9396         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9397         (Cref_table_compare::operator()): New function.
9398         (Cref_inputs::gather_cref): New function.
9399         (filecol): New static const.
9400         (Cref_inputs::print_cref): New function.
9401         (Cref::print_cref): New function.
9402         * cref.h: Include <cstdio>.
9403         (class Cref): Update declarations.
9404         * mapfile.h (Mapfile::file): New function.
9405         * object.h (class Object): Define Symbols.  Declare virtual
9406         do_get_global_symbols.
9407         (Object::get_global_symbols): New function.
9408         * object.cc (Input_objects::add_object): Pass object to cref_ if
9409         --cref.
9410         (Input_objects::archive_start): Likewise.
9411         (Input_objects::archive_stop): Likewise.
9412         (Input_objects::print_cref): New function.
9413         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9414         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9415         --cref.
9416         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9417         function.
9418         * plugin.h (class Sized_pluginobj): Update declarations.
9419
9420 2010-01-05  Ian Lance Taylor  <iant@google.com>
9421
9422         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9423         to is_default_version.  Rename insdef to insdefault.
9424         (Symbol_table::add_from_relobj): Rename def to is_default_version
9425         and local to is_forced_local.
9426         (Symbol_table::add_from_pluginobj): Likewise.
9427         (Symbol_table::add_from_dynobj): Likewise.
9428         (Symbol_table::define_special_symbol): Rename insdef to
9429         insdefault.
9430
9431 2010-01-04  Ian Lance Taylor  <iant@google.com>
9432
9433         PR 10980
9434         * options.h (class General_options): Add
9435         --allow-multiple-definition and -z muldefs.
9436         * resolve.cc (Symbol_table::should_override): Don't warn about a
9437         multiple symbol definition if --allow-multiple-definition or -z
9438         muldefs.
9439
9440         PR 10980
9441         * options.h (class General_options): Add --add-needed and
9442         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9443         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9444         error if --copy-dt-needed-entries aka --add-needed is used and
9445         would cause a change in behaviour.
9446
9447         PR 10980
9448         * options.h (class General_options): Add -G as a short version of
9449         --shared.  Add no-op options -assert, -g, and -i.
9450
9451 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9452
9453         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9454         check for .text or .gnu.linkonce.t sections.
9455         * icf.cc (Icf::find_identical_sections): Ditto.
9456         Change the detection for mangled function name within the section
9457         name.
9458         * icf.h (is_section_foldable_candidate): New function.
9459
9460 2009-12-30  Ian Lance Taylor  <iant@google.com>
9461
9462         PR 10980
9463         * options.h (class General_options): Permit two dashes with
9464         --retain-symbols-file.
9465
9466 2009-12-30  Ian Lance Taylor  <iant@google.com>
9467
9468         PR 10979
9469         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9470         don't put the file header and segment headers in the text
9471         segment.
9472
9473         PR 10979
9474         * common.cc (Sort_commons::operator()): Stabilize sort when both
9475         entries are NULL.
9476         (Symbol_table::do_allocate_commons_list): When allocating common
9477         symbols, skip a symbol which is no longer common.
9478         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9479         an object before checking its type.
9480         * testsuite/common_test_2.c: New file.
9481         * testsuite/common_test_3.c: New file.
9482         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9483         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9484         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9485         (common_test_2_pic.o, common_test_2.so): New targets.
9486         (common_test_3_pic.o, common_test_3.so): New targets.
9487         * testsuite/Makefile.in: Rebuild.
9488
9489         PR 10979
9490         * script.cc (read_input_script): If we see a new SECTIONS clause,
9491         and we have added an input section, give an error.
9492         * layout.h (class Layout): Add have_added_input_section function.
9493         Add have_added_input_section_ field.
9494         * layout.cc (Layout::Layout): Initialize
9495         have_added_input_section_.
9496         (Layout::layout): Set have_added_input_section_.
9497         (Layout::layout_eh_frame): Likewise.
9498
9499 2009-12-30  Ian Lance Taylor  <iant@google.com>
9500
9501         PR 10931
9502         * options.h (class General_options): Add --sort-common option.
9503         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9504         * common.cc (Sort_common): Add sort_order parameter to
9505         constructor.  Add sort_order_ field.
9506         (Sort_commons::operator): Check sort_order_.
9507         (Symbol_table::allocate_commons): Determine the sort order.
9508         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9509         Change all callers.
9510         (Symbol_table::do_allocate_commons_list): Likewise.
9511
9512 2009-12-30  Ian Lance Taylor  <iant@google.com>
9513
9514         PR 10916
9515         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9516         symbols from this object, don't change the visibility of an
9517         undefined symbol.
9518         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9519
9520 2009-12-30  Ian Lance Taylor  <iant@google.com>
9521
9522         PR 10861
9523         * script.h (class Version_script_info): Define Language enum.
9524         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9525         new fields globals_, locals_, and is_finalized_.
9526         * script.cc: Various formatting fixes.
9527         (class Parser_closure): Change language_stack_ from a vector of
9528         std::string to one of Version_script_info::Language.  Adjust all
9529         uses accordingly.
9530         (class Lazy_demangler): Remove.
9531         (struct Version_expression): Change language from std::string to
9532         Version_script_info::Language.
9533         (Version_script_info::Version_script_info): New function.
9534         (Version_script_info::~Version_script_info): Don't call clear.
9535         (Version_script_info::finalize): New function.
9536         (Version_script_info::build_lookup_tables): New function.
9537         (Version_script_info::build_expression_list_lookup): New
9538         function.
9539         (Version_script_info::get_symbol_version_helper): Rewrite to use
9540         lookup tables.
9541         (Version_script_info::print_expression_list): Adjust to use
9542         Version_script_info::Language.
9543         (script_push_lex_into_version_mode): Check that the version script
9544         has not been finalized.
9545         (version_script_push_lang): Change language string to
9546         Version_script_info::Language.
9547         * options.cc (Command_line::version_script): New function.
9548         * options.h (class General_options): Add finalize_dynamic_list
9549         function.  Change version_script from declaration to definition.
9550         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9551         * testsuite/version_script.map: Remove duplicate def of foo.
9552         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9553         version_script.map.
9554         * testsuite/Makefile.in: Rebuild.
9555
9556 2009-12-30  Ian Lance Taylor  <iant@google.com>
9557
9558         PR 10843
9559         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9560         if the input symbol index is 0, make the output symbol index 0.
9561
9562 2009-12-30  Ian Lance Taylor  <iant@google.com>
9563
9564         PR 10670
9565         * options.h (class General_options): Add -x/--discard-all.
9566         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9567         --discard-all.  If the local symbol needs a dynamic entry, check
9568         that before handling --discard-locals.
9569
9570 2009-12-30  Ian Lance Taylor  <iant@google.com>
9571
9572         PR 10450
9573         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9574         flags to PF_R.
9575         (Output_segment::add_output_section): Don't change the flags if
9576         the type is PT_TLS.
9577
9578         PR 10450
9579         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9580         GNU hash table if they need a dynamic value.  Otherwise, don't add
9581         them if they are defined in a dynamic object or are forced local.
9582
9583 2009-12-29  Ian Lance Taylor  <iant@google.com>
9584
9585         PR 10450
9586         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9587         .gnu.hash table for a 32-bit target.
9588
9589         PR 10450
9590         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9591         regular and a dynamic object only needs a dynamic symbol table
9592         entry if it is externally visible.
9593
9594         PR 10450
9595         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9596         constructor.  Add global_offset_table_ field.
9597         (Target_i386::got_section): Set global_offset_table_.
9598         (Target_i386::do_finalize_sections): Set global_offset_table_
9599         size.
9600         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9601         in constructor.  Add global_offset_table_ field.
9602         (Target_x86_64::got_section): Set global_offset_table_.
9603         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9604         size.
9605
9606         * layout.cc (Layout::Layout): Initialize increase_relro_.
9607         (Layout::get_output_section): Add is_relro, is_last_relro, and
9608         is_first_non_relro parameters.  Change all callers.
9609         (Layout::choose_output_section): Likewise.
9610         (Layout::add_output_section_data): Likewise.
9611         (Layout::make_output_section): Likewise.
9612         (Layout::set_segment_offsets): Clear increase_relro when using a
9613         linker script.
9614         * layout.h (class Layout): Add increase_relro method.  Add
9615         increase_relro_ field.  Update declarations.
9616         * output.cc (Output_section::Output_section): Initialize
9617         is_last_relro_ and is_first_non_relro_.
9618         (Output_segment::add_output_section): Group relro sections is
9619         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9620         (Output_segment::maximum_alignment): Remove relro handling.
9621         (Output_segment::set_section_addresses): Add increase_relro
9622         parameter.  Change all callers.  Add initial alignment to align
9623         relro sections on separate page.  Remove old relro handling.
9624         (Output_segment::set_section_list_addresses): Remove in_relro
9625         parameter.  Change all callers.
9626         (Output_segment::set_offset): Add increase parameter.  Change all
9627         callers.  Remove old relro handling.
9628         * output.h (class Output_section): Add new methods: is_last_relro,
9629         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9630         Add is_last_relro_ and is_first_non_relro_ fields.
9631         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9632         Create separate .got.plt section.  Call increase_relro.
9633         * x86_64.cc (Target_x86_64::got_section): Likewise.
9634         * testsuite/relro_script_test.t: Add .got.plt.
9635
9636         PR 10450
9637         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9638         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9639         (Layout::finalize): Call set_dynamic_symbol_size.
9640         (Layout::set_dynamic_symbol_size): New function.
9641         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9642         set_dynamic_symbol_size.
9643
9644         PR 10450
9645         * output.h (class Output_section): Add is_entsize_zero_ field.
9646         * output.cc (Output_section::Output_section): Initialize
9647         is_entsize_zero_.
9648         (Output_section::set_entsize): If two different entsizes are
9649         requested, force it to zero.
9650         (Output_section::add_input_section): Set flags for .debug_str
9651         before updating section flags.  Set entsize.
9652         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9653         and SHF_STRING if all input sections have those flags.
9654
9655 2009-12-29   Rafael Espindola  <espindola@google.com>
9656
9657         * main.cc (main): Fix the sys time reporting.
9658         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9659         reporting.
9660
9661 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9662
9663         * options.cc (General_options::parse_version): Allow -v to exit
9664         without an error if there is nothing to link.
9665
9666 2009-12-29  Ian Lance Taylor  <iant@google.com>
9667
9668         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9669         using a version of gcc before 4.1.
9670         * configure: Rebuild.
9671
9672 2009-12-28  Chris Demetriou  <cgd@google.com>
9673
9674         * attributes.cc (Output_attributes_section_data::do_write): Use
9675         std::vector::front rather than std::vector::data.
9676
9677 2009-12-28  Ian Lance Taylor  <iant@google.com>
9678
9679         * symtab.h (class Symbol_table): Add enum Defined.
9680         * resolve.cc (Symbol_table::should_override): Add defined
9681         parameter.  Change all callers.  Test whether object is NULL
9682         before calling a method on it.
9683         (Symbol_table::report_resolve_problem): Add defined parameter.
9684         Change all callers.
9685         (Symbol_table::should_override_with_special): Likewise.
9686         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9687         parameter.  Change all callers.
9688         (Symbol_table::do_define_in_output_data): Likewise.
9689         (Symbol_table::define_in_output_segment): Likewise.
9690         (Symbol_table::do_define_in_output_segment): Likewise.
9691         (Symbol_table::define_as_constant): Likewise.
9692         (Symbol_table::do_define_as_constant): Likewise.
9693         * script.h (class Symbol_assignment): Add is_defsym parameter to
9694         constructor; change all callers.
9695         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9696         parameter.  Change all callers.  Add is_defsym_ field.
9697         (class Parser_closure): Add parsing_defsym parameter to
9698         constructor; change all callers.  Add parsing_defsym accessor
9699         function.  Add parsing_defsym_ field.
9700
9701 2009-12-28  Ian Lance Taylor  <iant@google.com>
9702
9703         * gold.cc (queue_middle_tasks): Fix formatting.
9704         * object.cc (Relobj::is_section_name_included): Likewise.
9705
9706 2009-12-23  Ian Lance Taylor  <iant@google.com>
9707
9708         * i386.cc (Target_i386::do_calls_non_split): Recognize
9709         -fsplit-stack prologue for a function with a static chain.
9710         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9711         -fsplit-stack prologue when using %r11.
9712
9713 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9714
9715         * options.cc (General_options::parse_version): Make -v continue and do
9716         the link like GNU ld does.
9717
9718 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9719
9720         * Makefile.am (CCFILES): Add timer.cc.
9721         (HFILES): Add timer.h.
9722         * configure.ac: Check for sysconf and times.
9723         * main.cc: include timer.h.
9724         (main): Use Timer instead of get_run_time.
9725         * timer.cc: New.
9726         * timer.h: New.
9727         * workqueue.cc: include timer.h.
9728         (Workqueue::find_and_run_task):
9729         Report user, sys and wall time.
9730         * Makefile.in: Regenerate.
9731         * config.in: Regenerate.
9732         * configure: Regenerate.
9733
9734 2009-12-16  Doug Kwan  <dougkwan@google.com>
9735
9736         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9737         sections.
9738         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9739         relaxed input sections.
9740         * output.cc (Output_section::find_relaxed_input_section): Change
9741         return type to Output_relaxed_input_section pointer.  Adjust code
9742         for new type of relaxed_input_section_map_.
9743         * output.h (Output_section::find_relaxed_input_section): Change
9744         return type to Output_relaxed_input_section pointer.
9745         (Output_section::Output_relaxed_input_section_by_input_section_map):
9746         New type.
9747         (Output_section::relaxed_input_section_map_): Change type to
9748         Output_section::Output_relaxed_input_section_by_input_section_map.
9749         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9750         input section.
9751
9752 2009-12-15  Ian Lance Taylor  <iant@google.com>
9753
9754         * layout.cc (Layout::create_shstrtab): Only write out after input
9755         sections if we are compressing debug sections.
9756
9757 2009-12-15  Ian Lance Taylor  <iant@google.com>
9758
9759         * archive.cc (Archive::add_symbols): Only look up a symbol without
9760         a version if there is, in fact, a version.
9761
9762 2009-12-14  Ian Lance Taylor  <iant@google.com>
9763
9764         Revert -Wshadow changes, all changes from:
9765         2009-12-11  Doug Kwan  <dougkwan@google.com>
9766         2009-12-11  Nick Clifton  <nickc@redhat.com>
9767         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9768
9769 2009-12-11  Doug Kwan  <dougkwan@google.com>
9770
9771         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9772         due to -Wshadow.
9773         * attributes.cc (Object_attribute::size): Ditto.
9774         (Attributes_section_data::size): Ditto.
9775         (Attributes_section_data::Attributes_section_data): Ditto.
9776         (Output_attributes_section_data::do_write): Ditto.
9777         * attributes.h (Object_attribute::set_type): Ditto.
9778         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9779
9780 2009-12-11  Nick Clifton  <nickc@redhat.com>
9781
9782         * archive.cc: Fix shadowed variable warnings.
9783         * arm.cc: Likewise.
9784         * compressed_output.cc: Likewise.
9785         * compressed_output.h: Likewise.
9786         * configure: Likewise.
9787         * dwarf_reader.cc: Likewise.
9788         * dynobj.cc: Likewise.
9789         * dynobj.h: Likewise.
9790         * ehframe.cc: Likewise.
9791         * ehframe.h: Likewise.
9792         * errors.cc: Likewise.
9793         * expression.cc: Likewise.
9794         * fileread.cc: Likewise.
9795         * fileread.h: Likewise.
9796         * freebsd.h: Likewise.
9797         * i386.cc: Likewise.
9798         * icf.cc: Likewise.
9799         * incremental.h: Likewise.
9800         * layout.cc: Likewise.
9801         * layout.h: Likewise.
9802         * mapfile.cc: Likewise.
9803         * merge.cc: Likewise.
9804         * merge.h: Likewise.
9805         * object.cc: Likewise.
9806         * object.h: Likewise.
9807         * options.h: Likewise.
9808         * output.cc: Likewise.
9809         * output.h: Likewise.
9810         * parameters.cc: Likewise.
9811         * plugin.cc: Likewise.
9812         * powerpc.cc: Likewise.
9813         * reduced_debug_output.cc: Likewise.
9814         * reduced_debug_output.h: Likewise.
9815         * reloc.cc: Likewise.
9816         * reloc.h: Likewise.
9817         * resolve.cc: Likewise.
9818         * script-sections.cc: Likewise.
9819         * script.cc: Likewise.
9820         * script.h: Likewise.
9821         * sparc.cc: Likewise.
9822         * symtab.cc: Likewise.
9823         * symtab.h: Likewise.
9824         * target-select.cc: Likewise.
9825         * target-select.h: Likewise.
9826         * token.h: Likewise.
9827         * workqueue.cc: Likewise.
9828         * workqueue.h: Likewise.
9829         * x86_64.cc: Likewise.
9830
9831 2009-12-10  Doug Kwan  <dougkwan@google.com>
9832
9833         * arm.cc (attributes.h): New include.
9834         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9835         (Arm_relobj::~Arm_relobj): Delete object pointed by
9836         attributes_section_data_.
9837         (Arm_relobj::attributes_section_data): New method definition.
9838         (Arm_relobj::attributes_section_data_): New data member declaration.
9839         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9840         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9841         attributes_section_data_.
9842         (Arm_dynobj::attributes_section_data): New method definition.
9843         (Arm_dynobj::attributes_section_data_): New data member declaration.
9844         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9845         initialization value of may_use_blx_ to false.
9846         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9847         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9848         object attributes to compute results instead of hard-coding.
9849         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9850         Target_arm::get_secondary_compatible_arch,
9851         Target_arm::set_secondary_compatible_arch
9852         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9853         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9854         New method declarations.
9855         (Target_arm::get_aeabi_object_attribute): New method definition.
9856         (Target_arm::attributes_section_data_): New data member declaration.
9857         (read_arm_attributes_section): New template definition.
9858         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9859         (Arm_dynobj::do_read_symbols): Ditto.
9860         (Target_arm::do_finalize_sections): Merge attributes sections from
9861         input.  Check for BLX use after attributes section merging.
9862         Fix __exidx_start and __exidx_end visibility.  Create an
9863         .ARM.attributes section if necessary.
9864         (Target_arm::get_secondary_compatible_arch,
9865         Target_arm::set_secondary_compatible_arch,
9866         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9867         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9868         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9869         New method definitions.
9870
9871 2009-12-09  Ian Lance Taylor  <iant@google.com>
9872
9873         * plugin.cc (Plugin::load): Don't cast from void* to a function
9874         pointer.
9875
9876 2009-12-09  Ian Lance Taylor  <iant@google.com>
9877
9878         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9879         information fields.
9880
9881 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9882
9883         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9884         Replace two_file_shared_1.so with two_file_shared_2.so.
9885         * testsuite/Makefile.in: Regenerated.
9886
9887 2009-12-08  Doug Kwan  <dougkwan@google.com>
9888
9889         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9890         (HFILES): Add attributes.h and int_encoding.h.
9891         * Makefile.in: Regenerate.
9892         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9893         function definitions to int_encoding.cc
9894         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9895         prototypes to int_encoding.h
9896         * reduced_debug_output.cc (int_encoding.h): New include.
9897         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9898         function definitions to int_encoding.cc
9899         (insert_into_vector, read_from_pointer): Move template definitions to
9900         int_encoding.h
9901         * attributes.cc: New file.
9902         * attributes.h: New file.
9903         * int_encoding.cc: New file.
9904         * int_encoding.h: New file.
9905
9906 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9907
9908         PR gold/11055
9909         * incremental-dump.cc (dump_incremental_inputs): New.
9910         (main): Use dump_incremental_inputs.
9911
9912 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9913
9914         PR gold/10893
9915         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9916         checking elfcpp::STT_FUNC.
9917         (Target_i386::Relocate::relocate): Likewise.
9918         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9919
9920         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9921         symbols from shared libraries into normal FUNC symbols.
9922
9923         * symtab.h (Symbol): Add is_func and use it.
9924
9925 2009-12-05  Doug Kwan  <dougkwan@google.com>
9926
9927         * arm.cc (Target_arm::arm_info): Initialize new fields
9928         attributes_section and attributes_vendor.
9929         * i386.cc (Target_i386::i386_info): Same.
9930         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9931         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9932         fields attributes_section and attributes_vendor.
9933         * sparc.cc (Target_sparc::sparc_info): Same.
9934         * target.h (Target::attributes_section, Target::attributes_vendor,
9935         Target::is_attributes_section, Target::attribute_arg_type,
9936         Target::attributes_order): New method definitions.
9937         (Target::Target_info::attributes_section,
9938         Target::Target_info::attributes_vendor): New fields.
9939         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9940         virtual method definitions.
9941         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9942         attributes_section and attributes_vendor.
9943         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9944
9945 2009-12-05  Doug Kwan  <dougkwan@google.com>
9946
9947         * arm.cc: Update comments about interworking and stub generation.
9948         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9949         considered as non-PIC.
9950         (Arm_relocate_functions::base_abs): Fix formatting.
9951         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9952         of function to use GOT entry address instead of offset.
9953         (Target_arm::Scan::global): Issue an error if a symbol would need a
9954         PLT does not get one because it is untyped.  Remove code to create
9955         dynamic symbols for relative branches.
9956         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9957         takes unsigned integer instead of boolean.
9958
9959 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9960
9961         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9962         (two_file_test_LDADD): Likewise.
9963         (common_test_1_LDADD): Likewise.
9964         (exception_test_LDADD) Likewise.
9965         (weak_test_LDADD): Likewise.
9966         (many_sections_test_LDADD): Likewise.
9967         (initpri1_LDADD): Likewise.
9968         (script_test_1_LDADD): Likewise.
9969         (script_test_2_LDADD): Likewise.
9970         (justsyms_LDADD): Likewise.
9971         (binary_test_LDADD): Likewise.
9972         (large_LDADD): Likewise.
9973         * testsuite/Makefile.in: Regenerated.
9974
9975 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9976
9977         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9978         (Symbol_table::override_with_special): Likewise.
9979         (Symbol_table::add_from_object): Likewise.
9980
9981 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9982
9983         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9984         Don't set the data_offset twice.
9985
9986 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9987
9988         * testsuite/Makefile.in: Regenerate.
9989
9990 2009-12-03  Doug Kwan  <dougkwan@google.com>
9991
9992         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9993         (Target_arm::do_finalize_sections): Add parameter for symbol table
9994         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9995         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9996         parameter for symbol table pointer.
9997         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9998         an additional parameter for a pointer to symbol table.
9999         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10000         parameter for a symbol table pointer.
10001         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10002         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10003         Ditto.
10004         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10005         parameter for a symbol table pointer.
10006
10007 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10008
10009         * incremental.cc (Incremental_inputs_header)
10010         (Incremental_inputs_header_write, Incremental_inputs_entry)
10011         (Incremental_inputs_entry_write): Move ...
10012         * incremental.h (Incremental_inputs_header)
10013         (Incremental_inputs_header_write, Incremental_inputs_entry)
10014         (Incremental_inputs_entry_write): here.
10015
10016 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10017
10018         * incremental.cc (make_sized_incremental_binary): Set the target.
10019         Error if it is incompatible.
10020         * output.h (Output_file): Add filename method.
10021
10022 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10023
10024         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10025         from the get_* methods.
10026
10027 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10028
10029         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10030         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10031         Write 0 for the data_offset of scripts.
10032
10033 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10034
10035         * testsuite/Makefile.am: Add the incremental_test.sh test.
10036         * testsuite/incremental_test.sh: New.
10037         * testsuite/incremental_test_1.c: New.
10038         * testsuite/incremental_test_2.c: New.
10039
10040 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10041
10042         * incremental-dump.cc (main): Fix typos.
10043
10044 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10045
10046         PR gold/11025
10047         * incremental-dump.cc (main): Use llu to print 64 bit values.
10048
10049 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10050             H.J. Lu  <hongjiu.lu@intel.com>
10051
10052         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10053         $(LIBDL).
10054         (incremental_dump_LDADD): Likewise.
10055         * Makefile.in: Regenerated.
10056
10057 2009-11-25  Doug Kwan  <dougkwan@google.com>
10058
10059         Revert:
10060
10061         2009-11-25  Doug Kwan  <dougkwan@google.com>
10062
10063                 * arm.cc (Target_arm::Target_arm): Move method definition
10064                 outside of class definition.  Add code to handle
10065                 --target1-rel, --target1-abs and --target2= options.
10066                 (Target_arm::get_reloc_reloc_type): Change method to be
10067                 non-static and const.
10068                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10069                 New data member declaration.
10070                 (Target_arm::Scan::local, Target_arm::Scan::global,
10071                 Target_arm::Relocate::relocate,
10072                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10073                 Adjust call to Target_arm::get_real_reloc_type.
10074                 (Target_arm::get_real_reloc_type): Use command line options
10075                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10076                 * options.h (--target1-rel, --target1-abs, --target2): New
10077                 ARM-only options.
10078
10079 2009-11-25  Doug Kwan  <dougkwan@google.com>
10080
10081         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10082         class definition.  Add code to handle --target1-rel, --target1-abs
10083         and --target2= options.
10084         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10085         and const.
10086         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10087         member declaration.
10088         (Target_arm::Scan::local, Target_arm::Scan::global,
10089         Target_arm::Relocate::relocate,
10090         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10091         call to Target_arm::get_real_reloc_type.
10092         (Target_arm::get_real_reloc_type): Use command line options to
10093         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10094         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10095         options.
10096
10097 2009-11-25  Doug Kwan  <dougkwan@google.com>
10098
10099         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10100         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10101         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10102         formatting.
10103         (Arm_relocate_functions::thm_call): Replace body with a call to
10104         Arm_relocate_functions::thumb_branch_common.
10105         (Arm_relocate_functions::thm_jump24,
10106         Arm_relocate_functions::thm_xpc22): New method definitions.
10107         (Arm_relocate_functions::thumb_branch_common): New method definition.
10108         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10109         operator.
10110         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10111         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10112
10113 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10114
10115         * Makefile.am: Build incremental-dump
10116         * Makefile.in: Regenerate.
10117         * incremental-dump.cc: New.
10118         * incremental.cc (Incremental_inputs_header_data,
10119         Incremental_inputs_entry_data): Move to incremental.h
10120         * incremental.h: (Incremental_inputs_header_data,
10121         Incremental_inputs_entry_data): Move from incremental.cc
10122
10123 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10124
10125         * incremental.cc (Incremental_inputs_header,
10126         Incremental_inputs_header_write, Incremental_inputs_entry,
10127         Incremental_inputs_entry_write): Add a typedef with the data type.
10128
10129 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10130
10131         * incremental.cc (Incremental_inputs_header,
10132         Incremental_inputs_header_write, Incremental_inputs_entry,
10133         Incremental_inputs_entry_write): Update comment about which
10134         type has the filed descriptions.
10135
10136 2009-11-15  Doug Kwan  <dougkwan@google.com>
10137
10138         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10139         (Arm_relocate_functions::arm_branch_common): Change method defintion
10140         in class definition to a method declaration and update list of formal
10141         parameters.
10142         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10143         Arm_relocation_functions::jump24): Adjust call to
10144         Arm_relocate_functions::arm_branch_common.  Update list of formal
10145         parameters.
10146         (Arm_relocate_functions::xpc25): New method definition.
10147         (Arm_relocate_functions::arm_branch_common): Move method defintion
10148         out from class definition.  Use stubs for mode-switching and extending
10149         branch ranges.
10150         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10151         specially.  Change code to enable use of stubs in ARM branches.
10152
10153 2009-11-10  Doug Kwan  <dougkwan@google.com>
10154
10155         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10156         in method declaration.
10157         (Target_arm::relocate_stub): New method declaration.
10158         (Target_arm::default_target): Change to return a pointer instead of
10159         a const reference.
10160         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10161         Target_arm::default_target.
10162         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10163         method definition.
10164         (Target_arm::relocate_section): Adjust view.
10165         (Target_arm::relocate_stub): New method definition.
10166
10167 2009-11-10  Doug Kwan  <dougkwan@google.com>
10168
10169         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10170         a format warning.
10171         * incremental.cc (open_incremental_binary): Initialized local
10172         variables to avoid warnings.
10173         * object.cc (make_elf_object): Ditto.
10174         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10175         a format warning.
10176
10177 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10178
10179         PR gold/10930
10180         * testsuite/plugin_test.c: Include "config.h".
10181
10182 2009-11-09  Doug Kwan  <dougkwan@google.com>
10183
10184         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10185         (arm_symbol_value): Remove.
10186         (Arm_relocate_functions::arm_branch_common,
10187         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10188         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10189         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10190         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10191         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10192         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10193         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10194         Arm_relocate_functions::thm_mobw_abs_nc,
10195         Arm_relocate_functions::thm_mov_abs,
10196         Arm_relocate_functions::movw_prel_nc,
10197         Arm_relocate_functions::thm_movt_abs,
10198         Arm_relocate_functions::movt_prel,
10199         Arm_relocate_functions::thm_movw_prel_nc,
10200         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10201         (Target_arm::Relocate::relocate): Only decompose address into two
10202         parts if relocation type uses the thumb-bit and pass the actual
10203         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10204         calls to methods in Arm_relocate_functions for this change.
10205
10206 2009-11-08  Ian Lance Taylor  <iant@google.com>
10207
10208         PR 10925
10209         * reloc.cc: Instantiate
10210         Sized_relobj::initialize_input_to_output_maps and
10211         Sized_relobj:free_input_to_output_maps.
10212
10213 2009-11-06  Ian Lance Taylor  <iant@google.com>
10214
10215         PR 10876
10216         * defstd.cc (in_segment): Set only_if_ref true for "end".
10217
10218 2009-11-06  Doug Kwan  <dougkwan@google.com>
10219
10220         * arm.cc (class Reloc_stub): Correct a comment.
10221         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10222         (Target_arm::scan_section_for_stubs): New method declaration.
10223         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10224         Change methods from private to protected.
10225         (Target_arm::do_may_relax): New method definition.
10226         (Target_arm::do_relax, Target_arm::group_sections,
10227         Target_arm::scan_reloc_for_stub,
10228         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10229         (Target_arm::arm_input_section_map_): New data member declaration.
10230         (Target_arm::scan_reloc_for_stub,
10231         Target_arm::scan_reloc_section_for_stubs,
10232         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10233         Target_arm::do_relax): New method definitions.
10234
10235 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10236
10237         * configure.ac: Check for (struct stat)::st_mtim
10238         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10239         * config.in: Regenerate.
10240         * configure: Regenerate.
10241
10242 2009-11-05  Ian Lance Taylor  <iant@google.com>
10243
10244         PR 10910
10245         * output.cc (Output_segment::add_output_section): Add missing
10246         return statement.
10247
10248 2009-11-04  Ian Lance Taylor  <iant@google.com>
10249
10250         PR 10880
10251         * object.h (class Object): Add is_needed and set_is_needed
10252         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10253         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10254         defined in a dynamic object and referenced by a regular object,
10255         set is_needed for the dynamic object.
10256         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10257         if the file is marked with as_needed and it is not needed.
10258
10259 2009-11-04  Ian Lance Taylor  <iant@google.com>
10260
10261         PR 10887
10262         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10263         tags if data is discarded by linker script.
10264         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10265         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10266         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10267         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10268
10269 2009-11-04  Ian Lance Taylor  <iant@google.com>
10270
10271         * layout.cc (Layout::get_output_section): Add is_interp and
10272         is_dynamic_linker_section parameters.  Change all callers.
10273         (Layout::choose_output_section): Likewise.
10274         (Layout::make_output_section): Likewise.
10275         (Layout::add_output_section_data): Add is_dynamic_linker_section
10276         parameter.  Change all callers.
10277         * layout.h (class Layout): Update declarations.
10278         * output.h (class Output_section): Add is_interp, set_is_interp,
10279         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10280         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10281         generate_code_fills_at_write_ to a bitfield.
10282         * output.cc (Output_section::Output_sections): Initialize new
10283         fields.
10284         (Output_segment::add_output_section): Add do_sort parameter.
10285         Change all callers.
10286
10287 2009-11-03  Ian Lance Taylor  <iant@google.com>
10288
10289         PR 10860
10290         * options.h (class General_options): Add --warn-common.
10291         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10292         merging two common symbols.
10293         (Symbol_table::should_override): Handle --warn-common when merging
10294         a common symbol with a defined symbol.  Use report_resolve_problem
10295         for multiple definitions.
10296         (Symbol_table::report_resolve_problem): New function.
10297         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10298
10299 2009-11-03  Doug Kwan  <dougkwan@google.com>
10300
10301         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10302         stub_factory_.
10303         (Target_arm::stub_factory): New method definition.
10304         (Target_arm::new_arm_input_section,
10305         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10306         Target_arm::reloc_uses_thumb_bit): New method declarations.
10307         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10308         New type definitions.
10309         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10310         member declarations.
10311         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10312         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10313         New method definitions.
10314
10315 2009-11-03  Ian Lance Taylor  <iant@google.com>
10316
10317         * options.h (class General_options): Add --warn_constructors.
10318
10319 2009-11-03  Ian Lance Taylor  <iant@google.com>
10320
10321         PR 10893
10322         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10323         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10324
10325 2009-11-03  Ian Lance Taylor  <iant@google.com>
10326
10327         PR 10895
10328         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10329         --msgid-bugs-address.
10330         (install-pdf): New target.
10331         (install-data_yes): Look up one directory to find mkinstalldirs.
10332
10333 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10334
10335         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10336         tree.
10337
10338 2009-10-30  Doug Kwan  <dougkwan@google.com>
10339
10340         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10341
10342 2009-10-30  Doug Kwan  <dougkwan@google.com>
10343
10344         * arm.cc (Stub_addend_reader): New struct template definition
10345         and partial specializations.
10346         (Stub_addend_reader::operator()): New method definition for a
10347         partially specialized template.
10348
10349 2009-10-30  Doug Kwan  <dougkwan@google.com>
10350
10351         * arm.cc (Arm_relobj::processor_specific_flags): New method
10352         definition.
10353         (Arm_relobj::do_read_symbols): New method declaration.
10354         (Arm_relobj::processor_specific_flags_): New data member declaration.
10355         (Arm_dynobj): New class definition.
10356         (Target_arm::do_finalize_sections): Add input_objects parameter.
10357         (Target_arm::do_adjust_elf_header): New method declaration.
10358         (Target_arm::are_eabi_versions_compatible,
10359         (Target_arm::merge_processor_specific_flags): New method declaration.
10360         (Target_arm::do_make_elf_object): New overloaded method definitions
10361         and declaration.
10362         (Arm_relobj::do_read_symbols): New method definition.
10363         (Arm_dynobj::do_read_symbols): Ditto.
10364         (Target_arm::do_finalize_sections): Add input_objects parameters.
10365         Merge processor-specific flags from all input objects.
10366         (Target_arm::are_eabi_versions_compatible,
10367         Target_arm::merge_processor_specific_flags,
10368         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10369         New method definitions.
10370         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10371         Input_objects pointer type parameter.
10372         * layout.cc (Layout::finalize): Pass input objects to target's.
10373         finalize_sections function.
10374         * output.cc (Output_file_header::do_sized_write): Set ELF file
10375         header's processor-specific flags.
10376         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10377         Input_objects pointer type parameter.
10378         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10379         * target.h (Input_objects): New forward class declaration.
10380         (Target::processor_specific_flags,
10381         Target::are_processor_specific_flags_sect): New method definitions.
10382         (Target::finalize_sections): Add input_objects parameter.
10383         (Target::Target): Initialize processor_specific_flags_ and
10384         are_processor_specific_flags_set_.
10385         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10386         parameter.
10387         (Target::set_processor_specific_flags): New method definition.
10388         (Target::processor_specific_flags_,
10389         Target::are_processor_specific_flags_set_): New data member
10390         declarations.
10391         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10392         Input_objects pointer type parameter.
10393
10394 2009-10-30  Doug Kwan  <dougkwan@google.com>
10395
10396         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10397
10398 2009-10-28  Ian Lance Taylor  <iant@google.com>
10399
10400         * object.h (class Relobj): Drop options parameter from
10401         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10402         do_scan_relocs, do_relocate.  Change all callers.
10403         (class Sized_relobj): Drop options parameters from
10404         do_gc_process_relocs, do_scan_relocs, do_relocate,
10405         do_relocate_sections, relocate_sections, emit_relocs_scan,
10406         emit_relocs_scan_reltype.  Change all callers.
10407         (struct Relocate_info): Remove options field and all references to
10408         it.
10409         * reloc.h (class Read_relocs): Remove options constructor
10410         parameter and options_ field.  Change all callers.
10411         (class Gc_process_relocs, class Scan_relocs): Likewise.
10412         (class Relocate_task): Likewise.
10413         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10414         all callers.
10415         (scan_relocatable_relocs): Likewise.
10416         * target.h (class Sized_target): Remove options parameter from
10417         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10418         all callers.
10419         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10420         callers.
10421         * arm.cc: Update functions to remove options parameters.
10422         * i386.cc: Likewise.
10423         * powerpc.cc: Likewise.
10424         * sparc.cc: Likewise.
10425         * x86_64.cc: Likewise.
10426         * testsuite/testfile.cc: Likewise.
10427
10428 2009-10-28  Doug Kwan  <dougkwan@google.com>
10429
10430         * arm.cc (Arm_relobj): New class definition.
10431         (Arm_relobj::scan_sections_for_stubs,
10432         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10433         New method definitions.
10434
10435 2009-10-28  Cary Coutant  <ccoutant@google.com>
10436
10437         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10438         (Plugin::cleanup_done_): New member.
10439         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10440         (Plugin_manager::cleanup_done_): Remove.
10441         (Plugin_manager::add_input_file): Edit error message.
10442         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10443         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10444
10445 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10446
10447         * fileread.cc: (File_read::View::~View): Use the new
10448         data_ownership_ filed.
10449         (File_read::~File_read): Dispose the new whole_file_view_.
10450         (File_read::open): Mmap the whole file if needed.
10451         (File_read::open): Use whole_file_view_ instead of contents_.
10452         (File_read::find_view): Use whole_file_view_ if applicable.
10453         (File_read::do_read): Use whole_file_view_ instead of contents_.
10454         (File_read::make_view): Use whole_file_view_ instead of contents_,
10455         update File_read::View::View call.
10456         (File_read::find_or_make_view): Update File_read::View::View
10457         call.
10458         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10459         remove contents_
10460         (File_read::View::Data_ownership): New enum.
10461         (File_read::View::View): Replace bool mapped_ with Data_ownership
10462         argument.
10463         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10464         (File_read::View::data_ownership_): New field.
10465         (File_read::contents_): Remove (replaced by whole_file_view_).
10466         (File_read::whole_file_view_): New field.
10467         * options.h (class General_options): Add --keep-files-mapped.
10468
10469 2009-10-27  Cary Coutant  <ccoutant@google.com>
10470
10471         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10472         * testsuite/Makefile.am (plugin_test_5): New test case.
10473         * testsuite/Makefile.in: Regenerate.
10474
10475 2009-10-25  Doug Kwan  <dougkwan@google.com>
10476
10477         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10478         from private to protected to allow access by child class.
10479         (Sized_relobj::do_relocate_sections): New method declaration.
10480         (Sized_relobj::relocate_sections): Virtualize.
10481         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10482         Sized_relobj::relocate_sections.  Instantiate template explicitly
10483         for different target sizes and endianity.
10484
10485 2009-10-24  Doug Kwan  <dougkwan@google.com>
10486
10487         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10488         (Arm_input_section::as_arm_input_section): New method.
10489         (Arm_output_section): New class definition.
10490         (Arm_output_section::create_stub_group,
10491         Arm_output_section::group_sections): New method definitions.
10492
10493 2009-10-22  Doug Kwan  <dougkwan@google.com>
10494
10495         * arm.cc (Arm_input_section): New class definition.
10496         (Arm_input_section::init, Arm_input_section:do_write,
10497         Arm_input_section::set_final_data_size,
10498         Arm_input_section::do_reset_address_and_file_offset): New method
10499         definitions.
10500
10501 2009-10-21  Doug Kwan  <dougkwan@google.com>
10502
10503         * arm.cc (Stub_table, Arm_input_section): New forward class
10504         declarations.
10505         (Stub_table): New class defintion.
10506         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10507         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10508         New method definition.
10509
10510 2009-10-21  Doug Kwan  <dougkwan@google.com>
10511
10512         * arm.cc: Update copyright comments.
10513         (Target_arm): New forward class template declaration.
10514         (Arm_address): New type.
10515         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10516         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10517         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10518         constants.
10519         (Insn_template): Same.
10520         (DEF_STUBS): New macro.
10521         (Stub_type): New enum type.
10522         (Stub_template): New class definition.
10523         (Stub): Same.
10524         (Reloc_stub): Same.
10525         (Stub_factory): Same.
10526         (Target_arm::Target_arm): Initialize may_use_blx_ and
10527         should_force_pic_veneer_.
10528         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10529         Target_arm::should_force_pic_veneer,
10530         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10531         Target_arm::using_thumb_only, Target_arm:;default_target): New
10532         method defintions.
10533         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10534         New data member declarations.
10535         (Insn_template::size, Insn_template::alignment): New method defintions.
10536         (Stub_template::Stub_template): New method definition.
10537         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10538         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10539         (Stub_factory::Stub_factory): New method definition.
10540         * gold.h (string_hash): New template.
10541         * output.h (Input_section_specifier::hash_value): Use
10542         gold::string_hash.
10543         (Input_section_specifier::string_hash): Remove.
10544         * stringpool.cc (Stringpool_template::string_hash): Use
10545         gold::string_hash.
10546
10547 2009-10-20  Doug Kwan  <dougkwan@google.com>
10548
10549         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10550         symbols of relaxed input sections.
10551         * output.h (Output_section::find_relaxed_input_section): Make
10552         method public.
10553
10554 2009-10-16  Doug Kwan  <dougkwan@google.com>
10555
10556         * dynobj.cc (Versions::Versions): Initialize version_script_.
10557         Only insert base version symbol definition for a shared object
10558         if version script defines any version versions.
10559         (Versions::define_base_version): New method definition.
10560         (Versions::add_def): Check that base version is not needed.
10561         (Versions::add_need): Define base version lazily.
10562         * dynobj.h (Versions::define_base_version): New method declaration.
10563         (Versions::needs_base_version_): New data member declaration.
10564         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10565         (check_DATA): Add no_version_test.stdout.
10566         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10567         New make rules.
10568         * testsuite/Makefile.in: Regenerate.
10569         * testsuite/no_version_test.c: New file.
10570         * testsuite/no_version_test.sh: Ditto.
10571
10572 2009-10-16  Doug Kwan  <dougkwan@google.com>
10573
10574         * expression.cc (class Segment_start_expression): New class definition.
10575         (Segment_start_expression::value): New method definition.
10576         (script_exp_function_segment_start): Return a new
10577         Segment_start_expression.
10578         * gold/script-c.h (script_saw_segment_start_expression): New function
10579         prototype.
10580         * script-sections.cc (Script_sections::Script_sections): Initialize
10581         SAW_SEGMENT_START_EXPRESSION_ to false.
10582         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10583         and -Tbbs options to specify section addresses if given in
10584         command line and no SEGMENT_START expression is seen in a script.
10585         * script-sections.h (Script_sections::saw_segment_start_expression,
10586         Script_sections::set_saw_segment_start_expression): New method
10587         definition.
10588         (Script_sections::saw_segment_start_expression_): New data member
10589         declaration.
10590         * script.cc (script_saw_segment_start_expression): New function.
10591         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10592         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10593         script_test_7.sh and script_test_8.sh.
10594         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10595         script_test_8.stdout.
10596         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10597         (script_test_6, script_test_6.stdout, script_test_7,
10598         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10599         * Makefile.in: Regenerate.
10600         * testsuite/script_test_6.sh: New file.
10601         * testsuite/script_test_6.t: Same.
10602         * testsuite/script_test_7.sh: Same.
10603         * testsuite/script_test_7.t: Same.
10604         * testsuite/script_test_8.sh: Same.
10605
10606 2009-10-16  Doug Kwan  <dougkwan@google.com>
10607
10608         * output.cc (Output_segment::set_section_list_address): Cast
10609         expressions to unsigned long long type to avoid format warnings.
10610
10611 2009-10-15  Ian Lance Taylor  <iant@google.com>
10612
10613         * script.cc (Script_options::add_symbol_assignment): Always add a
10614         dot assignment to script_sections_.
10615         * script-sections.cc (Script_sections::add_dot_assignment):
10616         Initialize if necessary.
10617
10618         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10619         program headers with no load segment if there is a linker script.
10620
10621         * layout.cc (Layout::set_segment_offsets): Align the file offset
10622         to the segment aligment for -N or -n with no load segment.
10623         * output.cc (Output_segment::add_output_section): Don't crash if
10624         the first section is a TLS section.
10625         (Output_segment::set_section_list_addresses): Print an error
10626         message if the address moves backward in a linker script.
10627         * script-sections.cc
10628         (Output_section_element_input::set_section_addresses): Don't
10629         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10630         (Orphan_output_section::set_section_addresses): Likewise.
10631
10632 2009-10-15  Doug Kwan  <dougkwan@google.com>
10633
10634         * layout.cc (Layout::finish_dynamic_section): Generate tags
10635         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10636         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10637         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10638
10639 2009-10-14  Ian Lance Taylor  <iant@google.com>
10640
10641         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10642         fields.
10643         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10644         data_shdr fields of relinfo.
10645         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10646         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10647         R_386_TLS_LDO_32, adjust based on section flags.
10648         (Target_i386::Relocate::fix_up_ldo): Remove.
10649
10650 2009-10-13  Ian Lance Taylor  <iant@google.com>
10651
10652         Add support for -pie.
10653         * options.h (class General_options): Add -pie and
10654         --pic-executable.
10655         (General_options::output_is_position_independent): Test -pie.
10656         (General_options::output_is_executable): Return true if not shared
10657         and not relocatable.
10658         (General_options::output_is_pie): Remove.
10659         * options.cc (General_options::finalize): Reject incompatible uses
10660         of -pie.
10661         * gold.cc (queue_middle_tasks): A -pie link is not static.
10662         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10663         * symtab.cc (Symbol::final_value_is_known): Return false if
10664         output_is_position_independent.
10665         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10666         output_is_position_independent.
10667         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10668         output_is_position_independent.
10669         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10670         output_is_position_independent.
10671         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10672         two_file_pie_test.
10673         (basic_pie_test.o, basic_pie_test): New targets.
10674         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10675         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10676         (two_file_pie_test): New target.
10677         * testsuite/Makefile.in: Rebuild.
10678         * README: Remove note saying that -pie is not supported.
10679
10680 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10681
10682         * options.h (class General_options): Add -init and -fini.
10683         * layout.cc (Layout::finish_dynamic_section): Emit
10684         given init and fini functions.
10685
10686 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10687
10688         * gc.h (gc_process_relocs): Check if icf is enabled using new
10689         function.
10690         * gold.cc (queue_initial_tasks): Likewise.
10691         (queue_middle_tasks): Likewise.
10692         * object.cc (do_layout): Likewise.
10693         * symtab.cc (is_section_folded): Likewise.
10694         * main.cc (main): Likewise.
10695         * reloc.cc (Read_relocs::run): Likewise.
10696         (Sized_relobj::do_scan_relocs): Likewise.
10697         * icf.cc (is_function_ctor_or_dtor): New function.
10698         (Icf::find_identical_sections): Check if function is ctor or dtor when
10699         safe icf is chosen.
10700         * options.h (General_options::icf): Change option to be an enum.
10701         (Icf_status): New enum.
10702         (icf_enabled): New method.
10703         (icf_safe_folding): New method.
10704         (set_icf_status): New method.
10705         (icf_status_): New variable.
10706         * (options.cc) (General_options::finalize): Set icf_status_.
10707         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10708         icf_test and icf_keep_unique_test to use the --icf enum flag.
10709         * testsuite/icf_safe_test.sh: New file.
10710         * testsuite/icf_safe_test.cc: New file.
10711
10712 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10713
10714         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10715         includes to gc.h and icf.h.
10716         * arm.cc: Include gc.h.
10717         * gold.cc: Likewise.
10718         * i386.cc: Likewise.
10719         * powerpc.cc: Likewise.
10720         * sparc.cc: Likewise.
10721         * x86_64.cc: Likewise.
10722         * gc.h: Include icf.h.
10723
10724 2009-10-11  Ian Lance Taylor  <iant@google.com>
10725
10726         * plugin.cc: Include "gold.h" before other header files.
10727
10728 2009-10-10  Chris Demetriou  <cgd@google.com>
10729
10730         * options.h (Input_file_argument::Input_file_type): New enum.
10731         (Input_file_argument::is_lib_): Replace with...
10732         (Input_file_argument::type_): New member.
10733         (Input_file_argument::Input_file_argument): Take Input_file_type
10734         'type' rather than boolean 'is_lib' as second argument.
10735         (Input_file_argument::is_lib): Use type_.
10736         (Input_file_argument::is_searched_file): New function.
10737         (Input_file_argument::may_need_search): Handle is_searched_file.
10738         * options.cc (General_options::parse_library): Support -l:filename.
10739         (General_options::parse_just_symbols): Update for Input_file_argument
10740         changes.
10741         (Command_line::process): Likewise.
10742         * archive.cc (Archive::get_file_and_offset): Likewise.
10743         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10744         * script.cc (read_script_file, script_add_file): Likewise.
10745         * fileread.cc (Input_file::Input_file): Likewise.
10746         (Input_file::will_search_for): Handle is_searched_file.
10747         (Input_file::open): Likewise.
10748         * readsyms.cc (Read_symbols::get_name): Likewise.
10749         * testsuite/Makefile.am (searched_file_test): New test.
10750         * testsuite/Makefile.in: Regenerate.
10751         * testsuite/searched_file_test.cc: New file.
10752         * testsuite/searched_file_test_lib.cc: New file.
10753
10754 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10755             Ian Lance Taylor  <iant@google.com>
10756
10757         * descriptor.cc: Include <cstdio> and "binary-io.h".
10758         (Descriptors::open): Open the files in binary mode always.
10759         * script.cc (Lex::get_token): Treat \r as whitespace.
10760
10761 2009-10-09  Ian Lance Taylor  <iant@google.com>
10762
10763         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10764
10765 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10766             Ian Lance Taylor  <iant@google.com>
10767
10768         * configure.ac: Check for readv function also.
10769         * fileread.cc (readv): Define if not HAVE_READV.
10770         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10771         does not exist.
10772         * config.in: Regenerate.
10773         * configure: Regenerate.
10774
10775 2009-10-09  Doug Kwan  <dougkwan@google.com>
10776
10777         * layout.cc (Layout::make_output_section): Call target hook to make
10778         ordinary output section.
10779         (Layout::finalize): Adjust parameter list of call the
10780         Target::may_relax().
10781         * layout.h (class Layout::section_list): New method.
10782         * merge.h (Output_merge_base::entsize): Change visibility to public.
10783         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10784         New methods.
10785         (Output_merge_string::do_is_string): New method.
10786         * object.cc (Sized_relobj::do_setup): renamed from
10787         Sized_relobj::set_up.
10788         * object.h (Sized_relobj::adjust_shndx,
10789         Sized_relobj::initializ_input_to_output_maps,
10790         Sized_relobj::free_input_to_output_maps): Change visibilities to
10791         protected.
10792         (Sized_relobj::setup): Virtualize.
10793         (Sized_relobj::do_setup): New method declaration.
10794         (Sized_relobj::invalidate_section_offset,
10795         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10796         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10797         * options.cc (parse_int): New function.
10798         * options.h (parse_int): New declaration.
10799         (DEFINE_int): New macro.
10800         (stub_group_size): New option.
10801         * output.cc (Output_section::Output_section): Initialize memebers
10802         merge_section_map_, merge_section_by_properties_map_,
10803         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10804         (Output_section::add_input_section): Handled deferred code-fill
10805         generation and remove an old comment.
10806         (Output_section::add_relaxed_input_section): New method definition.
10807         (Output_section::add_merge_input_section): Use merge section by
10808         properties map to speed to search.  Update merge section maps
10809         as appropriate.
10810         (Output_section::build_relaxation_map): New method definition.
10811         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10812         Same.
10813         (Output_section::relax_input_section): Renamed to
10814         Output_section::convert_input_sections_to_relaxed_sections and change
10815         interface to take a vector of pointers to relaxed sections.
10816         (Output_section::find_merge_section,
10817         Output_section::find_relaxed_input_section): New method definitions.
10818         (Output_section::is_input_address_mapped,
10819         Output_section::output_offset, Output_section::output_address):
10820         Use output section data maps to speed up searching.
10821         (Output_section::find_starting_output_address): Add comments.
10822         (Output_section::do_write,
10823         Output_section::write_to_postprocessing_buffer): Do code-fill
10824         generation as appropriate.
10825         (Output_section::get_input_sections): Invalidate relaxed input section
10826         map.
10827         (Output_section::restore_states): Adjust type of checkpoint .
10828         Invalidate relaxed input section map.
10829         * output.h (Output_merge_base): New class declaration.
10830         (Input_section_specifier): New class defintion.
10831         (class Output_relaxed_input_section) Change base class to
10832         Output_section_data_build.
10833         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10834         base class initializer.
10835         (Output_section::add_relaxed_input_section): New method declaration.
10836         (Output_section::Input_section): Change visibility to protected.
10837         (Output_section::Input_section::relobj,
10838         Output_section::Input_section::shndx): Handle relaxed input sections.
10839         Output_section::input_sections) Change visibility to protected.  Also
10840         define overload to return a non-const pointer.
10841         (Output_section::Merge_section_properties): New class defintion.
10842         (Output_section::Merge_section_by_properties_map,
10843         Output_section::Output_section_data_by_input_section_map,
10844         Output_section::Relaxation_map): New types.
10845         (Output_section::relax_input_section): Rename method to
10846         Output_section::convert_input_sections_to_relaxed_sections and change
10847         interface to take a vector of relaxed section pointers.
10848         (Output_section::find_merge_section,
10849         Output_section::find_relaxed_input_section,
10850         Output_section::build_relaxation_map,
10851         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10852         New method declarations.
10853         (Output_section::merge_section_map_
10854         Output_section::merge_section_by_properties_map_,
10855         Output_section::relaxed_input_section_map_,
10856         Output_section::is_relaxed_input_section_map_valid_,
10857         Output_section::generate_code_fills_at_write_): New data members.
10858         * script-sections.cc
10859         (Output_section_element_input::set_section_addresses): Call
10860         current_data_size and addralign methods of relaxed input sections.
10861         (Orphan_output_section::set_section_addresses): Call current_data_size
10862         and addralign methods of relaxed input sections.
10863         * symtab.cc (Symbol_table::compute_final_value): Extract template
10864         from the body of Symbol_table::sized_finalize_symbol.
10865         (Symbol_table::sized_finalized_symbol): Call
10866         Symbol_table::compute_final_value.
10867         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10868         (Symbol_table::compute_final_value): New templated method declaration.
10869         * target.cc (Target::do_make_output_section): New method defintion.
10870         * target.h (Target::make_output_section): New method declaration.
10871         (Target::relax): Add more parameters for input objects, symbol table
10872         and layout.  Adjust call to do_relax.
10873         (Target::do_make_output_section): New method declaration.
10874         (Target::do_relax): Add parameters for input objects, symbol table
10875         and layout.
10876
10877 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10878
10879         * pread.c: Include stdio.h.
10880
10881 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10882
10883         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10884         defined.
10885
10886 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10887
10888         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10889         Change read_shndx type to unsigned int.
10890         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10891         int.
10892         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10893         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10894         Change read_shndx type to unsigned int.
10895         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10896         int.
10897         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10898         * layout.cc (Layout::create_symtab_sections): Cast the result of
10899         local_symcount * symsize to off_t in the gold_assert.
10900
10901 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10902
10903         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10904         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10905         R_ARM_BASE_ABS.
10906         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10907         (Arm_relocate_functions::thm_abs5): New function.
10908         (Arm_relocate_functions::abs12): New function.
10909         (Arm_relocate_functions::abs16): New function.
10910         (Arm_relocate_functions::base_abs): New function.
10911         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10912         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10913         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10914         R_ARM_BASE_ABS.
10915         (Scan::global): Likewise.
10916         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10917         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10918         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10919         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10920         R_ARM_BASE_ABS.
10921
10922 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10923
10924         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10925         (Arm_relocate_functions::movt_prel): New function.
10926         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10927         (Arm_relocate_functions::thm_movt_prel): New function.
10928         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10929         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10930         (Scan::global, Relocate::relocate): Likewise.
10931         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10932
10933 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10934
10935         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10936         Incremental_checker.
10937         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10938         unsigned int.
10939         (class Incremental_inputs_header): New class.
10940         (Incremental_inputs_header_writer): Edit comment.
10941         (Incremental_inputs_entry): New class.
10942         (Incremental_inputs_entry_writer): Edit comment.
10943         (Sized_incremental_binary::do_find_incremental_inputs_section):
10944         Add *strtab_shndx parameter, fill it.
10945         (Sized_incremental_binary::do_check_inputs): New method.
10946         (Incremental_checker::can_incrementally_link_output_file): Use
10947         Sized_incremental_binary::check_inputs.
10948         (Incremental_inputs::report_command_line): Save command line in
10949         command_line_.
10950         * incremental.h:
10951         (Incremental_binary::find_incremental_inputs_section): New
10952         method.
10953         (Incremental_binary::do_find_incremental_inputs_section): Add
10954         strtab_shndx parameter.
10955         (Incremental_binary::do_check_inputs): New pure virtual method.
10956         (Sized_incremental_binary::do_check_inputs): Declare.
10957         (Incremental_checker::Incremental_checker): Add incremental_inputs
10958         parameter, use it to initialize incremental_inputs_.
10959         (Incremental_checker::incremental_inputs_): New field.
10960         (Incremental_checker::command_line): New method.
10961         (Incremental_checker::inputs): New method.
10962         (Incremental_checker::command_line_): New field.
10963
10964 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10965
10966         * incremental.cc: Include <cstdarg> and "target-select.h".
10967         (vexplain_no_incremental): New function.
10968         (explain_no_incremental): New function.
10969         (Incremental_binary::error): New method.
10970         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10971         method.
10972         (make_sized_incremental_binary): New function.
10973         (open_incremental_binary): New function.
10974         (can_incrementally_link_file): Add checks if output is ELF and has
10975         inputs section.
10976         * incremental.h: Include "elfcpp_file.h" and "output.h".
10977         (Incremental_binary): New class.
10978         (Sized_incremental_binary): New class.
10979         (open_incremental_binary): Declare.
10980         * object.cc (is_elf_object): Use
10981         elfcpp::Elf_recognizer::is_elf_file.
10982         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10983         * output.h (Output_file::filesize): New method.
10984
10985 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10986
10987         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10988         New function.
10989         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10990         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10991         function.
10992         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10993         function.
10994         (Arm_relocate_functions::movw_abs_nc): New function.
10995         (Arm_relocate_functions::movt_abs): New function.
10996         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10997         (Arm_relocate_functions::thm_movt_abs): New function.
10998         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10999         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11000         (Scan::global): Likewise.
11001         (Relocate::relocate): Likewise.
11002         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11003
11004 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11005
11006         * arm.cc (Arm_relocate_functions::got_prel) New function.
11007         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11008         (Relocate::relocate): Likewise.
11009         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11010
11011 2009-10-06  Ian Lance Taylor  <iant@google.com>
11012
11013         * options.h (class General_options): Define
11014         split_stack_adjust_size parameter.
11015         * object.h (class Object): Add uses_split_stack_ and
11016         has_no_split_stack_ fields.  Add uses_split_stack and
11017         has_no_split_stack accessor functions.  Declare
11018         handle_split_stack_section.
11019         (class Reloc_symbol_changes): Define.
11020         (class Sized_relobj): Define Function_offsets.  Declare
11021         split_stack_adjust, split_stack_adjust_reltype, and
11022         find_functions.
11023         * object.cc (Object::handle_split_stack_section): New function.
11024         (Sized_relobj::do_layout): Call handle_split_stack_section.
11025         * dynobj.cc (Sized_dynobj::do_layout): Call
11026         handle_split_stack_section.
11027         * reloc.cc (Sized_relobj::relocate_sections): Call
11028         split_stack_adjust for executable sections in split_stack
11029         objects.  Pass reloc_map to relocate_section.
11030         (Sized_relobj::split_stack_adjust): New function.
11031         (Sized_relobj::split_stack_adjust_reltype): New function.
11032         (Sized_relobj::find_functions): New function.
11033         * target-reloc.h: Include "object.h".
11034         (relocate_section): Add reloc_symbol_changes parameter.  Change
11035         all callers.
11036         * target.h (class Target): Add calls_non_split method.  Declare
11037         do_calls_non_split virtual method.  Declare match_view and
11038         set_view_to_nop.
11039         * target.cc: Include "elfcpp.h".
11040         (Target::do_calls_non_split): New function.
11041         (Target::match_view): New function.
11042         (Target::set_view_to_nop): New function.
11043         * gold.cc (queue_middle_tasks): Give an error if mixing
11044         split-stack and non-split-stack objects with -r.
11045         * i386.cc (Target_i386::relocate_section): Add
11046         reloc_symbol_changes parameter.
11047         (Target_i386::do_calls_non_split): New function.
11048         * x86_64.cc (Target_x86_64::relocate_section): Add
11049         reloc_symbol_changes parameter.
11050         (Target_x86_64::do_calls_non_split): New function.
11051         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11052         parameter.
11053         * powerpc.cc (Target_powerpc::relocate_section): Add
11054         reloc_symbol_changes parameter.
11055         * sparc.cc (Target_sparc::relocate_section): Add
11056         reloc_symbol_changes parameter.
11057         * configure.ac: Call AM_CONDITIONAL for the default target.
11058         * configure: Rebuild.
11059         * testsuite/Makefile.am (TEST_AS): New variable.
11060         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11061         (check_DATA): Add split_i386 and split_x86_64 files.
11062         (SPLIT_DEFSYMS): Define.
11063         (split_i386_[1234n].o): New targets.
11064         (split_i386_[124]): New targets.
11065         (split_i386_[1234r].stdout): New targets.
11066         (split_x86_64_[1234n].o): New targets.
11067         (split_x86_64_[124]): New targets.
11068         (split_x86_64_[1234r].stdout): New targets.
11069         (MOSTLYCLEANFILES): Add new executables.
11070         * testsuite/split_i386.sh: New file.
11071         * testsuite/split_x86_64.sh: New file.
11072         * testsuite/split_i386_1.s: New file.
11073         * testsuite/split_i386_2.s: New file.
11074         * testsuite/split_i386_3.s: New file.
11075         * testsuite/split_i386_4.s: New file.
11076         * testsuite/split_i386_n.s: New file.
11077         * testsuite/split_x86_64_1.s: New file.
11078         * testsuite/split_x86_64_2.s: New file.
11079         * testsuite/split_x86_64_3.s: New file.
11080         * testsuite/split_x86_64_4.s: New file.
11081         * testsuite/split_x86_64_n.s: New file.
11082         * testsuite/testfile.cc (Target_test): Update relocation_section
11083         function.
11084         * testsuite/Makefile.in: Rebuild.
11085
11086 2009-10-06  Ian Lance Taylor  <iant@google.com>
11087
11088         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11089         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11090         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11091         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11092         the address on ldo_addrs_.
11093         (Target_i386::Relocate::fix_up_ldo): New function.
11094
11095 2009-10-06   Rafael Espindola  <espindola@google.com>
11096
11097         * plugin.cc (add_input_library): New.
11098         (Plugin::load): Add add_input_library to tv.
11099         (Plugin_manager::add_input_file): Add the is_lib argument.
11100         (add_input_file): Update call to Plugin_manager::add_input_file.
11101         (add_input_library): New.
11102         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11103
11104 2009-09-30  Doug Kwan  <dougkwan@google.com>
11105
11106         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11107         symbol and call Symbol::may_need_copy_reloc to determine if
11108         a copy reloc is needed.
11109         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11110         nocopyreloc is given in command line.
11111         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11112         given in command line.
11113         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11114         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11115         of the removed Target_i386::may_need_copy_reloc.
11116         * options.h (copyreloc): New option with default value false.
11117         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11118         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11119         instead of the removed Target_powerpc::may_need_copy_reloc.
11120         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11121         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11122         instead of the removed Target_sparc::may_need_copy_reloc.
11123         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11124         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11125         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11126         instead of the removed Target_x86_64::may_need_copy_reloc.
11127
11128 2009-09-30  Ian Lance Taylor  <iant@google.com>
11129
11130         * object.h (class Object): Remove target_ field, and target,
11131         sized_target, and set_target methods.
11132         (Object::sized_target): Remove.
11133         (class Sized_relobj): Update declarations.  Remove sized_target.
11134         * object.cc (Sized_relobj::setup): Remove target parameter.
11135         Change all callers.
11136         (Input_objects::add_object): Don't do anything with the target.
11137         (make_elf_sized_object): Add punconfigured parameter.  Change all
11138         callers.  Set or test parameter target.
11139         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11140         Change all callers.
11141         * parameters.cc (Parameters::set_target): Change parameter type to
11142         be non-const.
11143         (Parameters::default_target): Remove.
11144         (set_parameters_target): Change parameter type to be non-const.
11145         (parameters_force_valid_target): New function.
11146         (parameters_clear_target): New function.
11147         * parameters.h (class Parameters): Update declarations.  Remove
11148         default_target method.  Add sized_target and clear_target
11149         methods.  Change target_ to be non-const.
11150         (set_parameters_target): Update declaration.
11151         (parameters_force_valid_target): Declare.
11152         (parameters_clear_target): Declare.
11153         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11154         as NULL if we aren't searching.
11155         (Add_symbols::run): Don't check for compatible target.
11156         * fileread.cc (Input_file::open_binary): Call
11157         parameters_force_valid_target.
11158         * gold.cc (queue_middle_tasks): Likewise.
11159         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11160         set_target on object.
11161         * dynobj.h (class Sized_dynobj): Update declarations.
11162         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11163         make_elf_object returns NULL.
11164         (Archive::include_member): Don't check whether object target is
11165         compatible.
11166         * output.cc (Output_section::add_input_section): Get target from
11167         parameters.
11168         (Output_section::relax_input_section): Likewise.
11169         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11170         parameters.
11171         (Sized_relobj::do_scan_relocs): Likewise.
11172         (Sized_relobj::relocate_sections): Likewise.
11173         * resolve.cc (Symbol_table::resolve): Likewise.
11174         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11175         parameter.  Change all callers.
11176         (Symbol_table::add_from_object): Get target from parameters.
11177         (Symbol_table::add_from_relobj): Don't check object target.
11178         (Symbol_table::add_from_dynobj): Likewise.
11179         (Symbol_table::define_special_symbol): Get target from
11180         parameters.
11181         * symtab.h (class Symbol_table): Update declaration.
11182         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11183         parameter.  Change all callers.  Clear parameter target.
11184         (Binary_test): Test target here.
11185         * testsuite/object_unittest.cc (gold_testsuite): Remove
11186         target_test_pointer parameter.  Change all callers.
11187         (Object_test): Test target here.
11188
11189 2009-09-26  Ian Lance Taylor  <iant@google.com>
11190
11191         * testsuite/initpri1.c: Don't try to use constructor priorities if
11192         compiling with gcc before 4.3.
11193
11194 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11195
11196         * testsuite/retain_symbols_file_test.sh (check_present): Change
11197         output file name to retain_symbols_file_test.stdout.
11198         (check_absent): Likewise.
11199
11200 2009-09-18  Craig Silverstein  <csilvers@google.com>
11201
11202         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11203         * options.cc: Include <cerrno> and <fstream>.
11204         (General_options::finalize): Parse -retain-symbols-file tag.
11205         * options.h: New flag.
11206         (General_options): New method should_retain_symbol, new
11207         variable symbols_to_retain.
11208         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11209         should_retain_symbol map.
11210         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11211         * testsuite/Makefile.in: Regenerate.
11212         * testsuite/retain_symbols_file_test.sh: New file.
11213
11214 2009-09-18  Nick Clifton  <nickc@redhat.com>
11215
11216         * po/es.po: Updated Spanish translation.
11217
11218 2009-09-17  Doug Kwan  <dougkwan@google.com>
11219
11220         * debug.h (DEBUG_RELAXATION): New constant.
11221         (DEBUG_ALL): Add DEBUG_RELAXATION.
11222         (debug_string_to_enum): Add relaxation debug option.
11223         * layout.cc
11224         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11225         Layout::Relaxation_debug_check::read_sections,
11226         Layout::Relaxation_debug_check::read_sections): New method definitions.
11227         (Layout::Layout): Initialize data members
11228         record_output_section_data_from_scrips_,
11229         script_output_section_data_list_ and relaxation_debug_check_.
11230         (Layout::save_segments, Layout::restore_segments,
11231         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11232         Layout::relaxation_loop_body): New method definitions.
11233         (Layout::finalize): Support relaxation.  Move section layout code to
11234         Layout::relaxation_loop_body.
11235         (Layout::set_asection_address_from_script): Move code for orphan
11236         section placement out.
11237         (Layout::place_orphan_sections_in_script): New method definition.
11238         * layout.h (Output_segment_headers, Output_file_header):
11239         New forward class declarations.
11240         (Layout::~Layout): Define.
11241         (Layout::new_output_section_data_from_script): New method definition.
11242         (Layout::place_orphan_sections_in_script): New method declaration.
11243         (Layout::Segment_states): New type declaration.
11244         (Layout::save_segments, Layout::restore_segments,
11245         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11246         Layout::relaxation_loop_body): New method declarations.
11247         (Layout::Output_section_data_list): New type declaration.
11248         (Layout::Relaxation_debug_check): New class definition.
11249         (Layout::record_output_section_data_from_script_,
11250         Layout::script_output_section_data_list_, Layout::segment_states_,
11251         Layout::relaxation_debug_check_): New data members.
11252         * output.cc: (Output_section_headers::do_size): New method definition.
11253         (Output_section_headers::Output_section_headers): Move size
11254         computation to Output_section_headers::do_size.
11255         (Output_segment_headers::do_size): New method definition.
11256         (Output_file_header::Output_file_header): Move size computation to
11257         Output_file_header::do_size and call it.
11258         (Output_file_header::do_size): New method definition.
11259         (Output_data_group::Output_data_group): Adjust call to
11260         Output_section_data.
11261         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11262         (Output_symtab_xindex::do_write): Add array bound check.
11263         (Output_section::Input_section::print_to_mapfile): Handle
11264         RELAXED_INPUT_SECTION_CODE.
11265         (Output_section::Output_section): Initialize data member checkpoint_.
11266         (Output_section::~Output_section): Delete checkpoint object pointed
11267         by checkpoint_.
11268         (Output_section::add_input_section): Always add an Input_section if
11269         relaxing.
11270         (Output_section::add_merge_input_section): Add assert.
11271         (Output_section::relax_input_section): New method definition.
11272         (Output_section::set_final_data_size): Set load address to zero for
11273         an unallocated section.
11274         (Output_section::do_address_and_file_offset_have_reset_values):
11275         New method definition.
11276         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11277         Handle relaxed input section.
11278         (Output_section::sort_attached_input_sections): Checkpoint input
11279         section list lazily.
11280         (Output_section::get_input_sections): Change type of input_sections to
11281         list of Simple_input_section pointers.  Checkpoint input section list
11282         lazily.  Also handle relaxed input sections.
11283         (Output_section::add_input_section_for_script): Take a reference to
11284         a Simple_input_section object instead of Relobj pointer and section
11285         index as parameter.  Handle relaxed input sections.
11286         (Output_section::save_states, Output_section::restore_states): New
11287         method definitions.
11288         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11289         (Output_data::is_data_size_fixed): New method definition.
11290         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11291         if it is fixed.
11292         (Output_data::address_and_file_offset_have_reset_values): New method
11293         definition.
11294         (Output_data::do_address_and_file_offset_have_reset_values): New method
11295         definition.
11296         (Output_data::set_data_size): Check that data size is not fixed.
11297         (Output_data::fix_data_size): New method definition.
11298         (Output_data::is_data_size_fixed_): New data member.
11299         (Output_section_headers::set_final_data_size): New method definition.
11300         (Output_section_headers::do_size): New method declaration.
11301         (Output_segment_headers::set_final_data_size): New method definition.
11302         (Output_segment_headers::do_size): New method declaration.
11303         (Output_file_header::set_final_data_size)::New method definition.
11304         (Output_file_header::do_size)::New method declaration.
11305         (Output_section_data::Output_section_data): Add new parameter
11306         is_data_size_fixed and use it to fix data size.
11307         (Output_data_const::Output_data_const): Adjust call to base class
11308         constructor and fix data size.
11309         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11310         base class constructor and fix data size.
11311         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11312         base class constructor and fix data size.
11313         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11314         class constructor and fix data size.
11315         (Output_data_group::set_final_data_size): New method definition.
11316         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11317         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11318         class constructor and fix data size.
11319         (Output_relaxed_input_section): New class definition.
11320         (Output_section::Simple_input_section): New class definition.
11321         (Output_section::get_input_sections): Adjust parameter list.
11322         (Output_section::add_input_section_for_script): Same.
11323         (Output_section::save_states, Output_section::restore_states,
11324         Output_section::do_address_and_file_offset_have_reset_values,
11325         (Output_section::Input_section::Input_section): Handle
11326         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11327         Output_relaxed_input_section.
11328         (Output_section::Input_section::is_input_section,
11329         Output_section::Input_section::set_output_section): Handle relaxed
11330         input section.
11331         (Output_section::Input_section::is_relaxed_input_section,
11332         Output_section::Input_section::output_section_data,
11333         Output_section::Input_section::relaxed_input_section): New method
11334         definitions.
11335         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11336         value.
11337         (Output_section::Input_section::u1_): Update comments.
11338         (Output_section::Input_section::u2_): Add new union member poris.
11339         (Output_section::Checkpoint_output_section): New classs definition.
11340         (Output_section::relax_input_section): New method declaration.
11341         (Output_section::checkpoint_): New data member.
11342         (Output_segment): Update comments.
11343         (Output_segment::Output_segment): Un-privatize copy constructor.
11344         (Output_segment::operator=): Un-privatize.
11345         * script-sections.cc (Output_section_element::Input_section_list):
11346         Change element type to Output_section::Simple_input_section.
11347         (Output_section_element_dot_assignment::set_section_addresses):
11348         Register output section data for relaxation clean up.
11349         (Output_data_exression::Output_data_expression): Adjust call to base
11350         constructor to fix data size.
11351         (Output_section_element_data::set_section_addresses): Register
11352         Output_data_expression object for relaxation clean up.
11353         (struct Input_section_info): Replace Relobj pointer and section index
11354         pair with Output_section::Simple_input_section and Convert struct to a
11355         class.
11356         (Input_section_sorter::operator()): Adjust access to
11357         Input_section_info data member to use accessors.
11358         (Output_section_element_input::set_section_addresses): Use layout
11359         parameter.  Adjust code to use Output_section::Simple_input_section
11360         and Input_secction_info classes.  Register filler for relaxation
11361         clean up.
11362         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11363         and section index pair with Output_section::Simple_input_section
11364         class.  Adjust code accordingly.
11365         (Phdrs_element::release_segment): New method definition.
11366         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11367         segment list.
11368         (Script_sections::release_segments): New method definition.
11369         * gold/script-sections.h (Script_sections::release_segments): New
11370         method declaration.
11371         * gold/target.h (Target::may_relax, Target::relax,
11372         Target::do_may_relax, Target::do_relax): New method definitions.
11373
11374 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11375
11376         * arm.cc (has_signed_unsigned_overflow): New function.
11377         (Arm_relocate_functions::abs8): New function.
11378         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11379         (Target_arm::Scan::global): Likewise.
11380         (Target_arm::relocate::relocate): Likewise.
11381         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11382         Likewise.
11383
11384 2009-09-16  Cary Coutant  <ccoutant@google.com>
11385
11386         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11387         * testsuite/Makefile.in: Regenerate.
11388
11389 2009-09-11  Nick Clifton  <nickc@redhat.com>
11390
11391         * po/gold.pot: Updated by the Translation project.
11392
11393 2009-09-08  Cary Coutant  <ccoutant@google.com>
11394
11395         * output.cc (Output_file::open): Add execute permission to empty file.
11396         * testsuite/Makefile.am (permission_test): New test.
11397         * testsuite/Makefile.in: Regenerate.
11398
11399 2009-09-02  Ian Lance Taylor  <iant@google.com>
11400
11401         * output.cc (Output_file::resize): Call map_no_anonymous rather
11402         than map.
11403
11404 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11405
11406         * gold.cc: Include "incremental.h".
11407         (queue_initial_tasks): Call Incremental_checker methods.
11408         * incremental.cc: Include "output.h".
11409         (Incremental_checker::can_incrementally_link_output_file): New
11410         method.
11411         * incremental.h (Incremental_checker): New class.
11412
11413         * output.cc (Output_file::open_for_modification): New method.
11414         (Output_file::map_anonymous): Changed return type to bool.  Record
11415         map in base_ field.
11416         (Output_file::map_no_anonymous): New method, broken out of map.
11417         (Output_file::map): Use map_no_anonymous and map_anonymous.
11418         * output.h (class Output_file): Update declarations.
11419
11420 2009-08-24  Cary Coutant  <ccoutant@google.com>
11421
11422         * options.h (Command_line::Pre_options): New class.
11423         (Command_line::pre_options): New member.
11424         * options.cc (gold::options::ready_to_register): New variable.
11425         (One_option::register_option): Do nothing if not registering options.
11426         Assert if same short option registered twice.
11427         (General_options::General_options): Turn off option registration when
11428         done constructing.
11429         (Command_line::Pre_options::Pre_options): New constructor.
11430
11431 2009-08-24  Cary Coutant  <ccoutant@google.com>
11432
11433         * options.h (General_options::no_keep_memory): Remove incorrect
11434         short option.
11435
11436 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11437
11438         * Makefile.am (am__skiplex, am__skipyacc): New.
11439         * Makefile.in: Regenerate.
11440
11441 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11442
11443         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11444         (INCLUDES): ... this.
11445         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11446         (AM_CPPFLAGS): Renamed from ...
11447         (INCLUDE): ... this.
11448         * Makefile.in, testsuite/Makefile.in: Regenerate.
11449
11450         * Makefile.in: Regenerate.
11451         * aclocal.m4: Likewise.
11452         * config.in: Likewise.
11453         * configure: Likewise.
11454         * testsuite/Makefile.in: Likewise.
11455
11456         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11457         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11458         * Makefile.in: Regenerate.
11459         * testsuite/Makefile.in: Regenerate.
11460
11461 2009-08-19  Cary Coutant  <ccoutant@google.com>
11462
11463         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11464         symbols in shared libraries overridden by hidden or internal symbols
11465         in the main program.
11466
11467 2009-08-19  Chris Demetriou  <cgd@google.com>
11468
11469         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11470         checking source file names in error messages.
11471
11472 2009-08-18  Doug Kwan  <dougkwan@google.com>
11473
11474         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11475         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11476         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11477         an elfcpp::Ehdr as parameter.
11478         * object.cc (Object::set_target): Remove the version that looks up
11479         a target and sets it.
11480         (Sized_relobj::setup): Take a Target object instead of
11481         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11482         (make_elf_sized_object): Find target and ask target to
11483         make an ELF object.
11484         * object.h: (Object::set_target): Remove the version that looks up
11485         a target and sets it.
11486         (Sized_relobj::setup): Take a Target object instead of
11487         an elfcpp:Ehdr as parameter.
11488         * target.cc: Include dynobj.h.
11489         (Target::do_make_elf_object_implementation): New.
11490         (Target::do_make_elf_object): New.
11491         * target.h (Target::make_elf_object): New template declaration.
11492         (Target::do_make_elf_object): New method declarations.
11493         (Target::do_make_elf_object_implementation): New template declaration.
11494
11495 2009-08-14  Ian Lance Taylor  <iant@google.com>
11496
11497         * gold.h (FUNCTION_NAME): Define.
11498         (gold_unreachable): Use FUNCTION_NAME.
11499
11500 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11501
11502         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11503         symbol in the --keep-unique list is not found.
11504
11505 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11506
11507         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11508         been maked as --keep-unique.
11509         (Icf::unfold_section): New function.
11510         * icf.h (Icf::unfold_section): New function.
11511         * options.h (General_options::keep_unique): New option.
11512         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11513         * testsuite/Makefile.in: Regenerate.
11514         * testsuite/icf_keep_unique_test.sh: New file.
11515         * testsuite/icf_keep_unique_test.cc: New file.
11516
11517 2009-08-12  Cary Coutant  <ccoutant@google.com>
11518
11519         PR 10471
11520         * resolve.cc (Symbol_table::resolve): Check for references from
11521         dynamic objects to hidden and internal symbols.
11522         * testsuite/Makefile.am (hidden_test.sh): New test.
11523         * testsuite/Makefile.in: Regenerate.
11524         * testsuite/hidden_test.sh: New script.
11525         * testsuite/hidden_test_1.c: New test source.
11526         * testsuite/hidden_test_main.c: New test source.
11527
11528 2009-08-11  Doug Kwan  <dougkwan@google.com>
11529
11530         * arm.cc: Update comments.
11531         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11532         segment to locate the .ARM.exidx section if present.
11533
11534 2009-08-09  Doug Kwan  <dougkwan@google.com>
11535
11536         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11537         patch.
11538
11539 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11540         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11541         compiler warnings.
11542
11543 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11544
11545         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11546         valid tls_segment only for non-debug-section relocations.
11547         * testsuite/Makefile.am: Add gc_tls_test.
11548         * testsuite/Makefile.in: Regenerate.
11549         * testsuite/gc_tls_test.cc: New file.
11550         * testsuite/gc_tls_test.sh: New file.
11551
11552 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11553
11554         * icf.cc: New file.
11555         * icf.h: New file.
11556         * Makefile.am (CCFILES): Add icf.cc.
11557         (HFILES): Add icf.h
11558         * Makefile.in: Regenerate.
11559         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11560         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11561         section, symbol and addend information for the relocs.
11562         * gold.cc (queue_middle_tasks): Call identical code folding.
11563         * gold.h: Add defines for multimap.
11564         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11565         to the call of finalize_local_symbols.
11566         * main.cc (main): Create object of class Icf.
11567         * object.cc (Sized_relobj::do_layout): Allow this function to be
11568         called twice during icf.
11569         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11570         to sections marked as identical by icf.
11571         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11572         when available.
11573         (Sized_relobj::do_section_entsize): New function.
11574         * object.h (Object::section_entsize): New function.
11575         (Object::do_section_entsize): New pure virtual function.
11576         (Relobj::finalize_local_symbols): Add new parameter.
11577         (Relobj::do_section_entsize): New function.
11578         * options.h (General_options::icf): New option.
11579         (General_options::icf_iterations): New option.
11580         (General_options::print_icf_sections): New option.
11581         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11582         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11583         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11584         icf.
11585         * symtab.cc (Symbol_table::is_section_folded): New function.
11586         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11587         to sections marked as identical by icf.
11588         * symtab.h (Symbol_table::set_icf): New function.
11589         (Symbol_table::icf): New function.
11590         (Symbol_table::is_section_folded): New function.
11591         (Symbol_table::icf_): New data member.
11592         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11593         * testsuite/Makefile.am: Add commands to build icf_test.
11594         * testsuite/Makefile.in: Regenerate.
11595         * testsuite/icf_test.sh: New file.
11596         * testsuite/icf_test.cc: New file.
11597
11598 2009-07-24  Chris Demetriou  <cgd@google.com>
11599
11600         * layout.cc (is_compressible_debug_section): Fix incorrect
11601         comment about compressed section names.
11602
11603 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11604
11605         PR 10419
11606         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11607
11608 2009-07-16  Ian Lance Taylor  <iant@google.com>
11609
11610         PR 10400
11611         * layout.h: #include <map>.
11612         (class Kept_section): Change from struct to class.  Add accessors
11613         and setters.  Add section size to Comdat_group mapping.  Change
11614         Comdat_group to std::map.  Add is_comdat_ field.  Add
11615         linkonce_size field in union.
11616         (class Layout): Update declaration of find_or_add_kept_section.
11617         Don't declare find_kept_object.
11618         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11619         parameter.  Add object, shndx, is_comdat, and is_group_name
11620         parameters.  Change all callers.  Adjust for new Kept_section.
11621         (Layout::find_kept_object): Remove.
11622         * object.cc (Sized_relobj::include_section_group): Update use of
11623         Kept_section.  Rename secnum to shndx.  Only record
11624         Kept_comdat_section if sections are the same size.
11625         (Sized_relobj::include_linkonce_section): Update use of
11626         Kept_section.  Only record Kept_comdat_section if sections are the
11627         same size.  Set size of linkonce section.
11628         (Sized_relobj::map_to_kept_section): Update call to
11629         get_kept_comdat_section.
11630         * object.h (class Sized_relobj): Rename fields in
11631         Kept_comdat_section to drop trailing underscores; change object
11632         field to Relobj*.  Change Kept_comdat_section_table to store
11633         struct rather than pointer.
11634         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11635         Add kept_object and kept_shndx parameters.  Change all callers.
11636         (Sized_relobj::get_kept_comdat_section): Change return type to
11637         bool.  Add kept_object and kept_shndx parameters.  Change all
11638         callers.
11639         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11640         Layout::find_or_add_kept_section.
11641
11642 2009-07-09  Ian Lance Taylor  <iant@google.com>
11643
11644         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11645         Reserve space in the hash table.
11646
11647 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11648
11649         * fileread.cc (File_read::get_mtime): New method.
11650         * fileread.h (Timespec): New structure.
11651         (File_read::get_mtime): New method.
11652         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11653         Renamed from timestamp_nsec.
11654         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11655         Elf_Xword.
11656         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11657         timestamp_nsec.
11658         (Incremental_inputs::report_archive): Save mtime; style fix.
11659         (Incremental_inputs::report_obejct): Save mtime; style fix.
11660         (Incremental_inputs::report_script): Save mtime; style fix.
11661         (Incremental_inputs::finalize_inputs): Style fix.
11662         (Incremental_inputs::finalize): Style fix.
11663         (Incremental_inputs::create_input_section_data): Store inputs
11664         mtime.
11665         * incremental.h (Incremental_inputs::report_script): Add mtime
11666         argument.
11667         (Incremental_inputs::Input_info::Input_info): Intialize only one
11668         union member.
11669         (Incremental_inputs::Input_info::archive): Move to nameless
11670         union.
11671         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11672         (Incremental_inputs::Input_info::script): Move to nameless union.
11673         (Incremental_inputs::mtime): New field.
11674         * script.cc (read_input_script): Pass file mtime to
11675         Incremental_input.
11676         * script.h (Script_info::inputs): Style fix.
11677
11678 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11679
11680         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11681         instead of 32.
11682
11683 2009-06-24  Ian Lance Taylor  <iant@google.com>
11684
11685         PR 10156
11686         * layout.cc (Layout::choose_output_section): If we find an
11687         existing section, update the flags.
11688         (Layout::create_notes): New function, broken out of
11689         Layout::finalize.
11690         (Layout::finalize): Don't create note sections.
11691         (Layout::create_note): Don't crash if linker script discards
11692         section.
11693         (Layout::create_gold_note): Likewise.
11694         (Layout::create_build_id): Likewise.  Don't set
11695         after_input_sections on the section.
11696         (Layout::create_executable_stack_info): Remove target parameter.
11697         Change caller.
11698         * layout.h (class Layout): Declare create_notes.  Update
11699         declaration of create_executable_stack_info.
11700         * gold.cc (queue_middle_tasks): Call create_notes.
11701         * output.cc (Output_section::update_flags_for_input_section): Move
11702         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11703         invalid.
11704         * output.h (Output_data::mark_address_invalid): New function.
11705         (class Output_section): Only declare, not define,
11706         update_flags_for_input_section.  Remove set_flags.
11707
11708 2009-06-24  Ian Lance Taylor  <iant@google.com>
11709
11710         * script-sections.cc (Output_section_definition::
11711         set_section_addresses): Rename shadowing local load_address to
11712         laddr.
11713
11714 2009-06-24  Ian Lance Taylor  <iant@google.com>
11715
11716         PR 10244
11717         * reloc.cc (relocate_sections): Skip empty relocation sections.
11718
11719 2009-06-23  Ian Lance Taylor  <iant@google.com>
11720
11721         PR 10156
11722         * layout.cc (Layout::create_note): Use choose_output_section
11723         rather than make_output_section.
11724
11725 2009-06-23  Ian Lance Taylor  <iant@google.com>
11726
11727         PR 10237
11728         * options.cc (General_options::parse_V): Set printed_version_.
11729         (General_options::General_options): Initialize printed_version_.
11730         * options.h (class General_options): Add printed_version_ field.
11731         * gold.cc (queue_initial_tasks): If there are no input files,
11732         don't give a fatal error if we printed the version information.
11733         (queue_middle_tasks): If using -r with a shared object, give a
11734         fatal error rather than an ordinary error.
11735
11736 2009-06-23  Ian Lance Taylor  <iant@google.com>
11737
11738         PR 10219
11739         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11740         (Layout::make_output_section): Set have_stabstr_section_ if we see
11741         a .stab*str section.
11742         (Layout::finalize): Call link_stabs_sections.
11743         (Layout::link_stabs_sections): New file.
11744         * layout.h (class Layout): Add have_stabstr_section_ field.
11745         Declare link_stabs_sections.
11746
11747 2009-06-23  Doug Kwan  <dougkwan@google.com>
11748
11749         * Makefile.am (libgold_a_LIBADD): New.
11750         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11751         * Makefile.in: Regenerate.
11752         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11753         * configure: Regenerate.
11754         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11755         * fileread.cc: Include sys/state.h
11756         * gold.h: Declare memmem and strndup if found missing.
11757         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11758
11759 2009-06-23  Ian Lance Taylor  <iant@google.com>
11760
11761         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11762         * configure: Rebuild.
11763
11764 2009-06-23  Ian Lance Taylor  <iant@google.com>
11765
11766         PR 10147
11767         * object.cc (Object::section_contents): Don't try to get a view if
11768         the section has length zero.
11769         (Object::handle_gnu_warning_section): If the section is empty, use
11770         the name of the section as the warning.
11771
11772 2009-06-23  Ian Lance Taylor  <iant@google.com>
11773
11774         PR 10133
11775         * stringpool.h (class Stringpool_template): Add optimize_ field.
11776         (Stringpool_template::set_optimize): New function.
11777         * stringpool.cc (Stringpool_template::Stringpool_template):
11778         Initialize optimize_ field.
11779         (Stringpool_template::set_string_offsets): Test local optimize
11780         fild rather than parameter.
11781         * layout.cc (Layout::Layout): Call set_optimize on the section
11782         name stringpool.
11783
11784 2009-06-22  Ian Lance Taylor  <iant@google.com>
11785
11786         PR 10030
11787         * yyscript.y: Parse TARGET.
11788         * script.cc (script_set_target): New function.
11789         * script-c.h (script_set_target): Declare.
11790         * options.cc (General_options::string_to_object_format): Rename
11791         from string_to_object_format in anonymous namespace.  Change
11792         callers.
11793         * options.h (class General_options): Declare
11794         string_to_object_format.
11795
11796 2009-06-22  Ian Lance Taylor  <iant@google.com>
11797
11798         * script-sections.cc (Script_sections::create_segments): Don't put
11799         program headers in a PT_LOAD segment if -n or -N.
11800
11801 2009-06-22  Ian Lance Taylor  <iant@google.com>
11802
11803         PR 10141
11804         * options.h (class General_options): Add -z lazy and -z now.  Sort
11805         -z options into alphabetical order.
11806         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11807
11808 2009-06-21  Ian Lance Taylor  <iant@google.com>
11809
11810         * layout.cc (Layout::make_output_section): Call
11811         Target::new_output_section.
11812         (Layout::attach_allocated_section_to_segment): Put large section
11813         sections in a separate load segment with the large segment flag
11814         set.
11815         (Layout::segment_precedes): Sort large data segments after other
11816         load segments.
11817         (align_file_offset): New static function.
11818         (Layout::set_segment_offsets): Use align_file_offset.
11819         * output.h (class Output_section): Add is_small_section_ and
11820         is_large_section_ fields.
11821         (Output_section::is_small_section): New function.
11822         (Output_section::set_is_small_section):  New function.
11823         (Output_section::is_large_section): New function.
11824         (Output_section::set_is_large_section): New function.
11825         (Output_section::is_large_data_section): New function.
11826         (class Output_segment): Add is_large_data_segment_ field.
11827         (Output_segment::is_large_data_segment): New function.
11828         (Output_segment::set_is_large_data_segment): New function.
11829         * output.cc (Output_section::Output_section): Initialize new
11830         fields.
11831         (Output_segment::Output_segment): Likewise.
11832         (Output_segment::add_output_section): Add assertion that large
11833         data sections always go in large data segments.  Force small data
11834         sections to the end of the list of data sections.  Force small BSS
11835         sections to the start of the list of BSS sections.  For large BSS
11836         sections to the end of the list of BSS sections.
11837         * symtab.h (class Symbol): Declare is_common_shndx.
11838         (Symbol::is_defined): Check Symbol::is_common_shndx.
11839         (Symbol::is_common): Likewise.
11840         (class Symbol_table): Define enum Commons_section_type.  Update
11841         declarations.  Add small_commons_ and large_commons_ fields.
11842         * symtab.cc (Symbol::is_common_shndx): New function.
11843         (Symbol_table::Symbol_table): Initialize new fields.
11844         (Symbol_table::add_from_object): Put small and large common
11845         symbols in the right list.
11846         (Symbol_table::sized_finalized_symbol): Check
11847         Symbol::is_common_shndx.
11848         (Symbol_table::sized_write_globals): Likewise.
11849         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11850         common symbol lists.  Don't call do_allocate_commons_list if the
11851         list is empty.
11852         (Symbol_table::do_allocate_commons_list): Remove is_tls
11853         parameter.  Add comons_section_type parameter.  Change all
11854         callers.  Handle small and large common symbols.
11855         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11856         Symbol::is_common_shndx.
11857         * resolve.cc (symbol_to_bits): Likewise.
11858         * target.h (Target::small_common_shndx): New function.
11859         (Target::small_common_section_flags): New function.
11860         (Target::large_common_shndx): New function.
11861         (Target::large_common_section_flags): New function.
11862         (Target::new_output_section): New function.
11863         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11864         small_common_section_flags, and large_common_section_flags
11865         fields.
11866         (Target::do_new_output_section): New virtual function.
11867         * arm.cc (Target_arm::arm_info): Initialize new fields.
11868         * i386.cc (Target_i386::i386_info): Likewise.
11869         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11870         Likewise.
11871         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11872         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11873         (Target_x86_64::do_new_output_section): New function.
11874         * configure.ac: Define conditional MCMODEL_MEDIUM.
11875         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11876         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11877         (large_LDFLAGS): Define.
11878         * testsuite/large.c: New file.
11879         * testsuite/testfile.cc (Target_test::test_target_info):
11880         Initialize new fields.
11881         * configure, testsuite/Makefile.in: Rebuild.
11882
11883 2009-06-05  Doug Kwan  <dougkwan@google.com>
11884
11885         * Makefile.am (CCFILES): Add target.cc.
11886         * Makefile.in: Regenerate.
11887         * i386.cc (class Target_i386): Define new virtual method to
11888         override do_is_local_label_name in parent.
11889         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11890         local symbols if --discard-locals or -X is given.
11891         * options.h (class General_options): Declare new options
11892         '--discard-locals' and '-X' for discarding locals.
11893         * target.h (class Target): Define new methods is_local_label_name.
11894         Declare new virtual method do_is_local_label_name.
11895         * target.cc: New file.
11896         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11897         (check_SCRIPTS): Add discard_locals_test.sh.
11898         (check_DATA): Add discard_local_tests.syms.
11899         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11900         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11901         * testsuite/Makefile.in: Regenerate.
11902         * testsuite/discard_locals_test.c: New file.
11903         * testsuite/discard_locals_test.sh: Same.
11904
11905 2009-06-05  Doug Kwan  <dougkwan@google.com>
11906
11907         * object.cc (Sized_relobj::Sized_relobj): Initialize
11908         discarded_eh_frame_shndx_ to -1U.
11909         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11910         section.
11911         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11912         a discarded .eh_frame section.
11913         (Sized_relobj::do_finalize_local_symbols): Ditto.
11914         * object.h (class Sized_relobj): Declare new member
11915         discarded_eh_frame_shndx_.
11916         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11917         (local_labels_test.o, local_labels_test): New rules.
11918         * testsuite/Makefile.in: Regenerate.
11919
11920 2009-06-04  Doug Kwan  <dougkwan@google.com>
11921
11922         * layout.cc (Layout::section_name_mapping): Add mapping for
11923         special ARM sections.
11924
11925 2009-06-03  Doug Kwan  <dougkwan@google.com>
11926
11927         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11928         (utils::has_overflow): Same.
11929
11930 2009-06-03  Ian Lance Taylor  <iant@google.com>
11931
11932         * layout.cc (Layout::section_name_mapping): New array, replacing
11933         Layout::linkonce_mapping.
11934         (Layout::section_name_mapping_count): New variable, replacing
11935         Layout::linkonce_mapping_count.
11936         (Layout::linkonce_output_name): Remove.
11937         (Layout::output_section_name): Rewrite.
11938         * layout.h (class Layout): Rename Linkonce_mapping to
11939         Section_name_mapping, linkonce_mapping to section_name_mapping,
11940         linkonce_mapping_count to section_name_mapping_count.  Don't
11941         declare linkonce_output_name.
11942
11943 2009-06-03  Doug Kwan  <dougkwan@google.com>
11944
11945         * gold/arm.cc (namespace utils): New.
11946         (Target_arm::reloc_is_non_pic): Define new method.
11947         (class Arm_relocate_functions): New.
11948         (Target_arm::Relocate::relocate): Handle relocation types used by
11949         Android.
11950
11951 2009-06-03  Ian Lance Taylor  <iant@google.com>
11952
11953         * arm.cc (Target_arm::scan::global): Use || instead of |.
11954
11955 2009-06-02  Doug Kwan  <dougkwan@google.com>
11956
11957         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11958         issued_non_pic_error_.
11959         (class Target_arm::Scan): Declare new method check_non_pic.
11960         Define new method symbol_needs_plt_entry.
11961         Declare new data member issued_non_pic_error_.
11962         (class Target_arm::Relocate): Declare new method
11963         should_apply_static_reloc.
11964         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11965         (Target_arm::Scan::check_non_pic): Define new method.
11966         (Target_arm::Scan::local): Handle a small subset of reloc types used
11967         by Android.
11968         (Target_arm::Scan::local): Same.
11969         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11970
11971 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11972
11973         * incremental.cc (Incremental_inputs::report_command_line): Filter
11974         out --incremental-* options.
11975
11976 2009-05-29  Doug Kwan  <dougkwan@google.com>
11977
11978         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11979         template class.
11980         (class Target_arm): Update comment.
11981         (Target_arm::Target_arm): Initialize new data members GOT_,
11982         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11983         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11984         and Target_arm::rel_dyn_section.
11985         Declare new_enum Target_arm::Got_type.
11986         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11987         and DYNBSS_.
11988         Update commments for member do_dynsym_value.
11989         (Target_arm::got_size, Target_arm::plt_section,
11990         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11991         new methods inside class defintion.
11992         (Target_arm::got_section): Define new method.
11993         (Target_arm::rel_dyn_section): Same.
11994         (Output_data_plt_arm): New template class.
11995         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11996         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11997         (Output_data_plt_arm::add_entry): Same.
11998         (Output_data_plt_arm::first_plt_entry): Define new
11999         static data member for PLT instruction template.
12000         (Output_data_plt_arm::plt_entry): Same.
12001         (Output_data_plt_arm::do_write): Define new method.
12002         (Target_arm::make_plt_entry): Same.
12003         (Target_arm::do_finalize_sections): Same.
12004         (Target_arm::do_dynsym_value): Same.
12005
12006 2009-05-28  Doug Kwan  <dougkwan@google.com>
12007
12008         * Makefile.am (TARGETSOURCES): Add arm.cc.
12009         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12010         * Makefile.in: Regenerate.
12011         * arm.cc: New file.
12012         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12013
12014 2009-05-26  Doug Kwan  <dougkwan@google.com>
12015
12016         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12017         (General_options::check_excluded_libs): Strip off directories in
12018         archive name before matching like GNU ld does.
12019         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12020         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12021         (exclude_libs_test_LDFLAGS): Add linker option
12022         -Wl,--exclude-libs,libexclude_libs_test_3
12023         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12024         an explicit archive without using -l.
12025         (alt/libexclude_libs_test_3.a): New make rule.
12026         * testsuite/Makefile.in: Regenerate.
12027         * testsuite/exclude_libs_test.c : Declare lib3_default().
12028         (main): Call it.
12029         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12030         * exclude_libs_test_3.c: New file.
12031
12032 2009-05-26  Nick Clifton  <nickc@redhat.com>
12033
12034         * po/id.po: New Indonesian translation.
12035         * po/gold.pot: Updated template file.
12036
12037 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12038
12039         * testsuite/Makefile.am: Add -ffunction-sections to compile
12040         gc_comdat_test files.  Add -Wl,--gc-sections to build
12041         gc_comdat_test.
12042         * testsuite/Makefile.in: Regenerate.
12043         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12044
12045 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12046
12047         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12048         kept comdat section was garbage collected.
12049         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12050         * testsuite/Makefile.in: Regenerate.
12051         * testsuite/gc_comdat_test.sh: New file.
12052         * testsuite/gc_comdat_test_1.cc: New file.
12053         * testsuite/gc_comdat_test_2.cc: New file.
12054
12055 2009-05-19  Doug Kwan  <dougkwan@google.com>
12056
12057         * archive.cc (Archive::Archive): Move constructor from archive.h
12058         to here.  Initialize no_export_.
12059         (Archive::get_elf_object_for_member): Set no_export flag of object.
12060         * archive.h (Archive::Archive): Move constructor body to
12061         archive.cc.
12062         (Archive::no_export): New method.
12063         (Archive::no_export_): New field.
12064         * object.h (Object::Object): Initialize no_export_ to false.
12065         (Object::no_export, Object::set_no_export): New methods.
12066         (Object::no_export_): New field.
12067         * options.cc (General_options::parse_exclude_libs): New method.
12068         (General_options::check_excluded_libs) Same.
12069         * options.h (exclude_libs): New option.
12070         (General_options::check_excluded_libs): New method declaration.
12071         (General_options::excluded_libs_): New field.
12072         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12073         default or protected visibility if an object has no-export flag set.
12074         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12075         (check_SCRIPTS): Add exclude_libs_test.sh.
12076         (check_DATA): Add exclude_libs_test.syms.
12077         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12078         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12079         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12080         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12081         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12082         libexclude_libs_test_2.a): New rules.
12083         * testsuite/Makefile.in: Regenerate.
12084         * testsuite/exclude_libs_test.c: New file.
12085         * testsuite/exclude_libs_test.sh: Ditto.
12086         * testsuite/exclude_libs_test_1.c: Ditto.
12087         * testsuite/exclude_libs_test_2.c: Ditto.
12088
12089 2009-05-15  Ian Lance Taylor  <iant@google.com>
12090
12091         * configure.ac: Check for declarations for cases where libiberty.h
12092         checks HAVE_DECL_xxx.
12093         * configure, config.in: Rebuild.
12094
12095 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12096
12097         * gold.h (Incremental_argument_list): Remove (invalid) forward
12098         declaration.
12099         * incremental.cc (Incremental_inputs::report_achive): New method.
12100         (Incremental_inputs::report_object): New method.
12101         (Incremental_inputs::report_script): New method.
12102         (Incremental_inputs::finalize_inputs): New method.
12103         (Incremental_inputs::finalize): Call finalize_inputs().
12104         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12105         Create inputs entries.
12106         * incremental.h (Incremental_input_type): New enum.
12107         (Incremental_inputs::Incremental_input): Initialize new fields.
12108         (Incremental_inputs::report_inputs): New method.
12109         (Incremental_inputs::report_achive): New method.
12110         (Incremental_inputs::report_object): New method.
12111         (Incremental_inputs::report_script): New method.
12112         (Incremental_inputs::finalize_inputs): New method.
12113         (Incremental_inputs::Input_info): New struct.
12114         (Incremental_inputs::Input_info_map): New typedef.
12115         (Incremental_inputs::lock_): New field.
12116         (Incremental_inputs::Inputs_): New field.
12117         (Incremental_inputs::Inputs_map): New field.
12118         * main.cc (main): Call Incremental_input::report_inputs.
12119         * options.h (Input_argument_list): Typedef moved from
12120         Input_arguments.
12121         (Input_file_group::Files): Remove, use ::Input_argument_list.
12122         (Input_file_group::Input_argument_list): Remove, use
12123         ::Input_argument_list.
12124         * plugin.cc (Plugin_manager::add_input_file): Add error in
12125         incremental build.
12126         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12127         functions.
12128         * script.cc (read_input_script): Call
12129         Incremental_input::report_script.
12130         * script.h (Script_info): New class.
12131
12132 2009-04-27  Ian Lance Taylor  <iant@google.com>
12133
12134         * x86_64.cc (do_adjust_output_section): Set entsize to
12135         plt_entry_size.
12136
12137 2009-04-23  Elliott Hughes  <enh@google.com>
12138
12139         * output.cc (Output_file::close): After short writes, continue
12140         writing from the correct offset in the buffer being written.
12141
12142 2009-04-23  Chris Demetriou  <cgd@google.com>
12143
12144         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12145         * configure: Regenerate.
12146         * config.in: Regenerate.
12147         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12148         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12149
12150 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12151
12152         * incremental.cc (Incremental_inputs_header_data): Renamed from
12153         Incremental_input_header_data.
12154         (Incremental_inputs_header_data::data_size): New field.
12155         (Incremental_inputs_header_data::put_input_file_count): Renamed
12156         from input_file_count.
12157         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12158         from command_line_offset.
12159         (Incremental_inputs_header_data::put_reserved): Renamed from
12160         put_reserved.
12161         (Incremental_inputs_entry_data): Renamed from
12162         Incremental_input_entry_data.
12163         (Incremental_inputs_entry_data::data_size): New field.
12164         (Incremental_inputs::report_command_line): New method.
12165         (Incremental_inputs::finalize): New method.
12166         (Incremental_inputs::create_incremental_inputs_data): New method.
12167         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12168         * incremental.h: New file.
12169         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12170         (Layout::finalize): Create incremental inputs section in
12171         incremental builds.
12172         (Layout::create_incremental_info_sections): New method.
12173         * layout.h (Layout::incremental_inputs): New method.
12174         (Layout::create_incremental_info_sections): New method.
12175         (Layout::incremental_inputs_): New field.
12176         * main.cc (main): Notify Incremental_input of the command line.
12177
12178 2009-04-01  Ian Lance Taylor  <iant@google.com>
12179             Mikolaj Zalewski  <mikolajz@google.com>
12180
12181         * gold.h (reserve_unordered_map): Define, three versions, one for
12182         each version of Unordered_map.
12183         * layout.cc (Layout::Layout): Remove options parameter.  Add
12184         number_of_input_files parameter.  Don't initialize options_.
12185         Initialize number_of_input_files_ and resized_signatures_.  Move
12186         sections_are_attached_.
12187         (Layout::layout_group): Reserve space for group_signatures_.
12188         (Layout::find_or_add_kept_section): Change name parameter to be a
12189         reference.  Resize signatures_ map when it gets large enough.
12190         (Layout::layout_eh_frame): Use parameters->options() instead of
12191         this->options_.
12192         (Layout::make_output_section): Likewise.
12193         (Layout::attach_allocated_section_to_segment): Likewise.
12194         (Layout::finalize, Layout::create_executable_stack): Likewise.
12195         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12196         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12197         * layout.h (class Layout): Update declarations.  Remove options_
12198         field.  Add number_of_input_files_ and resized_signatures_
12199         fields.  Move sections_are_attached_ field.
12200         * main.cc (main): Pass number of input files to Layout
12201         constructor.  Don't pass options.
12202
12203 2009-03-30  Ian Lance Taylor  <iant@google.com>
12204
12205         * ffsll.c (ffsll): Correct implementation.
12206
12207 2009-03-27  Ian Lance Taylor  <iant@google.com>
12208
12209         * ffsll.c: New file.
12210         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12211         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12212         * ftruncate.c (ftruncate): Declare before definition.
12213         * mremap.c (mremap): Likewise.
12214         * pread.c (pread): Likewise.
12215         * configure, Makefile.in, config.in: Rebuild.
12216
12217         * mremap.c: New file.
12218         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12219         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12220         (mremap): Declare if HAVE_MREMAP is not defined.
12221         * configure, Makefile.in, config.in: Rebuild.
12222
12223 2009-03-27  Cary Coutant  <ccoutant@google.com>
12224
12225         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12226         position independent.
12227         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12228         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12229
12230 2009-03-24  Cary Coutant  <ccoutant@google.com>
12231
12232         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12233         an executable.
12234         (needs_dynamic_reloc): Likewise.
12235
12236 2009-03-24  Ian Lance Taylor  <iant@google.com>
12237
12238         * yyscript.y (file_cmd): Recognize EXTERN.
12239         (extern_name_list, extern_name_list_body): New nonterminals.
12240         * script.cc (script_add_extern): Define.
12241         * script-c.h (script_add_extern): Declare.
12242
12243 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12244
12245         * object.cc (is_elf_object): Define.
12246         * object.h (is_elf_object): Declare.
12247         * archive.cc (Archive::get_elf_object_for_member): Call
12248         is_elf_object.
12249         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12250
12251 2009-03-24  Elliott Hughes  <enh@google.com>
12252
12253         * output.cc (Output_file::map_anonymous): Define.
12254         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12255         try an anonymous one.  Report the size if the mmap fails.
12256         * output.h (class Output_file): Declare map_anonymous.
12257
12258 2009-03-24  Ian Lance Taylor  <iant@google.com>
12259
12260         * target-select.cc (instantiate_target): Don't acquire the lock if
12261         the instantiated_target_ field has already been set.
12262
12263 2009-03-23  Ian Lance Taylor  <iant@google.com>
12264
12265         * gold-threads.h (class Initialize_lock): Define.
12266         * gold-threads.cc (class Initialize_lock_once): Define.
12267         (initialize_lock_control): New static variable.
12268         (initialize_lock_pointer): New static variable.
12269         (initialize_lock_once): New static function.
12270         (Initialize_lock::Initialize_lock): Define.
12271         (Initialize_lock::initialize): Define.
12272         * target-select.h: Include "gold-threads.h".
12273         (class Target_selector): Add lock_ and initialize_lock_ fields.
12274         Don't define instantiate_target, just declare it.
12275         * target-select.cc (Target_selector::Target_selector): Initialize
12276         new fields.
12277         (Target_selector::instantiate_target): Define.
12278         * descriptors.h: Include "gold-threads.h".
12279         (class Descriptors): Add initialize_lock_ field.
12280         * descriptors.cc (Descriptors::Descriptors): Initialize new
12281         field.
12282         (Descriptors::open): Use initialize_lock_ field
12283         * errors.h (class Errors): Add initialize_lock_ field.
12284         * errors.cc (Errors::Errors): Initialize new field.
12285         (Errors::initialize_lock): Use initialize_lock_ field.
12286         * powerpc.cc (class Target_selector_powerpc): Remove
12287         instantiated_target_ field.  In do_recognize call
12288         instantiate_target rather than do_instantiate_target.  In
12289         do_instantiate_target just allocate a new target.
12290         * sparc.cc (class Target_selector_sparc): Likewise.
12291
12292         * freebsd.h: New file.
12293         * i386.cc: Include "freebsd.h".
12294         (Target_i386): Derive from Target_freebsd rather than
12295         Sized_target.
12296         (Target_selector_i386): Derive from Target_selector_freebsd rather
12297         than Target_selector.
12298         * x86_64.cc: Include "freebsd.h".
12299         (Target_x86_64): Derive from Target_freebsd rather than
12300         Sized_target.
12301         (Target_selector_x86_64): Derive from Target_selector_freebsd
12302         rather than Target_selector.
12303         * target.h (class Target): Add adjust_elf_header and
12304         do_adjust_elf_header.
12305         * output.cc (Output_file_header:: do_sized_write): Call target
12306         adjust_elf_header routine.
12307         * configure.tgt: Set targ_osabi.
12308         * configure.ac: Define GOLD_DEFAULT_OSABI.
12309         * parameters.cc (Parameters::default_target): Pass
12310         GOLD_DEFAULT_OSABI to select_target.
12311         * target-select.h (class Target_selector): Make instantiate_target
12312         protected rather than private.
12313         * Makefile.am (HFILES): Add freebsd.h.
12314         * configure, Makefile.in, config.in: Rebuild.
12315
12316         * merge.cc (do_add_input_section): Correct pend value.  Change
12317         message about last entry not being null terminated from error to
12318         warning.
12319
12320 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12321
12322         * incremental.cc: New file.
12323         * Makefile.am (CCFILES): Add incremental.cc.
12324         * Makefile.in: Rebuild.
12325
12326 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12327
12328         * layout.cc (Layout::output_section_name): Preserve names
12329         of '.note.' sections.
12330
12331 2009-03-19  Ian Lance Taylor  <iant@google.com>
12332
12333         * descriptors.cc (Descriptors::open): Check that the options are
12334         valid before using them.
12335
12336 2009-03-18  Ian Lance Taylor  <iant@google.com>
12337
12338         * script-sections.h: Include <list>.
12339         (class Script_sections): Change Sections_elements from std::vector
12340         to std::list.  Typedef public Elements_iterator.  Add
12341         orphan_section_placement_, data_segment_align_start_, and
12342         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12343         field.
12344         * script-sections.cc (class Orphan_section_placement): New class.
12345         (class Sections_element): Add virtual functions is_relro and
12346         orphan_section_init.  Remove virtual function place_orphan_here.
12347         (class Output_section_definition): Add is_relro and
12348         orphan_section_init.  Remove place_orphan_here.
12349         (class Orphan_output_section): Likewise.
12350         (Script_sections::Script_sections): Update for field changes.
12351         (Script_sections::data_segment_align): Set saw_data_segment_align_
12352         and data_segment_align_start_, not data_segment_align_index.
12353         (Script_sections::data_segment_relro_end): Check
12354         saw_data_segment_align_.  Use data_segment_align_start_ rather
12355         than data_segment_align_index_.
12356         (Script_sections::place_orphan): Rewrite to use
12357         Orphan_section_placement.
12358
12359 2009-03-17  Ian Lance Taylor  <iant@google.com>
12360
12361         * archive.cc (Archive::add_symbols): Check for a version attached
12362         to the symbol name in the archive map.
12363         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12364         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12365         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12366         (ver_test_11.a): New target.
12367         * testsuite/Makefile.in: Rebuild.
12368
12369         * configure.ac: Check for chsize and posix_fallocate.  Replace
12370         ftruncate.
12371         * ftruncate.c: New file, from gnulib.
12372         * output.cc (posix_fallocate): Define dummy version if not
12373         HAVE_POSIX_FALLOCATE.
12374         (Output_file::map): Call posix_fallocate rather than lseek and
12375         write.
12376         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12377         * configure, Makefile.in, config.in: Rebuild.
12378
12379 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12380
12381         * layout.h (Layout::create_note): Add section_name parameter.
12382         * layout.cc (Layout::create_note): Likewise.
12383         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12384
12385 2009-03-17  Ian Lance Taylor  <iant@google.com>
12386
12387         * descriptors.cc: Include "options.h".
12388         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12389         (Descriptors::open): Always use O_CLOEXEC when opening a new
12390         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12391         then set FD_CLOEXEC.
12392
12393         * sparc.cc (class Target_sparc): Add has_got_section.
12394         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12395         make sure we have a GOT section.
12396
12397         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12398         (Target_sparc::Scan::local): Likewise.
12399         (Target_sparc::Scan::global): Likewise.
12400         (Target_sparc::Relocate::relocate): Likewise.
12401         (Target_sparc::Relocate::relocate_tls): Likewise.
12402
12403         * symtab.cc (Symbol_table::define_default_version): New function,
12404         broken out of add_from_object.
12405         (Symbol_table::add_from_object): Call define_default_version.
12406         (Symbol_table::define_special_symbol): Add resolve_oldsym
12407         parameter.  Change all callers.  If the version for a symbol comes
12408         from a version script, resolve it with the symbol with the same
12409         name with no version.  Also add the symbol without a version if
12410         appropriate.
12411         (do_define_in_output_data): If resolving with oldsym, don't delete
12412         sym.
12413         (do_define_in_output_segment): Likewise.
12414         (do_define_as_constant): Likewise.
12415         * symtab.h (class Symbol_table): Update declarations.
12416
12417 2009-03-13  Ian Lance Taylor  <iant@google.com>
12418
12419         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12420         (Read_symbols::requeue): New function.
12421         (Read_symbols::do_read_symbols): If make_elf_object fails because
12422         the target type is not configured, and the file was searched for,
12423         issue a warning and retry with the next directory.
12424         (Add_symbols::run): If the file has an incompatible format, and
12425         it was searched for, requeue the Read_symbols task.  On error,
12426         release the object.
12427         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12428         dirindex parameter to constructor.  Change all callers.  Declare
12429         incompatible_warning and requeue.
12430         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12431         input_argument_ and input_group_ fields.  Add them to
12432         constructor.  Change all callers.
12433         (class Read_script): Add dirindex_ field.  Add it to constructor.
12434         Change all callers.
12435         * archive.cc (Archive::setup): Remove input_objects parameter.
12436         Change all callers.
12437         (Archive::get_file_and_offset): Likewise.
12438         (Archive::read_all_symbols): Likewise.
12439         (Archive::read_symbols): Likewise.
12440         (Archive::get_elf_object_for_member): Remove input_objects
12441         parameter.  Add punconfigured parameter.  Change all callers.
12442         (Archive::add_symbols): Change return type to bool.  Check return
12443         value of include_member.
12444         (Archive::include_all_members): Likewise.
12445         (Archive::include_member): Change return type to bool.  Return
12446         false if first included object has incompatible target.  Set
12447         included_member_ field.
12448         (Add_archive_symbols::run): If add_symbols returns false, requeue
12449         Read_symbols task.
12450         * archive.h (class Archive): Add included_member_ field.
12451         Initialize it in constructor.  Add input_file and searched_for
12452         methods.  Update declarations.
12453         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12454         input_argument_ fields.  Add them to constructor.  Change all
12455         callers.
12456         * script.cc: Include "target-select.h".
12457         (class Parser_closure): Add skip_on_incompatible_target_ and
12458         found_incompatible_target_ fields.  Add
12459         skip_on_incompatible_target parameter to constructor.  Change all
12460         callers.  Add methods skip_on_incompatible_target,
12461         clear_skip_on_incompatible_target, found_incompatible_target, and
12462         set_found_incompatible_target.
12463         (read_input_script): Add dirindex parameter.  Change all callers.
12464         If parser finds an incompatible target, requeue Read_symbols
12465         task.
12466         (script_set_symbol): Clear skip_on_incompatible_target in
12467         closure.
12468         (script_add_assertion, script_parse_option): Likewise.
12469         (script_start_sections, script_add_phdr): Likewise.
12470         (script_check_output_format): New function.
12471         * script.h (read_input_script): Update declaration.
12472         * script-c.h (script_check_output_format): Declare.
12473         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12474         (ignore_cmd): Remove OUTPUT_FORMAT.
12475         * fileread.cc (Input_file::Input_file): Add explicit this.
12476         (Input_file::will_search_for): New function.
12477         (Input_file::open): Add pindex parameter.  Change all callers.
12478         * fileread.h (class Input_file): Add input_file_argument method.
12479         Declare will_search_for.  Update declarations.
12480         * object.cc (make_elf_object): Add punconfigured parameter.
12481         Change all callers.
12482         * object.h (class Object): Make input_file public.  Add
12483         searched_for method.
12484         (make_elf_object): Update declaration.
12485         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12486         restart search.
12487         * dirsearch.h (class Dirsearch): Update declaration.
12488         * options.h (class General_options): Add --warn-search-mismatch.
12489         * parameters.cc (Parameters::is_compatible_target): New function.
12490         * parameters.h (class Parameters): Declare is_compatible_target.
12491         * workqueue.cc (Workqueue::add_blocker): New function.
12492         * workqueue.h (class Workqueue): Declare add_blocker.
12493
12494         * fileread.cc (Input_file::open): Remove options parameter.
12495         Change all callers.
12496         (Input_file::open_binary): Likewise.
12497         * script.cc (read_input_script): Likewise.
12498         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12499         options parameter from constructor.  Change all callers.
12500         (class Read_script): Likewise.
12501         * fileread.h (class Input_file): Update declarations.
12502         * script.h (read_input_script): Update declaration.
12503
12504 2009-03-10  Nick Clifton  <nickc@redhat.com>
12505
12506         * po/es.po: New Spanish translation.
12507
12508 2009-03-06  Cary Coutant  <ccoutant@google.com>
12509
12510         * options.cc (parse_short_option): Keep dash_z from registering itself.
12511
12512 2009-03-03  Ian Lance Taylor  <iant@google.com>
12513
12514         PR 9918
12515         * target-reloc.h (relocate_section): Pass output_section to
12516         relocate.
12517         * i386.cc (Target_i386::should_apply_static_reloc): Add
12518         output_section parameter.  Change all callers.
12519         (Target_i386::Relocate::relocate): Add output_section parameter.
12520         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12521         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12522         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12523         * testsuite/two_file_shared.sh: New script.
12524         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12525         (check_DATA): Add two_file_shared.dbg.
12526         (two_file_shared.dbg): New target.
12527         * testsuite/Makefile.in: Rebuild.
12528
12529 2009-03-01  Ian Lance Taylor  <iant@google.com>
12530
12531         * configure.ac: Check for byteswap.h.
12532         * configure: Rebuild.
12533         * config.in: Rebuild.
12534
12535 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12536
12537         * layout.cc (Layout::find_or_add_kept_section): New function.
12538         (Layout::add_comdat): Removed.
12539         * layout.h (struct Kept_section): Move out of class Layout.
12540         Remove trailing underscores from field names.  Add group_sections
12541         field.  Rename group_ field to is_group.  Change all uses.
12542         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12543         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12544         comdat_groups_ field.
12545         (Sized_relobj::include_section_group): Use
12546         find_or_add_kept_section and Kept_section::group_sections.
12547         (Sized_relobj::include_linkonce_section): Likewise.
12548         * object.cc (class Sized_relobj): Don't define Comdat_group or
12549         Comdat_group_table.  Remove find_comdat_group and
12550         add_comdat_group.  Remove comdat_groups_ field.
12551         * plugin.cc (include_comdat_group): Use
12552         Layout::find_or_add_kept_section.
12553
12554 2009-02-28  Ian Lance Taylor  <iant@google.com>
12555
12556         * README: --gc-sections and map files are now supported.  Document
12557         some build requirements.
12558
12559         PR 6992
12560         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12561         relocatable link set the value of the section symbol to zero.
12562         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12563         relocatable link don't include the section address in the local
12564         symbol value.
12565
12566 2009-02-27  Ian Lance Taylor  <iant@google.com>
12567
12568         PR 6811
12569         * options.h (class Search_directory): Add is_system_directory.
12570         (class General_options): Declare is_in_system_directory.
12571         * options.cc (get_relative_sysroot): Make static.
12572         (get_default_sysroot): Make static.
12573         (General_optoins::is_in_system_directory): New function.
12574         * fileread.cc (Input_file::is_in_system_directory): New function.
12575         * fileread.h (class Input_file): Declare is_in_system_directory.
12576         * object.h (class Object): Add is_in_system_directory.
12577         (class Input_objects): Remove system_library_directory_ field.
12578         * object.cc (Input_objects::add_object): Don't set
12579         system_library_directory_.
12580         (input_objects::found_in_system_library_directory): Remove.
12581         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12582         parameter.  Change all callers.
12583         (Symbol_table::sized_write_globals): Likewise.
12584         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12585         Call Object::is_in_system_directory.
12586         * symtab.h (class Symbol_table): Update declarations.
12587
12588         PR 5990
12589         * descriptors.h (Open_descriptor): Add is_on_stack field.
12590         * descriptors.cc (Descriptors::open): If the descriptor is on the
12591         top of the stack, remove it.  Initialize is_on_stack field.
12592         (Descriptors::release): Only add pod to stack if it is not on the
12593         stack already.
12594         (Descriptors::close_some_descriptor): Clear stack_next and
12595         is_on_stack fields.
12596
12597         PR 7091
12598         * output.cc (Output_section::find_starting_output_address): Rename
12599         from starting_output_address; add PADDR parameter; change return
12600         type.
12601         * output.h (class Output_section): Declare
12602         find_starting_output_address instead of starting_output_address.
12603         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12604         section symbol for which we can't find a merge section.
12605
12606         PR 9836
12607         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12608         hidden or internal, force the symbol to be local.
12609         * resolve.cc (Symbol::override_visibility): Define.
12610         (Symbol::override_base): Use override_visibility.
12611         (Symbol_table::resolve): Likewise.
12612         (Symbol::override_base_with_special): Likewise.
12613         (Symbol_table::override_with_special): If the visibility is hidden
12614         or internal, force the symbol to be local.
12615         * symtab.h (class Symbol): Add set_visibility and
12616         override_visibility.
12617         * testsuite/ver_test_1.sh: New file.
12618         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12619         (check_DATA): Add ver_test_1.syms.
12620         (ver_test_1.syms): New target.
12621         * testsuite/Makefile.in: Rebuild.
12622
12623 2009-02-25  Cary Coutant  <ccoutant@google.com>
12624
12625         * layout.cc (Layout::choose_output_section): Don't rename sections
12626         when using a linker script that has a SECTIONS clause.
12627         * Makefile.in: Regenerate.
12628
12629         * testsuite/Makefile.am (script_test_5.sh): New test case.
12630         * testsuite/Makefile.in: Regenerate.
12631         * testsuite/script_test_5.cc: New file.
12632         * testsuite/script_test_5.sh: New file.
12633         * testsuite/script_test_5.t: New file.
12634
12635 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12636
12637         * archive.cc (Archive::include_member): Update calls to add_symbols.
12638         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12639         the Layout argument.
12640         * dynobj.h (do_add_symbols): Add the Layout argument.
12641         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12642         Layout argument.
12643         * object.h (Object::add_symbols): Add the Layout argument.
12644         (Object::do_add_symbols): Add the Layout argument.
12645         (Sized_relobj::do_add_symbols): Add the Layout argument.
12646         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12647         Unify the two versions.
12648         (Add_plugin_symbols): Remove.
12649         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12650         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12651         (Add_plugin_symbols): Remove.
12652         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12653         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12654         (Add_symbols::run): Make it work with Pulginobj.
12655
12656 2009-02-06  Ian Lance Taylor  <iant@google.com>
12657
12658         * object.cc (Sized_relobj::do_layout): Make info message start
12659         with lower case letter.
12660
12661 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12662
12663         * binary.cc: Fix file comment.
12664
12665         * options.h (enum Incremental_disposition): Define.
12666         (class General_options): Add new options: --incremental,
12667         --incremental_changed, --incremental_unchanged,
12668         --incremental_unknown.  Add incremental_disposition_ and
12669         implicit_incremental_ fields.
12670         (General_options::incremental_disposition): New function.
12671         (class Position_dependent_options): Add incremental_disposition
12672         option.
12673         (Position_dependent_options::copy_from_options): Set incremental
12674         dispositions.
12675         * options.cc (General_options::parse_incremental_changed): New
12676         function.
12677         (General_options::parse_incremental_unchanged): New function.
12678         (General_options::parse_incremental_unknown): New function.
12679         (General_options::General_options): Initialize new fields
12680         incremental_disposition_ and implicit_incremental_.
12681         (General_options::finalize): Check for uasge of --incremental-*
12682         without --incremental.
12683
12684 2009-02-06  Chris Demetriou  <cgd@google.com>
12685
12686         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12687         pointer and to report location as the file name associated with
12688         the symbol.
12689         (gold_undefined_symbol_at_location): New function to replace the
12690         old gold_undefined_symbol functionality.
12691         * target-reloc.h (relocate_section): Update to use
12692         gold_undefined_symbol_at_location.
12693         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12694         Call gold_undefined_symbol function rather than gold_error.
12695         * errors.h (Errors::undefined_symbol): Take location as a
12696         string, rather than calculating it from a relocation.
12697         * errors.cc (Errors::fatal): Print "fatal error:" before the
12698         formatted message.
12699         (Errors::error, Errors::error_at_location): Print "error: "
12700         before the formatted message.
12701         (Errors::undefined_symbol): Take location as a string, rather
12702         than calculating it from a relocation.
12703         (gold_undefined_symbol_at_location): New function akin to
12704         old gold_undefined_symbol, calculates location from relocation.
12705         (gold_undefined_symbol): Change to take only a Symbol pointer
12706         and to report location as the file name associated with the symbol.
12707         * testsuite/debug_msg.sh: Update for changed error messages.
12708         * testsuite/undef_symbol.sh: Likewise.
12709
12710 2009-02-04  Duncan Sands  <baldrick@free.fr>
12711
12712         PR 9812
12713         * reduced_debug_output.h
12714         (Output_reduced_debug_abbrev_section::failed): Use format for
12715         gold_warning.
12716         (Output_reduced_debug_info_section::faild): Likewise.
12717
12718 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12719
12720         * script.cc (Lazy_demangler): New class.
12721         (Version_script_info::get_symbol_version_helper): Demangle a
12722         symbol only once.
12723
12724 2009-01-29  Cary Coutant  <ccoutant@google.com>
12725
12726         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12727         to __tls_get_addr.
12728         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12729
12730 2009-01-28  Ian Lance Taylor  <iant@google.com>
12731
12732         * version.cc (version_string): Bump to 1.9.
12733
12734         * gold.h: Include <cstring> and <stdint.h>.
12735         * version.cc: Include <cstdio>.
12736         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12737         warning.
12738         * reduced_debug_output.cc (insert_into_vector): Rename from
12739         Insert_into_vector; change all callers.  Use Swap_unaligned to
12740         avoid aliasing issue; remove union since it is unnecessary.
12741
12742 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12743
12744         * Makefile.am (CCFILES): Add gc.cc.
12745         (HFILES): Add gc.h.
12746         * Makefile.in: Regenerate.
12747         * gold.cc (Gc_runner): New class.
12748         (queue_initial_tasks): Call garbage collection related tasks
12749         when corresponding options are invoked.
12750         (queue_middle_gc_tasks): New function.
12751         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12752         processed early before laying out sections during garbage collection.
12753         * gold.h (queue_middle_gc_tasks): New function.
12754         (is_prefix_of): Move from "layout.cc".
12755         * i386.cc (Target_i386::gc_process_relocs): New function.
12756         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12757         * main.cc (main): Create object of class "Garbage_collection".
12758         * object.cc (Relobj::copy_symbols_data): New function.
12759         (Relobj::is_section_name_included): New function.
12760         (Sized_relobj::do_layout): Allow this function to be called twice
12761         during garbage collection and defer layout of section during the
12762         first call.
12763         * object.h (Relobj::get_symbols_data): New function.
12764         (Relobj::is_section_name_included): New function.
12765         (Relobj::copy_symbols_data): New function.
12766         (Relobj::set_symbols_data): New function.
12767         (Relobj::get_relocs_data): New function.
12768         (Relobj::set_relocs_data): New function.
12769         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12770         (Relobj::gc_process_relocs): New function.
12771         (Relobj::do_gc_process_relocs): New pure virtual function.
12772         (Relobj::sd_): New data member.
12773         (Sized_relobj::is_output_section_offset_invalid): New function.
12774         (Sized_relobj::do_gc_process_relocs): New function.
12775         * options.h (General_options::gc_sections): Modify to not be a no-op.
12776         (General_options::print_gc_sections): New option.
12777         * plugin.cc (Plugin_finish::run): Remove function call to
12778         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12779         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12780         * reloc.cc (Read_relocs::run): Add task to process relocs and
12781         determine unreferenced sections when doing garbage collection.
12782         (Gc_process_relocs): New class.
12783         (Sized_relobj::do_gc_process_relocs): New function.
12784         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12785         sections that are garbage collected.
12786         * reloc.h (Gc_process_relocs): New class.
12787         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12788         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12789         symbols whose corresponding sections are garbage collected.
12790         (Symbol_table::Symbol_table): Add new parameter for the garbage
12791         collection object.
12792         (Symbol_table::gc_mark_undef_symbols): New function.
12793         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12794         (Symbol_table::gc_mark_dyn_syms): New function.
12795         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12796         as garbage.
12797         (Symbol_table::add_from_object): Likewise.
12798         (Symbol_table::add_from_relobj): When building shared objects, do not
12799         treat externally visible symbols as garbage.
12800         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12801         table information for static and relocatable links.
12802         * symtab.h (Symbol_table::set_gc): New function.
12803         (Symbol_table::gc): New function.
12804         (Symbol_table::gc_mark_undef_symbols): New function.
12805         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12806         (Symbol_table::gc_mark_dyn_syms): New function.
12807         (Symbol_table::gc_): New data member.
12808         * target.h (Sized_target::gc_process_relocs): New pure virtual
12809         function.
12810         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12811         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12812
12813 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12814
12815         * options.h (General_options::gc_sections): Define as a no-op for now.
12816         (General_options::no_keep_memory): Ditto.
12817         (General_options::Bshareable): Define.
12818         * options.cc (General_options::finalize): Honor -Bshareable.
12819
12820 2009-01-20  Andreas Schwab  <schwab@suse.de>
12821
12822         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12823         read the value in the contents, since we don't use it.  Use the
12824         template endianness when writing.
12825         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12826
12827 2009-01-19  Andreas Schwab  <schwab@suse.de>
12828
12829         * configure.tgt (powerpc64-*): Fix targ_obj.
12830
12831 2009-01-15  Ian Lance Taylor  <iant@google.com>
12832
12833         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12834         local symbols when stripping all symbols.
12835
12836 2009-01-14  Cary Coutant  <ccoutant@google.com>
12837
12838         * output.cc (Output_reloc): Add explicit instantiations.
12839
12840 2009-01-14  Cary Coutant  <ccoutant@google.com>
12841
12842         * archive.cc (Archive::get_elf_object_for_member): Remove call
12843         to File_read::claim_for_plugin.
12844         * descriptors.cc (Descriptors::open): Remove reference to
12845         is_claimed.
12846         (Descriptors::claim_for_plugin): Remove.
12847         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12848         (Descriptors::is_claimed): Remove.
12849         (claim_descriptor_for_plugin): Remove.
12850         * fileread.cc (File_read::claim_for_plugin): Remove.
12851         * fileread.h (File_read::claim_for_plugin): Remove.
12852         (File_read::descriptor): Reopen descriptor if necessary.
12853         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12854         (Plugin_manager::all_symbols_read): Add task parameter. Change
12855         all callers.
12856         (Plugin_manager::get_input_file): New function.
12857         (Plugin_manager::release_input_file): New function.
12858         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12859         corresponding data member.
12860         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12861         and pass to base constructor. Change all callers.
12862         (get_input_file, release_input_file): New functions.
12863         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12864         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12865         (Plugin_manager::all_symbols_read): Add task parameter.
12866         (Plugin_manager::get_input_file): New function.
12867         (Plugin_manager::release_input_file): New function.
12868         (Plugin_manager::task_): New data member.
12869         (Pluginobj::Pluginobj): Add filesize parameter.
12870         (Pluginobj::filename): New function.
12871         (Pluginobj::descriptor): New function.
12872         (Pluginobj::filesize): New function.
12873         (Pluginobj::filesize_): New data member.
12874         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12875         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12876         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12877
12878         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12879         with archive libraries.
12880         * testsuite/Makefile.in: Regenerate.
12881         * testsuite/plugin_test.c (struct sym_info): New type.
12882         (get_input_file, release_input_file): New static variables.
12883         (onload): Capture new transfer vector entries.
12884         (claim_file_hook): Stop reading at end of file according to filesize.
12885         Factor out parsing of readelf output into separate function.
12886         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12887         APIs and get the source file name from the symbol table.  Convert
12888         source file name to corresponding object file name.  Print info
12889         message when adding new input files.
12890         (parse_readelf_line): New function.
12891         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12892         * testsuite/plugin_test_2.sh: Likewise.
12893         * testsuite/plugin_test_3.sh: Likewise.
12894         * testsuite/plugin_test_4.sh: New test case.
12895
12896 2009-01-07  Ian Lance Taylor  <iant@google.com>
12897
12898         * version.cc (version_string): Bump to 1.8.
12899
12900 2008-12-23  Cary Coutant  <ccoutant@google.com>
12901
12902         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12903         * plugin.cc (Plugin_manager::finish): Rename as
12904         layout_deferred_objects.  Move cleanup to separate function.
12905         (Plugin_manager::cleanup): New function.
12906         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12907         separately.
12908         * plugin.h (Plugin_manager::finish): Rename as
12909         layout_deferred_objects.
12910         (Plugin_manager::cleanup): New function.
12911         (Plugin_manager::cleanup_done): New field.
12912
12913 2008-12-23  Cary Coutant  <ccoutant@google.com>
12914
12915         * plugin.cc (is_visible_from_outside): New function.
12916         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12917         so we don't return "IR only" status for exported symbols or -r links.
12918
12919         * testsuite/Makefile.am (plugin_test_3): New test case.
12920         * testsuite/Makefile.in: Regenerate.
12921         * testsuite/plugin_test_3.sh: New file.
12922
12923 2008-12-22  Cary Coutant  <ccoutant@google.com>
12924
12925         * object.cc (Sized_relobj::layout_section): New function.
12926         (Sized_relobj::do_layout): Defer layout of input sections until after
12927         plugin has provided replacement files.
12928         (Sized_relobj::do_layout_deferred_sections): New function.
12929         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12930         (Relobj::layout_deferred_sections): New function.
12931         (Relobj::do_layout_deferred_sections): New function.
12932         (Sized_relobj::do_layout_deferred_sections): New function.
12933         (Sized_relobj::layout_section): New function.
12934         (Sized_relobj::Deferred_layout): New structure.
12935         (Sized_relobj::deferred_layout_): New field.
12936         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12937         Change all callers.  Layout deferred sections.
12938         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12939         references.
12940         (Plugin_hook::run): Move code from do_plugin_hook inline.
12941         (Plugin_hook::do_plugin_hook): Remove.
12942         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12943         (Plugin_manager::finish): Renamed, was cleanup.
12944         (Plugin_manager::should_defer_layout): New function.
12945         (Plugin_manager::add_deferred_layout_object): New function.
12946         (Plugin_manager::Deferred_layout_list): New type.
12947         (Plugin_manager::deferred_layout_objects_): New field.
12948         (Plugin_hook::do_plugin_hook): Remove.
12949
12950 2008-12-17  Ian Lance Taylor  <iant@google.com>
12951
12952         * options.h (class General_options): Add --no case for
12953         --export-dynamic.
12954
12955 2008-12-16  Cary Coutant  <ccoutant@google.com>
12956
12957         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12958         vector.
12959         (Plugin_manager::claim_file): Create plugin object even if
12960         plugin did not call the add_symbols callback.
12961         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12962         asking for more symbols than were added.
12963         * testsuite/Makefile.am (plugin_test_1): Add test case with
12964         no global symbols.
12965         (empty.syms): New target.
12966         * testsuite/Makefile.in: Regenerate.
12967         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12968         message. Don't call add_symbols if no globals.
12969         (all_symbols_read_hook): Don't provide replacement for empty
12970         claimed file.
12971
12972 2008-12-12  Ian Lance Taylor  <iant@google.com>
12973
12974         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12975         r_type == 0 for a local symbol with r_sym == 0.
12976         (scan_relocatable_relocs): Pass r_sym to
12977         local_non_section_strategy.
12978         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12979         r_sym parameter.
12980
12981         * configure.ac: Update test for TLS descriptors: they are
12982         supported as of glibc 2.9.
12983         * configure: Rebuild.
12984
12985 2008-12-11  Ian Lance Taylor  <iant@google.com>
12986
12987         PR 7091
12988         * target-reloc.h (Default_scan_relocatable_relocs): For each
12989         function, map r_type == 0 to RELOC_DISCARD.
12990
12991 2008-12-10  Cary Coutant  <ccoutant@google.com>
12992
12993         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12994         object to override a kept COMDAT group from a plugin object.
12995
12996 2008-12-09  Ian Lance Taylor  <iant@google.com>
12997
12998         PR 7088
12999         * yyscript.y (file_cmd): Handle INPUT.
13000
13001         * testsuite/initpri1.c: Change all declarations to be full
13002         prototypes by adding void, to avoid compiler warnings.
13003
13004 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13005
13006         * options.cc (General_options::parse_plugin_opt): New.
13007         (General_options::add_plugin): The argument now is just the filename.
13008         (General_options::add_plugin_option): New.
13009         * options.h (plugin_opt): New.
13010         (add_plugin): Change argument name.
13011         (add_plugin_option): New.
13012         * plugin.cc (Plugin::load): Don't parse the plugin option.
13013         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13014         (Plugin::add_option): New.
13015         (Plugin::args_): Change type.
13016         (Plugin::filename_): New.
13017         (Plugin_manager::add_plugin_option): New.
13018         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13019         * testsuite/Makefile.in: Regenerate.
13020
13021 2008-12-05  Cary Coutant  <ccoutant@google.com>
13022
13023         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13024         Handle --strip-lto-sections option.
13025         * options.h (strip_lto_sections): New option.
13026
13027 2008-12-01  Cary Coutant  <ccoutant@google.com>
13028
13029         * plugin.cc (ld_plugin_message): Change format parameter to const.
13030         Fix mismatch between new[] and delete.
13031
13032 2008-11-14  Cary Coutant  <ccoutant@google.com>
13033
13034         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13035         instead of -1U.
13036
13037 2008-11-05  Craig Silverstein  <csilvers@google.com>
13038
13039         * options.cc (General_options::parse_dynamic_list): New function.
13040         * options.h (General_options): New flags dynamic_list,
13041         dynamic_list_data, dynamic_list_cpp_new, and
13042         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13043         (General_options::in_dynamic_list): New function.
13044         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13045         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13046         (Lex::can_continue_name): Likewise.
13047         (yylex): Likewise.
13048         (read_script_file): New parameter script_options.
13049         (read_dynamic_list): New function.
13050         (Script_options::define_dynamic_list): New function.
13051         (dynamic_list_keyword_parsecodes): New variable.
13052         (dynamic_list_keywords): New variable.
13053         * script.h (Script_options::define_dynamic_list): New function
13054         prototype.
13055         (read_dynamic_list): New function prototype.
13056         * symtab.cc (strprefix): New macro.
13057         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13058         dynamic_list_data, dynamic_list_cpp_new, and
13059         dynamic_list_cpp_typeinfo.
13060         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13061         (dynamic_list_expr): New rule.
13062         (dynamic_list_nodes): Likewise.
13063         (dynamic_list_node): Likewise.
13064         * testsuite/Makefile.am (dynamic_list): New test.
13065         * testsuite/Makefile.in: Regenerated.
13066         * testsuite/dynamic_list.t: New file.
13067         * testsuite/dynamic_list.sh: New file.
13068
13069 2008-11-05  Craig Silverstein  <csilvers@google.com>
13070
13071         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13072         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13073         (t11_last): Likewise.
13074         * testsuite/ver_test_6.c (main): Likewise.
13075
13076 2008-10-07  Cary Coutant  <ccoutant@google.com>
13077
13078         * options.c (General_options::finalize): Add check for -static and
13079         -shared.
13080         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13081         is not empty.
13082
13083 2008-10-02  Cary Coutant  <ccoutant@google.com>
13084
13085         * plugin.cc (make_sized_plugin_object): Fix conditional
13086         compilation to work when not all targets are enabled.
13087
13088 2008-09-29  Cary Coutant  <ccoutant@google.com>
13089
13090         * archive.cc (Archive::get_file_and_offset): Use filename instead
13091         of name to get library path.
13092         (Archive::include_member): Unlock external member of a thin archive.
13093
13094         * testsuite/Makefile.am (TEST_AR): New variable.
13095         (thin_archive_test_1): New test.
13096         (thin_archive_test_2): New test.
13097         * testsuite/Makefile.in: Regenerate.
13098         * testsuite/thin_archive_main.cc: New file.
13099         * testsuite/thin_archive_test_1.cc: New file.
13100         * testsuite/thin_archive_test_2.cc: New file.
13101         * testsuite/thin_archive_test_3.cc: New file.
13102         * testsuite/thin_archive_test_4.cc: New file.
13103
13104 2008-09-29  Cary Coutant  <ccoutant@google.com>
13105
13106         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13107         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13108         instead of -1U.
13109         (Sized_relobj::do_finalize_local_symbols): Likewise.
13110         (Sized_relobj::map_to_kept_section): Likewise.
13111         * object.h (Sized_relobj::invalid_address): New constant.
13112         (Sized_relobj::do_output_section_offset): Check for invalid_address
13113         and return -1ULL.
13114         * output.cc (Output_reloc::local_section_offset): Use constant
13115         invalid_address instead of -1U.
13116         (Output_reloc::get_address): Likewise.
13117         (Output_section::output_address): Change -1U to -1ULL.
13118         * output.h (Output_reloc::invalid_address): New constant.
13119         * reloc.cc (Sized_relobj::write_sections): Use constant
13120         invalid_address instead of -1U.
13121         (Sized_relobj::relocate_sections): Likewise.
13122         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13123         values for merge sections.
13124         * target-reloc.h (relocate_for_relocatable): Use constant
13125         invalid_address instead of -1U.
13126
13127 2008-09-19  Cary Coutant  <ccoutant@google.com>
13128
13129         Add plugin functionality for link-time optimization (LTO).
13130         * configure.ac (plugins): Add --enable-plugins option.
13131         * configure: Regenerate.
13132         * config.in: Regenerate.
13133         * Makefile.am (LIBDL): New variable.
13134         (CCFILES): Add plugin.cc.
13135         (HFILES): Add plugin.h.
13136         (ldadd_var): Add LIBDL.
13137         * Makefile.in: Regenerate.
13138
13139         * archive.cc: Include "plugin.h".
13140         (Archive::setup): Don't preread archive symbols when using a plugin.
13141         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13142         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13143         files.
13144         (Archive::include_member): Add symbols from plugin objects.
13145         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13146         * descriptors.cc (Descriptors::open): Check for file descriptors
13147         abandoned by plugins.
13148         (Descriptors::claim_for_plugin): New function.
13149         * descriptors.h (Descriptors::claim_for_plugin): New function.
13150         (Open_descriptor::is_claimed): New field.
13151         (claim_descriptor_for_plugin): New function.
13152         * fileread.cc (File_read::claim_for_plugin): New function.
13153         * fileread.h (File_read::claim_for_plugin): New function.
13154         (File_read::descriptor): New function.
13155         * gold.cc: Include "plugin.h".
13156         (queue_initial_tasks): Add task to call plugin hooks for generating
13157         new object files.
13158         * main.cc: Include "plugin.h".
13159         (main): Load plugin libraries.
13160         * object.h (Pluginobj): Declare.
13161         (Object::pluginobj): New function.
13162         (Object::do_pluginobj): New function.
13163         (Object::set_target): New function.
13164         * options.cc: Include "plugin.h".
13165         (General_options::parse_plugin): New function.
13166         (General_options::General_options): Initialize plugins_ field.
13167         (General_options::add_plugin): New function.
13168         * options.h (Plugin_manager): Declare.
13169         (General_options): Add --plugin option.
13170         (General_options::has_plugins): New function.
13171         (General_options::plugins): New function.
13172         (General_options::add_plugin): New function.
13173         (General_options::plugins_): New field.
13174         * plugin.cc: New file.
13175         * plugin.h: New file.
13176         * readsyms.cc: Include "plugin.h".
13177         (Read_symbols::do_read_symbols): Check for archive before checking
13178         for ELF file.  Call plugin hooks to claim files.
13179         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13180         from a real object file; force override when processing replacement
13181         files.
13182         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13183         (Symbol::init_base_object): Likewise.
13184         (Symbol::init_base_output_data): Likewise.
13185         (Symbol::init_base_output_segment): Likewise.
13186         (Symbol::init_base_constant): Likewise.
13187         (Symbol::init_base_undefined): Likewise.
13188         (Symbol::output_section): Assert that object is not a plugin.
13189         (Symbol_table::add_from_pluginobj): New function.
13190         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13191         undefined.
13192         (Symbol_table::sized_write_globals): Likewise.
13193         (Symbol_table::add_from_pluginobj): Instantiate template.
13194         * symtab.h (Sized_pluginobj): Declare.
13195         (Symbol::in_real_elf): New function.
13196         (Symbol::set_in_real_elf): New function.
13197         (Symbol::in_real_elf_): New field.
13198         (Symbol_table::add_from_pluginobj): New function.
13199
13200         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13201         (LIBDL): New variable.
13202         (LDADD): Add LIBDL.
13203         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13204         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13205         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13206         (MOSTLYCLEANFILES): Likewise.
13207         * testsuite/Makefile.in: Regenerate.
13208         * testsuite/plugin_test.c: New file.
13209         * testsuite/plugin_test_1.sh: New file.
13210         * testsuite/plugin_test_2.sh: New file.
13211
13212 2008-09-16  Ian Lance Taylor  <iant@google.com>
13213
13214         * target-reloc.h (relocate_section): Check whether a symbol is
13215         defined by the ABI before reporting an undefined symbol error.
13216         * target.h (Target::is_defined_by_abi): Make parameter const.
13217         (Target::do_is_defined_by_abi): Likewise.
13218         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13219         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13220         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13221         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13222         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13223         * testsuite/Makefile.in: Rebuild.
13224
13225         * fileread.cc (make_view): Add casts to avoid warning.
13226
13227 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13228
13229         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13230         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13231
13232 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13233
13234         * options.h (General_options::output_is_executable): New.
13235         (General_options::output_is_pie): New.
13236         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13237         for shared libraries.
13238         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13239
13240 2008-09-11  Chris Demetriou  <cgd@google.com>
13241
13242         * options.h (origin): New -z option.
13243         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13244         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13245         in DT_FLAGS_1.
13246
13247 2008-09-05  Cary Coutant  <ccoutant@google.com>
13248
13249         * fileread.cc (File_read::make_view): Add check for attempt to map
13250         beyond end of file.
13251
13252 2008-09-05  Cary Coutant  <ccoutant@google.com>
13253
13254         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13255         explicit instantiations.
13256
13257 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13258
13259         PR gold/6858
13260         * options.cc (General_options::finalize): Allow undefined symbols
13261         in shlibs if linking -shared.
13262
13263         PR gold/6859
13264         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13265         symbols as not needing a dynsym entry.
13266
13267 2008-08-20  Craig Silverstein  <csilvers@google.com>
13268
13269         * fileread.cc (File_read::open): Do not lock the file unless it
13270         was successfully opened.
13271
13272 2008-08-14  Cary Coutant  <ccoutant@google.com>
13273
13274         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13275         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13276         * testsuite/tls_test.cc (struct int128): 128-bit struct
13277         for testing TLS relocs with non-zero addend.
13278         (v12): New TLS variable.
13279         (t12): New test.
13280         (t_last): Add check for v12.
13281         * testsuite/tls_test.h (t12): New function.
13282         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13283
13284 2008-08-13  Ian Lance Taylor  <iant@google.com>
13285
13286         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13287         set tls_segment_ or relro_segment_.
13288         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13289         when appropriate.
13290         * output.h (Output_section::clear_is_relro): New function.
13291         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13292         sections specially even when output_data_ is empty.
13293         (Output_segment::maximum_alignment): When first section is relro,
13294         only force alignment for PT_LOAD segments.
13295         * script.cc (script_data_segment_align): New function.
13296         (script_data_segment_relro_end): New function.
13297         * script-c.h (script_data_segment_align): Declare.
13298         (script_data_segment_relro_end): Declare.
13299         * script-sections.h (class Script_sections): Declare
13300         data_segment_align and data_segment_relro_end.  Add fields
13301         segment_align_index_ and saw_relro_end_.
13302         * script-sections.cc (class Sections_element): Add set_is_relro
13303         virtual function.  Add new bool* parameter to place_orphan_here.
13304         Add get_output_section virtual function.
13305         (class Output_section_definition): Add set_is_relro.  Add new
13306         bool* parameter to place_orphan_here.  Add get_output_section.
13307         Add is_relro_ field.
13308         (Output_section_definition::Output_section_definition): Initialize
13309         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13310         and is_relro_ fields.
13311         (Output_section_definition::place_orphan_here): Add is_relro
13312         parameter.
13313         (Output_section_definition::set_section_addresses): Set relro for
13314         output section.
13315         (Output_section_definition::alternate_constraint): Likewise.
13316         (class Orphan_output_section): Add new bool* parameter to
13317         place_orphan_here.  Add get_output_section.
13318         (Orphan_output_section::place_orphan_here): Add is_relro
13319         parameter.
13320         (Script_sections::Script_sections): Initialize
13321         data_segment_align_index_ and saw_relro_end_.
13322         (Script_sections::data_segment_align): New function.
13323         (Script_sections::data_segment_relro_end): New function.
13324         (Script_sections::place_orphan): Set or clear is_relro.
13325         (Script_sections::set_section_addresses): Force alignment of first
13326         TLS section.
13327         * yyscript.y (exp): Call script_data_segment_align and
13328         script_data_segment_relro_end.
13329         * testsuite/relro_script_test.t: New file.
13330         * testsuite/relro_test.cc (using_script): Declare.
13331         (t1, t2): Test using_script.
13332         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13333         (relro_script_test_SOURCES): Define.
13334         (relro_script_test_DEPENDENCIES): Define.
13335         (relro_script_test_LDFLAGS): Define.
13336         (relro_script_test_LDADD): Define.
13337         (relro_script_test.so): New target.
13338         * testsuite/Makefile.in: Rebuild.
13339
13340 2008-08-06  Cary Coutant <ccoutant@google.com>
13341
13342         * archive.cc (Archive::total_archives, Archive::total_members)
13343         (Archive::total_members_loaded): New variables.
13344         (Archive::setup): Add parameter.  Add option to preread
13345         archive symbols.
13346         (Archive::read_armap): Add counter.
13347         (Archive::get_file_and_offset): New function.
13348         (Archive::get_elf_object_for_member): New function.
13349         (Archive::read_all_symbols): New function.
13350         (Archive::read_symbols): New function.
13351         (Archive::add_symbols): Add counters.
13352         (Archive::include_all_members): Use armap to find members if it's
13353         already built.
13354         (Archive::include_member): Skip reading symbols if already read.
13355         Factored code into Archive::get_file_and_offset and
13356         Archive::get_elf_object_for_member.  Changed call to
13357         Mapfile::report_include_archive_member.
13358         (Archive::print_stats): New function.
13359         * archive.h: Declare Object and Read_symbols_data classes.
13360         (Archive::Archive): Add initializers for new members.
13361         (Archive::setup): Add parameter.
13362         (Archive::print_stats): New function.
13363         (Archive::total_archives, Archive::total_members)
13364         (Archive::total_members_loaded): New variables.
13365         (Archive::get_file_and_offset): New function.
13366         (Archive::get_elf_object_for_member): New function.
13367         (Archive::read_all_symbols): New function.
13368         (Archive::read_symbols): New function.
13369         (Archive::Archive_member): New class.
13370         (Archive::members_): New member.
13371         (Archive::num_members_): New member.
13372         * main.cc: Include archive.h.
13373         (main): Call Archive::print_stats.
13374         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13375         archive parameter; member_name is now the fully-decorated name.
13376         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13377         * options.h: (General_options): Add --preread-archive-symbols option.
13378         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13379         Archive::setup.
13380
13381 2008-08-04  Ian Lance Taylor  <iant@google.com>
13382
13383         * symtab.h (Symbol::use_plt_offset): New function.
13384         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13385         * powerpc.cc (Relocate::relocate): Likewise.
13386         * sparc.cc (Relocate::relocate): Likewise.
13387         * x86_64.cc (Relocate::relocate): Likewise.
13388         * testsuite/weak_plt.sh: New test.
13389         * testsuite/weak_plt_main.cc: New test.
13390         * testsuite/weak_plt_shared.cc: New test.
13391         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13392         (check_PROGRAMS): Add weak_plt.
13393         (check_DATA): Add weak_plt_shared.so.
13394         (weak_plt_main_pic.o, weak_plt): New targets.
13395         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13396         * testsuite/Makefile.in: Rebuild.
13397
13398         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13399         gcctestdir/ld.
13400         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13401         * testsuite/Makefile.in: Rebuild.
13402
13403 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13404
13405         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13406         * Makefile.in: Regenerate.
13407         * po/POTFILES.in: Regenerate.
13408
13409 2008-07-29  Ian Lance Taylor  <iant@google.com>
13410
13411         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13412         symbols before other symbols.
13413         * testsuite/script_test_2.cc (test_addr): Declare.
13414         (test_addr_alias): Declare.
13415         (main): Check that test_addr and test_addr_alias have the right
13416         values.
13417         * testsuite/script_test_2.t: Define test_addr_alias and
13418         test_addr.
13419
13420 2008-07-24  Ian Lance Taylor  <iant@google.com>
13421
13422         PR 5990
13423         * descriptors.cc: New file.
13424         * descriptors.h: New file.
13425         * gold-threads.h (class Hold_optional_lock): New class.
13426         * fileread.cc: Include "descriptors.h".
13427         (File_read::~File_read): Release descriptor rather than closing
13428         it.
13429         (File_read::open) [file]: Call open_descriptor rather than open.
13430         Set is_descriptor_opened_.
13431         (File_read::open) [memory]: Assert that descriptor is not open.
13432         (File_read::reopen_descriptor): New function.
13433         (File_read::release): Release descriptor.
13434         (File_read::do_read): Make non-const.  Reopen descriptor.
13435         (File_read::read): Make non-const.
13436         (File_read::make_view): Reopen descriptor.
13437         (File_read::do_readv): Likewise.
13438         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13439         Update declarations.
13440         * layout.cc: Include "descriptors.h".
13441         (Layout::create_build_id): Use open_descriptor rather than open.
13442         * output.cc: Include "descriptors.h".
13443         (Output_file::open): Use open_descriptor rather than open.
13444         * archive.cc (Archive::const_iterator): Change Archive to be
13445         non-const.
13446         (Archive::begin, Archive::end): Make non-const.
13447         (Archive::count_members): Likewise.
13448         * archive.h (class Archive): Update declarations.
13449         * object.h (Object::read): Make non-const.
13450         * Makefile.am (CCFILES): Add descriptors.cc.
13451         (HFILES): Add descriptors.h.
13452         * Makefile.in: Rebuild.
13453
13454         PR 6716
13455         * gold.h: Always include <clocale>.  Add Solaris workarounds
13456         following code in binutils/sysdep.h.
13457
13458         PR 6048
13459         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13460         this->eh_frame_hdr_ is NULL before using it.
13461
13462         * dynobj.cc (Versions::Versions): Update comment.
13463
13464         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13465         the base version name.
13466
13467         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13468         array size plus one.
13469         (Stringpool_template::set_string_offsets): Subtract one from key
13470         before using it as an array index.
13471         (Stringpool_template::get_offset_with_length): Likewise.
13472         (Stringpool_template::write_to_buffer): Likewise.
13473         * stringpool.h (Stringpool_template::get_offset_from_key):
13474         Likewise.
13475
13476 2008-07-23  Ian Lance Taylor  <iant@google.com>
13477
13478         PR 6658
13479         * object.h (Merged_symbol_value::value): Do our best to handle a
13480         negative addend.
13481
13482         PR 6647
13483         * script.cc (Version_script_info::get_versions): Don't add empty
13484         version tag to return value.
13485         (Version_script_info::get_symbol_version_helper): Change return
13486         type to bool.  Add pversion parameter.  Change all callers.
13487         (script_register_vers_node): Don't require a non-NULL tag.
13488         * script.h (class Version_script_info): Update declarations.
13489         (Version_script_info::get_symbol_version): Change return type to
13490         bool.  Add version parameter.  Change all callers.
13491         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13492         handling.  Handle an empty version from a version script.
13493         (Symbol_table::define_special_symbol): Likewise.
13494         * testsuite/ver_test_10.script: New file.
13495         * testsuite/ver_test_10.sh: New file.
13496         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13497         (check_DATA): Add ver_test_10.syms.
13498         (ver_test_10.syms, ver_test_10.so): New target.
13499         * testsuite/Makefile.in: Rebuild.
13500
13501 2008-07-23  Simon Baldwin  <simonb@google.com>
13502
13503         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13504         to zero for undefined symbols from dynamic libraries.
13505
13506 2008-07-23  Ian Lance Taylor  <iant@google.com>
13507
13508         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13509         Change all callers.
13510         * symtab.h (class Symbol_table): Update declaration.
13511         * testsuite/ver_test_9.cc: New file.
13512         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13513         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13514         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13515         (ver_test_9.so, ver_test_9.o): New targets.
13516         * testsuite/Makefile.in: Rebuild.
13517
13518 2008-07-22  Ian Lance Taylor  <iant@google.com>
13519
13520         * options.h (class General_options): Define --check-sections.
13521         * layout.cc (Layout::set_segment_offsets): Handle
13522         --check-sections.
13523
13524         * options.h (class General_options): Define -n/--nmagic and
13525         -N/--omagic.
13526         * options.cc (General_options::finalize): For -n/--nmagic or
13527         -N/--omagic, set -static.
13528         * layout.cc (Layout::attach_allocated_section_to_segment): If
13529         -N/--omagic, don't put read-only and read-write sections in
13530         different segments.
13531         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13532         finding a read-only segment.
13533         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13534         don't set the minimum segment alignment to the common page size,
13535         and don't set the file offset to the address modulo the page size.
13536         * script-sections.cc (Script_sections::create_segments): If
13537         -n/--omagic, don't put read-only and read-write sections in
13538         different segments.
13539
13540         * cref.cc: New file.
13541         * cref.h: New file.
13542         * options.h (class General_options): Add --print-symbol-counts.
13543         * main.cc (main): Issue defined symbol report if requested.
13544         * archive.cc (Archive::interpret_header): Make into a const member
13545         function.
13546         (Archive::add_symbols): Call Input_objects::archive_start and
13547         archive_stop.
13548         (Archive::const_iterator): Define new class.
13549         (Archive::begin, Archive::end): New functions.
13550         (Archive::include_all_members): Rewrite to use iterator.
13551         (Archive::count_members): New function.
13552         * archive.h (class Archive): Update declarations.
13553         (Archive::filename): New function.
13554         * object.cc: Include "cref.h".
13555         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13556         (Sized_relobj::do_get_global_symbol_counts): New function.
13557         (Input_objects::add_object): Add object to cross-referencer.
13558         (Input_objects::archive_start): New function.
13559         (Input_objects::archive_stop): New function.
13560         (Input_objects::print_symbol_counts): New function.
13561         * object.h: Declare Cref and Archive.
13562         (Object::get_global_symbol_counts): New function.
13563         (Object::do_get_global_symbol_counts): New pure virtual function.
13564         (class Sized_relobj): Add defined_count_ field.  Update
13565         declarations.
13566         (class Input_objects): Add cref_ field.  Update constructor.
13567         Update declarations.
13568         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13569         defined_count_.
13570         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13571         symbol counts.
13572         (Sized_dynobj::do_get_global_symbol_counts): New function.
13573         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13574         defined_count_.  Update declarations.  Define Symbols typedef.
13575         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13576         parameter.  Change all callers.
13577         (Symbol_table::add_from_dynobj): Add sympointers and defined
13578         parameters.  Change all callers.
13579         * symtab.h (class Symbol_table): Update declarations.
13580         * Makefile.am (CCFILES): Add cref.cc.
13581         (HFILES): Add cref.h.
13582         * Makefile.in: Rebuild.
13583
13584 2008-07-22  Simon Baldwin  <simonb@google.com>
13585
13586         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13587         to zero when writing undefined symbols.
13588
13589 2008-07-22  Ian Lance Taylor  <iant@google.com>
13590
13591         * output.cc (Output_section::add_input_section): Don't try to
13592         merge empty merge sections.
13593
13594 2008-07-21  Craig Silverstein  <csilvers@google.com>
13595
13596         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13597         Include symbol version in error message.
13598
13599 2008-07-20  Chris Demetriou  <cgd@google.com>
13600
13601         * configure.ac (gold_cv_c_random_seed): New configured variable.
13602         (RANDOM_SEED_CFLAGS): New substituted variable.
13603         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13604         * configure: Rebuild.
13605         * Makefile.in: Likewise.
13606         * testsuite/Makefile.in: Likewise.
13607
13608 2008-07-18  Ian Lance Taylor  <iant@google.com>
13609
13610         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13611         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13612         * testsuite/ver_test_main.cc (main): Call t4.
13613         (t4, t4_2a): Define.
13614         * testsuite/ver_test_2.cc (t4_2): Define.
13615         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13616         * testsuite/ver_test_4.cc (t4_2a): Define.
13617         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13618         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13619
13620 2008-07-17  Ian Lance Taylor  <iant@google.com>
13621
13622         * dynobj.cc (Versions::add_def): If we give an error about a
13623         missing version, go ahead and create the version anyhow.
13624
13625 2008-07-10  Ian Lance Taylor  <iant@google.com>
13626
13627         Handle output sections with more than 0x7fffffff bytes.
13628         * object.h (class Relobj): Change map_to_output_ to
13629         output_sections_, and just keep a section pointer.  Change all
13630         uses.  Move comdat group support to Sized_relobj.
13631         (Relobj::is_section_specially_mapped): Remove.
13632         (Relobj::output_section): Remove poff parameter.  Change all
13633         callers.
13634         (Relobj::output_section_offset): New function.
13635         (Relobj::set_section_offset): Rewrite.
13636         (Relobj::map_to_output): Remove.
13637         (Relobj::output_sections): New function.
13638         (Relobj::do_output_section_offset): New pure virtual function.
13639         (Relobj::do_set_section_offset): Likewise.
13640         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13641         group support from Relobj.  Update declarations.
13642         (Sized_relobj::get_output_section_offset): New function.
13643         (Sized_relobj::do_output_section_offset): New function.
13644         (Sized_relobj::do_set_section_offset): New function.
13645         * object.cc (Relobj::output_section_address): Remove.
13646         (Sized_relobj::Sized_relobj): Initialize new fields.
13647         (Sized_relobj::include_section_group): Cast find_kept_object to
13648         Sized_relobj.
13649         (Sized_relobj::include_linkonce_section): Likewise.
13650         (Sized_relobj::do_layout): Use separate arrays for output section
13651         and output offset.
13652         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13653         output_sections.
13654         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13655         output_sections and section_offsets.
13656         (Sized_relobj::write_local_symbols): Likewise.
13657         (map_to_kept_section): Compute output address directly.
13658         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13659         output_sections and section_offsets.
13660         (Sized_relobj::write_sections): Likewise.
13661         (Sized_relobj::relocate_sections): Likewise.
13662         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13663         * output.h (class Output_reloc): Update declarations.  Change
13664         u2_.relobj to Sized_relobj*.
13665         (class Output_data_reloc): Change add functions to use
13666         Sized_relobj*.
13667         * output.cc (Output_reloc::Output_reloc): Change relobj to
13668         Sized_relobj*.
13669         (Output_reloc::local_section_offset): Change return type to
13670         Elf_Addr.  Use get_output_section_offset.
13671         (Output_reloc::get_address): Likewise.
13672         (Output_section::is_input_address_mapped): Don't call
13673         is_section_specially_mapped.
13674         (Output_section::output_offset): Likewise.
13675         (Output_section::output_address): Likewise.
13676         (Output_section::starting_output_address): Likewise.
13677         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13678         parameter to Sized_relobj*.
13679         (Copy_relocs::need_copy_reloc): Likewise.
13680         (Copy_relocs::save): Likewise.
13681         * copy-relocs.h (class Copy_relocs): Update declarations.
13682         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13683         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13684         * target-reloc.h (relocate_for_relocatable): Change
13685         offset_in_output_section type to Elf_Addr.  Change code that uses
13686         it as well.
13687         * layout.cc (Layout::layout): Always set *off.
13688         * mapfile.cc (Mapfile::print_input_section): Use
13689         output_section_offset.
13690         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13691         Sized_relobj*.
13692         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13693         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13694         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13695
13696 2008-07-03  Ian Lance Taylor  <iant@google.com>
13697
13698         * layout.cc (Layout::include_section): Do not discard unrecognized
13699         SHT_STRTAB sections.
13700
13701 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13702
13703         * script.cc (Lex::can_continue_name): Make '?' allowable in
13704         version-script names.
13705         * testsuite/version_script.map: Change glob pattern to use '?'
13706
13707 2008-06-30  Manish Singh  <yosh@gimp.org>
13708
13709         PR 6585
13710         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13711         Correct typo.
13712
13713 2008-06-30  Ian Lance Taylor  <iant@google.com>
13714
13715         PR 6660
13716         PR 6682
13717         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13718         versions]: Don't try to read the value in the contents, since we
13719         don't use it.  Use the template endianness when writing.
13720
13721 2008-06-25  Cary Coutant  <ccoutant@google.com>
13722
13723         * fileread.cc (File_read::make_view): Assert on zero-length view.
13724         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13725         symbol table when there are no symbols to read.
13726
13727 2008-06-23  Craig Silverstein  <csilvers@google.com>
13728
13729         * version.cc (version_string): Bump to 1.7
13730
13731 2008-06-18  Craig Silverstein  <csilvers@google.com>
13732
13733         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13734         constant 0xFFFF to type Valtype.
13735         (Powerpc_relocate_functions::rel16_ha): Likewise.
13736
13737 2008-06-17  Ian Lance Taylor  <iant@google.com>
13738
13739         * output.h (Output_section::Input_section): Initialize p2align_ to
13740         zero for Output_section_data constructors.
13741         (Output_section::Input_section::addralign): If not an input
13742         section, return the alignment of the Output_section_data.
13743         * testsuite/copy_test.cc: New file.
13744         * testsuite/copy_test_1.cc: New file.
13745         * testsuite/copy_test_2.cc: New file.
13746         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13747         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13748         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13749         (copy_test_1_pic.o, copy_test_1.so): New targets.
13750         (copy_test_2_pic.o, copy_test_2.so): New targets.
13751         * testsuite/Makefile.in: Rebuild.
13752
13753         * script-sections.cc (Script_sections::place_orphan): Initialize
13754         local variable exact.
13755
13756 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13757
13758         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13759
13760 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13761             David S. Miller  <davem@davemloft.net>
13762
13763         * powerpc.cc: New file.
13764         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13765         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13766         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13767         * Makefile.in: Rebuild.
13768
13769 2008-06-09  Ian Lance Taylor  <iant@google.com>
13770
13771         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13772         <exception>.
13773         (throwing, orig_terminate): New static variables.
13774         (terminate_handler): New static function.
13775         (t2): Set terminate handler.
13776
13777 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13778
13779         PR 6584
13780         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13781         alignment.
13782
13783 2008-05-30  Cary Coutant  <ccoutant@google.com>
13784
13785         * archive.cc (Archive::include_all_members) Correct to step
13786         over symbol table and extended name table in thin archives.
13787
13788 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13789
13790         PR 6407
13791         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13792         calculation.
13793
13794 2008-05-28  Caleb Howe  <cshowe@google.com>
13795
13796         * reduced_debug_output.cc: New file.
13797         * reduced_debug_output.h: New file.
13798         * options.h (class General_options): Add --strip-debug-non-line.
13799         * options.cc (General_options::finalize): Add strip_debug_non_line
13800         to the strip heirarchy.
13801         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13802         fields.
13803         * layout.cc: Include "reduced_debug_output.h".
13804         (Layout::Layout): Initialize new fields.
13805         (line_only_debug_sections): New static array.
13806         (is_lines_only_debug_sections): New static inline function.
13807         (Layout::include_section): Handle --strip-debug-non-line.
13808         (Layout::make_output_section): If --strip-debug-non-line, build
13809         new output sections for .debug_abbrev and .debug_info.
13810         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13811         gold.  Warn about possible overflow.
13812         (read_signed_LEB_128): Likewise.
13813         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13814         (read_signed_LEB_128): Declare.
13815         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13816         (HFILES): Add reduced_debug_output.h.
13817         * Makefile.in: Rebuild.
13818
13819 2008-05-21  Ian Lance Taylor  <iant@google.com>
13820
13821         * mapfile.cc: New file.
13822         * mapfile.h: New file.
13823         * options.h (class General_options): Add -M/--print-map and -Map.
13824         * options.cc (General_options::finalize): Make -M equivalent to
13825         -Map -.
13826         * main.cc: Include <cstdio> and "mapfile.h".
13827         (main): Open mapfile if requested.
13828         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13829         constructor.  Change caller.
13830         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13831         (queue_middle_tasks): Likewise.
13832         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13833         declarations.
13834         * archive.cc: Include "mapfile.h".
13835         (Archive::add_symbols): Add mapfile parameter.  Change all
13836         callers.  Pass mapfile, symbol, and reason to include_member.
13837         (Archive::include_all_members): Add mapfile parameter.  Change all
13838         callers.
13839         (Archive::include_member): Add mapfile, sym, and why parameters.
13840         Change all callers.  Report inclusion to map file.
13841         * archive.h: Include "fileread.h".
13842         (class Archive): Update declarations.
13843         (Archive::file): New const method.
13844         (class Add_archive_symbols): Add mapfile_ field.  Update
13845         constructor.  Change all callers.
13846         * readsyms.h (class Read_symbols): Likewise.
13847         (class Finish_group): Likewise.
13848         (class Read_script): Likewise.
13849         * common.cc: Include "mapfile.h".
13850         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13851         all callers.
13852         (Symbol_table::do_allocate_commons): Likewise.
13853         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13854         symbol allocation to mapfile.
13855         * common.h (class Allocate_commons_task): Add mapfile_ field.
13856         Update constructor.  Change all callers.
13857         * symtab.h (class Symbol_table): Update declarations.
13858         * layout.cc: Include "mapfile.h".
13859         (Layout_task_runner::run): Print information to mapfile.
13860         (Layout::create_gold_note): Change Output_data_fixed_space to
13861         Output_data_zero_fill.
13862         (Layout::create_build_id): Likewise.
13863         (Layout::print_to_mapfile): New function.
13864         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13865         constructor.  Change caller.
13866         (class Layout): Declare print_to_mapfile.
13867         * output.cc (Output_section::Input_section::print_to_mapfile): New
13868         function.
13869         (Output_section::add_input_section): If producing a map, always
13870         add to input_sections_ list.
13871         (Output_section::do_print_to_mapfile): New function.
13872         (Output_segment::print_sections_to_mapfile): New function.
13873         (Output_segment::print_section_list_to_mapfile): New function.
13874         * output.h: Include "mapfile.h".
13875         (Output_data::print_to_mapfile): New function.
13876         (Output_data::do_print_to_mapfile): New virtual function.
13877         (Output_segment_headers::do_print_to_mapfile): New function.
13878         (Output_file_header::do_print_to_mapfile): New function.
13879         (Output_data_const::do_print_to_mapfile): New function.
13880         (class Output_data_const_buffer): Add map_name_ field.  Update
13881         constructor.  Change all callers.  Add do_print_to_mapfile
13882         function.
13883         (class Output_data_fixed_space): Likewise.
13884         (class Output_data_space): Likewise.
13885         (class Output_data_zero_fill): New class.
13886         (Output_data_strtab::do_print_to_mapfile): New function.
13887         (Output_data_reloc_base::do_print_to_mapfile): New function.
13888         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13889         (Output_data_group::do_print_to_mapfile): New function.
13890         (Output_data_got::do_print_to_mapfile): New function.
13891         (Output_data_dynamic::do_print_to_mapfile): New function.
13892         (Output_symtab_xindex::do_print_to_mapfile): New function.
13893         (class Output_section): Declare do_print_to_mapflie.  Declare
13894         print_to_mapfile in Input_section.
13895         (class Output_segment): Declare new functions.
13896         * object.h (Sized_relobj::symbol_count): New function.
13897         * script-sections.cc
13898         (Output_section_element_dot_assignment::set_section_addresses):
13899         Change Output_data_fixed_space to Output_data_zero_fill.
13900         (Output_data_expression::do_print_to_mapfile): New function.
13901         * script.cc (read_input_script): Add mapfile parameter.  Change
13902         all callers.
13903         * script.h (read_input_script): Update declaration.
13904         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13905         (Eh_frame::do_print_to_mapfile): New function.
13906         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13907         (Output_merge_string::do_print_to_mapfile): New function.
13908         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13909         function.
13910         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13911         function.
13912         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13913         function.
13914         * Makefile.am (CCFILES): Add mapfile.cc.
13915         (HFILES): Add mapfile.h.
13916         * Makefile.in: Rebuild.
13917
13918 2008-05-19  Ian Lance Taylor  <iant@google.com>
13919
13920         * options.h (class General_options): Add -z relro.
13921         * layout.cc (Layout::Layout): Initialize relro_segment_.
13922         (Layout::add_output_section_data): Return the output section.
13923         (Layout::make_output_section): Rcognize relro sections and mark
13924         them appropriately.
13925         (Layout::attach_allocated_section_to_segment): Put relro sections
13926         in a PT_GNU_RELRO segment.
13927         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13928         section as relro.
13929         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13930         PT_TLS segments.
13931         (Layout::linkonce_mapping): Map d.rel.ro.local to
13932         .data.rel.ro.local.
13933         (Layout::output_section_name): Us .data.rel.ro.local for any
13934         section which begins with that.
13935         * layout.h (class Layout): Update add_output_section_data
13936         declaration.  Add relro_segment_ field.
13937         * output.cc (Output_section::Output_section): Initialize is_relro_
13938         and is_relro_local_ fields.
13939         (Output_segment::add_output_section): Group relro sections.
13940         (Output_segment::is_first_section_relro): New function.
13941         (Output_segment::maximum_alignment): If there is a relro section,
13942         align the segment to the common page size.
13943         (Output_segment::set_section_addresses): Track whether we are
13944         looking at relro sections.  If the last section is a relro
13945         section, align to the common page size.
13946         (Output_segment::set_section_list_addresses): Add in_relro
13947         parameter.  Change all callers.  Align to the page size when
13948         moving from relro to non-relro section.
13949         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13950         segment.
13951         * output.h (class Output_section): Add is_relro_ and
13952         is_relro_local_ fields.
13953         (Output_section::is_relro): New function.
13954         (Output_section::set_is_relro): New function.
13955         (Output_section::is_relro_local): New function.
13956         (Output_section::set_is_relro_local): New function.
13957         (class Output_segment): Update declarations.
13958         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13959         * sparc.cc (Target_sparc::got_section): Likewise.
13960         * x86_64.cc (Target_x86_64::got_section): Likewise.
13961         * testsuite/relro_test_main.cc: New file.
13962         * testsuite/relro_test.cc: New file.
13963         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13964         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13965         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13966         (relro_test.so, relro_test_pic.o): New targets.
13967         * testsuite/Makefile.in: Rebuild.
13968
13969 2008-05-16  Ian Lance Taylor  <iant@google.com>
13970
13971         * output.cc (Output_segment::add_output_section): Remove front
13972         parameter.
13973         * output.h (class Output_segment): Remove
13974         add_initial_output_section and overloaded add_output_section.
13975         Update declaration of remaining add_output_section.
13976         * layout.cc (Layout::create_interp): Call add_output_section
13977         rather than add_initial_output_section.
13978         (Layout::finish_dynamic_section): Likewise.
13979
13980         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13981         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13982         know the dynamic type.
13983         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13984         field.  Initialize it in constructor.
13985         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13986         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13987         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13988         reloc.
13989
13990         * output.cc (Output_reloc::get_address): Change return type to
13991         Elf_Addr.
13992         * output.h (class Output_reloc): Update get_address declaration.
13993         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13994         for section addresses.
13995
13996 2008-05-09  Ian Lance Taylor  <iant@google.com>
13997
13998         PR 6493
13999         * gold.cc (gold_nomem): Use return value of write.
14000
14001 2008-05-08  Ian Lance Taylor  <iant@google.com>
14002
14003         * symtab.c (Symbol::init_base_output_data): Add version
14004         parameter.  Change all callers.
14005         (Symbol::init_base_output_segment): Likewise.
14006         (Symbol::init_base_constant): Likewise.
14007         (Symbol::init_base_undefined): Likewise.
14008         (Sized_symbol::init_output_data): Likewise.
14009         (Sized_symbol::init_output_segment): Likewise.
14010         (Sized_symbol::init_constant): Likewise.
14011         (Sized_symbol::init_undefined): Likewise.
14012         (Symbol_table::do_define_in_output_data): If the new symbol has a
14013         version, mark it as the default.
14014         (Symbol_table::do_define_in_output_segment): Likewise.
14015         (Symbol_table::do_define_as_constant): Likewise.
14016         * symtab.h (class Symbol): Update declarations.
14017         (class Sized_symbol): Likewise.
14018         * resolve.cc (Symbol::override_version): New function.
14019         (Symbol::override_base): Call override_version.
14020         (Symbol::override_base_with_special): Likewise.
14021         * testsuite/ver_script_8.script: New file.
14022         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14023         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14024         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14025         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14026
14027 2008-05-06  Ian Lance Taylor  <iant@google.com>
14028
14029         PR 6049
14030         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14031         functions.
14032         (class General_options): Remove existing --undefined, and add
14033         --no-undefined instead.  Add new --undefined as synonym for -u.
14034         * archive.cc (Archive::add_symbols): Check whether symbol was
14035         named with -u.
14036         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14037         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14038         all uses.  Add IS_UNDEFINED.  Update declarations to split
14039         different versions of init_base.  Declare init_base_undefined.
14040         (Symbol::is_defined): Handle IS_UNDEFINED.
14041         (Symbol::is_undefined): Likewise.
14042         (Symbol::is_weak_undefined): Call is_undefined.
14043         (Symbol::is_absolute): Handle IS_CONSTANT.
14044         (class Sized_symbol): Update declarations to split different
14045         versions of init.  Declare init_undefined.
14046         (class Symbol_table): Declare new functions.
14047         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14048         Change all callers.
14049         (Symbol::init_base_output_data): Likewise.
14050         (Symbol::init_base_output_segment): Likewise.
14051         (Symbol::init_base_constant): Likewise.
14052         (Symbol::init_base_undefined): New function.
14053         (Sized_symbol::init_object): Rename from init.  Change all
14054         callers.
14055         (Sized_symbol::init_output_data): Likewise.
14056         (Sized_symbol::init_output_segment): Likewise.
14057         (Sized_symbol::init_constant): Likewise.
14058         (Sized_symbol::init_undefined): New function.
14059         (Symbol_table::add_undefined_symbols_from_command_line): New
14060         function.
14061         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14062         function.
14063         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14064         (Symbol::output_section): Likewise.
14065         (Symbol::set_output_section): Likewise.
14066         (Symbol_table::sized_finalize_symbol): Likewise.
14067         (Symbol_table::sized_write_globals): Likewise.
14068         * resolve.cc (Symbol_table::should_override): Likewise.
14069         (Symbol::override_base_with_special): Likewise.
14070
14071         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14072         symbol, change it to have default visibility.
14073         * testsuite/protected_1.cc: New file.
14074         * testsuite/protected_2.cc: New file.
14075         * testsuite/protected_3.cc: New file.
14076         * testsuite/protected_main_1.cc: New file.
14077         * testsuite/protected_main_2.cc: New file.
14078         * testsuite/protected_main_3.cc: New file.
14079         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14080         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14081         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14082         (protected_1.so): New target.
14083         (protected_1_pic.o, protected_2_pic.o): New targets.
14084         (protected_3_pic.o): New target.
14085         (check_PROGRAMS): Add protected_2.
14086         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14087         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14088         * testsuite/Makefile.in: Rebuild.
14089
14090         * options.h (DEFINE_var): Add set_user_set_##varname__.
14091         (DEFINE_bool_alias): New macro.
14092         (class General_options): Define -Bstatic using DEFINE_bool_alias
14093         rather than DEFINE_special.  Add --undefined as an alias for -z
14094         defs.
14095         * options.cc (General_options::parse_Bstatic): Remove.
14096
14097         * options.h (class General_options): Add --fatal-warnings.
14098         * main.cc (main): Implement --fatal-warnings.
14099         * errors.h (Errors::warning_count): New function.
14100
14101         * options.h (class General_options): Add -Bsymbolic-functions.
14102         * symtab.h (Symbol::is_preemptible): Check for
14103         -Bsymbolic-functions.
14104
14105 2008-05-05  Ian Lance Taylor  <iant@google.com>
14106
14107         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14108         as noVARNAME rather than no-VARNAME.
14109         (class General_options): Add option -z combreloc.
14110         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14111         get_address.
14112         (Output_reloc::sort_before) [SHT_REL]: New function.
14113         (Output_reloc::sort_before) [SHT_RELA]: New function.
14114         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14115         Sort_relocs_comparison.
14116         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14117         parameter.  Change all callers.
14118         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14119         sort_relocs parameter.  Change all callers.
14120         * output.cc (Output_reloc::get_address): New function, broken out
14121         of write_rel.
14122         (Output_reloc::write_rel): Call it.
14123         (Output_reloc::compare): New function.
14124         (Output_data_reloc_base::do_write): Optionally sort relocs.
14125
14126         * configure.ac: If targ_extra_obj is set, link it in.
14127         * configure.tgt: Initialize all variables.
14128         (x86_64*): Set targ_extra_obj and targ_extra_size.
14129         * configure: Rebuild.
14130
14131         * object.cc (Sized_relobj::include_section_group): Adjust section
14132         indexes read from group data.  Build vector to pass to
14133         layout_group.
14134         * layout.cc (Layout::layout_group): Add flags and shndxes
14135         parameters.  Remove contents parameter.  Change caller.  Update
14136         explicit instantiations.
14137         * layout.h (class Layout): Update layout_group declaration.
14138         * output.cc (Output_data_group::Output_data_group): Add flags and
14139         input_shndxes parameters.  Remove contents parameter.  Change
14140         caller.
14141         (Output_data_group::do_write): Change input_sections_ to
14142         input_shndxes_.
14143         * output.h (class Output_data_group): Update constructor
14144         declaration.  Rename input_sections_ to input_shndxes_.
14145         * testsuite/many_sections_test.cc: Add template.
14146
14147 2008-04-30  Cary Coutant  <ccoutant@google.com>
14148
14149         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14150
14151         * layout.cc (Layout::include_section): Refactored check for debug
14152         info section.
14153         (Layout::add_comdat): Add new parameters.  Change type
14154         of signature parameter.  Add object and shndx to signatures table.
14155         (Layout::find_kept_object): New function.
14156         * layout.h: Include <cstring>.
14157         (Layout::is_debug_info_section): New function.
14158         (Layout::add_comdat): Add new parameters.
14159         (Layout::find_kept_object): New function.
14160         (Layout::Kept_section): New struct.
14161         (Layout::Signatures): Change type of map range.
14162         * object.cc (Relobj::output_section_address): New function.
14163         (Sized_relobj::include_section_group): Add new parameters.  Change
14164         calls to Layout::add_comdat.  Change to build table of kept comdat
14165         groups and table mapping discarded sections to kept sections.
14166         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14167         (Sized_relobj::do_layout): Change calls to include_section_group and
14168         include_linkonce_section.
14169         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14170         value to zero when section is discarded.
14171         (Sized_relobj::map_to_kept_section): New function.
14172         * object.h (Relobj::output_section_address): New function.
14173         (Relobj::Comdat_group): New type.
14174         (Relobj::find_comdat_group): New function.
14175         (Relobj::Comdat_group_table): New type.
14176         (Relobj::Kept_comdat_section): New type.
14177         (Relobj::Kept_comdat_section_table): New type.
14178         (Relobj::add_comdat_group): New function.
14179         (Relobj::set_kept_comdat_section): New function.
14180         (Relobj::get_kept_comdat_section): New function.
14181         (Relobj::comdat_groups_): New field.
14182         (Relobj::kept_comdat_sections_): New field.
14183         (Symbol_value::input_value): Update comment.
14184         (Sized_relobj::map_to_kept_section) New function.
14185         (Sized_relobj::include_linkonce_section): Add new parameter.
14186         * target-reloc.h (Comdat_behavior): New type.
14187         (get_comdat_behavior): New function.
14188         (relocate_section): Add code to map a discarded section to the
14189         corresponding kept section when applying a relocation.
14190
14191 2008-04-30  Craig Silverstein  <csilvers@google.com>
14192
14193         * dwarf_reader.cc (next_generation_count): New static var.
14194         (Addr2line_cache_entry): New struct.
14195         (addr2line_cache): New static var.
14196         (Dwarf_line_info::one_addr2line): Added caching.
14197         (Dwarf_line_info::clear_addr2line_cache): New function.
14198         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14199         cache-size parameter.
14200         (Dwarf_line_info::one_addr2line_cache): New function.
14201         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14202         new cache-size argument to one_addr2line(), and clear cache.
14203
14204 2008-04-28  Cary Coutant  <ccoutant@google.com>
14205
14206         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14207         R_386_PC8 relocations.
14208
14209 2008-04-23  Ian Lance Taylor  <iant@google.com>
14210
14211         * object.cc (Sized_relobj::include_section_group): Check for
14212         invalid section group.
14213
14214         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14215         header size.
14216
14217         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14218         than read for file header.
14219         * archive.cc (Archive::include_member): Likewise.
14220
14221 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14222
14223         * aclocal.m4: Regenerate.
14224         * configure: Regenerate.
14225
14226 2008-04-19  Ian Lance Taylor  <iant@google.com>
14227
14228         * version.cc (version_string): Bump to 1.6.
14229
14230         * testsuite/Makefile.am (many_sections_r_test): New target.
14231         (many_sections_r_test_SOURCES): Remove.
14232         (many_sections_r_test_DEPENDENCIES): Remove.
14233         (many_sections_r_test_LDFLAGS): Remove.
14234         (many_sections_r_test_LDADD): Remove.
14235
14236         * object.cc (Sized_relobj::do_add_symbols): Always pass
14237         local_symbol_count_ to add_from_relobj.
14238
14239         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14240         every thousand variables.
14241         * testsuite/Makefile.in: Rebuild.
14242
14243         * object.cc (Xindex::initialize_symtab_xindex): New function.
14244         (Xindex::read_symtab_xindex): New function.
14245         (Xindex::sym_xindex_to_shndx): New function.
14246         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14247         available.
14248         (Sized_relobj::do_initialize_xindex): New function.
14249         (Sized_relobj::do_read_symbols): Adjust section links.
14250         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14251         parameter.  Change all callers.
14252         (Sized_relobj::include_section_group): Adjust section links and
14253         symbol section indexes.
14254         (Sized_relobj::do_layout): Adjust section links.
14255         (Sized_relobj::do_count_local_symbols): Adjust section links and
14256         symbol section indexes.
14257         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14258         ordinary and special symbols.
14259         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14260         dynsym_xindex parameters.  Change all callers.  Adjust section
14261         links.  Use SHN_XINDEX when needed.
14262         (Sized_relobj::get_symbol_location_info): Adjust section links.
14263         Don't get fooled by special symbols.
14264         * object.h (class Xindex): Define.
14265         (class Object): Add xindex_ parameter.  Declare virtual functoin
14266         do_initialize_xindex.
14267         (Object::adjust_sym_shndx): New function.
14268         (Object::set_xindex): New protected function.
14269         (class Symbol_value): Add is_ordinary_shndx_ field.
14270         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14271         (Symbol_value::value): Assert ordinary section.
14272         (Symbol_value::initialize_input_to_output_map): Likewise.
14273         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14274         Change all callers.
14275         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14276         all callers.
14277         (class Sized_relobj): Update declarations.
14278         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14279         parameter.  Change all callers.
14280         (Sized_relobj::adjust_shndx): New function.
14281         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14282         field.
14283         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14284         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14285         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14286         (Sized_dynobj::read_dynsym_section): Adjust section links.
14287         (Sized_dynobj::read_dynamic): Likewise.
14288         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14289         section links.
14290         (Sized_dynobj::do_initialize_xindex): New function.
14291         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14292         do_initialize_xindex.
14293         (Sized_dynobj::adjust_shndx): New function.
14294         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14295         dynsym_xindex_ fields.
14296         (Layout::finalize): Add a call to set_section_indexes before
14297         creating the symtab sections.
14298         (Layout::set_section_indexes): Don't do anything if the section
14299         already has a section index.
14300         (Layout::create_symtab_sections): Add shnum parameter.  Change
14301         caller.  Create .symtab_shndx section if needed.
14302         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14303         caller.
14304         (Layout::allocated_output_section_count): New function.
14305         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14306         needed.
14307         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14308         fields.  Update declarations.
14309         (Layout::symtab_xindex): New function.
14310         (Layout::dynsym_xindex): New function.
14311         (class Write_symbols_task): Add layout_ field.
14312         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14313         Change caller.
14314         * output.cc (Output_section_headers::Output_section_headers): Add
14315         shstrtab_section parameter.  Change all callers.
14316         (Output_section_headers::do_sized_write): Store overflow values
14317         for section count and section string table section index in
14318         section header zero.
14319         (Output_file_header::do_sized_write): Check for overflow of
14320         section count and section string table section index.
14321         (Output_symtab_xindex::do_write): New function.
14322         (Output_symtab_xindex::endian_do_write): New function.
14323         * output.h (class Output_section_headers): Add shstrtab_section_.
14324         Update declarations.
14325         (class Output_symtab_xindex): Define.
14326         (Output_section::has_out_shndx): New function.
14327         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14328         field.
14329         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14330         Change all callers.
14331         (Sized_symbol::init): Likewise.
14332         (Symbol::output_section): Check for ordinary symbol.
14333         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14334         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14335         callers.
14336         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14337         Change all callers.  Simplify handling of symbols from sections
14338         not included in the link.
14339         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14340         distinction.
14341         (Weak_alias_sorter::operator()): Assert that symbols are
14342         ordinary.
14343         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14344         distinction.
14345         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14346         parameters.  Change all callers.
14347         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14348         symbol distinction.  Use SHN_XINDEX when needed.
14349         (Symbol_table::write_section_symbol): Add symtab_xindex
14350         parameter.  Change all callers.
14351         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14352         SHN_XINDEX when needed.
14353         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14354         declarations.
14355         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14356         (Symbol::is_defined): Check is_ordinary.
14357         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14358         (Symbol::is_absolute, Symbol::is_common): Likewise.
14359         (class Sized_symbol): Update declarations.
14360         (class Symbol_table): Update declarations.
14361         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14362         parameters.  Change all callers.
14363         (Sized_symbol::override): Likewise.
14364         (Symbol_table::override): Likewise.
14365         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14366         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14367         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14368         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14369         to be in an ordinary section.
14370         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14371         object and is_ordinary parameters.  Change all callers.
14372         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14373         Change all callers.  Don't add undefined or non-ordinary symbols
14374         to reloc_map_.
14375         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14376         Change all callers.
14377         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14378         declarations.
14379         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14380         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14381         (Sized_relobj::relocate_sections): Likewise.
14382         * target-reloc.h (scan_relocs): Adjust section symbol index.
14383         (scan_relocatable_relocs): Likewise.
14384         * i386.cc (Scan::local): Check for ordinary symbols.
14385         * sparc.cc (Scan::local): Likewise.
14386         * x86_64.cc (Scan::local): Likewise.
14387         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14388         to symbol_section_and_value.
14389         * testsuite/many_sections_test.cc: New file.
14390         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14391         (check_PROGRAMS): Add many_sections_test.
14392         (many_sections_test_SOURCES): Define.
14393         (many_sections_test_DEPENDENCIES): Define.
14394         (many_sections_test_LDFLAGS): Define.
14395         (BUILT_SOURCES): Add many_sections_define.h.
14396         (many_sections_define.h): New target.
14397         (BUILT_SOURCES): Add many_sections_check.h.
14398         (many_sections_check.h): New target.
14399         (check_PROGRAMS): Add many_sections_r_test.
14400         (many_sections_r_test_SOURCES): Define.
14401         (many_sections_r_test_DEPENDENCIES): Define.
14402         (many_sections_r_test_LDFLAGS): Define.
14403         (many_sections_r_test_LDADD): Define.
14404         (many_sections_r_test.o): New target.
14405         * testsuite/Makefile.in: Rebuild.
14406
14407 2008-04-17  Cary Coutant  <ccoutant@google.com>
14408
14409         * errors.cc (Errors::info): New function.
14410         (gold_info): New function.
14411         * errors.h (Errors::info): New function.
14412         * gold.h (gold_info): New function.
14413         * object.cc (Input_objects::add_object): Print trace output.
14414         * options.cc (options::parse_set): New function.
14415         (General_options::parse_wrap): Deleted.
14416         (General_options::General_options): Deleted initializer.
14417         * options.h (options::String_set): New typedef.
14418         (options::parse_set): New function.
14419         (DEFINE_set): New macro.
14420         (General_options::wrap): Changed to use DEFINE_set. Changed
14421         callers of any_wrap_symbols and is_wrap_symbol.
14422         (General_options::trace, General_options::trace_symbol):
14423         New options.
14424         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14425         (General_options::wrap_symbols_): Deleted.
14426         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14427
14428 2008-04-17  David S. Miller  <davem@davemloft.net>
14429
14430         * options.cc (General_options::parse_V): New function.
14431         * options.h: Add entries for -V and -Qy.
14432
14433 2008-04-17  Ian Lance Taylor  <iant@google.com>
14434
14435         * common.cc (Symbol_table::allocate_commons): Remove options
14436         parameter.  Change caller.
14437         (Symbol_table::do_allocate_commons): Remove options parameter.
14438         Change caller.  Just call do_allocate_commons_list twice.
14439         (Symbol_table::do_allocate_commons_list): New function, broken out
14440         of do_allocate_commons.
14441         * common.h (class Allocate_commons_task): Remove options_ field.
14442         Update constructor.
14443         * symtab.cc (Symbol_table::Symbol_table): Initialize
14444         tls_commons_.
14445         (Symbol_table::add_from_object): Put TLS common symbols on
14446         tls_commons_ list.
14447         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14448         which are IN_OUTPUT_DATA.
14449         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14450         allocate_commons and do_allocate_commons declarations.  Declare
14451         do_allocate_commons_list.
14452         * gold.cc (queue_middle_tasks): Update creation of
14453         Allocate_commons_task to not pass options.
14454         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14455         (TLS_TEST_C_FLAGS): New variable.
14456         (tls_test_c_pic.o): New target.
14457         (tls_test_shared.so): Link in tls_test_c_pic.o.
14458         (tls_test_c_pic_ie.o): New target.
14459         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14460         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14461         (tls_test_c.o): New target.
14462         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14463         (tls_pic_test_LDADD): Likewise.
14464         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14465         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14466         (tls_test_c_gnu2.o): New target.
14467         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14468         tls_test_c_gnu2.o.
14469         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14470         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14471         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14472         * testsuite/tls_test.cc: Include "config.h".
14473         (t_last): Call t11_last.
14474         * testsuite/tls_test.h (t11, t11_last): Declare.
14475         * testsuite/tls_test_c.c: New file.
14476         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14477         * configure.ac: Check for OpenMP support.
14478         * configure, config.in, Makefile.in: Rebuild.
14479         * testsuite/Makefile.in: Rebuild.
14480
14481 2008-04-16  Cary Coutant  <ccoutant@google.com>
14482
14483         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14484         (Target_i386::tls_base_symbol_defined_): New field.
14485         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14486         (Target_i386::Scan::global): Likewise.
14487         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14488         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14489         (Target_x86_64::tls_base_symbol_defined_): New field.
14490         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14491         (Target_x86_64::Scan::global): Likewise.
14492
14493 2008-04-16  Cary Coutant  <ccoutant@google.com>
14494
14495         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14496         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14497         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14498         building shared libraries.
14499         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14500         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14501         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14502         * testsuite/Makefile.in: Rebuild.
14503         * testsuite/weak_undef.h: New file.
14504         * testsuite/weak_undef_file1.cc: Add extra test cases.
14505         * testsuite/weak_undef_file2.cc: Likewise.
14506         * testsuite/weak_undef_test.cc: Likewise.
14507
14508 2008-04-16  David S. Miller  <davem@davemloft.net>
14509
14510         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14511         Add issued_non_pic_error_ field.  Declare check_non_pic.
14512         (Target_sparc::Scan::check_non_pic): New function.
14513         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14514         (Target_sparc::Scan::global): Likewise.
14515
14516         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14517         * configure: Rebuild.
14518
14519         * options.h (DEFINE_enable): New macro.
14520         (new_dtags): New enable option.
14521         (initfirst, interpose, loadfltr, nodefaultlib,
14522         nodelete, nodlopen, nodump): New -z options.
14523         * layout.cc (Layout:finish_dynamic_section): If new
14524         dtags enabled, emit DT_RUNPATH.  Also, emit a
14525         DT_FLAGS_1 containing any specified -z flags.
14526
14527 2008-04-16  Ian Lance Taylor  <iant@google.com>
14528
14529         * copy-relocs.cc: New file.
14530         * copy-relocs.h: New file.
14531         * reloc.cc: Remove Copy_relocs code.
14532         * reloc.h: Likewise.
14533         * reloc-types.h (struct Reloc_types) [both versions]: Add
14534         get_reloc_addend_noerror.
14535         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14536         variants of add_global which take an addend which must be zero.
14537         * i386.cc: Include "copy-relocs.h".
14538         (class Target_i386): Change type of copy_relocs_ to variable,
14539         update initializer.
14540         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14541         Change all callers.
14542         (Target_i386::do_finalize_sections): Change handling of
14543         copy_relocs_.
14544         * sparc.cc: Include "copy-relocs.h".
14545         (class Target_sparc): Change type of copy_relocs_ to variable,
14546         update initializer.
14547         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14548         Change all callers.
14549         (Target_sparc::do_finalize_sections): Change handling of
14550         copy_relocs_.
14551         * x86_64.cc: Include "copy-relocs.h".
14552         (class Target_x86_64): Change type of copy_relocs_ to variable,
14553         update initializer.
14554         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14555         class.  Change all callers.
14556         (Target_x86_64::do_finalize_sections): Change handling of
14557         copy_relocs_.
14558         * Makefile.am (CCFILES): Add copy-relocs.cc.
14559         (HFILES): Add copy-relocs.h.
14560
14561         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14562
14563         * testsuite/script_test_4.sh: Permit leading zeroes.
14564
14565 2008-04-15  Ian Lance Taylor  <iant@google.com>
14566
14567         * script-sections.cc (Script_sections::create_segments): Use
14568         header_size_adjustment even when there is enough room for the
14569         headers.
14570         * testsuite/script_test_4.sh: New file.
14571         * testsuite/script_test_4.t: New file.
14572         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14573         (check_DATA): Add script_test_4.stdout.
14574         (MOSTLYCLEANFILES): Likewise.
14575         (script_test_4): New target.
14576         (script_test_4.stdout): New target.
14577         * testsuite/Makefile.in: Rebuild.
14578
14579         * sparc.cc: Add definitions for Output_data_plt_sparc class
14580         constants.
14581
14582 2008-04-14  David S. Miller  <davem@davemloft.net>
14583
14584         * sparc.cc: New file.
14585         * Makefile.am (TARGETSOURCES): Add sparc.cc
14586         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14587         * configure.tgt: Document targ_extra_size and
14588         targ_extra_big_endian.  Add entries for sparc-* and
14589         sparc64-*.
14590         * configure.ac: Handle targ_extra_size and
14591         targ_extra_big_endian.
14592         * Makefile.in: Rebuild.
14593         * configure: Likewise.
14594         * po/POTFILES.in: Likewise.
14595         * po/gold.pot: Likewise.
14596
14597 2008-04-14  Ian Lance Taylor  <iant@google.com>
14598
14599         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14600         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14601         in the name/type/flags to section mapping.  Don't call
14602         allocate_output_section.
14603         (Layout::choose_output_section): Change parameter from adjust_name
14604         to is_input_section.  Don't permit input sections after sections
14605         are attached to segments.  Don't call allocate_output_section.
14606         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14607         not write_enable_output_section.
14608         (Layout::make_output_section): Don't push to
14609         unattached_section_list_ nor call attach_to_segment.  Call
14610         attach_section_to_segment if sections are attached.
14611         (Layout::attach_sections_to_segments): New function.
14612         (Layout::attach_section_to_segment): New function.
14613         (Layout::attach_allocated_section_to_segment): Rename from
14614         attach_to_segment.  Remove flags parameter.
14615         (Layout::allocate_output_section): Remove function.
14616         (Layout::write_enable_output_section): Remove function.
14617         * layout.h (class Layout): Update for above changes.  Add new
14618         field sections_are_attached_.
14619         * output.h (Output_section::update_flags_for_input_section): New
14620         function.
14621         * output.cc (Output_section::add_input_section): Call
14622         update_flags_for_input_section.
14623         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14624
14625 2008-04-11  Cary Coutant  <ccoutant@google.com>
14626
14627         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14628         thought unnecessary.
14629         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14630
14631 2008-04-11  Ian Lance Taylor  <iant@google.com>
14632
14633         * output.h (class Output_section_data): Remove inline definition
14634         of set_addralign.
14635         * output.cc (Output_section_data::set_addralign): New function.
14636
14637 2008-04-11  Cary Coutant  <ccoutant@google.com>
14638
14639         Add support for TLS descriptors for i386 and x86_64.
14640         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14641         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14642         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14643         GOT_TYPE_TLS_DESC.
14644         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14645         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14646         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14647         relocations.
14648         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14649         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14650         Fix problem with initial-exec relocations.
14651         (Target_i386::Relocate::relocate_tls): Likewise.
14652         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14653         relaxation.
14654         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14655         support for section-plus-offset dynamic table entries.
14656         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14657         (Output_data_dynamic::Dynamic_entry): Add support for
14658         section-plus-offset dynamic table entries.
14659         (Output_data_dynamic::Classification): Likewise.
14660         (Output_data_dynamic::classification_): Renamed offset_.
14661         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14662         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14663         (Target_x86_64::make_plt_section): New function.
14664         (Target_x86_64::reserve_tlsdesc_entries): New function.
14665         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14666         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14667         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14668         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14669         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14670         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14671         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14672         add extra PLT entry for TLS descriptors.
14673         (Output_data_plt_x86_64::got_): New field.
14674         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14675         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14676         fields.
14677         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14678         descriptors.
14679         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14680         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14681         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14682         R_386_TLS_DESC_CALL relocations.
14683         (Target_x86_64::Scan::global): Likewise.
14684         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14685         for TLS descriptors.
14686         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14687         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14688         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14689         GD-to-IE relaxation.
14690         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14691         and TLS_DESCRIPTORS.
14692         * Makefile.in: Rebuild.
14693         * configure: Rebuild.
14694         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14695         (tls_test_shared2.so): New target.
14696         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14697         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14698         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14699         (tls_shared_gd_to_ie_test_LDADD): New variable.
14700         (tls_shared_gnu2_gd_to_ie_test): New target.
14701         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14702         New targets.
14703         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14704         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14705         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14706         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14707         (tls_shared_gnu2_test): New target.
14708         (tls_test_gnu2_shared.so): New target.
14709         (tls_shared_gnu2_test_SOURCES): New variable.
14710         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14711         (tls_shared_gnu2_test_LDFLAGS): New variable.
14712         (tls_shared_gnu2_test_LDADD): New variable.
14713         * testsuite/Makefile.in: Rebuild.
14714         * testsuite/Makefile.
14715
14716 2008-04-11  Ian Lance Taylor  <iant@google.com>
14717
14718         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14719         justsyms.t.
14720         * testsuite/Makefile.in: Rebuild.
14721
14722         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14723         long.
14724         * testsuite/script_test_2.cc (main): Adjust test.
14725
14726 2008-04-11  David S. Miller  <davem@davemloft.net>
14727             Ian Lance Taylor  <iant@google.com>
14728
14729         * options.h (General_options): Add entries for '-Y' and
14730         '-relax'.
14731         * options.cc (General_options:finalize): If -Y was used, add those
14732         entries to the library path instead of the default "/lib" and
14733         "/usr/lib".
14734
14735 2008-04-11  David S. Miller  <davem@davemloft.net>
14736
14737         * testsuite/justsyms.t: Start at 0x100.
14738         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14739         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14740         long.
14741         * testsuite/script_test_2.cc: Adjust string and section length
14742         checks.
14743
14744 2008-04-09  Ian Lance Taylor  <iant@google.com>
14745
14746         PR gold/5996
14747         * script-sections.cc (Sections_element::allocate_to_segment): Add
14748         orphan parameter.
14749         (Output_section_definition::allocate_to_segment): Likewise.
14750         (Orphan_output_section::allocate_to_segment): Likewise.
14751         (Script_sections::attach_sections_using_phdrs_clause): Don't
14752         propagate non-PT_LOAD segments to orphan sections.
14753         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14754         readelf rather than objdump.
14755         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14756         .interp section and PT_INTERP segment are the same size.
14757         * testsuite/Makefile.in: Rebuild.
14758
14759         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14760         aliases for symbols defined in the same object.
14761         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14762         (weak_alias_test_SOURCES): New variable.
14763         (weak_alias_test_DEPENDENCIES): New variable.
14764         (weak_alias_test_LDFLAGS): New variable.
14765         (weak_alias_test_LDADD): New variable.
14766         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14767         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14768         (weak_alias_test_3.o): New target.
14769         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14770         * testsuite/weak_alias_test_main.cc: New file.
14771         * testsuite/weak_alias_test_1.cc: New file.
14772         * testsuite/weak_alias_test_2.cc: New file.
14773         * testsuite/weak_alias_test_3.cc: New file.
14774
14775 2008-04-08  Ian Lance Taylor  <iant@google.com>
14776
14777         * options.h (class General_options): Add --noinhibit-exec option.
14778         * main.cc (main): Check --noinhibit-exec.
14779
14780         * options.h (class General_options): Define --wrap as a special
14781         option.  Add wrap_symbols_ field.
14782         (General_options::any_wrap_symbols): New function.
14783         (General_options::is_wrap_symbol): New function.
14784         * options.cc (General_options::parse_wrap): New function.
14785         (General_options::General_options): Initialize wrap_symbols_.
14786         * symtab.cc (Symbol_table::wrap_symbol): New function.
14787         (Symbol_table::add_from_object): Handle --wrap.
14788         * symtab.h (class Symbol_table): Declare wrap_symbol.
14789         * target.h (Target::wrap_char): New function.
14790         (Target::Target_info): Add wrap_char field.
14791         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14792         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14793         * testsuite/testfile.cc (Target_test::test_target_info):
14794         Likewise.
14795
14796         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14797         there is one.
14798
14799         * layout.h (class Layout): Add added_eh_frame_data_ field.
14800         * layout.cc (Layout::Layout): Initialize new field.
14801         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14802         output section until we find a section we merged successfully.
14803         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14804         that the size be non-zero.
14805
14806         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14807         qualifier.
14808
14809 2008-04-08  Craig Silverstein  <csilvers@google.com>
14810
14811         * configure.ac: Export new conditional variable HAVE_ZLIB.
14812         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14813         on HAVE_ZLIB.
14814         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14815         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14816
14817 2008-04-07  Ian Lance Taylor  <iant@google.com>
14818
14819         * version.cc (version_string): Set to "1.5".
14820
14821         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14822         Add issued_non_pic_error_ field.  Declare check_non_pic.
14823         (Target_x86_64::Scan::check_non_pic): New function.
14824         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14825         (Target_x86_64::Scan::global): Likewise.
14826
14827         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14828         addend parameter.  Change caller.  Handle merge sections.
14829         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14830         Address to Addend.  Don't add in the result of
14831         local_section_offset, pass down the addend and use the returned
14832         value.
14833         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14834         Update declarations of local_section_offset and symbol_value.
14835         * testsuite/two_file_test_1.cc (t18): New function.
14836         * testsuite/two_file_test_2.cc (f18): New function.
14837         * testsuite/two_file_test_main.cc (main): Call t18.
14838         * testsuite/two_file_test.h (t18, f18): Declare.
14839
14840         * configure.ac: Don't test for objdump, c++filt, or readelf.
14841         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14842         conditionals.
14843         (TEST_READELF): New variable.
14844         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14845         (check_PROGRAMS): Add two_file_strip_test.
14846         (two_file_strip_test): New target.
14847         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14848         (two_file_same_shared_strip_test_SOURCES): New variable.
14849         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14850         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14851         (two_file_same_shared_strip_test_LDADD): New variable.
14852         (two_file_shared_strip.so): New target.
14853         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14854         (ver_test_5.syms, ver_test_7.syms): Likewise.
14855         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14856         (strip_test_3.stdout): Use TEST_OBJDUMP.
14857         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14858
14859 2008-04-04  Cary Coutant  <ccoutant@google.com>
14860
14861         * symtab.h (Symbol::is_weak_undefined): New function.
14862         (Symbol::is_strong_undefined): New function.
14863         (Symbol::is_absolute): New function.
14864         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14865         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14866         absolute symbols.
14867         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14868         (weak_undef_test): New target.
14869         * testsuite/Makefile.in: Rebuild.
14870         * testsuite/weak_undef_file1.cc: New file.
14871         * testsuite/weak_undef_file2.cc: New file.
14872         * testsuite/weak_undef_test.cc: New file.
14873
14874 2008-04-03  Craig Silverstein  <csilvers@google.com>
14875
14876         * compressed_output.h (class Output_compressed_section): Use
14877         unsigned buffer.
14878         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14879         add zlib header.
14880         (zlib_compressed_suffix): Removed.
14881         (Output_compressed_section::set_final_data_size): Use unsigned
14882         buffers.
14883         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14884         Fix linker invocation.
14885         (flagstest_o_specialfile_and_compress_debug_sections):
14886         Likewise.
14887         * testsuite/Makefile.in: Regenerated.
14888
14889 2008-04-02  David S. Miller  <davem@davemloft.net>
14890
14891         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14892         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14893
14894 2008-04-02  Craig Silverstein  <csilvers@google.com>
14895
14896         * TODO: New file.
14897
14898 2008-04-02  Ian Lance Taylor  <iant@google.com>
14899
14900         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14901         parameters.  Update for new key type to views_.  Change all
14902         callers.
14903         (File_read::read): Adjust for byteshift in returned view.
14904         (File_read::add_view): New function, broken out of
14905         find_and_make_view.
14906         (File_read::make_view): New function, broken out of
14907         find_and_make_view.
14908         (File_read::find_or_make_view): Add offset and aligned
14909         parameters.  Rewrite accordingly.  Change all callers.
14910         (File_read::get_view): Add offset and aligned parameters.  Adjust
14911         for byteshift in return value.
14912         (File_read::get_lasting_view): Likewise.
14913         * fileread.h (class File_read): Update declarations.
14914         (class File_read::View): Add byteshift_ field.  Add byteshift to
14915         constructor.  Add byteshift method.
14916         * archive.h (Archive::clear_uncached_views): New function.
14917         (Archive::get_view): Add aligned parameter.  Change all callers.
14918         * object.h (Object::get_view): Add aligned parameter.  Change all
14919         callers.
14920         (Object::get_lasting_view): Likewise.
14921
14922         * fileread.cc (File_read::release): Don't call clear_views if
14923         there are multiple objects.
14924         * fileread.h (File_read::clear_uncached_views): New function.
14925         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14926         on the archive.
14927
14928 2008-03-31  Cary Coutant  <ccoutant@google.com>
14929
14930         Add thin archive support.
14931         * archive.cc (Archive::armagt): New const.
14932         (Archive::setup): Remove task parameter and calls to unlock.
14933         (Archive::unlock_nested_archives): New function.
14934         (Archive::read_header): Add nested_off parameter. Change
14935         all callers.
14936         (Archive::interpret_header): Likewise.
14937         (Archive::include_all_members): Change to handle thin
14938         archives.
14939         (Archive::include_member): Likewise.
14940         * archive.h (Archive::Archive): Add new parameters and
14941         initializers.
14942         (Archive::armagt): New const.
14943         (Archive::setup): Remove task parameter.
14944         (Archive::unlock_nested_archives): New function.
14945         (Archive::read_header): Add nested_off parameter.
14946         (Archive::interpret_header): Likewise.
14947         (Archive::Nested_archive_table): New typedef.
14948         (Archive::is_thin_archive_): New field.
14949         (Archive::nested_archives_): New field.
14950         (Archive::options_): New field.
14951         (Archive::dirpath_): New field.
14952         (Archive::task_): New field.
14953         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14954         for thin archives.  Pass additional parameters to
14955         Archive::Archive.  Unlock the archive file after calling
14956         Archive::setup.
14957
14958 2008-03-29  Ian Lance Taylor  <iant@google.com>
14959
14960         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14961         version symbol to be local.
14962         * testsuite/ver_test_4.sh: New file.
14963         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14964         (check_DATA): Add ver_test_4.syms.
14965         (ver_test_4.syms): New target.
14966         * testsuite/Makefile.in: Rebuild.
14967
14968         * output.cc
14969         (Output_section::Input_section_sort_entry::has_priority): New
14970         function.
14971         (Output_section::Input_section_sort_entry::match_file_name): New
14972         function.
14973         (Output_section::Input_section_sort_entry::match_section_name):
14974         Remove.
14975         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14976         Remove.
14977         (Output_section::Input_section_sort_entry::match_section_file):
14978         Remove.
14979         (Output_section::Input_section_sort_compare::operator()): Rewrite
14980         using new Input_section_sort_entry functions.  Sort crtbegin and
14981         crtend first.  Sort sections with no priority before sections with
14982         a priority.
14983         * testsuite/initpri1.c (d3): Check j != 4.
14984         (cd5): New constructor/destructor function.
14985         (main): Check j != 2.
14986
14987         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14988         new symbol when resolving, don't call set_is_default.
14989         * testsuite/ver_test_7.cc: New file.
14990         * testsuite/ver_test_7.sh: New file.
14991         * testsuite/Makefile.am (ver_test_7.so): New target.
14992         (ver_test_7.o): New target.
14993         (check_SCRIPTS): Add ver_test_7.sh.
14994         (check_DATA): Add ver_test_7.syms.
14995         (ver_test_7.syms): New target.
14996
14997 2008-03-28  Ian Lance Taylor  <iant@google.com>
14998
14999         * layout.cc (Layout::layout): If we see an input section with a
15000         name that needs sorting, set the must_sort flag for the output
15001         section.
15002         (Layout::make_output_section): If the name of the output section
15003         indicates that it might require sorting, set the may_sort flag.
15004         * output.h (Output_section::may_sort_attached_input_sections): New
15005         function.
15006         (Output_section::set_may_sort_attached_input_sections): New
15007         function.
15008         (Output_section::must_sort_attached_input_sections): New
15009         function.
15010         (Output_section::set_must_sort_attached_input_sections): New
15011         function.
15012         (class Output_section): Declare Input_section_sort_entry.  Define
15013         Input_section_sort_compare.  Declare
15014         sort_attached_input_sections.  Add new fields:
15015         may_sort_attached_input_sections_,
15016         must_sort_attached_input_sections_,
15017         attached_input_sections_are_sorted_.
15018         * output.cc (Output_section::Output_section): Initialize new
15019         fields.
15020         (Output_section::add_input_section): Add an entry to
15021         input_sections_ if may_sort or must_sort are true.
15022         (Output_section::set_final_data_size): Call
15023         sort_attached_input_sections if necessary.
15024         (Output_section::Input_section_sort_entry): Define new class.
15025         (Output_section::Input_section_sort_compare::operator()): New
15026         function.
15027         (Output_section::sort_attached_input_sections): New function.
15028         * configure.ac: Check whether the compiler supports constructor
15029         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15030         * testsuite/initpri1.c: New file.
15031         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15032         CONSTRUCTOR_PRIORITY.
15033         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15034         (initpri1_LDFLAGS): New variable.
15035         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15036
15037 2008-03-27  Ian Lance Taylor  <iant@google.com>
15038
15039         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15040         * testsuite/common_test_1.c: New file.
15041         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15042         (common_test_1_SOURCES): New variable.
15043         (common_test_1_DEPENDENCIES): New variable.
15044         (common_test_1_LDFLAGS): New variable.
15045
15046         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15047         and commons_ correctly when NAME/VERSION does not override
15048         NAME/NULL.
15049         * testsuite/ver_test_6.c: New file.
15050         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15051         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15052         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15053
15054 2008-03-26  Ian Lance Taylor  <iant@google.com>
15055
15056         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15057         of an undefined symbol from a version script.
15058         * testsuite/Makefile.am (ver_test_5.so): New target.
15059         (ver_test_5.o): New target.
15060         (check_SCRIPTS): Add ver_test_5.sh.
15061         (check_DATA): Add ver_test_5.syms.
15062         (ver_test_5.syms): New target.
15063         * testsuite/ver_test_5.cc: New file.
15064         * testsuite/ver_test_5.script: New file.
15065         * testsuite/ver_test_5.sh: New file.
15066         * Makefile.in, testsuite/Makefile.in: Rebuild.
15067
15068         PR gold/5986
15069         Fix problems building gold with gcc 4.3.0.
15070         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15071         (gold_error_at_location, gold_warning_at_location): Use it.
15072         * configure.ac: Check whether we can compile and use a template
15073         function with a printf attribute.
15074         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15075         when jumping over bytes.
15076         * object.cc: Instantiate Object::read_section_data.
15077         * debug.h: Include <cstring>
15078         * dwarf_reader.cc: Include <algorithm>
15079         * main.cc: Include <cstring>.
15080         * options.cc: Include <cstring>.
15081         * output.cc: Include <cstring>.
15082         * script.cc: Include <cstring>.
15083         * script.h: Include <string>.
15084         * symtab.cc: Include <cstring> and <algorithm>.
15085         * target-select.cc: Include <cstring>.
15086         * version.cc: Include <string>.
15087         * testsuite/testmain.cc: Include <cstdlib>.
15088         * configure, config.in: Rebuild.
15089
15090 2008-03-25  Ian Lance Taylor  <iant@google.com>
15091
15092         * options.cc: Include "../bfd/bfdver.h".
15093         (options::help): Print bug reporting address.
15094
15095         * version.cc (print_version): Adjust output for current value of
15096         BFD_VERSION_STRING.
15097
15098         * NEWS: New file.
15099
15100         * options.cc (options::help): Print list of supported targets.
15101         * target-select.h: Include <vector>.
15102         (class Target_selector): Make machine_, size_, and is_big_endian_
15103         fields const.  Add bfd_name_ and instantiated_target_ fields.
15104         (Target_selector::Target_selector): Add bfd_name parameter.
15105         (Target_selector::recognize): Make non-virtual, call
15106         do_recognize.
15107         (Target_selector::recognize_by_name): Make non-virtual, call
15108         do_recognize_by_name.
15109         (Target_selector::supported_names): New function.
15110         (Target_selector::bfd_name): New function.
15111         (Target_selector::do_instantiate_target): New pure virtual
15112         function.
15113         (Target_selector::do_recognize): New virtual function.
15114         (Target_selector::do_recognize_by_name): New virtual function.
15115         (Target_selector::instantiate_target): New private function.
15116         (supported_target_names): Declare.
15117         * target-select.cc (Target_selector::Target_selector): Update for
15118         new parameter and fields.
15119         (select_target_by_name): Check that the name matches before
15120         calling recognize_by_name.
15121         (supported_target_names): New function.
15122         * i386.cc (class Target_selector_i386): Update Target_selector
15123         constructor call.  Remove recognize and recognize_by_name.  Add
15124         do_instantiate_target.
15125         * x86_64.cc (class Target_selector_x86_64): Likewise.
15126         * testsuite/testfile.cc (class Target_selector_test): Update for
15127         changes to Target_selector.
15128
15129         * README: Rewrite, with some notes on unsupported features.
15130
15131 2008-03-24  Cary Coutant  <ccoutant@google.com>
15132
15133         * i386.cc (Target_i386::Got_type): New enum declaration.
15134         (Target_i386::Scan::local): Updated callers of Output_data_got
15135         member functions.
15136         (Target_i386::Scan::global): Likewise.
15137         (Target_i386::Relocate::relocate): Likewise.
15138         (Target_i386::Relocate::relocate_tls): Likewise.
15139         * object.h (Got_offset_list): New class.
15140         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15141         (Sized_relobj::local_got_offset): Likewise.
15142         (Sized_relobj::set_local_got_offset): Likewise.
15143         (Sized_relobj::local_has_tls_got_offset): Removed.
15144         (Sized_relobj::local_tls_got_offset): Removed.
15145         (Sized_relobj::set_local_tls_got_offset): Removed.
15146         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15147         * output.cc (Output_data_got::add_global): Added got_type parameter.
15148         (Output_data_got::add_global_with_rel): Likewise.
15149         (Output_data_got::add_global_with_rela): Likewise.
15150         (Output_data_got::add_global_pair_with_rel): New function.
15151         (Output_data_got::add_global_pair_with_rela): New function.
15152         (Output_data_got::add_local): Added got_type parameter.
15153         (Output_data_got::add_local_with_rel): Likewise.
15154         (Output_data_got::add_local_with_rela): Likewise.
15155         (Output_data_got::add_local_pair_with_rel): New function.
15156         (Output_data_got::add_local_pair_with_rela): New function.
15157         (Output_data_got::add_global_tls): Removed.
15158         (Output_data_got::add_global_tls_with_rel): Removed.
15159         (Output_data_got::add_global_tls_with_rela): Removed.
15160         (Output_data_got::add_local_tls): Removed.
15161         (Output_data_got::add_local_tls_with_rel): Removed.
15162         (Output_data_got::add_local_tls_with_rela): Removed.
15163         * output.h (Output_data_got::add_global): Added got_type parameter.
15164         (Output_data_got::add_global_with_rel): Likewise.
15165         (Output_data_got::add_global_with_rela): Likewise.
15166         (Output_data_got::add_global_pair_with_rel): New function.
15167         (Output_data_got::add_global_pair_with_rela): New function.
15168         (Output_data_got::add_local): Added got_type parameter.
15169         (Output_data_got::add_local_with_rel): Likewise.
15170         (Output_data_got::add_local_with_rela): Likewise.
15171         (Output_data_got::add_local_pair_with_rel): New function.
15172         (Output_data_got::add_local_pair_with_rela): New function.
15173         (Output_data_got::add_global_tls): Removed.
15174         (Output_data_got::add_global_tls_with_rel): Removed.
15175         (Output_data_got::add_global_tls_with_rela): Removed.
15176         (Output_data_got::add_local_tls): Removed.
15177         (Output_data_got::add_local_tls_with_rel): Removed.
15178         (Output_data_got::add_local_tls_with_rela): Removed.
15179         * resolve.cc (Symbol::override_base_with_special): Removed
15180         reference to has_got_offset_ field.
15181         * symtab.cc (Symbol::init_fields): Replaced initialization
15182         of got_offset_ with got_offsets_.  Removed initialization
15183         of has_got_offset_
15184         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15185         (Symbol::got_offset): Likewise.
15186         (Symbol::set_got_offset): Likewise.
15187         (Symbol::has_tls_got_offset): Removed.
15188         (Symbol::tls_got_offset): Removed.
15189         (Symbol::set_tls_got_offset): Removed.
15190         (Symbol::got_offset_): Removed.
15191         (Symbol::tls_mod_got_offset_): Removed.
15192         (Symbol::tls_pair_got_offset_): Removed.
15193         (Symbol::got_offsets_): New field.
15194         (Symbol::has_got_offset): Removed.
15195         (Symbol::has_tls_mod_got_offset): Removed.
15196         (Symbol::has_tls_pair_got_offset): Removed.
15197         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15198         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15199         member functions.
15200         (Target_x86_64::Scan::global): Likewise.
15201         (Target_x86_64::Relocate::relocate): Likewise.
15202         (Target_x86_64::Relocate::relocate_tls): Likewise.
15203
15204 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15205
15206         * yyscript.y: Fix spelling error in comment.
15207
15208 2008-03-24  Ian Lance Taylor  <iant@google.com>
15209
15210         * options.h (class General_options): Define build_id option.
15211         * layout.h (class Layout): Declare write_build_id, create_note,
15212         create_build_id.  Add build_id_note_ member.
15213         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15214         "libiberty.h", "md5.h", "sha1.h".
15215         (Layout::Layout): Initialize eh_frame_data_,
15216         eh_frame_hdr_section_, and build_id_note_.
15217         (Layout::finalize): Call create_build_id.
15218         (Layout::create_note): New function, broken out of
15219         Layout::create_gold_note.
15220         (Layout::create_gold_note): Call create_note.
15221         (Layout::create_build_id): New function.
15222         (Layout::write_build_id): New function.
15223         (Close_task_runner::run): Call write_build_id.
15224
15225         * x86_64.cc: Correct license to GPLv3.
15226
15227 2008-03-23  Ian Lance Taylor  <iant@google.com>
15228
15229         * options.cc: Include "demangle.h".
15230         (parse_optional_string): New function.
15231         (parse_long_option): Handle takes_optional_argument.
15232         (parse_short_option): Update dash_z initializer.  Handle
15233         takes_optional_argument.
15234         (General_options::General_options): Initialize do_demangle_.
15235         (General_options::finalize): Set do_demangle_.  Handle demangling
15236         style.
15237         * options.h (parse_optional_string): Declare.
15238         (struct One_option): Add optional_arg field.  Update constructor.
15239         Update call constructor calls.  Add takes_optional_argument
15240         function.
15241         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15242         (DEFINE_optional_string): Define.
15243         (General_options::demangle): Change from DEFINE_bool to
15244         DEFINE_optional_string.
15245         (General_options::no_demangle): New function.
15246         (General_options::do_demangle): New function.
15247         (General_options::set_do_demangle): New function.
15248         (General_options::execstack_status_): Move definition to end of
15249         class definition.
15250         (General_options::static_): Likewise.
15251         (General_options::do_demangle_): New field.
15252         * object.cc (big_endian>::get_symbol_location_info): Call
15253         Options::do_demangle, not Options::demangle.
15254         * symtab.cc (demangle): Likewise.
15255
15256 2008-03-22  Ian Lance Taylor  <iant@google.com>
15257
15258         * gold.h: Include <cstddef> and <sys/types.h>
15259         * options.h: Include <cstring>.
15260
15261 2008-03-21  Ian Lance Taylor  <iant@google.com>
15262
15263         * Added source code to GNU binutils.
15264 \f
15265 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15266
15267 Copying and distribution of this file, with or without modification,
15268 are permitted in any medium without royalty provided the copyright
15269 notice and this notice are preserved.
15270
15271 Local Variables:
15272 mode: change-log
15273 left-margin: 8
15274 fill-column: 74
15275 version-control: never
15276 End: