PowerPC64 ELFv2 support for gold.
[external/binutils.git] / gold / ChangeLog
1 2013-10-30  Alan Modra  <amodra@gmail.com>
2
3         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
4         ppc64_local_entry_offset, ppc64_local_entry_offset,
5         do_read_symbols): New functions.
6         (Powerpc_relobj::e_flags_, st_other_): New vars.
7         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
8         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
9         (Powerpc_relobj::e_flags_): New var.
10         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
11         and adjust for ELFv2.
12         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
13         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
14         (Powerpc_dynobj::do_find_special_sections): Likewise.
15         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
16         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
17         to ELFv2 local entry.
18         (Target_powerpc::do_relax): No thread safe barriers needed for
19         ELFv2.
20         (Output_data_plt_powerpc::initial_plt_entry_size_,
21         plt_entry_size): Delete.  Replace all uses with
22         first_plt_entry_offset() and plt_entry_size().
23         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
24         reserved_size parm.  Update callers.
25         (Output_data_plt_powerpc::entry_count): Update.
26         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
27         and use Target_powerpc::first_plt_entry_offset().
28         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
29         rename to plt_entry_size.
30         (Output_data_plt_powerpc::add_ifunc_entry,
31         add_local_ifunc_entry): Adjust reloc for ELFv2.
32         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
33         (glink_eh_frame_fde_64v2): New.
34         (Stub_table::plt_call_size): Support ELFv2 sizing.
35         (Output_data_glink::add_eh_frame): Use the new FDE.
36         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
37         (Stub_table::do_write): Write ELFv2 stubs and glink.
38         (Target_powerpc::Relocate::relocate): Replaces nop after call
39         with ld 2,24(1) and adjust local offset destination for ELFv2.
40
41 2013-10-30  Alan Modra  <amodra@gmail.com>
42
43         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
44         (Target_powerpc::Scan::global, local): Likewise.
45         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
46         on all ppc64 @h and @ha relocs.
47
48 2013-10-14  Alan Modra  <amodra@gmail.com>
49
50         * output.h (Output_data_got::add_constant): Tidy.
51         (Output_data_got::add_constant_pair): New function.
52         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
53         methods used so as to first call reserve_ent().
54
55 2013-10-11  Roland McGrath  <mcgrathr@google.com>
56
57         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
58         add_got_entry and add_got_entry_pair.
59
60         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
61         (HAVE_PUBNAMES): Likewise.
62         * configure: Regenerate.
63
64         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
65         * testsuite/Makefile.in: Regenerate.
66
67         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
68         Remove const from declaration.
69         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
70         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
71         * output.h (Output_file_header): Remove const from member target_
72         and corresponding constructor argument.
73         * output.cc (Output_file_header::Output_file_header): Update prototype.
74         (Output_file_header::do_sized_write): Use this->target_ in place
75         of parameters()->target().
76
77         * testsuite/undef_symbol.cc (Foo::get_a): New method.
78
79         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
80         * configure: Regenerate.
81         * Makefile.in: Regenerate.
82         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
83         * testsuite/merge_string_literals_2.c: Likewise.
84         * testsuite/Makefile.am
85         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
86         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
87         literal -fmerge-constants.
88         * testsuite/Makefile.in: Regenerate.
89
90         * i386.cc (Target_i386): Remove unused member dynbss_.
91         * arm.cc (Target_arm): Likewise.
92         * powerpc.cc (Target_powerpc): Likewise.
93         * sparc.cc (Target_sparc): Likewise.
94         * tilegx.cc (Target_tilegx): Likewise.
95         * x86_64.cc (Target_x86_64): Likewise.
96         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
97         type_signature_, type_offset_.
98         * plugin.h (Plugin_hook): Remove unused member layout_.
99         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
100         mapfile_.
101         (Read_member): Remove unused members input_objects_, symtab_,
102         mapfile_, layout_.
103         (Check_library): Remove unused member symtab_.
104         * archive.h (Lib_group): Remove unused member lib_.
105         * archive.cc (Lib_group::Lib_group): Update initializer.
106         * incremental.h (Incremental_binary): Remove unused member target_.
107         (Incremental_script_entry): Removed unused member script_.
108         * layout.h (Write_symbols_task): Remove unused member input_objects_.
109         * icf.h (Icf): Remove unused member num_tracked_relocs.
110
111         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
112         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
113         its only use.
114         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
115
116         * archive.h: Use struct rather than class for forward declaration
117         of Read_symbols_data.
118
119 2013-10-07  Cary Coutant  <ccoutant@google.com>
120
121         PR gold/16010
122         * testsuite/Makefile.am (icf_test): Fix dependencies.
123         (icf_safe_test): Likewise.
124         (icf_safe_so_test): Likewise.
125         (large_symbol_alignment): Add empty _LDADD rule.
126         * testsuite/Makefile.in: Regenerate.
127
128 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
129
130         PR gold/15927
131         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
132         relocation for R_X86_64_32 on x32.
133
134 2013-08-27  Roland McGrath  <mcgrathr@google.com>
135
136         * output.cc (Output_segment::set_section_addresses): Take new
137         Target* argument.  If target->isolate_execinstr() and the segment
138         is executable and starts at a target->abi_pagesize() boundary,
139         pad its end out to a target->abi_pagesize() boundary with code fill.
140         * output.h (Output_segment::set_section_addresses): Update decl.
141         * layout.h (Layout::check_output_data_for_reset_values): Take new
142         argument RELAX_OUTPUTS.
143         (Layout): New member relax_output_list_.
144         (Layout::add_relax_output): New method.
145         * layout.cc (Layout::Layout): Update constructor.
146         (Layout::reset_relax_output): New method.
147         (Layout::clean_up_after_relaxation): Call it.
148         (Layout::prepare_for_relaxation): Update caller.
149         (Layout::set_segment_offsets): Update callers of set_section_addresses.
150         Call reset_relax_output before re-processing segments for
151         isolate_execinstr case.
152         (Layout::write_data): Handle relax_output_list_.
153         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
154         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
155
156 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
157
158         PR binutils/15834
159         * object.h: Fix typos.
160
161 2013-08-16  Roland McGrath  <mcgrathr@google.com>
162
163         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
164         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
165
166 2013-08-07  Cary Coutant  <ccoutant@google.com>
167
168         Revert support for v2 DWP files:
169
170         2013-03-01  Cary Coutant  <ccoutant@google.com>
171
172             Add dwp support for v2 DWARF package file format.
173             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
174             tu_length parameter.  Adjust all callers.
175             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
176             * dwp.cc: Include dwarf.h.
177             (Section_bounds): New struct type.
178             (Unit_set): New struct type.
179             (Dwo_file::Dwo_file): Initialize new data member.
180             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
181             Combine and rename to...
182             (Dwo_file::read_unit_index): ...this.
183             (Dwo_file::sized_read_compunit_index)
184             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
185             (Dwo_file::sized_read_unit_index): ...this.
186             (Dwo_file::copy_section): Remove section_name, is_str_offsets
187             parameters; add section_id parameter.
188             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
189             (Dwo_file::add_unit_set): ...this.
190             (Dwo_file::shndx_map_): Remove.
191             (Dwo_file::sect_offsets_): New data member.
192             (Dwp_output_file::Dwp_output_file): Initialize new data members.
193             (Dwp_output_file::add_section): Rename to...
194             (Dwp_output_file::add_contribution): ...this.
195             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
196             (Dwp_output_file::add_tu_set): Likewise.
197             (Dwp_output_file::Contribution): New type.
198             (Dwp_output_file::Section::contributions): New data member.
199             (Dwp_output_file::Cu_or_tu_set): Remove.
200             (Dwp_output_file::Section::Section): New ctor.
201             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
202             (Dwp_output_file::Dwp_index::Section_table): New type.
203             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
204             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
205             parameter.
206             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
207             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
208             (Dwp_output_file::Dwp_index::section_table): New member function.
209             (Dwp_output_file::Dwp_index::section_table_end): New member function.
210             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
211             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
212             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
213             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
214             (Dwp_output_file::Dwp_index::section_table_): New data member.
215             (Dwp_output_file::Dwp_index::section_mask_): New data member.
216             (Dwp_output_file::add_output_section): New member function.
217             (Dwp_output_file::write_new_section): New member function.
218             (Dwp_output_file::write_contributions): New member function.
219             (Dwp_output_file::section_id_map_): New data member.
220             (class Dwo_id_info_reader): Remove.
221             (class Unit_reader): New class.
222             (get_dwarf_section_name): New function.
223             (Dwo_file::read_executable): Adjust initializations of class data.
224             (Dwo_file::read): Add support for v2 package file format.
225             (Dwo_file::read_unit_index): Likewise.
226             (Dwo_file::sized_read_unit_index): Likewise.
227             (Dwo_file::copy_section): Likewise.
228             (Dwo_file::add_unit_set): Likewise.
229             (Dwp_output_file::add_output_section): Likewise.
230             (Dwp_output_file::add_contribution): Likewise.
231             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
232             for empty slot.
233             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
234             file format.
235             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
236             slot.
237             (Dwp_output_file::initialize): Remove unused function.
238             (Dwp_output_file::finalize): Add support for v2 package file format.
239             (Dwp_output_file::write_index): Likewise.
240             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
241             function prototype.
242
243 2013-07-31  Cary Coutant  <ccoutant@google.com>
244
245         * object.cc (Sized_relobj::do_output_section_address): New function.
246         (Sized_relobj): Instantiate explicitly.
247         * object.h (Object::output_section_address): New function.
248         (Object::do_output_section_address): New function.
249         (Sized_relobj::do_output_section_address): New function.
250         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
251
252 2013-07-30  Cary Coutant  <ccoutant@google.com>
253             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
254
255         * parameters.cc (Parameters::entry): Return target-specific entry
256         symbol name.
257         * target.h (Target::entry_symbol_name): New function.
258         (Target_info::entry_symbol_name): New data member.
259
260         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
261         * i386.cc (Target_i386::i386_info): Likewise.
262         (Target_i386_nacl::i386_nacl_info): Likewise.
263         * sparc.cc (Target_sparc::sparc_info): Likewise.
264         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
265         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
266         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
267         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
268
269 2013-07-22  Sterling Augustine  <saugustine@google.com>
270
271         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
272         Convert parameter shndx to local variable. Add parameters symtab
273         and symtab_size.  Scan over section names.  Find relocation
274         section corresponding to current section.  Create and initialize
275         reloc_mapper_ and reloc_type_.
276         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
277         unit_length to off_t.  Initialize member unit_length_.  Fill in field
278         cu_offset_.
279         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
280         Initialize new fields unit_length_ and cu_offset_.
281         (Dwarf_pubnames_table::read_section): Update prototype.
282         (Dwarf_pubnames_table::cu_offset): New member function.
283         (Dwarf_pubnames_table::subsection_size): Likewise.
284         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
285         New fields.
286         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
287         member functions public.
288         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
289         Update comment.  Rework logic.  Move repeated parts to...
290         (Gdb_index_info_reader::read_pubtable): ...here. New function.
291         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
292         pubtypes_table_, and stmt_list_offset.
293         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
294         Gdb_index::find_pubtype_offset,
295         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
296         (Gdb_index::pubnames_read): Update prototype and rework logic.
297         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
298         Forward declare.
299         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
300         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
301         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
302         Gdb_index::map_pubtable_to_dies):
303         Declare functions.
304         (Gdb_index::pubnames_read): Update declaration.
305         (Gdb_index::Pubname_offset_map): New type.
306         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
307         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
308         Gdb_index::stmt_list_offset): Declare.
309         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
310         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
311         Gdb_index::pubtypes_offset_): Remove.
312
313 2013-07-19  Roland McGrath  <mcgrathr@google.com>
314
315         * options.h (General_options): Add -Trodata-segment option.
316         * parameters.cc (Parameters::check_rodata_segment): New function.
317         (Parameters::set_target_once): Call it.
318         * parameters.h (Parameters): Declare it (private member function).
319         * layout.cc (load_seg_unusable_for_headers): New function, broken
320         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
321         then validate rodata segment rather than text segment.
322         (relaxation_loop_body): Call that.
323         (is_text_segment): New function.  Don't admit a non-executable
324         segment if TARGET->isolate_execinstr().
325         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
326
327 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
328
329         PR gold/15070
330         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
331         * nacl.h (Sniff_file::View::View): Request aligned view.
332
333 2013-07-11  Cary Coutant  <ccoutant@google.com>
334
335         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
336         correct BRLT entry size.
337
338 2013-07-03  Alan Modra  <amodra@gmail.com>
339
340         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
341         comment.
342
343 2013-07-01  Cary Coutant  <ccoutant@google.com>
344
345         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
346         reloc_type_.
347         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
348         (Dwarf_ranges_table::lookup_reloc): New function.
349         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
350         reloc_type_.
351         (Dwarf_ranges_table::lookup_reloc): New function.
352         (Dwarf_ranges_table::reloc_type_): New data member.
353
354 2013-06-27  Jing Yu  <jingyu@google.com>
355
356         PR gold/15662
357         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
358         function.
359         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
360         (Target_powerpc::do_relax): Call the above.
361
362 2013-06-27  Cary Coutant  <ccoutant@google.com>
363
364         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
365         on garbage collected .opd section.
366
367 2013-06-27  Alan Modra  <amodra@gmail.com>
368
369         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
370         is non-zero.
371         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
372         (Target_powerpc::do_function_location): Likewise for loc->shndx.
373
374 2013-06-14  Cary Coutant  <ccoutant@google.com>
375
376         * resolve.cc (Symbol::override_base): Don't override st_type
377         from plugin placeholder symbols.
378         (Symbol_table::resolve): Likewise.
379         (Symbol_table::should_override): Don't complain about TLS mismatch
380         if the TO symbol is a plugin placeholder.
381         * testsuite/Makefile.am (plugin_test_tls): New test.
382         * testsuite/Makefile.in: Regenerate.
383         * testsuite/plugin_test_tls.sh: New test script.
384         * testsuite/two_file_test_2_tls.cc: New test source.
385         * testsuite/two_file_test_tls.cc: New test source.
386
387 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
388
389         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
390         the maximum segment alignment is larger than the page size.
391         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
392         correctly aligns the symbols with large alignemnt.
393         * testsuite/Makefile.in: Regenerate.
394         * testsuite/large_symbol_alignment.cc: New file.
395
396 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
397             Sriraman Tallam  <tmsriram@google.com>
398
399         * options.h (sort_section): New option.
400         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
401         Rename from Input_section_sort_section_name_special_ordering_compare.
402         (Input_section_sort_section_name_compare): New struct.
403         * output.cc (Output_section::Input_section_sort_section_name_compare::
404         operator()): New function.
405         (Output_section::sort_attached_input_sections): Use new sort function
406         for .text if --sort-section=name is specified.
407         * layout.cc (Layout::make_output_section):
408         Add sorting by name when --sort-section=name is specified.
409         * testsuite/Makefile.am (text_section_grouping): Test option
410         --sort-section=name.
411         * testsuite/Makefile.in: Regenerate.
412         * testsuite/section_sorting_name.cc: New file.
413         * testsuite/section_sorting_name.sh: New file.
414
415 2013-05-21  Cary Coutant  <ccoutant@google.com>
416
417         * symtab.h (Symbol::is_cxx_vtable): New function.
418         * target-reloc.h (relocate_section): Check for vtable symbol.
419         * testsuite/Makefile.am (missing_key_func.sh): New test case.
420         * testsuite/Makefile.in: Regenerate.
421         * testsuite/missing_key_func.cc: New test source.
422         * testsuite/missing_key_func.sh: New test script.
423
424 2013-05-21  Cary Coutant  <ccoutant@google.com>
425
426         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
427         type of enclosing symbol.
428         (Relocate_info::location): Check symbol type when describing symbol.
429         * object.h (Symbol_location_info): Remove unused line_number;
430         add enclosing_symbol_type.
431         * testsuite/debug_msg.sh: Adjust expected output.
432
433 2013-05-13  Cary Coutant  <ccoutant@google.com>
434
435         * configure.ac: Export DEFAULT_TARGET.
436         * configure: Regenerate.
437         * Makefile.in: Regenerate.
438         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
439         * testsuite/Makefile.in: Regenerate.
440         * testsuite/debug_msg.sh: Delete duplicate tests.
441         Don't check undef_int error message match for powerpc where the
442         source file and line number aren't available.
443
444 2013-05-10  Roland McGrath  <mcgrathr@google.com>
445
446         * options.h (General_options): Add --rosegment-gap option.
447         * options.cc (finalize): --rosegment-gap implies --rosegment.
448         * layout.cc (set_segment_offsets): Let user option override
449         target->rosegment_gap().
450
451 2013-05-10  Roland McGrath  <mcgrathr@google.com>
452
453         * options.h (General_options): Remove leading space from help
454         messages for -nostdlib and --rosegment.
455
456 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
457
458         PR ld/15365
459         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
460
461 2013-05-03  Alan Modra  <amodra@gmail.com>
462
463         * merge.cc (Output_merge_string::do_add_input_section): Correct
464         scan for number of strings.  Rename vars to avoid shadowing.
465         Include missing terminator in input_size_.
466
467 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
468
469         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
470         Restore empty string handling.
471
472 2013-05-01  Cary Coutant  <ccoutant@google.com>
473
474         * stringpool.cc (Stringpool_template::new_key_offset): Fix
475         uninitialized warning.
476
477 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
478
479         * output.cc (Output_section::add_merge_input_section): Allow
480         to merge sections if the alignment is more than character size.
481         * merge.h (Output_merge_string::Output_merge_string): Remove
482         assert.
483         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
484         only not-null strings. Check the alignment of strings.
485         * stringpool.h
486         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
487         alignment as the argument.
488         (Stringpool_template<Stringpool_char>::addralign_): New class member.
489         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
490         Align non-zero length strings according to the addralign_.
491         (Stringpool_template<Stringpool_char>::set_string_offsets):
492         Updating offsets according to the given alignment.
493         * testsuite/Makefile.am (text_section_grouping): Test if string
494         literals are getting merged.
495         * testsuite/Makefile.in: Regenerate.
496         * testsuite/merge_string_literals_1.c: New file.
497         * testsuite/merge_string_literals_2.c: Ditto.
498         * testsuite/merge_string_literals.sh: Ditto.
499
500 2013-04-26  Ian Lance Taylor  <iant@google.com>
501
502         * target-reloc.h (relocate_section): If the reloc offset is out of
503         range, pass VIEW as NULL to relocate.relocate.
504         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
505         * i386.cc (Target_i386::Relocate::relocate): Likewise.
506         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
507         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
508         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
509         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
510
511 2013-04-26  Geoff Pike  <gpike@chromium.org>
512
513         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
514         * layout.cc (Hash_task): New class.
515         (Layout::queue_build_id_tasks): New function.
516         (Layout::write_build_id): Handle single-thread portion of build ID
517         computation.  (In some cases, all of it is single-threaded.)  Replace
518         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
519         functionality in fewer lines of code.
520         * layout.h (Layout::queue_build_id_tasks): New function declaration.
521         * options.h (General_options): make "--build-id" default to tree
522         rather than sha1.  Add two new options related to --build-id=tree:
523         --build-id-chunk-size-for-treehash and
524         --build-id-min-file-size-for-treehash.
525         * Makefile.am: add testing of --build-id=tree and related new options
526         (these tests will be invoked by "make check").
527         * Makefile.in: Regenerate.
528
529 2013-04-25  Alan Modra  <amodra@gmail.com>
530
531         * configure.tgt: Add powerpcle and powerpc64le.
532
533 2013-04-22  Alan Modra  <amodra@gmail.com>
534
535         PR gold/15355
536         * layout.cc (Layout::segment_precedes): Allow more than one
537         segment with the same type and flags.
538
539 2013-04-15  Cary Coutant  <ccoutant@google.com>
540
541         * layout.cc (Layout::set_relocatable_section_offsets): Don't
542         allocate space in file for BSS sections.
543
544 2013-04-15  Cary Coutant  <ccoutant@google.com>
545
546         * script-sections.cc (Orphan_output_section): Reset address
547         to zero after each orphaned section for relocatable links.
548
549 2013-04-15  Cary Coutant  <ccoutant@google.com>
550
551         * symtab.cc (Symbol_table::sized_write_globals): Subtract
552         section starting address for relocatable link.
553         * testsuite/Makefile.am (script_test_11): New test.
554         * testsuite/Makefile.in: Regenerate.
555         * testsuite/script_test_11.c: New source file.
556         * testsuite/script_test_11.t: New linker script.
557
558 2013-04-13  Alan Modra  <amodra@gmail.com>
559
560         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
561         owner when sections are not adjacent and exceed group size.
562         (Target_powerpc::group_sections): Handle corner case.
563         (Target_powerpc::Branch_info::make_stub): Handle case where
564         stub table doesn't exist due to branches in non-exec sections.
565         (Target_powerpc::Relocate::relocate): Likewise.
566
567 2013-04-11  Alan Modra  <amodra@gmail.com>
568
569         PR gold/15354
570         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
571         .branch_lt to match bfd ld.  Adjust comments throughout file.
572
573 2013-04-04  Ian Lance Taylor  <iant@google.com>
574
575         GCC PR c++/56840
576         * object.cc (do_layout_deferred_sections): Handle .eh_frame
577         sections before checking whether they are included in the link.
578
579 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
580
581         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
582         object before calling the plugin claim_file handler.  Pass the elf
583         object of the archive to the plugin. Delete the elf object if the
584         plugin claims the file.
585
586 2013-03-21  Alan Modra  <amodra@gmail.com>
587
588         * layout.cc (Layout::set_segment_offsets): Accept writable .text
589         segment when omagic.
590
591 2013-03-21  Alan Modra  <amodra@gmail.com>
592
593         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
594         comparison warning.
595         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
596         uninitialized" warning.
597
598 2013-03-20  Alan Modra  <amodra@gmail.com>
599
600         * symtab.h (Symbol::clear_version): New function.
601         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
602         is_needed by weak references.  Clear version for symbols defined
603         in as-needed objects that are not needed.
604
605 2013-03-15  Alan Modra  <amodra@gmail.com>
606
607         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
608         static and public.  Add report_err param.  Return false for data refs.
609         (Target_powerpc::rela_dyn_section): New overloaded function.
610         (Target_powerpc::plt_, iplt_): Elucidate.
611         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
612         (Output_data_plt_powerpc::do_write): Don't write .iplt.
613         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
614         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
615         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
616         push_branch and make_plt_entry for ifunc syms when
617         reloc_needs_plt_for_ifunc.
618         (Target_powerpc::Relocate::relocate): Don't use plt entry value
619         for ifunc unless reloc_needs_plt_for_ifunc.
620
621 2013-03-15  Alan Modra  <amodra@gmail.com>
622
623         * gc.h (gc_process_relocs): Don't look through function descriptors.
624         * icf.cc (get_section_contents): Do so here instead.
625
626 2013-03-13  Alan Modra  <amodra@gmail.com>
627
628         * powerpc.cc (is_branch_reloc): Forward declare.
629         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
630         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
631         false for 64-bit, true for 32-bit non-branch relocs.
632         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
633         * testsuite/Makefile.am (icf_test): Use linker map file instead of
634         nm output.
635         (icf_safe_test): Generate linker map file as well as nm output.
636         (icf_safe_so_test): Likewise.
637         * testsuite/Makefile.in: Regenerate.
638         * testsuite/icf_test.sh: Parse linker map file to determine
639         section folding.
640         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
641         * testsuite/icf_safe_so_test.sh: Likewise.
642         (X86_32_or_ARM_specific_safe_fold): Merge into..
643         (arch_specific_safe_fold): ..this.
644         (X86_64_specific_safe_fold): Delete unused function.
645
646 2013-03-12  Alan Modra  <amodra@gmail.com>
647
648         * gc.h (gc_process_relocs): Look through function descriptors
649         to determine shndx, symvalue and addend used by ICF.  Tidy
650         variable duplication.
651
652 2013-03-11  Alan Modra  <amodra@gmail.com>
653
654         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
655         * layout.cc (Layout_task_runner::run): ..to here.
656         * symtab.h (struct Symbol_location): Extract from..
657         (class Symbol_table): ..here.
658         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
659         * target.h (class Target): Add function_location and
660         do_function_location functions.
661         (class Sized_target): Add do_function_location.
662         * object.h (class Sized_relobj_file): Move find_shdr..
663         (class Object): ..to here.
664         * object.cc: Likewise.  Update to suit.  Instantiate.
665         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
666         * powerpc.cc (class Powerpc_dynobj): New.
667         (Target_powerpc::do_function_location): New function.
668         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
669         (Powerpc_dynobj::do_read_symbols): New function.
670         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
671
672 2013-03-08  Ian Lance Taylor  <iant@google.com>
673
674         * options.cc (General_options::string_to_object_format): Accept
675         "default".
676
677 2013-03-08  Alan Modra  <amodra@gmail.com>
678
679         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
680         pointer to Post_fde.
681         (struct Post_fde): Move definition to here..
682         * ehframe.cc (struct Post_fde): ..from here.
683         (Cie::write): Don't alloc Post_fde.
684         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
685
686 2013-03-07  Alan Modra  <amodra@gmail.com>
687
688         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
689         relocation referencing .LC0.
690         * testsuite/discard_locals_test.sh: Remove FIXMEs.
691
692 2013-03-07  Alan Modra  <amodra@gmail.com>
693
694         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
695         always_inline.  Add assembly for powerpc to avoid GOT.
696
697 2013-03-07  Alan Modra  <amodra@gmail.com>
698
699         * testsuite/script_test_10.sh: Don't test .bss section
700         header number.
701
702 2013-03-06  Alan Modra  <amodra@gmail.com>
703
704         * powerpc.cc (class Powerpc_relobj): Move some member functions.
705         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
706         all callers.  Handle folded sections.
707         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
708         to Powerpc_relobj.
709         (Global_symbol_visitor_opd::operator()): Likewise.
710
711 2013-03-04  Alan Modra  <amodra@gmail.com>
712
713         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
714         * testsuite/Makefile.in: Regenerate.
715
716 2013-03-01  Cary Coutant  <ccoutant@google.com>
717
718         Add dwp support for v2 DWARF package file format.
719         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
720         tu_length parameter.  Adjust all callers.
721         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
722         * dwp.cc: Include dwarf.h.
723         (Section_bounds): New struct type.
724         (Unit_set): New struct type.
725         (Dwo_file::Dwo_file): Initialize new data member.
726         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
727         Combine and rename to...
728         (Dwo_file::read_unit_index): ...this.
729         (Dwo_file::sized_read_compunit_index)
730         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
731         (Dwo_file::sized_read_unit_index): ...this.
732         (Dwo_file::copy_section): Remove section_name, is_str_offsets
733         parameters; add section_id parameter.
734         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
735         (Dwo_file::add_unit_set): ...this.
736         (Dwo_file::shndx_map_): Remove.
737         (Dwo_file::sect_offsets_): New data member.
738         (Dwp_output_file::Dwp_output_file): Initialize new data members.
739         (Dwp_output_file::add_section): Rename to...
740         (Dwp_output_file::add_contribution): ...this.
741         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
742         (Dwp_output_file::add_tu_set): Likewise.
743         (Dwp_output_file::Contribution): New type.
744         (Dwp_output_file::Section::contributions): New data member.
745         (Dwp_output_file::Cu_or_tu_set): Remove.
746         (Dwp_output_file::Section::Section): New ctor.
747         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
748         (Dwp_output_file::Dwp_index::Section_table): New type.
749         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
750         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
751         parameter.
752         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
753         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
754         (Dwp_output_file::Dwp_index::section_table): New member function.
755         (Dwp_output_file::Dwp_index::section_table_end): New member function.
756         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
757         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
758         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
759         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
760         (Dwp_output_file::Dwp_index::section_table_): New data member.
761         (Dwp_output_file::Dwp_index::section_mask_): New data member.
762         (Dwp_output_file::add_output_section): New member function.
763         (Dwp_output_file::write_new_section): New member function.
764         (Dwp_output_file::write_contributions): New member function.
765         (Dwp_output_file::section_id_map_): New data member.
766         (class Dwo_id_info_reader): Remove.
767         (class Unit_reader): New class.
768         (get_dwarf_section_name): New function.
769         (Dwo_file::read_executable): Adjust initializations of class data.
770         (Dwo_file::read): Add support for v2 package file format.
771         (Dwo_file::read_unit_index): Likewise.
772         (Dwo_file::sized_read_unit_index): Likewise.
773         (Dwo_file::copy_section): Likewise.
774         (Dwo_file::add_unit_set): Likewise.
775         (Dwp_output_file::add_output_section): Likewise.
776         (Dwp_output_file::add_contribution): Likewise.
777         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
778         for empty slot.
779         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
780         file format.
781         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
782         slot.
783         (Dwp_output_file::initialize): Remove unused function.
784         (Dwp_output_file::finalize): Add support for v2 package file format.
785         (Dwp_output_file::write_index): Likewise.
786         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
787         function prototype.
788
789 2013-03-01  Cary Coutant  <ccoutant@google.com>
790
791         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
792         function into class definition in header file.
793         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
794         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
795         New function.
796         (Dwarf_info_reader::check_buffer): Move here from .cc file.
797
798 2013-02-28  Alan Modra  <amodra@gmail.com>
799
800         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
801         * target.cc (Target::do_plt_fde_location): New function.
802         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
803         accessor function, and constructor param.
804         (struct Post_fde, Post_fdes): Declare.
805         (Cie::write): Add post_fdes param.
806         * ehframe.cc (Fde::write): Use plt_fde_location.
807         (struct Post_fde): Define.
808         (Cie::write): Stash FDEs added post merge mapping.
809         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
810         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
811         (Eh_frame::do_sized_write): Arrange to write post map FDES after
812         other FDEs.
813         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
814         (Target_powerpc::has_glink): New function.
815         (Target_powerpc::do_relax): Add eh_frame info for stubs.
816         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
817         glink_eh_frame_fde_32, default_fde): New data.
818         (Stub_table::eh_frame_added_): New var.
819         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
820         Make const.
821         (Stub_table::add_eh_frame): New function.
822         (Output_data_glink::add_eh_frame): New function.
823         (Target_powerpc::make_glink_section): Call add_eh_frame.
824
825 2013-02-15  Ian Lance Taylor  <iant@google.com>
826
827         * options.h (DEFINE_uint64_alias): Define.
828         (class General_options): Add -Ttext-segment as an alias for
829         -Ttext.
830
831 2013-02-15  Alan Modra  <amodra@gmail.com>
832
833         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
834         (Stub_table::do_write): ..here, two places.
835         (Stub_table::plt_call_size): Use it here too.
836
837 2013-02-11  Ian Lance Taylor  <iant@google.com>
838
839         * descriptors.cc (Descriptors::close_all): New function.
840         * descriptors.h (class Descriptors): Declare close_all.
841         (close_all_descriptors): New inline function.
842         * plugin.cc: Include "descriptors.h".
843         (Plugin_manager::cleanup): Call close_all_descriptors.
844
845 2013-02-06  Alan Modra  <amodra@gmail.com>
846
847         * README: Update coding style link.
848
849 2013-01-28  Cary Coutant  <ccoutant@google.com>
850
851         * dwp.cc (File_list): New typedef.
852         (Dwo_name_info_reader): New class.
853         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
854         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
855         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
856         (Dwo_file::read_executable): New function.
857         (Dwo_file::read): Move common setup code to ...
858         (Dwo_file::make_object): ... here.
859         (dwp_options): Add --exec/-e.
860         (usage): Likewise.
861         (main): Likewise.
862
863 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
864
865         * layout.cc (Layout::layout): Check for option text_reorder.
866         (Layout::make_output_section): Ditto.
867         * options.h (text_reorder): New option.
868         * output.cc (Input_section_sort_compare): Remove special ordering
869         of section names.
870         (Output_section::
871          Input_section_sort_section_name_special_ordering_compare::
872          operator()): New function.
873         (Output_section::sort_attached_input_sections): Use new sort function
874         for .text.
875         * output.h (Input_section_sort_section_name_special_ordering_compare):
876         New struct.
877         * testsuite/Makefile.am (text_section_grouping): Test option
878         --no-text-reorder
879         * testsuite/Makefile.in: Regenerate.
880         * testsuite/text_section_grouping.sh: Check order of functions without
881         default text reordering.
882
883 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
884
885         * options.h (General_options): Change default to true for new_dtags.
886
887 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
888
889         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
890         when enable_new_dtags is false.  Only add DT_RUNPATH when
891         enable_new_dtags is true.
892
893 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
894
895         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
896         used in declaration and definition consistent.
897         (Target_powerpc::symval_for_branch): Ditto.
898
899 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
900
901         * testsuite/plugin_final_layout.cc: Fix comment.
902
903 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
904
905         * layout.cc (Layout::layout): Do not do default sorting for
906         text sections when section ordering is specified.
907         (make_output_section): Ditto.
908         * testsuite/plugin_final_layout.cc: Name the function sections
909         to catch reordering issues.
910
911 2013-01-15  Alan Modra  <amodra@gmail.com>
912
913         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
914         plt-thread-safe.
915
916 2013-01-15  Alan Modra  <amodra@gmail.com>
917
918         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
919         * testsuite/Makefile.in: Regenerate.
920
921 2013-01-14  Alan Modra  <amodra@gmail.com>
922
923         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
924         * testsuite/Makefile.in: Regenerate.
925
926 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
927
928         PR bfd/14430
929         Fix mingw gold build with plugins enabled
930         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
931         * configure.ac: Export DLOPEN_LIBS and add headers check.
932         * plugin.cc: Handle non-dlfcn case.
933         * Makefile.in: Regenerate.
934         * config.in: Regenerate.
935         * configure: Regenerate.
936         * testsuite/Makefile.in: Regenerate.
937
938 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
939
940         * output.h (sort_attached_input_sections): Change to be public.
941         * script-sections.cc
942         (Output_section_definition::set_section_addresses): Sort
943         attached input sections according to section order before linker
944         script assigns section addresses.
945         (Orphan_output_section::set_section_addresses): Sort
946         attached input sections according to section order before linker
947         script assigns section addresses.
948         * Makefile.am (final_layout.sh): Use a simple linker script to
949         check if section ordering still works.
950         * Makefile.in: Regenerate.
951
952 2013-01-09  Ben Cheng  <bccheng@google.com>
953
954         * arm.cc (Target_arm::attributes_accept_div): New function.
955         (Target_arm::attributes_forbid_div): New function.
956         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
957         attribute using the same new functions as what bfd/elf32_arm.c
958         does.
959
960 2013-01-07  Cary Coutant  <ccoutant@google.com>
961
962         PR gold/14993
963         * output.cc (Output_section::add_input_section): For incremental
964         updates, don't track input sections that are allocated from patch
965         space.
966
967 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
968             Ian Lance Taylor  <iant@google.com>
969
970         PR gold/14897
971         * configure.ac (--enable-ld): Removed.
972         (install_as_default): Set to yes only for --enable-gold=default
973         or --disable-ld.
974         * configure: Regenerated.
975
976 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
977
978         * options.h (General_options): Add -fuse-ld= for GCC linker
979         option compatibility.
980
981 2013-01-04  Cary Coutant  <ccoutant@google.com>
982
983         * configure.ac: Fix typo restoring CXXFLAGS.
984         * configure: Regenerate.
985
986 2013-01-04  Cary Coutant  <ccoutant@google.com>
987
988         * testsuite/Makefile.am (CXXLINK_S): New macro.
989         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
990         * testsuite/Makefile.in: Regenerate.
991
992 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
993
994         * version.cc (print_version): Update copyright year to 2013.
995
996 2012-12-20  Ian Lance Taylor  <iant@google.com>
997
998         * layout.cc (Layout::special_ordering_of_input_section): New
999         function.
1000         (Layout::layout): If input section requires special ordering, must
1001         sort input sections.
1002         (Layout::make_output_section): May sort .text input sections.
1003         (Layout::is_section_name_prefix_grouped): Remove.
1004         * layout.h (class Layout): Declare
1005         special_ordering_of_input_section.  Don't declare
1006         is_section_name_prefix_grouped.
1007         * output.cc (Output_section::add_input_section): Revert last
1008         change.
1009         (Output_section::Input_section_sort::match_file_name): Don't crash
1010         if called on output section data.
1011         (Output_section::Input_section_sort_compare): Sort based on
1012         special ordering.
1013         (Output_section::Input_section_sort_section_order_index_compare):
1014         Revert last patch.
1015         (Output_section::sort_attached_input_sections): Likewise.
1016
1017 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1018
1019         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1020         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1021         * output.cc (Output_section::add_input_section): Check if section
1022         name contains special prefix.  Keep input sections to sort such
1023         sections.
1024         (Output_section::Input_section_sort_section_order_index_compare
1025          ::operator()): Group sections according to prefixes.
1026         (Output_section::sort_attached_input_sections): Add condition to
1027         Input_section_entry constructor call.
1028         * testsuite/Makefile.am (text_section_grouping): New test.
1029         * testsuite/Makefile.in: Regenerate.
1030         * testsuite/text_section_grouping.cc: New file.
1031         * testsuite/text_section_grouping.sh: New file.
1032
1033 2012-12-17  Nick Clifton  <nickc@redhat.com>
1034
1035         * Makefile.am: Add copyright notice.
1036         * NEWS: Likewise.
1037         * README: Likewise.
1038         * configure.ac: Likewise.
1039         * ftruncate.c: Likewise.
1040         * Makefile.in: Regenerate.
1041
1042 2012-12-14  Cary Coutant  <ccoutant@google.com>
1043
1044         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1045         --no-as-needed flag.
1046         (exception_separate_shared_12_test): Likewise.
1047         (incremental_copy_test): Likewise.
1048         * testsuite/Makefile.in: Regenerate.
1049
1050 2012-12-14  Cary Coutant  <ccoutant@google.com>
1051
1052         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1053         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1054
1055 2012-12-12  Alan Modra  <amodra@gmail.com>
1056
1057         * powerpc.cc (class Track_tls): New.
1058         (class Relocate, class Scan): Inherit Track_tls.
1059         (Target_powerpc::Scan::local, global): Track tls optimization
1060         and avoid creating plt entry for __tls_get_addr if all uses
1061         are optimized away.
1062         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1063
1064 2012-12-12  Alan Modra  <amodra@gmail.com>
1065
1066         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1067         Replace no_toc_optimize with toc_optimize.
1068         * output.h (Output_section::input_sections): Provide non-const variant.
1069         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1070         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1071         accessors.
1072         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1073         (class Sort_toc_sections): New.
1074         (Target_powerpc::do_finalize_sections): Sort toc sections.
1075         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1076
1077 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1078
1079         * testsuite/binary_unittest.cc (read_all): New function.
1080         (Sized_binary_test): Use it instead of ::read.
1081         * fileread.cc (do_read): Don't assume pread always reads the whole
1082         amount in a single call.
1083
1084 2012-12-10  Alan Modra  <amodra@gmail.com>
1085
1086         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1087         Set EM_PPC64 or EM_PPC here.
1088         (Target_selector_powerpc::do_recognize): Delete.
1089
1090 2012-12-10  Alan Modra  <amodra@gmail.com>
1091
1092         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1093         stub_table_.
1094         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1095
1096 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1097
1098         * testsuite/binary_unittest.cc (Sized_binary_test):
1099         Use open_descriptor rather than ::open.
1100
1101 2012-12-07  Alan Modra  <amodra@gmail.com>
1102
1103         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1104         typedef and invalid_address constant.
1105         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1106         instantiate constants.
1107
1108 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1109
1110         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1111         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1112         * aclocal.m4: Regenerate.
1113         * configure: Regenerate.
1114         * Makefile.in: Regenerate.
1115         * testsuite/Makefile.in: Regenerate.
1116
1117 2012-12-07  Alan Modra  <amodra@gmail.com>
1118
1119         * options.h (General_options): Add no_toc_optimize.
1120         * powerpc.cc (ok_lo_toc_insn): New function.
1121         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1122
1123 2012-12-06  Alan Modra  <amodra@gmail.com>
1124
1125         * options.h (General_options): Add plt_align, plt_static_chain,
1126         plt_thread_safe.  Update stub_group_size help text.
1127         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1128         for new plt_thread_safe_ var.
1129         (use_plt_offset): Correct comments.
1130         (Target_powerpc::do_relax): Look for thread creation symbols to
1131         determine default plt_thread_safe value.  Clear plt call stubs
1132         as well as branch stubs each iteration.
1133         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1134         insn constants.
1135         (l, hi, ha, write_insn): Move earlier.
1136         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1137         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1138         plt stubs too.
1139         (Stub_table::update_size): Adjust.
1140         (Stub_table::prev_size, set_prev_size): Delete.
1141         (Stub_table::stub_align): Let --plt-align affect result.
1142         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1143         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1144         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1145         (Stub_table::do_write): Support more stub variants.
1146
1147 2012-12-04  Alan Modra  <amodra@gmail.com>
1148
1149         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1150         (Target_powerpc::do_define_standard_symbols): New function.
1151
1152 2012-12-03  Alan Modra  <amodra@gmail.com>
1153
1154         * output.h: Formatting, whitespace.
1155
1156 2012-12-03  Alan Modra  <amodra@gmail.com>
1157
1158         * layout.h (Layout::get_executable_sections): Declare.
1159         * layout.cc (Layout::get_executable_sections): New function.
1160         * arm.cc (Target_arm::group_sections): Use it.
1161         (Arm_output_section::group_sections): Delete now redundant test.
1162         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1163         param to handle relative relocs.
1164         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1165         (Output_data_reloc::add_absolute): Adjust.
1166         (Output_data_reloc::add_relative): New function.
1167         (Output_data::reset_data_size): New function.
1168         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1169         (Output_section::set_addralign): New function.
1170         (Output_section::checkpoint_set_addralign): New function.
1171         (Output_section::clear_section_offsets_need_adjustment): New function.
1172         (Output_section::input_sections): Make public.
1173         * powerpc.cc (class Output_data_brlt_powerpc): New.
1174         (class Stub_table, class Stub_control): New.
1175         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1176         stub_table_, set_stub_table, stub_table): New vectors and accessor
1177         functions.
1178         (Target_powerpc::do_may_relax, do_relax, push_branch,
1179         new_stub_table, stub_tables, brlt_section, group_sections,
1180         add_branch_lookup_table, find_branch_lookup_table,
1181         write_branch_lookup_table, make_brlt_section): New functions.
1182         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1183         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1184         branch_info_): New vars.
1185         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1186         make call stubs here.
1187         (Output_data_glink): Remove all call stub handling from this class.
1188         (Target_powerpc::Scan::local, global): Save interesting branch
1189         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1190         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1191         functions on final link.
1192         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1193         Handle long branch destinations too.
1194         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1195         do_plt_address_for_local): Adjust lookup of plt call stubs.
1196
1197 2012-11-30  Alan Modra  <amodra@gmail.com>
1198
1199         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1200         relocs against protected symbols when building 32-bit shared libs.
1201
1202 2012-11-30  Alan Modra  <amodra@gmail.com>
1203
1204         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1205         param.  Call got_section() to make .got.  Update all callers
1206         and their callers and so on.
1207
1208 2012-11-30  Alan Modra  <amodra@gmail.com>
1209
1210         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1211         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1212         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1213         value if it already exists.
1214
1215 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         PR gold/14858
1218         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1219
1220 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1221
1222         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1223         than bfc instruction for data sandboxing.
1224
1225 2012-11-08  Alan Modra  <amodra@gmail.com>
1226
1227         * po/POTFILES.in: Regenerate.
1228
1229 2012-11-05  Alan Modra  <amodra@gmail.com>
1230
1231         * configure.ac: Apply 2012-09-10 change to config.in here.
1232         * configure: Regenerate.
1233
1234 2012-11-05  Alan Modra  <amodra@gmail.com>
1235
1236         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1237         (struct Opd_ent): Use "Address" rather than "Offset".
1238         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1239         (Target_powerpc::got_section): Make public.
1240         (Target_powerpc::scan_relocs): Move code setting symbols..
1241         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1242         Create _SDA_BASE_ only when referenced.
1243
1244 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1245
1246         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1247         from last change.
1248
1249 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1250
1251         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1252         for offset_in_output_section parameter.
1253         (Sized_target::relocate_special_relocatable): Likewise.
1254         * arm.cc (Target_arm::relocate_relocs): Likewise.
1255         (Target_arm::relocate_special_relocatable): Likewise.
1256         * i386.cc (Target_i386::relocate_relocs): Likewise.
1257         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1258         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1259         * target-reloc.h (relocate_relocs): Likewise.
1260         * testsuite/testfile.cc (Target_test): Likewise.
1261         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1262         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1263
1264         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1265         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1266
1267         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1268         parameter, which is unused in the [!F_SETFD] case.
1269
1270         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1271         SYMNDX to off_t before comparing it to this->data_size().
1272         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1273         * incremental.cc (Output_section_incremental_inputs::do_write):
1274         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1275
1276         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1277
1278 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1279
1280         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1281         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1282         in EABI_VER5.
1283
1284 2012-10-29  Cary Coutant  <ccoutant@google.com>
1285
1286         * dwp.cc (usage): Add file and exit status parameters;
1287         add --help and --version options.
1288         (print_version): New function.
1289         (main): Add --help and --version options.
1290
1291 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1292
1293         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1294         final_layout_sequence.txt.
1295         * testsuite/Makefile.in: Regenerated.
1296
1297 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1298
1299         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1300         COMPILE generated by automake.
1301         (LINK1): Likewise.
1302         (CXXCOMPILE1): Likewise.
1303         (CXXLINK1): Likewise.
1304         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1305         (LINK): Likewise.
1306         (CXXCOMPILE): Likewise.
1307         (CXXLINK): Likewise.
1308         * testsuite/Makefile.in: Regenerated.
1309
1310 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1311
1312         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1313         on bad fwrite return.
1314
1315 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1316
1317         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1318         on val.
1319
1320 2012-10-23  Cary Coutant  <ccoutant@google.com>
1321
1322         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1323         * testsuite/Makefile.in: Regenerate.
1324         * testsuite/dwp_test.h: New source file.
1325         * testsuite/dwp_test_1.cc: New source file.
1326         * testsuite/dwp_test_1.s: New source file.
1327         * testsuite/dwp_test_1.sh: New source file.
1328         * testsuite/dwp_test_1b.cc: New source file.
1329         * testsuite/dwp_test_1b.s: New source file.
1330         * testsuite/dwp_test_2.cc: New source file.
1331         * testsuite/dwp_test_2.s: New source file.
1332         * testsuite/dwp_test_2.sh: New source file.
1333         * testsuite/dwp_test_main.cc: New source file.
1334         * testsuite/dwp_test_main.s: New source file.
1335
1336 2012-10-23  Cary Coutant  <ccoutant@google.com>
1337
1338         * dwp.h: New header file.
1339         * dwp.cc: New source file.
1340         * gold.h: Move shared declarations to system.h.
1341         * system.h: New header file.
1342         * Makefile.am: Add dwp.
1343         * Makefile.in: Regenerate.
1344
1345 2012-10-23  Cary Coutant  <ccoutant@google.com>
1346
1347         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1348         Dwarf_info_reader::read_from_pointer.
1349         (Dwarf_pubnames_table::read_header): Likewise.
1350         (Dwarf_pubnames_table::next_name): Likewise.
1351         (Dwarf_die::read_attributes): Likewise.
1352         (Dwarf_die::skip_attributes): Likewise.
1353         (Dwarf_info_reader::read_from_pointer): New function template.
1354         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1355         (Dwarf_pubnames_table): Likewise.
1356         (Dwarf_info_reader::read_from_pointer): New function template.
1357         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1358         Dwarf_pubnames_table ctor.
1359
1360 2012-10-23  Cary Coutant  <ccoutant@google.com>
1361
1362         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1363         abbrev_shndx.
1364         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1365         abbrev_shndx_.
1366         (Dwarf_info_reader::set_abbrev_shndx): New method.
1367         (Dwarf_info_reader::abbrev_shndx_): New data member.
1368
1369 2012-10-23  Cary Coutant  <ccoutant@google.com>
1370
1371         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1372         from object, not parameters.
1373         (Dwarf_info_reader::parse): Likewise.
1374         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1375         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1376         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1377         methods.
1378
1379 2012-10-23  Cary Coutant  <ccoutant@google.com>
1380
1381         * fileread.cc (Input_file::Input_file): New constructor.
1382         * fileread.h (class Input_file): Add new constructor.
1383
1384 2012-10-18  Alan Modra  <amodra@gmail.com>
1385
1386         PR gold/14727
1387         * object.cc (Relobj::is_section_name_included): Also match
1388         .sdata personality section.
1389
1390 2012-10-18  Alan Modra  <amodra@gmail.com>
1391
1392         * target-reloc.h (class Default_comdat_behavior): New, package up..
1393         (get_comdat_behaviour): ..this.
1394         (relocate_section): Add Relocate_comdat_behavior template arg,
1395         adjust code to suit.
1396         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1397         (Target_arm::scan_reloc_section): Likewise.
1398         * i386.cc (Target_i386::relocate_section): Likewise.
1399         * sparc.cc (Target_sparc::relocate_section): Likewise.
1400         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1401         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1402         * powerpc.cc (class Relocate_comdat_behavior): New.
1403         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1404         gold::relocate_section with new template arg.
1405
1406 2012-10-18  Alan Modra  <amodra@gmail.com>
1407
1408         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1409         dynamic relocs for GOT_TPREL got entries, without symbol if
1410         resolving locally.
1411         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1412         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1413         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1414
1415 2012-10-17  Alan Modra  <amodra@gmail.com>
1416
1417         PR gold/14726
1418         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1419
1420 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1421
1422         * layout.cc (Layout::include_section): Keep sections marked
1423         SHF_EXCLUDE when doing relocatable links.
1424
1425 2012-10-16  Alan Modra  <amodra@gmail.com>
1426
1427         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1428         (Target_powerpc::do_finalize_sections): Call it.
1429         (Output_data_save_res): New class and supporting functions.
1430         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1431         normal symbols defined in object files.
1432
1433 2012-10-12  Alan Modra  <amodra@gmail.com>
1434
1435         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1436         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1437         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1438         section if scan_opd_relocs not yet called.
1439         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1440
1441 2012-10-12  Alan Modra  <amodra@gmail.com>
1442
1443         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1444         add_local_ifunc_entry): Revert last change.
1445         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1446
1447 2012-10-05  Alan Modra  <amodra@gmail.com>
1448
1449         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1450         do_plt_address_for_global): New functions.
1451         (Output_data_got_powerpc::do_write): Don't segfault when linking
1452         statically.
1453         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1454         add_local_ifunc_entry): Return true on adding entry..
1455         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1456         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1457         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1458         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1459         set up symbols here.
1460         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1461         syms here.  Do so even when no .iplt.  Don't segfault when linking
1462         statically.
1463         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1464         new variants without reloc param.
1465         (Glink_sym_ent::Glink_sym_ent): Likewise.
1466         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1467         reloc when refs will resolve to plt call stub.
1468         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1469         R_PPC_PLTREL24 to resolve locally.
1470         (Target_powerpc::Scan::global): Correct ifunc handling.
1471         (Target_powerpc::Relocate::relocate): Correct local sym glink
1472         lookup.  Don't destroy "value" when we have a plt call stub,
1473         and when checking plt call validity.
1474         (Target_powerpc::do_dynsym_value): Simplify.
1475
1476 2012-10-05  Alan Modra  <amodra@gmail.com>
1477
1478         * i386.cc (Output_data_plt_i386::address_for_global,
1479         address_for_local): Add plt offset to returned value.  Adjust uses.
1480         * sparc.cc (Output_data_plt_sparc::address_for_global,
1481         address_for_local): Likewise.
1482         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1483         address_for_local): Likewise.
1484         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1485         address_for_local): Likewise.
1486         * target.h (Target::plt_address_for_global, plt_address_for_local):
1487         Update comment.
1488         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1489         (Output_data_got::Got_entry::write): Nor here.
1490         * output.h: Comment fix.
1491
1492 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1493
1494         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1495         global_offset_table_ value for larget got.
1496         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1497
1498 2012-09-29  Alan Modra  <amodra@gmail.com>
1499
1500         * powerpc.cc (Target_powerpc::iplt_): New output section.
1501         (Target_powerpc::iplt_section, make_iplt_section,
1502         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1503         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1504         Target_powerpc::plt_entry_count): Count iplt entries too.
1505         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1506         reloc section in constructor.  New params.
1507         (Target_powerpc::make_plt_section): Create reloc section here instead.
1508         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1509         functions.
1510         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1511         (Output_data_glink::add_entry, find_entry): New functions to
1512         deal with local syms.
1513         (Glink_sym_ent): Add support for local syms.
1514         (Output_data_glink::do_write): Handle ifunc plt entries.
1515         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1516         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1517         (Target_powerpc::Relocate::relocate): Likewise.
1518         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1519
1520 2012-09-25  Alan Modra  <amodra@gmail.com>
1521
1522         * object.h (Sized_relobj_file::adjust_local_symbol,
1523         do_adjust_local_symbol): New functions.
1524         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1525         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1526         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1527         and irregular opd entry spacing.
1528         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1529         (Global_symbol_visitor_opd): New functor.
1530         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1531         on deleted opd entries.
1532
1533 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1534
1535         * tilegx.cc: New file.
1536         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1537         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1538         * configure.tgt: Add entries for tilegx*.
1539         * configure.ac: Likewise.
1540         * Makefile.in: Rebuild.
1541         * configure: Likewise.
1542         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1543         tilegx.
1544
1545 2012-09-13  Alan Modra  <amodra@gmail.com>
1546
1547         * target-reloc.h (scan_relocs): Call scan.local for relocs
1548         against symbols in discarded sections.  Pass is_discarded
1549         param.
1550         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1551         Add is_discarded param.
1552         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1553         is_discarded to flag opd entry as discarded.  Don't emit dyn
1554         relocs on such entries.
1555         (Target_powerpc::Scan::global): Similarly detect and handle
1556         such opd entries.
1557         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1558         opd_ent_.  Update all uses.
1559         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1560         (Target_powerpc::relocate_section): Zero out discarded opd
1561         entry relocs.
1562
1563 2012-09-12  Ian Lance Taylor  <iant@google.com>
1564
1565         PR gold/14570
1566         * output.cc: Rename Output_data_got template parameter from size
1567         to got_size for all functions.  Compile all variants of
1568         Output_data_got.
1569         (Output_data_got::Got_entry::write): Correct use of size for
1570         symbol value.  Use local_is_tls rather than casting to
1571         Sized_relobj_file.
1572         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1573         (class Sized_relobj_file): Add do_local_is_tls.
1574         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1575
1576 2012-09-11  Alan Modra  <amodra@gmail.com>
1577
1578         PR gold/14566
1579         * layout.cc (Layout::set_segment_offsets): When using
1580         common-page-size alignment, ensure we are on a new max-page-size
1581         page.
1582         * output.cc (Output_segment::set_section_addresses): Use
1583         abi_pagesize, not common_pagesize for relro boundary.
1584         (Output_segment::set_offset): Likewise.
1585
1586 2012-09-11  Alan Modra  <amodra@gmail.com>
1587
1588         * output.h (Output_data_got::add_global_tls, add_local_tls,
1589         add_local_tls_pair): New functions.
1590         (Output_data_got::add_local_pair_with_rel): Remove second
1591         reloc param.  Expand comment.
1592         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1593         use_plt_or_tls_offset_, similarly for constructor param.
1594         (Output_data_got::Got_entry::write): Add got_index param.
1595         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1596         add_local_tls_pair): New functions.
1597         (Output_data_got::Got_entry::write): Handle tls symbols
1598         with use_plt_or_tls_offset_ set specially.
1599         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1600         (Output_data_got::do_write): Replace iterator with index, pass
1601         index to entry write function.
1602         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1603         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1604         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1605         call.
1606         * i386.cc (Target_i386::Scan::local): Likewise.
1607         * sparc.cc (Target_sparc::Scan::local): Likewise.
1608         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1609         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1610         do_tls_offset_for_global): New functions.
1611         (Target_powerpc::Scan::local): Correct TLS relocations and got
1612         entry values.
1613         (Target_powerpc::Scan::global): Don't emit unnecessary
1614         dynamic relocations on TLS GOT entries.
1615
1616 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1617
1618         * config.in: Disable sanity check for kfreebsd.
1619
1620 2012-09-10  Sterling Augustine  <saugustine@google.com>
1621
1622         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1623         (Gdb_index::pubtypes_read): New parameter.
1624         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1625         to calls.
1626         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1627         pubtypes_object_.
1628
1629 2012-09-09  Alan Modra  <amodra@gmail.com>
1630
1631         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1632         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1633         * gc.h (gc_process_relocs): Call target gc_add_reference.
1634         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1635         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1636         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1637         unnecessary cast.
1638         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1639         to cater for when we don't need code offset.  Update use.
1640         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1641         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1642         set_opd_valid): New functions.
1643         (Target_powerpc::do_gc_add_reference): New function.
1644         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1645         stashed refs.
1646         (Target_powerpc::do_gc_mark_symbol): New function.
1647
1648 2012-09-06  Cary Coutant  <ccoutant@google.com>
1649
1650         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1651         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1652         (Dwarf_die::skip_attributes): Likewise.
1653         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1654         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1655         (main): Call it.
1656         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1657
1658 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1659
1660         * testsuite/script_test_3.t: Add .got.plt output section
1661         statement.
1662         * testsuite/script_test_4.t: Likewise.
1663
1664 2012-09-05  Alan Modra  <amodra@gmail.com>
1665
1666         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1667         update all uses and lose "enum" when using type.
1668
1669 2012-09-05  Alan Modra  <amodra@gmail.com>
1670
1671         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1672         * configure: Regenerate.
1673         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1674         (plugin_final_layout.stdout): Likewise.
1675         (memory_test): Set page sizes to 0x1000.
1676         * testsuite/Makefile.in: Regenerate.
1677         * testsuite/discard_locals_test.sh: Add FIXME comment.
1678         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1679         * testsuite/pr14265.t: Add .got output section statement.
1680         * testsuite/script_test_2.t: Likewise.
1681         * testsuite/script_test_3.t: Likewise.
1682         * testsuite/script_test_4.t: Likewise.
1683         * testsuite/script_test_5.t: Likewise.
1684         * testsuite/script_test_6.t: Likewise.
1685         * testsuite/script_test_7.t: Likewise.
1686         * testsuite/script_test_9.t: Likewise.
1687
1688 2012-09-05  Alan Modra  <amodra@gmail.com>
1689
1690         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1691         (Powerpc_relocate_functions::Status): New typedef.
1692         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1693         (Target_powerpc::Scan::local): Handle REL64.
1694         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1695         for REL32 and REL64.
1696         (Target_powerpc::symval_for_branch): New function, extracted from..
1697         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1698         checks.  Report overflow errors.
1699
1700 2012-09-05  Alan Modra  <amodra@gmail.com>
1701
1702         * object.h (Sized_relobj_file::emit_relocs): Delete.
1703         (Sized_relobj_file::emit_relocs_reltype): Delete.
1704         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1705         relocate_relocs for --emit-relocs.
1706         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1707         * output.h: Update comment.
1708         (Output_segment::first_section): New function.
1709         (Output_segment::first_section_load_address): Use first_section.
1710         * output.cc (Output_segment::first_section): New function extracted..
1711         (Output_segment::first_section_load_address): ..from here.  Delete.
1712         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1713         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1714         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1715         adjust call to target.h function.
1716         * i386.cc (Target_i386): Likewise.
1717         * sparc.cc (Target_sparc): Likewise.
1718         * x86_64.cc (Target_x86_64): Likewise.
1719         * powerpc.cc (Target_powerpc): Likewise.
1720         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1721         first tls section has section symbol for optimised local dynamic
1722         output relocs.
1723         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1724         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1725         optimised tls code.
1726         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1727         Rename to relocate_relocs.  Update error message.
1728
1729 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1730
1731         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1732         --just-symbols.
1733
1734 2012-08-31  Alan Modra  <amodra@gmail.com>
1735
1736         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1737         (Powerpc_relobj::toc_base_offset): New stub function.
1738         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1739         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1740         (Target_powerpc::Relocate::enum skip_tls): New.
1741         (Target_powerpc::call_tls_get_addr_): New var.
1742         (Target_powerpc::is_branch_reloc): Move to file scope.
1743         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1744         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1745         New functions.
1746         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1747         (powerpc_info): Correct common_pagesize for ppc64.
1748         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1749         (Powerpc_relocate_functions): Add overflow check enums and functions.
1750         Add non-shift version of rela, rela_ua.  Delete all rel public
1751         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1752         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1753         addr16_ha3, addr14 functions.
1754         (Output_data_got_powerpc::add_constant_pair): New function.
1755         (Output_data_got_powerpc::got_base_offset): Likewise.
1756         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1757         (instruction constants): Sort, add some more.
1758         (Output_data_glink::do_write): Add and use Address typedef.  Use
1759         object->toc_base_offset() stub for 64-bit.
1760         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1761         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1762         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1763         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1764         Always treat .opd relocs as against locally defined symbol.
1765         Correct condition for RELATIVE relocs.
1766         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1767         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1768         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1769         calculations.  Handle TLS relocs, and more.  Add overflow
1770         checking and adjust for Powerpc_relocate_functions changes.
1771         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1772         Reinstate --emit-relocs code with FIXME.
1773
1774 2012-08-30  Alan Modra  <amodra@gmail.com>
1775
1776         * layout.cc (Layout::set_segment_offsets): Set p_align to
1777         abi_pagesize, not common_pagesize.
1778         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1779         to determine whether file header can go in segment.
1780
1781 2012-08-30  Alan Modra  <amodra@gmail.com>
1782
1783         * output.h (Output_reloc::Output_reloc <output section>): Add
1784         is_relative param.  Adjust calls.
1785         (Output_reloc::add_output_section_relative): New functions.
1786         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1787         is_relative.
1788         (Output_reloc::symbol_value): Handle SECTION_CODE.
1789
1790 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1791
1792         * gold.cc (queue_middle_tasks): Call layout again when unique
1793         segments for sections is desired.
1794         * layout.cc (Layout::Layout): Initialize new members.
1795         (Layout::get_output_section_flags): New function.
1796         (Layout::choose_output_section): Call get_output_section_flags.
1797         (Layout::layout): Make output section for mapping to a unique segment.
1798         (Layout::insert_section_segment_map): New function.
1799         (Layout::attach_allocated_section_to_segment): Make unique segment for
1800         output sections marked so.
1801         (Layout::segment_precedes): Check for unique segments when sorting.
1802         * layout.h (Layout::Unique_segment_info): New struct.
1803         (Layout::Section_segment_map): New typedef.
1804         (Layout::insert_section_segment_map): New function.
1805         (Layout::get_output_section_flags): New function.
1806         (Layout::is_unique_segment_for_sections_specified): New function.
1807         (Layout::set_unique_segment_for_sections_specified): New function.
1808         (Layout::unique_segment_for_sections_specified_): New member.
1809         (Layout::section_segment_map_): New member.
1810         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1811         Rename is_gc_pass_one to is_pass_one.
1812         Rename is_gc_pass_two to is_pass_two.
1813         Rename is_gc_or_icf to is_two_pass.
1814         Check for which pass based on whether symbols data is present.
1815         Make it two pass when unique segments for sections is desired.
1816         * output.cc (Output_section::Output_section): Initialize new
1817         members.
1818         * output.h (Output_section::is_unique_segment): New function.
1819         (Output_section::set_is_unique_segment): New function.
1820         (Output_section::is_unique_segment_): New member.
1821         (Output_section::extra_segment_flags): New function.
1822         (Output_section::set_extra_segment_flags): New function.
1823         (Output_section::extra_segment_flags_): New member.
1824         (Output_section::segment_alignment): New function.
1825         (Output_section::set_segment_alignment): New function.
1826         (Output_section::segment_alignment_): New member.
1827         (Output_segment::Output_segment): Initialize is_unique_segment_.
1828         (Output_segment::is_unique_segment): New function.
1829         (Output_segment::set_is_unique_segment): New function.
1830         (Output_segment::is_unique_segment_): New member.
1831         * plugin.cc (allow_unique_segment_for_sections): New function.
1832         (unique_segment_for_sections): New function.
1833         (Plugin::load): Add new functions to transfer vector.
1834         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1835         * Makefile.in: Regenerate.
1836         * testsuite/plugin_final_layout.sh: Check if unique segment
1837         functionality works.
1838         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1839         are available.
1840         (allow_unique_segment_for_sections): New global.
1841         (unique_segment_for_sections): New global.
1842         (claim_file_hook): Call allow_unique_segment_for_sections.
1843         (all_symbols_read_hook): Call unique_segment_for_sections.
1844
1845 2012-08-22  Cary Coutant  <ccoutant@google.com>
1846
1847         * layout.cc (Layout::include_section): Don't assert on GROUP
1848         sections with --emit-relocs.
1849
1850 2012-08-21  Cary Coutant  <ccoutant@google.com>
1851
1852         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1853         if --export-dynamic-symbol names an undef symbol.
1854
1855 2012-08-18  Alan Modra  <amodra@gmail.com>
1856
1857         * powerpc.cc: Formatting and white space.
1858         (Powerpc_relobj): Rename got2_section_ to special_.
1859         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1860         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1861         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1862         (Target_powerpc): Add Address typedef and invalid_address.  Use
1863         throughout.
1864         (Target_powerpc::is_branch_reloc): New function.
1865         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1866         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1867         for dst_mask, value and addend.
1868         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1869         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1870         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1871         uint16_t for 24-bit offset.  Use get_output_section_offset and
1872         check return.
1873         (Target_powerpc::Scan::local): Handle more relocs.
1874         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1875         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1876         Plug in toc restoring insn after plt calls.  Translate branches
1877         to function descriptor symbols to corresponding entry point.
1878         (Target_powerpc::relocate_for_relocatable): Check return from
1879         get_output_section_offset.
1880         * symtab.h: Comment typo.
1881
1882 2012-08-14  Ian Lance Taylor  <iant@google.com>
1883
1884         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1885         unsupported_relocal_local to call unsupported_reloc_global.
1886
1887 2012-08-14  Nick Clifton  <nickc@redhat.com>
1888
1889         PR ld/14265
1890         * script-sections.cc (Sections_element::output_section_name): Add
1891         keep return parameter.
1892         (Output_section_element::match_name): Add keep return parameter.
1893         Return the value of the keep_ member.
1894         * script-sections.h (class Output_section): Update
1895         output_section_name prototype.
1896         * layout.cc (Layout::keep_input_section): New public member
1897         function.
1898         (Layout::choose_output_section): Pass keep parameter to
1899         output_section_name.
1900         * layout.h (class Layout): Add keep_input_section.
1901         * object.cc (Sized_relobj_file::do_layout): Check for kept input
1902         sections.
1903         * testsuite/Makefile.am: Add a test.
1904         * testsuite/Makefile.in: Regenerate.
1905         * testsuite/pr14265.c: Source file for the test.
1906         * testsuite/pr14265.t: Linker script for the test.
1907         * testsuite/pr14265.sh: Shell script for the test.
1908
1909 2012-08-14  Alan Modra  <amodra@gmail.com>
1910
1911         * target.h (Target::output_section_name): New function.
1912         (Target::do_output_section_name): New function.
1913         * layout.cc (Layout::choose_output_section): Call the above.
1914         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
1915
1916 2012-08-14  Alan Modra  <amodra@gmail.com>
1917
1918         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
1919         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
1920         for replace_constant call.
1921         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
1922         (Output_data_glink::do_print_to_mapfile): New function.
1923         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
1924         (Target_powerpc::Relocate::relocate): Likewise.
1925
1926 2012-08-14  Alan Modra  <amodra@gmail.com>
1927
1928         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
1929         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
1930         (Output_data_glink::add_entry,find_entry): Remove shndx param.
1931         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
1932         all references to shndx_.  Handle special case for R_PPC_PLTREL24
1933         here.
1934         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
1935         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
1936         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
1937         here.
1938         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
1939         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
1940
1941 2012-08-12  Alan Modra  <amodra@gmail.com>
1942
1943         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
1944         (glink insn constants): Use uint32_t.
1945         (Output_data_glink::add_entry): Use insert, not [] operator.
1946
1947 2012-08-11  Alan Modra  <amodra@gmail.com>
1948
1949         * object.h (Sized_relobj_file::find_shdr): New function.
1950         (Sized_relobj_file::find_special_sections): New function.
1951         * object.cc (Sized_relobj_file::find_shdr): New function.
1952         (Sized_relobj_file::find_eh_frame): Use find_shdr.
1953         (Sized_relobj_file::find_special_sections): New function, split out..
1954         (Sized_relobj_file::do_read_symbols): ..from here.
1955         * output.h (Output_data_got::replace_constant): New function.
1956         (Output_data_got::num_entries): New function.
1957         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
1958         (Output_data_got::got_offset): Protected rather than private.
1959         (Output_data_got::replace_got_entry): New function.
1960         * output.cc (Output_data_got::replace_got_entry): New function.
1961         * powerpc.cc (class Powerpc_relobj): New.
1962         (class Powerpc_relocate_functions): Delete all psymval variants or
1963         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
1964         Implement _ha functions using corresponding _hi function.
1965         (Powerpc_relobj::find_special_sections): New function.
1966         (Target_powerpc::do_make_elf_object): New function.
1967         (class Output_data_got_powerpc): New.
1968         (class Output_data_glink): New.
1969         (class Powerpc_scan_relocatable_reloc): New.
1970         Many more changes througout file.
1971
1972 2012-08-09  Nick Clifton  <nickc@redhat.com>
1973
1974         * po/vi.po: Updated Vietnamese translation.
1975
1976 2012-08-07  Ian Lance Taylor  <iant@google.com>
1977
1978         * layout.cc (Layout::add_target_dynamic_tags): If
1979         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
1980         plt_rel.
1981
1982 2012-07-30  Nick Clifton  <nickc@redhat.com>
1983
1984         * po/gold.pot: Updated template.
1985         * po/es.po: Updated Spanish translation.
1986
1987 2012-07-18  Cary Coutant  <ccoutant@google.com>
1988
1989         PR gold/14344
1990         * configure.ac: Add check for -gpubnames support.
1991         * configure: Regenerate.
1992         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
1993         support; force -gno-pubnames.
1994         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
1995         support.
1996         (gdb_index_test_4): New test.
1997         * testsuite/Makefile.in: Regenerate.
1998         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
1999         * testsuite/gdb_index_test_2.sh: Likewise.
2000         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2001         * testsuite/gdb_index_test_4.sh: New script.
2002         * testsuite/gdb_index_test_comm.sh: New script with common code;
2003         don't look for space after colon.
2004
2005 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2006
2007         * gold.cc (queue_middle_tasks): Update function order only after
2008         deferred objects due to plugins are processed.
2009
2010 2012-07-11  Ian Lance Taylor  <iant@google.com>
2011
2012         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2013         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2014         (Target_arm::scan_reloc_for_stub): Likewise.
2015         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2016         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2017         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2018         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2019         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2020
2021 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2022             Ian Lance Taylor  <iant@google.com>
2023
2024         PR gold/14309
2025         * configure.ac: Test whether std::tr1::hash<off_t> works.
2026         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2027         needed.
2028         * output.h (class Output_fill): Add virtual destructor.
2029         * configure, config.in: Rebuild.
2030
2031 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2032
2033         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2034
2035 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2036
2037         * plugin.cc (Plugin::load): Handle position independent executables.
2038
2039 2012-06-06  Cary Coutant  <ccoutant@google.com>
2040
2041         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2042         add .debug_macro.
2043         (lines_only_debug_sections): Likewise.
2044         (gdb_fast_lookup_sections): New static array.
2045         (is_gdb_debug_section): Rename formal parameter.
2046         (is_lines_only_debug_section): Likewise.
2047         (is_gdb_fast_lookup_section): New function.
2048         (Layout::include_section): Check for ".zdebug_" prefix; pass
2049         section name suffix to is_gdb_debug_section, et al.; check for
2050         fast-lookup sections when building .gdb_index.
2051         * options.h (--strip-debug-gdb): Update GDB version number.
2052
2053 2012-06-06  Cary Coutant  <ccoutant@google.com>
2054
2055         * configure.ac: Add check for fallocate.
2056         * configure: Regenerate.
2057         * config.in: Regenerate.
2058
2059         * options.h (class General_options): Add --mmap-output-file and
2060         --posix-fallocate options.
2061         * output.cc: (posix_fallocate): Remove; replace with...
2062         (gold_fallocate): New function.
2063         (Output_file::map_no_anonymous): Call gold_fallocate.
2064         (Output_file::map): Check --mmap-output-file option.
2065
2066 2012-06-05  Jing Yu  <jingyu@google.com>
2067
2068         * gold.h (textdomain): Add do {} to empty while(0).
2069         (bindtextdomain): Likewise.
2070
2071 2012-06-04  Cary Coutant  <ccoutant@google.com>
2072
2073         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2074         has_dynsym_index.
2075
2076 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2077
2078         * symtab.cc (Symbol_table::define_special_symbol):
2079         Initialize *poldsym to prevent uninitialized variable errors.
2080
2081 2012-05-23  Cary Coutant  <ccoutant@google.com>
2082
2083         * layout.cc (Layout::section_name_mapping): Add rules to handle
2084         exact match on .data.rel.ro.local or .data.rel.ro.
2085         (Layout::output_section_name): Check for exact matches.
2086
2087 2012-05-23  Cary Coutant  <ccoutant@google.com>
2088
2089         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2090         more carefully.
2091
2092 2012-05-22  Cary Coutant  <ccoutant@google.com>
2093
2094         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2095         object before exporting symbol.
2096
2097 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2098
2099         * testsuite/tls_test.cc: Include "config.h" first.
2100         * testsuite/tls_test_c.c: Likewise.
2101
2102 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2103             Nick Clifton  <nickc@redhat.com>
2104
2105         PR 14072
2106         * configure.in: Add check that sysdep.h has been included before
2107         any system header files.
2108         * configure: Regenerate.
2109         * config.in: Regenerate.
2110
2111 2012-05-14  Cary Coutant  <ccoutant@google.com>
2112
2113         * layout.cc (Layout::make_output_section): Mark .tdata section
2114         as RELRO.
2115         * testsuite/relro_test.cc: Add a TLS variable.
2116
2117 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2118
2119         PR gold/14091
2120         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2121         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2122         R_X86_64_64.
2123
2124 2012-05-08  Cary Coutant  <ccoutant@google.com>
2125
2126         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2127         (lines_only_debug_sections): Likewise.
2128
2129 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2130
2131         * nacl.cc: New file.
2132         * nacl.h: New file.
2133         * Makefile.am (CCFILES, HFILES): Add them.
2134         * Makefile.in: Regenerate.
2135         * i386.cc (Output_data_plt_i386_nacl): New class.
2136         (Output_data_plt_i386_nacl_exec): New class.
2137         (Output_data_plt_i386_nacl_dyn): New class.
2138         (Target_i386_nacl): New class.
2139         (Target_selector_i386_nacl): New class.
2140         (target_selector_i386): Use it instead of Target_selector_i386.
2141         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2142         (Target_x86_64_nacl): New class.
2143         (Target_selector_x86_64_nacl): New class.
2144         (target_selector_x86_64, target_selector_x32): Use it instead of
2145         Target_selector_x86_64.
2146         * arm.cc (Output_data_plt_arm_nacl): New class.
2147         (Target_arm_nacl): New class.
2148         (Target_selector_arm_nacl): New class.
2149         (target_selector_arm, target_selector_armbe): Use it instead of
2150         Target_selector_arm.
2151
2152         * target-select.cc (select_target): Take new Input_file* and off_t
2153         arguments, pass them on to recognize method of selector.
2154         * object.cc (make_elf_sized_object): Update caller.
2155         * parameters.cc (parameters_force_valid_target): Likewise.
2156         * incremental.cc (make_sized_incremental_binary): Likewise.
2157         * target-select.h: Update decl.
2158         (Target_selector::recognize): Take new Input_file* argument,
2159         pass it on to do_recognize.
2160         (Target_selector::do_recognize): Take new Input_file* argument.
2161         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2162         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2163         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2164         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2165
2166         * target.h (Target::Target_info): New members isolate_execinstr
2167         and rosegment_gap.
2168         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2169         * arm.cc (Target_arm::arm_info): Update initializer.
2170         * i386.cc (Target_i386::i386_info): Likewise.
2171         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2172         * sparc.cc (Target_sparc::sparc_info): Likewise.
2173         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2174         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2175         * layout.cc (Layout::attach_allocated_section_to_segment):
2176         Take new const Target* argument.  If target->isolate_execinstr(), act
2177         like --rosegment.
2178         (Layout::find_first_load_seg): Take new const Target* argument;
2179         if target->isolate_execinstr(), reject PF_X segments.
2180         (Layout::relaxation_loop_body): Update caller.
2181         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2182         reset file offset to zero when we hit LOAD_SEG, and then do a second
2183         loop over the segments before LOAD_SEG to reassign offsets after
2184         addresses have been determined.  Handle target->rosegment_gap().
2185         (Layout::attach_section_to_segment): Take new const Target* argument;
2186         pass it to attach_allocated_section_to_segment.
2187         (Layout::make_output_section): Update caller.
2188         (Layout::attach_sections_to_segments): Take new const Target* argument;
2189         pass it to attach_section_to_segment.
2190         * gold.cc (queue_middle_tasks): Update caller.
2191         * layout.h (Layout): Update method decls with new arguments.
2192
2193         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2194         Target_info pointer to use.
2195         (Target_arm::do_make_data_plt): New virtual method.
2196         (Target_arm::make_data_plt): New method that calls it.
2197         (Target_arm::make_plt_entry): Use it.
2198         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2199         for the section alignment.
2200         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2201         method.
2202         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2203         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2204         method.
2205         (Output_data_plt_arm::get_plt_entry_size): Call it.
2206         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2207         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2208         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2209         method.
2210         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2211         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2212         method instead of sizeof(plt_entry).
2213         (Output_data_plt_arm::add_entry): Likewise.
2214         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2215         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2216         than static method.
2217         (Target_arm::plt_entry_size): Likewise.
2218         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2219         Move to ...
2220         (Output_data_plt_arm_standard): ... here, new class.
2221         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2222         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2223         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2224
2225         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2226         Take additional argument for the PLT entry size.
2227         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2228         Use get_plt_entry_size method rather than plt_entry_size variable.
2229         (Output_data_plt_x86_64::reserve_slot): Likewise.
2230         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2231         (Output_data_plt_x86_64::add_entry): Likewise.
2232         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2233         (Output_data_plt_x86_64::address_for_global): Likewise.
2234         (Output_data_plt_x86_64::address_for_local): Likewise.
2235         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2236         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2237         Make method non-static.
2238         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2239         method.
2240         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2241         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2242         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2243         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2244         virtual method.
2245         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2246         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2247         virtual method.
2248         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2249         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2250         virtual method.
2251         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2252         (Output_data_plt_x86_64::plt_entry_size)
2253         (Output_data_plt_x86_64::first_plt_entry)
2254         (Output_data_plt_x86_64::plt_entry)
2255         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2256         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2257         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2258         (Output_data_plt_x86_64_standard): ... here, new class.
2259         (Target_x86_64::Target_x86_64): Take optional argument for the
2260         Target_info pointer to use.
2261         (Target_x86_64::do_make_data_plt): New virtual method.
2262         (Target_x86_64::make_data_plt): New method to call it.
2263         (Target_x86_64::init_got_plt_for_update): Use that.
2264         Call this->plt_->add_eh_frame method here.
2265         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2266         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2267         rather than static method.
2268         (Target_x86_64::plt_entry_size): Likewise.
2269         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2270         rather than plt_entry_size variable.  Move guts of PLT filling to...
2271         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2272         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2273         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2274
2275         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2276         additional argument for the section alignment.
2277         Don't do add_eh_frame_for_plt here.
2278         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2279         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2280         variable.
2281         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2282         method.
2283         (Output_data_plt_i386::get_plt_entry_size): Call it.
2284         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2285         (Output_data_plt_i386::add_eh_frame): New method to call it.
2286         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2287         method.
2288         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2289         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2290         method.
2291         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2292         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2293         method instead of plt_entry_size.
2294         (Output_data_plt_i386::plt_entry_size)
2295         (Output_data_plt_i386::plt_eh_frame_fde_size)
2296         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2297         (Output_data_plt_i386_standard): ... here, new class.
2298         (Output_data_plt_i386_exec): New class.
2299         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2300         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2301         (Output_data_plt_i386::exec_plt_entry): Move to ...
2302         (Output_data_plt_i386_exec::plt_entry): ... here.
2303         (Output_data_plt_i386_dyn): New class.
2304         (Output_data_plt_i386::first_plt_entry): Move to ...
2305         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2306         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2307         (Output_data_plt_i386_dyn::plt_entry): ... here.
2308         (Target_i386::Target_i386): Take optional argument for the Target_info
2309         pointer to use.
2310         (Target_i386::do_make_data_plt): New virtual method.
2311         (Target_i386::make_data_plt): New method to call it.
2312         (Target_i386::make_plt_section): Use that.
2313         Call this->plt_->add_eh_frame method here.
2314         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2315         rather than plt_entry_size variable.
2316         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2317         (Output_data_plt_i386::address_for_local): Likewise.
2318         (Output_data_plt_i386::do_write): Likewise.
2319         Move guts of PLT filling to...
2320         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2321         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2322         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2323         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2324
2325 2012-05-01  Cary Coutant  <ccoutant@google.com>
2326
2327         * dwarf_reader.cc (Dwarf_die::read_attributes)
2328         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2329         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2330         * reduced_debug_output.cc
2331         (Output_reduced_debug_info_section::get_die_end): Remove
2332         DW_FORM_GNU_ref_index.  Add default case.
2333
2334 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2335
2336         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2337         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2338         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2339         DW_AT_high_pc as offset from DW_AT_low_pc.
2340
2341         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2342         * testsuite/Makefile.in: Regenerate.
2343         * testsuite/gdb_index_test_3.c: New test source file.
2344         * testsuite/gdb_index_test_3.sh: New test source file.
2345
2346 2012-04-25  Ian Lance Taylor  <iant@google.com>
2347
2348         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2349         pointer.
2350         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2351         as a class, not a struct.
2352         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2353         (Target_arm::apply_cortex_a8_workaround): Likewise.
2354         * gc.h: Declare Reloc_types as a struct, not a class.
2355         * object.h: Declare Symbols_data as a struct.
2356         * reloc.h: Declare Read_relocs_data as a struct.
2357         * target.h: Declare Relocate_info as a struct.
2358
2359 2012-04-24  David S. Miller  <davem@davemloft.net>
2360
2361         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2362         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2363         and R_SPARC_WPLT30.
2364
2365 2012-04-24  Cary Coutant  <ccoutant@google.com>
2366
2367         * incremental-dump.cc (find_input_containing_global): Replace
2368         magic number with symbolic constant.
2369         (dump_incremental_inputs): Update version number.
2370         * incremental.cc (Output_section_incremental_inputs): Update version
2371         number; import symbolic constants from Incremental_inputs_reader.
2372         (Incremental_inputs::create_data_sections): Align relocations
2373         section correctly for 64-bit targets.
2374         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2375         constants; add padding.
2376         (Output_section_incremental_inputs::write_header): Add assert for
2377         header_size.
2378         (Output_section_incremental_inputs::write_input_files): Add assert
2379         for input_entry_size.
2380         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2381         add assert for object_info_size, input_section_entry_size,
2382         global_sym_entry_size.
2383         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2384         for data structure sizes; use them.
2385         (Incremental_input_entry_reader): Import symbolic constants from
2386         Incremental_inputs_reader; use them.
2387
2388 2012-04-23  David S. Miller  <davem@davemloft.net>
2389
2390         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2391         and elf_flags_set_.
2392         (Target_sparc::Target_sparc): Initialize new fields.
2393         (Target_sparc::do_make_elf_object): New function.
2394         (Target_sparc::do_adjust_elf_header): New function.
2395
2396 2012-04-23  Cary Coutant  <ccoutant@google.com>
2397
2398         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2399         CU range table of gdb index.
2400
2401 2012-04-20  David S. Miller  <davem@davemloft.net>
2402
2403         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2404         instead of false.
2405
2406 2012-04-16  David S. Miller  <davem@davemloft.net>
2407
2408         * sparc.cc (Target_sparc::got_address): New function.
2409         (Sparc_relocate_functions::gdop_hix22): New function.
2410         (Sparc_relocate_functions::gdop_lox10): New function.
2411         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2412         relocs.
2413         (Target_sparc::Scan::local): Likewise if the global symbol is not
2414         preemptible and is not IFUNC.
2415         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2416         transformations for local and non-preemptible non-IFUNC global
2417         symbols.
2418
2419         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2420         writing out 64-bit part of ranges.
2421
2422         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2423         -fpic and -fpie respectively.
2424         * Makefile.in: Regenerate.
2425
2426         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2427         (Target_sparc::Target_sparc): Initialize new field.
2428         (Target_sparc::do_plt_section_for_global): New function.
2429         (Target_sparc::do_plt_section_for_local): New function.
2430         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2431         (Target_sparc::make_plt_section): New function, broken out of
2432         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2433         (Target_sparc::make_plt_entry): Call make_plt_section.
2434         (Target_sparc::make_local_ifunc_plt_entry): New function.
2435         (Target_sparc::rela_ifunc_section): New function.
2436         (Target_sparc::plt_section): Remove const.
2437         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2438         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2439         and ifunc_count_ fields.
2440         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2441         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2442         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2443         (Output_data_plt_sparc::rela_ifunc): New function.
2444         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2445         (Output_data_plt_sparc::has_ifunc_section): New function.
2446         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2447         (Output_data_plt_sparc::address_for_global): New function.
2448         (Output_data_plt_sparc::address_for_local): New function.
2449         (Output_data_plt_sparc::plt_index_to_offset): New function.
2450         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2451         and entry_count.
2452         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2453         entry_count.
2454         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2455         R_SPARC_JMP_IREL to switch.
2456         (Target_sparc::Scan::check_non_pic): Likewise.
2457         (Target_sparc::Scan::local): Handle IFUNC symbols.
2458         (Target_sparc::Scan::local): Likewise.
2459         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2460         and plt_address_for_local.
2461         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2462         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2463
2464         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2465         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2466         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2467         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2468         global relocs too.
2469         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2470         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2471         calls.
2472         * sparc.cc (Target_sparc::Scan::global): Likewise.
2473         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2474
2475 2012-04-16  Cary Coutant  <ccoutant@google.com>
2476
2477         * archive.cc (Library_base::should_include_member): Check for
2478         --export-dynamic-symbol.
2479         * options.h (class General_options): Add --export-dynamic-symbol.
2480         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2481         --export-dynamic-symbol.
2482         (Symbol_table::gc_mark_undef_symbols): Likewise.
2483         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2484
2485 2012-04-12  David S. Miller  <davem@davemloft.net>
2486
2487         * sparc.cc (Reloc::wdisp10): New relocation method.
2488         (Reloc::h34): Likewise.
2489         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2490         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2491         R_SPARC_WDISP10.
2492         (Target_sparc::Scan::local): Likewise.
2493         (Target_sparc::Scan::global): Likewise.
2494         (Target_sparc::Relocate::relocate): Likewise.
2495
2496 2012-04-09  Cary Coutant  <ccoutant@google.com>
2497
2498         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2499         low_pc == 0.
2500
2501 2012-04-06  Ian Lance Taylor  <iant@google.com>
2502
2503         * timer.cc: #include <unistd.h>.
2504
2505 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2506
2507         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2508         * config.in: Regenerate.
2509         * configure: Regenerate.
2510
2511 2012-04-05  Nick Clifton  <nickc@redhat.com>
2512
2513         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2514         (AM_LC_MESSAGES): Add.
2515         * aclocal.m4: Regenerate.
2516         * config.in: Regenerate.
2517         * configure: Regenerate.
2518
2519 2012-03-21  Cary Coutant  <ccoutant@google.com>
2520
2521         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2522         * Makefile.in: Regenerate.
2523         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2524         (Sized_elf_reloc_mapper::symbol_section): New function.
2525         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2526         (make_elf_reloc_mapper): New function.
2527         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2528         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2529         (Dwarf_abbrev_table::do_get_abbrev): New function.
2530         (Dwarf_ranges_table::read_ranges_table): New function.
2531         (Dwarf_ranges_table::read_range_list): New function.
2532         (Dwarf_pubnames_table::read_section): New function.
2533         (Dwarf_pubnames_table::read_header): New function.
2534         (Dwarf_pubnames_table::next_name): New function.
2535         (Dwarf_die::Dwarf_die): New function.
2536         (Dwarf_die::read_attributes): New function.
2537         (Dwarf_die::skip_attributes): New function.
2538         (Dwarf_die::set_name): New function.
2539         (Dwarf_die::set_linkage_name): New function.
2540         (Dwarf_die::attribute): New function.
2541         (Dwarf_die::string_attribute): New function.
2542         (Dwarf_die::int_attribute): New function.
2543         (Dwarf_die::uint_attribute): New function.
2544         (Dwarf_die::ref_attribute): New function.
2545         (Dwarf_die::child_offset): New function.
2546         (Dwarf_die::sibling_offset): New function.
2547         (Dwarf_info_reader::check_buffer): New function.
2548         (Dwarf_info_reader::parse): New function.
2549         (Dwarf_info_reader::do_parse): New function.
2550         (Dwarf_info_reader::do_read_string_table): New function.
2551         (Dwarf_info_reader::lookup_reloc): New function.
2552         (Dwarf_info_reader::get_string): New function.
2553         (Dwarf_info_reader::visit_compilation_unit): New function.
2554         (Dwarf_info_reader::visit_type_unit): New function.
2555         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2556         Sized_elf_reloc_mapper.
2557         (Sized_dwarf_line_info::symbol_section): Remove function.
2558         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2559         (Sized_dwarf_line_info::read_line_mappings): Remove object
2560         parameter, adjust callers.
2561         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2562         * dwarf_reader.h: Include <sys/types.h>.
2563         (class Track_relocs): Remove forward declaration.
2564         (class Elf_reloc_mapper): New class.
2565         (class Sized_elf_reloc_mapper): New class.
2566         (class Dwarf_abbrev_table): New class.
2567         (class Dwarf_range_list): New class.
2568         (class Dwarf_ranges_table): New class.
2569         (class Dwarf_pubnames_table): New class.
2570         (class Dwarf_die): New class.
2571         (class Dwarf_info_reader): New class.
2572         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2573         (Sized_dwarf_line_info::symbol_section): Remove member function.
2574         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2575         base class.
2576         * gdb-index.cc: New source file.
2577         * gdb-index.h: New source file.
2578         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2579         and .debug_types sections, call Layout::add_to_gdb_index.
2580         (Sized_relobj_incr::do_section_name): Implement.
2581         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2582         return type; Implement.
2583         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2584         return type.
2585         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2586         parameter list and return type.
2587         (Sized_incr_dynobj::do_section_contents): Likewise.
2588         * layout.cc: Include gdb-index.h.
2589         (Layout::Layout): Initialize gdb_index_data_.
2590         (Layout::init_fixed_output_section): Check for .gdb_index section.
2591         (Layout::add_to_gdb_index): New function. Instantiate.
2592         * layout.h: Add forward declaration for class Gdb_index.
2593         (Layout::add_to_gdb_index): New member function.
2594         (Layout::gdb_index_data_): New data member.
2595         * main.cc: Include gdb-index.h.
2596         (main): Print statistics for gdb index.
2597         * object.cc (Object::section_contents): Move code into
2598         do_section_contents.
2599         (need_decompressed_section): Check for sections needed when building
2600         gdb index.
2601         (build_compressed_section_map): Likewise.
2602         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2603         gdb index.
2604         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2605         sections; call Layout::add_to_gdb_index.
2606         (Sized_relobj_file::do_decompressed_section_contents): Call
2607         do_section_contents directly.
2608         * object.h (Object::do_section_contents): Adjust parameter list and
2609         return type.
2610         (Object::do_decompressed_section_contents): Call do_section_contents
2611         directly.
2612         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2613         return type.
2614         * options.h (class General_options): Add --gdb-index option.
2615         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2616         list and return type.
2617         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2618         * reloc.h (Track_relocs::checkpoint): New function.
2619         (Track_relocs::reset): New function.
2620
2621         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2622         New test cases.
2623         * testsuite/Makefile.in: Regenerate.
2624         * testsuite/gdb_index_test.cc: New test source file.
2625         * testsuite/gdb_index_test_1.sh: New test source file.
2626         * testsuite/gdb_index_test_2.sh: New test source file.
2627
2628 2012-03-19  Doug Kwan  <dougkwan@google.com>
2629
2630         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2631         (Target_arm::do_finalize_sections): Remove code which defines
2632         __exidx_start and __exidx_end.  Make symbol table parameter
2633         anonymous as it is not used.
2634         * gold.cc (queue_middle_tasks): Call target hook to define any
2635         target-specific symbols.
2636         * target.h (Target::define_standard_symbols): New method.
2637         (Target::do_define_standard_symbols): Same.
2638         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2639         * testsuite/Makefile.in: Regenerate.
2640         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2641         and __exidx_end.
2642         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2643         relocations are generated for __exidx_start and __exidx_end.
2644
2645 2012-03-16  Doug Kwan  <dougkwan@google.com>
2646
2647         * testsuite/Makefile.am: Disable test initpri3b.
2648         * testsuite/Makefile.in: Regenerate.
2649
2650 2012-03-15  Doug Kwan  <dougkwan@google.com>
2651
2652         * arm.cc (Target_arm::got_section): Make .got section read-only
2653         if -z now is given.
2654
2655 2012-03-15  Ian Lance Taylor  <iant@google.com>
2656
2657         PR gold/13850
2658         * layout.cc (Layout::make_output_section): Correctly mark
2659         SHT_INIT_ARRAY, et. al., as relro.
2660
2661 2012-03-14  Doug Kwan  <dougkwan@google.com>
2662
2663         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2664         dynamic relocations for protected symbols in shared objects.
2665
2666 2012-03-13  Ian Lance Taylor  <iant@google.com>
2667
2668         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2669         keep the larger alignment.
2670
2671 2012-03-12  Cary Coutant  <ccoutant@google.com>
2672
2673         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2674         handling of DW_LNE_define_file.
2675
2676 2012-03-12  Cary Coutant  <ccoutant@google.com>
2677
2678         * reduced_debug_output.cc
2679         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2680         codes to switch.
2681
2682 2012-02-29  Cary Coutant  <ccoutant@google.com>
2683
2684         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2685
2686 2012-02-29  Cary Coutant  <ccoutant@google.com>
2687
2688         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2689         Call Object::decompressed_section_contents.
2690         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2691         New dtor.
2692         (Sized_dwarf_line_info::buffer_start_): New data member.
2693         * merge.cc (Output_merge_data::do_add_input_section): Call
2694         Object::decompressed_section_contents.
2695         (Output_merge_string::do_add_input_section): Likewise.
2696         * object.cc (need_decompressed_section): New function.
2697         (build_compressed_section_map): Decompress sections needed later.
2698         (Sized_relobj_file::do_decompressed_section_contents): New function.
2699         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2700         * object.h (Object::decompressed_section_contents): New function.
2701         (Object::discard_decompressed_sections): New function.
2702         (Object::do_decompressed_section_contents): New function.
2703         (Object::do_discard_decompressed_sections): New function.
2704         (Compressed_section_info): New type.
2705         (Compressed_section_map): Include decompressed section contents.
2706         (Sized_relobj_file::do_decompressed_section_contents): New function.
2707         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2708
2709 2012-02-16  Cary Coutant  <ccoutant@google.com>
2710
2711         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2712         * testsuite/Makefile.in: Regenerate.
2713
2714 2012-02-14  Cary Coutant  <ccoutant@google.com>
2715
2716         * options.cc (General_options::finalize): Disallow -pie and -static.
2717
2718 2012-02-03  Doug Kwan  <dougkwan@google.com>
2719
2720         * arm.cc (Arm_relocate_functions::abs8,
2721         Arm_relocate_functions::abs16): Use
2722         Bits::has_signed_unsigned_overflow32.
2723         (Arm_relocate_functions::thm_abs8): Correct range of
2724         overflow check.
2725         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2726         in assertions.
2727
2728 2012-02-02  Doug Kwan  <dougkwan@google.com>
2729
2730         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2731         position independent outputs, not just shared objects.
2732
2733 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2734
2735         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2736         * configure: Regenerated.
2737
2738 2012-01-27  Ian Lance Taylor  <iant@google.com>
2739
2740         * reloc.h (Bits): New class with static functions, copied from
2741         namespace utils in arm.cc.
2742         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2743         instead.
2744
2745 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2746
2747         * incremental.cc (write_info_blocks): Correct relocation offset.
2748
2749 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2750
2751         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2752         (Relocate::tls_gd_to_le): Likewise.
2753
2754 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2755
2756         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2757
2758 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2759
2760         * configure.ac: Check if -mcmodel=medium works.
2761         * configure: Regenerated.
2762
2763 2012-01-24  Cary Coutant  <ccoutant@google.com>
2764
2765         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2766         definition and ...
2767         (read_unsigned_LEB_128_x): ... this new function.
2768         (read_signed_LEB_128): Replaced with inline definition and ...
2769         (read_signed_LEB_128_x): ... this new function.
2770         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2771         (read_unsigned_LEB_128): Add inline definition.
2772         (read_signed_LEB_128_x): New function.
2773         (read_signed_LEB_128): Add inline definition.
2774         * testsuite/Makefile.am (leb128_unittest): New unit test.
2775         * testsuite/Makefile.in: Regenerate.
2776         * testsuite/leb128_unittest.cc: New unit test.
2777
2778 2012-01-23  Ian Lance Taylor  <iant@google.com>
2779
2780         PR gold/13617
2781         * i386.cc (Target_i386::do_code_fill): When using a jmp
2782         instruction, pad with nop instructions.
2783         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2784
2785 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2786
2787         * x86_64.cc (gc_process_relocs): Add typename on types used in
2788         template.
2789         (scan_relocs): Likewise.
2790         (relocate_section): Likewise.
2791         (apply_relocation): Likewise.
2792
2793 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2794
2795         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2796         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2797         under x32.
2798
2799 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2800
2801         * x86_64.cc: Initial support for x32.
2802
2803 2012-01-03  Cary Coutant  <ccoutant@google.com>
2804
2805         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2806         Use abstract base class for GOT.
2807         * gold/output.h (class Output_data_got_base): New abstract base class.
2808         (class Output_data_got): Derive from new base class, adjust ctors.
2809         (Output_data_got::reserve_slot): Make virtual; rename to
2810         do_reserve_slot; Adjust callers.
2811         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2812         pointer to abstract base class.
2813         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2814
2815 2011-12-18  Ian Lance Taylor  <iant@google.com>
2816
2817         * object.h (Relobj::local_symbol_value): New function.
2818         (Relobj::local_plt_offset): New function.
2819         (Relobj::local_has_got_offset): New function.
2820         (Relobj::local_got_offset): New function.
2821         (Relobj::set_local_got_offset): New function.
2822         (Relobj::do_local_symbol_value): New pure virtual function.
2823         (Relobj::do_local_plt_offset): Likewise.
2824         (Relobj::do_local_has_got_offset): Likewise.
2825         (Relobj::do_local_got_offset): Likewise.
2826         (Relobj::do_set_local_got_offset): Likewise.
2827         (Sized_relobj::do_local_has_got_offset): Rename from
2828         local_has_got_offset.
2829         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2830         (Sized_relobj::do_set_local_got_offset): Rename from
2831         set_local_got_offset.
2832         (Sized_relobj_file::do_local_plt_offset): Rename from
2833         local_plt_offset.
2834         (Sized_relobj_file::do_local_symbol_value): New function.
2835         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2836         local_plt_offset.
2837         * output.cc (Output_data_got::Got_entry::write): Change object to
2838         Relobj.  Use local_symbol_value.
2839         (Output_data_got::add_global_with_rel): Change rel_dyn to
2840         Output_data_reloc_generic*.  Use add_global_generic.
2841         (Output_data_got::add_global_with_rela): Remove.  Change all
2842         callers to use add_global_with_rel.
2843         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2844         Output_data_reloc_generic*.  Use add_global_generic.
2845         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2846         callers to use add_global_pair_with_rel.
2847         (Output_data_got::add_local): Change object to Relobj*.
2848         (Output_data_got::add_local_plt): Likewise.
2849         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2850         change rel_dyn to Output_data_reloc_generic*.  Use
2851         add_local_generic.
2852         (Output_data_got::add_local_with_rela): Remove.  Change all
2853         callers to use all_local_with_rel.
2854         (Output_data_got::add_local_pair_with_rel): Change object to
2855         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2856         add_output_section_generic.
2857         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2858         callers to use add_local_pair_with_rel.
2859         (Output_data_got::reserve_local): Change object to Relobj*.
2860         * output.h: (class Output_data_reloc_generic): Add pure virtual
2861         declarations for add_global_generic, add_local_generic,
2862         add_output_section_generic.
2863         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2864         functions for Output_data_reloc_generic.  Update declarations for
2865         changes listed in output.cc.
2866         (class Output_data_got): Change template parameter to got_size.
2867         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2868         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2869         function.
2870         (Sized_relobj_incr::do_local_plt_offset): New function.
2871         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2872         add_global_generic.
2873
2874 2011-12-17  Cary Coutant  <ccoutant@google.com>
2875
2876         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2877         * resolve.cc (Symbol_table::resolve): Likewise.
2878         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2879         arrays.
2880         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2881
2882 2011-12-16  Ian Lance Taylor  <iant@google.com>
2883
2884         * output.h (Output_data_reloc_generic::add): Only call
2885         add_dynamic_reloc if this is a dynamic reloc section.
2886
2887 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2888
2889         PR gold/13505
2890         * target-reloc.h (apply_relocation): Replace <64, false> with
2891         <size, big_endian>.
2892
2893 2011-11-25  Nick Clifton  <nickc@redhat.com>
2894
2895         * po/it.po: New Italian translation.
2896
2897 2011-11-17  Sterling Augustine  <saugustine@google.com>
2898
2899         * script.cc (script_include_directive): Implement.
2900         (read_script_file): New local variables name and search_path. Update
2901         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
2902         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
2903         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
2904
2905 2011-11-11  Sterling Augustine  <saugustine@google.com>
2906
2907         * yyscript.y (section_cmd): Add support for INCLUDE directive.
2908         (file_or_sections_cmd): Likewise.
2909
2910 2011-11-11  Doug Kwan  <dougkwan@google.com>
2911
2912         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
2913         if --just-symbols is given.
2914
2915 2011-11-10  Doug Kwan  <dougkwan@google.com>
2916
2917         PR gold/13362
2918         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
2919         when processing data relocs.
2920         * reloc.h (Relocate_functions::rel_unaligned): New method.
2921         (Relocate_functions::pcrel_unaligned): Ditto.
2922         (Relocate_functions::rel32_unaligned): Ditto.
2923         (Relocate_functions::pcrel32_unaligned): Ditto.
2924
2925 2011-11-09  Doug Kwan  <dougkwan@google.com>
2926
2927         PR gold/13362
2928         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
2929         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
2930         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
2931         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2932         (Relocate_functions::rel_unaligned): New.
2933         (Relocate_functions::rel32_unaligned): New.
2934         * target-reloc.h (relocate_for_relocatable): Add code to handle
2935         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
2936         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
2937         arm_unaligned_reloc_r): New targets.
2938         * testsuite/Makefile.in: Regenerate.
2939         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
2940         linking.
2941
2942 2011-11-02  Ian Lance Taylor  <iant@google.com>
2943
2944         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
2945         NATIVE_LINKER.
2946         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
2947         * options.cc (General_options::finalize): Use library search path
2948         from configure script if specified.  If not native and no sysroot,
2949         only search TOOLLIBDIR.
2950         * options.h (Search_directory::Search_directory): Change name to
2951         const std::string&.
2952         (General_options::add_to_library_path_with_sysroot): Change arg to
2953         const std::string&.
2954         * configure, Makefile.in, config.in: Rebuild.
2955
2956 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2957
2958         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
2959         we are working around the ARM1176 Erratum.
2960         * options.h (General_options::fix_arm1176): Add option.
2961         * testsuite/Makefile.am: Add testcases, and keep current ones
2962         working.
2963         * testsuite/Makefile.in: Regenerate.
2964         * testsuite/arm_fix_1176.s: New file.
2965         * testsuite/arm_fix_1176.sh: Likewise.
2966
2967 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
2968
2969         * arm.cc (Target_arm::Target_arm): Remove initialisation of
2970         may_use_blx_.
2971         (Target_arm::may_use_blx): Remove method.
2972         (Target_arm::set_may_use_blx): Likewise.
2973         (Target_arm::may_use_v4t_interworking): New method.
2974         (Target_arm::may_use_v5t_interworking): Likewise.
2975         (Target_arm::may_use_blx_): Remove member variable.
2976         (Arm_relocate_functions::arm_branch_common): Check for v5T
2977         interworking.
2978         (Arm_relocate_functions::thumb_branch_common): Likewise.
2979         (Reloc_stub::stub_type_for_reloc): Likewise.
2980         (Target_arm::do_finalize_sections): Correct interworking checks.
2981         * testsuite/Makefile.am: Add new tests.
2982         * testsuite/Makefile.in: Regenerate.
2983         * testsuite/arm_farcall_arm_arm.s: New test.
2984         * testsuite/arm_farcall_arm_arm.sh: Likewise.
2985         * testsuite/arm_farcall_arm_thumb.s: Likewise.
2986         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
2987         * testsuite/arm_farcall_thumb_arm.s: Likewise.
2988         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
2989         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
2990         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
2991
2992 2011-10-31  Cary Coutant  <ccoutant@google.com>
2993
2994         PR gold/13023
2995         * expression.cc (Expression::eval_with_dot): Add
2996         is_section_dot_assignment parameter.
2997         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
2998         absolute and assigning to dot within a section.
2999         * script-sections.cc
3000         (Output_section_element_assignment::set_section_addresses): Pass
3001         dot_section to set_if_absolute.
3002         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3003         as is_section_dot_assignment flag to eval_with_dot.
3004         (Output_section_element_dot_assignment::set_section_addresses):
3005         Likewise.
3006         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3007         parameter.  Also set value if relative to dot_section; set the
3008         symbol's output_section.
3009         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3010         parameter.  Adjust all callers.
3011         (Expression::eval_maybe_dot): Likewise.
3012         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3013         Adjust all callers.
3014         * testsuite/script_test_2.t: Test assignment of an absolute value
3015         to dot within an output section element.
3016
3017 2011-10-31  Cary Coutant  <ccoutant@google.com>
3018
3019         * options.h (class General_options): Add --[no-]gnu-unique options.
3020         * symtab.cc (Symbol_table::sized_write_globals): Convert
3021         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3022
3023 2011-10-31  Cary Coutant  <ccoutant@google.com>
3024
3025         PR gold/13359
3026         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3027         unnecessary assertion.
3028         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3029
3030 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3031
3032         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3033         gc_mark_symbol.
3034         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3035         gc_mark_symbol.
3036         Change to just keep the section associated with symbol.
3037         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3038         they are externally visible and --export-dynamic is turned on.
3039         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3040
3041 2011-10-19  Ian Lance Taylor  <iant@google.com>
3042
3043         PR gold/13163
3044         * script-sections.cc
3045         (Output_section_element_dot_assignment::needs_output_section): New
3046         function.
3047
3048 2011-10-19  Ian Lance Taylor  <iant@google.com>
3049
3050         PR gold/13204
3051         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3052         --section-start option was seen.
3053         * options.h (General_options::any_section_start): New function.
3054
3055 2011-10-18  David S. Miller  <davem@davemloft.net>
3056
3057         PR binutils/13301
3058         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3059         member to track relocation locations that have moved during TLS
3060         reloc optimizations.
3061         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3062         (Target_sparc::Relocate::relocate): Adjust view down by 4
3063         bytes if it matches reloc_adjust_addr_.
3064         (Target_sparc::Relocate::relocate_tls): Always move the
3065         __tls_get_addr call delay slot instruction forward 4 bytes when
3066         performing relaxation.
3067
3068 2011-10-18  Cary Coutant  <ccoutant@google.com>
3069
3070         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3071         (Output_file::map_no_anonymous): Check for non-zero
3072         return code from posix_fallocate.
3073
3074 2011-10-17  Cary Coutant  <ccoutant@google.com>
3075
3076         PR gold/13245
3077         * plugin.cc (is_visible_from_outside): Check for symbols
3078         referenced from dynamic objects.
3079         * resolve.cc (Symbol_table::resolve): Don't count references
3080         from dynamic objects as references from real ELF files.
3081         * testsuite/plugin_test_2.sh: Adjust expected result.
3082
3083 2011-10-17  Cary Coutant  <ccoutant@google.com>
3084
3085         * gold.cc: Include timer.h.
3086         (queue_middle_tasks): Stamp time.
3087         (queue_final_tasks): Likewise.
3088         * main.cc (main): Store timer in parameters.  Print timers
3089         for each pass.
3090         * parameters.cc (Parameters::Parameters): Initialize timer_.
3091         (Parameters::set_timer): New function.
3092         (set_parameters_timer): New function.
3093         * parameters.h (Parameters::set_timer): New function.
3094         (Parameters::timer): New function.
3095         (Parameters::timer_): New data member.
3096         (set_parameters_timer): New function.
3097         * timer.cc (Timer::stamp): New function.
3098         (Timer::get_pass_time): New function.
3099         * timer.h (Timer::stamp): New function.
3100         (Timer::get_pass_time): New function.
3101         (Timer::pass_times_): New data member.
3102
3103 2011-10-17  Cary Coutant  <ccoutant@google.com>
3104
3105         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3106         task for members of lib groups.
3107
3108 2011-10-17  Cary Coutant  <ccoutant@google.com>
3109
3110         PR gold/13288
3111         * fileread.cc (File_read::find_view): Add assert.
3112         (File_read::make_view): Move bounds check (replace with assert)...
3113         (File_read::find_or_make_view): ... to here.
3114
3115 2011-10-12  Cary Coutant  <ccoutant@google.com>
3116
3117         * output.cc (Output_file::open_base_file): Handle case where
3118         ::read returns less than requested size.
3119
3120 2011-10-10  Cary Coutant  <ccoutant@google.com>
3121
3122         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3123         Initialize defined_count_.
3124         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3125         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3126         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3127         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3128         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3129         * incremental.h (Sized_relobj_incr::defined_count_): New data
3130         member.
3131         (Sized_incr_dynobj::defined_count_): New data member.
3132         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3133         Return zeroes instead of internal error.
3134
3135 2011-10-10  Cary Coutant  <ccoutant@google.com>
3136
3137         PR gold/13249
3138         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3139         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3140         * output.h (class Output_reloc): Add use_plt_offset flag.
3141         (Output_reloc::type_): Adjust size of bit field.
3142         (Output_reloc::use_plt_offset_): New bit field.
3143         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3144         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3145         flag.  Adjust all callers.
3146         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3147         creating RELATIVE relocations.
3148
3149 2011-10-10  Nick Clifton  <nickc@redhat.com>
3150
3151         * po/es.po: Updated Spanish translation.
3152         * po/fi.po: Updated Finnish translation.
3153
3154 2011-10-03   Diego Novillo  <dnovillo@google.com>
3155
3156         * options.cc (parse_uint): Fix dereference of RETVAL.
3157
3158 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3159
3160         * layout.h (section_order_map_): New member.
3161         (get_section_order_map): New member function.
3162         * output.cc (Output_section::add_input_section): Check for patterns
3163         only when --section-ordering-file is specified.
3164         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3165         output_sections have been formed.
3166         * layout.cc (Layout_Layout): Initialize section_order_map_.
3167         * plugin.cc (update_section_order): Store order in order_map. Do not
3168         update the order.
3169         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3170         * testsuite/Makefile.in: Regenerate.
3171         * testsuite/plugin_section_order.c: New file.
3172         * testsuite/plugin_final_layout.cc: New file.
3173         * testsuite/plugin_final_layout.sh: New file.
3174
3175 2011-09-29  Cary Coutant  <ccoutant@google.com>
3176
3177         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3178         Check for NULL.
3179         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3180         symbols during incremental update.
3181         (Symbol_table::add_from_dynobj): Likewise.
3182
3183 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3184             Ian Lance Taylor  <iant@google.com>
3185
3186         * symtab.cc (Symbol_table::define_special_symbol): Always
3187         canonicalize version string.
3188
3189 2011-09-26  Cary Coutant  <ccoutant@google.com>
3190
3191         * gold.cc (queue_initial_tasks): Move option checks ...
3192         * options.cc (General_options::finalize): ... to here. Disable
3193         some options; make others fatal.
3194
3195 2011-09-26  Cary Coutant  <ccoutant@google.com>
3196
3197         gcc PR lto/47247
3198         * plugin.cc (get_symbols_v2): New function.
3199         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3200         (is_referenced_from_outside): New function.
3201         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3202         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3203         (get_symbols): Pass version parameter.
3204         (get_symbols_v2): New function.
3205         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3206         parameter.
3207         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3208         (onload): Add LDPT_GET_SYMBOLS_V2.
3209         (all_symbols_read_hook): Use get_symbols_v2; check for
3210         LDPR_PREVAILING_DEF_IRONLY_EXP.
3211         * testsuite/plugin_test_3.sh: Update expected results.
3212
3213 2011-09-23  Simon Baldwin  <simonb@google.com>
3214
3215         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3216         configuration options.
3217         * configure: Regenerate.
3218         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3219         * Makefile.in: Regenerate.
3220         * testsuite/Makefile.in: Regenerate.
3221
3222 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3223
3224         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3225
3226 2011-09-19  Cary Coutant  <ccoutant@google.com>
3227
3228         * incremental.cc (can_incremental_update): Fix typo in comment.
3229         * incremental.h (can_incremental_update): Likewise.
3230
3231 2011-09-18  Cary Coutant  <ccoutant@google.com>
3232
3233         * incremental.cc (can_incremental_update): New function.
3234         * incremental.h (can_incremental_update): New function.
3235         * layout.cc (Layout::init_fixed_output_section): Call it.
3236         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3237         * object.cc (Sized_relobj_file::do_layout): Call
3238         can_incremental_update.
3239
3240 2011-09-13  Cary Coutant  <ccoutant@google.com>
3241
3242         * configure.ac: Check for glibc support for gnu_indirect_function
3243         support with static linking, setting automake conditional
3244         IFUNC_STATIC.
3245         * Makefile.in: Regenerate.
3246         * configure: Regenerate.
3247
3248         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3249         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3250         for IFUNC_STATIC.
3251         * testsuite/Makefile.in: Regenerate.
3252
3253 2011-09-13  Cary Coutant  <ccoutant@google.com>
3254
3255         * incremental.cc (Sized_relobj_incr::do_layout): Call
3256         report_comdat_group for kept comdat sections.
3257         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3258         * testsuite/Makefile.in: Regenerate.
3259         * testsuite/incr_comdat_test_1.cc: New source file.
3260         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3261         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3262         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3263
3264 2011-09-13  Ian Lance Taylor  <iant@google.com>
3265
3266         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3267         variable external_symbols_offset.
3268
3269 2011-09-12  Ian Lance Taylor  <iant@google.com>
3270
3271         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3272         triggered if object has no symbols.
3273
3274 2011-09-09  David S. Miller  <davem@davemloft.net>
3275
3276         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3277         (Output_fill_debug_line::do_write): Likewise.
3278
3279 2011-08-29  Cary Coutant  <ccoutant@google.com>
3280
3281         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3282         casts to match formatting specs.
3283         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3284
3285 2011-08-26  Cary Coutant  <ccoutant@google.com>
3286
3287         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3288         remaining hole size when allocating.
3289         (Layout::make_output_section): Set fill methods for debug sections.
3290         * layout.h (Free_list::Free_list_node): Move from private to
3291         public.
3292         (Free_list::set_min_hole_size): New function.
3293         (Free_list::begin, Free_list::end): New functions.
3294         (Free_list::min_hole_): New data member.
3295         * output.cc: Include dwarf.h.
3296         (Output_fill_debug_info::do_minimum_hole_size): New function.
3297         (Output_fill_debug_info::do_write): New function.
3298         (Output_fill_debug_line::do_minimum_hole_size): New function.
3299         (Output_fill_debug_line::do_write): New function.
3300         (Output_section::Output_section): Initialize new data member.
3301         (Output_section::set_final_data_size): Ensure patch space is larger
3302         than minimum hole size.
3303         (Output_section::do_write): Fill holes in debug sections.
3304         * output.h (Output_fill): New class.
3305         (Output_fill_debug_info): New class.
3306         (Output_fill_debug_line): New class.
3307         (Output_section::set_free_space_fill): New function.
3308         (Output_section::free_space_fill_): New data member.
3309         * testsuite/Makefile.am (incremental_test_3): Add
3310         --incremental-patch option.
3311         (incremental_test_4): Likewise.
3312         (incremental_test_5): Likewise.
3313         (incremental_test_6): Likewise.
3314         (incremental_copy_test): Likewise.
3315         (incremental_common_test_1): Likewise.
3316         * testsuite/Makefile.in: Regenerate.
3317
3318 2011-08-26  Nick Clifton  <nickc@redhat.com>
3319
3320         * po/es.po: Updated Spanish translation.
3321
3322 2011-08-01  Cary Coutant  <ccoutant@google.com>
3323
3324         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3325         * gold/testsuite/Makefile.in: Regenerate.
3326         * gold/testsuite/justsyms_exec.c: New source file.
3327         * gold/testsuite/justsyms_lib.c: New source file.
3328
3329 2011-08-01  Cary Coutant  <ccoutant@google.com>
3330
3331         * layout.cc (Layout::set_segment_offsets): Don't realign text
3332         segment if -Ttext was specified.
3333         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3334         file type.
3335         * object.h (Sized_relobj_file::e_type): New function.
3336         (Sized_relobj_file::e_type_): New data member.
3337         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3338         base address for ET_EXEC files.
3339         * target.cc (Target::do_make_elf_object_implementation): Allow
3340         ET_EXEC files with --just-symbols option.
3341
3342 2011-07-28  Cary Coutant  <ccoutant@google.com>
3343
3344         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3345         Add thread_number parameter.
3346         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3347         * workqueue-threads.cc
3348         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3349         current thread if its thread number is greater than desired thread
3350         count.
3351         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3352         Add thread_number parameter.
3353         (Workqueue::should_cancel_thread): Likewise.
3354         (Workqueue::find_runnable_or_wait): Pass thread_number to
3355         should_cancel_thread.
3356         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3357         parameter.
3358
3359 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3360
3361         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3362         only after checking if it cannot be forced local.
3363         * symtab.h (is_externally_visible): Check if the symbol is not forced
3364         local.
3365
3366 2011-07-15  Ian Lance Taylor  <iant@google.com>
3367
3368         * options.h (class General_options): Add --print-output-format.
3369         Move -EL next to -EB, for  better --help output.
3370         * target-select.cc: Include <cstdio>, "options.h", and
3371         "parameters.h".
3372         (Target_selector::do_target_bfd_name): New function.
3373         (print_output_format): New function.
3374         * target-select.h (class Target_selector): Update declarations.
3375         (Target_selector::target_bfd_name): New function.
3376         (print_output_format): Declare.
3377         * main.cc: Include "target-select.h".
3378         (main): Handle --print-output-format.
3379         * gold.cc: Include "target-select.h".
3380         (queue_initial_tasks): Handle --print-output-format when there are
3381         no input files.
3382         * parameters.cc (parameters_force_valid_target): Give a better
3383         error message if -EB/-EL does not match target.
3384         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3385         function.
3386
3387 2011-07-15  Ian Lance Taylor  <iant@google.com>
3388
3389         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3390         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3391         (Output_data_plt_i386::do_write): Write address of .dynamic
3392         section to first entry in .got.plt section.
3393         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3394         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3395         Initialize layout_.
3396         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3397         section to first entry in .got.plt section.
3398         * layout.h (Layout::dynamic_section): New function.
3399
3400 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3401
3402         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3403         to claim_file call.
3404         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3405         input_section_position_, and input_section_glob_.
3406         (read_layout_from_file): Call function section_ordering_specified.
3407         * layout.h (is_section_ordering_specified): New function.
3408         (section_ordering_specified): New function.
3409         (section_ordering_specified_): New boolean member.
3410         * main.cc(main): Call load_plugins after layout object is defined.
3411         * output.cc (Output_section::add_input_section): Use
3412         function section_ordering_specified to check if section ordering is
3413         needed.
3414         * output.cc (Output_section::add_relaxed_input_section): Use
3415         function section_ordering_specified to check if section ordering is
3416         needed.
3417         (Output_section::update_section_layout): New function.
3418         (Output_section::sort_attached_input_sections): Check if input section
3419         must be reordered.
3420         * output.h (Output_section::update_section_layout): New function.
3421         * plugin.cc (get_section_count): New function.
3422         (get_section_type): New function.
3423         (get_section_name): New function.
3424         (get_section_contents): New function.
3425         (update_section_order): New function.
3426         (allow_section_ordering): New function.
3427         (Plugin::load): Add the new interfaces to the transfer vector.
3428         (Plugin_manager::load_plugins): New parameter.
3429         (Plugin_manager::all_symbols_read): New parameter.
3430         (Plugin_manager::claim_file): New parameter. Save the elf object for
3431         unclaimed objects.
3432         (Plugin_manager::get_elf_object): New function.
3433         (Plugin_manager::get_view): Change to directly use the bool to check
3434         if get_view is called from claim_file_hook.
3435         * plugin.h (input_objects): New function
3436         (Plugin__manager::load_plugins): New parameter.
3437         (Plugin_manager::claim_file): New parameter.
3438         (Plugin_manager::get_elf_object): New function.
3439         (Plugin_manager::in_claim_file_handler): New function.
3440         (Plugin_manager::in_claim_file_handler_): New member.
3441         (layout): New function.
3442         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3443         handler with an extra parameter. Make the elf object before calling
3444         claim_file handler.
3445         * testsuite/plugin_test.c (get_section_count): New function pointer.
3446         (get_section_type): New function pointer.
3447         (get_section_name): New function pointer.
3448         (get_section_contents): New function pointer.
3449         (update_section_order): New function pointer.
3450         (allow_section_ordering): New function pointer.
3451         (onload): Check if the new interfaces exist.
3452
3453 2011-07-13  Ian Lance Taylor  <iant@google.com>
3454
3455         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3456         relro section.
3457         * x86_64.cc (Target_x86_64::got_section): Likewise.
3458         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3459         (relro_now_test_SOURCES): New variable.
3460         (relro_now_test_DEPENDENCIES): New variable.
3461         (relro_now_test_LDFLAGS): New variable.
3462         (relro_now_test_LDADD): New variable.
3463         (relro_now_test.so): New target.
3464         * testsuite/Makefile.in: Rebuild.
3465
3466 2011-07-12  Ian Lance Taylor  <iant@google.com>
3467
3468         PR gold/12980
3469         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3470         GLOB_DAT relocation rather than a RELATIVE relocation for a
3471         protected symbol when creating a shared library.
3472         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3473         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3474         * testsuite/protected_main_1.cc (main): Test that protected
3475         function has same address.
3476
3477 2011-07-11  Ian Lance Taylor  <iant@google.com>
3478
3479         PR gold/12979
3480         * options.h (class General_options): Add -Bgroup.
3481         * options.cc (General_options::finalize): If -Bgroup is set,
3482         default to --unresolved-symbols=report-all.
3483         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3484         * target-reloc.h (issue_undefined_symbol_error): Handle
3485         --unresolved-symbols=report-all.
3486
3487 2011-07-08  Ian Lance Taylor  <iant@google.com>
3488
3489         PR gold/11985
3490         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3491         if linker script discards key sections.
3492         (Layout::create_dynamic_symtab): Likewise.
3493         (Layout::assign_local_dynsym_offsets): Likewise.
3494         (Layout::sized_create_version_sections): Likewise.
3495         (Layout::create_interp): Likewise.
3496         (Layout::finish_dynamic_section): Likewise.
3497         (Layout::set_dynamic_symbol_size): Likewise.
3498
3499 2011-07-08  Ian Lance Taylor  <iant@google.com>
3500
3501         PR gold/12386
3502         * options.h (class General_options): Add --unresolved-symbols.
3503         * target-reloc.h (issue_undefined_symbol_error): Check
3504         --unresolved-symbols.  Add comments.
3505
3506 2011-07-08  Ian Lance Taylor  <iant@google.com>
3507
3508         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3509         expression more complex.
3510
3511 2011-07-08  Ian Lance Taylor  <iant@google.com>
3512
3513         PR gold/11317
3514         * target-reloc.h (issue_undefined_symbol_error): New inline
3515         function, broken out of relocate_section.
3516         (relocate_section): Call issue_undefined_symbol_error.
3517         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3518         there is no TLS segment if we are about to issue an undefined
3519         symbol error.
3520         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3521
3522 2011-07-08  Ian Lance Taylor  <iant@google.com>
3523
3524         PR gold/12279
3525         * resolve.cc (Symbol_table::should_override): Add fromtype
3526         parameter.  Change all callers.  Give error when linking together
3527         TLS and non-TLS symbol.
3528         (Symbol_table::should_override_with_special): Add fromtype
3529         parameter.  Change all callers.
3530         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3531         there is no TLS segment if we have reported some errors.
3532         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3533
3534 2011-07-08  Ian Lance Taylor  <iant@google.com>
3535
3536         PR gold/12372
3537         * target.h (Target::plt_address_for_global): New function.
3538         (Target::plt_address_for_local): New function.
3539         (Target::plt_section_for_global): Remove.
3540         (Target::plt_section_for_local): Remove.
3541         (Target::do_plt_address_for_global): New virtual function.
3542         (Target::do_plt_address_for_local): New virtual function.
3543         (Target::do_plt_section_for_global): Remove.
3544         (Target::do_plt_section_for_local): Remove.
3545         (Target::register_global_plt_entry): Add Symbol_table and Layout
3546         parameters.
3547         * output.cc (Output_data_got::Got_entry::write): Use
3548         plt_address_for_global and plt_address_for_local.
3549         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3550         address of output section.
3551         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3552         got_irelative_, and irelative_count_ fields.  Update
3553         declarations.
3554         (Output_data_plt_i386::has_irelative_section): New function.
3555         (Output_data_plt_i386::entry_count): Add irelative_count_.
3556         (Output_data_plt_i386::set_final_data_size): Likewise.
3557         (class Target_i386): Add got_irelative_ and rel_irelative_
3558         fields.  Update declarations.
3559         (Target_i386::Target_i386): Initialize new fields.
3560         (Target_i386::do_plt_address_for_global): New function replacing
3561         do_plt_section_for_global.
3562         (Target_i386::do_plt_address_for_local): New function replacing
3563         do_plt_section_for_local.
3564         (Target_i386::got_section): Create got_irelative_.
3565         (Target_i386::rel_irelative_section): New function.
3566         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3567         fields.  Don't define __rel_iplt_{start,end}.
3568         (Output_data_plt_i386::add_entry): Add symtab and layout
3569         parameters.  Change all callers.  Use different PLT and GOT for
3570         IFUNC symbols.
3571         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3572         layout parameters.  Change all callers.  Use different PLT and
3573         GOT.
3574         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3575         (Output_data_plt_i386::rel_irelative): New function.
3576         (Output_data_plt_i386::address_for_global): New function.
3577         (Output_data_plt_i386::address_for_local): New function.
3578         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3579         IRELATIVE GOT when changing IFUNC GOT entries.
3580         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3581         reloc.
3582         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3583         if we didn't create an IRELATIVE GOT.
3584         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3585         plt_address_for_local.
3586         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3587         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3588         got_irelative_, and irelative_count_ fields.  Update
3589         declarations.
3590         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3591         Initialize new fields.  Remove symtab parameter.  Change all
3592         callers.
3593         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3594         irelative_count_.
3595         (Output_data_plt_x86_64::has_irelative_section): New function.
3596         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3597         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3598         fields.  Update declarations.
3599         (Target_x86_64::Target_x86_64): Initialize new fields.
3600         (Target_x86_64::do_plt_address_for_global): New function replacing
3601         do_plt_section_for_global.
3602         (Target_x86_64::do_plt_address_for_local): New function replacing
3603         do_plt_section_for_local.
3604         (Target_x86_64::got_section): Create got_irelative_.
3605         (Target_x86_64::rela_irelative_section): New function.
3606         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3607         all callers.  Don't create __rel_iplt_{start,end}.
3608         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3609         parameters.  Change all callers.  Use different PLT and GOT for
3610         IFUNC symbols.
3611         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3612         layout parameters.  Change all callers.  Use different PLT and
3613         GOT.
3614         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3615         parameters.  Change all callers.  Use different PLT and GOT for
3616         IFUNC symbols.
3617         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3618         (Output_data_plt_x86_64::rela_irelative): New function.
3619         (Output_data_plt_x86_64::address_for_global): New function.
3620         (Output_data_plt_x86_64::address_for_local): New function.
3621         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3622         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3623         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3624         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3625         parameters.
3626         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3627         reloc.
3628         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3629         symbols if we didn't create an IRELATIVE GOT.
3630         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3631         plt_address_for_local.
3632         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3633         * testsuite/ifuncvar1.c: New test file.
3634         * testsuite/ifuncvar2.c: New test file.
3635         * testsuite/ifuncvar3.c: New test file.
3636         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3637         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3638         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3639         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3640         * testsuite/Makefile.in: Rebuild.
3641
3642 2011-07-07  Cary Coutant  <ccoutant@google.com>
3643
3644         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3645         (two_file_test_1_ndebug.o): Likewise.
3646         (two_file_test_1b_ndebug.o): Likewise.
3647         (two_file_test_2_ndebug.o): Likewise.
3648         (two_file_test_main_ndebug.o): Likewise.
3649         (incremental_test_2): Link with no-debug versions.
3650
3651 2011-07-06  Cary Coutant  <ccoutant@google.com>
3652
3653         * gold/incremental.cc
3654         (Output_section_incremental_inputs::write_info_blocks): Check for
3655         hidden and internal symbols.
3656
3657 2011-07-06  Cary Coutant  <ccoutant@google.com>
3658
3659         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3660         Check disposition for startup file.
3661         (Incremental_inputs::report_command_line): Ignore
3662         --incremental-startup-unchanged option.
3663         * options.cc (General_options::parse_incremental_startup_unchanged):
3664         New function.
3665         (General_options::General_options): Initialize new data member.
3666         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3667         (General_options): Add --incremental-startup-unchanged option.
3668         (General_options::incremental_startup_disposition): New function.
3669         (General_options::incremental_startup_disposition_): New data member.
3670
3671 2011-07-06  Cary Coutant  <ccoutant@google.com>
3672
3673         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3674         input file index to Script_info ctor.
3675         (Sized_incremental_binary::do_file_has_changed): Find the
3676         command-line argument for files named in scripts.
3677         * incremental.h (Script_info::Script_info): New ctor
3678         with input file index.
3679         (Script_info::input_file_index): New function.
3680         (Script_info::input_file_index_): New data member.
3681         (Incremental_binary::get_library): Add const.
3682         (Incremental_binary::get_script_info): Add const.
3683         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3684         * testsuite/Makefile.am (incremental_test_5): New test case.
3685         (incremental_test_6): New test case.
3686         * testsuite/Makefile.in: Regenerate.
3687
3688 2011-07-06  Cary Coutant  <ccoutant@google.com>
3689
3690         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3691         debug output when command lines differ.
3692
3693 2011-07-06  Cary Coutant  <ccoutant@google.com>
3694
3695         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3696         --incremental-patch option.
3697         * layout.cc (Free_list::allocate): Extend allocation beyond original
3698         end if enabled.
3699         (Layout::make_output_section): Mark sections that should get
3700         patch space.
3701         * options.cc (parse_percent): New function.
3702         * options.h (parse_percent): New function.
3703         (DEFINE_percent): New macro.
3704         (General_options): Add --incremental-patch option.
3705         * output.cc (Output_section::Output_section): Initialize new data
3706         members.
3707         (Output_section::add_input_section): Print section name when out
3708         of patch space.
3709         (Output_section::add_output_section_data): Likewise.
3710         (Output_section::set_final_data_size): Add patch space when
3711         doing --incremental-full.
3712         (Output_section::do_reset_address_and_file_offset): Remove patch
3713         space.
3714         (Output_segment::set_section_list_addresses): Print debug output
3715         only if --incremental-update.
3716         * output.h (Output_section::set_is_patch_space_allowed): New function.
3717         (Output_section::is_patch_space_allowed_): New data member.
3718         (Output_section::patch_space_): New data member.
3719         * parameters.cc (Parameters::incremental_full): New function.
3720         * parameters.h (Parameters::incremental_full): New function
3721         * testsuite/Makefile.am (incremental_test_2): Add test for
3722         --incremental-patch option.
3723         * testsuite/Makefile.in: Regenerate.
3724         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3725         (t18): Remove function body.
3726
3727 2011-07-05  Doug Kwan  <dougkwan@google.com>
3728
3729         PR gold/12771
3730         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3731         Arm_Address type for relocation result.
3732         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3733         overflow check.
3734         (Arm_relocate_functions::abs32): Use unaligned access.
3735         (Arm_relocate_functions::rel32): Ditto.
3736         (Arm_relocate_functions::prel31): Ditto.
3737         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3738         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3739         static data relocations.
3740         * testsuite/Makefile.in: Regnerate.
3741         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3742
3743 2011-07-05  Ian Lance Taylor  <iant@google.com>
3744
3745         PR gold/12392
3746         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3747         symbols if necessary.
3748         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3749
3750 2011-07-05  Ian Lance Taylor  <iant@google.com>
3751
3752         PR gold/12952
3753         * resolve.cc (Symbol::override_base_with_special): Simply override
3754         version with special symbol version, ignoring previous version.
3755
3756 2011-07-05  Ian Lance Taylor  <iant@google.com>
3757
3758         * object.cc (Sized_relobj_file::include_section_group): Add
3759         information to comment about signature location.
3760
3761 2011-07-02  Ian Lance Taylor  <iant@google.com>
3762
3763         PR gold/12957
3764         * options.h (class General_options): Add -f and -F.
3765         * options.cc (General_options::finalize): Fatal error if -f/-F
3766         are used without -shared.
3767         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3768
3769 2011-07-02  Ian Lance Taylor  <iant@google.com>
3770
3771         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3772
3773 2011-07-01  Ian Lance Taylor  <iant@google.com>
3774
3775         PR gold/12525
3776         PR gold/12952
3777         * resolve.cc (Symbol::override_base_with_special): Don't override
3778         the version if the overriding symbol has a different name.
3779         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3780         all callers.  If we give an error about an undefined version,
3781         define the base version if necessary.
3782         * dynobj.h (class Versions): Update declaration.
3783         * testsuite/weak_alias_test_5.cc: New file.
3784         * testsuite/weak_alias_test.script: New file.
3785         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3786         and versioned_alias have the right value, and call t2.
3787         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3788         weak_alias_test_5.so.
3789         (weak_alias_test_LDADD): Likewise.
3790         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3791         * testsuite/Makefile.in: Rebuild.
3792
3793 2011-07-01  Ian Lance Taylor  <iant@google.com>
3794
3795         PR gold/12525
3796         * options.h (class General_options): Support -z notext.
3797         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3798         -Wl,-z,notext.
3799         (two_file_shared_nonpic.so): Likewise.
3800         (two_file_shared_mixed.so): Likewise.
3801         (two_file_shared_mixed_1.so): Likewise.
3802         (weak_undef_lib_nonpic.so): Likewise.
3803         (alt/weak_undef_lib_nonpic.so): Likewise.
3804         (tls_test_shared_nonpic.so): Likewise.
3805         * testsuite/Makefile.in: Rebuild.
3806
3807 2011-07-01  Ian Lance Taylor  <iant@google.com>
3808
3809         PR gold/12525
3810         * configure.ac: Test whether static linking works, setting
3811         the automake conditional HAVE_STATIC.
3812         * testsuite/Makefile.am: Disable tests using -static if
3813         HAVE_STATIC is not true.
3814         * configure, testsuite/Makefile.in: Rebuild.
3815
3816 2011-07-01  Ian Lance Taylor  <iant@google.com>
3817
3818         PR gold/12525
3819         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3820         Assert if we see DW_EH_PE_indirect.
3821         * target.h (Target::ehframe_datarel_base): New function.
3822         (Target::do_ehframe_datarel_base): New target function.
3823         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3824         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3825         function.
3826
3827 2011-07-01  Ian Lance Taylor  <iant@google.com>
3828
3829         PR gold/12571
3830         * options.h (class General_options): Add
3831         --ld-generated-unwind-info.
3832         * ehframe.cc (Fde::write): Add address parameter.  Change all
3833         callers.  If associated with PLT, fill in address and size.
3834         (Cie::set_output_offset): Only add merge mapping if there is an
3835         object.
3836         (Cie::write): Add address parameter.  Change all callers.
3837         (Eh_frame::add_ehframe_for_plt): New function.
3838         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3839         input_offset_ fields into union u_, with new plt field.
3840         (Fde::Fde): Adjust for new union field.
3841         (Fde::Fde) [Output_data version]: New constructor.
3842         (Fde::add_mapping): Only add merge mapping if there is an object.
3843         (class Cie): Update declarations.
3844         (class Eh_frame): Declare add_ehframe_for_plt.
3845         * layout.cc (Layout::layout_eh_frame): Break out code into
3846         make_eh_frame_section, and call it.
3847         (Layout::make_eh_frame_section): New function.
3848         (Layout::add_eh_frame_for_plt): New function.
3849         * layout.h (class Layout): Update declarations.
3850         * merge.cc (Merge_map::add_mapping): Add assertion.
3851         * i386.cc: Include "dwarf.h".
3852         (class Output_data_plt_i386): Make first_plt_entry,
3853         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3854         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3855         and plt_eh_frame_fde.
3856         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3857         boundary.  Call add_eh_frame_for_plt if appropriate.
3858         * x86_64.cc: Include "dwarf.h".
3859         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3860         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3861         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3862         and plt_eh_frame_fde.
3863         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3864         appropriate.
3865
3866 2011-06-29  Ian Lance Taylor  <iant@google.com>
3867
3868         PR gold/12629
3869         * object.cc (Sized_relobj_file::layout_section): Change shdr
3870         parameter to be const.
3871         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3872         out of do_layout.
3873         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3874         appropriate.  Call layout_eh_frame_section.
3875         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3876         sections.
3877         * object.h (class Sized_relobj_file): Update declarations.
3878
3879 2011-06-29  Ian Lance Taylor  <iant@google.com>
3880
3881         PR gold/12652
3882         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3883         modifier.
3884         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3885
3886 2011-06-29  Ian Lance Taylor  <iant@google.com>
3887
3888         PR gold/12675
3889         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3890         SHT_X86_64_UNWIND.
3891         * layout.cc (Layout::layout_eh_frame): Likewise.
3892
3893 2011-06-29  Ian Lance Taylor  <iant@google.com>
3894
3895         PR gold/12695
3896         * layout.cc (Layout::symtab_section_shndx): New function.
3897         * layout.h (class Layout): Declare symtab_section_shndx.
3898         * output.cc (Output_section::write_header): Call it.
3899
3900 2011-06-29  Ian Lance Taylor  <iant@google.com>
3901
3902         PR gold/12818
3903         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
3904         symbols which are not used in a relocation.
3905
3906 2011-06-28  Ian Lance Taylor  <iant@google.com>
3907
3908         PR gold/12898
3909         * layout.cc (Layout::segment_precedes): Don't crash if a linker
3910         script create indistinguishable segments.
3911         (Layout::set_segment_offsets): Use stable_sort when sorting
3912         segments.  Pass this to Compare_segments constructor.
3913         * layout.h (class Layout): Make segment_precedes non-static.
3914         (class Compare_segments): Change from struct to class.  Add
3915         layout_ field.  Add constructor.
3916         * script-sections.cc
3917         (Script_sections::attach_sections_using_phdrs_clause): Rename
3918         local orphan to is_orphan.  Don't report failure to put empty
3919         section in segment.  On attachment failure, report name of
3920         section, and attach to first PT_LOAD segment.
3921
3922 2011-06-28  Ian Lance Taylor  <iant@google.com>
3923
3924         PR gold/12934
3925         * target-select.cc (Target_selector::Target_selector): Add
3926         emulation parameter.  Change all callers.
3927         (select_target_by_bfd_name): Rename from select_target_by_name.
3928         Change all callers.
3929         (select_target_by_emulation): New function.
3930         (supported_emulation_names): New function.
3931         * target-select.h (class Target_selector): Add emulation_ field.
3932         Update declarations.
3933         (Target_selector::recognize_by_bfd_name): Rename from
3934         recognize_by_name.  Change all callers.
3935         (Target_selector::supported_bfd_names): Rename from
3936         supported_names.  Change all callers.
3937         (Target_selector::recognize_by_emulation): New function.
3938         (Target_selector::supported_emulations): New function.
3939         (Target_selector::emulation): New function.
3940         (Target_selector::do_recognize_by_bfd_name): Rename from
3941         do_recognize_by_name.  Change all callers.
3942         (Target_selector::do_supported_bfd_names): Rename from
3943         do_supported_names.  Change all callers.
3944         (Target_selector::do_recognize_by_emulation): New function.
3945         (Target_selector::do_supported_emulations): New function.
3946         (select_target_by_bfd_name): Change name in declaration.
3947         (select_target_by_emulation): Declare.
3948         (supported_emulation_names): Declare.
3949         * parameters.cc (parameters_force_valid_target): Try to find
3950         target based on emulation from -m option.
3951         * options.h (class General_options): Change doc string for -m.
3952         * options.cc (help): Print emulations.
3953         (General_options::parse_V): Likewise.
3954         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
3955         Add emulation parameter.  Change all callers.
3956
3957 2011-06-28  Ian Lance Taylor  <iant@google.com>
3958
3959         * target.h (class Target): Add osabi_ field.
3960         (Target::osabi): New function.
3961         (Target::set_osabi): New function.
3962         (Target::Target): Initialize osabi_.
3963         (Target::do_adjust_elf_header): Make pure virtual.
3964         (Sized_target::do_adjust_elf_header): Declare.
3965         * target.cc (Sized_target::do_adjust_elf_header): New function.
3966         (class Sized_target): Instantiate all versions.
3967         * freebsd.h (class Target_freebsd): Remove.
3968         (Target_selector_freebsd::do_recognize): Call set_osabi on
3969         Target.
3970         (Target_selector_freebsd::do_recognize_by_name): Likewise.
3971         (Target_selector_freebsd::set_osabi): Remove.
3972         * i386.cc (class Target_i386): Inherit from Sized_target rather
3973         than Target_freebsd.
3974         * x86_64.cc (class Target_x86_64): Likewise.
3975
3976 2011-06-28  Ian Lance Taylor  <iant@google.com>
3977
3978         * target.h (Target::can_check_for_function_pointers): Rewrite.
3979         Make non-virtual.
3980         (Target::can_icf_inline_merge_sections): Likewise.
3981         (Target::section_may_have_icf_unsafe_poineters): Likewise.
3982         (Target::Target_info): Add can_icf_inline_merge_sections field.
3983         (Target::do_can_check_for_function_pointers): New virtual
3984         function.
3985         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
3986         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
3987         from can_check_for_function_pointers, move in file.
3988         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
3989         section_may_have_icf_unsafe_poineters, move in file.
3990         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
3991         * i386.cc (Target_i386::do_can_check_for_function_pointers):
3992         Rename from can_check_for_function_pointers, move in file.
3993         (Target_i386::can_icf_inline_merge_sections): Remove.
3994         (Target_i386::i386_info): Initialize
3995         can_icf_inline_merge_sections.
3996         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
3997         Initialize can_icf_inline_merge_sections.
3998         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
3999         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4000         Rename from can_check_for_function_pointers, move in file.
4001         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4002         (Target_x86_64::x86_64_info): Initialize
4003         can_icf_inline_merge_sections.
4004         * testsuite/testfile.cc (Target_test::test_target_info):
4005         Likewise.
4006         * icf.cc (get_section_contents): Correct formatting.
4007
4008 2011-06-27  Ian Lance Taylor  <iant@google.com>
4009
4010         * symtab.cc (Symbol::versioned_name): New function.
4011         (Symbol_table::add_to_final_symtab): Use versioned_name when
4012         appropriate.
4013         (Symbol_table::sized_write_symbol): Likewise.
4014         * symtab.h (class Symbol): Declare versioned_name.
4015         * stringpool.h (class Stringpool_template): Add variant of add
4016         which takes a std::basic_string.
4017         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4018         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4019         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4020         (ver_test_12.o): New target.
4021         * testsuite/Makefile.in: Rebuild.
4022
4023 2011-06-27  Doug Kwan  <dougkwan@google.com>
4024
4025         * arm.cc (Arm_relocate_functions::thm_jump8,
4026         Arm_relocate_functions::thm_jump11): Use a wider signed
4027         type to compute offset.
4028         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4029         arm_thm_jump8.
4030         * testsuite/Makefile.in: Regenerate.
4031         * testsuite/arm_branch_in_range.sh: Check test results of
4032         arm_thm_jump11 and arm_thm_jump8.
4033         * testsuite/arm_thm_jump11.s: New test source file.
4034         * testsuite/arm_thm_jump11.t: New linker script.
4035         * testsuite/arm_thm_jump8.s: New test source file.
4036         * testsuite/arm_thm_jump8.t: New linker script.
4037
4038 2011-06-24  Ian Lance Taylor  <iant@google.com>
4039
4040         * layout.cc: Include "object.h".
4041         (ctors_sections_in_init_array): New static variable.
4042         (Layout::is_ctors_in_init_array): New function.
4043         (Layout::layout): Add entry to ctors_sections_in_init_array if
4044         appropriate.
4045         * layout.h (class Layout): Declare is_ctors_in_init_array.
4046         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4047         is_ctors_reverse_view is set.
4048         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4049         all callers.  Set is_ctors_reverse_view field of View_size.
4050         (Sized_relobj_file::reverse_words): New function.
4051         * object.h (Sized_relobj_file::View_size): Add
4052         is_ctors_reverse_view field.
4053         (class Sized_relobj_file): Update declarations.
4054         * testsuite/initpri3.c: New test.
4055         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4056         initpri3b.
4057         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4058         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4059         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4060         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4061         * testsuite/Makefile.in: Rebuild.
4062
4063 2011-06-24  Cary Coutant  <ccoutant@google.com>
4064
4065         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4066         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4067         (debug_msg_cdebug.err): New targets.
4068         * testsuite/Makefile.in: Regenerate.
4069         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4070         Fix checks for link with shared library.
4071
4072 2011-06-24  Doug Kwan  <dougkwan@google.com>
4073
4074         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4075         skip empty text sections.
4076         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4077
4078 2011-06-22  Ian Lance Taylor  <iant@google.com>
4079
4080         PR gold/12910
4081         * options.h (class General_options): Add --ctors-in-init-array.
4082         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4083         friends as SHT_PROGBITS for merging sections.
4084         (Layout::layout): Remove special handling of .init_array and
4085         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4086         and .dtors if ctors_in_init_array.
4087         (Layout::make_output_section): Force correct section types for
4088         .init_array and friends.  Don't sort if doing relocatable link,
4089         Don't sort .ctors and .dtors if ctors_in_init_array.
4090         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4091         (Layout::output_section_name): Add relobj parameter.  Change all
4092         callers.  Handle .ctors. and .dtors. in code rather than table.
4093         Handle .ctors and .dtors if ctors_in_init_array.
4094         (Layout::match_file_name): New function, moved from output.cc.
4095         * layout.h (class Layout): Update declarations.
4096         * output.cc: Include "layout.h".
4097         (Input_section_sort_entry::get_priority): New function.
4098         (Input_section_sort_entry::match_file_name): Just call
4099         Layout::match_file_name.
4100         (Output_section::Input_section_sort_init_fini_compare::operator()):
4101         Handle .ctors and .dtors.  Sort by explicit priority rather than
4102         by name.
4103         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4104         * testsuite/initpri2.c: New test.
4105         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4106         (check_PROGRAMS): Add initpri2.
4107         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4108         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4109         * configure, testsuite/Makefile.in: Rebuild.
4110
4111 2011-06-19  Ian Lance Taylor  <iant@google.com>
4112
4113         PR gold/12880
4114         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4115         .interp section to a PT_INTERP segment even if we have seen a
4116         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4117         clause in a linker script.
4118         (Layout::finalize): Don't create a .interp section if we've
4119         already create a PT_INTERP segment.
4120         (Layout::create_interp): Always call choose_output_section (revert
4121         patch of 2011-06-17).  Don't create PT_INTERP segment.
4122         * script-sections.cc
4123         (Script_sections::create_note_and_tls_segments): Add a .interp
4124         section to a PT_INTERP segment even if we have seen a
4125         --dynamic-linker option.
4126
4127 2011-06-18  Ian Lance Taylor  <iant@google.com>
4128
4129         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4130         merely because a non-PT_LOAD segment has a dynamic reloc.
4131
4132 2011-06-18  Ian Lance Taylor  <iant@google.com>
4133
4134         * layout.cc (Layout::finish_dynamic_section): Don't create
4135         DT_FLAGS entry if not needed.
4136
4137 2011-06-18  Ian Lance Taylor  <iant@google.com>
4138
4139         PR gold/12745
4140         * layout.cc (Layout::layout_eh_frame): Correct handling of
4141         writable .eh_frame section.
4142
4143 2011-06-17  Ian Lance Taylor  <iant@google.com>
4144
4145         PR gold/12893
4146         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4147         symbol is redefined with the exact same object and value.
4148
4149 2011-06-17  Ian Lance Taylor  <iant@google.com>
4150
4151         PR gold/12880
4152         * layout.h (class Layout): Add interp_segment_ field.
4153         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4154         (Layout::attach_allocated_section_to_segment): If making shared
4155         library, put .interp section in PT_INTERP segment.
4156         (Layout::finalize): Also call create_interp if -dynamic-linker
4157         option was used.
4158         (Layout::create_interp): Assert that there is no PT_INTERP
4159         segment.  If not using a SECTIONS clause, use make_output_section.
4160         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4161         * script-sections.cc
4162         (Script_sections::create_note_and_tls_segments): If making shared
4163         library, put .interp section in PT_INTERP segment.
4164
4165 2011-06-17  Ian Lance Taylor  <iant@google.com>
4166
4167         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4168         when making a shared library.
4169
4170 2011-06-17  Ian Lance Taylor  <iant@google.com>
4171
4172         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4173         parameter.  Change all callers.  Don't issue warning about PC32
4174         against locally defined symbol.
4175
4176 2011-06-16  Ian Lance Taylor  <iant@google.com>
4177
4178         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4179         occurs in same object.
4180
4181 2011-06-14  Alan Modra  <amodra@gmail.com>
4182
4183         * po/POTFILES.in: Regenerate.
4184
4185 2011-06-09  Ian Lance Taylor  <iant@google.com>
4186
4187         * script-sections.cc
4188         (Orphan_output_section::set_section_addresses): For a relocatable
4189         link set address to 0.
4190
4191 2011-06-09  Cary Coutant  <ccoutant@google.com>
4192
4193         PR gold/12804
4194         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4195         used with --compress-debug-sections.
4196         * gold/object.cc (Sized_relobj_file::do_layout): Report
4197         uncompressed size of compressed input sections.
4198
4199 2011-06-08  Cary Coutant  <ccoutant@google.com>
4200
4201         PR gold/12804
4202         * testsuite/two_file_test_2_v1.cc: Change initialization of
4203         v2 to keep it in .data.
4204
4205 2011-06-07  Cary Coutant  <ccoutant@google.com>
4206
4207         * common.cc (Symbol_table::do_allocate_commons_list): Call
4208         gold_fallback.
4209         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4210         (Errors::fallback): New function.
4211         (gold_fallback): New function.
4212         * errors.h (Errors::fallback): New function.
4213         * gold.cc (gold_exit): Change status parameter to enum; adjust
4214         all callers.
4215         (queue_initial_tasks): Call gold_fallback.
4216         * gold.h: Include cstdlib.
4217         (Exit_status): New enum type.
4218         (gold_exit): Change status parameter to enum.
4219         (gold_fallback): New function.
4220         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4221         (Layout::create_symtab_sections): Likewise.
4222         (Layout::create_shdrs): Likewise.
4223         * main.cc (main): Adjust call to gold_exit.
4224         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4225         (Output_data_got::add_got_entry_pair): Likewise.
4226         (Output_section::add_input_section): Likewise.
4227         (Output_section::add_output_section_data): Likewise.
4228         (Output_segment::set_section_list_addresses): Likewise.
4229         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4230
4231 2011-06-07  Cary Coutant  <ccoutant@google.com>
4232
4233         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4234         for incremental links.
4235         * output.cc (Output_segment::set_section_list_addresses): Remove
4236         FIXME and test for TLS or BSS.
4237
4238 2011-06-07  Cary Coutant  <ccoutant@google.com>
4239
4240         * testsuite/Makefile.am: Add incremental_copy_test,
4241         incremental_common_test_1.
4242         * testsuite/Makefile.in: Regenerate.
4243         * testsuite/common_test_1_v1.c: New source file.
4244         * testsuite/common_test_1_v2.c: New source file.
4245         * testsuite/copy_test_v1.cc: New source file.
4246
4247 2011-06-07  Cary Coutant  <ccoutant@google.com>
4248
4249         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4250         update, allocate common from bss section's free list.
4251         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4252         linker-defined symbols.
4253         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4254         Skip GOT and PLT entries that are no longer referenced.
4255         (Output_section_incremental_inputs::write_info_blocks): Mark
4256         linker-defined symbols.
4257         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4258         * output.cc (Output_section::allocate): New function.
4259         * output.h (Output_section::allocate): New function.
4260         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4261         linker-defined symbols.
4262         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4263         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4264         (Symbol::init_base_output_data): Likewise.
4265         (Symbol::init_base_output_segment): Likewise.
4266         (Symbol::init_base_constant): Likewise.
4267         (Sized_symbol::init_output_data): Likewise.
4268         (Sized_symbol::init_output_segment): Likewise.
4269         (Sized_symbol::init_constant): Likewise.
4270         (Symbol_table::do_define_in_output_data): Likewise.
4271         (Symbol_table::do_define_in_output_segment): Likewise.
4272         (Symbol_table::do_define_as_constant): Likewise.
4273         * symtab.h (Symbol::is_predefined): New function.
4274         (Symbol::init_base_output_data): Add is_predefined parameter.
4275         (Symbol::init_base_output_segment): Likewise.
4276         (Symbol::init_base_constant): Likewise.
4277         (Symbol::is_predefined_): New data member.
4278         (Sized_symbol::init_output_data): Add is_predefined parameter.
4279         (Sized_symbol::init_output_segment): Likewise.
4280         (Sized_symbol::init_constant): Likewise.
4281         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4282
4283 2011-06-07  Cary Coutant  <ccoutant@google.com>
4284
4285         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4286         instead of emit_copy_reloc.
4287         (Copy_relocs::emit_copy_reloc): Refactor.
4288         (Copy_relocs::make_copy_reloc): New function.
4289         (Copy_relocs::add_copy_reloc): Remove.
4290         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4291         section.
4292         (Copy_relocs::make_copy_reloc): New function.
4293         (Copy_relocs::add_copy_reloc): Remove.
4294         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4295         unchanged input files.
4296         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4297         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4298         Reserve BSS space for COPY relocations.
4299         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4300         (Output_section_incremental_inputs::write_info_blocks): Record
4301         whether a symbol is copied from a shared object.
4302         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4303         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4304         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4305         (Incremental_input_entry_reader::get_output_symbol_index): Add
4306         is_copy parameter.
4307         (Incremental_binary::emit_copy_relocs): New function.
4308         (Incremental_binary::do_emit_copy_relocs): New function.
4309         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4310         new data member.
4311         (Sized_incremental_binary::add_copy_reloc): New function.
4312         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4313         (Sized_incremental_binary::Copy_reloc): New struct.
4314         (Sized_incremental_binary::Copy_relocs): New typedef.
4315         (Sized_incremental_binary::copy_relocs_): New data member.
4316         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4317         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4318         * target.h (Sized_target::emit_copy_reloc): New function.
4319         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4320
4321 2011-06-02  Cary Coutant  <ccoutant@google.com>
4322
4323         PR gold/12163
4324         * gold/archive.cc (Archive::Archive): Initialize new data member.
4325         (Archive::include_all_members): Return if archive has already been
4326         included.
4327         * gold/archive.h (Archive::include_all_members_): New data member.
4328
4329 2011-06-02  Nick Clifton  <nickc@redhat.com>
4330
4331         * dynobj.h: Fix spelling mistake in comment.
4332         * output.cc: Likewise.
4333
4334 2011-05-31  Doug Kwan  <dougkwan@google.com>
4335             Asier Llano
4336
4337         PR gold/12826
4338         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4339         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4340         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4341         redundant arm_exidx_test.so.
4342         * testsuite/Makefile.in: Regenerate.
4343         (check_SCRIPTS): Add pr12826.sh
4344         (check_DATA): Add pr12826.stdout
4345         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4346         * testsuite/pr12826.sh: New file.
4347         * testsuite/pr12826_1.s: Ditto.
4348         * testsuite/pr12826_1.s: Ditto.
4349
4350 2011-05-30  Ian Lance Taylor  <iant@google.com>
4351
4352         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4353         sections.
4354
4355 2011-05-29  Ian Lance Taylor  <iant@google.com>
4356
4357         PR gold/12804
4358         * testsuite/Makefile.am: Use different file name for two_file_test
4359         temporary file for each incremental test.
4360         * testsuite/Makefile.in: Rebuild.
4361
4362 2011-05-29  Ian Lance Taylor  <iant@google.com>
4363
4364         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4365         binary input file is empty.
4366
4367 2011-05-27  Ian Lance Taylor  <iant@google.com>
4368
4369         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4370         (ver_test_9.so): Likewise.
4371         * testsuite/Makefile.in: Rebuild.
4372
4373 2011-05-26 Cary Coutant  <ccoutant@google.com>
4374
4375         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4376         * incremental.cc (Incremental_inputs::report_input_section): Fix
4377         comment, indentation.
4378         (Incremental_inputs::report_comdat_group): New function.
4379         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4380         of data for incremental input file entry.
4381         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4382         group count, COMDAT group signatures.
4383         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4384         an unchanged input file.
4385         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4386         Initialize new data member.
4387         (Incremental_object_entry::add_comdat_group): New function.
4388         (Incremental_object_entry::get_comdat_group_count): New function.
4389         (Incremental_object_entry::get_comdat_signature_key): New function.
4390         (Incremental_object_entry::groups_): New data member.
4391         (Incremental_inputs::report_comdat_group): New function.
4392         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4393         data for incremental input file entry.
4394         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4395         (Incremental_input_entry_reader::get_input_section): Adjust size of
4396         data for incremental input file entry.
4397         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4398         (Incremental_input_entry_reader::get_comdat_group_signature): New
4399         function.
4400         * object.cc (Sized_relobj::include_section_group): Report kept
4401         COMDAT groups for incremental links.
4402
4403 2011-05-24  David Meyer  <pdox@google.com>
4404
4405         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4406         with name parameter.  Add found_name parameter.
4407         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4408         * dirsearch.h (class Dirsearch): Update declaration.
4409
4410 2011-05-24  Ian Lance Taylor  <iant@google.com>
4411
4412         * archive.cc (Library_base::should_include_member): Pull in object
4413         from archive if it defines the entry symbol.
4414         * parameters.cc (Parameters::entry): New function.
4415         * parameters.h (class Parameters): Declare entry.
4416         * output.h (class Output_file_header): Remove entry_ field.
4417         * output.cc (Output_file_header::Output_file_header): Remove entry
4418         parameter.  Change all callers.
4419         (Output_file_header::entry): Use parameters->entry.
4420         * gold.cc (queue_middle_tasks): Likewise.
4421         * plugin.cc (Plugin_hook::run): Likewise.
4422
4423 2011-05-24 Cary Coutant  <ccoutant@google.com>
4424
4425         * gold.cc (queue_initial_tasks): Pass incremental base filename
4426         to Output_file::open_base_file; don't print error message.
4427         * incremental-dump.cc (main): Adjust call to
4428         Output_file::open_for_modification.
4429         * incremental-dump.cc (main): Likewise.
4430         * incremental.cc (Incremental_inputs::report_command_line):
4431         Ignore --incremental-base option when comparing command lines.
4432         Ignore parameter when given as separate argument.
4433         * options.h (class General_options): Add --incremental-base.
4434         * output.cc (Output_file::Output_file):
4435         (Output_file::open_base_file): Add base_name and writable parameters;
4436         read base file into new file; print error message here.
4437         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4438         callers.
4439         * output.h (Output_file::open_for_modification): Rename to...
4440         (Output_file::open_base_file): ...this; add base_name and
4441         writable parameters; adjust all callers.
4442         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4443         callers.
4444         * testsuite/Makefile.am (incremental_test_4): Test
4445         --incremental-base.
4446         * testsuite/Makefile.in: Regenerate.
4447
4448 2011-05-24 Cary Coutant  <ccoutant@google.com>
4449
4450         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4451         incremental_test_4.
4452         * testsuite/Makefile.in: Regenerate.
4453         * testsuite/two_file_test_1_v1.cc: New test source file.
4454         * testsuite/two_file_test_1b_v1.cc: New test source file.
4455         * testsuite/two_file_test_2_v1.cc: New test source file.
4456
4457 2011-05-24 Cary Coutant  <ccoutant@google.com>
4458
4459         * dynobj.h (Dynobj::do_dynobj): New function.
4460         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4461         flag and soname for shared objects.
4462         * incremental.cc (Incremental_inputs::report_object): Make
4463         either Incremental_object_entry or Incremental_dynobj_entry; add
4464         soname to string table.
4465         (Incremental_inputs::report_input_section): Add assertion.
4466         (Output_section_incremental_inputs::set_final_data_size): Adjust
4467         type of input file entry for shared libraries; adjust size of
4468         shared library info entry.
4469         (Output_section_incremental_inputs::write_input_files): Write
4470         as_needed flag for shared libraries.
4471         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4472         of input file entry for shared libraries; write soname.
4473         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4474         soname from incremental info.
4475         * incremental.h (enum Incremental_input_flags): Add
4476         INCREMENTAL_INPUT_AS_NEEDED.
4477         (Incremental_input_entry::Incremental_input_entry): Initialize new
4478         data member.
4479         (Incremental_input_entry::set_as_needed): New function.
4480         (Incremental_input_entry::as_needed): New function.
4481         (Incremental_input_entry::do_dynobj_entry): New function.
4482         (Incremental_input_entry::as_needed_): New data member.
4483         (Incremental_object_entry::Incremental_object_entry): Don't check
4484         for shared library.
4485         (Incremental_object_entry::do_type): Likewise.
4486         (class Incremental_dynobj_entry): New class.
4487         (Incremental_input_entry_reader::as_needed): New function.
4488         (Incremental_input_entry_reader::get_soname): New function.
4489         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4490         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4491         size of shared library info entry.
4492         * layout.cc (Layout::finish_dynamic_section): Don't test for
4493         incremental link when adding DT_NEEDED entries.
4494         * object.h (Object::Object): Initialize new data member.
4495         (Object::dynobj): New function.
4496         (Object::set_as_needed): New function.
4497         (Object::as_needed): New function.
4498         (Object::do_dynobj): New function.
4499         (Object::as_needed_): New data member.
4500
4501 2011-05-24 Cary Coutant  <ccoutant@google.com>
4502
4503         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4504         info; adjust display of GOT entries.
4505         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4506         vector of input objects; remove file_status_.
4507         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4508         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4509         got_plt reader; call target hooks to reserve GOT entries.
4510         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4511         of input file info header and GOT info entry.
4512         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4513         relocation info.
4514         (Got_plt_view_info::got_descriptor): Remove.
4515         (Got_plt_view_info::sym_index): New data member.
4516         (Got_plt_view_info::input_index): New data member.
4517         (Local_got_offset_visitor::visit): Write input file index.
4518         (Global_got_offset_visitor::visit): Write 0 for input file index.
4519         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4520         with sym_index and input_index.
4521         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4522         incremental info GOT entry; replace got_descriptor with input_index.
4523         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4524         map from input file index to object.
4525         (Sized_relobj_incr::do_layout): Replace direct data member reference
4526         with accessor function.
4527         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4528         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4529         Adjust size of input file info header.
4530         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4531         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4532         (Incremental_input_entry_reader::get_input_section): Adjust size of
4533         input file info header.
4534         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4535         of incremental info GOT entry.
4536         (Incremental_got_plt_reader::get_got_desc): Remove.
4537         (Incremental_got_plt_reader::get_got_symndx): New function.
4538         (Incremental_got_plt_reader::get_got_input_index): New function.
4539         (Sized_incremental_binary::Sized_incremental_binary): Remove
4540         file_status_; add input_objects_.
4541         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4542         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4543         (Sized_incremental_binary::file_is_unchanged): Remove.
4544         (Sized_incremental_binary::set_input_object): New function.
4545         (Sized_incremental_binary::input_object): New function.
4546         (Sized_incremental_binary::file_status_): Remove.
4547         (Sized_incremental_binary::input_objects_): New data member.
4548         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4549         references.
4550         (Sized_relobj_incr::invalid_address): Move to base class.
4551         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4552         class.
4553         (Sized_relobj_incr::do_output_section_offset): Likewise.
4554         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4555         (Sized_relobj_incr::section_offsets_): Likewise.
4556         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4557         function.
4558         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4559         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4560         with accessor function.
4561         (Sized_relobj_file::do_layout): Likewise.
4562         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4563         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4564         (Sized_relobj_file::compute_final_local_value): Replace refs to
4565         section_offsets_ with accessor function.
4566         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4567         * object.h (Relobj::Relobj): Initialize new data members.
4568         (Relobj::add_dyn_reloc): New function.
4569         (Relobj::first_dyn_reloc): New function.
4570         (Relobj::dyn_reloc_count): New function.
4571         (Relobj::first_dyn_reloc_): New data member.
4572         (Relobj::dyn_reloc_count_): New data member.
4573         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4574         references.
4575         (Sized_relobj::Address): New typedef.
4576         (Sized_relobj::invalid_address): Move here from child class.
4577         (Sized_relobj::Sized_relobj): Initialize new data members.
4578         (Sized_relobj::sized_relobj): New function.
4579         (Sized_relobj::is_output_section_offset_invalid): Move here from
4580         child class.
4581         (Sized_relobj::get_output_section_offset): Likewise.
4582         (Sized_relobj::local_has_got_offset): Likewise.
4583         (Sized_relobj::local_got_offset): Likewise.
4584         (Sized_relobj::set_local_got_offset): Likewise.
4585         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4586         (Sized_relobj::clear_got_offsets): New function.
4587         (Sized_relobj::section_offsets): Move here from child class.
4588         (Sized_relobj::do_output_section_offset): Likewise.
4589         (Sized_relobj::do_set_section_offset): Likewise.
4590         (Sized_relobj::Local_got_offsets): Likewise.
4591         (Sized_relobj::local_got_offsets_): Likewise.
4592         (Sized_relobj::section_offsets_): Likewise.
4593         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4594         references.
4595         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4596         class.
4597         (Sized_relobj_file::sized_relobj): New function
4598         (Sized_relobj_file::local_has_got_offset): Move to base class.
4599         (Sized_relobj_file::local_got_offset): Likewise.
4600         (Sized_relobj_file::set_local_got_offset): Likewise.
4601         (Sized_relobj_file::get_output_section_offset): Likewise.
4602         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4603         (Sized_relobj_file::do_output_section_offset): Likewise.
4604         (Sized_relobj_file::do_set_section_offset): Likewise.
4605         (Sized_relobj_file::Local_got_offsets): Likewise.
4606         (Sized_relobj_file::local_got_offsets_): Likewise.
4607         (Sized_relobj_file::section_offsets_): Likewise.
4608         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4609         (all constructors).
4610         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4611         (Output_reloc::get_symbol_index): Likewise.
4612         (Output_reloc::local_section_offset): Likewise.
4613         (Output_reloc::get_address): Likewise.
4614         (Output_reloc::symbol_value): Likewise.
4615         (Output_data_got::reserve_slot): Move to class definition.
4616         (Output_data_got::reserve_local): New function.
4617         (Output_data_got::reserve_slot_for_global): Remove.
4618         (Output_data_got::reserve_global): New function.
4619         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4620         (all constructors, two instantiations).
4621         (Output_reloc::get_relobj): New function (two instantiations).
4622         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4623         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4624         (Output_data_reloc::add_global): Adjust type of relobj.
4625         (Output_data_reloc::add_global_relative): Likewise.
4626         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4627         (Output_data_reloc::add_local): Likewise.
4628         (Output_data_reloc::add_local_relative): Likewise.
4629         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4630         (Output_data_reloc::add_local_section): Likewise.
4631         (Output_data_reloc::add_output_section): Likewise.
4632         (Output_data_reloc::add_absolute): Likewise.
4633         (Output_data_reloc::add_target_specific): Likewise.
4634         (Output_data_got::reserve_slot): Move definition here.
4635         (Output_data_got::reserve_local): New function.
4636         (Output_data_got::reserve_global): New function.
4637         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4638         section_offsets_ with accessor function.
4639         (Sized_relobj_file::write_sections): Likewise.
4640         (Sized_relobj_file::do_relocate_sections): Likewise.
4641         * target.h (Sized_target::reserve_local_got_entry): New function.
4642         (Sized_target::reserve_global_got_entry): New function.
4643         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4644         (Target_x86_64::reserve_global_got_entry): New function.
4645         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4646
4647 2011-05-23 Cary Coutant  <ccoutant@google.com>
4648
4649         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4650         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4651         bit when checking got_type.
4652         * incremental.cc (Sized_incremental_binary::setup_readers):
4653         Store symbol table and string table locations; initialize bit vector
4654         of file status flags.
4655         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4656         unchanged files.
4657         (Sized_incremental_binary::do_process_got_plt): New function.
4658         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4659         (Output_section_incremental_inputs::set_final_data_size): Record
4660         file index for each input file.
4661         (Output_section_incremental_inputs::write_got_plt): Store file index
4662         instead of input entry offset for each GOT entry.
4663         * incremental.h
4664         (Incremental_input_entry::Incremental_input_entry): Initialize new
4665         data member.
4666         (Incremental_input_entry::set_offset): Store file index.
4667         (Incremental_input_entry::get_file_index): New function.
4668         (Incremental_input_entry::file_index_): New data member.
4669         (Incremental_binary::process_got_plt): New function.
4670         (Incremental_binary::do_process_got_plt): New function.
4671         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4672         data members.
4673         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4674         (Sized_incremental_binary::set_file_is_unchanged): New function.
4675         (Sized_incremental_binary::file_is_unchanged): New function.
4676         (Sized_incremental_binary::do_process_got_plt): New function.
4677         (Sized_incremental_binary::file_status_): New data member.
4678         (Sized_incremental_binary::main_symtab_loc_): New data member.
4679         (Sized_incremental_binary::main_strtab_loc_): New data member.
4680         * output.cc (Output_data_got::Got_entry::write): Add case
4681         RESERVED_CODE.
4682         (Output_data_got::add_global): Call add_got_entry.
4683         (Output_data_got::add_global_plt): Likewise.
4684         (Output_data_got::add_global_with_rel): Likewise.
4685         (Output_data_got::add_global_with_rela): Likewise.
4686         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4687         (Output_data_got::add_global_pair_with_rela): Likewise.
4688         (Output_data_got::add_local): Call add_got_entry.
4689         (Output_data_got::add_local_plt): Likewise.
4690         (Output_data_got::add_local_with_rel): Likewise.
4691         (Output_data_got::add_local_with_rela): Likewise.
4692         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4693         (Output_data_got::add_local_pair_with_rela): Likewise.
4694         (Output_data_got::reserve_slot): New function.
4695         (Output_data_got::reserve_slot_for_global): New function.
4696         (Output_data_got::add_got_entry): New function.
4697         (Output_data_got::add_got_entry_pair): New function.
4698         (Output_section::add_output_section_data): Edit FIXME.
4699         * output.h
4700         (Output_section_data_build::Output_section_data_build): New
4701         constructor with size parameter.
4702         (Output_data_space::Output_data_space): Likewise.
4703         (Output_data_got::Output_data_got): Initialize new data member; new
4704         constructor with size parameter.
4705         (Output_data_got::add_constant): Call add_got_entry.
4706         (Output_data_got::reserve_slot): New function.
4707         (Output_data_got::reserve_slot_for_global): New function.
4708         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4709         (Output_data_got::add_got_entry): New function.
4710         (Output_data_got::add_got_entry_pair): New function.
4711         (Output_data_got::free_list_): New data member.
4712         * target.h (Sized_target::init_got_plt_for_update): New function.
4713         (Sized_target::register_global_plt_entry): New function.
4714         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4715         Initialize new data member; call init; add constructor with PLT count.
4716         (Output_data_plt_x86_64::init): New function.
4717         (Output_data_plt_x86_64::add_relocation): New function.
4718         (Output_data_plt_x86_64::reserve_slot): New function.
4719         (Output_data_plt_x86_64::free_list_): New data member.
4720         (Target_x86_64::init_got_plt_for_update): New function.
4721         (Target_x86_64::register_global_plt_entry): New function.
4722         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4723         incremental updates.
4724         (Output_data_plt_x86_64::add_relocation): New function.
4725         * testsuite/object_unittest.cc (Object_test): Set default options.
4726
4727 2011-05-16  Ian Lance Taylor  <iant@google.com>
4728
4729         * options.h (class General_options): Make -i a synonym for -r.
4730
4731 2011-05-16  Ian Lance Taylor  <iant@google.com>
4732
4733         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4734
4735 2011-05-10 Cary Coutant  <ccoutant@google.com>
4736
4737         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4738         strip_all (-s).
4739
4740 2011-05-06  Ian Lance Taylor  <iant@google.com>
4741
4742         * layout.cc (Layout::layout): If the output section flags change,
4743         update the ordering.
4744
4745 2011-04-25 Cary Coutant  <ccoutant@google.com>
4746
4747         * incremental-dump.cc (dump_incremental_inputs): Print local
4748         symbol info for each input file.
4749         * incremental.cc
4750         (Output_section_incremental_inputs::set_final_data_size): Add local
4751         symbol info to input file entries in incremental info.
4752         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4753         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4754         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4755         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4756         implementation.
4757         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4758         (Sized_incr_relobj::do_relocate): Write the local symbols.
4759         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4760         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4761         Adjust size of input file header.
4762         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4763         (Incremental_inputs_reader::get_local_symbol_count): New function.
4764         (Incremental_inputs_reader::get_input_section): Adjust size of input
4765         file header.
4766         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4767         (Sized_incr_relobj::This): New typedef.
4768         (Sized_incr_relobj::sym_size): New const data member.
4769         (Sized_incr_relobj::Local_symbol): New struct.
4770         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4771         (Sized_incr_relobj::do_local_symbol_offset): New function.
4772         (Sized_incr_relobj::local_symbol_count_): New data member.
4773         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4774         (Sized_incr_relobj::local_symbol_index_): New data member.
4775         (Sized_incr_relobj::local_symbol_offset_): New data member.
4776         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4777         (Sized_incr_relobj::local_symbols_): New data member.
4778         * object.h (Relobj::output_local_symbol_count): New function.
4779         (Relobj::local_symbol_offset): New function.
4780         (Relobj::do_output_local_symbol_count): New function.
4781         (Relobj::do_local_symbol_offset): New function.
4782         (Sized_relobj::do_output_local_symbol_count): New function.
4783         (Sized_relobj::do_local_symbol_offset): New function.
4784
4785 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4786
4787         * descriptors.cc (set_close_on_exec): New function.
4788         (Descriptors::open): Use set_close_on_exec.
4789         * output.cc (S_ISLNK): Define if not defined.
4790
4791 2011-04-22 Cary Coutant  <ccoutant@google.com>
4792
4793         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4794         global symbol map.
4795         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4796         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4797         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4798         relocations.
4799         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4800         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4801         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4802         * incremental.h
4803         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4804         function.
4805         (Incremental_binary::apply_incremental_relocs): New function.
4806         (Incremental_binary::do_apply_incremental_relocs): New function.
4807         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4808         data member.
4809         (Sized_incremental_binary::add_global_symbol): New function.
4810         (Sized_incremental_binary::global_symbol): New function.
4811         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4812         (Sized_incremental_binary::symbol_map_): New data member.
4813         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4814         * target.h (Sized_target::apply_relocation): New function.
4815         * target-reloc.h (apply_relocation): New function.
4816         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4817
4818 2011-04-22  Doug Kwan  <dougkwan@google.com>
4819
4820         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4821         flag of a SHT_ARM_EXIDX section.
4822         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4823         * testsuite/Makefile.in: Regenerate.
4824         * testsuite/arm_exidx_test.s: New file.
4825         * testsuite/arm_exidx_test.sh: Same.
4826
4827 2011-04-20 Cary Coutant  <ccoutant@google.com>
4828
4829         PR gold/12689
4830         * archive.h (Incremental_archive_entry::Archive_member):
4831         Initialize arg_serial_ (second constructor).
4832
4833 2011-04-17  Ian Lance Taylor  <iant@google.com>
4834
4835         * object.cc (Relocate_info::location): Simplify location string.
4836         * errors.cc (Errors::error_at_location): Don't print program
4837         name.
4838         (Errors::warning_at_location): Likewise.
4839         (Errors::undefined_symbol): Likewise.
4840         * testsuite/debug_msg.sh: Update accordingly.
4841
4842 2011-04-14 Cary Coutant  <ccoutant@google.com>
4843
4844         * gold/layout.cc (Layout::symtab_section_offset): New function.
4845         * gold/layout.h (Layout::symtab_section_offset): New function.
4846         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4847
4848 2011-04-12  Ian Lance Taylor  <iant@google.com>
4849
4850         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4851         with MREMAP_MAYMOVE.
4852         * output.h (class Output_file): Add map_is_allocated_ field.
4853         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4854         not available, provide stubs.  If mremap is not available, #define
4855         it to gold_mremap.
4856         (MREMAP_MAYMOVE): Define if not defined.
4857         (Output_file::Output_file): Initialize map_is_allocated_.
4858         (Output_file::resize): Check map_is_allocated_.
4859         (Output_file::map_anonymous): If mmap fails, use malloc.
4860         (Output_file::unmap): Don't do anything for an anonymous map.
4861         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4862         is not available, provide stubs.
4863         (File_read::View::~View): Use free rather than delete[].
4864         (File_read::make_view): Use malloc rather than new[].  If mmap
4865         fails, use malloc.
4866         (File_read::find_or_make_view): Use malloc rather than new[].
4867         * gold.h: Remove HAVE_REMAP code.
4868         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4869         exists.  Rename mremap to gold_mremap.  If mmap is not available
4870         don't do anything.
4871         * configure, config.in: Rebuild.
4872
4873 2011-04-11  Ian Lance Taylor  <iant@google.com>
4874
4875         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4876         initialize local variable v.
4877
4878 2011-04-11  Cary Coutant  <ccoutant@google.com>
4879
4880         * archive.cc (Archive::include_member): Adjust call to
4881         report_object.
4882         (Add_archive_symbols::run): Track argument serial numbers.
4883         (Lib_group::include_member): Likewise.
4884         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4885         * archive.h (Incremental_archive_entry::Archive_member):
4886         Initialize arg_serial_.
4887         (Archive_member::arg_serial_): New data member.
4888         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4889         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4890         incremental link.
4891         (Sized_dynobj::do_for_all_local_got_entries): New function.
4892         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4893         function.
4894         * fileread.cc (get_mtime): New function.
4895         * fileread.h (get_mtime): New function.
4896         * gold.cc (queue_initial_tasks): Check for incremental update.
4897         (process_incremental_input): New function.
4898         (queue_middle_tasks): Don't force valid target for incremental
4899         update.
4900         * incremental-dump.cc (find_input_containing_global): Adjust
4901         size of symbol info entry.
4902         (dump_incremental_inputs): Dump argument serial number and
4903         in_system_directory flag; bias shndx by 1; print symbol names
4904         when dumping per-file symbol lists; use new symbol info readers.
4905         * incremental.cc
4906         (Output_section_incremental_inputs:update_data_size): New function.
4907         (Sized_incremental_binary::setup_readers): Setup input readers
4908         for each input file; build maps for files added from libraries
4909         and scripts.
4910         (Sized_incremental_binary::check_input_args): New function.
4911         (Sized_incremental_binary::do_check_inputs): Build map of argument
4912         serial numbers to input arguments.
4913         (Sized_incremental_binary::do_file_has_changed): Rename
4914         do_file_is_unchanged to this; compare file modification times.
4915         (Sized_incremental_binary::do_init_layout): New function.
4916         (Sized_incremental_binary::do_reserve_layout): New function.
4917         (Sized_incremental_binary::do_get_input_reader): Remove.
4918         (Sized_incremental_binary::get_symtab_view): New function.
4919         (Incremental_checker::can_incrementally_link_output_file): Remove.
4920         (Incremental_inputs::report_command_line): Exclude --debug options.
4921         (Incremental_inputs::report_archive_begin): Add parameter; track
4922         argument serial numbers; don't put input file entry for archive
4923         before archive members.
4924         (Incremental_inputs::report_archive_end): Put input file entry
4925         for archive after archive members.
4926         (Incremental_inputs::report_object): Add parameter; track argument
4927         serial numbers and in_system_directory flag.
4928         (Incremental_inputs::report_script): Add parameter; track argument
4929         serial numbers.
4930         (Output_section_incremental_inputs::set_final_data_size): Adjust
4931         size of symbol info entry; check for forwarding symbols.
4932         (Output_section_incremental_inputs::write_input_files): Write
4933         in_system_directory flag and argument serial number.
4934         (Output_section_incremental_inputs::write_info_blocks): Map section
4935         indices between incremental info and original input file; store
4936         input section index for each symbol.
4937         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
4938         change operator() to visit().
4939         (class Global_got_offset_visitor): Likewise.
4940         (class Global_symbol_visitor_got_plt):
4941         (Output_section_incremental_inputs::write_got_plt): Use new visitor
4942         classes.
4943         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
4944         (Sized_incr_relobj::do_read_symbols): New function.
4945         (Sized_incr_relobj::do_layout): New function.
4946         (Sized_incr_relobj::do_layout_deferred_sections): New function.
4947         (Sized_incr_relobj::do_add_symbols): New function.
4948         (Sized_incr_relobj::do_should_include_member): New function.
4949         (Sized_incr_relobj::do_for_all_global_symbols): New function.
4950         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
4951         (Sized_incr_relobj::do_section_size): New function.
4952         (Sized_incr_relobj::do_section_name): New function.
4953         (Sized_incr_relobj::do_section_contents): New function.
4954         (Sized_incr_relobj::do_section_flags): New function.
4955         (Sized_incr_relobj::do_section_entsize): New function.
4956         (Sized_incr_relobj::do_section_address): New function.
4957         (Sized_incr_relobj::do_section_type): New function.
4958         (Sized_incr_relobj::do_section_link): New function.
4959         (Sized_incr_relobj::do_section_info): New function.
4960         (Sized_incr_relobj::do_section_addralign): New function.
4961         (Sized_incr_relobj::do_initialize_xindex): New function.
4962         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
4963         (Sized_incr_relobj::do_read_relocs): New function.
4964         (Sized_incr_relobj::do_gc_process_relocs): New function.
4965         (Sized_incr_relobj::do_scan_relocs): New function.
4966         (Sized_incr_relobj::do_count_local_symbols): New function.
4967         (Sized_incr_relobj::do_finalize_local_symbols): New function.
4968         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
4969         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
4970         (Sized_incr_relobj::do_relocate): New function.
4971         (Sized_incr_relobj::do_set_section_offset): New function.
4972         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
4973         (Sized_incr_dynobj::do_read_symbols): New function.
4974         (Sized_incr_dynobj::do_layout): New function.
4975         (Sized_incr_dynobj::do_add_symbols): New function.
4976         (Sized_incr_dynobj::do_should_include_member): New function.
4977         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
4978         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
4979         (Sized_incr_dynobj::do_section_size): New function.
4980         (Sized_incr_dynobj::do_section_name): New function.
4981         (Sized_incr_dynobj::do_section_contents): New function.
4982         (Sized_incr_dynobj::do_section_flags): New function.
4983         (Sized_incr_dynobj::do_section_entsize): New function.
4984         (Sized_incr_dynobj::do_section_address): New function.
4985         (Sized_incr_dynobj::do_section_type): New function.
4986         (Sized_incr_dynobj::do_section_link): New function.
4987         (Sized_incr_dynobj::do_section_info): New function.
4988         (Sized_incr_dynobj::do_section_addralign): New function.
4989         (Sized_incr_dynobj::do_initialize_xindex): New function.
4990         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
4991         (make_sized_incremental_object): New function.
4992         (Incremental_library::copy_unused_symbols): New function.
4993         (Incremental_library::do_for_all_unused_symbols): New function.
4994         * incremental.h (enum Incremental_input_flags): New type.
4995         (class Incremental_checker): Remove.
4996         (Incremental_input_entry::Incremental_input_entry): Add argument
4997         serial number.
4998         (Incremental_input_entry::arg_serial): New function.
4999         (Incremental_input_entry::set_is_in_system_directory): New function.
5000         (Incremental_input_entry::is_in_system_directory): New function.
5001         (Incremental_input_entry::arg_serial_): New data member.
5002         (Incremental_input_entry::is_in_system_directory_): New data member.
5003         (class Script_info): Move here from script.h.
5004         (Script_info::Script_info): Add filename parameter.
5005         (Script_info::filename): New function.
5006         (Script_info::filename_): New data member.
5007         (Incremental_script_entry::Incremental_script_entry): Add argument
5008         serial number.
5009         (Incremental_object_entry::Incremental_object_entry): Likewise.
5010         (Incremental_object_entry::add_input_section): Build list of input
5011         sections with map to original shndx.
5012         (Incremental_object_entry::get_input_section_index): New function.
5013         (Incremental_object_entry::shndx_): New data member.
5014         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5015         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5016         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5017         serial number.
5018         (Incremental_inputs::report_archive_begin): Likewise.
5019         (Incremental_inputs::report_object): Likewise.
5020         (Incremental_inputs::report_script): Likewise.
5021         (class Incremental_global_symbol_reader): New class.
5022         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5023         and store flags and input file type.
5024         (Incremental_input_entry_reader::arg_serial): New function.
5025         (Incremental_input_entry_reader::type): Extract type from flags.
5026         (Incremental_input_entry_reader::is_in_system_directory): New function.
5027         (Incremental_input_entry_reader::get_input_section_count): Call
5028         accessor function for type.
5029         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5030         function for type; adjust size of global symbol entry.
5031         (Incremental_input_entry_reader::get_global_symbol_count): Call
5032         accessor function for type.
5033         (Incremental_input_entry_reader::get_object_count): Likewise.
5034         (Incremental_input_entry_reader::get_object_offset): Likewise.
5035         (Incremental_input_entry_reader::get_member_count): Likewise.
5036         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5037         (Incremental_input_entry_reader::get_member_offset): Likewise.
5038         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5039         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5040         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5041         (Incremental_input_entry_reader::get_global_symbol_reader): New
5042         function.
5043         (Incremental_input_entry_reader::get_output_symbol_index): New
5044         function.
5045         (Incremental_input_entry_reader::type_): Remove.
5046         (Incremental_input_entry_reader::flags_): New data member.
5047         (Incremental_inputs_reader::input_file_offset): New function.
5048         (Incremental_inputs_reader::input_file_index): New function.
5049         (Incremental_inputs_reader::input_file): Call input_file_offset.
5050         (Incremental_inputs_reader::input_file_at_offset): New function.
5051         (Incremental_relocs_reader::get_r_type): Reformat.
5052         (Incremental_relocs_reader::get_r_shndx): Reformat.
5053         (Incremental_relocs_reader::get_r_offset): Reformat.
5054         (Incremental_relocs_reader::data): New function.
5055         (Incremental_binary::Incremental_binary): Initialize new data members.
5056         (Incremental_binary::check_inputs): Add cmdline parameter.
5057         (Incremental_binary::file_is_unchanged): Remove.
5058         (Input_reader::arg_serial): New function.
5059         (Input_reader::get_unused_symbol_count): New function.
5060         (Input_reader::get_unused_symbol): New function.
5061         (Input_reader::do_arg_serial): New function.
5062         (Input_reader::do_get_unused_symbol_count): New function.
5063         (Input_reader::do_get_unused_symbol): New function.
5064         (Incremental_binary::input_file_count): New function.
5065         (Incremental_binary::get_input_reader): Change signature to use
5066         index instead of filename.
5067         (Incremental_binary::file_has_changed): New function.
5068         (Incremental_binary::get_input_argument): New function.
5069         (Incremental_binary::get_library): New function.
5070         (Incremental_binary::get_script_info): New function.
5071         (Incremental_binary::init_layout): New function.
5072         (Incremental_binary::reserve_layout): New function.
5073         (Incremental_binary::output_file): New function.
5074         (Incremental_binary::do_check_inputs): New function.
5075         (Incremental_binary::do_file_is_unchanged): Remove.
5076         (Incremental_binary::do_file_has_changed): New function.
5077         (Incremental_binary::do_init_layout): New function.
5078         (Incremental_binary::do_reserve_layout): New function.
5079         (Incremental_binary::do_input_file_count): New function.
5080         (Incremental_binary::do_get_input_reader): Change signature.
5081         (Incremental_binary::input_args_map_): New data member.
5082         (Incremental_binary::library_map_): New data member.
5083         (Incremental_binary::script_map_): New data member.
5084         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5085         new data members.
5086         (Sized_incremental_binary::output_section): New function.
5087         (Sized_incremental_binary::inputs_reader): Add const.
5088         (Sized_incremental_binary::symtab_reader): Add const.
5089         (Sized_incremental_binary::relocs_reader): Add const.
5090         (Sized_incremental_binary::got_plt_reader): Add const.
5091         (Sized_incremental_binary::get_symtab_view): New function.
5092         (Sized_incremental_binary::Inputs_reader): New typedef.
5093         (Sized_incremental_binary::Input_entry_reader): New typedef.
5094         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5095         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5096         (Sized_incremental_binary::do_file_has_changed): New function.
5097         (Sized_incremental_binary::do_init_layout): New function.
5098         (Sized_incremental_binary::do_reserve_layout): New function.
5099         (Sized_input_reader::Inputs_reader): Remove.
5100         (Sized_input_reader::Input_entry_reader): Remove.
5101         (Sized_input_reader::do_arg_serial): New function.
5102         (Sized_input_reader::do_get_unused_symbol_count): New function.
5103         (Sized_input_reader::do_get_unused_symbol): New function.
5104         (Sized_incremental_binary::do_input_file_count): New function.
5105         (Sized_incremental_binary::do_get_input_reader): Change signature;
5106         use index instead of filename.
5107         (Sized_incremental_binary::section_map_): New data member.
5108         (Sized_incremental_binary::input_entry_readers_): New data member.
5109         (class Sized_incr_relobj): New class.
5110         (class Sized_incr_dynobj): New class.
5111         (make_sized_incremental_object): New function.
5112         (class Incremental_library): New class.
5113         * layout.cc (Free_list::num_lists): New static data member.
5114         (Free_list::num_nodes): New static data member.
5115         (Free_list::num_removes): New static data member.
5116         (Free_list::num_remove_visits): New static data member.
5117         (Free_list::num_allocates): New static data member.
5118         (Free_list::num_allocate_visits): New static data member.
5119         (Free_list::init): New function.
5120         (Free_list::remove): New function.
5121         (Free_list::allocate): New function.
5122         (Free_list::dump): New function.
5123         (Free_list::print_stats): New function.
5124         (Layout_task_runner::run): Resize output file for incremental updates.
5125         (Layout::Layout): Initialize new data members.
5126         (Layout::set_incremental_base): New function.
5127         (Layout::init_fixed_output_section): New function.
5128         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5129         incremental updates.
5130         (Layout::create_gold_note): Do not create gold note section for
5131         incremental updates.
5132         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5133         for incremental updates.
5134         (Layout::set_section_offsets): For incremental updates, allocate space
5135         from free list.
5136         (Layout::create_symtab_sections): Layout with offsets relative to
5137         start of section; for incremental updates, allocate space from free
5138         list.
5139         (Layout::create_shdrs): For incremental updates, allocate space from
5140         free list.
5141         (Layout::finish_dynamic_section): For incremental updates, do not
5142         check --as-needed (fixed in subsequent patch).
5143         * layout.h (class Free_list): New class.
5144         (Layout::set_incremental_base): New function.
5145         (Layout::incremental_base): New function.
5146         (Layout::init_fixed_output_section): New function.
5147         (Layout::allocate): New function.
5148         (Layout::incremental_base_): New data member.
5149         (Layout::free_list_): New data member.
5150         * main.cc (main): Print Free_list statistics.
5151         * object.cc (Relobj::finalize_incremental_relocs): Add
5152         clear_counts parameter; clear counts only when clear_counts is set.
5153         (Sized_relobj::Sized_relobj): Initialize new base class.
5154         (Sized_relobj::do_layout): Don't report special sections.
5155         (Sized_relobj::do_for_all_local_got_entries): New function.
5156         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5157         symtab_off to all symbol table offsets.
5158         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5159         * object.h (class Got_offset_list): Move to top of file.
5160         (Object::Object): Allow case where input_file == NULL.
5161         (Object::~Object): Likewise.
5162         (Object::input_file): Assert that input_file != NULL.
5163         (Object::lock): Allow case where input_file == NULL.
5164         (Object::unlock): Likewise.
5165         (Object::is_locked): Likewise.
5166         (Object::token): Likewise.
5167         (Object::release): Likewise.
5168         (Object::is_incremental): New function.
5169         (Object::get_mtime): New function.
5170         (Object::for_all_local_got_entries): New function.
5171         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5172         (Object::set_is_in_system_directory): New function.
5173         (Object::is_in_system_directory): New function.
5174         (Object::do_is_incremental): New function.
5175         (Object::do_get_mtime): New function.
5176         (Object::do_for_all_local_got_entries): New function.
5177         (Object::is_in_system_directory_): New data member.
5178         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5179         (class Sized_relobj_base): New class.
5180         (class Sized_relobj): Derive from Sized_relobj_base.
5181         (class Sized_relobj::Symbols): Redeclare from base class.
5182         (class Sized_relobj::local_got_offset_list): Remove.
5183         (class Sized_relobj::Output_sections): Redeclare from base class.
5184         (class Sized_relobj::do_for_all_local_got_entries): New function.
5185         (class Sized_relobj::write_local_symbols): Add offset parameter.
5186         (class Sized_relobj::local_symbol_offset_): Update comment.
5187         (class Sized_relobj::local_dynsym_offset_): Update comment.
5188         * options.cc (Input_arguments::add_file): Remove const.
5189         * options.h (Input_file_argument::Input_file_argument):
5190         Initialize arg_serial_ (all constructors).
5191         (Input_file_argument::set_arg_serial): New function.
5192         (Input_file_argument::arg_serial): New function.
5193         (Input_file_argument::arg_serial_): New data member.
5194         (Input_arguments::Input_arguments): Initialize file_count_.
5195         (Input_arguments::add_file): Remove const.
5196         (Input_arguments::number_of_input_files): New function.
5197         (Input_arguments::file_count_): New data member.
5198         (Command_line::number_of_input_files): Call
5199         Input_arguments::number_of_input_files.
5200         * output.cc (Output_segment_headers::Output_segment_headers):
5201         Set current size.
5202         (Output_section::Input_section::current_data_size): New function.
5203         (Output_section::Output_section): Initialize new data members.
5204         (Output_section::add_input_section): Don't do merge sections for
5205         an incremental link; allocate space from free list for an
5206         incremental update.
5207         (Output_section::add_output_section_data): Allocate space from
5208         free list for an incremental update.
5209         (Output_section::update_data_size): New function.
5210         (Output_section::set_fixed_layout): New function.
5211         (Output_section::reserve): New function.
5212         (Output_segment::set_section_addresses): Remove const.
5213         (Output_segment::set_section_list_addresses): Remove const; allocate
5214         space from free list for an incremental update.
5215         (Output_segment::set_offset): Adjust size of RELRO segment for an
5216         incremental update.
5217         * output.h (Output_data::current_data_size): Move here from
5218         child classes.
5219         (Output_data::pre_finalize_data_size): New function.
5220         (Output_data::update_data_size): New function.
5221         (Output_section_headers::update_data_size): new function.
5222         (Output_section_data_build::current_data_size): Move to Output_data.
5223         (Output_data_strtab::update_data_size): New function.
5224         (Output_section::current_data_size): Move to Output_data.
5225         (Output_section::set_fixed_layout): New function.
5226         (Output_section::has_fixed_layout): New function.
5227         (Output_section::reserve): New function.
5228         (Output_section::update_data_size): New function.
5229         (Output_section::has_fixed_layout_): New data member.
5230         (Output_section::free_list_): New data member.
5231         (Output_segment::set_section_addresses): Remove const.
5232         (Output_segment::set_section_list_addresses): Remove const.
5233         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5234         New function.
5235         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5236         New function.
5237         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5238         parameter when calling Add_symbols constructor; store argument
5239         serial number for members of a lib group.
5240         (Add_symbols::locks): Allow case where token == NULL.
5241         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5242         (Read_member::~Read_member): New function.
5243         (Read_member::is_runnable): New function.
5244         (Read_member::locks): New function.
5245         (Read_member::run): New function.
5246         (Check_script::~Check_script): New function.
5247         (Check_script::is_runnable): New function.
5248         (Check_script::locks): New function.
5249         (Check_script::run): New function.
5250         (Check_library::~Check_library): New function.
5251         (Check_library::is_runnable): New function.
5252         (Check_library::locks): New function.
5253         (Check_library::run): New function.
5254         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5255         (Add_symbols::library_): New data member.
5256         (class Read_member): New class.
5257         (class Check_script): New class.
5258         (class Check_library): New class.
5259         * reloc.cc (Read_relocs::is_runnable): Allow case where
5260         token == NULL.
5261         (Read_relocs::locks): Likewise.
5262         (Scan_relocs::locks): Likewise.
5263         (Relocate_task::locks): Likewise.
5264         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5265         to clear counters.
5266         (Sized_relobj::incremental_relocs_scan): Fix comment.
5267         (Sized_relobj::do_relocate): Pass output file offset to
5268         write_local_symbols.
5269         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5270         from class declaration.
5271         * script.cc (read_input_script): Allocate Script_info; pass
5272         argument serial number to report_script.
5273         * script.h (class Script_info): Move to incremental.h.
5274         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5275         * symtab.h (Symbol_table::add_from_incrobj): New function.
5276         (Symbol_table::set_file_offset): New function.
5277
5278 2011-04-05  Cary Coutant  <ccoutant@google.com>
5279
5280         * incremental-dump.cc (dump_incremental_inputs): Change signature
5281         to take a Sized_incremental_binary; change caller.  Use readers
5282         in Sized_incremental_binary.
5283         * incremental.cc
5284         (Sized_incremental_binary::find_incremental_inputs_sections):
5285         Rename do_find_incremental_inputs_sections to this.
5286         (Sized_incremental_binary::setup_readers): New function.
5287         (Sized_incremental_binary::do_check_inputs): Check
5288         has_incremental_info_ flag; move setup code to setup_readers;
5289         use input readers.
5290         (Sized_incremental_binary::do_file_is_unchanged): New function.
5291         (Sized_incremental_binary::do_get_input_reader): New function.
5292         * incremental.h (class Incremental_binary): Move to end of file.
5293         (Incremental_binary::file_is_unchanged): New function.
5294         (Incremental_binary::do_file_is_unchanged): New function.
5295         (Incremental_binary::Input_reader): New class.
5296         (Incremental_binary::get_input_reader): New function.
5297         (class Sized_incremental_binary): Move to end of file.
5298         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5299         input section reader classes.
5300         (Sized_incremental_binary::has_incremental_info): New function.
5301         (Sized_incremental_binary::inputs_reader): New function.
5302         (Sized_incremental_binary::symtab_reader): New function.
5303         (Sized_incremental_binary::relocs_reader): New function.
5304         (Sized_incremental_binary::got_plt_reader): New function.
5305         (Sized_incremental_binary::do_file_is_unchanged): New function.
5306         (Sized_incremental_binary::Sized_input_reader): New class.
5307         (Sized_incremental_binary::get_input_reader): New function.
5308         (Sized_incremental_binary::find_incremental_inputs_sections):
5309         Rename do_find_incremental_inputs_sections to this.
5310         (Sized_incremental_binary::setup_readers): New function.
5311         (Sized_incremental_binary::has_incremental_info_): New data member.
5312         (Sized_incremental_binary::inputs_reader_): New data member.
5313         (Sized_incremental_binary::symtab_reader_): New data member.
5314         (Sized_incremental_binary::relocs_reader_): New data member.
5315         (Sized_incremental_binary::got_plt_reader_): New data member.
5316         (Sized_incremental_binary::current_input_file_): New data member.
5317
5318 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5319
5320         PR gold/12640
5321         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5322         violation.
5323
5324 2011-03-30  Cary Coutant  <ccoutant@google.com>
5325
5326         * archive.cc (Archive::include_member): Adjust call to report_object.
5327         (Add_archive_symbols::run): Add script_info to call to
5328         report_archive_begin.
5329         (Lib_group::include_member): Adjust call to report_object.
5330         (Add_lib_group_symbols::run): Adjust call to report_object.
5331         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5332         blocks.  Add object count for script input files.
5333         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5334         script_info parameter; change all callers.
5335         (Incremental_inputs::report_object): Add script_info parameter;
5336         change all callers.
5337         (Incremental_inputs::report_script): Store backpointer to
5338         incremental info entry.
5339         (Output_section_incremental_inputs::set_final_data_size): Record
5340         additional information for scripts.
5341         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5342         * incremental.h (Incremental_script_entry::add_object): New function.
5343         (Incremental_script_entry::get_object_count): New function.
5344         (Incremental_script_entry::get_object): New function.
5345         (Incremental_script_entry::objects_): New data member; adjust
5346         constructor.
5347         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5348         (Incremental_inputs::report_object): Add script_info parameter.
5349         (Incremental_inputs_reader::get_object_count): New function.
5350         (Incremental_inputs_reader::get_object_offset): New function.
5351         * options.cc (Input_arguments::add_file): Return reference to
5352         new input argument.
5353         * options.h (Input_argument::set_script_info): New function.
5354         (Input_argument::script_info): New function.
5355         (Input_argument::script_info_): New data member; adjust all
5356         constructors.
5357         (Input_file_group::add_file): Return reference to new input argument.
5358         (Input_file_lib::add_file): Likewise.
5359         (Input_arguments::add_file): Likewise.
5360         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5361         * script.cc (Parser_closure::Parser_closure): Add script_info
5362         parameter; adjust all callers.
5363         (Parser_closure::script_info): New function.
5364         (Parser_closure::script_info_): New data member.
5365         (read_input_script): Report scripts earlier to incremental info.
5366         (script_add_file): Set script_info in Input_argument.
5367         (script_add_library): Likewise.
5368         * script.h (Script_options::Script_info): Rewrite class.
5369
5370 2011-03-29  Cary Coutant  <ccoutant@google.com>
5371
5372         * archive.cc (Library_base::should_include_member): Move
5373         method here from class Archive.
5374         (Archive::Archive): Initialize base class.
5375         (Archive::should_include_member): Move to base class.
5376         (Archive::do_for_all_unused_symbols): New function.
5377         (Add_archive_symbols::run): Remove redundant access to
5378         incremental_inputs.
5379         (Lib_group::Lib_group): Initialize base class.
5380         (Lib_group::do_filename): New function.
5381         (Lib_group::include_member): Pass pointer to Lib_group to
5382         report_object.
5383         (Lib_group::do_for_all_unused_symbols): New function.
5384         (Add_lib_group_symbols::run): Report archive information for
5385         incremental links.
5386         * archive.h (class Library_base): New base class.
5387         (class Archive): Derive from Library_base.
5388         (Archive::filename): Move to base class.
5389         (Archive::set_incremental_info): Likewise.
5390         (Archive::incremental_info): Likewise.
5391         (Archive::Should_include): Likewise.
5392         (Archive::should_include_member): Likewise.
5393         (Archive::Armap_entry): Remove.
5394         (Archive::Unused_symbol_iterator): Remove.
5395         (Archive::unused_symbols_begin): Remove.
5396         (Archive::unused_symbols_end): Remove.
5397         (Archive::do_filename): New function.
5398         (Archive::do_get_mtime): New function.
5399         (Archive::do_for_all_unused_symbols): New function.
5400         (Archive::task_): Move to base class.
5401         (Archive::incremental_info_): Likewise.
5402         (class Lib_group): Derive from Library_base.
5403         (Lib_group::do_filename): New function.
5404         (Lib_group::do_get_mtime): New function.
5405         (Lib_group::do_for_all_unused_symbols): New function.
5406         (Lib_group::task_): Move to base class.
5407         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5408         function.
5409         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5410         function.
5411         * incremental.cc (Incremental_inputs::report_archive_begin):
5412         Use Library_base; call library's get_mtime; add incremental inputs
5413         entry before members.
5414         (class Unused_symbol_visitor): New class.
5415         (Incremental_inputs::report_archive_end): Use Library_base; use
5416         visitor class to record unused symbols; don't add incremental inputs
5417         entry after members.
5418         (Incremental_inputs::report_object): Use Library_base.
5419         * incremental.h
5420         (Incremental_archive_entry::Incremental_archive_entry): Remove
5421         unused Archive parameter.
5422         (Incremental_inputs::report_archive_begin): Use Library_base.
5423         (Incremental_inputs::report_archive_end): Likewise.
5424         (Incremental_inputs::report_object): Likewise.
5425         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5426         function.
5427         * object.h (Object::for_all_global_symbols): New function.
5428         (Object::do_for_all_global_symbols): New function.
5429         (Sized_relobj::do_for_all_global_symbols): New function.
5430         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5431         function.
5432         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5433         function.
5434
5435 2011-03-27  Ian Lance Taylor  <iant@google.com>
5436
5437         * archive.cc (Archive::interpret_header): Return -1 if something
5438         goes wrong.  Change callers accordingly.
5439
5440 2011-03-25  Cary Coutant  <ccoutant@google.com>
5441
5442         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5443         * testsuite/Makefile.in: Regenerate.
5444
5445 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5446
5447         * plugin.cc (get_view): New.
5448         (Plugin::load): Pass get_view to the plugin.
5449         (Plugin_manager::get_view): New.
5450
5451 2011-03-21  Ian Lance Taylor  <iant@google.com>
5452
5453         * testsuite/final_layout.sh: Rewrite to not use dc.
5454         * testsuite/relro_test.sh: Fail if dc is not present.
5455
5456 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5457
5458         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5459         Change == to -eq.
5460         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5461         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5462         Change == to -eq.
5463         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5464         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5465
5466 2011-03-14  Ian Lance Taylor  <iant@google.com>
5467
5468         * script-sections.cc (Sort_output_sections::script_compare):
5469         Rename from is_before, change return type.
5470         (Sort_output_sections::operator()): Adjust accordingly.
5471
5472 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5473
5474         PR gold/12572
5475         * testsuite/odr_violation2.cc: Add comment to make all error line
5476         numbers double digits.
5477         * testsuite/debug_msg.sh: Adjust expected errors.
5478
5479 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5480
5481         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5482         but mark earlier ones as non-canonical
5483         (offset_to_iterator): Update search target and example
5484         (do_addr2line): Return extra lines in a vector*
5485         (format_file_lineno): Extract from do_addr2line
5486         (one_addr2line): Add vector* out-param
5487         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5488         when a lineno entry appeared last for its instruction
5489         (Dwarf_line_info): Add vector* out-param
5490         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5491         * symtab.cc (Odr_violation_compare): Include the lineno in the
5492         comparison again.
5493         (linenos_from_loc): New. Combine the canonical line for an
5494         address with its other lines.
5495         (True_if_intersect): New. Helper functor to make
5496         std::set_intersection a query.
5497         (detect_odr_violations): Compare sets of lines instead of just
5498         one line for each function. This became less deterministic, but
5499         has fewer false positives.
5500         * symtab.h: Declarations.
5501         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5502         mix an optimized and non-optimized object in the same binary
5503         (odr_violation2.so): Same.
5504         * testsuite/Makefile.in: Regenerate from Makefile.am.
5505         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5506         * testsuite/debug_msg.sh: Update line numbers and add
5507         assertions.
5508         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5509         non-optimized context.
5510         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5511         isn't inlined, and use OdrDerived in an optimized context.
5512         * testsuite/odr_header1.h: Defines OdrDerived, where
5513         optimization will change the
5514         first-instruction-in-the-destructor's file and line number.
5515         * testsuite/odr_header2.h: Defines OdrBase.
5516
5517 2011-03-09  Ian Lance Taylor  <iant@google.com>
5518
5519         * fileread.cc (File_read::clear_views): Don't delete the whole
5520         file view.
5521
5522 2011-03-08  Ian Lance Taylor  <iant@google.com>
5523
5524         PR gold/12525
5525         * fileread.cc: #include <climits>.
5526         (GOLD_IOV_MAX): Define.
5527         (File_read::read_multiple): Limit number of entries by iov_max.
5528         * fileread.h (class File_read): Always set max_readv_entries to
5529         128.
5530
5531 2011-03-07  Ian Lance Taylor  <iant@google.com>
5532
5533         PR gold/12525
5534         * options.h (class General_options): Add -dy and -dn.
5535
5536 2011-03-02  Cary Coutant  <ccoutant@google.com>
5537
5538         * testsuite/script_test_9.t: Add TLS segment.
5539
5540 2011-03-02  Simon Baldwin  <simonb@google.com>
5541
5542         * configure.ac: Add check for gnu_indirect_function support in
5543         the toolchain building binutils.
5544         * configure: Rebuild.
5545
5546 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5547
5548         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5549         plugin only symbols.
5550         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5551         in plugin files as not needed in the symbol table.
5552
5553 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5554
5555         * output.cc (Output_section::add_input_section): Delay fill
5556         generation for section ordering.
5557
5558 2011-02-09  Ian Lance Taylor  <iant@google.com>
5559
5560         PR gold/12316
5561         * object.h (class Sized_relobj): Remove clear_local_symbols.
5562         * reloc.cc (Sized_relobj::do_relocate): Don't call
5563         clear_local_symbols.
5564
5565 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5566
5567         * plugin.cc (is_visible_from_outside): Return true for symbols
5568         in the -u option.
5569
5570 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5571
5572         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5573         filename.
5574
5575 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5576
5577         * icf.h (is_section_foldable_candidate): Change type of parameter
5578         to std::string.
5579         * icf.cc (Icf::find_identical_sections): Change type of local variable
5580         section_name to be std::string.
5581         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5582
5583 2011-01-25  Ian Lance Taylor  <iant@google.com>
5584
5585         * script.cc (script_add_extern): Rewrite to use
5586         add_symbol_reference.
5587
5588 2011-01-25  Doug Kwan  <dougkwan@google.com>
5589
5590         * icf.cc (get_section_contents): Always lock section's object.
5591
5592 2011-01-24  Ian Lance Taylor  <iant@google.com>
5593
5594         * options.h (class General_options): Accept
5595         --no-detect-odr-violations.
5596
5597 2011-01-24  Ian Lance Taylor  <iant@google.com>
5598
5599         * version.cc (version_string): Bump to 1.11.
5600
5601 2011-01-24  Ian Lance Taylor  <iant@google.com>
5602
5603         * plugin.cc (class Plugin_rescan): Define new class.
5604         (Plugin_manager::claim_file): Set any_claimed_.
5605         (Plugin_manager::save_archive): New function.
5606         (Plugin_manager::save_input_group): New function.
5607         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5608         necessary.
5609         (Plugin_manager::new_undefined_symbol): New function.
5610         (Plugin_manager::rescan): New function.
5611         (Plugin_manager::rescannable_defines): New function.
5612         (Plugin_manager::add_input_file): Set any_added_.
5613         * plugin.h (class Plugin_manager): define new fields rescannable_,
5614         undefined_symbols_, any_claimed_, and any_added_.  Declare
5615         Plugin_rescan as friend.  Declare new functions.
5616         (Plugin_manager::Rescannable): Define type.
5617         (Plugin_manager::Rescannable_list): Define type.
5618         (Plugin_manager::Undefined_symbol_list): Define type.
5619         (Plugin_manager::Plugin_manager): Initialize new fields.
5620         * archive.cc (Archive::defines_symbol): New function.
5621         (Add_archive_symbols::run): Pass archive to plugins if any.
5622         * archive.h (class Archive): Declare defines_symbol.
5623         * readsyms.cc (Input_group::~Input_group): New function.
5624         (Finish_group::run): Pass input_group to plugins if any.
5625         * readsyms.h (class Input_group): Declare destructor.
5626         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5627         any.
5628
5629 2011-01-10  Ian Lance Taylor  <iant@google.com>
5630
5631         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5632         section as relro.
5633         (Layout::set_segment_offsets): Reset increase_relro before calling
5634         set_section_addresses a second time.
5635
5636 2011-01-04  Cary Coutant  <ccoutant@google.com>
5637
5638         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5639         sections before NOBITS sections.
5640
5641 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5642
5643         * version.cc (print_version): Update copyright to 2011.
5644
5645 2010-12-23  Cary Coutant  <ccoutant@google.com>
5646
5647         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5648         of OS to this->add.  Add OD parameter to second form of the function.
5649
5650 2010-12-20  Ian Lance Taylor  <iant@google.com>
5651
5652         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5653         second of two consecutive entries with same offset.
5654
5655 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5656
5657         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5658         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5659         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5660         to avoid unneeded links against $(LDADD).
5661         * testsuite/Makefile.in: Regenerate.
5662
5663 2010-12-15  Ian Lance Taylor  <iant@google.com>
5664
5665         PR gold/12324
5666         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5667         for R_X86_64_32 and R_X86_64_PC32.
5668         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5669         ver_matching_def_pic.o.
5670         (ver_matching_def_pic.o): New target.
5671
5672 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5673
5674         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5675         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5676         Move definition before File_read::View member definitions.
5677         (File_read::View::~View): Initialize and hold lock before
5678         updating current_mapped_bytes.
5679
5680 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5681
5682         * dwarf_reader.cc: Remove outdated comment.
5683         * gold-threads.cc: Fix typo in error message.
5684         * archive.cc: Fix typos in comments.
5685         * archive.h: Likewise.
5686         * arm-reloc-property.cc: Likewise.
5687         * arm-reloc-property.h: Likewise.
5688         * arm-reloc.def: Likewise.
5689         * arm.cc: Likewise.
5690         * attributes.h: Likewise.
5691         * cref.cc: Likewise.
5692         * ehframe.cc: Likewise.
5693         * fileread.h: Likewise.
5694         * gold.h: Likewise.
5695         * i386.cc: Likewise.
5696         * icf.cc: Likewise.
5697         * incremental.h: Likewise.
5698         * int_encoding.cc: Likewise.
5699         * layout.h: Likewise.
5700         * main.cc: Likewise.
5701         * merge.h: Likewise.
5702         * object.cc: Likewise.
5703         * object.h: Likewise.
5704         * options.cc: Likewise.
5705         * readsyms.cc: Likewise.
5706         * reduced_debug_output.cc: Likewise.
5707         * reloc.cc: Likewise.
5708         * script-sections.cc: Likewise.
5709         * sparc.cc: Likewise.
5710         * symtab.h: Likewise.
5711         * target-reloc.h: Likewise.
5712         * target.cc: Likewise.
5713         * target.h: Likewise.
5714         * timer.cc: Likewise.
5715         * timer.h: Likewise.
5716         * x86_64.cc: Likewise.
5717
5718 2010-12-09  Cary Coutant  <ccoutant@google.com>
5719
5720         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5721         stack.
5722         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5723         parameter; change all callers.
5724         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5725         * options.h (warn_execstack): New option.
5726
5727 2010-12-07  Doug Kwan  <dougkwan@google.com>
5728
5729         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5730         like function call relocations.
5731
5732 2010-12-07  Ian Lance Taylor  <iant@google.com>
5733
5734         * archive.cc (Archive::get_elf_object_for_member): Permit
5735         punconfigured to be NULL.
5736         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5737         (Archive::include_member): Pass NULL to get_elf_object_for_member
5738         if we searched for the archive and this is the first included
5739         object.
5740
5741 2010-12-01  Ian Lance Taylor  <iant@google.com>
5742
5743         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5744         track_relocs_type_ field.
5745         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5746         Set track_relocs_type_.
5747         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5748         contents when using RELA relocs.
5749         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5750         reloc_map_.
5751         * reloc.cc (Track_relocs::next_addend): New function.
5752         * reloc.h (class Track_relocs): Declare next_addend.
5753
5754 2010-12-01  Ian Lance Taylor  <iant@google.com>
5755
5756         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5757         virtual destructor.
5758
5759 2010-12-01  Ian Lance Taylor  <iant@google.com>
5760
5761         * README: Update compilers known to work and fail.
5762
5763 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5764
5765         * configure.in: For --enable-gold, handle value `default' instead of
5766         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5767         not the default.
5768         * configure: Regenerate.
5769
5770 2010-11-18  Doug Kwan  <dougkwan@google.com>
5771
5772         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5773         and right_alignment to be zero.  Store result alignment only if it is
5774         greater than existing alignment.
5775
5776 2010-11-16  Cary Coutant  <ccoutant@google.com>
5777
5778         PR gold/12220
5779         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5780         Check for ".zdebug_line".
5781
5782 2010-11-16  Doug Kwan  <dougkwan@google.com>
5783             Cary Coutant  <ccoutant@google.com>
5784
5785         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5786         by reference; adjust all callers.
5787         * output.cc (Output_segment::set_section_addresses): Adjust references
5788         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5789         list is empty.
5790         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5791         end at page boundary.
5792
5793 2010-11-16  Cary Coutant  <ccoutant@google.com>
5794
5795         PR gold/12220
5796         * layout.cc (Layout::choose_output_section): Transform names of
5797         compressed sections even when using a script with a SECTIONS clause.
5798         (Layout::output_section_name): Remove code to transform
5799         compressed debug section names.
5800         * output.cc (Output_section::add_input_section): Use uncompressed
5801         section size when tracking input sections.
5802
5803 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5804
5805         * symtab.h (Symbol::NON_PIC_REF): Remove.
5806         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5807         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5808         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5809         (Symbol::use_plt_offset): Take a flags argument and pass it
5810         directly to needs_dynamic_reloc.  Restrict check for undefined
5811         weak symbols to function calls.
5812         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5813         (Target_arm::Scan::global): Use it.
5814         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5815         (Target_arm::Relocate::relocate): Likewise.
5816         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5817         parameter with an r_type parameter.  Use get_reference_flags
5818         to get the flags.
5819         (Target_arm::Relocate::relocate): Update accordingly.
5820         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5821         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5822         (Target_i386::Scan::global): Likewise.
5823         (Target_i386::Relocate::relocate): Likewise.
5824         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5825         parameter with an r_type parameter.  Use get_reference_flags
5826         to get the flags.
5827         (Target_i386::Relocate::relocate): Update accordingly.
5828         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5829         (Target_powerpc::Scan::global): Use it.
5830         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5831         (Target_powerpc::Relocate::relocate): Likewise.
5832         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5833         (Target_sparc::Scan::global): Use it.
5834         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5835         (Target_sparc::Relocate::relocate): Likewise.
5836         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5837         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5838         (Target_x86_64::Scan::global): Likewise.
5839         (Target_x86_64::Relocate::relocate): Likewise.
5840
5841 2010-11-08  Doug Kwan  <dougkwan@google.com>
5842             Cary Coutant  <ccoutant@google.com>
5843
5844         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5845         (Arm_exidx_merge_section::section_contents_): New data member.
5846         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5847         (Arm_input_section::~Arm_input_section): De-allocate memory.
5848         (Arm_input_section::original_contents_): New data member.
5849         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5850         in parameters instead of calling Object::section_contents without
5851         locking.
5852         (Arm_output_section::group_section): New parameter TASK.  Pass it
5853         to callees that need locking objects.
5854         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5855         to lock EXIDX input sections.  Fix a formatting issue.  Call
5856         Arm_exidx_merged_section::build_contents to create merged section
5857         contents.
5858         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5859         to lock object of stub table owner.
5860         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5861         TEXT_SIZE to initialize data member TEXT_SIZE_.
5862         (Arm_exidx_input_section::addralign): Fix typo in comment.
5863         (Arm_exidx_input_section::text_size): New method.
5864         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5865         that require locking objects.  Lock objects before scanning for stubs
5866         and updating local symbols.
5867         (Arm_input_section<big_endian>::init): Copy contents of original
5868         input section.
5869         (Arm_input_section<big_endian>::do_write): Use saved contents of
5870         original input section instead of calling Object::section_contents
5871         without locking.
5872         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5873         size without calling Object::section_size().
5874         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5875         for size.  Allocate a buffer for merged EXIDX entries.
5876         (Arm_exidx_merged_section::build_contents): New method.
5877         (Arm_exidx_merged_section::do_write): Move merge section contents
5878         building code to Arm_exidx_merged_section::build_contetns.  Write
5879         out contetns in buffer instead of building it on the fly.
5880         (Arm_relobj::make_exidx_input_section): Also pass text section size
5881         to Arm_exidx_input_section constructor.
5882         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5883         (Arm_dynobj::do_read_symbols): Fix memory leak.
5884         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5885         * target.h: (class Task): Add forward declaration.
5886         (Target::relax): Add new parameter TASK and pass it to
5887         Target::do_relax().
5888         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5889
5890 2010-11-05  Cary Coutant  <ccoutant@google.com>
5891
5892         PR gold/10708
5893         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5894         object when reading from the file.
5895         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5896         second layout pass.
5897         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5898         when reading section contents.
5899         (get_section_contents): Likewise.
5900         (icf::find_identical_sections): Likewise.
5901         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
5902         object when reading from the file.
5903         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
5904         the object when doing deferred section layout.
5905
5906 2010-11-03  Nick Clifton  <nickc@redhat.com>
5907
5908         PR gold/12001
5909         * script.h (class Symbol_assignment: name): New member.  Returns
5910         the name of the symbol.
5911         * scrfipt.cc (Script_options::is_pending_assignment): New member.
5912         Returns true if the given symbol name is on the list of
5913         assignments wating to be processed.
5914         * archive.cc (should_incldue_member): If the symbol is undefined,
5915         check to see if it is on the list of symbols pending assignment.
5916
5917 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
5918
5919         * script-sections.cc (Script_sections::find_memory_region): Check
5920         for a NULL output section pointer.
5921
5922 2010-10-29  Doug Kwan  <dougkwan@google.com>
5923
5924         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
5925         Output_section::add_relaxed_input_section.
5926         * output.cc (Output_section::add_relaxed_input_section): Add new
5927         arguments LAYOUT and NAME.  Set section order index.
5928         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
5929         Copy section order index.
5930         * output.h (Output_section::add_relaxed_input_section): Add new
5931         arguments LAYOUT and NAME.
5932
5933 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
5934
5935         * testsuite/Makefile.am: Move gcctestdir/ld rule to
5936         NATIVE_OR_CROSS_LINKER.
5937         * testsuite/Makefile.in: Regenerate.
5938
5939 2010-10-20  Doug Kwan  <dougkwan@google.com>
5940
5941         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
5942         without SHF_LINK_ORDER flags.
5943         * layout.cc (Layout::choose_output_section): Do not filter
5944         SHF_LINK_ORDER flag in a relocatable link.
5945
5946 2010-10-17  Cary Coutant  <ccoutant@google.com>
5947
5948         * output.h (Output_segment::set_section_addresses): Change function
5949         signature.  Update all callers.
5950         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
5951         sections.
5952         (Output_segment::set_section_addresses): Align after last TLS
5953         section.  Add padding before last relro section instead of after.
5954
5955 2010-10-17  Doug Kwan  <dougkwan@google.com>
5956
5957         * gold/arm.cc (Target_arm::got_section): Use correct order and set
5958         GOT output section to be writable.
5959
5960 2010-10-14  Cary Coutant  <ccoutant@google.com>
5961
5962         * debug.h (DEBUG_INCREMENTAL): New flag.
5963         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
5964         * gold.cc (queue_initial_tasks): Check parameters for incremental link
5965         mode.
5966         * incremental.cc (report_command_line): Ignore all forms of
5967         --incremental.
5968         * layout.cc (Layout::Layout): Check parameters for incremental link
5969         mode.
5970         * options.cc (General_options::parse_incremental): New function.
5971         (General_options::parse_no_incremental): New function.
5972         (General_options::parse_incremental_full): New function.
5973         (General_options::parse_incremental_update): New function.
5974         (General_options::incremental_mode_): New data member.
5975         (General_options::finalize): Check incremental_mode_.
5976         * options.h (General_options): Update help text for --incremental.
5977         Add --no-incremental, --incremental-full, --incremental-update.
5978         (General_options::Incremental_mode): New enum type.
5979         (General_options::incremental_mode): New function.
5980         (General_options::incremental_mode_): New data member.
5981         * parameters.cc (Parameters::incremental_mode_): New data member.
5982         (Parameters::set_options): Set incremental_mode_.
5983         (Parameters::set_incremental_full): New function.
5984         (Parameters::incremental): New function.
5985         (Parameters::incremental_update): New function.
5986         (set_parameters_incremental_full): New function.
5987         * parameters.h (Parameters::set_incremental_full): New function.
5988         (Parameters::incremental): New function.
5989         (Parameters::incremental_update): New function.
5990         (Parameters::incremental_mode_): New data member.
5991         (set_parameters_incremental_full): New function.
5992         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
5993         incremental link mode.
5994         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
5995         (Sized_relobj::do_relocate_sections): Likewise.
5996         * testsuite/Makefile.am (incremental_test): Use --incremental-full
5997         option.
5998         * testsuite/Makefile.in: Regenerate.
5999         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6000
6001 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6002
6003         * script-sections.h (class Script_sections): Make
6004         Sections_elements typedef public.
6005         * script-sections.cc (class Sort_output_sections): Add elements_
6006         field.  Add constructor which sets it; change all callers.
6007         (Sort_output_sections::is_before): New function.
6008         (Sort_output_sections::operator()): Call is_before.
6009         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6010         conditional.
6011         * testsuite/script_test_10.sh: New test. Test script section
6012         order.
6013         * testsuite/script_test_10.t: Likewise.
6014         * testsuite/script_test_10.s: Likewise.
6015         * testsuite/Makefile.am: Wrap the cross linker tests and the
6016         common tests into NATIVE_OR_CROSS_LINKER.
6017         (check_SCRIPTS): Add script_test_10.sh.
6018         (check_DATA): Add script_test_10.stdout.
6019         (script_test_10.o, script_test_10): New targets.
6020         (script_test_10.stdout): New target.
6021         * configure, testsuite/Makefile.in: Regenerate.
6022
6023 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6024
6025         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6026         error for the deprecated relocations.
6027         (Target_arm::Scan::global): Likewise.
6028         (Target_arm::Relocate::relocate): Likewise.
6029
6030 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6031
6032         * fileread.cc (Input_file::find_file): Initialize *found_name
6033         and *namep when using the fallback search for case 4.
6034
6035 2010-10-11  Cary Coutant  <ccoutant@google.com>
6036
6037         * options.h (class General_options): Redefine -z lazy as an alias for
6038         the negation of -z now.
6039
6040 2010-10-11  Ian Lance Taylor  <iant@google.com>
6041
6042         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6043         binding.
6044
6045 2010-10-06  Nick Clifton  <nickc@redhat.com>
6046
6047         * script-sections.cc(class Memory_region): Remove
6048         current_lma_offset_ field.  Rename current_vma_offset_ to
6049         current_offset_.  Add last_section_ field.
6050         (Memory_region::get_current_vma_address): Rename to
6051         get_current_address.
6052         (Memory_region::get_current_lma_address): Delete.
6053         (Memory_region::increment_vma_offset): Rename to
6054         increment_offset.
6055         (Memory_region::increment_lma_offset): Delete.
6056         (Memory_region::attributes_compatible): New method.  Returns
6057         true if the provided section is compatible with the region.
6058         (Memory_region::get_last_section): New method.  Returns the last
6059         section to use the region.
6060         (Memory_region::set_last_section): New method.  Stores the last
6061         section to use the region.
6062         (Script_sections::block_in_region): New method.  Returns true if
6063         a block of memory is contained within a region.
6064         (Script_sections::find_memory_region): New method.  Locates a
6065         memory region to be used to set a VMA or LMA address.
6066         (Output_section_definition::set_section_addresses): Add code to
6067         check for addresses set by memory regions.
6068         (Output_segment::set_section_addresses): Remove memory region
6069         walking code.
6070         (Script_sections::create_segment): Add a warning if a header
6071         segment is created outside of any region.
6072         * script-sections.h (class Script_sections): Add prototypes for
6073         find_memory_region and block_in_region methods.
6074         * testsuite/memory_test.s: Use .long instead of .word.
6075         * testsuite/memory_test.t: Add some more output sections.
6076         * testsuite/memory_test.sh: Update expected output.
6077
6078 2010-10-02  Doug Kwan  <dougkwan@google.com>
6079
6080         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6081         defintion to symtab.h
6082         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6083         declaration to defintion.
6084
6085 2010-10-01  Nick Clifton  <nickc@redhat.com>
6086
6087         * expression.cc (eval): Replace dummy argument with NULL.
6088         (eval_maybe_dot): Check for a NULL result section pointer.
6089         (Symbol_expression::value): Likewise.
6090         (Dot_expression::value): Likewise.
6091         (BINARY_EXPRESSION): Likewise.
6092         (Max_expression::value): Likewise.
6093         (Min_expression::value): Likewise.
6094         (Absolute_expression::value): Likewise.
6095         (Addr_expression::value_from_output_section): Likewise.
6096         (Loaddddr_expression::value_from_output_section): Likewise.
6097         (Segment_start_expression::value): Likewise.
6098         * script-sections.cc
6099         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6100         argument with NULL.
6101         (Sections_elememt_dot_assignment::set_section_addresses):
6102         Likewise.
6103         (Output_data_expression::do_write_to_buffer): Likewise.
6104         (Output_section_definition::finalize_symbols): Likewise.
6105         (Output_section_definition::set_section_addresses): Likewise.
6106
6107 2010-09-30  Doug Kwan  <dougkwan@google.com>
6108
6109         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6110
6111 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6112
6113         * target.h (Target::can_icf_inline_merge_sections): New virtual
6114         function.
6115         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6116         virtual function.
6117         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6118         virtual function.
6119         * icf.cc (get_section_contents): Inline merge sections only when
6120         target allows it.
6121
6122 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6123
6124         * configure: Regenerate.
6125
6126 2010-09-17  Ian Lance Taylor  <iant@google.com>
6127
6128         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6129         * testsuite/Makefile.am (memory_test.o): New target.
6130         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6131         memory_test.t.
6132         * testsuite/Makefile.in: Rebuild.
6133
6134 2010-09-17  Doug Kwan  <dougkwan@google.com>
6135
6136         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6137         defintion if relocation uses GOT entries of the symbol.
6138         * testsuite/icf_safe_test.sh: Fix test.
6139         * testsuite/icf_safe_so_test.sh: Fix test.
6140
6141 2010-09-16  Cary Coutant  <ccoutant@google.com>
6142
6143         * script_sections.cc (class Memory_region): Remove "NULL" from
6144         vector initializations.
6145
6146 2010-09-15  Cary Coutant  <ccoutant@google.com>
6147
6148         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6149         Resolve forwarding symbols.
6150
6151 2010-09-15  Doug Kwan  <dougkwan@google.com>
6152
6153         * gold/testsuite/script_test_3.t: Add ARM special sections.
6154         * gold/testsuite/script_test_4.t: Same.
6155         * gold/testsuite/script_test_5.t: Same.
6156         * gold/testsuite/script_test_6.t: Same.
6157         * gold/testsuite/script_test_7.t: Same.
6158         * gold/testsuite/script_test_7.t: Same.
6159         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6160
6161 2010-09-14  Cary Coutant  <ccoutant@google.com>
6162
6163         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6164         (Target_x86_64::Relocate::relocate_tls): Replace check for
6165         saw_tls_block_reloc_ with test for executable section.
6166
6167 2010-09-12  Cary Coutant  <ccoutant@google.com>
6168
6169         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6170         position-independent executables to shared libraries need dynamic
6171         relocations.
6172         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6173         position-independent executables.
6174         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6175         * testsuite/Makefile.in: Regenerate.
6176
6177 2010-09-10  Nick Clifton  <nickc@redhat.com>
6178
6179         PR gold/11997
6180         * testsuite/memory_test.t: Discard any sections that are not
6181         needed.
6182
6183 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6184
6185         PR gold/11996
6186         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6187         "This::" to work around a bug in gcc 4.2.
6188
6189         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6190
6191 2010-09-09  Rafael Espindola  <espindola@google.com>
6192
6193         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6194         sections with different PF_X flags in the same segment.
6195         (Layout::find_first_load_seg): Search all segments to find the first
6196         one.
6197         * options.h (rosegment): New.
6198
6199 2010-09-08  Rafael Espindola  <espindola@google.com>
6200
6201         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6202
6203 2010-09-08  Doug Kwan  <dougkwan@google.com>
6204
6205         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6206         (Arm_relobj::do_relocate_sections): Add new parameter for output
6207         file to match the parent.
6208         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6209         of local symbols instead of input values.  Update code to track
6210         changes in gold::relocate_section.
6211         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6212         (Sized_relobj::compute_final_local_value_internal): New methods.
6213         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6214         body into private version of Sized_relobj::compute_final_local_value.
6215         Call the inline method.
6216         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6217         merged symbol value if there is one.
6218         (Symbol_value::has_output_value): New method defintiion.
6219         (Sized_relobj::Compute_final_local_value_status): New enum type.
6220         (Sized_relobj::compute_final_local_value): New methods.
6221         (Sized_relobj::compute_final_local_value_internal): New methods.
6222         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6223         and arm_cortex_a8.sh.
6224         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6225         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6226         New tests.
6227         * Makefile.in: Regenerate.
6228         * testsuite/arm_bl_out_of_range.s: Update test.
6229         * testsuite/thumb_bl_out_of_range.s: Ditto.
6230         * testsuite/thumb_blx_out_of_range.s: Ditto.
6231         * testsuite/arm_branch_out_of_range.sh: New file.
6232         * testsuite/arm_cortex_a8.sh: Ditto.
6233         * testsuite/arm_cortex_a8_b.s: Ditto.
6234         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6235         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6236         * testsuite/arm_cortex_a8_bl.s: Ditto.
6237         * testsuite/arm_cortex_a8_blx.s: Ditto.
6238         * testsuite/arm_cortex_a8_local.s: Ditto.
6239         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6240         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6241
6242 2010-09-08  Rafael Espindola  <espindola@google.com>
6243
6244         * Makefile.am (memory_test.stdout): Run readelf with -W.
6245         * Makefile.in: Regenerate.
6246         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6247         64 bit output.
6248
6249 2010-09-08  Rafael Espindola  <espindola@google.com>
6250
6251         * script-sections.cc (Script_sections::add_memory_region): Convert
6252         field precision to int.
6253         * script.cc (script_set_section_region, script_set_section_region):
6254         Convert field precision to int.
6255
6256 2010-09-08  Rafael Espindola  <espindola@google.com>
6257
6258         * arm.cc (do_finalize_sections): Create the __exidx_start and
6259         __exdix_end symbols even when the section is missing.
6260
6261 2010-09-08  Nick Clifton  <nickc@redhat.com>
6262
6263         * README: Remove claim that MEMORY is not supported.
6264         * expression.cc (script_exp_function_origin)
6265         (script_exp_function_length): Move from here to ...
6266         * script.cc: ... here.
6267         (script_set_section_region, script_add_memory)
6268         (script_parse_memory_attr, script_include_directive): New
6269         functions.
6270         * script-sections.cc
6271         (class Memory_region): New class.
6272         (class Output_section_definition): Add set_memory_region,
6273         set_section_vma, set_section_lma and get_section_name methods.
6274         (class Script_Sections): Add add_memory_region,
6275         find_memory_region, find_memory_region_origin,
6276         find_memory_region_length and set_memory_region methods.
6277         Have set_section_addresses method walk the list of set memory
6278         regions.
6279         Extend the print methos to display memory regions.
6280         * script-sections.h: Add prototypes for new methods.
6281         Add enum for MEMORY region attributes.
6282         * yyscript.y: Add support for parsing MEMORY regions.
6283         * script-c.h: Add prototypes for new functions.
6284         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6285         * testsuite/Makefile.in: Regenerate.
6286         * testsuite/memory_test.sh: New script.
6287         * testsuite/memory_test.s: New assembler source file.
6288         * testsuite/memory_test.t: New linker script.
6289
6290 2010-08-27  Doug Kwan  <dougkwan@google.com>
6291
6292         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6293         reference override an existing dynamic weak reference.
6294         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6295         * testsuite/Makefile.in: Regenerate.
6296         * testsuite/dyn_weak_ref.sh: New file.
6297         * testsuite/dyn_weak_ref_1.c: Ditto.
6298         * testsuite/dyn_weak_ref_2.c: Ditto.
6299
6300 2010-08-27  Ian Lance Taylor  <iant@google.com>
6301
6302         * incremental.h (class Incremental_input_entry): Add virtual
6303         destructor.
6304
6305 2010-08-27  Ian Lance Taylor  <iant@google.com>
6306
6307         * testsuite/start_lib_test_3.c: Mark t3 as used.
6308
6309 2010-08-27  Nick Clifton  <nickc@redhat.com>
6310
6311         * options.cc (version_script): Fix small typo in previous
6312         whitespace tidyup.
6313
6314 2010-08-25  Nick Clifton  <nickc@redhat.com>
6315
6316         * archive.cc: Formatting fixes: Remove whitespace between
6317         typename and following asterisk.  Remove whitespace between
6318         function name and opening parenthesis.
6319         * archive.h: Likewise.
6320         * arm.cc: Likewise.
6321         * attributes.cc: Likewise.
6322         * attributes.h: Likewise.
6323         * common.cc: Likewise.
6324         * copy-relocs.cc: Likewise.
6325         * dirsearch.h: Likewise.
6326         * dynobj.cc: Likewise.
6327         * ehframe.cc: Likewise.
6328         * ehframe.h: Likewise.
6329         * expression.cc: Likewise.
6330         * fileread.cc: Likewise.
6331         * fileread.h: Likewise.
6332         * gc.h: Likewise.
6333         * gold-threads.cc: Likewise.
6334         * gold.cc: Likewise.
6335         * i386.cc: Likewise.
6336         * icf.h: Likewise.
6337         * incremental-dump.cc: Likewise.
6338         * incremental.cc: Likewise.
6339         * layout.cc: Likewise.
6340         * layout.h: Likewise.
6341         * main.cc: Likewise.
6342         * merge.cc: Likewise.
6343         * merge.h: Likewise.
6344         * object.cc: Likewise.
6345         * object.h: Likewise.
6346         * options.cc: Likewise.
6347         * options.h: Likewise.
6348         * output.cc: Likewise.
6349         * output.h: Likewise.
6350         * plugin.cc: Likewise.
6351         * plugin.h: Likewise.
6352         * powerpc.cc: Likewise.
6353         * reloc.cc: Likewise.
6354         * script-c.h: Likewise.
6355         * script-sections.cc: Likewise.
6356         * script.cc: Likewise.
6357         * stringpool.cc: Likewise.
6358         * symtab.cc: Likewise.
6359         * symtab.h: Likewise.
6360         * target.cc: Likewise.
6361         * timer.cc: Likewise.
6362         * timer.h: Likewise.
6363         * version.cc: Likewise.
6364         * x86_64.cc: Likewise.
6365
6366 2010-08-24  Nick Clifton  <nickc@redhat.com>
6367
6368         PR 11899
6369         * layout.cc (segment_precedes): Sort segments by their physical
6370         addresses, if they have been set.
6371
6372 2010-08-23  Cary Coutant  <ccoutant@google.com>
6373
6374         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6375         symbols data.
6376         (Lib_group::include_member): Unlock object after deleting its
6377         symbols data.
6378         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6379         the bug fixed here.
6380
6381 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6382             Cary Coutant  <ccoutant@google.com>
6383
6384         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6385         constructor, and set_blocker.
6386         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6387         readsyms_blocker_.
6388         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6389         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6390         * testsuite/Makefile.am (start_lib_test): New test case.
6391         * testsuite/Makefile.in: Regenerate.
6392         * testsuite/start_lib_test_main.c: New file.
6393         * testsuite/start_lib_test_1.c: New file.
6394         * testsuite/start_lib_test_2.c: New file.
6395         * testsuite/start_lib_test_3.c: New file.
6396
6397 2010-08-19  Ian Lance Taylor  <iant@google.com>
6398
6399         * Makefile.in: Rebuild with automake 1.11.1.
6400         * aclocal.m4: Likewise.
6401         * testsuite/Makefile.in: Likewise.
6402
6403 2010-08-19  Ian Lance Taylor  <iant@google.com>
6404
6405         PR 10893
6406         * i386.cc (class Output_data_plt_i386): Update declarations.
6407         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6408         local_ifuncs_ fields.
6409         (Target_i386::do_plt_section_for_global): New function.
6410         (Target_i386::do_plt_section_for_local): New function.
6411         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6412         parameter; change all callers.  Initialize global_ifuncs_ and
6413         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6414         __rel_iplt_end.
6415         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6416         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6417         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6418         symbols.
6419         (Target_i386::make_plt_section): New function, broken out of
6420         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6421         (Target_i386::make_plt_entry): Call make_plt_section.
6422         (Target_i386::make_local_ifunc_plt_entry): New function.
6423         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6424         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6425         R_386_IRELATIVE to switch.
6426         (Target_i386::Scan::global): Likewise.
6427         (Target_i386::Relocate::relocate): Likewise.
6428         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6429         switch.
6430         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6431         (Target_x86_64::do_plt_section_for_global): New function.
6432         (Target_x86_64::do_plt_section_for_local): New function.
6433         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6434         parameter; change all callers.  If doing a static link define
6435         __rela_iplt_start and __rela_iplt_end.
6436         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6437         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6438         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6439         to point to .plt.
6440         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6441         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6442         switch.
6443         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6444         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6445         R_X86_64_IRELATIVE to switch.
6446         (Target_x86_64::Scan::global): Likewise.
6447         (Target_x86_64::Relocate::relocate): Likewise.
6448         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6449         switch.
6450         * target.h (class Target): Add plt_section_for_global and
6451         plt_section_for_local functions.  Add do_plt_section_for_global
6452         and do_plt_section_for_local virtual functions.
6453         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6454         clarifying comments.
6455         (Symbol::use_plt_offset): Handle IFUNC symbol.
6456         * object.cc (Sized_relobj::Sized_relobj): Initialize
6457         local_plt_offsets_.
6458         (Sized_relobj::local_has_plt_offset): New function.
6459         (Sized_relobj::local_plt_offset): New function.
6460         (Sized_relobj::set_local_plt_offset): New function.
6461         (Sized_relobj::do_count): Handle IFUNC symbol.
6462         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6463         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6464         is_ifunc_symbol functions.
6465         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6466         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6467         local_plt_offsets_ field.
6468         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6469         * output.h (class Output_section_data): Add non-const
6470         output_section function.
6471         (class Output_data_got): Update declarations.
6472         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6473         Add use_plt_offset parameter to global and local constructors.
6474         Change all callers.  Change local_sym_index_ field to 31 bits.
6475         Change GSYM_CODE and CONSTANT_CODE accordingly.
6476         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6477         doing a static link don't set sh_link field.
6478         (Output_data_got::Got_entry::write): Use PLT offset if
6479         appropriate.
6480         (Output_data_got::add_global_plt): New function.
6481         (Output_data_got::add_local_plt): New function.
6482         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6483         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6484         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6485         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6486         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6487         IFUNC conditional.
6488         * testsuite/ifunc-sel.h: New file.
6489         * testsuite/ifuncmain1.c: New file.
6490         * testsuite/ifuncmain1vis.c: New file.
6491         * testsuite/ifuncmod1.c: New file.
6492         * testsuite/ifuncdep2.c: New file.
6493         * testsuite/ifuncmain2.c: New file.
6494         * testsuite/ifuncmain3.c: New file.
6495         * testsuite/ifuncmod3.c: New file.
6496         * testsuite/ifuncmain4.c: New file.
6497         * testsuite/ifuncmain5.c: New file.
6498         * testsuite/ifuncmod5.c: New file.
6499         * testsuite/ifuncmain6pie.c: New file.
6500         * testsuite/ifuncmod6.c: New file.
6501         * testsuite/ifuncmain7.c: New file.
6502         * configure, testsuite/Makefile.in: Rebuild.
6503
6504 2010-08-18  Ian Lance Taylor  <iant@google.com>
6505
6506         * incremental.cc
6507         (Output_section_incremental_inputs::write_input_files): Add cast
6508         to avoid signed/unsigned comparison warning.
6509         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6510
6511 2010-08-12  Cary Coutant  <ccoutant@google.com>
6512
6513         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6514
6515 2010-08-13  Ian Lance Taylor  <iant@google.com>
6516
6517         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6518
6519 2010-08-12  Cary Coutant  <ccoutant@google.com>
6520             Doug Kwan  <dougkwan@google.com>
6521
6522         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6523         defintion overrides non-weak undef, remember that the original undef
6524         is not weak.
6525         * symtab.cc (Symbol_table::sized_write_global): For undef without
6526         an original weak binding, set binding to global in output.
6527         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6528         * testsuite/Makefile.in: Regenerate.
6529         * testsuite/strong_ref_weak_def.sh: New file.
6530         * testsuite/strong_ref_weak_def_1.c: Ditto.
6531         * testsuite/strong_ref_weak_def_2.c: Ditto.
6532
6533 2010-08-12  Cary Coutant  <ccoutant@google.com>
6534
6535         * testsuite/incremental_test.sh: Rewrite.
6536         * testsuite/incremental_test_1.c: Rewrite.
6537         * testsuite/incremental_test_2.c: Rewrite.
6538
6539 2010-08-12  Cary Coutant  <ccoutant@google.com>
6540
6541         * arm.cc (Target_arm::got_size): Add const.
6542         (Target_arm::got_entry_count): New function.
6543         (Target_arm::plt_entry_count): New function.
6544         (Target_arm::first_plt_entry_offset): New function.
6545         (Target_arm::plt_entry_size): New function.
6546         (Output_data_plt_arm::entry_count): New function.
6547         (Output_data_plt_arm::first_plt_entry_offset): New function.
6548         (Output_data_plt_arm::get_plt_entry_size): New function.
6549         * i386.cc (Target_i386::got_size): Add const.
6550         (Target_i386::got_entry_count): New function.
6551         (Target_i386::plt_entry_count): New function.
6552         (Target_i386::first_plt_entry_offset): New function.
6553         (Target_i386::plt_entry_size): New function.
6554         (Output_data_plt_i386::entry_count): New function.
6555         (Output_data_plt_i386::first_plt_entry_offset): New function.
6556         (Output_data_plt_i386::get_plt_entry_size): New function.
6557         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6558         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6559         * incremental.cc: Include target.h.
6560         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6561         parameter.  Adjust all callers.  Find incremental_got_plt section.
6562         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6563         section.
6564         (Output_section_incremental_inputs::set_final_data_size): Calculate
6565         size of incremental_got_plt section.
6566         (Output_section_incremental_inputs::do_write): Write the
6567         incremental_got_plt section.
6568         (Got_plt_view_info): New struct.
6569         (Local_got_offset_visitor): New class.
6570         (Global_got_offset_visitor): New class.
6571         (Global_symbol_visitor_got_plt): New class.
6572         (Output_section_incremental_inputs::write_got_plt): New function.
6573         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6574         Add parameter.  Adjust all callers.
6575         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6576         (Incremental_inputs::got_plt_section): New function.
6577         (Incremental_inputs::got_plt_section_): New data member.
6578         (Incremental_got_plt_reader): New class.
6579         * layout.cc (Layout::create_incremental_info_sections): Add the
6580         incremental_got_plt section.
6581         * object.h (Got_offset_list::get_list): New function.
6582         (Got offset_list::for_all_got_offsets): New function.
6583         (Sized_relobj::local_got_offset_list): New function.
6584         * powerpc.cc (Target_powerpc::got_size): Add const.
6585         (Target_powerpc::got_entry_count): New function.
6586         (Target_powerpc::plt_entry_count): New function.
6587         (Target_powerpc::first_plt_entry_offset): New function.
6588         (Target_powerpc::plt_entry_size): New function.
6589         (Output_data_plt_powerpc::entry_count): New function.
6590         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6591         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6592         * sparc.cc (Target_sparc::got_size): Add const.
6593         (Target_sparc::got_entry_count): New function.
6594         (Target_sparc::plt_entry_count): New function.
6595         (Target_sparc::first_plt_entry_offset): New function.
6596         (Target_sparc::plt_entry_size): New function.
6597         (Output_data_plt_sparc::entry_count): New function.
6598         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6599         (Output_data_plt_sparc::get_plt_entry_size): New function.
6600         * symtab.h (Symbol::got_offset_list): New function.
6601         (Symbol_table::for_all_symbols): New function.
6602         * target.h (Sized_target::got_entry_count): New function.
6603         (Sized_target::plt_entry_count): New function.
6604         (Sized_target::plt_entry_size): New function.
6605         * x86_64.cc (Target_x86_64::got_size): Add const.
6606         (Target_x86_64::got_entry_count): New function.
6607         (Target_x86_64::plt_entry_count): New function.
6608         (Target_x86_64::first_plt_entry_offset): New function.
6609         (Target_x86_64::plt_entry_size): New function.
6610         (Output_data_plt_x86_64::entry_count): New function.
6611         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6612         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6613
6614 2010-08-12  Cary Coutant  <ccoutant@google.com>
6615
6616         * archive.cc: Include incremental.h.
6617         (Archive::Archive): Initialize incremental_info_.
6618         (Archive::include_member): Record archive members in incremental info.
6619         (Add_archive_symbols::run): Record begin and end of an archive in
6620         incremental info.
6621         (Lib_group::include_member): Record objects in incremental info.
6622         * archive.h (Incremental_archive_entry): Forward declaration.
6623         (Archive::set_incremental_info): New member function.
6624         (Archive::incremental_info): New member function.
6625         (Archive::Unused_symbol_iterator): New class.
6626         (Archive::unused_symbols_begin): New member function.
6627         (Archive::unused_symbols_end): New member function.
6628         (Archive::incremental_info_): New data member.
6629         * incremental-dump.cc (find_input_containing_global): New function.
6630         (dump_incremental_inputs): Dump new incremental info sections.
6631         * incremental.cc: Include symtab.h.
6632         (Output_section_incremental_inputs): New class.
6633         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6634         new incremental info sections.
6635         (Sized_incremental_binary::do_check_inputs): Likewise.
6636         (Incremental_inputs::report_archive): Remove.
6637         (Incremental_inputs::report_archive_begin): New function.
6638         (Incremental_inputs::report_archive_end): New function.
6639         (Incremental_inputs::report_object): New function.
6640         (Incremental_inputs::finalize_inputs): Remove.
6641         (Incremental_inputs::report_input_section): New function.
6642         (Incremental_inputs::report_script): Rewrite.
6643         (Incremental_inputs::finalize): Do nothing but finalize string table.
6644         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6645         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6646         (Incremental_inputs::create_data_sections): New function.
6647         (Incremental_inputs::relocs_entsize): New function.
6648         (Output_section_incremental_inputs::set_final_data_size): New function.
6649         (Output_section_incremental_inputs::do_write): New function.
6650         (Output_section_incremental_inputs::write_header): New function.
6651         (Output_section_incremental_inputs::write_input_files): New function.
6652         (Output_section_incremental_inputs::write_info_blocks): New function.
6653         (Output_section_incremental_inputs::write_symtab): New function.
6654         * incremental.h (Incremental_script_entry): Forward declaration.
6655         (Incremental_object_entry): Forward declaration.
6656         (Incremental_archive_entry): Forward declaration.
6657         (Incremental_inputs): Forward declaration.
6658         (Incremental_inputs_header_data): Remove.
6659         (Incremental_inputs_header): Remove.
6660         (Incremental_inputs_header_write): Remove.
6661         (Incremental_inputs_entry_data): Remove.
6662         (Incremental_inputs_entry): Remove.
6663         (Incremental_inputs_entry_write): Remove.
6664         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6665         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6666         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6667         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6668         Likewise.
6669         (Incremental_input_entry): New class.
6670         (Incremental_script_entry): New class.
6671         (Incremental_object_entry): New class.
6672         (Incremental_archive_entry): New class.
6673         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6674         (Incremental_inputs::report_inputs): Remove.
6675         (Incremental_inputs::report_archive): Remove.
6676         (Incremental_inputs::report_archive_begin): New function.
6677         (Incremental_inputs::report_archive_end): New function.
6678         (Incremental_inputs::report_object): Change prototype.
6679         (Incremental_inputs::report_input_section): New function.
6680         (Incremental_inputs::report_script): Change prototype.
6681         (Incremental_inputs::get_reloc_count): New function.
6682         (Incremental_inputs::set_reloc_count): New function.
6683         (Incremental_inputs::create_data_sections): New function.
6684         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6685         (Incremental_inputs::inputs_section): New function.
6686         (Incremental_inputs::symtab_section): New function.
6687         (Incremental_inputs::relocs_section): New function.
6688         (Incremental_inputs::get_stringpool): Add const.
6689         (Incremental_inputs::command_line): Add const.
6690         (Incremental_inputs::inputs): Remove.
6691         (Incremental_inputs::command_line_key): New function.
6692         (Incremental_inputs::input_file_count): New function.
6693         (Incremental_inputs::input_files): New function.
6694         (Incremental_inputs::relocs_entsize): New function.
6695         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6696         (Incremental_inputs::finalize_inputs): Remove.
6697         (Incremental_inputs::Input_info): Remove.
6698         (Incremental_inputs::lock_): Remove.
6699         (Incremental_inputs::inputs_): Change type.
6700         (Incremental_inputs::inputs_map_): Remove.
6701         (Incremental_inputs::current_object_entry_): New data member.
6702         (Incremental_inputs::inputs_section_): New data member.
6703         (Incremental_inputs::symtab_section_): New data member.
6704         (Incremental_inputs::relocs_section_): New data member.
6705         (Incremental_inputs::reloc_count_): New data member.
6706         (Incremental_inputs_reader): New class.
6707         (Incremental_symtab_reader): New class.
6708         (Incremental_relocs_reader): New class.
6709         * layout.cc (Layout::finalize): Move finalization of incremental info
6710         and creation of incremental info sections to follow finalization of
6711         symbol table.  Set offsets for postprocessing sections.
6712         (Layout::create_incremental_info_sections): Call
6713         Incremental_inputs::create_data_sections.  Add incremental symtab
6714         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6715         sections to layout after input sections.
6716         * layout.h (struct Timespec): Forward declaration.
6717         (Layout::incremental_inputs): Add const.
6718         (Layout::create_incremental_info_sections): Add parameter.
6719         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6720         * object.cc: Include incremental.h.
6721         (Relobj::finalize_incremental_relocs): New function.
6722         (Sized_relobj::do_layout): Record input sections in incremental info.
6723         * object.h (Object::output_section): New function.
6724         (Object::output_section_offset): Moved from Relobj.
6725         (Object::get_incremental_reloc_base): New function.
6726         (Object::get_incremental_reloc_count): New function.
6727         (Object::do_output_section): New function.
6728         (Object::do_output_section_offset): Moved from Relobj.
6729         (Object::do_get_incremental_reloc_base): New function.
6730         (Object::do_get_incremental_reloc_count): New function.
6731         (Object::Object): Initialize new data members.
6732         (Relobj::output_section): Renamed do_output_section and moved to
6733         protected.
6734         (Relobj::output_section_offset): Moved to Object.
6735         (Relobj::do_get_incremental_reloc_base): New function.
6736         (Relobj::do_get_incremental_reloc_count): New function.
6737         (Relobj::allocate_incremental_reloc_counts): New function.
6738         (Relobj::count_incremental_reloc): New function.
6739         (Relobj::finalize_incremental_relocs): New function.
6740         (Relobj::next_incremental_reloc_index): New function.
6741         (Relobj::reloc_counts_): New data member.
6742         (Relobj::reloc_bases_): New data member.
6743         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6744         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6745         (Sized_relobj::incremental_relocs_scan): New function.
6746         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6747         (Sized_relobj::incremental_relocs_write): New function.
6748         (Sized_relobj::incremental_relocs_write_reltype): New function.
6749         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6750         incremental link.
6751         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6752         archives and object files elsewhere.
6753         (Add_symbols::run): Report object files here.
6754         (Finish_group::run): Report end of archive at end of group.
6755         * reloc.cc: Include layout.h, incremental.h.
6756         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6757         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6758         (Sized_relobj::incremental_relocs_scan): New function.
6759         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6760         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6761         (Sized_relobj::incremental_relocs_write): New function.
6762         (Sized_relobj::incremental_relocs_write_reltype): New function.
6763         * script.cc (read_input_script): Rewrite test for incremental link.
6764         Change call to Incremental_inputs::report_script.
6765         * symtab.h (Symbol_table::first_global_index): New function.
6766         (Symbol_table::output_count): New function.
6767
6768 2010-08-12  Doug Kwan  <dougkwan@google.com>
6769
6770         * arm.cc (Target_arm::merge_object_attributes): Check command line
6771         options --no-wchar-size-warning and --no-enum-size-warning.
6772         * options.h (General_options): Add ld-compatible options
6773         --no-enum-size-warning and --no-wchar-size-warning.
6774
6775 2010-08-04  Ian Lance Taylor  <iant@google.com>
6776
6777         * x86_64.cc (Target_x86_64::Scan::local): Use
6778         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6779         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6780         (Target_x86_64::Scan::global): Likewise.
6781         (Target_x86_64::Relocate::relocate): Likewise.
6782         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6783         Likewise.
6784
6785 2010-08-03  Cary Coutant  <ccoutant@google.com>
6786
6787         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6788         to reserve space in merged_strings vector. Keep total input size
6789         for stats.
6790         (Output_merge_string::do_print_merge_stats): Print total input size.
6791         * merge.h (Output_merge_string): Add input_size_ field.
6792         * stringpool.cc (Stringpool_template::string_length): Move
6793         implementations out of Stringpool_template class and place in
6794         stringpool.h.
6795         * stringpool.h (string_length): Move out of Stringpool_template.
6796
6797 2010-08-03  Ian Lance Taylor  <iant@google.com>
6798
6799         PR 11712
6800         * layout.cc (relaxation_loop_body): If address of load segment is
6801         set, adjust address to include headers if possible.
6802
6803 2010-08-03  Ian Lance Taylor  <iant@google.com>
6804
6805         * version.cc (version_string): Bump to 1.10.
6806
6807 2010-08-03  Ian Lance Taylor  <iant@google.com>
6808
6809         PR 11805
6810         * layout.h (enum Output_section_order): Define.
6811         (class Layout): Update declarations.
6812         * layout.cc (Layout::get_output_section): Add order parameter.
6813         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6814         is_first_non_relro parameters.  Change all callers.
6815         (Layout::choose_output_section): Likewise.
6816         (Layout::add_output_section_data): Likewise.
6817         (Layout::make_output_section): Likewise.  Set order.
6818         (Layout::default_section_order): New function.
6819         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6820         * output.cc (Output_section::Output_section): Initialize order_.
6821         Don't initialize deleted fields.
6822         (Output_segment::Output_segment): Don't initialize deleted
6823         fields.
6824         (Output_segment::add_output_section_to_load): New function
6825         replacing add_output_section.  Change all callers to call this or
6826         add_output_section_to_nonload.
6827         (Output_segment::add_output_section_to_nonload): New function.
6828         (Output_segment::remove_output_section): Rewrite.
6829         (Output_segment::add_initial_output_data): Likewise.
6830         (Output_segment::has_any_data_sections): Likewise.
6831         (Output_segment::is_first_section_relro): Likewise.
6832         (Output_segment::maximum_alignment): Likewise.
6833         (Output_segment::has_dynamic_reloc): New function replacing
6834         dynamic_reloc_count.  Change all callers.
6835         (Output_segment::has_dynamic_reloc_list): New function replacing
6836         dynamic_reloc_count_list.  Change all callers.
6837         (Output_segment::set_section_addresses): Rewrite.
6838         (Output_segment::set_offset): Rewrite.
6839         (Output_segment::find_first_and_last_list): Remove.
6840         (Output_segment::set_tls_offsets): Rewrite.
6841         (Output_segment::first_section_load_address): Likewise.
6842         (Output_segment::output_section_count): Likewise.
6843         (Output_segment::section_with_lowest_load_address): Likewise.
6844         (Output_segment::write_section_headers): Likewise.
6845         (Output_segment::print_sections_to_map): Likewise.
6846         * output.h (class Output_data): Remove dynamic_reloc_count_
6847         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6848         (Output_data::add_dynamic_reloc): Rewrite.
6849         (Output_data::has_dynamic_reloc): New function.
6850         (Output_data::dynamic_reloc_count): Remove.
6851         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6852         is_last_relro_, is_first_non_relro_, is_interp_,
6853         is_dynamic_linker_section_ fields.  Add order and set_order
6854         functions.  Remove is_relro_local, set_is_relro_local,
6855         is_last_relro, set_is_last_relro, is_first_non_relro,
6856         set_is_first_non_relro functions, is_interp, set_is_interp,
6857         is_dynamic_linker_section, and set_is_dynamic_linker_section
6858         functions.
6859         (class Output_segment): Change Output_data_list from std::list to
6860         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6861         output_bss_ fields.  Update declarations.
6862
6863 2010-08-02  Ian Lance Taylor  <iant@google.com>
6864
6865         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6866         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6867         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6868
6869 2010-08-02  Ian Lance Taylor  <iant@google.com>
6870
6871         PR 11855
6872         * script.cc (Script_options::Script_options): Initialize
6873         symbol_definitions_ and symbol_references_.
6874         (Script_options::add_symbol_assignment): Update
6875         symbol_definitions_ and symbol_references_.
6876         (Script_options::add_symbol_reference): New function.
6877         (script_symbol): New function.
6878         * script.h (class Script_options): Add symbol_definitions_ and
6879         symbol_references_ fields.
6880         (Script_options::referenced_const_iterator): New type.
6881         (Script_options::referenced_begin): New function.
6882         (Script_options::referenced_end): New function.
6883         (Script_options::is_referenced): New function.
6884         (Script_options::any_unreferenced): New function.
6885         * script-c.h (script_symbol): Declare.
6886         * yyscript.y (exp): Call script_symbol.
6887         * symtab.cc: Include "script.h".
6888         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6889         Change all callers.  Check symbols referenced by scripts.
6890         (Symbol_table::add_undefined_symbols_from_command_line): Add
6891         layout parameter.  Change all callers.
6892         (Symbol_table::do_add_undefined_symbols_from_command_line):
6893         Likewise.  Break out loop body.  Check symbols referenced by
6894         scripts.
6895         (Symbol_table::add_undefined_symbol_from_command_line): New
6896         function broken out of
6897         do_add_undefined_symbols_from_command_line.
6898         * symtab.h (class Symbol_table): Update declarations.
6899         * archive.cc: Include "layout.h".
6900         (Archive::should_include_member): Add layout parameter.  Change
6901         all callers.  Check for symbol mentioned in expression.
6902         * archive.h (class Archive): Update declaration.
6903         * object.cc (Sized_relobj::do_should_include_member): Add layout
6904         parameter.
6905         * object.h (Object::should_include_member): Add layout parameter.
6906         Change all callers.
6907         (Object::do_should_include_member): Add layout parameter.
6908         (class Sized_relobj): Update declaration.
6909         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
6910         parameter.
6911         * dynobj.h (class Sized_dynobj): Update declaration.
6912         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
6913         layout parameter.
6914         * plugin.h (class Sized_pluginobj): Update declaration.
6915
6916 2010-08-02  Ian Lance Taylor  <iant@google.com>
6917
6918         PR 11866
6919         * output.cc (Output_segment::set_offset): Search for the first and
6920         last sections rather than assuming that the list is in order.
6921         (Output_segment::find_first_and_last_list): New function.
6922         * output.h (class Output_segment): Update declarations.
6923         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
6924         (relro_strip_test_SOURCES): New variable.
6925         (relro_strip_test_DEPENDENCIES): New variable.
6926         (relro_strip_test_LDFLAGS): New variable.
6927         (relro_strip_test_LDADD): New variable.
6928         (relro_strip_test.so): New target.
6929
6930 2010-08-02  Ian Lance Taylor  <iant@google.com>
6931
6932         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
6933         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
6934         (Target_i386::got_tlsdesc_section): New function.
6935         (Target_i386::got_section): Create space for GOT entries for
6936         TLSDESC relocations.
6937         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
6938         R_386_TLS_GOTDESC.
6939         (Target_i386::Scan::global): Likewise.
6940         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
6941         using TLSDESC GOT.
6942         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
6943         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
6944         (Target_x86_64::got_tlsdesc_section): New function.
6945         (Target_x86_64::got_section): Create space for GOT entries for
6946         TLSDESC relocations.
6947         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
6948         R_386_TLS_GOTDESC.
6949         (Target_x86_64::Scan::global): Likewise.
6950         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
6951         using TLSDESC GOT.
6952
6953 2010-08-02  Ian Lance Taylor  <iant@google.com>
6954
6955         * testsuite/final_layout.sh: Use dc to convert from hex to
6956         decimal.
6957
6958 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
6959
6960         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
6961         paramter to the call to gold::gc_process_relocs.
6962         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
6963         paramter to the call to gold::gc_process_relocs.
6964         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
6965         parameter to the call to gold::gc_process_relocs.
6966         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
6967         template parameter to the call to gold::gc_process_relocs.
6968         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
6969         paramter to the call to gold::gc_process_relocs.
6970         * gc.h (get_embedded_addend_size): New function.
6971         (gc_process_relocs): Save the size of the reloc for use by ICF.
6972         * icf.cc (get_section_contents): Get the addend from the text section
6973         for SHT_REL relocation sections.
6974         * icf.h (Icf::Reloc_addend_size_info): New typedef.
6975         (Icf::Reloc_info): Add new member reloc_addend_size_info.
6976         * int_encoding.h (read_from_pointer): New overloaded function.
6977         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
6978         * testsuite/icf_sht_rel_addend_test.sh: New file.
6979         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
6980         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
6981
6982 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6983
6984         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
6985         * Makefile.in: Regenerate.
6986         * testsuite/Makefile.in: Regenerate.
6987
6988 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
6989
6990         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
6991         * gold/testsuite/debug_msg.cc: Likewise.
6992         * gold/testsuite/odr_violation1.cc
6993         * gold/testsuite/odr_violation2.cc
6994
6995 2010-07-21  Cary Coutant  <ccoutant@google.com>
6996
6997         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
6998         string, and length fields.
6999         (Output_merge_string::Merged_strings_list): New type.
7000         (Output_merge_string::Merged_strings_lists): New typedef.
7001         (Output_merge_string): Replace merged_strings_ with
7002         merged_strings_lists_.
7003         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7004         Merged_strings_list per input object and section.  Don't store pointer
7005         to the string.  Don't store length with each merged string entry.
7006         (Output_merge_string::finalize_merged_data): Loop over list of merged
7007         strings lists.  Recompute length of each merged string.
7008
7009 2010-07-15  Cary Coutant  <ccoutant@google.com>
7010
7011         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7012         here.
7013
7014 2010-07-14  Ian Lance Taylor  <iant@google.com>
7015
7016         * descriptors.cc (Descriptors::open): Report correct name in error
7017         message.
7018
7019 2010-07-13  Doug Kwan  <dougkwan@google.com>
7020
7021         * arm.cc (Arm_input_section::Arm_input_section): For a
7022         SHT_ARM_EXIDX section, always keeps the input sections.
7023         (Arm_input_section::set_exidx_section_link): New method.
7024         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7025         has_errors_ to false.
7026         (Arm_exidx_input_section::has_errors,
7027         Arm_exidx_input_section::set_has_errors): New methods.
7028         (Arm_exidx_input_section::has_errors_): New data member.
7029         (Arm_relobj::get_exidx_shndx_list): New method.
7030         (Arm_output_section::append_text_sections_to_list): Do not skip
7031         section without SHF_EXECINSTR.
7032         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7033         errors.
7034         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7035         section header.  Make error messages more verbose.  Check for
7036         a non-executable section linked to an EXIDX section.
7037         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7038         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7039         check that there is no deferred EXIDX section if we exit early.
7040         Instead of not making an EXIDX section in case of an error, make one
7041         and set the has_errors flag of it.
7042         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7043         in a relocatable link.
7044         (Target_arm::do_relax): Look for the EXIDX output section instead of
7045         assuming that it is called .ARM.exidx.
7046         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7047         section list.  Do not check for SHF_EXECINSTR section flags but
7048         skip any input section with errors.
7049         * output.cc (Output_section::Output_section): Initialize
7050         always_keeps_input_sections_ to false.
7051         (Output_section::add_input_section): Check for
7052         always_keeps_input_sections_.
7053         *  output.h (Output_section::always_keeps_input_sections,
7054         Output_section::set_always_keeps_input_sections): New methods.
7055         (Output_section::always_keeps_input_sections): New data member.
7056
7057 2010-07-13  Rafael Espindola  <espindola@google.com>
7058
7059         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7060         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7061
7062 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7063             Ian Lance Taylor  <iant@google.com>
7064
7065         * output.h (Output_section_lookup_maps::add_merge_section):
7066         Correct check of whether value was inserted.
7067         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7068         (Output_section_lookup_maps::add_relaxed_input_section):
7069         Likewise.
7070         * arm.cc (Target_arm::got_section): Remove used local os.
7071         * i386.cc (Target_i386::got_section): Likewise.
7072         * x86_64.cc (Target_x86_64::got_section): Likewise.
7073         * sparc.cc (Target_sparc::got_section): Likewise.
7074         (Target_sparc::relocate): Remove unused local have_got_offset.
7075         * powerpc.cc (Target_powerpc::relocate): Likewise.
7076
7077 2010-07-13  Ian Lance Taylor  <iant@google.com>
7078
7079         * compressed_output.cc (zlib_decompress): Fix signature in
7080         !HAVE_ZLIB_H case.
7081
7082         * archive.cc (Archive::include_member): Unlock an external member
7083         of a thin archive.  Don't bother to delete an object we know is
7084         NULL.
7085
7086 2010-07-12  Cary Coutant  <ccoutant@google.com>
7087
7088         * compressed_output.cc (zlib_decompress): New function.
7089         (get_uncompressed_size): New function.
7090         (decompress_input_section): New function.
7091         * compressed_output.h (get_uncompressed_size): New function.
7092         (decompress_input_section): New function.
7093         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7094         Handle compressed debug sections.
7095         * layout.cc (is_compressed_debug_section): New function.
7096         (Layout::output_section_name): Map compressed section names to
7097         canonical names.
7098         * layout.h (is_compressed_debug_section): New function.
7099         (is_debug_info_section): Recognize compressed debug sections.
7100         * merge.cc: Include compressed_output.h.
7101         (Output_merge_data::do_add_input_section): Handle compressed
7102         debug sections.
7103         (Output_merge_string::do_add_input_section): Handle compressed
7104         debug sections.
7105         * object.cc: Include compressed_output.h.
7106         (Sized_relobj::Sized_relobj): Initialize new data members.
7107         (build_compressed_section_map): New function.
7108         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7109         * object.h (Object::section_is_compressed): New method.
7110         (Object::do_section_is_compressed): New method.
7111         (Sized_relobj::Compressed_section_map): New type.
7112         (Sized_relobj::do_section_is_compressed): New method.
7113         (Sized_relobj::compressed_sections_): New data member.
7114         * output.cc (Output_section::add_input_section): Handle compressed
7115         debug sections.
7116         * reloc.cc: Include compressed_output.h.
7117         (Sized_relobj::write_sections): Handle compressed debug sections.
7118
7119 2010-07-08  Cary Coutant  <ccoutant@google.com>
7120
7121         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7122         weak when resolving to a dynamic def.
7123         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7124         for weak undef/dynamic def cases. Adjust callers.
7125         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7126         undef_binding_weak_.
7127         (Symbol_table::sized_write_globals): Adjust symbol binding.
7128         (Symbol_table::sized_write_symbol): Add binding parameter.
7129         * symtab.h (Symbol::set_undef_binding): New method.
7130         (Symbol::is_undef_binding_weak): New method.
7131         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7132         (Symbol_table::should_override): Add new parameter.
7133         (Symbol_table::sized_write_symbol): Add new parameter.
7134
7135         * testsuite/weak_undef_file1.cc: Add new test case.
7136         * testsuite/weak_undef_file2.cc: Fix header comment.
7137         * testsuite/weak_undef_test.cc: Add new test case.
7138
7139 2010-06-29  Doug Kwan  <dougkwan@google.com>
7140
7141         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7142         Initialize USE_SYMBOL_.
7143         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7144         definition.
7145         (Arm_reloc_property::uses_symbol_): New data member declaration.
7146         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7147         uses symbol value and symbol is undefined but not weakly undefined.
7148
7149 2010-06-28  Rafael Espindola  <espindola@google.com>
7150
7151         * plugin.cc (Plugin::load): Use dlerror.
7152
7153 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7154
7155         * symtab.cc (detect_odr_violations): When reporting an ODR
7156         violation, report an object where the symbol is defined.
7157
7158 2010-06-25  Doug Kwan  <dougkwan@google.com>
7159
7160         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7161         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7162         definition.
7163         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7164         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7165         target hook to detect function points.
7166         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7167         * icf.h (Icf::check_section_for_function_pointers): Change type of
7168         parameter SECTION_NAME to const reference to std::string.  Use
7169         target hook to determine if section may have unsafe pointers.
7170         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7171         method definition.
7172
7173 2010-06-21  Rafael Espindola  <espindola@google.com>
7174
7175         * fileread.cc (Input_file::find_fie): New
7176         (Input_file::open): Use Input_file::find_fie.
7177         * fileread.h (Input_file::find_fie): New
7178         * plugin.cc (set_extra_library_path): New.
7179         (Plugin::load): Add set_extra_library_path to the transfer vector.
7180         (Plugin_manager::set_extra_library_path): New.
7181         (Plugin_manager::add_input_file): Use the extra search path if set.
7182         (set_extra_library_path(): New.
7183         * plugin.h (Plugin_manager): Add set_extra_library_path and
7184         extra_search_path_.
7185
7186 2010-06-19  Cary Coutant  <ccoutant@google.com>
7187
7188         * layout.cc (gdb_sections): Add .debug_types.
7189         (lines_only_debug_sections): Likewise.
7190
7191 2010-06-18  Rafael Espindola  <espindola@google.com>
7192
7193         * plugin.cc (add_input_file,add_input_library)
7194         (Plugin_manager::add_input_file): Make filename arguments const.
7195         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7196         const.
7197
7198 2010-06-16  Doug Kwan  <dougkwan@google.com>
7199
7200         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7201         .ARM.attributes section if we have not merged any input
7202         attributes sections.
7203
7204 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7205
7206         * arm.cc: Allow combining objects with no EABI version
7207         information.
7208
7209 2010-06-15  Rafael Espindola  <espindola@google.com>
7210
7211         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7212
7213 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7214
7215         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7216         (struct iovec): Correct !HAVE_READV definition.
7217
7218 2010-06-10  Cary Coutant  <ccoutant@google.com>
7219
7220         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7221         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7222         reloc sections.
7223         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7224
7225         PR 11683
7226         * symtab.h (Symbol::is_placeholder): New member function.
7227         * target-reloc.h (relocate_section): Check for placeholder symbols.
7228
7229         * testsuite/Makefile.am (plugin_test_8): New test.
7230         (plugin_test_9): New test.
7231         * testsuite/Makefile.in: Regenerate.
7232
7233 2010-06-09  Nick Clifton  <nickc@redhat.com>
7234
7235         * yyscript.y (input_list_element): Allow strings prefixed with
7236         the '-' character.  Treat these as libraries.
7237         * script.cc (script_add_library): New function.  Adds a library
7238         specified by "-l<name>" found in an input script.
7239         * script-c.h: Add prototype for script_add_library.
7240
7241 2010-06-07  Doug Kwan  <dougkwan@google.com>
7242
7243         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7244         Restrict stub-group size to be within long conditional branch
7245         range when working around cortex-A8 erratum.
7246
7247 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7248
7249         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7250         #ifdef typo.
7251
7252 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7253
7254         PR gold/11658
7255         * output.cc
7256         (Output_section::Input_section_sort_entry::compare_section_ordering):
7257         Change to return non-zero correctly.
7258         (Output_section::Input_section_sort_section_order_index_compare
7259         ::operator()): Change to fix ambiguity in comparisons.
7260
7261 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7262
7263         * gold.h (is_wildcard_string): New function.
7264         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7265         (Layout::layout_eh_frame): Ditto.
7266         (Layout::find_section_order_index): New method.
7267         (Layout::read_layout_from_file): New method.
7268         * layout.h (Layout::find_section_order_index): New method.
7269         (Layout::read_layout_from_file): New method.
7270         (Layout::input_section_position_): New private member.
7271         (Layout::input_section_glob_): New private member.
7272         * main.cc (main): Call read_layout_from_file here.
7273         * options.h (--section-ordering-file): New option.
7274         * output.cc (Output_section::input_section_order_specified_): New
7275         member.
7276         (Output_section::Output_section): Initialize new member.
7277         (Output_section::add_input_section): Add new parameter.
7278         Keep input sections when --section-ordering-file is used.
7279         (Output_section::set_final_data_size): Sort input sections when
7280         section ordering file is specified.
7281         (Output_section::Input_section_sort_entry): Add new parameter.
7282         Check sorting type.
7283         (Output_section::Input_section_sort_entry::compare_section_ordering):
7284         New method.
7285         (Output_section::Input_section_sort_compare::operator()): Change to
7286         consider section_order_index.
7287         (Output_section::Input_section_sort_init_fini_compare::operator()):
7288         Change to consider section_order_index.
7289         (Output_section::Input_section_sort_section_order_index_compare
7290         ::operator()): New method.
7291         (Output_section::sort_attached_input_sections): Change to sort
7292         according to section order when specified.
7293         (Output_section::add_input_section<32, true>): Add new parameter.
7294         (Output_section::add_input_section<64, true>): Add new parameter.
7295         (Output_section::add_input_section<32, false>): Add new parameter.
7296         (Output_section::add_input_section<64, false>): Add new parameter.
7297         * output.h (Output_section::add_input_section): Add new parameter.
7298         (Output_section::input_section_order_specified): New
7299         method.
7300         (Output_section::set_input_section_order_specified): New method.
7301         (Input_section::Input_section): Initialize section_order_index_.
7302         (Input_section::section_order_index): New method.
7303         (Input_section::set_section_order_index): New method.
7304         (Input_section::section_order_index_): New member.
7305         (Input_section::Input_section_sort_section_order_index_compare): New
7306         struct.
7307         (Output_section::input_section_order_specified_): New member.
7308         * script-sections.cc (is_wildcard_string): Delete and move modified
7309         method to gold.h.
7310         (Output_section_element_input::Output_section_element_input): Modify
7311         call to is_wildcard_string.
7312         (Output_section_element_input::Input_section_pattern
7313         ::Input_section_pattern): Ditto.
7314         (Output_section_element_input::Output_section_element_input): Ditto.
7315         * testsuite/Makefile.am (final_layout): New test case.
7316         * testsuite/Makefile.in: Regenerate.
7317         * testsuite/final_layout.cc: New file.
7318         * testsuite/final_layout.sh: New file.
7319
7320 2010-06-01  Rafael Espindola  <espindola@google.com>
7321
7322         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7323
7324 2010-06-01  Rafael Espindola  <espindola@google.com>
7325
7326         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7327         visibility of symbols.
7328
7329 2010-05-27  Doug Kwan  <dougkwan@google.com>
7330
7331         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7332         from start of output section instead of address for a local symbol
7333         in a merged or relaxed section when doing a relocatable link.
7334
7335 2010-05-26  Rafael Espindola  <espindola@google.com>
7336
7337         PR 11604
7338         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7339         adding sections the garbage collector removed.
7340         * gold/testsuite/Makefile.am: Add test.
7341         * gold/testsuite/Makefile.in: Regenerate.
7342         * gold/testsuite/plugin_test_7.sh: New.
7343         * gold/testsuite/plugin_test_7_1.c: New.
7344         * gold/testsuite/plugin_test_7_2.c: New.
7345
7346 2010-05-26  Rafael Espindola  <espindola@google.com>
7347
7348         * script-sections.cc (Output_section_definition::set_section_addresses):
7349         Check for --section-start.
7350
7351 2010-05-26  Doug Kwan  <dougkwan@google.com>
7352
7353         * arm.cc (Arm_scan_relocatable_relocs): New class.
7354         (Target_arm::relocate_special_relocatable): New method.
7355         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7356         (Arm_relocate_functions::thumb_branch_common): Same.
7357         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7358         instead of Default_scan_relocatable_relocs.
7359         * target-reloc.h (relocate_for_relocatable): Let target handle
7360         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7361         * target.h (Sized_target::relocate_special_relocatable): New method.
7362
7363 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7364
7365         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7366
7367 2010-05-23  Doug Kwan  <dougkwan@google.com>
7368
7369         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7370         instead of a cast.
7371         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7372         with a direct branch, not a conditional branch, to a stub.
7373         * merge.cc (Output_merge_base::record_input_section): New method
7374         defintion.
7375         (Output_merge_data::do_add_input_section): Record input section if
7376         keeps-input-sections flag is set.
7377         (Output_merge_string::do_add_input_section): Ditto.
7378         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7379         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7380         INPUT_SECTIONS_.
7381         (Output_merge_base::keeps_input_sections,
7382         Output_merge_base::set_keeps_input_sections,
7383         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7384         method definitions.
7385         (Output_merge_base::Input_sections): New type declaration.
7386         (Output_merge_base::input_sections_begin,
7387         Output_merge_base::input_sections_end,
7388         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7389         (Output_merge_base::bool keeps_input_sections_,
7390         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7391         Output_merge_base::input_sections_): New data members.
7392         (Output_merge_data::do_set_keeps_input_sections): New method
7393         defintion.
7394         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7395         * output.cc (Output_section::Input_section::relobj): Move method
7396         defintion from class declaration to here and handle merge sections.
7397         (Output_section::Input_section::shndx): Ditto.
7398         (Output_section::Output_section): Remove initializations of removed
7399         data members and initialize new data member LOOKUP_MAPS_.
7400         (Output_section::add_input_section): Set keeps-input-sections flag
7401         for a newly created merge output section as appropriate.  Adjust code
7402         to use Output_section_lookup_maps class.
7403         (Output_section::add_relaxed_input_section): Adjst code for lookup
7404         maps code refactoring.
7405         (Output_section::add_merge_input_section): Add a new parameter
7406         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7407         class.  If adding input section to a newly created merge output
7408         section fails, remove the new merge section.
7409         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7410         Adjust code for use of the Output_section_lookup_maps class.
7411         (Output_section::find_merge_section): Ditto.
7412         (Output_section::build_lookup_maps): New method defintion.
7413         (Output_section::find_relaxed_input_section): Adjust code to use
7414         Output_section_lookup_maps class.
7415         (Output_section::get_input_sections): Export merge sections.  Adjust
7416         code to use Output_section_lookup_maps class.
7417         (Output_section:::add_script_input_section): Adjust code to use
7418         Output_section_lookup_maps class.  Update lookup maps for merge
7419         sections also.
7420         (Output_section::discard_states): Use Output_section_lookup_maps.
7421         (Output_section::restore_states): Same.
7422         * output.h (Merge_section_properties): Move class defintion out of
7423         Output_section.
7424         (Output_section_lookup_maps): New class.
7425         (Output_section::Input_section::is_merge_section): New method
7426         defintion.
7427         (Output_section::Input_section::relobj): Move defintion out of class
7428         defintion.  Declare method only.
7429         (Output_section::Input_section::shndx): Ditto.
7430         (Output_section::Input_section::output_merge_base): New method defintion.
7431         (Output_section::Input_section::u2_.pomb): New union field.
7432         (Output_section::Merge_section_by_properties_map,
7433         Output_section::Output_section_data_by_input_section_map,
7434         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7435         Remove types.
7436         (Output_section::add_merge_input_section): Add new parameter
7437         KEEPS_INPUT_SECTIONS.
7438         (Output_section::build_lookup_maps): New method declaration.
7439         (Output_section::merge_section_map_,
7440         Output_section::merge_section_by_properties_map_,
7441         Output_section::relaxed_input_section_map_,
7442         Output_section::is_relaxed_input_section_map_valid_): Remove data
7443         members.
7444         (Output_section::lookup_maps_): New data member.
7445
7446 2010-05-21  Doug Kwan  <dougkwan@google.com>
7447
7448         PR gold/11619
7449         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7450         avoid a compilation error.
7451
7452 2010-05-19  Rafael Espindola  <espindola@google.com>
7453
7454         * script-sections.cc (Output_section_definition::allocate_to_segment):
7455         Update the phdrs_list even when the output section is NULL.
7456         * testsuite/Makefile.am: Add test.
7457         * testsuite/Makefile.in: Regenerate.
7458         * testsuite/script_test_9.cc: New.
7459         * testsuite/script_test_9.sh: New.
7460         * testsuite/script_test_9.t: New.
7461
7462 2010-05-19  Doug Kwan  <dougkwan@google.com>
7463
7464         * arm.cc (Arm_input_section::original_size): New method.
7465         (Arm_input_section::do_addralign): Add a cast.
7466         (Arm_input_section::do_output_offset): Remove static cast.
7467         (Arm_input_section::original_addralign,
7468          Arm_input_section::original_size_): Change type to uint32_t.
7469         (Arm_input_section::init): Add safe casts for section alignment
7470         and size.
7471         (Arm_input_section::set_final_data_size): Do not set address and
7472         offset of stub table.
7473         (Arm_output_section::fix_exidx_coverage): Change use of of
7474         Output_section::Simple_input_section to that of
7475         Output_section::Input_section.
7476         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7477         except for the first pass.
7478         * output.cc (Output_section::get_input_sections): Change type of
7479         input_sections to std::list<Input_section>.
7480         (Output_section::add_script_input_section): Rename from
7481         Output_section::add_simple_input_section.  Change type of SIS
7482         parameter from Simple_input_section to Input_section.
7483         * output.h (Output_section::Simple_input_section): Remove class.
7484         (Output_section::Input_section): Change class visibility to public.
7485         (Output_section::Input_section::addralign): Use stored alignments
7486         for special input sections if set.
7487         (Output_section::Input_section::set_addralign): New method.
7488         (Output_section::get_input_sections): Change parameter type from
7489         list of Simple_input_section to list of Input_section.
7490         (Output_section::add_script_input_section): Rename from
7491         Output_section::add_simple_input_section. Change first parameter's
7492         type from Simple_input_section to Input_section and remove the
7493         second and third parameters.
7494         * script-sections.cc (Input_section::Input_section_list): Change
7495         type to list of Output_section::Input_section/
7496         (Input_section_info::Input_section_info): Change parameter type of
7497         INPUT_SECTION to Output_section::Input_section.
7498         (Input_section_info::input_section): Change return type.
7499         (Input_section_info::input_section_): Change type to
7500         Output_section::Input_section.
7501         (Output_section_element_input::set_section_addresses): Adjust code
7502         to use Output_section::Input_section instead of
7503         Output_section::Simple_input_section.  Adjust code for renaming
7504         of Output_section::add_simple_input_section.
7505         (Orphan_output_section::set_section_addresses): Ditto.
7506
7507 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7508
7509         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7510         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7511
7512 2010-05-18  Rafael Espindola  <espindola@google.com>
7513
7514         * options.cc (General_options::finalize): Handle -nostdlib.
7515         * options.h (nostdlib): New option.
7516         * script.cc (script_add_search_dir): Handle -nostdlib.
7517
7518 2010-05-12  Doug Kwan  <dougkwan@google.com>
7519
7520         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7521         attributes section only if there no attributes section after merging.
7522         (Target_arm::merge_object_attributes): Move value of
7523         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7524         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7525         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7526         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7527         and arm_attr_merge_7.stdout.
7528         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7529         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7530         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7531         arm_attr_merge_7b.o): New rules.
7532         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7533         arm_attr_merge_7
7534         * testsuite/Makefile.in: Regenerate.
7535         * testsuite/arm_attr_merge.sh: New file.
7536         * testsuite/arm_attr_merge_[67][ab].s: Same.
7537
7538 2010-05-05  Nick Clifton  <nickc@redhat.com>
7539
7540         * po/es.po: Updated Spanish translation.
7541
7542 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7543
7544         * Makefile.am (install-exec-local): Properly install gold as
7545         default cross linker.
7546         * Makefile.in: Regenerated.
7547
7548 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7549             Nick Clifton  <nickc@redhat.com>
7550
7551         * configure.ac (install_as_default): Define and set to false
7552         unless --enable-gold or --enable-gold=both/gold has been
7553         specified.
7554         * configure: Regenerate.
7555
7556         * Makefile.am (install-exec-local): Install the executable as
7557         'ld.gold'.  If install_as_default is true then also install it as
7558         'ld'.
7559         * Makefile.in: Regenerated.
7560
7561 2010-04-24  Ian Lance Taylor  <iant@google.com>
7562
7563         * layout.cc (Layout::layout_reloc): In relocatable link don't
7564         combine reloc sections for grouped sections.
7565
7566 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7567
7568         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7569         sections that are not ordinary to icf.
7570         * icf.cc (get_section_contents): Handle relocation pointing to section
7571         with no object or shndx information.
7572         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7573         * testsuite/Makefile.in: Regenerate.
7574         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7575         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7576
7577 2010-04-22  Ian Lance Taylor  <iant@google.com>
7578
7579         * expression.cc (Expression::Expression_eval_info): Add
7580         result_alignment_pointer field.
7581         (Expression::eval_with_dot): Add result_alignment_pointer
7582         parameter.  Change all callers.
7583         (Expression::eval_maybe_dot): Likewise.
7584         (class Binary_expression): Add alignment_pointer parameter to
7585         left_value and right_value.  Change all callers.
7586         (BINARY_EXPRESSION): Set result alignment.
7587         (class Trinary_expression): Add alignment_pointer parameter to
7588         arg2_value and arg3_value.  Change all callers.
7589         (Trinary_cond::value): Set result alignment.
7590         (Max_expression::value, Min_expression::value): Likewise.
7591         (Align_expression::value): Likewise.
7592         * script-sections.cc (class Sections_element): Add dot_alignment
7593         parameter to set_section_addresses virtual function.  Update
7594         instantiations.
7595         (class Output_section_element): Likewise.
7596         (Script_sections::create_segments): Add dot_alignment parameter.
7597         Change all callers.
7598         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7599         (Script_sections::set_phdrs_clause_addresses): Likewise.
7600         * script-sections.h: Update declarations.
7601         * script.h: Update declarations.
7602         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7603         min_p_align.
7604         * testsuite/script_test_3.t: Set large alignment.
7605         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7606         segment has expected alignment.
7607
7608 2010-04-22  Nick Clifton  <nickc@redhat.com>
7609
7610         * po/gold.pot: Updated by the Translation project.
7611         * po/vi.po: Updated Vietnamese translation.
7612
7613 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7614
7615         * testsuite/Makefile.am (check_PROGRAMS): Add
7616         icf_virtual_function_folding_test.
7617         * testsuite/Makefile.in: Regenerated.
7618
7619 2010-04-15  Andrew Haley  <aph@redhat.com>
7620
7621         * options.h (merge_exidx_entries): New option.
7622         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7623         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7624         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7625         (Target_arm::merge_exidx_entries): New function.
7626         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7627         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7628         to Arm_exidx_fixup constructor.
7629         Add new arg, merge_exidx_entries.
7630         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7631         Arm_output_section::fix_exidx_coverage.
7632
7633 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7634
7635         * icf.cc (get_section_contents): Check for preemptible functions.
7636         Ignore addend when appropriate.
7637         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7638         section folded.
7639         (add_from_relobj): Check for section folded.
7640         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7641         * symtab.h (should_add_dynsym_entry): Add new parameter.
7642         * target-reloc.h (scan_relocs): Check for section folded.
7643         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7644         Check reloc types for function pointers in shared objects.
7645         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7646         case.
7647         (icf_preemptible_functions_test): New test case.
7648         (icf_string_merge_test): New test case.
7649         * testsuite.Makefile.in: Regenerate.
7650         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7651         bar_glob.  Refactor code.
7652         * testsuite/icf_preemptible_functions_test.cc: New file.
7653         * testsuite/icf_preemptible_functions_test.sh: New file.
7654         * testsuite/icf_string_merge_test.cc: New file.
7655         * testsuite/icf_string_merge_test.sh: New file.
7656         * testsuite/icf_virtual_function_folding_test.cc: New file.
7657         * testsuite/icf_virtual_function_folding_test.sh: New file.
7658
7659 2010-04-14  Doug Kwan  <dougkwan@google.com>
7660
7661         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7662         for local symbol recounting if we remove a section due to ICF.
7663         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7664         there are no regular objects in input.
7665
7666 2010-04-13  Doug Kwan  <dougkwan@google.com>
7667
7668         * arm.cc (Arm_input_section::set_final_data_size): Compute
7669         accurate final data size instead of using current data size.
7670
7671 2010-04-09  Doug Kwan  <dougkwan@google.com>
7672
7673         * layout.cc (Layout::choose_output_section): Handle script section
7674         types.
7675         (Layout::make_output_section_for_script): Add section type parameter.
7676         Handle script section types.
7677         * layout.h (Layout::make_output_section_for_script): Add section
7678         type parameter.
7679         * output.cc (Output_section::Output_section): Initialize data member
7680         is_noload_.
7681         (Output_section::do_reset_address_and_file_offset): Do not set address
7682         to 0 if section is a NOLOAD section.
7683         * output.h (Output_section::is_noload): New method.
7684         (Output_section::set_is_noload): Ditto.
7685         (Output_section::is_noload_): New data member.
7686         * script-c.h (Script_section_type): New enum type.
7687         (struct Parser_output_section_header): Add new file section_type.
7688         * script-sections.cc (Sections_element::output_section_name): Add
7689         parameter for returning script section type.
7690         (Output_section_definition::output_section_name): Ditto.
7691         (Output_section_definition::section_type)P; New method.
7692         (Output_section_definiton::script_section_type_name): Ditto.
7693         (Output_section_definition::script_section_type_): New data member.
7694         (Output_section_definition::Output_section_definition): Initialize
7695         data member Output_section_definition::script_section_type_.
7696         (Output_section_definition::create_sections): Pass script section type
7697         to Layout::make_output_section_for_script.
7698         (Output_section_definition::output_section_name): Return script
7699         section type to caller.
7700         (Output_section_definition::set_section_address): Do not advance
7701         dot value and load address if section type is NOLOAD.  Set address
7702         of NOLOAD sections regardless of section flags.
7703         (Output_section_definition::print): Print section type if it is
7704         not SCRIPT_SECTION_TYPE_NONE.
7705         (Output_section_definition::section_type): New method.
7706         (Output_section_definition::script_section_type_name): Ditto.
7707         (Script_sections::output_section_name): Add new parameter
7708         PSECTION_TYPE for returning script section type.  Pass it to
7709         section elements.  Handle discard sections.
7710         (Sort_output_sections::operator()): Handle NOLOAD sections.
7711         * script-sections.h (Script_sections::Section_type): New enum type.
7712         (Script_sections::output_section_name): Add a new parameter for
7713         returning script section type.
7714         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7715         INFO and NOLOAD.
7716         * yyscript.y (union): Add new field SECTION_TYPE.
7717         (COPY, DSECT, INFO, NOLOAD): New tokens.
7718         (opt_address_and_section_type): Change type to output_section_header.
7719         (section_type): New non-terminal
7720         (section_header): Handle section type.
7721         (opt_address_and_section_type): Return section type value.
7722
7723 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7724
7725         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7726         * testsuite/plugin_common_test_2.c (foo): Likewise.
7727
7728 2010-04-08  Doug Kwan  <dougkwan@google.com>
7729
7730         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7731         Output_merge_data.
7732         * output.cc (Output_section::add_merge_input_section): Simplify
7733         code and return status of Output_merge_base::add_input_section.
7734         Update merge section map only if Output_merge_base::add_input_section
7735         returns true.
7736
7737 2010-04-07  Doug Kwan  <dougkwan@google.com>
7738
7739         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7740         if section is marked as containing instructions but has no mapping
7741         symbols.
7742         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7743         correct section index.
7744         (Arm_relobj::find_linked_text_section): Ditto.
7745
7746 2010-04-07  Cary Coutant  <ccoutant@google.com>
7747
7748         * archive.cc (include_member): Destroy Read_symbols_data object before
7749         releasing file.
7750         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7751         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7752         (Read_symbols_data::~Read_symbols_data) New destructor.
7753         (Section_relocs::Section_relocs) New constructor.
7754         (Section_relocs::~Section_relocs) New destructor.
7755         (Read_relocs_data::Read_relocs_data) New constructor.
7756         (Read_relocs_data::~Read_relocs_data) New destructor.
7757         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7758         pointers to NULL after deleting.
7759
7760 2010-04-07  Doug Kwan  <dougkwan@google.com>
7761
7762         * arm.cc: Replace "endianity" with "endianness" in comments.
7763         (Arm_exidx_cantunwind): Ditto.
7764         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7765         (Arm_relobj::merge_flags_and_attributes): New method.
7766         (Arm_relobj::merge_flags_and_attributes_): New data member.
7767         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7768         (Arm_relobj::scan_sections_for_stubs): Ditto.
7769         (Arm_relobj::do_read_symbols): Check to see if we really want to
7770         merge processor-specific flags and attributes.  Exit early if
7771         an object is empty except for section names and the undefined symbol.
7772         (Target_arm::do_finalize_sections): Move check for ELF format to
7773         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7774         attributes from a regular object only when we have determined that
7775         it is aapropriate.  Do not create an .ARM.attributes section in
7776         output if there is no regular input object.
7777         (Target_arm::merge_processor_specific_flags): Check
7778         --warn-mismatch before printing any error.
7779         (Target_arm::merge_object_attributes): Ditto.
7780         * gold.cc (queue_middle_tasks): Handle the case in which there is
7781         no regular object in input.
7782         * options.cc (General_options::parse_EB): New method.
7783         (General_options::parse_EL): Same.
7784         (General_options::General_options): Initialize endianness_.
7785         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7786         New options.
7787         (General_options::Endianness): New enum.
7788         (General_options::endianness): New method.
7789         (General_options::endianness_): New data member.
7790         * parameters.cc (Parameters::set_options): Check target endianness.
7791         (Parameters::set_target_once): Ditto.
7792         (Parameters::check_target_endianness): New method.
7793         (parameters_force_valid_target): If either -EL or -EB is specified,
7794         use it to define endianness of default target.
7795         * parameters.h (Parameters::check_target_endianness): New method
7796         declaration.
7797         * target.h (class Target): Change "endianity" to "endianness"
7798         in comments.
7799
7800 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7801
7802         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7803         * configure: Regenerate.
7804         * Makefile.in: Regenerate.
7805         * testsuite/Makefile.in: Regenerate.
7806
7807 2010-04-06  Cary Coutant  <ccoutant@google.com>
7808
7809         gcc PR lto/42757
7810         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7811         prevailing definitions of common symbols.
7812         * testsuite/plugin_test_6.sh: New test case.
7813         * testsuite/plugin_common_test_1.c: New test case.
7814         * testsuite/plugin_common_test_2.c: New test case.
7815         * testsuite/Makefile.am (plugin_test_6): New test case.
7816         * testsuite/Makefile.in: Regenerate.
7817
7818 2010-04-06  Nick Clifton  <nickc@redhat.com>
7819
7820         * po/vi.po: New Vietnamese translation.
7821
7822 2010-03-30  Doug Kwan  <dougkwan@google.com>
7823
7824         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7825
7826 2010-03-25  Doug Kwan  <dougkwan@google.com>
7827
7828         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7829         to avoid a conversion warning on a 32-bit host.
7830
7831 2010-03-24  Ian Lance Taylor  <iant@google.com>
7832
7833         * testsuite/script_test_3.t: Add a TLS segment.
7834         * testsuite/Makefile.am (check_PROGRAMS): Add
7835         tls_phdrs_script_test.
7836         (tls_phdrs_script_test_SOURCES): Define.
7837         (tls_phdrs_script_test_DEPENDENCIES): Define.
7838         (tls_phdrs_script_test_LDFLAGS): Define.
7839         (tls_phdrs_script_test_LDADD): Define.
7840         * testsuite/Makefile.in: Rebuild.
7841
7842 2010-03-23  Cary Coutant  <ccoutant@google.com>
7843
7844         * fileread.cc (find_or_make_view): Fix comment.
7845
7846 2010-03-23  Ian Lance Taylor  <iant@google.com>
7847
7848         * script-sections.cc (class Orphan_section_placement): Define
7849         PLACE_TLS and PLACE_TLS_BSS.
7850         (Orphan_section_placement::Orphan_section_placement): Initialize
7851         new places.
7852         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7853         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7854         (tls_script_test_SOURCES): Define.
7855         (tls_script_test_DEPENDENCIES): Define.
7856         (tls_script_test_LDFLAGS): Define.
7857         (tls_script_test_LDADD): Define.
7858         * testsuite/Makefile.in: Rebuild.
7859
7860 2010-03-22  Doug Kwan  <dougkwan@google.com>
7861
7862         * arm.cc (Arm_relocate_functions::abs8,
7863         Arm_relocate_functions::abs16): Use correct check for overflow
7864         specified in the ARM ELF specs.
7865         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7866         target of a BLX instruction specially.
7867         (Reloc_stub::stub_type_for_reloc): Ditto.
7868         (Relocate::relocate): Use symbolic names instead of numeric relocation
7869         codes to report error.
7870         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7871         workaround.
7872         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7873         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7874         thumb2_blx_out_of_range.stdout
7875         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7876         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7877         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7878         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7879         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7880         thumb2_blx_in_range, thumb2_blx_in_range.o,
7881         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7882         thumb2_blx_out_of_range.o): New rules.
7883         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7884         thumb2_blx_in_range and thumb2_blx_out_of_range.
7885         * testsuite/Makefile.in: Regenerate.
7886         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7887         * testsuite/thumb_blx_in_range.s: New file.
7888         * testsuite/thumb_blx_out_of_range.s: New file.
7889
7890 2010-03-22  Rafael Espindola  <espindola@google.com>
7891
7892         * archive.cc (Should_include): Move to archive.h.
7893         (should_include_member): Make it a member of Archive.
7894         (Lib_group): New.
7895         (Add_lib_group_symbols): New.
7896         * archive.h: Include options.h.
7897         (Archive_member): Moved from Archive.
7898         (Should_include): Moved from archive.cc.
7899         (Lib_group): New.
7900         (Add_lib_group_symbols): New.
7901         * dynobj.cc (do_should_include_member): New.
7902         * dynobj.h (do_should_include_member): New.
7903         * gold.cc (queue_initial_tasks): Update call to queue.
7904         * main.cc (main): Print lib group stats.
7905         * object.cc (do_should_include_member): New.
7906         * object.h: Include archive.h.
7907         (Object::should_include_member): New.
7908         (Object::do_should_include_member): New.
7909         (Sized_relobj::do_should_include_member): New.
7910         * options.cc (General_options::parse_start_lib): New.
7911         (General_options::parse_end_lib): New.
7912         (Input_arguments::add_file): Handle lib groups.
7913         (Input_arguments::start_group): Check we are not in a lib.
7914         (Input_arguments::start_lib): New.
7915         (Input_arguments::end_lib): New.
7916         * options.h (General_options): Add start_lib and end_lib.
7917         (Input_argument::lib_): New.
7918         (Input_argument::lib): New.
7919         (Input_argument::is_lib): New.
7920         (Input_file_lib): New.
7921         (Input_arguments::in_lib_): New.
7922         (Input_arguments::in_lib): New.
7923         (Input_arguments::start_lib): New.
7924         (Input_arguments::end_lib_): New.
7925         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
7926         in unused members as preempted.
7927         (Sized_pluginobj::do_should_include_member): New.
7928         * plugin.h (Sized_pluginobj::do_should_include_member): New.
7929         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
7930         return the blocker.
7931         (Read_symbols::do_whole_lib_group): New.
7932         (Read_symbols::do_lib_group): New.
7933         (Read_symbols::do_read_symbols): Handle lib groups.
7934         (Read_symbols::get_name): Handle lib groups.
7935         * readsyms.h (Read_symbols): Add an archive member pointer.
7936         (Read_symbols::do_whole_lib_group): New.
7937         (Read_symbols::do_lib_group): New.
7938         (Read_symbols::member_): New.
7939         * script.cc (read_input_script): Update call to queue_soon.
7940
7941 2010-03-19  Doug Kwan  <dougkwan@google.com>
7942
7943         * arm.cc (Stub_table::Stub_table): Initialize new data members
7944         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7945         (Stub_table::add_reloc_stub): Assign stub offset and update
7946         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
7947         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
7948         New data members.
7949         (Stub_table::update_data_size_and_addralign): Use
7950         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
7951         instead of going over all reloc stubs.
7952         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
7953         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7954         Stringpool_template::offset_ to size of Stringpool_char.
7955         (Stringpool_template::new_key_offset): Remove code to initialize
7956         Stringpool_template::offset_.
7957         * stringpool.h (Stringpool_template::set_no_zero_null): Set
7958         Stringpool_template::offset_ to zero.
7959
7960 2010-03-15  Doug Kwan  <dougkwan@google.com>
7961
7962         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
7963         offset_.
7964         (Stringpool_template::new_key_offset): New method.
7965         (Stringpool_template::add_string): Assign offsets when adding new
7966         strings.
7967         (Stringpool_template::set_string_offsets): Do not set string offsets
7968         when not optimizing.
7969         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
7970         member size_.
7971         (Chunked_vector::clear): Clear size_.
7972         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
7973         (Chunked_vector::size): Return size_.
7974         (Chunked_vector::push_back): Use size_ to find insert position.
7975         (Chunked_vector::size_): New data member.
7976         (Stringpool_template::set_no_zero_null): Assert string set is empty.
7977         (Stringpool_template::new_key_offset): New method declaration.
7978         (Stringpool_template::offset_): New data member.
7979
7980 2010-03-15   Rafael Espindola  <espindola@google.com>
7981
7982         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
7983         Add_symbols' constructor.
7984         * readsyms.h (Add_symbols): Remove the input_group member.
7985
7986 2010-03-10  Ian Lance Taylor  <iant@google.com>
7987
7988         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
7989         target to ask whether a reference to a symbol requires a stack
7990         split.
7991         * target.h (Target::is_call_to_non_split): New function.
7992         (Target::do_is_call_to_non_split): Declare virtual function.
7993         * target.cc: Include "symtab.h".
7994         (Target::do_is_call_to_non_split): New function.
7995         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
7996
7997 2010-03-10  Cary Coutant  <ccoutant@google.com>
7998
7999         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8000         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8001         (File_read::open[2]): Add whole_file_view_ to list of views.
8002         (File_read::make_view): Remove test of whole_file_view_.
8003         (File_read::find_or_make_view): Create whole_file_view_ if
8004         necessary.
8005         (File_read::clear_views): Replace bool parameter with enum;
8006         adjust all callers.  Don't delete views with permanent data;
8007         do delete cached views and views from archives if
8008         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8009         if clearing the corresponding view.
8010         * fileread.h (File_read::Clear_views_mode): New enum.
8011         (File_read::View::is_permanent_view): New method.
8012         (File_read::clear_views): Replace bool parameter
8013         with enum; adjust all callers.
8014         * options.h (General_options): Change keep_files_mapped option;
8015         add map_whole_files.
8016         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8017         releasing the file.
8018         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8019         the file.
8020
8021 2010-03-10  David S. Miller  <davem@davemloft.net>
8022
8023         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8024
8025 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8026
8027         * icf.cc (get_section_contents): Add '@' marker after processing the
8028         merge reloc.
8029
8030 2010-03-08  Doug Kwan  <dougkwan@google.com>
8031
8032         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8033         due to a conversion warning.
8034         (Arm_relobj::update_output_local_symbol_count): Check for local
8035         symbol with unset output index.
8036
8037 2010-03-05  Ian Lance Taylor  <iant@google.com>
8038
8039         * options.h (class General_options): Add --spare-dynamic-tags.
8040         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8041         --spare-dynamic-tags.
8042
8043 2010-03-05  Ian Lance Taylor  <iant@google.com>
8044
8045         * incremental.cc: Include "libiberty.h".
8046
8047 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8048
8049         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8050         function, is_info_ member.
8051         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8052         (Versions::Versions): Update caller.
8053         (Versions::define_base_version): Likewise.
8054         (Versions::add_def): Likewise.
8055
8056 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8057
8058         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8059         (Scan::possible_function_pointer_reloc): New function.
8060         (Scan::local_reloc_may_be_function_pointer): Change to call
8061         possible_function_pointer_reloc.
8062         (Scan::global_reloc_may_be_function_pointer): Ditto.
8063         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8064         relocations in ".data.rel.ro._ZTV" section.
8065         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8066         * testsuite/icf_safe_so_test.cc: Ditto.
8067         * testsuite/icf_safe_test.cc: Ditto.
8068         * testsuite/icf_safe_test.sh: Ditto.
8069
8070 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8071             Ian Lance Taylor  <iant@google.com>
8072
8073         * target-reloc.h (relocate_section): Check the symbol table index
8074         for -1U before setting the local symbol index.
8075         (scan_relocatable_relocs): If copying the relocation, record that
8076         the local symbol is required.
8077         * object.h (Symbol_value::is_output_symtab_index_set): New
8078         function.
8079         (Symbol_value::may_be_discarded_from_output_symtab): New
8080         function.
8081         (Symbol_value::has_output_symtab_entry): New function.
8082         (Symbol_value::needs_output_symtab_entry): Remove.
8083         (Symbol_value::output_symtab_index): Make sure the symbol index is
8084         set.
8085         (Symbol_value::set_output_symtab_index): Make sure the symbol
8086         index is not set.  Make sure the new index is valid.
8087         (Symbol_value::set_must_have_output_symtab_entry): New function.
8088         (Symbol_value::has_output_dynsym_entry): New function.
8089         (Symbol_value::set_output_dynsym_index): Make sure the new index
8090         is valid.
8091         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8092         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8093         local symbol if permitted.
8094         (Sized_relobj::do_finalize_local_symbols): Call
8095         is_output_symtab_index_set rather than needs_output_symtab_entry.
8096         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8097         rather than needs_output_symtab_entry.  Call
8098         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8099         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8100         is_output_symtab_index_set rather than needs_output_symtab_entry.
8101         * testsuite/discard_locals_relocatable_test.c: New file.
8102         * testsuite/discard_locals_test.sh: Test -r.
8103         * testsuite/Makefile.am (check_DATA): Add
8104         discard_locals_relocatable_test1.syms,
8105         discard_local_relocatable_test2.syms.
8106         (MOSTLYCLEANFILES): Likewise.  Also add
8107         discard_locals_relocatable_test1.lout and
8108         discard_locals_relocatable_test2.out.
8109         (discard_locals_relocatable_test1.syms): New target.
8110         (discard_locals_relocatable_test.o): New target.
8111         (discard_locals_relocatable_test1.out): New target.
8112         (discard_locals_relocatable_test2.syms): New target.
8113         (discard_locals_relocatable_test2.out): New target.
8114         (various): Add missing ../ld-new dependencies.
8115         * testsuite/Makefile.in: Rebuild.
8116
8117 2010-03-03  Nick Clifton  <nickc@redhat.com>
8118
8119         * po/fi.po: New Finnish translation.
8120
8121 2010-03-01  Doug Kwan  <dougkwan@google.com>
8122
8123         * layout.cc (Layout::Layout): Force section types of .init_array*,
8124         .preinit_array* and .fini_array* sections.
8125         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8126         Fix check of return value of std::string::find.().
8127         (Output_section::Input_section_sort_compare::operator()): Remove
8128         comment about .init_array.
8129         (Output_section::Input_section_sort_init_fini_compare::operator()):
8130         New method.
8131         (Output_section::sort_attached_input_sections): Handle .init_array
8132         and .fini_array specially.
8133         * output.h (Output_section::Inut_section_sort_compare): Update
8134         comment.
8135         (Output_section::Input_section_sort_init_fini_compare): New struct.
8136
8137 2010-02-26  Doug Kwan  <dougkwan@google.com>
8138
8139         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8140         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8141         * testsuite/debug_msg.sh: Avoid matching source line number for
8142         use of global variable undef_int.
8143
8144 2010-02-26  Doug Kwan  <dougkwan@google.com>
8145
8146         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8147         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8148         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8149         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8150         * options.cc (General_options::General_options): Initialize member
8151         fix_v4bx_.
8152         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8153         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8154         and rm_no_fix_v4bx.stdout
8155         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8156         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8157         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8158         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8159         and arm_no_fix_v4bx.
8160         * Makefile.in: Regenerate.
8161         * testsuite/arm_fix_v4bx.s: New file.
8162         * testsuite/arm_fix_v4bx.sh: Ditto.
8163
8164 2010-02-24  Doug Kwan  <dougkwan@google.com>
8165
8166         * arm.cc (Target_arm::got_section): Make the .got section the first
8167         non RELRO section in the data segment.
8168         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8169         suffixes of section names.
8170
8171 2010-02-24  Doug Kwan  <dougkwan@google.com>
8172
8173         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8174         flags and attributes merging if an input file is a binary file.
8175         * fileread.cc (Input_file::open): Record format of original file.
8176         * fileread.h (Input_file::Format): New enum type.
8177         (Input_file::Input_file): Initialize data member format_.
8178         (Input_file::format): New method definition.
8179         (Input_file::format_):: New data member.
8180
8181 2010-02-24  Doug Kwan  <dougkwan@google.com>
8182
8183         * arm.cc (Arm_output_data_got): New class.
8184         (ARM_TCB_SIZE): New constant
8185         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8186         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8187         If user uses a script with a SECTIONS clause, issue only a warning
8188         for a misplaced EXIDX input section.  Otherwise, issue an error.
8189         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8190         garbage collection.
8191         (Target_arm::got_mode_index_entry): Handle static linking.
8192         (Target_arm::Scan::local): Ditto.
8193         (Target_arm::Scan::global): Ditto.
8194         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8195         all incorrectly implemented relocations.
8196         (Target_arm::fix_exidx_coverage): Pass layout to
8197         Arm_output_section::fix_exidx_coverage.
8198         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8199         from ".ARM.exidx." and ".ARM.extab.".
8200
8201 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8202
8203         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8204         section if it does not already exist.
8205         * attributes.cc (Attributes_section_data::Attributes_section_data):
8206         Don't crash if size is zero.
8207
8208 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8209             Ian Lance Taylor  <iant@google.com>
8210
8211         * gold.cc (queue_middle_tasks): If no input files were opened,
8212         exit.
8213         * workqueue.h (Task_function::Task_function): Assert that there is
8214         a blocker.
8215
8216 2010-02-22  Doug Kwan  <dougkwan@google.com>
8217
8218         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8219         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8220         types to avoid warnings due to different uint64_t implementations
8221         on different hosts.
8222
8223 2010-02-21  Doug Kwan  <dougkwan@google.com>
8224
8225         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8226         handling of the maximum backward branch offset.
8227         (Arm_relocate_functions::thumb_branch_common): Ditto.
8228         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8229         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8230         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8231         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8232         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8233         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8234         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8235         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8236         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8237         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8238         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8239         thumb2_bl_out_of_range.o): New rules.
8240         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8241         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8242         thumb2_bl_out_of_range
8243         * testsuite/Makefile.in: Regenerate.
8244         * testsuite/arm_bl_in_range.s: New file.
8245         * testsuite/arm_bl_out_of_range.s: Ditto.
8246         * testsuite/arm_branch_in_range.sh: Ditto.
8247         * testsuite/arm_branch_range.t: Ditto.
8248         * testsuite/thumb2_branch_range.t: Ditto.
8249         * testsuite/thumb_bl_in_range.s: Ditto.
8250         * testsuite/thumb_bl_out_of_range.s: Ditto.
8251         * testsuite/thumb_branch_range.t: Ditto.
8252
8253 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8254
8255         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8256         Add reloc offset information.
8257         * icf.cc (get_section_contents): Change iterators to point to the new
8258         vectors. Add reloc offset information to the contents.
8259         * icf.h (Icf::Sections_reachable_info): New typedef.
8260         (Icf::Sections_reachable_list): New typedef.
8261         (Icf::Offset_info): New typedef.
8262         (Icf::Reloc_info): New struct typedef.
8263         (Icf::Reloc_info_list): New typedef.
8264         (Icf::symbol_reloc_list): Delete method.
8265         (Icf::addend_reloc_list): Delete method.
8266         (Icf::section_reloc_list): Delete method.
8267         (Icf::reloc_info_list): New method.
8268         (Icf::reloc_info_list_): New member.
8269
8270 2010-02-19  Doug Kwan  <dougkwan@google.com>
8271
8272         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8273         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8274         * arm.cc (Arm_relocation_functions): New forward declaration.
8275         (Target_arm::Target_arm): Initialize new data members
8276         got_mod_index_offset_ and tls_base_symbol_defined_.
8277         (Target_arm::Relocate::relocate_tls): New method.
8278         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8279          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8280         New methods.
8281         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8282         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8283         (Target_arm::got_mod_index_offset_,
8284         Target_arm::tls_base_symbol_defined_): New data members.
8285         (Target_arm::Scan::local, Target::Scan::global,
8286         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8287         relocations.
8288
8289 2010-02-18  Doug Kwan  <dougkwan@google.com>
8290
8291         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8292         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8293         text section as a parameter becuase some broken tools may not set
8294         the link in section header.
8295         (Target_arm::has_got_section): New method.
8296         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8297         without any mapping symbol as data only.  Remove warning.
8298         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8299         link in its section header, try to discover the link by inspecting the
8300         REL31 relocation at the beginning of the section.
8301         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8302         in error message.
8303         (Target_arm::Scan::global): Treat any reference to the symbol
8304         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8305
8306 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8307
8308         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8309         (Scan::global_reloc_may_be_function_pointer): New function.
8310         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8311         (Scan::global_reloc_may_be_function_pointer): New function.
8312         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8313         (Scan::global_reloc_may_be_function_pointer): New function.
8314         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8315         (Scan::global_reloc_may_be_function_pointer): New function.
8316         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8317         (Scan::global_reloc_may_be_function_pointer): New function.
8318         (Scan::possible_function_pointer_reloc): New function.
8319         (Target_x86_64::can_check_for_function_pointers): New function.
8320         * gc.h (gc_process_relocs): Scan relocation types to determine if
8321         function pointers were taken for targets that support it.
8322         * icf.cc (Icf::find_identical_sections): Include functions for
8323         folding in safe ICF whose pointer is not taken.
8324         * icf.h (Secn_fptr_taken_set): New typedef.
8325         (fptr_section_id_): New member.
8326         (section_has_function_pointers): New function.
8327         (set_section_has_function_pointers): New function.
8328         (check_section_for_function_pointers): New function.
8329         * options.h: Fix comment for safe ICF option.
8330         * target.h (can_check_for_function_pointers): New function.
8331         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8332         Modify icf_safe_test for X86-64.
8333         * testsuite/Makefile.in: Regenerate.
8334         * testsuite/icf_safe_so_test.cc: New file.
8335         * testsuite/icf_safe_so_test.sh: New file.
8336         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8337         (main): Change to take pointer to function kept_func_3.
8338         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8339         folding is done correctly for X86-64.
8340
8341 2010-02-12  David S. Miller  <davem@davemloft.net>
8342
8343         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8344         is_symbolless parameter.
8345         (Output_reloc<SHT_REL>::is_symbolless): New.
8346         (Output_reloc<SHT_REL>::is_symbolless_): New.
8347         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8348         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8349         (Output_reloc<SHT_RELA>::is_symbolless): New.
8350         (Output_data_reloc::add_global): Handle is_symbolless.
8351         (Output_data_reloc::add_global_relative): Likewise.
8352         (Output_data_reloc::add_local): Likewise.
8353         (Output_data_reloc::add_local_relative): Likewise.
8354         (Output_data_reloc::add_symbolless_global_addend): New.
8355         (Output_data_reloc::add_symbolless_local_addend): New.
8356         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8357         is_symbolless.
8358         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8359         instead of ->is_relative_
8360         (Output_reloc::write): Likewise.
8361         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8362         (Output_reloc::write_rel): Simplify.
8363
8364         * sparc.cc (Target_sparc::Scan::local): Use
8365         ->add_symbolless_local_addend as needed.
8366         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8367         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8368         based upon relocation offset.
8369
8370 2010-02-11  Doug Kwan  <dougkwan@google.com>
8371
8372         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8373         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8374         beginning of function.
8375         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8376         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8377         parameter is_32bit in calls to should_apply_static_reloc.
8378         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8379         (check_DATA): Add arm_abs_global.stdout.
8380         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8381         arm_abs_global.stdout): New rules.
8382         (MOSTLLYCLEANFILES): Add arm_abs_global
8383         * Makefile.in: Regenerate.
8384         * testsuite/arm_abs_global.s: New file.
8385         * testsuite/arm_abs_global.sh: Ditto.
8386         * testsuite/arm_abs_lib.s: Ditto.
8387
8388 2010-02-11  Ian Lance Taylor  <iant@google.com>
8389
8390         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8391         Read_relocs task.
8392         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8393         Allocate_commons_task first.
8394         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8395         task, rather than symtab_lock_.
8396         (Gc_process_relocs::~Gc_process_relocs): New function.
8397         (Gc_process_relocs::is_runnable): Check this_blocker_.
8398         (Gc_process_relocs::locks): Use next_blocker_ rather than
8399         blocker_.
8400         (Scan_relocs::~Scan_relocs): New function.
8401         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8402         symtab_lock_.
8403         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8404         next_blocker_.
8405         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8406         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8407         constructor accordingly.
8408         (class Gc_process_relocs): Likewise.
8409         (class Scan_relocs): Likewise.
8410         * common.h (class Allocate_commons_task): Remove symtab_lock_
8411         field, and corresponding constructor parameter.
8412         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8413         symtab_lock_.
8414         (Allocate_commons_task::locks): Likewise.
8415
8416 2010-02-11  Ian Lance Taylor  <iant@google.com>
8417
8418         * gold-threads.h (class Once): Define.
8419         (class Initialize_lock): Rewrite as child of Once.
8420         * gold-threads.cc (class Once_initialize): Define.
8421         (once_pointer_control): New static variable.
8422         (once_pointer, once_arg): New static variables.
8423         (c_run_once): New static function.
8424         (Once::Once, Once::run_once, Once::internal_run): New functions.
8425         (class Initialize_lock_once): Remove.
8426         (initialize_lock_control): Remove.
8427         (initialize_lock_pointer): Remove.
8428         (initialize_lock_once): Remove.
8429         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8430         (Initialize_lock::initialize): Rewrite.
8431         (Initialize_lock::do_run_once): New function.
8432         * archive.cc (Archive::interpret_header): Only clear name if it is
8433         not already empty.
8434         * fileread.cc: Include "gold-threads.h"
8435         (file_counts_lock): New static variable.
8436         (file_counts_initialize_lock): Likewise.
8437         (File_read::release): Only increment counts when using --stats.
8438         Use a lock around the increment.
8439         * parameters.cc (class Set_parameters_target_once): Define.
8440         (set_parameters_target_once): New static variable.
8441         (Parameters::Parameters): Move here from parameters.h.
8442         (Parameters::set_target): Rewrite.
8443         (Parameters::set_target_once): New function.
8444         (Parameters::clear_target): Move here and rewrite.
8445         * parameters.h (class Parameters): Update declarations.  Add
8446         set_parameters_target_once_ field.
8447         (Parameters::Parameters): Move to parameters.cc.
8448         (Parameters::clear_target): Likewise.
8449         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8450         task.
8451         (Start_group::~Start_group): New function.
8452         (Start_group::is_runnable): New function.
8453         (Start_group::locks, Start_group::run): New functions.
8454         (Finish_group::run): Change saw_undefined to size_t.
8455         * readsyms.h (class Start_group): Define.
8456         (class Finish_group): Change saw_undefined_ field to size_t.
8457         (Finish_group::Finish_group): Remove saw_undefined and
8458         this_blocker parameters.  Change all callers.
8459         (Finish_group::set_saw_undefined): New function.
8460         (Finish_group::set_blocker): New function.
8461         * symtab.h (class Symbol_table): Change saw_undefined to return
8462         size_t.  Change saw_undefined_ field to size_t.
8463         * target-select.cc (Set_target_once::do_run_once): New function.
8464         (Target_selector::Target_selector): Initialize set_target_once_
8465         field.  Don't initialize lock_ and initialize_lock_ fields.
8466         (Target_selector::instantiate_target): Rewrite.
8467         (Target_selector::set_target): New function.
8468         * target-select.h (class Set_target_once): Define.
8469         (class Target_selector): Update declarations.  Make
8470         Set_target_once a friend.  Remove lock_ and initialize_lock_
8471         fields.  Add set_target_once_ field.
8472
8473 2010-02-10  Ian Lance Taylor  <iant@google.com>
8474
8475         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8476         queueing any tasks.
8477         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8478         (queue_middle_tasks): Add all blockers before queueing any tasks.
8479         (queue_final_tasks): Likewise.
8480         * token.h (Task_token::add_blockers): New function.
8481         * object.h (Input_objects::number_of_relobjs): New function.
8482
8483 2010-02-10  Ian Lance Taylor  <iant@google.com>
8484
8485         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8486         shared, not if not position independent.
8487         * x86_64.cc (Relocate::relocate_tls): Likewise.
8488         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8489         (tls_pie_pic_test): New target.
8490         * testsuite/Makefile.in: Rebuild.
8491
8492         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8493         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8494         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8495         * testsuite/Makefile.in: Rebuild.
8496
8497 2010-02-09  David S. Miller  <davem@davemloft.net>
8498
8499         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8500         R_SPARC_RELATIVE using ->add_local_relative().
8501         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8502
8503         * output.h (Output_data_dynamic::add_section_size): New method
8504         that takes two Output_data objects.
8505         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8506         entry param.  Handle it in initializers.
8507         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8508         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8509         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8510         arg.
8511         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8512         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8513         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8514         for dynrel_includes_plt.
8515         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8516         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8517         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8518         before .rela.plt
8519         (Target_sparc::do_finalize_sections): Update to pass true for
8520         dynrel_includes_plt.
8521         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8522         output before .rela.plt
8523         (Target_powerpc::do_finalize_sections): Update to pass true for
8524         dynrel_includes_plt when 32-bit.
8525
8526 2010-02-08  Doug Kwan  <dougkwan@google.com>
8527
8528         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8529         method.
8530         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8531         Arm_relobj::scan_section_for_cortex_a8_stubs,
8532         Arm_relobj::do_relocation_section): Instead of calling
8533         Output_section::output_address, use faster
8534         Arm_relobj::simple_input_section_output_address.
8535
8536 2010-02-08  David S. Miller  <davem@davemloft.net>
8537
8538         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8539         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8540         relocation helper function.
8541
8542         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8543         just like R_SPARC_GOT{10,13,22}.
8544         (Target_sparc::Scan::local): Likewise.
8545         (Target_sparc::Relocate:relocate): Likewise.
8546
8547 2010-02-06  Ian Lance Taylor  <iant@google.com>
8548
8549         * configure.ac: Rewrite targetobjs duplicate removal code to use
8550         only shell constructs.
8551         * configure: Rebuild.
8552
8553 2010-02-05  Doug Kwan  <dougkwan@google.com>
8554
8555         PR 11247
8556         * arm.cc (Arm_relobj::section_is_scannable): New method.
8557         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8558         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8559
8560 2010-02-04  Doug Kwan  <dougkwan@google.com>
8561
8562         PR 11247
8563         * arm-reloc-property.cc (cstdio): Include.
8564         * configure.ac (targetobjs): Remove duplicates.
8565         * configure: Regenerate.
8566         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8567         big and little endian version for a given address size.
8568
8569 2010-02-03  Doug Kwan  <dougkwan@google.com>
8570
8571         * arm-reloc-property.cc
8572         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8573         definition.
8574         * arm-reloc-property.h
8575         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8576         New method definition.
8577         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8578         declaration.
8579         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8580         overflow to N.
8581         (GOT_PREL): Change implemented to Y.
8582         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8583         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8584         (Arm_relocate_functions::movw_abs_nc): Remove method.
8585         (Arm_relocate_functions::movt_abs): Ditto.
8586         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8587         (Arm_relocate_functions::thm_movt_abs): Ditto.
8588         (Arm_relocate_functions::movw_rel_nc): Ditto.
8589         (Arm_relocate_functions::movw_rel): Ditto.
8590         (Arm_relocate_functions::movt_rel): Ditto.
8591         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8592         (Arm_relocate_functions:thm_movw_rel): Ditto.
8593         (Arm_relocate_functions:thm_movt_rel): Ditto.
8594         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8595         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8596         New method definitions.
8597         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8598         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8599         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8600         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8601         (Target_arm::Relocate::relocate): Check for non-static or
8602         unimplemented relocation code and exit early.  Change calls to
8603         Target_arm::reloc_uses_thumb_bit and
8604         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8605         instead.  Refactor code to handle similar relocations to increase
8606         code sharing.  Remove check for unsupported relocation code in switch
8607         statement.
8608         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8609         relocation property table to find out size.  Change error message to
8610         print out the name of a relocation code instead of the numeric value.
8611         (Target_arm::scan_reloc_for_stub): Use relocation property table
8612         instead of calling Target_arm::reloc_uses_thumb_bit().
8613
8614 2010-02-02  Doug Kwan  <dougkwan@google.com>
8615
8616         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8617         types of relaxed input section.
8618
8619 2010-02-02  Doug Kwan  <dougkwan@google.com>
8620
8621         * Makefile.am (HFILES): Add arm-reloc-property.h.
8622         (DEFFILES): New.
8623         (TARGETSOURCES): Add arm-reloc-property.cc
8624         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8625         (libgold_a_SOURCES): $(DEFFILES)
8626         * Makefile.in: Regenerate.
8627         * arm-reloc-property.cc: New file.
8628         * arm-reloc-property.h: New file.
8629         * arm-reloc.def: New file.
8630         * arm.cc: Update comments.
8631         (arm-reloc-property.h): New included header.
8632         (arm_reloc_property_table): New global variable.
8633         (Target_arm::do_select_as_default_target): New method definition.
8634         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8635         arm-reloc-property to targ_extra_obj.
8636         * parameters.cc (set_parameters_target): Call
8637         Target::select_as_default_target().
8638         * target.h (Target::select_as_default_target): New method definition.
8639         (Target::do_select_as_default_target): Same.
8640
8641 2010-02-01  Doug Kwan  <dougkwan@google.com>
8642
8643         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8644         first_output_text_section_.
8645         (Arm_exidx_fixup::first_output_text_section): New method definition.
8646         (Arm_exidx_fixup::first_output_text_section_): New data member.
8647         (Arm_exidx_fixup::process_exidx_section): Record the first text
8648         output section seen.
8649         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8650         and entsize in output section header.
8651
8652 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8653
8654         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8655         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8656         (Arm_relocate_functions::thm_alu11): New Method.
8657         (Arm_relocate_functions::thm_pc8): New Method.
8658         (Arm_relocate_functions::thm_pc12): New Method.
8659         (Target_arm::Scan::local): Handle the relocations.
8660         (Target_arm::Scan::global): Likewise.
8661         (Target_arm::Relocate::relocate): Likewise.
8662         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8663
8664 2010-01-29  Doug Kwan  <dougkwan@google.com>
8665
8666         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8667         of relocation types as ld.
8668
8669 2010-01-29  Doug Kwan  <dougkwan@google.com>
8670
8671         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8672         to public.
8673         (Arm_relocate_functions::thumb_branch_common): Ditto.
8674         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8675         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8676         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8677         Arm_relocate_functions::jump24): Remove.
8678         (Target_arm::Relocate::relocate): Adjust code to call
8679         Arm_relocation_functions::arm_branch_common and
8680         Arm_relocation_functions::thumb_branch_common instead of their removed
8681         wrappers.  Merge switch-cases together to reduce source code size.
8682
8683 2010-01-29  Doug Kwan  <dougkwan@google.com>
8684
8685         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8686         output_local_symbol_count_needs_update_.
8687         (Arm_relobj::output_local_symbol_count_needs_update,
8688          Arm_relobj::set_output_local_symbol_count_needs_update,
8689          Arm_relobj::update_output_local_symbol_count): New methods.
8690         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8691         member.
8692         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8693         of pointed function as in a R_ARM_PREL31 relocation.
8694         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8695         for output local symbol count updating.
8696         (Target_arm::do_relax): Update output local symbol counts in objects
8697         if necessary.
8698         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8699
8700 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8701
8702         * arm.cc: Added support for the ARM relocations:
8703         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8704         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8705         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8706         movw_prel_nc).
8707         (Arm_relocate_functions::movw_rel): New method.
8708         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8709         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8710         thm_movw_prel_nc).
8711         (Arm_relocate_functions::thm_movw_rel): New method.
8712         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8713         thm_movt_prel).
8714         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8715         relocations.
8716         (Target_arm::Scan::global): Likewise.
8717         (Target_arm::Relocate::relocate): Likewise.
8718         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8719         Likewise.
8720
8721 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8722
8723         * arm.cc: Added support for ARM group relocations.
8724         (Target_arm::reloc_needs_sym_origin): New method.
8725         (Arm_relocate_functions::calc_grp_kn): New method.
8726         (Arm_relocate_functions::calc_grp_residual): New method.
8727         (Arm_relocate_functions::calc_grp_gn): New method.
8728         (Arm_relocate_functions::arm_grp_alu): New Method.
8729         (Arm_relocate_functions::arm_grp_ldr): New Method.
8730         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8731         (Arm_relocate_functions::arm_grp_ldc): New Method.
8732         (Target_arm::Scan::local): Handle the ARM group relocations.
8733         (Target_arm::Scan::global): Likewise.
8734         (Target_arm::Relocate::relocate): Likewise.
8735         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8736         Likewise.
8737
8738 2010-01-26  Doug Kwan  <dougkwan@google.com>
8739
8740         * arm.cc (set): Include.
8741         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8742         pointer type.
8743         (Arm_output_section::Text_section_list): New type.
8744         (Arm_output_section::append_text_sections_to_list): New method.
8745         (Arm_output_section::fix_exidx_coverage): Ditto.
8746         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8747         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8748         Relobj::set_section_offset() instead of
8749         Sized_relobj::invalidate_section_offset().
8750         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8751         parameter for section headers. Ignore relocation sections for
8752         unallocated sections and EXIDX sections.
8753         (Target_arm::fix_exidx_coverage): New method.
8754         (Target_arm::output_section_address_less_than): New type.
8755         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8756         linked text section instead of the EXIDX section.
8757         (Arm_output_section::create_stub_group): Add an assertion to check
8758         that this is not an EXIDX output section.
8759         (Arm_output_section::append_text_sections_to_list): New method.
8760         (Arm_output_section::fix_exidx_coverage): Ditto.
8761         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8762         Arm_relobj::section_needs_reloc_stub_scanning.
8763         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8764         first pass.
8765         (Target_arm::fix_exidx_coverage): New method.
8766         * object.h (Relobj::set_output_section): New method.
8767         (Sized_relobj::invalidate_section_offset): Remove method.
8768         (Sized_relobj::do_invalidate_section_offset): Remove method.
8769         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8770
8771 2010-01-25  Doug Kwan  <dougkwan@google.com>
8772
8773         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8774         Fix warning due to signed and unsigned comparison on a 32-bit host.
8775
8776 2010-01-22  Doug Kwan  <dougkwan@google.com>
8777
8778         * arm.cc (Target_arm::do_relax): Record an output section for section
8779         offset adjustment it contains any stub table that has changed.
8780         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8781         offsets in an output section if necessary.
8782         * output.cc (Output_section::Output_section): Initialize
8783         section_offsets_need_adjustments_.
8784         (Output_section::add_input_section_for_script): Renamed to
8785         Output_section::add_simple_input_section.
8786         (Output_section::save_states): Add a comment.
8787         (Output_section::discard_states): New method defintion.
8788         (Output_section::adjust_section_offsets): Same.
8789         * output.h (Output_section::add_input_section_for_script): Renamed to
8790         Output_section::add_simple_input_section.
8791         (Output_section::discard_states): New method declaration.
8792         (Output_section::adjust_section_offsets): Same.
8793         (Output_section::section_offsets_need_adjustment,
8794         Output_section::set_section_offsets_need_adjustment): New method
8795         definitions.
8796         (Output_section::section_offsets_need_adjustment_): New data member.
8797         * script-sections.cc
8798         (Output_section_element_input::set_section_address): Adjust code for
8799         renaming of Output_section::add_input_section_for_script.
8800         (Orphan_output_section::set_section_address): Same.
8801
8802 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8803
8804         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8805         Fix_v4bx enum values .
8806         * gold/options.h (General_options): New option definitions.
8807         (General_options::fix_v4bx): New method.
8808         (General_options::Fix_v4bx): New enum.
8809         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8810         (General_options::parse_fix_v4bx_interworking): New method.
8811
8812 2010-01-22  Doug Kwan  <dougkwan@google.com>
8813
8814         * arm.cc (Arm_exidx_fixup): New class.
8815
8816 2010-01-21  Doug Kwan  <dougkwan@google.com>
8817
8818         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8819         classes.
8820         (Arm_exidx_section_offset_map): New type.
8821
8822 2010-01-21  Doug Kwan  <dougkwan@google.com>
8823
8824         * arm.cc (Arm_exidx_input_section): New class.
8825         (Arm_relobj::exidx_input_section_by_link,
8826         Arm_relobj::exidx_input_section_by_shndx,
8827         Arm_relobj::make_exidx_input_section): New methods.
8828         (read_arm_attributes_section): Remove.
8829         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8830         information about them.
8831         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8832         to here.
8833
8834 2010-01-20  Doug Kwan  <dougkwan@google.com>
8835
8836         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8837         Input_section_specifier to Section_id.
8838         (Target_arm::new_arm_input_section: Adjust code for change of key
8839         type.
8840         (Target_arm::find_arm_input_section): Ditto.
8841         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8842         (Section_id): Remove.
8843         (Garbage_collection::Section_id_hash): Remove.
8844         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8845         (Section_id): Remove.
8846         (Icf::Section_id_hash): Remove.
8847         * object.h (Section_id, Const_section_id, Section_id_hash,
8848         Const_section_id_hash): New type definitions.
8849         * output.cc (Output_section::add_relaxed_input_section): Change to
8850         use Const_section_id instead of Input_section_specifier as key type.
8851         (Output_section::add_merge_input_section): Ditto.
8852         (Output_section::build_relaxation_map): Change to use Section_id
8853         instead of Input_section_specifier as key type.
8854         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8855         Ditto.
8856         (Output_section::convert_input_sections_to_relaxed_sections): Change
8857         to use Const_section_id instead of Input_section_specifier as key type.
8858         (Output_section::find_merge_section): Ditto.
8859         (Output_section::find_relaxed_input_section): Ditto.
8860         * output.h (Input_section_specifier): Remove class.
8861         (Output_section::Output_section_data_by_input_section_map): Change
8862         key type to Const_section_id.
8863         (Output_section::Output_relaxed_input_section_by_input_section_map):
8864         Ditto.
8865         (Output_section::Relaxation_map): Change key type to Section_id.
8866
8867 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8868
8869         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8870         (class Arm_v4bx_stub): New class.
8871         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8872         (Stub_factory::make_arm_v4bx_stub): New method.
8873         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8874         (Stub_table::empty): Handle v4bx stubs.
8875         (Stub_table::add_arm_v4bx_stub): New method.
8876         (Stub_table::find_arm_v4bx_stub): New method.
8877         (Arm_relocate_functions::v4bx): New method.
8878         (Target_arm::fix_v4bx): New method.
8879         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8880         (Stub_table::relocate_stubs): Likewise.
8881         (Stub_table::do_write): Likewise.
8882         (Stub_table::update_data_size_and_addralign): Likewise.
8883         (Stub_table::finalize_stubs):  Likewise.
8884         (Target_arm::Scan::local): Likewise.
8885         (Target_arm::Scan::global): Likewise.
8886         (Target_arm::do_finalize_sections): Likewise.
8887         (Target_arm::Relocate::relocate): Likewise.
8888         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8889         Likewise.
8890         (Target_arm::scan_reloc_for_stub): Likewise.
8891         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8892
8893 2010-01-19  Ian Lance Taylor  <iant@google.com>
8894
8895         * output.cc (Output_section_headers::do_sized_write): Write large
8896         segment count to sh_info field.
8897         (Output_file_header::do_sized_write): For large segment count,
8898         write PN_XNUM to e_phnum field.
8899
8900 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8901
8902         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
8903         (Arm_relocate_functions::thm_jump8): New function.
8904         (Arm_relocate_functions::thm_jump11): New function.
8905         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
8906         R_ARM_THM_JUMP11.
8907         (Target_arm::Scan::global): Likewise.
8908         (Target_arm::Relocate::relocate): Likewise.
8909         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8910         Likewise.
8911
8912 2010-01-14  Doug Kwan  <dougkwan@google.com>
8913
8914         * arm.cc (map, utility): Include headers.
8915         (Target_arm::apply_cortex_a8_workaround): New method.
8916         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
8917         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
8918         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
8919         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
8920         the --[no-]fix-cortex-a8 command line options.
8921         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
8922         (Target_arm::relocate_stub): Use addend in instruction template.
8923         * options.h (DEFINE_bool): Set the user-set flag.
8924         (General_options): Add --[no-]-fix-cortex options.
8925         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
8926         : Update fast look-up map after conversion.
8927
8928 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
8929
8930         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
8931         in the first pass of do_layout.
8932
8933 2010-01-13  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8936         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
8937         apparent compiler problem of not folding static constant integral
8938         data members of elfcpp::Elf_sizes<32>.
8939
8940 2010-01-13  Doug Kwan  <dougkwan@google.com>
8941
8942         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
8943         Arm_relobj::section_needs_cortex_a8_stub_scanning,
8944         Arm_relobj::scan_section_for_cortex_a8_erratum,
8945         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
8946         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
8947         sections to scan for relocation stubs into a new method
8948         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
8949         relocation and Cortex-A8 stub scanning.
8950         (Target_arm::do_relax): Force stubs to be after stubbed sections
8951         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
8952         the beginning of a new relaxation pass.  Update a comment.
8953         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
8954
8955 2010-01-12  Ian Lance Taylor  <iant@google.com>
8956
8957         * target-reloc.h (visibility_error): New inline function.
8958         (relocate_section): Call visibility_error.
8959         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
8960         (MOSTLYCLEANFILES): Likewise.
8961         (protected_4_pic.o, protected_3.err): New targets.
8962         * testsuite/protected_4.cc: New file.
8963
8964 2010-01-12  Doug Kwan  <dougkwan@google.com>
8965
8966         * arm.cc (Cortex_a8_reloc): New class.
8967         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
8968         and cortex_a8_relocs_info_.
8969         (Target_arm::fix_cortex_a8): New method definition.
8970         (Target_arm::Cortex_a8_relocs_info): New type.
8971         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
8972         New data member declarations.
8973         (Target_arm::scan_reloc_for_stub): Record information about
8974         relocations for THUMB branches that might be exempted from the
8975         Cortex-A8 workaround.
8976         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
8977         at the beginning of a relaxation pass.
8978
8979 2010-01-12  Doug Kwan  <dougkwan@google.com>
8980
8981         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
8982         (Arm_relobj::Mapping_symbol_position,
8983          Arm_reloj::Mapping_symbol_position_less,
8984          Arm_relobj::Mapping_symbols_info): New types.
8985         (Target_arm::is_mapping_symbol_name): New method definition.
8986         (Arm_relobj::do_count_local_symbols): Save information about mapping
8987         symbols.
8988
8989 2010-01-11  Doug Kwan  <dougkwan@google.com>
8990
8991         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
8992         Arm_relocate_functions::thumb32_branch_upper,
8993         Arm_relocate_functions::thumb32_branch_lower,
8994         Arm_relocate_functions::thumb32_cond_branch_offset,
8995         Arm_relocate_functions::thumb32_cond_branch_upper,
8996         Arm_relocate_functions::thumb32_cond_branch_lower,
8997         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
8998         branch offset encoding.
8999         (Arm_relocate_functions::thumb_branch_common): Use new branch
9000         offset encoding methods to avoid code duplication.
9001         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9002         (Stub_addend_reader::operator()): Use new branch encoding method
9003         to avoid code duplication.
9004
9005 2010-01-11  Doug Kwan  <dougkwan@google.com>
9006
9007         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9008         (Target_arm::do_finalize_sections): Define special EXIDX section
9009         symbols only if referenced.
9010         * gc.h (Garbage_collection::add_reference): New method.
9011         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9012         code duplication.
9013
9014 2010-01-11  Ian Lance Taylor  <iant@google.com>
9015
9016         * script.cc (Version_script_info::build_expression_list_lookup):
9017         Change complaing about duplicate wildcard match from error to
9018         warning.
9019
9020         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9021         of 2009-12-30.
9022         (Version_script_info::Version_script_info): Initialize globs_,
9023         default_version_, default_is_global_, and exact_.  Don't
9024         initialize globals_ or locals_.
9025         (Version_script_info::build_lookup_tables): Build local symbols
9026         first.
9027         (Version_script_info::unquote): New function.
9028         (Version_script_info::add_exact_match): New function.
9029         (Version_script_info::build_expression_list_lookup): Remove lookup
9030         parameter.  Add is_global parameter.  Change all callers.  Handle
9031         wildcard pattern specially.  Unquote pattern.  Call
9032         add_exact_match.
9033         (Version_script_info::get_name_to_match): New function.
9034         (Version_script_info::get_symbol_version): New function.
9035         (Version_script_info::get_symbol_version_helper): Remove.
9036         (Version_script_info::check_unmatched_names): Call unquote.
9037         * script.h (class Version_script_info): Change get_symbol_version
9038         to be non-inline and add is_global parameter; change all callers.
9039         Rewrite symbol_is_local.  Update declarations.  Define struct
9040         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9041         Remove globals_ and locals_ members.  Add exact_, globs_,
9042         default_version_, is_global_.
9043         (Version_script_info::Glob): Remove pattern, add expression and
9044         is_global.  Update constructor.  Change all callers.
9045         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9046         default version.
9047         (Versions::symbol_section_contents): If a symbol is undefined, or
9048         defined in a dynamic object, set the version index to
9049         VER_NDX_LOCAL.
9050         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9051         symbol_is_local.
9052         (Symbol_table::add_from_pluginobj): Likewise.
9053         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9054
9055 2010-01-11  Doug Kwan  <dougkwan@google.com>
9056
9057         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9058         (incremental_dump_LDADD): Add linking option for libintl.
9059         * Makefile.in: Regenerate.
9060
9061 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9062
9063         PR gold/11144
9064         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9065         instead of -Ds.
9066         * testsuite/Makefile.in: Regenerated.
9067
9068 2010-01-10  Doug Kwan  <dougkwan@google.com>
9069
9070         * options.h (DEFINE_var): Use parentheses around argument varname__
9071         in macro body to avoid any unintended subsequent substitutions.
9072
9073 2010-01-10  Ian Lance Taylor  <iant@google.com>
9074
9075         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9076         candidates before doing symbol resolution.
9077
9078         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9079         ODR candidates if only one is weak.
9080
9081 2010-01-08  Ian Lance Taylor  <iant@google.com>
9082
9083         * script.cc (Version_script_info::build_expression_list_lookup):
9084         Don't warn about ambiguous version, just record the ambiguity.
9085         (Version_script_info::get_symbol_version_helper): Give error if
9086         version is ambiguous.
9087
9088 2010-01-08  Doug Kwan  <dougkwan@google.com>
9089
9090         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9091         prev_data_size_ and prev_addralign_.  Remove initializer for
9092         deleted data member has_been_changed_.
9093         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9094         to determine if the table is empty.
9095         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9096         Remove.
9097         (Stub_table::add_reloc_stub): Define method in class definition
9098         instead of just declaring it there.
9099         (Stub_table::add_cortex_a8_stub): New method definition.
9100         (Stub_table::update_data_size_and_addralign): Ditto.
9101         (Stub_table::finalize_stubs): Ditto.
9102         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9103         (Stub_table::do_addralign_): Return address alignment in the
9104         (Stub_table::do_reset_address_and_file_offset): Define method in
9105         class definition instead of declaring it there.  Set current data
9106         size to be the data size of the previous pass.
9107         (Stub_table::set_final_data_size): Use current data size as the
9108         final data size.
9109         (Stub_table::relocate_stub): Change parameter type of stub from
9110         Reloc_stub pointer to Stub pointer.
9111         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9112         (Stub_table::Cortex_a8_stub_list): New typedef.
9113         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9114          Stub_table::prev_addralign_): New data member.
9115         (Arm_relobj::Arm_relobj): Initialize data member
9116         section_has_cortex_a8_workaround_.
9117         (Arm_relobj::section_has_cortex_a8_workaround,
9118          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9119          definitions.
9120         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9121         declarations.
9122         (Target_arm::relocate_stub): Change parameter type of stub from
9123         Reloc_stub pointer to Stub pointer.
9124         (Insn_template::size, Insn_template::alignment): Handle
9125         THUMB16_SPECIAL_TYPE.
9126         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9127          Stub_table::update_data_size_and_addralign,
9128          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9129         definitions.
9130         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9131         (Stub_table::do_write): Ditto.
9132         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9133
9134 2010-01-08  Ian Lance Taylor  <iant@google.com>
9135
9136         PR 11108
9137         * symtab.h (class Symbol): Remove fields is_target_special_ and
9138         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9139         (Symbol::is_defined_in_discarded_section): New function.
9140         (Symbol::set_is_defined_in_discarded_section): New function.
9141         (Symbol::has_plt_offset): Rewrite.
9142         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9143         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9144         Don't initialize is_target_special_ or has_plt_offset_.
9145         Initialize is_defined_in_discarded_section_.
9146         (Symbol_table::add_from_relobj): If appropriate, set
9147         is_defined_in_discarded_section.
9148         * resolve.cc (Symbol::override_base_with_special): Don't test
9149         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9150         * target-reloc.h (relocate_section): Do special handling for
9151         symbols defined in discarded sections for global symbols as well
9152         as local symbols.
9153
9154 2010-01-08  Ian Lance Taylor  <iant@google.com>
9155
9156         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9157         the SHT_SYMTAB case.
9158
9159 2010-01-08  Ian Lance Taylor  <iant@google.com>
9160
9161         * object.cc (Sized_relobj::do_layout): Don't get confused if
9162         layout_eh_frame returns NULL.
9163
9164 2010-01-08  Ian Lance Taylor  <iant@google.com>
9165
9166         PR 11084
9167         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9168         dynamic symbol table, use the normal symbol table.
9169         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9170         symbol table.
9171
9172 2010-01-08  Ian Lance Taylor  <iant@google.com>
9173
9174         PR 11072
9175         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9176         sections.
9177
9178 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9179
9180         * version.cc (print_version): Change to "Copyright 2010".
9181
9182 2010-01-08  Ian Lance Taylor  <iant@google.com>
9183
9184         PR 10287
9185         PR 11063
9186         * i386.cc (class Target_i386): Change return type of plt_section
9187         to be non-const.
9188         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9189         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9190         tls_desc_rel_ field.
9191         (Output_data_plt_i386::rel_tls_desc): New function.
9192         (Target_i386::rel_tls_desc_section): New function.
9193         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9194         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9195         R_386_TLS_DESC reloc in rel_tls_desc_section.
9196         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9197         Define struct Tlsdesc_info.
9198         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9199         (Target_x86_64::do_reloc_symbol_index): New function.
9200         (Target_x86_64::add_tlsdesc_info): New function.
9201         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9202         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9203         tlsdesc_rel_ field.
9204         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9205         all callers.
9206         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9207         (Target_x86_64::rela_tlsdesc_section): New function.
9208         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9209         handling.
9210         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9211         (Target_x86_64::do_reloc_addend): New function.
9212         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9213         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9214         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9215         (Output_reloc::type): New function.
9216         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9217         (Output_reloc::is_target_specific): New function.
9218         (Output_reloc::target_arg): New function.
9219         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9220         absolute relocs and target specific relocs.
9221         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9222         add_target_specific.
9223         (class Output_data_reloc) [SHT_RELA]: Likewise.
9224         * output.cc (Output_reloc::Output_reloc): Add four new versions
9225         for absolute relocs and target specific relocs.
9226         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9227         (Output_reloc::get_symbol_index): Likewise.
9228         (Output_reloc::local_section_offset): Check that local_sym_index_
9229         is not TARGET_CODE or 0.
9230         (Output_reloc::symbol_value): Likewise.
9231         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9232         reloc.
9233         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9234         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9235         functions.
9236         * layout.cc (add_target_dynamic_tags): Use output section for
9237         DT_PLTRELSZ and DT_JMPREL.
9238
9239 2010-01-07  Ian Lance Taylor  <iant@google.com>
9240
9241         PR 11061
9242         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9243         function.
9244         (class Output_data_reloc_generic): Define.
9245         (class Output_data_reloc_base): Change base class to
9246         Output_data_reloc_generic.  Change add() method to call
9247         bump_relative_reloc_count for a relative reloc.  Remove
9248         sort_relocs_ field.
9249         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9250         to sort_relocs().
9251         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9252         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9253         appropriate.
9254         * layout.h (class Layout): Update declaration.
9255
9256 2010-01-07  Ian Lance Taylor  <iant@google.com>
9257
9258         * output.h (class Output_data): Add const version of
9259         output_section and do_output_section.
9260         (class Output_section_data): Add const version of
9261         do_output_section.
9262         (class Output_section): Likewise.
9263         * layout.cc (Layout::add_target_dynamic_tags): New function.
9264         * layout.h (class Layout): Update declarations.
9265         * arm.cc (Target_arm::do_finalize_sections): Use
9266         add_target_dynamic_tags.
9267         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9268         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9269         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9270         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9271
9272 2010-01-07  Ian Lance Taylor  <iant@google.com>
9273
9274         PR 11042
9275         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9276         object as needed.
9277
9278 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9279             Ian Lance Taylor  <iant@google.com>
9280
9281         PR 11019
9282         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9283         Xindex::read_symtab_xindex.
9284
9285 2010-01-07  Doug Kwan  <dougkwan@google.com>
9286
9287         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9288         (Insn_template::thumb16_bcond_insn): New method declaration.
9289         (Insn_template): Fix spelling.
9290         (Stub::thumb16_special): New method declaration.
9291         (Stub::do_write): Define virtual method which was previously pure
9292         virtual.
9293         (Stub::do_thumb16_special): New method declaration.
9294         (Stub::do_fixed_endian_write): New template member.
9295         (Reloc_stub::do_write): Remove.
9296         (Reloc_stub::do_fixed_endian_write): Remove.
9297         (Cortex_a8_stub): New class definition.
9298         (Stub_factory::make_cortex_a8_stub): New method definition.
9299         (Stub_factory::Stub_factory): Add missing static storage class
9300         qualifier for elf32_arm_stub_a8_veneer_blx.
9301
9302 2010-01-07  Ian Lance Taylor  <iant@google.com>
9303
9304         PR 10980
9305         * options.h (class General_options): Add --warn-unresolved-symbols
9306         and --error-unresolved-symbols.
9307         * errors.cc (Errors::undefined_symbol): Implement
9308         --warn-unresolved-symbols.
9309
9310         * options.h (class General_options): Add -z text and -z textoff.
9311         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9312
9313 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9314
9315         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9316         (Garbage_collection::cident_sections): New function.
9317         (Garbage_collection::add_cident_section): New function.
9318         (Garbage_collection::cident_sections_): New member.
9319         (gc_process_relocs): Add references to sections whose names are C
9320         identifiers.
9321         * gold.h (cident_section_start_prefix): New constant.
9322         (cident_section_stop_prefix): New constant.
9323         (is_cident): New function.
9324         * layout.cc (Layout::define_section_symbols): Replace string constants
9325         with the newly defined constants.
9326         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9327         C identifiers.
9328         * testsuite/Makefile.am: Add gc_orphan_section_test.
9329         * testsuite/Makefile.in: Regenerate.
9330         * testsuite/gc_orphan_section_test.cc: New file.
9331         * testsuite/gc_orphan_section_test.sh: New file.
9332
9333 2010-01-06  Ian Lance Taylor  <iant@google.com>
9334
9335         PR 10980
9336         * options.h (class General_options): Add --warn-shared-textrel.
9337         * layout.cc (Layout::finish_dynamic_section): Implement
9338         --warn-shared-textrel.
9339
9340         PR 10980
9341         * options.h (class General_options): Add --warn-multiple-gp.
9342
9343 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9344
9345         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9346         $(THREADSLIB) and $(LIBDL).
9347         * Makefile.in: Rebuild.
9348
9349 2010-01-06  Ian Lance Taylor  <iant@google.com>
9350
9351         PR 10980
9352         * options.cc (General_options::parse_section_start): New function.
9353         (General_options::section_start): New function.
9354         (General_options::General_options): Initialize all members.
9355         * options.h: Include <map>
9356         (class General_options): Add --section-start.  Add section_starts_
9357         member.
9358         * layout.cc (Layout::attach_allocated_section_to_segment): If
9359         --section-start was used, set the address of the segment.  Remove
9360         local sort_sections.
9361         (Layout::relaxation_loop_body): If the address of the load segment
9362         has been set by --section-start, don't use it.
9363         * output.h (Output_segment::update_flags_for_output_section): New
9364         function.
9365         * output.cc (Output_segment::add_output_section): Call
9366         update_flags_for_output_section.
9367
9368 2010-01-05  Ian Lance Taylor  <iant@google.com>
9369
9370         PR 10980
9371         * options.h (class General_options): Add --undefined-version.
9372         * script.cc (struct Version_expression): Add was_matched_by_symbol
9373         field.
9374         (Version_script_info::matched_symbol): New function.
9375         (Version_script_info::get_symbol_version_helper): Call
9376         matched_symbol.
9377         (Version_script_info::check_unmatched_names): New function.
9378         * script.h (class Version_script_info): Update declarations.
9379         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9380
9381         * options.h (class General_options): Use DEFINE_bool_alias for
9382         allow_multiple_definition.
9383         * resolve.cc (Symbol_table::should_override): Don't test
9384         allow_multiple_definition.
9385
9386         PR 10980
9387         * options.h (class General_options): Add --cref.
9388         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9389         until after printing cref table.
9390         * cref.cc: Include "symtab.h".
9391         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9392         (Cref_table_compare::operator()): New function.
9393         (Cref_inputs::gather_cref): New function.
9394         (filecol): New static const.
9395         (Cref_inputs::print_cref): New function.
9396         (Cref::print_cref): New function.
9397         * cref.h: Include <cstdio>.
9398         (class Cref): Update declarations.
9399         * mapfile.h (Mapfile::file): New function.
9400         * object.h (class Object): Define Symbols.  Declare virtual
9401         do_get_global_symbols.
9402         (Object::get_global_symbols): New function.
9403         * object.cc (Input_objects::add_object): Pass object to cref_ if
9404         --cref.
9405         (Input_objects::archive_start): Likewise.
9406         (Input_objects::archive_stop): Likewise.
9407         (Input_objects::print_cref): New function.
9408         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9409         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9410         --cref.
9411         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9412         function.
9413         * plugin.h (class Sized_pluginobj): Update declarations.
9414
9415 2010-01-05  Ian Lance Taylor  <iant@google.com>
9416
9417         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9418         to is_default_version.  Rename insdef to insdefault.
9419         (Symbol_table::add_from_relobj): Rename def to is_default_version
9420         and local to is_forced_local.
9421         (Symbol_table::add_from_pluginobj): Likewise.
9422         (Symbol_table::add_from_dynobj): Likewise.
9423         (Symbol_table::define_special_symbol): Rename insdef to
9424         insdefault.
9425
9426 2010-01-04  Ian Lance Taylor  <iant@google.com>
9427
9428         PR 10980
9429         * options.h (class General_options): Add
9430         --allow-multiple-definition and -z muldefs.
9431         * resolve.cc (Symbol_table::should_override): Don't warn about a
9432         multiple symbol definition if --allow-multiple-definition or -z
9433         muldefs.
9434
9435         PR 10980
9436         * options.h (class General_options): Add --add-needed and
9437         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9438         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9439         error if --copy-dt-needed-entries aka --add-needed is used and
9440         would cause a change in behaviour.
9441
9442         PR 10980
9443         * options.h (class General_options): Add -G as a short version of
9444         --shared.  Add no-op options -assert, -g, and -i.
9445
9446 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9447
9448         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9449         check for .text or .gnu.linkonce.t sections.
9450         * icf.cc (Icf::find_identical_sections): Ditto.
9451         Change the detection for mangled function name within the section
9452         name.
9453         * icf.h (is_section_foldable_candidate): New function.
9454
9455 2009-12-30  Ian Lance Taylor  <iant@google.com>
9456
9457         PR 10980
9458         * options.h (class General_options): Permit two dashes with
9459         --retain-symbols-file.
9460
9461 2009-12-30  Ian Lance Taylor  <iant@google.com>
9462
9463         PR 10979
9464         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9465         don't put the file header and segment headers in the text
9466         segment.
9467
9468         PR 10979
9469         * common.cc (Sort_commons::operator()): Stabilize sort when both
9470         entries are NULL.
9471         (Symbol_table::do_allocate_commons_list): When allocating common
9472         symbols, skip a symbol which is no longer common.
9473         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9474         an object before checking its type.
9475         * testsuite/common_test_2.c: New file.
9476         * testsuite/common_test_3.c: New file.
9477         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9478         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9479         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9480         (common_test_2_pic.o, common_test_2.so): New targets.
9481         (common_test_3_pic.o, common_test_3.so): New targets.
9482         * testsuite/Makefile.in: Rebuild.
9483
9484         PR 10979
9485         * script.cc (read_input_script): If we see a new SECTIONS clause,
9486         and we have added an input section, give an error.
9487         * layout.h (class Layout): Add have_added_input_section function.
9488         Add have_added_input_section_ field.
9489         * layout.cc (Layout::Layout): Initialize
9490         have_added_input_section_.
9491         (Layout::layout): Set have_added_input_section_.
9492         (Layout::layout_eh_frame): Likewise.
9493
9494 2009-12-30  Ian Lance Taylor  <iant@google.com>
9495
9496         PR 10931
9497         * options.h (class General_options): Add --sort-common option.
9498         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9499         * common.cc (Sort_common): Add sort_order parameter to
9500         constructor.  Add sort_order_ field.
9501         (Sort_commons::operator): Check sort_order_.
9502         (Symbol_table::allocate_commons): Determine the sort order.
9503         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9504         Change all callers.
9505         (Symbol_table::do_allocate_commons_list): Likewise.
9506
9507 2009-12-30  Ian Lance Taylor  <iant@google.com>
9508
9509         PR 10916
9510         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9511         symbols from this object, don't change the visibility of an
9512         undefined symbol.
9513         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9514
9515 2009-12-30  Ian Lance Taylor  <iant@google.com>
9516
9517         PR 10861
9518         * script.h (class Version_script_info): Define Language enum.
9519         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9520         new fields globals_, locals_, and is_finalized_.
9521         * script.cc: Various formatting fixes.
9522         (class Parser_closure): Change language_stack_ from a vector of
9523         std::string to one of Version_script_info::Language.  Adjust all
9524         uses accordingly.
9525         (class Lazy_demangler): Remove.
9526         (struct Version_expression): Change language from std::string to
9527         Version_script_info::Language.
9528         (Version_script_info::Version_script_info): New function.
9529         (Version_script_info::~Version_script_info): Don't call clear.
9530         (Version_script_info::finalize): New function.
9531         (Version_script_info::build_lookup_tables): New function.
9532         (Version_script_info::build_expression_list_lookup): New
9533         function.
9534         (Version_script_info::get_symbol_version_helper): Rewrite to use
9535         lookup tables.
9536         (Version_script_info::print_expression_list): Adjust to use
9537         Version_script_info::Language.
9538         (script_push_lex_into_version_mode): Check that the version script
9539         has not been finalized.
9540         (version_script_push_lang): Change language string to
9541         Version_script_info::Language.
9542         * options.cc (Command_line::version_script): New function.
9543         * options.h (class General_options): Add finalize_dynamic_list
9544         function.  Change version_script from declaration to definition.
9545         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9546         * testsuite/version_script.map: Remove duplicate def of foo.
9547         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9548         version_script.map.
9549         * testsuite/Makefile.in: Rebuild.
9550
9551 2009-12-30  Ian Lance Taylor  <iant@google.com>
9552
9553         PR 10843
9554         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9555         if the input symbol index is 0, make the output symbol index 0.
9556
9557 2009-12-30  Ian Lance Taylor  <iant@google.com>
9558
9559         PR 10670
9560         * options.h (class General_options): Add -x/--discard-all.
9561         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9562         --discard-all.  If the local symbol needs a dynamic entry, check
9563         that before handling --discard-locals.
9564
9565 2009-12-30  Ian Lance Taylor  <iant@google.com>
9566
9567         PR 10450
9568         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9569         flags to PF_R.
9570         (Output_segment::add_output_section): Don't change the flags if
9571         the type is PT_TLS.
9572
9573         PR 10450
9574         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9575         GNU hash table if they need a dynamic value.  Otherwise, don't add
9576         them if they are defined in a dynamic object or are forced local.
9577
9578 2009-12-29  Ian Lance Taylor  <iant@google.com>
9579
9580         PR 10450
9581         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9582         .gnu.hash table for a 32-bit target.
9583
9584         PR 10450
9585         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9586         regular and a dynamic object only needs a dynamic symbol table
9587         entry if it is externally visible.
9588
9589         PR 10450
9590         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9591         constructor.  Add global_offset_table_ field.
9592         (Target_i386::got_section): Set global_offset_table_.
9593         (Target_i386::do_finalize_sections): Set global_offset_table_
9594         size.
9595         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9596         in constructor.  Add global_offset_table_ field.
9597         (Target_x86_64::got_section): Set global_offset_table_.
9598         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9599         size.
9600
9601         * layout.cc (Layout::Layout): Initialize increase_relro_.
9602         (Layout::get_output_section): Add is_relro, is_last_relro, and
9603         is_first_non_relro parameters.  Change all callers.
9604         (Layout::choose_output_section): Likewise.
9605         (Layout::add_output_section_data): Likewise.
9606         (Layout::make_output_section): Likewise.
9607         (Layout::set_segment_offsets): Clear increase_relro when using a
9608         linker script.
9609         * layout.h (class Layout): Add increase_relro method.  Add
9610         increase_relro_ field.  Update declarations.
9611         * output.cc (Output_section::Output_section): Initialize
9612         is_last_relro_ and is_first_non_relro_.
9613         (Output_segment::add_output_section): Group relro sections is
9614         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9615         (Output_segment::maximum_alignment): Remove relro handling.
9616         (Output_segment::set_section_addresses): Add increase_relro
9617         parameter.  Change all callers.  Add initial alignment to align
9618         relro sections on separate page.  Remove old relro handling.
9619         (Output_segment::set_section_list_addresses): Remove in_relro
9620         parameter.  Change all callers.
9621         (Output_segment::set_offset): Add increase parameter.  Change all
9622         callers.  Remove old relro handling.
9623         * output.h (class Output_section): Add new methods: is_last_relro,
9624         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9625         Add is_last_relro_ and is_first_non_relro_ fields.
9626         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9627         Create separate .got.plt section.  Call increase_relro.
9628         * x86_64.cc (Target_x86_64::got_section): Likewise.
9629         * testsuite/relro_script_test.t: Add .got.plt.
9630
9631         PR 10450
9632         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9633         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9634         (Layout::finalize): Call set_dynamic_symbol_size.
9635         (Layout::set_dynamic_symbol_size): New function.
9636         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9637         set_dynamic_symbol_size.
9638
9639         PR 10450
9640         * output.h (class Output_section): Add is_entsize_zero_ field.
9641         * output.cc (Output_section::Output_section): Initialize
9642         is_entsize_zero_.
9643         (Output_section::set_entsize): If two different entsizes are
9644         requested, force it to zero.
9645         (Output_section::add_input_section): Set flags for .debug_str
9646         before updating section flags.  Set entsize.
9647         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9648         and SHF_STRING if all input sections have those flags.
9649
9650 2009-12-29   Rafael Espindola  <espindola@google.com>
9651
9652         * main.cc (main): Fix the sys time reporting.
9653         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9654         reporting.
9655
9656 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9657
9658         * options.cc (General_options::parse_version): Allow -v to exit
9659         without an error if there is nothing to link.
9660
9661 2009-12-29  Ian Lance Taylor  <iant@google.com>
9662
9663         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9664         using a version of gcc before 4.1.
9665         * configure: Rebuild.
9666
9667 2009-12-28  Chris Demetriou  <cgd@google.com>
9668
9669         * attributes.cc (Output_attributes_section_data::do_write): Use
9670         std::vector::front rather than std::vector::data.
9671
9672 2009-12-28  Ian Lance Taylor  <iant@google.com>
9673
9674         * symtab.h (class Symbol_table): Add enum Defined.
9675         * resolve.cc (Symbol_table::should_override): Add defined
9676         parameter.  Change all callers.  Test whether object is NULL
9677         before calling a method on it.
9678         (Symbol_table::report_resolve_problem): Add defined parameter.
9679         Change all callers.
9680         (Symbol_table::should_override_with_special): Likewise.
9681         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9682         parameter.  Change all callers.
9683         (Symbol_table::do_define_in_output_data): Likewise.
9684         (Symbol_table::define_in_output_segment): Likewise.
9685         (Symbol_table::do_define_in_output_segment): Likewise.
9686         (Symbol_table::define_as_constant): Likewise.
9687         (Symbol_table::do_define_as_constant): Likewise.
9688         * script.h (class Symbol_assignment): Add is_defsym parameter to
9689         constructor; change all callers.
9690         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9691         parameter.  Change all callers.  Add is_defsym_ field.
9692         (class Parser_closure): Add parsing_defsym parameter to
9693         constructor; change all callers.  Add parsing_defsym accessor
9694         function.  Add parsing_defsym_ field.
9695
9696 2009-12-28  Ian Lance Taylor  <iant@google.com>
9697
9698         * gold.cc (queue_middle_tasks): Fix formatting.
9699         * object.cc (Relobj::is_section_name_included): Likewise.
9700
9701 2009-12-23  Ian Lance Taylor  <iant@google.com>
9702
9703         * i386.cc (Target_i386::do_calls_non_split): Recognize
9704         -fsplit-stack prologue for a function with a static chain.
9705         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9706         -fsplit-stack prologue when using %r11.
9707
9708 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9709
9710         * options.cc (General_options::parse_version): Make -v continue and do
9711         the link like GNU ld does.
9712
9713 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9714
9715         * Makefile.am (CCFILES): Add timer.cc.
9716         (HFILES): Add timer.h.
9717         * configure.ac: Check for sysconf and times.
9718         * main.cc: include timer.h.
9719         (main): Use Timer instead of get_run_time.
9720         * timer.cc: New.
9721         * timer.h: New.
9722         * workqueue.cc: include timer.h.
9723         (Workqueue::find_and_run_task):
9724         Report user, sys and wall time.
9725         * Makefile.in: Regenerate.
9726         * config.in: Regenerate.
9727         * configure: Regenerate.
9728
9729 2009-12-16  Doug Kwan  <dougkwan@google.com>
9730
9731         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9732         sections.
9733         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9734         relaxed input sections.
9735         * output.cc (Output_section::find_relaxed_input_section): Change
9736         return type to Output_relaxed_input_section pointer.  Adjust code
9737         for new type of relaxed_input_section_map_.
9738         * output.h (Output_section::find_relaxed_input_section): Change
9739         return type to Output_relaxed_input_section pointer.
9740         (Output_section::Output_relaxed_input_section_by_input_section_map):
9741         New type.
9742         (Output_section::relaxed_input_section_map_): Change type to
9743         Output_section::Output_relaxed_input_section_by_input_section_map.
9744         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9745         input section.
9746
9747 2009-12-15  Ian Lance Taylor  <iant@google.com>
9748
9749         * layout.cc (Layout::create_shstrtab): Only write out after input
9750         sections if we are compressing debug sections.
9751
9752 2009-12-15  Ian Lance Taylor  <iant@google.com>
9753
9754         * archive.cc (Archive::add_symbols): Only look up a symbol without
9755         a version if there is, in fact, a version.
9756
9757 2009-12-14  Ian Lance Taylor  <iant@google.com>
9758
9759         Revert -Wshadow changes, all changes from:
9760         2009-12-11  Doug Kwan  <dougkwan@google.com>
9761         2009-12-11  Nick Clifton  <nickc@redhat.com>
9762         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9763
9764 2009-12-11  Doug Kwan  <dougkwan@google.com>
9765
9766         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9767         due to -Wshadow.
9768         * attributes.cc (Object_attribute::size): Ditto.
9769         (Attributes_section_data::size): Ditto.
9770         (Attributes_section_data::Attributes_section_data): Ditto.
9771         (Output_attributes_section_data::do_write): Ditto.
9772         * attributes.h (Object_attribute::set_type): Ditto.
9773         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9774
9775 2009-12-11  Nick Clifton  <nickc@redhat.com>
9776
9777         * archive.cc: Fix shadowed variable warnings.
9778         * arm.cc: Likewise.
9779         * compressed_output.cc: Likewise.
9780         * compressed_output.h: Likewise.
9781         * configure: Likewise.
9782         * dwarf_reader.cc: Likewise.
9783         * dynobj.cc: Likewise.
9784         * dynobj.h: Likewise.
9785         * ehframe.cc: Likewise.
9786         * ehframe.h: Likewise.
9787         * errors.cc: Likewise.
9788         * expression.cc: Likewise.
9789         * fileread.cc: Likewise.
9790         * fileread.h: Likewise.
9791         * freebsd.h: Likewise.
9792         * i386.cc: Likewise.
9793         * icf.cc: Likewise.
9794         * incremental.h: Likewise.
9795         * layout.cc: Likewise.
9796         * layout.h: Likewise.
9797         * mapfile.cc: Likewise.
9798         * merge.cc: Likewise.
9799         * merge.h: Likewise.
9800         * object.cc: Likewise.
9801         * object.h: Likewise.
9802         * options.h: Likewise.
9803         * output.cc: Likewise.
9804         * output.h: Likewise.
9805         * parameters.cc: Likewise.
9806         * plugin.cc: Likewise.
9807         * powerpc.cc: Likewise.
9808         * reduced_debug_output.cc: Likewise.
9809         * reduced_debug_output.h: Likewise.
9810         * reloc.cc: Likewise.
9811         * reloc.h: Likewise.
9812         * resolve.cc: Likewise.
9813         * script-sections.cc: Likewise.
9814         * script.cc: Likewise.
9815         * script.h: Likewise.
9816         * sparc.cc: Likewise.
9817         * symtab.cc: Likewise.
9818         * symtab.h: Likewise.
9819         * target-select.cc: Likewise.
9820         * target-select.h: Likewise.
9821         * token.h: Likewise.
9822         * workqueue.cc: Likewise.
9823         * workqueue.h: Likewise.
9824         * x86_64.cc: Likewise.
9825
9826 2009-12-10  Doug Kwan  <dougkwan@google.com>
9827
9828         * arm.cc (attributes.h): New include.
9829         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9830         (Arm_relobj::~Arm_relobj): Delete object pointed by
9831         attributes_section_data_.
9832         (Arm_relobj::attributes_section_data): New method definition.
9833         (Arm_relobj::attributes_section_data_): New data member declaration.
9834         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9835         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9836         attributes_section_data_.
9837         (Arm_dynobj::attributes_section_data): New method definition.
9838         (Arm_dynobj::attributes_section_data_): New data member declaration.
9839         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9840         initialization value of may_use_blx_ to false.
9841         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9842         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9843         object attributes to compute results instead of hard-coding.
9844         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9845         Target_arm::get_secondary_compatible_arch,
9846         Target_arm::set_secondary_compatible_arch
9847         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9848         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9849         New method declarations.
9850         (Target_arm::get_aeabi_object_attribute): New method definition.
9851         (Target_arm::attributes_section_data_): New data member declaration.
9852         (read_arm_attributes_section): New template definition.
9853         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9854         (Arm_dynobj::do_read_symbols): Ditto.
9855         (Target_arm::do_finalize_sections): Merge attributes sections from
9856         input.  Check for BLX use after attributes section merging.
9857         Fix __exidx_start and __exidx_end visibility.  Create an
9858         .ARM.attributes section if necessary.
9859         (Target_arm::get_secondary_compatible_arch,
9860         Target_arm::set_secondary_compatible_arch,
9861         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9862         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9863         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9864         New method definitions.
9865
9866 2009-12-09  Ian Lance Taylor  <iant@google.com>
9867
9868         * plugin.cc (Plugin::load): Don't cast from void* to a function
9869         pointer.
9870
9871 2009-12-09  Ian Lance Taylor  <iant@google.com>
9872
9873         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9874         information fields.
9875
9876 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9877
9878         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9879         Replace two_file_shared_1.so with two_file_shared_2.so.
9880         * testsuite/Makefile.in: Regenerated.
9881
9882 2009-12-08  Doug Kwan  <dougkwan@google.com>
9883
9884         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9885         (HFILES): Add attributes.h and int_encoding.h.
9886         * Makefile.in: Regenerate.
9887         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9888         function definitions to int_encoding.cc
9889         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9890         prototypes to int_encoding.h
9891         * reduced_debug_output.cc (int_encoding.h): New include.
9892         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9893         function definitions to int_encoding.cc
9894         (insert_into_vector, read_from_pointer): Move template definitions to
9895         int_encoding.h
9896         * attributes.cc: New file.
9897         * attributes.h: New file.
9898         * int_encoding.cc: New file.
9899         * int_encoding.h: New file.
9900
9901 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
9902
9903         PR gold/11055
9904         * incremental-dump.cc (dump_incremental_inputs): New.
9905         (main): Use dump_incremental_inputs.
9906
9907 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
9908
9909         PR gold/10893
9910         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
9911         checking elfcpp::STT_FUNC.
9912         (Target_i386::Relocate::relocate): Likewise.
9913         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
9914
9915         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
9916         symbols from shared libraries into normal FUNC symbols.
9917
9918         * symtab.h (Symbol): Add is_func and use it.
9919
9920 2009-12-05  Doug Kwan  <dougkwan@google.com>
9921
9922         * arm.cc (Target_arm::arm_info): Initialize new fields
9923         attributes_section and attributes_vendor.
9924         * i386.cc (Target_i386::i386_info): Same.
9925         * object.cc (Sized_relobj::do_layout): Skip attribute section.
9926         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
9927         fields attributes_section and attributes_vendor.
9928         * sparc.cc (Target_sparc::sparc_info): Same.
9929         * target.h (Target::attributes_section, Target::attributes_vendor,
9930         Target::is_attributes_section, Target::attribute_arg_type,
9931         Target::attributes_order): New method definitions.
9932         (Target::Target_info::attributes_section,
9933         Target::Target_info::attributes_vendor): New fields.
9934         (Target::do_attribute_arg_type, Target::do_attributes_order): New
9935         virtual method definitions.
9936         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
9937         attributes_section and attributes_vendor.
9938         * testsuite/testfile.cc (Target_test::test_target_info): Same.
9939
9940 2009-12-05  Doug Kwan  <dougkwan@google.com>
9941
9942         * arm.cc: Update comments about interworking and stub generation.
9943         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
9944         considered as non-PIC.
9945         (Arm_relocate_functions::base_abs): Fix formatting.
9946         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
9947         of function to use GOT entry address instead of offset.
9948         (Target_arm::Scan::global): Issue an error if a symbol would need a
9949         PLT does not get one because it is untyped.  Remove code to create
9950         dynamic symbols for relative branches.
9951         (Target_arm::Relocate::relocate: Use 0 instead of false since function
9952         takes unsigned integer instead of boolean.
9953
9954 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
9955
9956         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
9957         (two_file_test_LDADD): Likewise.
9958         (common_test_1_LDADD): Likewise.
9959         (exception_test_LDADD) Likewise.
9960         (weak_test_LDADD): Likewise.
9961         (many_sections_test_LDADD): Likewise.
9962         (initpri1_LDADD): Likewise.
9963         (script_test_1_LDADD): Likewise.
9964         (script_test_2_LDADD): Likewise.
9965         (justsyms_LDADD): Likewise.
9966         (binary_test_LDADD): Likewise.
9967         (large_LDADD): Likewise.
9968         * testsuite/Makefile.in: Regenerated.
9969
9970 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
9971
9972         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
9973         (Symbol_table::override_with_special): Likewise.
9974         (Symbol_table::add_from_object): Likewise.
9975
9976 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9977
9978         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
9979         Don't set the data_offset twice.
9980
9981 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
9982
9983         * testsuite/Makefile.in: Regenerate.
9984
9985 2009-12-03  Doug Kwan  <dougkwan@google.com>
9986
9987         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
9988         (Target_arm::do_finalize_sections): Add parameter for symbol table
9989         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
9990         * i386.cc (Target_i386::do_finalize_sections): Add an additional
9991         parameter for symbol table pointer.
9992         * layout.cc (Layout::finalize): Call Target::finalize_sections with
9993         an additional parameter for a pointer to symbol table.
9994         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
9995         parameter for a symbol table pointer.
9996         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
9997         * target.h (Target::finalize_sections, Target::do_finalize_sections):
9998         Ditto.
9999         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10000         parameter for a symbol table pointer.
10001
10002 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10003
10004         * incremental.cc (Incremental_inputs_header)
10005         (Incremental_inputs_header_write, Incremental_inputs_entry)
10006         (Incremental_inputs_entry_write): Move ...
10007         * incremental.h (Incremental_inputs_header)
10008         (Incremental_inputs_header_write, Incremental_inputs_entry)
10009         (Incremental_inputs_entry_write): here.
10010
10011 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10012
10013         * incremental.cc (make_sized_incremental_binary): Set the target.
10014         Error if it is incompatible.
10015         * output.h (Output_file): Add filename method.
10016
10017 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10018
10019         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10020         from the get_* methods.
10021
10022 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10023
10024         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10025         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10026         Write 0 for the data_offset of scripts.
10027
10028 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10029
10030         * testsuite/Makefile.am: Add the incremental_test.sh test.
10031         * testsuite/incremental_test.sh: New.
10032         * testsuite/incremental_test_1.c: New.
10033         * testsuite/incremental_test_2.c: New.
10034
10035 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10036
10037         * incremental-dump.cc (main): Fix typos.
10038
10039 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10040
10041         PR gold/11025
10042         * incremental-dump.cc (main): Use llu to print 64 bit values.
10043
10044 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10045             H.J. Lu  <hongjiu.lu@intel.com>
10046
10047         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10048         $(LIBDL).
10049         (incremental_dump_LDADD): Likewise.
10050         * Makefile.in: Regenerated.
10051
10052 2009-11-25  Doug Kwan  <dougkwan@google.com>
10053
10054         Revert:
10055
10056         2009-11-25  Doug Kwan  <dougkwan@google.com>
10057
10058                 * arm.cc (Target_arm::Target_arm): Move method definition
10059                 outside of class definition.  Add code to handle
10060                 --target1-rel, --target1-abs and --target2= options.
10061                 (Target_arm::get_reloc_reloc_type): Change method to be
10062                 non-static and const.
10063                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10064                 New data member declaration.
10065                 (Target_arm::Scan::local, Target_arm::Scan::global,
10066                 Target_arm::Relocate::relocate,
10067                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10068                 Adjust call to Target_arm::get_real_reloc_type.
10069                 (Target_arm::get_real_reloc_type): Use command line options
10070                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10071                 * options.h (--target1-rel, --target1-abs, --target2): New
10072                 ARM-only options.
10073
10074 2009-11-25  Doug Kwan  <dougkwan@google.com>
10075
10076         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10077         class definition.  Add code to handle --target1-rel, --target1-abs
10078         and --target2= options.
10079         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10080         and const.
10081         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10082         member declaration.
10083         (Target_arm::Scan::local, Target_arm::Scan::global,
10084         Target_arm::Relocate::relocate,
10085         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10086         call to Target_arm::get_real_reloc_type.
10087         (Target_arm::get_real_reloc_type): Use command line options to
10088         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10089         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10090         options.
10091
10092 2009-11-25  Doug Kwan  <dougkwan@google.com>
10093
10094         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10095         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10096         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10097         formatting.
10098         (Arm_relocate_functions::thm_call): Replace body with a call to
10099         Arm_relocate_functions::thumb_branch_common.
10100         (Arm_relocate_functions::thm_jump24,
10101         Arm_relocate_functions::thm_xpc22): New method definitions.
10102         (Arm_relocate_functions::thumb_branch_common): New method definition.
10103         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10104         operator.
10105         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10106         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10107
10108 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10109
10110         * Makefile.am: Build incremental-dump
10111         * Makefile.in: Regenerate.
10112         * incremental-dump.cc: New.
10113         * incremental.cc (Incremental_inputs_header_data,
10114         Incremental_inputs_entry_data): Move to incremental.h
10115         * incremental.h: (Incremental_inputs_header_data,
10116         Incremental_inputs_entry_data): Move from incremental.cc
10117
10118 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10119
10120         * incremental.cc (Incremental_inputs_header,
10121         Incremental_inputs_header_write, Incremental_inputs_entry,
10122         Incremental_inputs_entry_write): Add a typedef with the data type.
10123
10124 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10125
10126         * incremental.cc (Incremental_inputs_header,
10127         Incremental_inputs_header_write, Incremental_inputs_entry,
10128         Incremental_inputs_entry_write): Update comment about which
10129         type has the filed descriptions.
10130
10131 2009-11-15  Doug Kwan  <dougkwan@google.com>
10132
10133         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10134         (Arm_relocate_functions::arm_branch_common): Change method defintion
10135         in class definition to a method declaration and update list of formal
10136         parameters.
10137         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10138         Arm_relocation_functions::jump24): Adjust call to
10139         Arm_relocate_functions::arm_branch_common.  Update list of formal
10140         parameters.
10141         (Arm_relocate_functions::xpc25): New method definition.
10142         (Arm_relocate_functions::arm_branch_common): Move method defintion
10143         out from class definition.  Use stubs for mode-switching and extending
10144         branch ranges.
10145         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10146         specially.  Change code to enable use of stubs in ARM branches.
10147
10148 2009-11-10  Doug Kwan  <dougkwan@google.com>
10149
10150         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10151         in method declaration.
10152         (Target_arm::relocate_stub): New method declaration.
10153         (Target_arm::default_target): Change to return a pointer instead of
10154         a const reference.
10155         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10156         Target_arm::default_target.
10157         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10158         method definition.
10159         (Target_arm::relocate_section): Adjust view.
10160         (Target_arm::relocate_stub): New method definition.
10161
10162 2009-11-10  Doug Kwan  <dougkwan@google.com>
10163
10164         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10165         a format warning.
10166         * incremental.cc (open_incremental_binary): Initialized local
10167         variables to avoid warnings.
10168         * object.cc (make_elf_object): Ditto.
10169         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10170         a format warning.
10171
10172 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10173
10174         PR gold/10930
10175         * testsuite/plugin_test.c: Include "config.h".
10176
10177 2009-11-09  Doug Kwan  <dougkwan@google.com>
10178
10179         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10180         (arm_symbol_value): Remove.
10181         (Arm_relocate_functions::arm_branch_common,
10182         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10183         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10184         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10185         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10186         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10187         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10188         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10189         Arm_relocate_functions::thm_mobw_abs_nc,
10190         Arm_relocate_functions::thm_mov_abs,
10191         Arm_relocate_functions::movw_prel_nc,
10192         Arm_relocate_functions::thm_movt_abs,
10193         Arm_relocate_functions::movt_prel,
10194         Arm_relocate_functions::thm_movw_prel_nc,
10195         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10196         (Target_arm::Relocate::relocate): Only decompose address into two
10197         parts if relocation type uses the thumb-bit and pass the actual
10198         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10199         calls to methods in Arm_relocate_functions for this change.
10200
10201 2009-11-08  Ian Lance Taylor  <iant@google.com>
10202
10203         PR 10925
10204         * reloc.cc: Instantiate
10205         Sized_relobj::initialize_input_to_output_maps and
10206         Sized_relobj:free_input_to_output_maps.
10207
10208 2009-11-06  Ian Lance Taylor  <iant@google.com>
10209
10210         PR 10876
10211         * defstd.cc (in_segment): Set only_if_ref true for "end".
10212
10213 2009-11-06  Doug Kwan  <dougkwan@google.com>
10214
10215         * arm.cc (class Reloc_stub): Correct a comment.
10216         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10217         (Target_arm::scan_section_for_stubs): New method declaration.
10218         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10219         Change methods from private to protected.
10220         (Target_arm::do_may_relax): New method definition.
10221         (Target_arm::do_relax, Target_arm::group_sections,
10222         Target_arm::scan_reloc_for_stub,
10223         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10224         (Target_arm::arm_input_section_map_): New data member declaration.
10225         (Target_arm::scan_reloc_for_stub,
10226         Target_arm::scan_reloc_section_for_stubs,
10227         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10228         Target_arm::do_relax): New method definitions.
10229
10230 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10231
10232         * configure.ac: Check for (struct stat)::st_mtim
10233         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10234         * config.in: Regenerate.
10235         * configure: Regenerate.
10236
10237 2009-11-05  Ian Lance Taylor  <iant@google.com>
10238
10239         PR 10910
10240         * output.cc (Output_segment::add_output_section): Add missing
10241         return statement.
10242
10243 2009-11-04  Ian Lance Taylor  <iant@google.com>
10244
10245         PR 10880
10246         * object.h (class Object): Add is_needed and set_is_needed
10247         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10248         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10249         defined in a dynamic object and referenced by a regular object,
10250         set is_needed for the dynamic object.
10251         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10252         if the file is marked with as_needed and it is not needed.
10253
10254 2009-11-04  Ian Lance Taylor  <iant@google.com>
10255
10256         PR 10887
10257         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10258         tags if data is discarded by linker script.
10259         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10260         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10261         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10262         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10263
10264 2009-11-04  Ian Lance Taylor  <iant@google.com>
10265
10266         * layout.cc (Layout::get_output_section): Add is_interp and
10267         is_dynamic_linker_section parameters.  Change all callers.
10268         (Layout::choose_output_section): Likewise.
10269         (Layout::make_output_section): Likewise.
10270         (Layout::add_output_section_data): Add is_dynamic_linker_section
10271         parameter.  Change all callers.
10272         * layout.h (class Layout): Update declarations.
10273         * output.h (class Output_section): Add is_interp, set_is_interp,
10274         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10275         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10276         generate_code_fills_at_write_ to a bitfield.
10277         * output.cc (Output_section::Output_sections): Initialize new
10278         fields.
10279         (Output_segment::add_output_section): Add do_sort parameter.
10280         Change all callers.
10281
10282 2009-11-03  Ian Lance Taylor  <iant@google.com>
10283
10284         PR 10860
10285         * options.h (class General_options): Add --warn-common.
10286         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10287         merging two common symbols.
10288         (Symbol_table::should_override): Handle --warn-common when merging
10289         a common symbol with a defined symbol.  Use report_resolve_problem
10290         for multiple definitions.
10291         (Symbol_table::report_resolve_problem): New function.
10292         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10293
10294 2009-11-03  Doug Kwan  <dougkwan@google.com>
10295
10296         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10297         stub_factory_.
10298         (Target_arm::stub_factory): New method definition.
10299         (Target_arm::new_arm_input_section,
10300         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10301         Target_arm::reloc_uses_thumb_bit): New method declarations.
10302         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10303         New type definitions.
10304         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10305         member declarations.
10306         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10307         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10308         New method definitions.
10309
10310 2009-11-03  Ian Lance Taylor  <iant@google.com>
10311
10312         * options.h (class General_options): Add --warn_constructors.
10313
10314 2009-11-03  Ian Lance Taylor  <iant@google.com>
10315
10316         PR 10893
10317         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10318         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10319
10320 2009-11-03  Ian Lance Taylor  <iant@google.com>
10321
10322         PR 10895
10323         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10324         --msgid-bugs-address.
10325         (install-pdf): New target.
10326         (install-data_yes): Look up one directory to find mkinstalldirs.
10327
10328 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10329
10330         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10331         tree.
10332
10333 2009-10-30  Doug Kwan  <dougkwan@google.com>
10334
10335         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10336
10337 2009-10-30  Doug Kwan  <dougkwan@google.com>
10338
10339         * arm.cc (Stub_addend_reader): New struct template definition
10340         and partial specializations.
10341         (Stub_addend_reader::operator()): New method definition for a
10342         partially specialized template.
10343
10344 2009-10-30  Doug Kwan  <dougkwan@google.com>
10345
10346         * arm.cc (Arm_relobj::processor_specific_flags): New method
10347         definition.
10348         (Arm_relobj::do_read_symbols): New method declaration.
10349         (Arm_relobj::processor_specific_flags_): New data member declaration.
10350         (Arm_dynobj): New class definition.
10351         (Target_arm::do_finalize_sections): Add input_objects parameter.
10352         (Target_arm::do_adjust_elf_header): New method declaration.
10353         (Target_arm::are_eabi_versions_compatible,
10354         (Target_arm::merge_processor_specific_flags): New method declaration.
10355         (Target_arm::do_make_elf_object): New overloaded method definitions
10356         and declaration.
10357         (Arm_relobj::do_read_symbols): New method definition.
10358         (Arm_dynobj::do_read_symbols): Ditto.
10359         (Target_arm::do_finalize_sections): Add input_objects parameters.
10360         Merge processor-specific flags from all input objects.
10361         (Target_arm::are_eabi_versions_compatible,
10362         Target_arm::merge_processor_specific_flags,
10363         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10364         New method definitions.
10365         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10366         Input_objects pointer type parameter.
10367         * layout.cc (Layout::finalize): Pass input objects to target's.
10368         finalize_sections function.
10369         * output.cc (Output_file_header::do_sized_write): Set ELF file
10370         header's processor-specific flags.
10371         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10372         Input_objects pointer type parameter.
10373         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10374         * target.h (Input_objects): New forward class declaration.
10375         (Target::processor_specific_flags,
10376         Target::are_processor_specific_flags_sect): New method definitions.
10377         (Target::finalize_sections): Add input_objects parameter.
10378         (Target::Target): Initialize processor_specific_flags_ and
10379         are_processor_specific_flags_set_.
10380         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10381         parameter.
10382         (Target::set_processor_specific_flags): New method definition.
10383         (Target::processor_specific_flags_,
10384         Target::are_processor_specific_flags_set_): New data member
10385         declarations.
10386         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10387         Input_objects pointer type parameter.
10388
10389 2009-10-30  Doug Kwan  <dougkwan@google.com>
10390
10391         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10392
10393 2009-10-28  Ian Lance Taylor  <iant@google.com>
10394
10395         * object.h (class Relobj): Drop options parameter from
10396         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10397         do_scan_relocs, do_relocate.  Change all callers.
10398         (class Sized_relobj): Drop options parameters from
10399         do_gc_process_relocs, do_scan_relocs, do_relocate,
10400         do_relocate_sections, relocate_sections, emit_relocs_scan,
10401         emit_relocs_scan_reltype.  Change all callers.
10402         (struct Relocate_info): Remove options field and all references to
10403         it.
10404         * reloc.h (class Read_relocs): Remove options constructor
10405         parameter and options_ field.  Change all callers.
10406         (class Gc_process_relocs, class Scan_relocs): Likewise.
10407         (class Relocate_task): Likewise.
10408         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10409         all callers.
10410         (scan_relocatable_relocs): Likewise.
10411         * target.h (class Sized_target): Remove options parameter from
10412         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10413         all callers.
10414         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10415         callers.
10416         * arm.cc: Update functions to remove options parameters.
10417         * i386.cc: Likewise.
10418         * powerpc.cc: Likewise.
10419         * sparc.cc: Likewise.
10420         * x86_64.cc: Likewise.
10421         * testsuite/testfile.cc: Likewise.
10422
10423 2009-10-28  Doug Kwan  <dougkwan@google.com>
10424
10425         * arm.cc (Arm_relobj): New class definition.
10426         (Arm_relobj::scan_sections_for_stubs,
10427         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10428         New method definitions.
10429
10430 2009-10-28  Cary Coutant  <ccoutant@google.com>
10431
10432         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10433         (Plugin::cleanup_done_): New member.
10434         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10435         (Plugin_manager::cleanup_done_): Remove.
10436         (Plugin_manager::add_input_file): Edit error message.
10437         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10438         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10439
10440 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10441
10442         * fileread.cc: (File_read::View::~View): Use the new
10443         data_ownership_ filed.
10444         (File_read::~File_read): Dispose the new whole_file_view_.
10445         (File_read::open): Mmap the whole file if needed.
10446         (File_read::open): Use whole_file_view_ instead of contents_.
10447         (File_read::find_view): Use whole_file_view_ if applicable.
10448         (File_read::do_read): Use whole_file_view_ instead of contents_.
10449         (File_read::make_view): Use whole_file_view_ instead of contents_,
10450         update File_read::View::View call.
10451         (File_read::find_or_make_view): Update File_read::View::View
10452         call.
10453         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10454         remove contents_
10455         (File_read::View::Data_ownership): New enum.
10456         (File_read::View::View): Replace bool mapped_ with Data_ownership
10457         argument.
10458         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10459         (File_read::View::data_ownership_): New field.
10460         (File_read::contents_): Remove (replaced by whole_file_view_).
10461         (File_read::whole_file_view_): New field.
10462         * options.h (class General_options): Add --keep-files-mapped.
10463
10464 2009-10-27  Cary Coutant  <ccoutant@google.com>
10465
10466         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10467         * testsuite/Makefile.am (plugin_test_5): New test case.
10468         * testsuite/Makefile.in: Regenerate.
10469
10470 2009-10-25  Doug Kwan  <dougkwan@google.com>
10471
10472         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10473         from private to protected to allow access by child class.
10474         (Sized_relobj::do_relocate_sections): New method declaration.
10475         (Sized_relobj::relocate_sections): Virtualize.
10476         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10477         Sized_relobj::relocate_sections.  Instantiate template explicitly
10478         for different target sizes and endianity.
10479
10480 2009-10-24  Doug Kwan  <dougkwan@google.com>
10481
10482         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10483         (Arm_input_section::as_arm_input_section): New method.
10484         (Arm_output_section): New class definition.
10485         (Arm_output_section::create_stub_group,
10486         Arm_output_section::group_sections): New method definitions.
10487
10488 2009-10-22  Doug Kwan  <dougkwan@google.com>
10489
10490         * arm.cc (Arm_input_section): New class definition.
10491         (Arm_input_section::init, Arm_input_section:do_write,
10492         Arm_input_section::set_final_data_size,
10493         Arm_input_section::do_reset_address_and_file_offset): New method
10494         definitions.
10495
10496 2009-10-21  Doug Kwan  <dougkwan@google.com>
10497
10498         * arm.cc (Stub_table, Arm_input_section): New forward class
10499         declarations.
10500         (Stub_table): New class defintion.
10501         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10502         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10503         New method definition.
10504
10505 2009-10-21  Doug Kwan  <dougkwan@google.com>
10506
10507         * arm.cc: Update copyright comments.
10508         (Target_arm): New forward class template declaration.
10509         (Arm_address): New type.
10510         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10511         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10512         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10513         constants.
10514         (Insn_template): Same.
10515         (DEF_STUBS): New macro.
10516         (Stub_type): New enum type.
10517         (Stub_template): New class definition.
10518         (Stub): Same.
10519         (Reloc_stub): Same.
10520         (Stub_factory): Same.
10521         (Target_arm::Target_arm): Initialize may_use_blx_ and
10522         should_force_pic_veneer_.
10523         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10524         Target_arm::should_force_pic_veneer,
10525         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10526         Target_arm::using_thumb_only, Target_arm:;default_target): New
10527         method defintions.
10528         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10529         New data member declarations.
10530         (Insn_template::size, Insn_template::alignment): New method defintions.
10531         (Stub_template::Stub_template): New method definition.
10532         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10533         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10534         (Stub_factory::Stub_factory): New method definition.
10535         * gold.h (string_hash): New template.
10536         * output.h (Input_section_specifier::hash_value): Use
10537         gold::string_hash.
10538         (Input_section_specifier::string_hash): Remove.
10539         * stringpool.cc (Stringpool_template::string_hash): Use
10540         gold::string_hash.
10541
10542 2009-10-20  Doug Kwan  <dougkwan@google.com>
10543
10544         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10545         symbols of relaxed input sections.
10546         * output.h (Output_section::find_relaxed_input_section): Make
10547         method public.
10548
10549 2009-10-16  Doug Kwan  <dougkwan@google.com>
10550
10551         * dynobj.cc (Versions::Versions): Initialize version_script_.
10552         Only insert base version symbol definition for a shared object
10553         if version script defines any version versions.
10554         (Versions::define_base_version): New method definition.
10555         (Versions::add_def): Check that base version is not needed.
10556         (Versions::add_need): Define base version lazily.
10557         * dynobj.h (Versions::define_base_version): New method declaration.
10558         (Versions::needs_base_version_): New data member declaration.
10559         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10560         (check_DATA): Add no_version_test.stdout.
10561         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10562         New make rules.
10563         * testsuite/Makefile.in: Regenerate.
10564         * testsuite/no_version_test.c: New file.
10565         * testsuite/no_version_test.sh: Ditto.
10566
10567 2009-10-16  Doug Kwan  <dougkwan@google.com>
10568
10569         * expression.cc (class Segment_start_expression): New class definition.
10570         (Segment_start_expression::value): New method definition.
10571         (script_exp_function_segment_start): Return a new
10572         Segment_start_expression.
10573         * gold/script-c.h (script_saw_segment_start_expression): New function
10574         prototype.
10575         * script-sections.cc (Script_sections::Script_sections): Initialize
10576         SAW_SEGMENT_START_EXPRESSION_ to false.
10577         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10578         and -Tbbs options to specify section addresses if given in
10579         command line and no SEGMENT_START expression is seen in a script.
10580         * script-sections.h (Script_sections::saw_segment_start_expression,
10581         Script_sections::set_saw_segment_start_expression): New method
10582         definition.
10583         (Script_sections::saw_segment_start_expression_): New data member
10584         declaration.
10585         * script.cc (script_saw_segment_start_expression): New function.
10586         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10587         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10588         script_test_7.sh and script_test_8.sh.
10589         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10590         script_test_8.stdout.
10591         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10592         (script_test_6, script_test_6.stdout, script_test_7,
10593         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10594         * Makefile.in: Regenerate.
10595         * testsuite/script_test_6.sh: New file.
10596         * testsuite/script_test_6.t: Same.
10597         * testsuite/script_test_7.sh: Same.
10598         * testsuite/script_test_7.t: Same.
10599         * testsuite/script_test_8.sh: Same.
10600
10601 2009-10-16  Doug Kwan  <dougkwan@google.com>
10602
10603         * output.cc (Output_segment::set_section_list_address): Cast
10604         expressions to unsigned long long type to avoid format warnings.
10605
10606 2009-10-15  Ian Lance Taylor  <iant@google.com>
10607
10608         * script.cc (Script_options::add_symbol_assignment): Always add a
10609         dot assignment to script_sections_.
10610         * script-sections.cc (Script_sections::add_dot_assignment):
10611         Initialize if necessary.
10612
10613         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10614         program headers with no load segment if there is a linker script.
10615
10616         * layout.cc (Layout::set_segment_offsets): Align the file offset
10617         to the segment aligment for -N or -n with no load segment.
10618         * output.cc (Output_segment::add_output_section): Don't crash if
10619         the first section is a TLS section.
10620         (Output_segment::set_section_list_addresses): Print an error
10621         message if the address moves backward in a linker script.
10622         * script-sections.cc
10623         (Output_section_element_input::set_section_addresses): Don't
10624         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10625         (Orphan_output_section::set_section_addresses): Likewise.
10626
10627 2009-10-15  Doug Kwan  <dougkwan@google.com>
10628
10629         * layout.cc (Layout::finish_dynamic_section): Generate tags
10630         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10631         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10632         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10633
10634 2009-10-14  Ian Lance Taylor  <iant@google.com>
10635
10636         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10637         fields.
10638         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10639         data_shdr fields of relinfo.
10640         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10641         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10642         R_386_TLS_LDO_32, adjust based on section flags.
10643         (Target_i386::Relocate::fix_up_ldo): Remove.
10644
10645 2009-10-13  Ian Lance Taylor  <iant@google.com>
10646
10647         Add support for -pie.
10648         * options.h (class General_options): Add -pie and
10649         --pic-executable.
10650         (General_options::output_is_position_independent): Test -pie.
10651         (General_options::output_is_executable): Return true if not shared
10652         and not relocatable.
10653         (General_options::output_is_pie): Remove.
10654         * options.cc (General_options::finalize): Reject incompatible uses
10655         of -pie.
10656         * gold.cc (queue_middle_tasks): A -pie link is not static.
10657         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10658         * symtab.cc (Symbol::final_value_is_known): Return false if
10659         output_is_position_independent.
10660         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10661         output_is_position_independent.
10662         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10663         output_is_position_independent.
10664         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10665         output_is_position_independent.
10666         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10667         two_file_pie_test.
10668         (basic_pie_test.o, basic_pie_test): New targets.
10669         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10670         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10671         (two_file_pie_test): New target.
10672         * testsuite/Makefile.in: Rebuild.
10673         * README: Remove note saying that -pie is not supported.
10674
10675 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10676
10677         * options.h (class General_options): Add -init and -fini.
10678         * layout.cc (Layout::finish_dynamic_section): Emit
10679         given init and fini functions.
10680
10681 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10682
10683         * gc.h (gc_process_relocs): Check if icf is enabled using new
10684         function.
10685         * gold.cc (queue_initial_tasks): Likewise.
10686         (queue_middle_tasks): Likewise.
10687         * object.cc (do_layout): Likewise.
10688         * symtab.cc (is_section_folded): Likewise.
10689         * main.cc (main): Likewise.
10690         * reloc.cc (Read_relocs::run): Likewise.
10691         (Sized_relobj::do_scan_relocs): Likewise.
10692         * icf.cc (is_function_ctor_or_dtor): New function.
10693         (Icf::find_identical_sections): Check if function is ctor or dtor when
10694         safe icf is chosen.
10695         * options.h (General_options::icf): Change option to be an enum.
10696         (Icf_status): New enum.
10697         (icf_enabled): New method.
10698         (icf_safe_folding): New method.
10699         (set_icf_status): New method.
10700         (icf_status_): New variable.
10701         * (options.cc) (General_options::finalize): Set icf_status_.
10702         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10703         icf_test and icf_keep_unique_test to use the --icf enum flag.
10704         * testsuite/icf_safe_test.sh: New file.
10705         * testsuite/icf_safe_test.cc: New file.
10706
10707 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10708
10709         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10710         includes to gc.h and icf.h.
10711         * arm.cc: Include gc.h.
10712         * gold.cc: Likewise.
10713         * i386.cc: Likewise.
10714         * powerpc.cc: Likewise.
10715         * sparc.cc: Likewise.
10716         * x86_64.cc: Likewise.
10717         * gc.h: Include icf.h.
10718
10719 2009-10-11  Ian Lance Taylor  <iant@google.com>
10720
10721         * plugin.cc: Include "gold.h" before other header files.
10722
10723 2009-10-10  Chris Demetriou  <cgd@google.com>
10724
10725         * options.h (Input_file_argument::Input_file_type): New enum.
10726         (Input_file_argument::is_lib_): Replace with...
10727         (Input_file_argument::type_): New member.
10728         (Input_file_argument::Input_file_argument): Take Input_file_type
10729         'type' rather than boolean 'is_lib' as second argument.
10730         (Input_file_argument::is_lib): Use type_.
10731         (Input_file_argument::is_searched_file): New function.
10732         (Input_file_argument::may_need_search): Handle is_searched_file.
10733         * options.cc (General_options::parse_library): Support -l:filename.
10734         (General_options::parse_just_symbols): Update for Input_file_argument
10735         changes.
10736         (Command_line::process): Likewise.
10737         * archive.cc (Archive::get_file_and_offset): Likewise.
10738         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10739         * script.cc (read_script_file, script_add_file): Likewise.
10740         * fileread.cc (Input_file::Input_file): Likewise.
10741         (Input_file::will_search_for): Handle is_searched_file.
10742         (Input_file::open): Likewise.
10743         * readsyms.cc (Read_symbols::get_name): Likewise.
10744         * testsuite/Makefile.am (searched_file_test): New test.
10745         * testsuite/Makefile.in: Regenerate.
10746         * testsuite/searched_file_test.cc: New file.
10747         * testsuite/searched_file_test_lib.cc: New file.
10748
10749 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10750             Ian Lance Taylor  <iant@google.com>
10751
10752         * descriptor.cc: Include <cstdio> and "binary-io.h".
10753         (Descriptors::open): Open the files in binary mode always.
10754         * script.cc (Lex::get_token): Treat \r as whitespace.
10755
10756 2009-10-09  Ian Lance Taylor  <iant@google.com>
10757
10758         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10759
10760 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10761             Ian Lance Taylor  <iant@google.com>
10762
10763         * configure.ac: Check for readv function also.
10764         * fileread.cc (readv): Define if not HAVE_READV.
10765         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10766         does not exist.
10767         * config.in: Regenerate.
10768         * configure: Regenerate.
10769
10770 2009-10-09  Doug Kwan  <dougkwan@google.com>
10771
10772         * layout.cc (Layout::make_output_section): Call target hook to make
10773         ordinary output section.
10774         (Layout::finalize): Adjust parameter list of call the
10775         Target::may_relax().
10776         * layout.h (class Layout::section_list): New method.
10777         * merge.h (Output_merge_base::entsize): Change visibility to public.
10778         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10779         New methods.
10780         (Output_merge_string::do_is_string): New method.
10781         * object.cc (Sized_relobj::do_setup): renamed from
10782         Sized_relobj::set_up.
10783         * object.h (Sized_relobj::adjust_shndx,
10784         Sized_relobj::initializ_input_to_output_maps,
10785         Sized_relobj::free_input_to_output_maps): Change visibilities to
10786         protected.
10787         (Sized_relobj::setup): Virtualize.
10788         (Sized_relobj::do_setup): New method declaration.
10789         (Sized_relobj::invalidate_section_offset,
10790         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10791         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10792         * options.cc (parse_int): New function.
10793         * options.h (parse_int): New declaration.
10794         (DEFINE_int): New macro.
10795         (stub_group_size): New option.
10796         * output.cc (Output_section::Output_section): Initialize memebers
10797         merge_section_map_, merge_section_by_properties_map_,
10798         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10799         (Output_section::add_input_section): Handled deferred code-fill
10800         generation and remove an old comment.
10801         (Output_section::add_relaxed_input_section): New method definition.
10802         (Output_section::add_merge_input_section): Use merge section by
10803         properties map to speed to search.  Update merge section maps
10804         as appropriate.
10805         (Output_section::build_relaxation_map): New method definition.
10806         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10807         Same.
10808         (Output_section::relax_input_section): Renamed to
10809         Output_section::convert_input_sections_to_relaxed_sections and change
10810         interface to take a vector of pointers to relaxed sections.
10811         (Output_section::find_merge_section,
10812         Output_section::find_relaxed_input_section): New method definitions.
10813         (Output_section::is_input_address_mapped,
10814         Output_section::output_offset, Output_section::output_address):
10815         Use output section data maps to speed up searching.
10816         (Output_section::find_starting_output_address): Add comments.
10817         (Output_section::do_write,
10818         Output_section::write_to_postprocessing_buffer): Do code-fill
10819         generation as appropriate.
10820         (Output_section::get_input_sections): Invalidate relaxed input section
10821         map.
10822         (Output_section::restore_states): Adjust type of checkpoint .
10823         Invalidate relaxed input section map.
10824         * output.h (Output_merge_base): New class declaration.
10825         (Input_section_specifier): New class defintion.
10826         (class Output_relaxed_input_section) Change base class to
10827         Output_section_data_build.
10828         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10829         base class initializer.
10830         (Output_section::add_relaxed_input_section): New method declaration.
10831         (Output_section::Input_section): Change visibility to protected.
10832         (Output_section::Input_section::relobj,
10833         Output_section::Input_section::shndx): Handle relaxed input sections.
10834         Output_section::input_sections) Change visibility to protected.  Also
10835         define overload to return a non-const pointer.
10836         (Output_section::Merge_section_properties): New class defintion.
10837         (Output_section::Merge_section_by_properties_map,
10838         Output_section::Output_section_data_by_input_section_map,
10839         Output_section::Relaxation_map): New types.
10840         (Output_section::relax_input_section): Rename method to
10841         Output_section::convert_input_sections_to_relaxed_sections and change
10842         interface to take a vector of relaxed section pointers.
10843         (Output_section::find_merge_section,
10844         Output_section::find_relaxed_input_section,
10845         Output_section::build_relaxation_map,
10846         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10847         New method declarations.
10848         (Output_section::merge_section_map_
10849         Output_section::merge_section_by_properties_map_,
10850         Output_section::relaxed_input_section_map_,
10851         Output_section::is_relaxed_input_section_map_valid_,
10852         Output_section::generate_code_fills_at_write_): New data members.
10853         * script-sections.cc
10854         (Output_section_element_input::set_section_addresses): Call
10855         current_data_size and addralign methods of relaxed input sections.
10856         (Orphan_output_section::set_section_addresses): Call current_data_size
10857         and addralign methods of relaxed input sections.
10858         * symtab.cc (Symbol_table::compute_final_value): Extract template
10859         from the body of Symbol_table::sized_finalize_symbol.
10860         (Symbol_table::sized_finalized_symbol): Call
10861         Symbol_table::compute_final_value.
10862         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10863         (Symbol_table::compute_final_value): New templated method declaration.
10864         * target.cc (Target::do_make_output_section): New method defintion.
10865         * target.h (Target::make_output_section): New method declaration.
10866         (Target::relax): Add more parameters for input objects, symbol table
10867         and layout.  Adjust call to do_relax.
10868         (Target::do_make_output_section): New method declaration.
10869         (Target::do_relax): Add parameters for input objects, symbol table
10870         and layout.
10871
10872 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10873
10874         * pread.c: Include stdio.h.
10875
10876 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10877
10878         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10879         defined.
10880
10881 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10882
10883         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10884         Change read_shndx type to unsigned int.
10885         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10886         int.
10887         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10888         * dwarf_reader.h (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         * layout.cc (Layout::create_symtab_sections): Cast the result of
10894         local_symcount * symsize to off_t in the gold_assert.
10895
10896 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10897
10898         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10899         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10900         R_ARM_BASE_ABS.
10901         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
10902         (Arm_relocate_functions::thm_abs5): New function.
10903         (Arm_relocate_functions::abs12): New function.
10904         (Arm_relocate_functions::abs16): New function.
10905         (Arm_relocate_functions::base_abs): New function.
10906         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
10907         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
10908         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
10909         R_ARM_BASE_ABS.
10910         (Scan::global): Likewise.
10911         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
10912         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
10913         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
10914         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
10915         R_ARM_BASE_ABS.
10916
10917 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10918
10919         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
10920         (Arm_relocate_functions::movt_prel): New function.
10921         (Arm_relocate_functions::thm_movw_prel_nc): New function.
10922         (Arm_relocate_functions::thm_movt_prel): New function.
10923         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
10924         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
10925         (Scan::global, Relocate::relocate): Likewise.
10926         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10927
10928 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10929
10930         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
10931         Incremental_checker.
10932         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
10933         unsigned int.
10934         (class Incremental_inputs_header): New class.
10935         (Incremental_inputs_header_writer): Edit comment.
10936         (Incremental_inputs_entry): New class.
10937         (Incremental_inputs_entry_writer): Edit comment.
10938         (Sized_incremental_binary::do_find_incremental_inputs_section):
10939         Add *strtab_shndx parameter, fill it.
10940         (Sized_incremental_binary::do_check_inputs): New method.
10941         (Incremental_checker::can_incrementally_link_output_file): Use
10942         Sized_incremental_binary::check_inputs.
10943         (Incremental_inputs::report_command_line): Save command line in
10944         command_line_.
10945         * incremental.h:
10946         (Incremental_binary::find_incremental_inputs_section): New
10947         method.
10948         (Incremental_binary::do_find_incremental_inputs_section): Add
10949         strtab_shndx parameter.
10950         (Incremental_binary::do_check_inputs): New pure virtual method.
10951         (Sized_incremental_binary::do_check_inputs): Declare.
10952         (Incremental_checker::Incremental_checker): Add incremental_inputs
10953         parameter, use it to initialize incremental_inputs_.
10954         (Incremental_checker::incremental_inputs_): New field.
10955         (Incremental_checker::command_line): New method.
10956         (Incremental_checker::inputs): New method.
10957         (Incremental_checker::command_line_): New field.
10958
10959 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
10960
10961         * incremental.cc: Include <cstdarg> and "target-select.h".
10962         (vexplain_no_incremental): New function.
10963         (explain_no_incremental): New function.
10964         (Incremental_binary::error): New method.
10965         (Sized_incremental_binary::do_find_incremental_inputs_section): New
10966         method.
10967         (make_sized_incremental_binary): New function.
10968         (open_incremental_binary): New function.
10969         (can_incrementally_link_file): Add checks if output is ELF and has
10970         inputs section.
10971         * incremental.h: Include "elfcpp_file.h" and "output.h".
10972         (Incremental_binary): New class.
10973         (Sized_incremental_binary): New class.
10974         (open_incremental_binary): Declare.
10975         * object.cc (is_elf_object): Use
10976         elfcpp::Elf_recognizer::is_elf_file.
10977         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
10978         * output.h (Output_file::filesize): New method.
10979
10980 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10981
10982         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
10983         New function.
10984         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
10985         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
10986         function.
10987         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
10988         function.
10989         (Arm_relocate_functions::movw_abs_nc): New function.
10990         (Arm_relocate_functions::movt_abs): New function.
10991         (Arm_relocate_functions::thm_movw_abs_nc): New function.
10992         (Arm_relocate_functions::thm_movt_abs): New function.
10993         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
10994         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
10995         (Scan::global): Likewise.
10996         (Relocate::relocate): Likewise.
10997         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
10998
10999 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11000
11001         * arm.cc (Arm_relocate_functions::got_prel) New function.
11002         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11003         (Relocate::relocate): Likewise.
11004         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11005
11006 2009-10-06  Ian Lance Taylor  <iant@google.com>
11007
11008         * options.h (class General_options): Define
11009         split_stack_adjust_size parameter.
11010         * object.h (class Object): Add uses_split_stack_ and
11011         has_no_split_stack_ fields.  Add uses_split_stack and
11012         has_no_split_stack accessor functions.  Declare
11013         handle_split_stack_section.
11014         (class Reloc_symbol_changes): Define.
11015         (class Sized_relobj): Define Function_offsets.  Declare
11016         split_stack_adjust, split_stack_adjust_reltype, and
11017         find_functions.
11018         * object.cc (Object::handle_split_stack_section): New function.
11019         (Sized_relobj::do_layout): Call handle_split_stack_section.
11020         * dynobj.cc (Sized_dynobj::do_layout): Call
11021         handle_split_stack_section.
11022         * reloc.cc (Sized_relobj::relocate_sections): Call
11023         split_stack_adjust for executable sections in split_stack
11024         objects.  Pass reloc_map to relocate_section.
11025         (Sized_relobj::split_stack_adjust): New function.
11026         (Sized_relobj::split_stack_adjust_reltype): New function.
11027         (Sized_relobj::find_functions): New function.
11028         * target-reloc.h: Include "object.h".
11029         (relocate_section): Add reloc_symbol_changes parameter.  Change
11030         all callers.
11031         * target.h (class Target): Add calls_non_split method.  Declare
11032         do_calls_non_split virtual method.  Declare match_view and
11033         set_view_to_nop.
11034         * target.cc: Include "elfcpp.h".
11035         (Target::do_calls_non_split): New function.
11036         (Target::match_view): New function.
11037         (Target::set_view_to_nop): New function.
11038         * gold.cc (queue_middle_tasks): Give an error if mixing
11039         split-stack and non-split-stack objects with -r.
11040         * i386.cc (Target_i386::relocate_section): Add
11041         reloc_symbol_changes parameter.
11042         (Target_i386::do_calls_non_split): New function.
11043         * x86_64.cc (Target_x86_64::relocate_section): Add
11044         reloc_symbol_changes parameter.
11045         (Target_x86_64::do_calls_non_split): New function.
11046         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11047         parameter.
11048         * powerpc.cc (Target_powerpc::relocate_section): Add
11049         reloc_symbol_changes parameter.
11050         * sparc.cc (Target_sparc::relocate_section): Add
11051         reloc_symbol_changes parameter.
11052         * configure.ac: Call AM_CONDITIONAL for the default target.
11053         * configure: Rebuild.
11054         * testsuite/Makefile.am (TEST_AS): New variable.
11055         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11056         (check_DATA): Add split_i386 and split_x86_64 files.
11057         (SPLIT_DEFSYMS): Define.
11058         (split_i386_[1234n].o): New targets.
11059         (split_i386_[124]): New targets.
11060         (split_i386_[1234r].stdout): New targets.
11061         (split_x86_64_[1234n].o): New targets.
11062         (split_x86_64_[124]): New targets.
11063         (split_x86_64_[1234r].stdout): New targets.
11064         (MOSTLYCLEANFILES): Add new executables.
11065         * testsuite/split_i386.sh: New file.
11066         * testsuite/split_x86_64.sh: New file.
11067         * testsuite/split_i386_1.s: New file.
11068         * testsuite/split_i386_2.s: New file.
11069         * testsuite/split_i386_3.s: New file.
11070         * testsuite/split_i386_4.s: New file.
11071         * testsuite/split_i386_n.s: New file.
11072         * testsuite/split_x86_64_1.s: New file.
11073         * testsuite/split_x86_64_2.s: New file.
11074         * testsuite/split_x86_64_3.s: New file.
11075         * testsuite/split_x86_64_4.s: New file.
11076         * testsuite/split_x86_64_n.s: New file.
11077         * testsuite/testfile.cc (Target_test): Update relocation_section
11078         function.
11079         * testsuite/Makefile.in: Rebuild.
11080
11081 2009-10-06  Ian Lance Taylor  <iant@google.com>
11082
11083         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11084         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11085         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11086         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11087         the address on ldo_addrs_.
11088         (Target_i386::Relocate::fix_up_ldo): New function.
11089
11090 2009-10-06   Rafael Espindola  <espindola@google.com>
11091
11092         * plugin.cc (add_input_library): New.
11093         (Plugin::load): Add add_input_library to tv.
11094         (Plugin_manager::add_input_file): Add the is_lib argument.
11095         (add_input_file): Update call to Plugin_manager::add_input_file.
11096         (add_input_library): New.
11097         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11098
11099 2009-09-30  Doug Kwan  <dougkwan@google.com>
11100
11101         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11102         symbol and call Symbol::may_need_copy_reloc to determine if
11103         a copy reloc is needed.
11104         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11105         nocopyreloc is given in command line.
11106         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11107         given in command line.
11108         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11109         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11110         of the removed Target_i386::may_need_copy_reloc.
11111         * options.h (copyreloc): New option with default value false.
11112         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11113         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11114         instead of the removed Target_powerpc::may_need_copy_reloc.
11115         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11116         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11117         instead of the removed Target_sparc::may_need_copy_reloc.
11118         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11119         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11120         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11121         instead of the removed Target_x86_64::may_need_copy_reloc.
11122
11123 2009-09-30  Ian Lance Taylor  <iant@google.com>
11124
11125         * object.h (class Object): Remove target_ field, and target,
11126         sized_target, and set_target methods.
11127         (Object::sized_target): Remove.
11128         (class Sized_relobj): Update declarations.  Remove sized_target.
11129         * object.cc (Sized_relobj::setup): Remove target parameter.
11130         Change all callers.
11131         (Input_objects::add_object): Don't do anything with the target.
11132         (make_elf_sized_object): Add punconfigured parameter.  Change all
11133         callers.  Set or test parameter target.
11134         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11135         Change all callers.
11136         * parameters.cc (Parameters::set_target): Change parameter type to
11137         be non-const.
11138         (Parameters::default_target): Remove.
11139         (set_parameters_target): Change parameter type to be non-const.
11140         (parameters_force_valid_target): New function.
11141         (parameters_clear_target): New function.
11142         * parameters.h (class Parameters): Update declarations.  Remove
11143         default_target method.  Add sized_target and clear_target
11144         methods.  Change target_ to be non-const.
11145         (set_parameters_target): Update declaration.
11146         (parameters_force_valid_target): Declare.
11147         (parameters_clear_target): Declare.
11148         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11149         as NULL if we aren't searching.
11150         (Add_symbols::run): Don't check for compatible target.
11151         * fileread.cc (Input_file::open_binary): Call
11152         parameters_force_valid_target.
11153         * gold.cc (queue_middle_tasks): Likewise.
11154         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11155         set_target on object.
11156         * dynobj.h (class Sized_dynobj): Update declarations.
11157         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11158         make_elf_object returns NULL.
11159         (Archive::include_member): Don't check whether object target is
11160         compatible.
11161         * output.cc (Output_section::add_input_section): Get target from
11162         parameters.
11163         (Output_section::relax_input_section): Likewise.
11164         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11165         parameters.
11166         (Sized_relobj::do_scan_relocs): Likewise.
11167         (Sized_relobj::relocate_sections): Likewise.
11168         * resolve.cc (Symbol_table::resolve): Likewise.
11169         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11170         parameter.  Change all callers.
11171         (Symbol_table::add_from_object): Get target from parameters.
11172         (Symbol_table::add_from_relobj): Don't check object target.
11173         (Symbol_table::add_from_dynobj): Likewise.
11174         (Symbol_table::define_special_symbol): Get target from
11175         parameters.
11176         * symtab.h (class Symbol_table): Update declaration.
11177         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11178         parameter.  Change all callers.  Clear parameter target.
11179         (Binary_test): Test target here.
11180         * testsuite/object_unittest.cc (gold_testsuite): Remove
11181         target_test_pointer parameter.  Change all callers.
11182         (Object_test): Test target here.
11183
11184 2009-09-26  Ian Lance Taylor  <iant@google.com>
11185
11186         * testsuite/initpri1.c: Don't try to use constructor priorities if
11187         compiling with gcc before 4.3.
11188
11189 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11190
11191         * testsuite/retain_symbols_file_test.sh (check_present): Change
11192         output file name to retain_symbols_file_test.stdout.
11193         (check_absent): Likewise.
11194
11195 2009-09-18  Craig Silverstein  <csilvers@google.com>
11196
11197         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11198         * options.cc: Include <cerrno> and <fstream>.
11199         (General_options::finalize): Parse -retain-symbols-file tag.
11200         * options.h: New flag.
11201         (General_options): New method should_retain_symbol, new
11202         variable symbols_to_retain.
11203         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11204         should_retain_symbol map.
11205         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11206         * testsuite/Makefile.in: Regenerate.
11207         * testsuite/retain_symbols_file_test.sh: New file.
11208
11209 2009-09-18  Nick Clifton  <nickc@redhat.com>
11210
11211         * po/es.po: Updated Spanish translation.
11212
11213 2009-09-17  Doug Kwan  <dougkwan@google.com>
11214
11215         * debug.h (DEBUG_RELAXATION): New constant.
11216         (DEBUG_ALL): Add DEBUG_RELAXATION.
11217         (debug_string_to_enum): Add relaxation debug option.
11218         * layout.cc
11219         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11220         Layout::Relaxation_debug_check::read_sections,
11221         Layout::Relaxation_debug_check::read_sections): New method definitions.
11222         (Layout::Layout): Initialize data members
11223         record_output_section_data_from_scrips_,
11224         script_output_section_data_list_ and relaxation_debug_check_.
11225         (Layout::save_segments, Layout::restore_segments,
11226         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11227         Layout::relaxation_loop_body): New method definitions.
11228         (Layout::finalize): Support relaxation.  Move section layout code to
11229         Layout::relaxation_loop_body.
11230         (Layout::set_asection_address_from_script): Move code for orphan
11231         section placement out.
11232         (Layout::place_orphan_sections_in_script): New method definition.
11233         * layout.h (Output_segment_headers, Output_file_header):
11234         New forward class declarations.
11235         (Layout::~Layout): Define.
11236         (Layout::new_output_section_data_from_script): New method definition.
11237         (Layout::place_orphan_sections_in_script): New method declaration.
11238         (Layout::Segment_states): New type declaration.
11239         (Layout::save_segments, Layout::restore_segments,
11240         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11241         Layout::relaxation_loop_body): New method declarations.
11242         (Layout::Output_section_data_list): New type declaration.
11243         (Layout::Relaxation_debug_check): New class definition.
11244         (Layout::record_output_section_data_from_script_,
11245         Layout::script_output_section_data_list_, Layout::segment_states_,
11246         Layout::relaxation_debug_check_): New data members.
11247         * output.cc: (Output_section_headers::do_size): New method definition.
11248         (Output_section_headers::Output_section_headers): Move size
11249         computation to Output_section_headers::do_size.
11250         (Output_segment_headers::do_size): New method definition.
11251         (Output_file_header::Output_file_header): Move size computation to
11252         Output_file_header::do_size and call it.
11253         (Output_file_header::do_size): New method definition.
11254         (Output_data_group::Output_data_group): Adjust call to
11255         Output_section_data.
11256         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11257         (Output_symtab_xindex::do_write): Add array bound check.
11258         (Output_section::Input_section::print_to_mapfile): Handle
11259         RELAXED_INPUT_SECTION_CODE.
11260         (Output_section::Output_section): Initialize data member checkpoint_.
11261         (Output_section::~Output_section): Delete checkpoint object pointed
11262         by checkpoint_.
11263         (Output_section::add_input_section): Always add an Input_section if
11264         relaxing.
11265         (Output_section::add_merge_input_section): Add assert.
11266         (Output_section::relax_input_section): New method definition.
11267         (Output_section::set_final_data_size): Set load address to zero for
11268         an unallocated section.
11269         (Output_section::do_address_and_file_offset_have_reset_values):
11270         New method definition.
11271         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11272         Handle relaxed input section.
11273         (Output_section::sort_attached_input_sections): Checkpoint input
11274         section list lazily.
11275         (Output_section::get_input_sections): Change type of input_sections to
11276         list of Simple_input_section pointers.  Checkpoint input section list
11277         lazily.  Also handle relaxed input sections.
11278         (Output_section::add_input_section_for_script): Take a reference to
11279         a Simple_input_section object instead of Relobj pointer and section
11280         index as parameter.  Handle relaxed input sections.
11281         (Output_section::save_states, Output_section::restore_states): New
11282         method definitions.
11283         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11284         (Output_data::is_data_size_fixed): New method definition.
11285         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11286         if it is fixed.
11287         (Output_data::address_and_file_offset_have_reset_values): New method
11288         definition.
11289         (Output_data::do_address_and_file_offset_have_reset_values): New method
11290         definition.
11291         (Output_data::set_data_size): Check that data size is not fixed.
11292         (Output_data::fix_data_size): New method definition.
11293         (Output_data::is_data_size_fixed_): New data member.
11294         (Output_section_headers::set_final_data_size): New method definition.
11295         (Output_section_headers::do_size): New method declaration.
11296         (Output_segment_headers::set_final_data_size): New method definition.
11297         (Output_segment_headers::do_size): New method declaration.
11298         (Output_file_header::set_final_data_size)::New method definition.
11299         (Output_file_header::do_size)::New method declaration.
11300         (Output_section_data::Output_section_data): Add new parameter
11301         is_data_size_fixed and use it to fix data size.
11302         (Output_data_const::Output_data_const): Adjust call to base class
11303         constructor and fix data size.
11304         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11305         base class constructor and fix data size.
11306         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11307         base class constructor and fix data size.
11308         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11309         class constructor and fix data size.
11310         (Output_data_group::set_final_data_size): New method definition.
11311         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11312         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11313         class constructor and fix data size.
11314         (Output_relaxed_input_section): New class definition.
11315         (Output_section::Simple_input_section): New class definition.
11316         (Output_section::get_input_sections): Adjust parameter list.
11317         (Output_section::add_input_section_for_script): Same.
11318         (Output_section::save_states, Output_section::restore_states,
11319         Output_section::do_address_and_file_offset_have_reset_values,
11320         (Output_section::Input_section::Input_section): Handle
11321         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11322         Output_relaxed_input_section.
11323         (Output_section::Input_section::is_input_section,
11324         Output_section::Input_section::set_output_section): Handle relaxed
11325         input section.
11326         (Output_section::Input_section::is_relaxed_input_section,
11327         Output_section::Input_section::output_section_data,
11328         Output_section::Input_section::relaxed_input_section): New method
11329         definitions.
11330         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11331         value.
11332         (Output_section::Input_section::u1_): Update comments.
11333         (Output_section::Input_section::u2_): Add new union member poris.
11334         (Output_section::Checkpoint_output_section): New classs definition.
11335         (Output_section::relax_input_section): New method declaration.
11336         (Output_section::checkpoint_): New data member.
11337         (Output_segment): Update comments.
11338         (Output_segment::Output_segment): Un-privatize copy constructor.
11339         (Output_segment::operator=): Un-privatize.
11340         * script-sections.cc (Output_section_element::Input_section_list):
11341         Change element type to Output_section::Simple_input_section.
11342         (Output_section_element_dot_assignment::set_section_addresses):
11343         Register output section data for relaxation clean up.
11344         (Output_data_exression::Output_data_expression): Adjust call to base
11345         constructor to fix data size.
11346         (Output_section_element_data::set_section_addresses): Register
11347         Output_data_expression object for relaxation clean up.
11348         (struct Input_section_info): Replace Relobj pointer and section index
11349         pair with Output_section::Simple_input_section and Convert struct to a
11350         class.
11351         (Input_section_sorter::operator()): Adjust access to
11352         Input_section_info data member to use accessors.
11353         (Output_section_element_input::set_section_addresses): Use layout
11354         parameter.  Adjust code to use Output_section::Simple_input_section
11355         and Input_secction_info classes.  Register filler for relaxation
11356         clean up.
11357         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11358         and section index pair with Output_section::Simple_input_section
11359         class.  Adjust code accordingly.
11360         (Phdrs_element::release_segment): New method definition.
11361         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11362         segment list.
11363         (Script_sections::release_segments): New method definition.
11364         * gold/script-sections.h (Script_sections::release_segments): New
11365         method declaration.
11366         * gold/target.h (Target::may_relax, Target::relax,
11367         Target::do_may_relax, Target::do_relax): New method definitions.
11368
11369 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11370
11371         * arm.cc (has_signed_unsigned_overflow): New function.
11372         (Arm_relocate_functions::abs8): New function.
11373         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11374         (Target_arm::Scan::global): Likewise.
11375         (Target_arm::relocate::relocate): Likewise.
11376         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11377         Likewise.
11378
11379 2009-09-16  Cary Coutant  <ccoutant@google.com>
11380
11381         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11382         * testsuite/Makefile.in: Regenerate.
11383
11384 2009-09-11  Nick Clifton  <nickc@redhat.com>
11385
11386         * po/gold.pot: Updated by the Translation project.
11387
11388 2009-09-08  Cary Coutant  <ccoutant@google.com>
11389
11390         * output.cc (Output_file::open): Add execute permission to empty file.
11391         * testsuite/Makefile.am (permission_test): New test.
11392         * testsuite/Makefile.in: Regenerate.
11393
11394 2009-09-02  Ian Lance Taylor  <iant@google.com>
11395
11396         * output.cc (Output_file::resize): Call map_no_anonymous rather
11397         than map.
11398
11399 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11400
11401         * gold.cc: Include "incremental.h".
11402         (queue_initial_tasks): Call Incremental_checker methods.
11403         * incremental.cc: Include "output.h".
11404         (Incremental_checker::can_incrementally_link_output_file): New
11405         method.
11406         * incremental.h (Incremental_checker): New class.
11407
11408         * output.cc (Output_file::open_for_modification): New method.
11409         (Output_file::map_anonymous): Changed return type to bool.  Record
11410         map in base_ field.
11411         (Output_file::map_no_anonymous): New method, broken out of map.
11412         (Output_file::map): Use map_no_anonymous and map_anonymous.
11413         * output.h (class Output_file): Update declarations.
11414
11415 2009-08-24  Cary Coutant  <ccoutant@google.com>
11416
11417         * options.h (Command_line::Pre_options): New class.
11418         (Command_line::pre_options): New member.
11419         * options.cc (gold::options::ready_to_register): New variable.
11420         (One_option::register_option): Do nothing if not registering options.
11421         Assert if same short option registered twice.
11422         (General_options::General_options): Turn off option registration when
11423         done constructing.
11424         (Command_line::Pre_options::Pre_options): New constructor.
11425
11426 2009-08-24  Cary Coutant  <ccoutant@google.com>
11427
11428         * options.h (General_options::no_keep_memory): Remove incorrect
11429         short option.
11430
11431 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11432
11433         * Makefile.am (am__skiplex, am__skipyacc): New.
11434         * Makefile.in: Regenerate.
11435
11436 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11437
11438         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11439         (INCLUDES): ... this.
11440         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11441         (AM_CPPFLAGS): Renamed from ...
11442         (INCLUDE): ... this.
11443         * Makefile.in, testsuite/Makefile.in: Regenerate.
11444
11445         * Makefile.in: Regenerate.
11446         * aclocal.m4: Likewise.
11447         * config.in: Likewise.
11448         * configure: Likewise.
11449         * testsuite/Makefile.in: Likewise.
11450
11451         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11452         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11453         * Makefile.in: Regenerate.
11454         * testsuite/Makefile.in: Regenerate.
11455
11456 2009-08-19  Cary Coutant  <ccoutant@google.com>
11457
11458         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11459         symbols in shared libraries overridden by hidden or internal symbols
11460         in the main program.
11461
11462 2009-08-19  Chris Demetriou  <cgd@google.com>
11463
11464         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11465         checking source file names in error messages.
11466
11467 2009-08-18  Doug Kwan  <dougkwan@google.com>
11468
11469         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11470         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11471         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11472         an elfcpp::Ehdr as parameter.
11473         * object.cc (Object::set_target): Remove the version that looks up
11474         a target and sets it.
11475         (Sized_relobj::setup): Take a Target object instead of
11476         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11477         (make_elf_sized_object): Find target and ask target to
11478         make an ELF object.
11479         * object.h: (Object::set_target): Remove the version that looks up
11480         a target and sets it.
11481         (Sized_relobj::setup): Take a Target object instead of
11482         an elfcpp:Ehdr as parameter.
11483         * target.cc: Include dynobj.h.
11484         (Target::do_make_elf_object_implementation): New.
11485         (Target::do_make_elf_object): New.
11486         * target.h (Target::make_elf_object): New template declaration.
11487         (Target::do_make_elf_object): New method declarations.
11488         (Target::do_make_elf_object_implementation): New template declaration.
11489
11490 2009-08-14  Ian Lance Taylor  <iant@google.com>
11491
11492         * gold.h (FUNCTION_NAME): Define.
11493         (gold_unreachable): Use FUNCTION_NAME.
11494
11495 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11496
11497         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11498         symbol in the --keep-unique list is not found.
11499
11500 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11501
11502         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11503         been maked as --keep-unique.
11504         (Icf::unfold_section): New function.
11505         * icf.h (Icf::unfold_section): New function.
11506         * options.h (General_options::keep_unique): New option.
11507         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11508         * testsuite/Makefile.in: Regenerate.
11509         * testsuite/icf_keep_unique_test.sh: New file.
11510         * testsuite/icf_keep_unique_test.cc: New file.
11511
11512 2009-08-12  Cary Coutant  <ccoutant@google.com>
11513
11514         PR 10471
11515         * resolve.cc (Symbol_table::resolve): Check for references from
11516         dynamic objects to hidden and internal symbols.
11517         * testsuite/Makefile.am (hidden_test.sh): New test.
11518         * testsuite/Makefile.in: Regenerate.
11519         * testsuite/hidden_test.sh: New script.
11520         * testsuite/hidden_test_1.c: New test source.
11521         * testsuite/hidden_test_main.c: New test source.
11522
11523 2009-08-11  Doug Kwan  <dougkwan@google.com>
11524
11525         * arm.cc: Update comments.
11526         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11527         segment to locate the .ARM.exidx section if present.
11528
11529 2009-08-09  Doug Kwan  <dougkwan@google.com>
11530
11531         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11532         patch.
11533
11534 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11535         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11536         compiler warnings.
11537
11538 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11539
11540         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11541         valid tls_segment only for non-debug-section relocations.
11542         * testsuite/Makefile.am: Add gc_tls_test.
11543         * testsuite/Makefile.in: Regenerate.
11544         * testsuite/gc_tls_test.cc: New file.
11545         * testsuite/gc_tls_test.sh: New file.
11546
11547 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11548
11549         * icf.cc: New file.
11550         * icf.h: New file.
11551         * Makefile.am (CCFILES): Add icf.cc.
11552         (HFILES): Add icf.h
11553         * Makefile.in: Regenerate.
11554         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11555         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11556         section, symbol and addend information for the relocs.
11557         * gold.cc (queue_middle_tasks): Call identical code folding.
11558         * gold.h: Add defines for multimap.
11559         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11560         to the call of finalize_local_symbols.
11561         * main.cc (main): Create object of class Icf.
11562         * object.cc (Sized_relobj::do_layout): Allow this function to be
11563         called twice during icf.
11564         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11565         to sections marked as identical by icf.
11566         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11567         when available.
11568         (Sized_relobj::do_section_entsize): New function.
11569         * object.h (Object::section_entsize): New function.
11570         (Object::do_section_entsize): New pure virtual function.
11571         (Relobj::finalize_local_symbols): Add new parameter.
11572         (Relobj::do_section_entsize): New function.
11573         * options.h (General_options::icf): New option.
11574         (General_options::icf_iterations): New option.
11575         (General_options::print_icf_sections): New option.
11576         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11577         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11578         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11579         icf.
11580         * symtab.cc (Symbol_table::is_section_folded): New function.
11581         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11582         to sections marked as identical by icf.
11583         * symtab.h (Symbol_table::set_icf): New function.
11584         (Symbol_table::icf): New function.
11585         (Symbol_table::is_section_folded): New function.
11586         (Symbol_table::icf_): New data member.
11587         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11588         * testsuite/Makefile.am: Add commands to build icf_test.
11589         * testsuite/Makefile.in: Regenerate.
11590         * testsuite/icf_test.sh: New file.
11591         * testsuite/icf_test.cc: New file.
11592
11593 2009-07-24  Chris Demetriou  <cgd@google.com>
11594
11595         * layout.cc (is_compressible_debug_section): Fix incorrect
11596         comment about compressed section names.
11597
11598 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11599
11600         PR 10419
11601         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11602
11603 2009-07-16  Ian Lance Taylor  <iant@google.com>
11604
11605         PR 10400
11606         * layout.h: #include <map>.
11607         (class Kept_section): Change from struct to class.  Add accessors
11608         and setters.  Add section size to Comdat_group mapping.  Change
11609         Comdat_group to std::map.  Add is_comdat_ field.  Add
11610         linkonce_size field in union.
11611         (class Layout): Update declaration of find_or_add_kept_section.
11612         Don't declare find_kept_object.
11613         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11614         parameter.  Add object, shndx, is_comdat, and is_group_name
11615         parameters.  Change all callers.  Adjust for new Kept_section.
11616         (Layout::find_kept_object): Remove.
11617         * object.cc (Sized_relobj::include_section_group): Update use of
11618         Kept_section.  Rename secnum to shndx.  Only record
11619         Kept_comdat_section if sections are the same size.
11620         (Sized_relobj::include_linkonce_section): Update use of
11621         Kept_section.  Only record Kept_comdat_section if sections are the
11622         same size.  Set size of linkonce section.
11623         (Sized_relobj::map_to_kept_section): Update call to
11624         get_kept_comdat_section.
11625         * object.h (class Sized_relobj): Rename fields in
11626         Kept_comdat_section to drop trailing underscores; change object
11627         field to Relobj*.  Change Kept_comdat_section_table to store
11628         struct rather than pointer.
11629         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11630         Add kept_object and kept_shndx parameters.  Change all callers.
11631         (Sized_relobj::get_kept_comdat_section): Change return type to
11632         bool.  Add kept_object and kept_shndx parameters.  Change all
11633         callers.
11634         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11635         Layout::find_or_add_kept_section.
11636
11637 2009-07-09  Ian Lance Taylor  <iant@google.com>
11638
11639         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11640         Reserve space in the hash table.
11641
11642 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11643
11644         * fileread.cc (File_read::get_mtime): New method.
11645         * fileread.h (Timespec): New structure.
11646         (File_read::get_mtime): New method.
11647         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11648         Renamed from timestamp_nsec.
11649         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11650         Elf_Xword.
11651         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11652         timestamp_nsec.
11653         (Incremental_inputs::report_archive): Save mtime; style fix.
11654         (Incremental_inputs::report_obejct): Save mtime; style fix.
11655         (Incremental_inputs::report_script): Save mtime; style fix.
11656         (Incremental_inputs::finalize_inputs): Style fix.
11657         (Incremental_inputs::finalize): Style fix.
11658         (Incremental_inputs::create_input_section_data): Store inputs
11659         mtime.
11660         * incremental.h (Incremental_inputs::report_script): Add mtime
11661         argument.
11662         (Incremental_inputs::Input_info::Input_info): Intialize only one
11663         union member.
11664         (Incremental_inputs::Input_info::archive): Move to nameless
11665         union.
11666         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11667         (Incremental_inputs::Input_info::script): Move to nameless union.
11668         (Incremental_inputs::mtime): New field.
11669         * script.cc (read_input_script): Pass file mtime to
11670         Incremental_input.
11671         * script.h (Script_info::inputs): Style fix.
11672
11673 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11674
11675         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11676         instead of 32.
11677
11678 2009-06-24  Ian Lance Taylor  <iant@google.com>
11679
11680         PR 10156
11681         * layout.cc (Layout::choose_output_section): If we find an
11682         existing section, update the flags.
11683         (Layout::create_notes): New function, broken out of
11684         Layout::finalize.
11685         (Layout::finalize): Don't create note sections.
11686         (Layout::create_note): Don't crash if linker script discards
11687         section.
11688         (Layout::create_gold_note): Likewise.
11689         (Layout::create_build_id): Likewise.  Don't set
11690         after_input_sections on the section.
11691         (Layout::create_executable_stack_info): Remove target parameter.
11692         Change caller.
11693         * layout.h (class Layout): Declare create_notes.  Update
11694         declaration of create_executable_stack_info.
11695         * gold.cc (queue_middle_tasks): Call create_notes.
11696         * output.cc (Output_section::update_flags_for_input_section): Move
11697         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11698         invalid.
11699         * output.h (Output_data::mark_address_invalid): New function.
11700         (class Output_section): Only declare, not define,
11701         update_flags_for_input_section.  Remove set_flags.
11702
11703 2009-06-24  Ian Lance Taylor  <iant@google.com>
11704
11705         * script-sections.cc (Output_section_definition::
11706         set_section_addresses): Rename shadowing local load_address to
11707         laddr.
11708
11709 2009-06-24  Ian Lance Taylor  <iant@google.com>
11710
11711         PR 10244
11712         * reloc.cc (relocate_sections): Skip empty relocation sections.
11713
11714 2009-06-23  Ian Lance Taylor  <iant@google.com>
11715
11716         PR 10156
11717         * layout.cc (Layout::create_note): Use choose_output_section
11718         rather than make_output_section.
11719
11720 2009-06-23  Ian Lance Taylor  <iant@google.com>
11721
11722         PR 10237
11723         * options.cc (General_options::parse_V): Set printed_version_.
11724         (General_options::General_options): Initialize printed_version_.
11725         * options.h (class General_options): Add printed_version_ field.
11726         * gold.cc (queue_initial_tasks): If there are no input files,
11727         don't give a fatal error if we printed the version information.
11728         (queue_middle_tasks): If using -r with a shared object, give a
11729         fatal error rather than an ordinary error.
11730
11731 2009-06-23  Ian Lance Taylor  <iant@google.com>
11732
11733         PR 10219
11734         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11735         (Layout::make_output_section): Set have_stabstr_section_ if we see
11736         a .stab*str section.
11737         (Layout::finalize): Call link_stabs_sections.
11738         (Layout::link_stabs_sections): New file.
11739         * layout.h (class Layout): Add have_stabstr_section_ field.
11740         Declare link_stabs_sections.
11741
11742 2009-06-23  Doug Kwan  <dougkwan@google.com>
11743
11744         * Makefile.am (libgold_a_LIBADD): New.
11745         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11746         * Makefile.in: Regenerate.
11747         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11748         * configure: Regenerate.
11749         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11750         * fileread.cc: Include sys/state.h
11751         * gold.h: Declare memmem and strndup if found missing.
11752         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11753
11754 2009-06-23  Ian Lance Taylor  <iant@google.com>
11755
11756         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11757         * configure: Rebuild.
11758
11759 2009-06-23  Ian Lance Taylor  <iant@google.com>
11760
11761         PR 10147
11762         * object.cc (Object::section_contents): Don't try to get a view if
11763         the section has length zero.
11764         (Object::handle_gnu_warning_section): If the section is empty, use
11765         the name of the section as the warning.
11766
11767 2009-06-23  Ian Lance Taylor  <iant@google.com>
11768
11769         PR 10133
11770         * stringpool.h (class Stringpool_template): Add optimize_ field.
11771         (Stringpool_template::set_optimize): New function.
11772         * stringpool.cc (Stringpool_template::Stringpool_template):
11773         Initialize optimize_ field.
11774         (Stringpool_template::set_string_offsets): Test local optimize
11775         fild rather than parameter.
11776         * layout.cc (Layout::Layout): Call set_optimize on the section
11777         name stringpool.
11778
11779 2009-06-22  Ian Lance Taylor  <iant@google.com>
11780
11781         PR 10030
11782         * yyscript.y: Parse TARGET.
11783         * script.cc (script_set_target): New function.
11784         * script-c.h (script_set_target): Declare.
11785         * options.cc (General_options::string_to_object_format): Rename
11786         from string_to_object_format in anonymous namespace.  Change
11787         callers.
11788         * options.h (class General_options): Declare
11789         string_to_object_format.
11790
11791 2009-06-22  Ian Lance Taylor  <iant@google.com>
11792
11793         * script-sections.cc (Script_sections::create_segments): Don't put
11794         program headers in a PT_LOAD segment if -n or -N.
11795
11796 2009-06-22  Ian Lance Taylor  <iant@google.com>
11797
11798         PR 10141
11799         * options.h (class General_options): Add -z lazy and -z now.  Sort
11800         -z options into alphabetical order.
11801         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11802
11803 2009-06-21  Ian Lance Taylor  <iant@google.com>
11804
11805         * layout.cc (Layout::make_output_section): Call
11806         Target::new_output_section.
11807         (Layout::attach_allocated_section_to_segment): Put large section
11808         sections in a separate load segment with the large segment flag
11809         set.
11810         (Layout::segment_precedes): Sort large data segments after other
11811         load segments.
11812         (align_file_offset): New static function.
11813         (Layout::set_segment_offsets): Use align_file_offset.
11814         * output.h (class Output_section): Add is_small_section_ and
11815         is_large_section_ fields.
11816         (Output_section::is_small_section): New function.
11817         (Output_section::set_is_small_section):  New function.
11818         (Output_section::is_large_section): New function.
11819         (Output_section::set_is_large_section): New function.
11820         (Output_section::is_large_data_section): New function.
11821         (class Output_segment): Add is_large_data_segment_ field.
11822         (Output_segment::is_large_data_segment): New function.
11823         (Output_segment::set_is_large_data_segment): New function.
11824         * output.cc (Output_section::Output_section): Initialize new
11825         fields.
11826         (Output_segment::Output_segment): Likewise.
11827         (Output_segment::add_output_section): Add assertion that large
11828         data sections always go in large data segments.  Force small data
11829         sections to the end of the list of data sections.  Force small BSS
11830         sections to the start of the list of BSS sections.  For large BSS
11831         sections to the end of the list of BSS sections.
11832         * symtab.h (class Symbol): Declare is_common_shndx.
11833         (Symbol::is_defined): Check Symbol::is_common_shndx.
11834         (Symbol::is_common): Likewise.
11835         (class Symbol_table): Define enum Commons_section_type.  Update
11836         declarations.  Add small_commons_ and large_commons_ fields.
11837         * symtab.cc (Symbol::is_common_shndx): New function.
11838         (Symbol_table::Symbol_table): Initialize new fields.
11839         (Symbol_table::add_from_object): Put small and large common
11840         symbols in the right list.
11841         (Symbol_table::sized_finalized_symbol): Check
11842         Symbol::is_common_shndx.
11843         (Symbol_table::sized_write_globals): Likewise.
11844         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11845         common symbol lists.  Don't call do_allocate_commons_list if the
11846         list is empty.
11847         (Symbol_table::do_allocate_commons_list): Remove is_tls
11848         parameter.  Add comons_section_type parameter.  Change all
11849         callers.  Handle small and large common symbols.
11850         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11851         Symbol::is_common_shndx.
11852         * resolve.cc (symbol_to_bits): Likewise.
11853         * target.h (Target::small_common_shndx): New function.
11854         (Target::small_common_section_flags): New function.
11855         (Target::large_common_shndx): New function.
11856         (Target::large_common_section_flags): New function.
11857         (Target::new_output_section): New function.
11858         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11859         small_common_section_flags, and large_common_section_flags
11860         fields.
11861         (Target::do_new_output_section): New virtual function.
11862         * arm.cc (Target_arm::arm_info): Initialize new fields.
11863         * i386.cc (Target_i386::i386_info): Likewise.
11864         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11865         Likewise.
11866         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11867         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11868         (Target_x86_64::do_new_output_section): New function.
11869         * configure.ac: Define conditional MCMODEL_MEDIUM.
11870         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11871         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11872         (large_LDFLAGS): Define.
11873         * testsuite/large.c: New file.
11874         * testsuite/testfile.cc (Target_test::test_target_info):
11875         Initialize new fields.
11876         * configure, testsuite/Makefile.in: Rebuild.
11877
11878 2009-06-05  Doug Kwan  <dougkwan@google.com>
11879
11880         * Makefile.am (CCFILES): Add target.cc.
11881         * Makefile.in: Regenerate.
11882         * i386.cc (class Target_i386): Define new virtual method to
11883         override do_is_local_label_name in parent.
11884         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11885         local symbols if --discard-locals or -X is given.
11886         * options.h (class General_options): Declare new options
11887         '--discard-locals' and '-X' for discarding locals.
11888         * target.h (class Target): Define new methods is_local_label_name.
11889         Declare new virtual method do_is_local_label_name.
11890         * target.cc: New file.
11891         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11892         (check_SCRIPTS): Add discard_locals_test.sh.
11893         (check_DATA): Add discard_local_tests.syms.
11894         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11895         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11896         * testsuite/Makefile.in: Regenerate.
11897         * testsuite/discard_locals_test.c: New file.
11898         * testsuite/discard_locals_test.sh: Same.
11899
11900 2009-06-05  Doug Kwan  <dougkwan@google.com>
11901
11902         * object.cc (Sized_relobj::Sized_relobj): Initialize
11903         discarded_eh_frame_shndx_ to -1U.
11904         (Sized_relobj::do_layout): Record index of a discard .eh_frame
11905         section.
11906         (Sized_relobj::do_count_local_symbols): Skip local symbols in
11907         a discarded .eh_frame section.
11908         (Sized_relobj::do_finalize_local_symbols): Ditto.
11909         * object.h (class Sized_relobj): Declare new member
11910         discarded_eh_frame_shndx_.
11911         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
11912         (local_labels_test.o, local_labels_test): New rules.
11913         * testsuite/Makefile.in: Regenerate.
11914
11915 2009-06-04  Doug Kwan  <dougkwan@google.com>
11916
11917         * layout.cc (Layout::section_name_mapping): Add mapping for
11918         special ARM sections.
11919
11920 2009-06-03  Doug Kwan  <dougkwan@google.com>
11921
11922         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
11923         (utils::has_overflow): Same.
11924
11925 2009-06-03  Ian Lance Taylor  <iant@google.com>
11926
11927         * layout.cc (Layout::section_name_mapping): New array, replacing
11928         Layout::linkonce_mapping.
11929         (Layout::section_name_mapping_count): New variable, replacing
11930         Layout::linkonce_mapping_count.
11931         (Layout::linkonce_output_name): Remove.
11932         (Layout::output_section_name): Rewrite.
11933         * layout.h (class Layout): Rename Linkonce_mapping to
11934         Section_name_mapping, linkonce_mapping to section_name_mapping,
11935         linkonce_mapping_count to section_name_mapping_count.  Don't
11936         declare linkonce_output_name.
11937
11938 2009-06-03  Doug Kwan  <dougkwan@google.com>
11939
11940         * gold/arm.cc (namespace utils): New.
11941         (Target_arm::reloc_is_non_pic): Define new method.
11942         (class Arm_relocate_functions): New.
11943         (Target_arm::Relocate::relocate): Handle relocation types used by
11944         Android.
11945
11946 2009-06-03  Ian Lance Taylor  <iant@google.com>
11947
11948         * arm.cc (Target_arm::scan::global): Use || instead of |.
11949
11950 2009-06-02  Doug Kwan  <dougkwan@google.com>
11951
11952         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
11953         issued_non_pic_error_.
11954         (class Target_arm::Scan): Declare new method check_non_pic.
11955         Define new method symbol_needs_plt_entry.
11956         Declare new data member issued_non_pic_error_.
11957         (class Target_arm::Relocate): Declare new method
11958         should_apply_static_reloc.
11959         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
11960         (Target_arm::Scan::check_non_pic): Define new method.
11961         (Target_arm::Scan::local): Handle a small subset of reloc types used
11962         by Android.
11963         (Target_arm::Scan::local): Same.
11964         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
11965
11966 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
11967
11968         * incremental.cc (Incremental_inputs::report_command_line): Filter
11969         out --incremental-* options.
11970
11971 2009-05-29  Doug Kwan  <dougkwan@google.com>
11972
11973         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
11974         template class.
11975         (class Target_arm): Update comment.
11976         (Target_arm::Target_arm): Initialize new data members GOT_,
11977         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
11978         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
11979         and Target_arm::rel_dyn_section.
11980         Declare new_enum Target_arm::Got_type.
11981         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
11982         and DYNBSS_.
11983         Update commments for member do_dynsym_value.
11984         (Target_arm::got_size, Target_arm::plt_section,
11985         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
11986         new methods inside class defintion.
11987         (Target_arm::got_section): Define new method.
11988         (Target_arm::rel_dyn_section): Same.
11989         (Output_data_plt_arm): New template class.
11990         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
11991         (Output_data_plt_arm:do_adjust_output_section): Define new method.
11992         (Output_data_plt_arm::add_entry): Same.
11993         (Output_data_plt_arm::first_plt_entry): Define new
11994         static data member for PLT instruction template.
11995         (Output_data_plt_arm::plt_entry): Same.
11996         (Output_data_plt_arm::do_write): Define new method.
11997         (Target_arm::make_plt_entry): Same.
11998         (Target_arm::do_finalize_sections): Same.
11999         (Target_arm::do_dynsym_value): Same.
12000
12001 2009-05-28  Doug Kwan  <dougkwan@google.com>
12002
12003         * Makefile.am (TARGETSOURCES): Add arm.cc.
12004         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12005         * Makefile.in: Regenerate.
12006         * arm.cc: New file.
12007         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12008
12009 2009-05-26  Doug Kwan  <dougkwan@google.com>
12010
12011         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12012         (General_options::check_excluded_libs): Strip off directories in
12013         archive name before matching like GNU ld does.
12014         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12015         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12016         (exclude_libs_test_LDFLAGS): Add linker option
12017         -Wl,--exclude-libs,libexclude_libs_test_3
12018         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12019         an explicit archive without using -l.
12020         (alt/libexclude_libs_test_3.a): New make rule.
12021         * testsuite/Makefile.in: Regenerate.
12022         * testsuite/exclude_libs_test.c : Declare lib3_default().
12023         (main): Call it.
12024         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12025         * exclude_libs_test_3.c: New file.
12026
12027 2009-05-26  Nick Clifton  <nickc@redhat.com>
12028
12029         * po/id.po: New Indonesian translation.
12030         * po/gold.pot: Updated template file.
12031
12032 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12033
12034         * testsuite/Makefile.am: Add -ffunction-sections to compile
12035         gc_comdat_test files.  Add -Wl,--gc-sections to build
12036         gc_comdat_test.
12037         * testsuite/Makefile.in: Regenerate.
12038         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12039
12040 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12041
12042         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12043         kept comdat section was garbage collected.
12044         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12045         * testsuite/Makefile.in: Regenerate.
12046         * testsuite/gc_comdat_test.sh: New file.
12047         * testsuite/gc_comdat_test_1.cc: New file.
12048         * testsuite/gc_comdat_test_2.cc: New file.
12049
12050 2009-05-19  Doug Kwan  <dougkwan@google.com>
12051
12052         * archive.cc (Archive::Archive): Move constructor from archive.h
12053         to here.  Initialize no_export_.
12054         (Archive::get_elf_object_for_member): Set no_export flag of object.
12055         * archive.h (Archive::Archive): Move constructor body to
12056         archive.cc.
12057         (Archive::no_export): New method.
12058         (Archive::no_export_): New field.
12059         * object.h (Object::Object): Initialize no_export_ to false.
12060         (Object::no_export, Object::set_no_export): New methods.
12061         (Object::no_export_): New field.
12062         * options.cc (General_options::parse_exclude_libs): New method.
12063         (General_options::check_excluded_libs) Same.
12064         * options.h (exclude_libs): New option.
12065         (General_options::check_excluded_libs): New method declaration.
12066         (General_options::excluded_libs_): New field.
12067         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12068         default or protected visibility if an object has no-export flag set.
12069         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12070         (check_SCRIPTS): Add exclude_libs_test.sh.
12071         (check_DATA): Add exclude_libs_test.syms.
12072         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12073         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12074         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12075         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12076         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12077         libexclude_libs_test_2.a): New rules.
12078         * testsuite/Makefile.in: Regenerate.
12079         * testsuite/exclude_libs_test.c: New file.
12080         * testsuite/exclude_libs_test.sh: Ditto.
12081         * testsuite/exclude_libs_test_1.c: Ditto.
12082         * testsuite/exclude_libs_test_2.c: Ditto.
12083
12084 2009-05-15  Ian Lance Taylor  <iant@google.com>
12085
12086         * configure.ac: Check for declarations for cases where libiberty.h
12087         checks HAVE_DECL_xxx.
12088         * configure, config.in: Rebuild.
12089
12090 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12091
12092         * gold.h (Incremental_argument_list): Remove (invalid) forward
12093         declaration.
12094         * incremental.cc (Incremental_inputs::report_achive): New method.
12095         (Incremental_inputs::report_object): New method.
12096         (Incremental_inputs::report_script): New method.
12097         (Incremental_inputs::finalize_inputs): New method.
12098         (Incremental_inputs::finalize): Call finalize_inputs().
12099         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12100         Create inputs entries.
12101         * incremental.h (Incremental_input_type): New enum.
12102         (Incremental_inputs::Incremental_input): Initialize new fields.
12103         (Incremental_inputs::report_inputs): New method.
12104         (Incremental_inputs::report_achive): New method.
12105         (Incremental_inputs::report_object): New method.
12106         (Incremental_inputs::report_script): New method.
12107         (Incremental_inputs::finalize_inputs): New method.
12108         (Incremental_inputs::Input_info): New struct.
12109         (Incremental_inputs::Input_info_map): New typedef.
12110         (Incremental_inputs::lock_): New field.
12111         (Incremental_inputs::Inputs_): New field.
12112         (Incremental_inputs::Inputs_map): New field.
12113         * main.cc (main): Call Incremental_input::report_inputs.
12114         * options.h (Input_argument_list): Typedef moved from
12115         Input_arguments.
12116         (Input_file_group::Files): Remove, use ::Input_argument_list.
12117         (Input_file_group::Input_argument_list): Remove, use
12118         ::Input_argument_list.
12119         * plugin.cc (Plugin_manager::add_input_file): Add error in
12120         incremental build.
12121         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12122         functions.
12123         * script.cc (read_input_script): Call
12124         Incremental_input::report_script.
12125         * script.h (Script_info): New class.
12126
12127 2009-04-27  Ian Lance Taylor  <iant@google.com>
12128
12129         * x86_64.cc (do_adjust_output_section): Set entsize to
12130         plt_entry_size.
12131
12132 2009-04-23  Elliott Hughes  <enh@google.com>
12133
12134         * output.cc (Output_file::close): After short writes, continue
12135         writing from the correct offset in the buffer being written.
12136
12137 2009-04-23  Chris Demetriou  <cgd@google.com>
12138
12139         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12140         * configure: Regenerate.
12141         * config.in: Regenerate.
12142         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12143         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12144
12145 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12146
12147         * incremental.cc (Incremental_inputs_header_data): Renamed from
12148         Incremental_input_header_data.
12149         (Incremental_inputs_header_data::data_size): New field.
12150         (Incremental_inputs_header_data::put_input_file_count): Renamed
12151         from input_file_count.
12152         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12153         from command_line_offset.
12154         (Incremental_inputs_header_data::put_reserved): Renamed from
12155         put_reserved.
12156         (Incremental_inputs_entry_data): Renamed from
12157         Incremental_input_entry_data.
12158         (Incremental_inputs_entry_data::data_size): New field.
12159         (Incremental_inputs::report_command_line): New method.
12160         (Incremental_inputs::finalize): New method.
12161         (Incremental_inputs::create_incremental_inputs_data): New method.
12162         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12163         * incremental.h: New file.
12164         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12165         (Layout::finalize): Create incremental inputs section in
12166         incremental builds.
12167         (Layout::create_incremental_info_sections): New method.
12168         * layout.h (Layout::incremental_inputs): New method.
12169         (Layout::create_incremental_info_sections): New method.
12170         (Layout::incremental_inputs_): New field.
12171         * main.cc (main): Notify Incremental_input of the command line.
12172
12173 2009-04-01  Ian Lance Taylor  <iant@google.com>
12174             Mikolaj Zalewski  <mikolajz@google.com>
12175
12176         * gold.h (reserve_unordered_map): Define, three versions, one for
12177         each version of Unordered_map.
12178         * layout.cc (Layout::Layout): Remove options parameter.  Add
12179         number_of_input_files parameter.  Don't initialize options_.
12180         Initialize number_of_input_files_ and resized_signatures_.  Move
12181         sections_are_attached_.
12182         (Layout::layout_group): Reserve space for group_signatures_.
12183         (Layout::find_or_add_kept_section): Change name parameter to be a
12184         reference.  Resize signatures_ map when it gets large enough.
12185         (Layout::layout_eh_frame): Use parameters->options() instead of
12186         this->options_.
12187         (Layout::make_output_section): Likewise.
12188         (Layout::attach_allocated_section_to_segment): Likewise.
12189         (Layout::finalize, Layout::create_executable_stack): Likewise.
12190         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12191         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12192         * layout.h (class Layout): Update declarations.  Remove options_
12193         field.  Add number_of_input_files_ and resized_signatures_
12194         fields.  Move sections_are_attached_ field.
12195         * main.cc (main): Pass number of input files to Layout
12196         constructor.  Don't pass options.
12197
12198 2009-03-30  Ian Lance Taylor  <iant@google.com>
12199
12200         * ffsll.c (ffsll): Correct implementation.
12201
12202 2009-03-27  Ian Lance Taylor  <iant@google.com>
12203
12204         * ffsll.c: New file.
12205         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12206         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12207         * ftruncate.c (ftruncate): Declare before definition.
12208         * mremap.c (mremap): Likewise.
12209         * pread.c (pread): Likewise.
12210         * configure, Makefile.in, config.in: Rebuild.
12211
12212         * mremap.c: New file.
12213         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12214         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12215         (mremap): Declare if HAVE_MREMAP is not defined.
12216         * configure, Makefile.in, config.in: Rebuild.
12217
12218 2009-03-27  Cary Coutant  <ccoutant@google.com>
12219
12220         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12221         position independent.
12222         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12223         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12224
12225 2009-03-24  Cary Coutant  <ccoutant@google.com>
12226
12227         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12228         an executable.
12229         (needs_dynamic_reloc): Likewise.
12230
12231 2009-03-24  Ian Lance Taylor  <iant@google.com>
12232
12233         * yyscript.y (file_cmd): Recognize EXTERN.
12234         (extern_name_list, extern_name_list_body): New nonterminals.
12235         * script.cc (script_add_extern): Define.
12236         * script-c.h (script_add_extern): Declare.
12237
12238 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12239
12240         * object.cc (is_elf_object): Define.
12241         * object.h (is_elf_object): Declare.
12242         * archive.cc (Archive::get_elf_object_for_member): Call
12243         is_elf_object.
12244         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12245
12246 2009-03-24  Elliott Hughes  <enh@google.com>
12247
12248         * output.cc (Output_file::map_anonymous): Define.
12249         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12250         try an anonymous one.  Report the size if the mmap fails.
12251         * output.h (class Output_file): Declare map_anonymous.
12252
12253 2009-03-24  Ian Lance Taylor  <iant@google.com>
12254
12255         * target-select.cc (instantiate_target): Don't acquire the lock if
12256         the instantiated_target_ field has already been set.
12257
12258 2009-03-23  Ian Lance Taylor  <iant@google.com>
12259
12260         * gold-threads.h (class Initialize_lock): Define.
12261         * gold-threads.cc (class Initialize_lock_once): Define.
12262         (initialize_lock_control): New static variable.
12263         (initialize_lock_pointer): New static variable.
12264         (initialize_lock_once): New static function.
12265         (Initialize_lock::Initialize_lock): Define.
12266         (Initialize_lock::initialize): Define.
12267         * target-select.h: Include "gold-threads.h".
12268         (class Target_selector): Add lock_ and initialize_lock_ fields.
12269         Don't define instantiate_target, just declare it.
12270         * target-select.cc (Target_selector::Target_selector): Initialize
12271         new fields.
12272         (Target_selector::instantiate_target): Define.
12273         * descriptors.h: Include "gold-threads.h".
12274         (class Descriptors): Add initialize_lock_ field.
12275         * descriptors.cc (Descriptors::Descriptors): Initialize new
12276         field.
12277         (Descriptors::open): Use initialize_lock_ field
12278         * errors.h (class Errors): Add initialize_lock_ field.
12279         * errors.cc (Errors::Errors): Initialize new field.
12280         (Errors::initialize_lock): Use initialize_lock_ field.
12281         * powerpc.cc (class Target_selector_powerpc): Remove
12282         instantiated_target_ field.  In do_recognize call
12283         instantiate_target rather than do_instantiate_target.  In
12284         do_instantiate_target just allocate a new target.
12285         * sparc.cc (class Target_selector_sparc): Likewise.
12286
12287         * freebsd.h: New file.
12288         * i386.cc: Include "freebsd.h".
12289         (Target_i386): Derive from Target_freebsd rather than
12290         Sized_target.
12291         (Target_selector_i386): Derive from Target_selector_freebsd rather
12292         than Target_selector.
12293         * x86_64.cc: Include "freebsd.h".
12294         (Target_x86_64): Derive from Target_freebsd rather than
12295         Sized_target.
12296         (Target_selector_x86_64): Derive from Target_selector_freebsd
12297         rather than Target_selector.
12298         * target.h (class Target): Add adjust_elf_header and
12299         do_adjust_elf_header.
12300         * output.cc (Output_file_header:: do_sized_write): Call target
12301         adjust_elf_header routine.
12302         * configure.tgt: Set targ_osabi.
12303         * configure.ac: Define GOLD_DEFAULT_OSABI.
12304         * parameters.cc (Parameters::default_target): Pass
12305         GOLD_DEFAULT_OSABI to select_target.
12306         * target-select.h (class Target_selector): Make instantiate_target
12307         protected rather than private.
12308         * Makefile.am (HFILES): Add freebsd.h.
12309         * configure, Makefile.in, config.in: Rebuild.
12310
12311         * merge.cc (do_add_input_section): Correct pend value.  Change
12312         message about last entry not being null terminated from error to
12313         warning.
12314
12315 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12316
12317         * incremental.cc: New file.
12318         * Makefile.am (CCFILES): Add incremental.cc.
12319         * Makefile.in: Rebuild.
12320
12321 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12322
12323         * layout.cc (Layout::output_section_name): Preserve names
12324         of '.note.' sections.
12325
12326 2009-03-19  Ian Lance Taylor  <iant@google.com>
12327
12328         * descriptors.cc (Descriptors::open): Check that the options are
12329         valid before using them.
12330
12331 2009-03-18  Ian Lance Taylor  <iant@google.com>
12332
12333         * script-sections.h: Include <list>.
12334         (class Script_sections): Change Sections_elements from std::vector
12335         to std::list.  Typedef public Elements_iterator.  Add
12336         orphan_section_placement_, data_segment_align_start_, and
12337         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12338         field.
12339         * script-sections.cc (class Orphan_section_placement): New class.
12340         (class Sections_element): Add virtual functions is_relro and
12341         orphan_section_init.  Remove virtual function place_orphan_here.
12342         (class Output_section_definition): Add is_relro and
12343         orphan_section_init.  Remove place_orphan_here.
12344         (class Orphan_output_section): Likewise.
12345         (Script_sections::Script_sections): Update for field changes.
12346         (Script_sections::data_segment_align): Set saw_data_segment_align_
12347         and data_segment_align_start_, not data_segment_align_index.
12348         (Script_sections::data_segment_relro_end): Check
12349         saw_data_segment_align_.  Use data_segment_align_start_ rather
12350         than data_segment_align_index_.
12351         (Script_sections::place_orphan): Rewrite to use
12352         Orphan_section_placement.
12353
12354 2009-03-17  Ian Lance Taylor  <iant@google.com>
12355
12356         * archive.cc (Archive::add_symbols): Check for a version attached
12357         to the symbol name in the archive map.
12358         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12359         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12360         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12361         (ver_test_11.a): New target.
12362         * testsuite/Makefile.in: Rebuild.
12363
12364         * configure.ac: Check for chsize and posix_fallocate.  Replace
12365         ftruncate.
12366         * ftruncate.c: New file, from gnulib.
12367         * output.cc (posix_fallocate): Define dummy version if not
12368         HAVE_POSIX_FALLOCATE.
12369         (Output_file::map): Call posix_fallocate rather than lseek and
12370         write.
12371         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12372         * configure, Makefile.in, config.in: Rebuild.
12373
12374 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12375
12376         * layout.h (Layout::create_note): Add section_name parameter.
12377         * layout.cc (Layout::create_note): Likewise.
12378         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12379
12380 2009-03-17  Ian Lance Taylor  <iant@google.com>
12381
12382         * descriptors.cc: Include "options.h".
12383         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12384         (Descriptors::open): Always use O_CLOEXEC when opening a new
12385         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12386         then set FD_CLOEXEC.
12387
12388         * sparc.cc (class Target_sparc): Add has_got_section.
12389         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12390         make sure we have a GOT section.
12391
12392         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12393         (Target_sparc::Scan::local): Likewise.
12394         (Target_sparc::Scan::global): Likewise.
12395         (Target_sparc::Relocate::relocate): Likewise.
12396         (Target_sparc::Relocate::relocate_tls): Likewise.
12397
12398         * symtab.cc (Symbol_table::define_default_version): New function,
12399         broken out of add_from_object.
12400         (Symbol_table::add_from_object): Call define_default_version.
12401         (Symbol_table::define_special_symbol): Add resolve_oldsym
12402         parameter.  Change all callers.  If the version for a symbol comes
12403         from a version script, resolve it with the symbol with the same
12404         name with no version.  Also add the symbol without a version if
12405         appropriate.
12406         (do_define_in_output_data): If resolving with oldsym, don't delete
12407         sym.
12408         (do_define_in_output_segment): Likewise.
12409         (do_define_as_constant): Likewise.
12410         * symtab.h (class Symbol_table): Update declarations.
12411
12412 2009-03-13  Ian Lance Taylor  <iant@google.com>
12413
12414         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12415         (Read_symbols::requeue): New function.
12416         (Read_symbols::do_read_symbols): If make_elf_object fails because
12417         the target type is not configured, and the file was searched for,
12418         issue a warning and retry with the next directory.
12419         (Add_symbols::run): If the file has an incompatible format, and
12420         it was searched for, requeue the Read_symbols task.  On error,
12421         release the object.
12422         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12423         dirindex parameter to constructor.  Change all callers.  Declare
12424         incompatible_warning and requeue.
12425         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12426         input_argument_ and input_group_ fields.  Add them to
12427         constructor.  Change all callers.
12428         (class Read_script): Add dirindex_ field.  Add it to constructor.
12429         Change all callers.
12430         * archive.cc (Archive::setup): Remove input_objects parameter.
12431         Change all callers.
12432         (Archive::get_file_and_offset): Likewise.
12433         (Archive::read_all_symbols): Likewise.
12434         (Archive::read_symbols): Likewise.
12435         (Archive::get_elf_object_for_member): Remove input_objects
12436         parameter.  Add punconfigured parameter.  Change all callers.
12437         (Archive::add_symbols): Change return type to bool.  Check return
12438         value of include_member.
12439         (Archive::include_all_members): Likewise.
12440         (Archive::include_member): Change return type to bool.  Return
12441         false if first included object has incompatible target.  Set
12442         included_member_ field.
12443         (Add_archive_symbols::run): If add_symbols returns false, requeue
12444         Read_symbols task.
12445         * archive.h (class Archive): Add included_member_ field.
12446         Initialize it in constructor.  Add input_file and searched_for
12447         methods.  Update declarations.
12448         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12449         input_argument_ fields.  Add them to constructor.  Change all
12450         callers.
12451         * script.cc: Include "target-select.h".
12452         (class Parser_closure): Add skip_on_incompatible_target_ and
12453         found_incompatible_target_ fields.  Add
12454         skip_on_incompatible_target parameter to constructor.  Change all
12455         callers.  Add methods skip_on_incompatible_target,
12456         clear_skip_on_incompatible_target, found_incompatible_target, and
12457         set_found_incompatible_target.
12458         (read_input_script): Add dirindex parameter.  Change all callers.
12459         If parser finds an incompatible target, requeue Read_symbols
12460         task.
12461         (script_set_symbol): Clear skip_on_incompatible_target in
12462         closure.
12463         (script_add_assertion, script_parse_option): Likewise.
12464         (script_start_sections, script_add_phdr): Likewise.
12465         (script_check_output_format): New function.
12466         * script.h (read_input_script): Update declaration.
12467         * script-c.h (script_check_output_format): Declare.
12468         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12469         (ignore_cmd): Remove OUTPUT_FORMAT.
12470         * fileread.cc (Input_file::Input_file): Add explicit this.
12471         (Input_file::will_search_for): New function.
12472         (Input_file::open): Add pindex parameter.  Change all callers.
12473         * fileread.h (class Input_file): Add input_file_argument method.
12474         Declare will_search_for.  Update declarations.
12475         * object.cc (make_elf_object): Add punconfigured parameter.
12476         Change all callers.
12477         * object.h (class Object): Make input_file public.  Add
12478         searched_for method.
12479         (make_elf_object): Update declaration.
12480         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12481         restart search.
12482         * dirsearch.h (class Dirsearch): Update declaration.
12483         * options.h (class General_options): Add --warn-search-mismatch.
12484         * parameters.cc (Parameters::is_compatible_target): New function.
12485         * parameters.h (class Parameters): Declare is_compatible_target.
12486         * workqueue.cc (Workqueue::add_blocker): New function.
12487         * workqueue.h (class Workqueue): Declare add_blocker.
12488
12489         * fileread.cc (Input_file::open): Remove options parameter.
12490         Change all callers.
12491         (Input_file::open_binary): Likewise.
12492         * script.cc (read_input_script): Likewise.
12493         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12494         options parameter from constructor.  Change all callers.
12495         (class Read_script): Likewise.
12496         * fileread.h (class Input_file): Update declarations.
12497         * script.h (read_input_script): Update declaration.
12498
12499 2009-03-10  Nick Clifton  <nickc@redhat.com>
12500
12501         * po/es.po: New Spanish translation.
12502
12503 2009-03-06  Cary Coutant  <ccoutant@google.com>
12504
12505         * options.cc (parse_short_option): Keep dash_z from registering itself.
12506
12507 2009-03-03  Ian Lance Taylor  <iant@google.com>
12508
12509         PR 9918
12510         * target-reloc.h (relocate_section): Pass output_section to
12511         relocate.
12512         * i386.cc (Target_i386::should_apply_static_reloc): Add
12513         output_section parameter.  Change all callers.
12514         (Target_i386::Relocate::relocate): Add output_section parameter.
12515         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12516         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12517         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12518         * testsuite/two_file_shared.sh: New script.
12519         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12520         (check_DATA): Add two_file_shared.dbg.
12521         (two_file_shared.dbg): New target.
12522         * testsuite/Makefile.in: Rebuild.
12523
12524 2009-03-01  Ian Lance Taylor  <iant@google.com>
12525
12526         * configure.ac: Check for byteswap.h.
12527         * configure: Rebuild.
12528         * config.in: Rebuild.
12529
12530 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12531
12532         * layout.cc (Layout::find_or_add_kept_section): New function.
12533         (Layout::add_comdat): Removed.
12534         * layout.h (struct Kept_section): Move out of class Layout.
12535         Remove trailing underscores from field names.  Add group_sections
12536         field.  Rename group_ field to is_group.  Change all uses.
12537         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12538         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12539         comdat_groups_ field.
12540         (Sized_relobj::include_section_group): Use
12541         find_or_add_kept_section and Kept_section::group_sections.
12542         (Sized_relobj::include_linkonce_section): Likewise.
12543         * object.cc (class Sized_relobj): Don't define Comdat_group or
12544         Comdat_group_table.  Remove find_comdat_group and
12545         add_comdat_group.  Remove comdat_groups_ field.
12546         * plugin.cc (include_comdat_group): Use
12547         Layout::find_or_add_kept_section.
12548
12549 2009-02-28  Ian Lance Taylor  <iant@google.com>
12550
12551         * README: --gc-sections and map files are now supported.  Document
12552         some build requirements.
12553
12554         PR 6992
12555         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12556         relocatable link set the value of the section symbol to zero.
12557         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12558         relocatable link don't include the section address in the local
12559         symbol value.
12560
12561 2009-02-27  Ian Lance Taylor  <iant@google.com>
12562
12563         PR 6811
12564         * options.h (class Search_directory): Add is_system_directory.
12565         (class General_options): Declare is_in_system_directory.
12566         * options.cc (get_relative_sysroot): Make static.
12567         (get_default_sysroot): Make static.
12568         (General_optoins::is_in_system_directory): New function.
12569         * fileread.cc (Input_file::is_in_system_directory): New function.
12570         * fileread.h (class Input_file): Declare is_in_system_directory.
12571         * object.h (class Object): Add is_in_system_directory.
12572         (class Input_objects): Remove system_library_directory_ field.
12573         * object.cc (Input_objects::add_object): Don't set
12574         system_library_directory_.
12575         (input_objects::found_in_system_library_directory): Remove.
12576         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12577         parameter.  Change all callers.
12578         (Symbol_table::sized_write_globals): Likewise.
12579         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12580         Call Object::is_in_system_directory.
12581         * symtab.h (class Symbol_table): Update declarations.
12582
12583         PR 5990
12584         * descriptors.h (Open_descriptor): Add is_on_stack field.
12585         * descriptors.cc (Descriptors::open): If the descriptor is on the
12586         top of the stack, remove it.  Initialize is_on_stack field.
12587         (Descriptors::release): Only add pod to stack if it is not on the
12588         stack already.
12589         (Descriptors::close_some_descriptor): Clear stack_next and
12590         is_on_stack fields.
12591
12592         PR 7091
12593         * output.cc (Output_section::find_starting_output_address): Rename
12594         from starting_output_address; add PADDR parameter; change return
12595         type.
12596         * output.h (class Output_section): Declare
12597         find_starting_output_address instead of starting_output_address.
12598         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12599         section symbol for which we can't find a merge section.
12600
12601         PR 9836
12602         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12603         hidden or internal, force the symbol to be local.
12604         * resolve.cc (Symbol::override_visibility): Define.
12605         (Symbol::override_base): Use override_visibility.
12606         (Symbol_table::resolve): Likewise.
12607         (Symbol::override_base_with_special): Likewise.
12608         (Symbol_table::override_with_special): If the visibility is hidden
12609         or internal, force the symbol to be local.
12610         * symtab.h (class Symbol): Add set_visibility and
12611         override_visibility.
12612         * testsuite/ver_test_1.sh: New file.
12613         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12614         (check_DATA): Add ver_test_1.syms.
12615         (ver_test_1.syms): New target.
12616         * testsuite/Makefile.in: Rebuild.
12617
12618 2009-02-25  Cary Coutant  <ccoutant@google.com>
12619
12620         * layout.cc (Layout::choose_output_section): Don't rename sections
12621         when using a linker script that has a SECTIONS clause.
12622         * Makefile.in: Regenerate.
12623
12624         * testsuite/Makefile.am (script_test_5.sh): New test case.
12625         * testsuite/Makefile.in: Regenerate.
12626         * testsuite/script_test_5.cc: New file.
12627         * testsuite/script_test_5.sh: New file.
12628         * testsuite/script_test_5.t: New file.
12629
12630 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12631
12632         * archive.cc (Archive::include_member): Update calls to add_symbols.
12633         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12634         the Layout argument.
12635         * dynobj.h (do_add_symbols): Add the Layout argument.
12636         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12637         Layout argument.
12638         * object.h (Object::add_symbols): Add the Layout argument.
12639         (Object::do_add_symbols): Add the Layout argument.
12640         (Sized_relobj::do_add_symbols): Add the Layout argument.
12641         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12642         Unify the two versions.
12643         (Add_plugin_symbols): Remove.
12644         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12645         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12646         (Add_plugin_symbols): Remove.
12647         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12648         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12649         (Add_symbols::run): Make it work with Pulginobj.
12650
12651 2009-02-06  Ian Lance Taylor  <iant@google.com>
12652
12653         * object.cc (Sized_relobj::do_layout): Make info message start
12654         with lower case letter.
12655
12656 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12657
12658         * binary.cc: Fix file comment.
12659
12660         * options.h (enum Incremental_disposition): Define.
12661         (class General_options): Add new options: --incremental,
12662         --incremental_changed, --incremental_unchanged,
12663         --incremental_unknown.  Add incremental_disposition_ and
12664         implicit_incremental_ fields.
12665         (General_options::incremental_disposition): New function.
12666         (class Position_dependent_options): Add incremental_disposition
12667         option.
12668         (Position_dependent_options::copy_from_options): Set incremental
12669         dispositions.
12670         * options.cc (General_options::parse_incremental_changed): New
12671         function.
12672         (General_options::parse_incremental_unchanged): New function.
12673         (General_options::parse_incremental_unknown): New function.
12674         (General_options::General_options): Initialize new fields
12675         incremental_disposition_ and implicit_incremental_.
12676         (General_options::finalize): Check for uasge of --incremental-*
12677         without --incremental.
12678
12679 2009-02-06  Chris Demetriou  <cgd@google.com>
12680
12681         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12682         pointer and to report location as the file name associated with
12683         the symbol.
12684         (gold_undefined_symbol_at_location): New function to replace the
12685         old gold_undefined_symbol functionality.
12686         * target-reloc.h (relocate_section): Update to use
12687         gold_undefined_symbol_at_location.
12688         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12689         Call gold_undefined_symbol function rather than gold_error.
12690         * errors.h (Errors::undefined_symbol): Take location as a
12691         string, rather than calculating it from a relocation.
12692         * errors.cc (Errors::fatal): Print "fatal error:" before the
12693         formatted message.
12694         (Errors::error, Errors::error_at_location): Print "error: "
12695         before the formatted message.
12696         (Errors::undefined_symbol): Take location as a string, rather
12697         than calculating it from a relocation.
12698         (gold_undefined_symbol_at_location): New function akin to
12699         old gold_undefined_symbol, calculates location from relocation.
12700         (gold_undefined_symbol): Change to take only a Symbol pointer
12701         and to report location as the file name associated with the symbol.
12702         * testsuite/debug_msg.sh: Update for changed error messages.
12703         * testsuite/undef_symbol.sh: Likewise.
12704
12705 2009-02-04  Duncan Sands  <baldrick@free.fr>
12706
12707         PR 9812
12708         * reduced_debug_output.h
12709         (Output_reduced_debug_abbrev_section::failed): Use format for
12710         gold_warning.
12711         (Output_reduced_debug_info_section::faild): Likewise.
12712
12713 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12714
12715         * script.cc (Lazy_demangler): New class.
12716         (Version_script_info::get_symbol_version_helper): Demangle a
12717         symbol only once.
12718
12719 2009-01-29  Cary Coutant  <ccoutant@google.com>
12720
12721         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12722         to __tls_get_addr.
12723         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12724
12725 2009-01-28  Ian Lance Taylor  <iant@google.com>
12726
12727         * version.cc (version_string): Bump to 1.9.
12728
12729         * gold.h: Include <cstring> and <stdint.h>.
12730         * version.cc: Include <cstdio>.
12731         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12732         warning.
12733         * reduced_debug_output.cc (insert_into_vector): Rename from
12734         Insert_into_vector; change all callers.  Use Swap_unaligned to
12735         avoid aliasing issue; remove union since it is unnecessary.
12736
12737 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12738
12739         * Makefile.am (CCFILES): Add gc.cc.
12740         (HFILES): Add gc.h.
12741         * Makefile.in: Regenerate.
12742         * gold.cc (Gc_runner): New class.
12743         (queue_initial_tasks): Call garbage collection related tasks
12744         when corresponding options are invoked.
12745         (queue_middle_gc_tasks): New function.
12746         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12747         processed early before laying out sections during garbage collection.
12748         * gold.h (queue_middle_gc_tasks): New function.
12749         (is_prefix_of): Move from "layout.cc".
12750         * i386.cc (Target_i386::gc_process_relocs): New function.
12751         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12752         * main.cc (main): Create object of class "Garbage_collection".
12753         * object.cc (Relobj::copy_symbols_data): New function.
12754         (Relobj::is_section_name_included): New function.
12755         (Sized_relobj::do_layout): Allow this function to be called twice
12756         during garbage collection and defer layout of section during the
12757         first call.
12758         * object.h (Relobj::get_symbols_data): New function.
12759         (Relobj::is_section_name_included): New function.
12760         (Relobj::copy_symbols_data): New function.
12761         (Relobj::set_symbols_data): New function.
12762         (Relobj::get_relocs_data): New function.
12763         (Relobj::set_relocs_data): New function.
12764         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12765         (Relobj::gc_process_relocs): New function.
12766         (Relobj::do_gc_process_relocs): New pure virtual function.
12767         (Relobj::sd_): New data member.
12768         (Sized_relobj::is_output_section_offset_invalid): New function.
12769         (Sized_relobj::do_gc_process_relocs): New function.
12770         * options.h (General_options::gc_sections): Modify to not be a no-op.
12771         (General_options::print_gc_sections): New option.
12772         * plugin.cc (Plugin_finish::run): Remove function call to
12773         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12774         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12775         * reloc.cc (Read_relocs::run): Add task to process relocs and
12776         determine unreferenced sections when doing garbage collection.
12777         (Gc_process_relocs): New class.
12778         (Sized_relobj::do_gc_process_relocs): New function.
12779         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12780         sections that are garbage collected.
12781         * reloc.h (Gc_process_relocs): New class.
12782         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12783         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12784         symbols whose corresponding sections are garbage collected.
12785         (Symbol_table::Symbol_table): Add new parameter for the garbage
12786         collection object.
12787         (Symbol_table::gc_mark_undef_symbols): New function.
12788         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12789         (Symbol_table::gc_mark_dyn_syms): New function.
12790         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12791         as garbage.
12792         (Symbol_table::add_from_object): Likewise.
12793         (Symbol_table::add_from_relobj): When building shared objects, do not
12794         treat externally visible symbols as garbage.
12795         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12796         table information for static and relocatable links.
12797         * symtab.h (Symbol_table::set_gc): New function.
12798         (Symbol_table::gc): New function.
12799         (Symbol_table::gc_mark_undef_symbols): New function.
12800         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12801         (Symbol_table::gc_mark_dyn_syms): New function.
12802         (Symbol_table::gc_): New data member.
12803         * target.h (Sized_target::gc_process_relocs): New pure virtual
12804         function.
12805         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12806         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12807
12808 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12809
12810         * options.h (General_options::gc_sections): Define as a no-op for now.
12811         (General_options::no_keep_memory): Ditto.
12812         (General_options::Bshareable): Define.
12813         * options.cc (General_options::finalize): Honor -Bshareable.
12814
12815 2009-01-20  Andreas Schwab  <schwab@suse.de>
12816
12817         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12818         read the value in the contents, since we don't use it.  Use the
12819         template endianness when writing.
12820         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12821
12822 2009-01-19  Andreas Schwab  <schwab@suse.de>
12823
12824         * configure.tgt (powerpc64-*): Fix targ_obj.
12825
12826 2009-01-15  Ian Lance Taylor  <iant@google.com>
12827
12828         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12829         local symbols when stripping all symbols.
12830
12831 2009-01-14  Cary Coutant  <ccoutant@google.com>
12832
12833         * output.cc (Output_reloc): Add explicit instantiations.
12834
12835 2009-01-14  Cary Coutant  <ccoutant@google.com>
12836
12837         * archive.cc (Archive::get_elf_object_for_member): Remove call
12838         to File_read::claim_for_plugin.
12839         * descriptors.cc (Descriptors::open): Remove reference to
12840         is_claimed.
12841         (Descriptors::claim_for_plugin): Remove.
12842         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12843         (Descriptors::is_claimed): Remove.
12844         (claim_descriptor_for_plugin): Remove.
12845         * fileread.cc (File_read::claim_for_plugin): Remove.
12846         * fileread.h (File_read::claim_for_plugin): Remove.
12847         (File_read::descriptor): Reopen descriptor if necessary.
12848         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12849         (Plugin_manager::all_symbols_read): Add task parameter. Change
12850         all callers.
12851         (Plugin_manager::get_input_file): New function.
12852         (Plugin_manager::release_input_file): New function.
12853         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12854         corresponding data member.
12855         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12856         and pass to base constructor. Change all callers.
12857         (get_input_file, release_input_file): New functions.
12858         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12859         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12860         (Plugin_manager::all_symbols_read): Add task parameter.
12861         (Plugin_manager::get_input_file): New function.
12862         (Plugin_manager::release_input_file): New function.
12863         (Plugin_manager::task_): New data member.
12864         (Pluginobj::Pluginobj): Add filesize parameter.
12865         (Pluginobj::filename): New function.
12866         (Pluginobj::descriptor): New function.
12867         (Pluginobj::filesize): New function.
12868         (Pluginobj::filesize_): New data member.
12869         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12870         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12871         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12872
12873         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12874         with archive libraries.
12875         * testsuite/Makefile.in: Regenerate.
12876         * testsuite/plugin_test.c (struct sym_info): New type.
12877         (get_input_file, release_input_file): New static variables.
12878         (onload): Capture new transfer vector entries.
12879         (claim_file_hook): Stop reading at end of file according to filesize.
12880         Factor out parsing of readelf output into separate function.
12881         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12882         APIs and get the source file name from the symbol table.  Convert
12883         source file name to corresponding object file name.  Print info
12884         message when adding new input files.
12885         (parse_readelf_line): New function.
12886         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12887         * testsuite/plugin_test_2.sh: Likewise.
12888         * testsuite/plugin_test_3.sh: Likewise.
12889         * testsuite/plugin_test_4.sh: New test case.
12890
12891 2009-01-07  Ian Lance Taylor  <iant@google.com>
12892
12893         * version.cc (version_string): Bump to 1.8.
12894
12895 2008-12-23  Cary Coutant  <ccoutant@google.com>
12896
12897         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12898         * plugin.cc (Plugin_manager::finish): Rename as
12899         layout_deferred_objects.  Move cleanup to separate function.
12900         (Plugin_manager::cleanup): New function.
12901         (Plugin_finish::run): Call layout_deferred_objects and cleanup
12902         separately.
12903         * plugin.h (Plugin_manager::finish): Rename as
12904         layout_deferred_objects.
12905         (Plugin_manager::cleanup): New function.
12906         (Plugin_manager::cleanup_done): New field.
12907
12908 2008-12-23  Cary Coutant  <ccoutant@google.com>
12909
12910         * plugin.cc (is_visible_from_outside): New function.
12911         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
12912         so we don't return "IR only" status for exported symbols or -r links.
12913
12914         * testsuite/Makefile.am (plugin_test_3): New test case.
12915         * testsuite/Makefile.in: Regenerate.
12916         * testsuite/plugin_test_3.sh: New file.
12917
12918 2008-12-22  Cary Coutant  <ccoutant@google.com>
12919
12920         * object.cc (Sized_relobj::layout_section): New function.
12921         (Sized_relobj::do_layout): Defer layout of input sections until after
12922         plugin has provided replacement files.
12923         (Sized_relobj::do_layout_deferred_sections): New function.
12924         * object.h (Relobj::set_section_offset): Remove virtual keyword.
12925         (Relobj::layout_deferred_sections): New function.
12926         (Relobj::do_layout_deferred_sections): New function.
12927         (Sized_relobj::do_layout_deferred_sections): New function.
12928         (Sized_relobj::layout_section): New function.
12929         (Sized_relobj::Deferred_layout): New structure.
12930         (Sized_relobj::deferred_layout_): New field.
12931         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
12932         Change all callers.  Layout deferred sections.
12933         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
12934         references.
12935         (Plugin_hook::run): Move code from do_plugin_hook inline.
12936         (Plugin_hook::do_plugin_hook): Remove.
12937         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
12938         (Plugin_manager::finish): Renamed, was cleanup.
12939         (Plugin_manager::should_defer_layout): New function.
12940         (Plugin_manager::add_deferred_layout_object): New function.
12941         (Plugin_manager::Deferred_layout_list): New type.
12942         (Plugin_manager::deferred_layout_objects_): New field.
12943         (Plugin_hook::do_plugin_hook): Remove.
12944
12945 2008-12-17  Ian Lance Taylor  <iant@google.com>
12946
12947         * options.h (class General_options): Add --no case for
12948         --export-dynamic.
12949
12950 2008-12-16  Cary Coutant  <ccoutant@google.com>
12951
12952         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
12953         vector.
12954         (Plugin_manager::claim_file): Create plugin object even if
12955         plugin did not call the add_symbols callback.
12956         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
12957         asking for more symbols than were added.
12958         * testsuite/Makefile.am (plugin_test_1): Add test case with
12959         no global symbols.
12960         (empty.syms): New target.
12961         * testsuite/Makefile.in: Regenerate.
12962         * testsuite/plugin_test.c (claim_file_hook): Add new debug
12963         message. Don't call add_symbols if no globals.
12964         (all_symbols_read_hook): Don't provide replacement for empty
12965         claimed file.
12966
12967 2008-12-12  Ian Lance Taylor  <iant@google.com>
12968
12969         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
12970         r_type == 0 for a local symbol with r_sym == 0.
12971         (scan_relocatable_relocs): Pass r_sym to
12972         local_non_section_strategy.
12973         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
12974         r_sym parameter.
12975
12976         * configure.ac: Update test for TLS descriptors: they are
12977         supported as of glibc 2.9.
12978         * configure: Rebuild.
12979
12980 2008-12-11  Ian Lance Taylor  <iant@google.com>
12981
12982         PR 7091
12983         * target-reloc.h (Default_scan_relocatable_relocs): For each
12984         function, map r_type == 0 to RELOC_DISCARD.
12985
12986 2008-12-10  Cary Coutant  <ccoutant@google.com>
12987
12988         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
12989         object to override a kept COMDAT group from a plugin object.
12990
12991 2008-12-09  Ian Lance Taylor  <iant@google.com>
12992
12993         PR 7088
12994         * yyscript.y (file_cmd): Handle INPUT.
12995
12996         * testsuite/initpri1.c: Change all declarations to be full
12997         prototypes by adding void, to avoid compiler warnings.
12998
12999 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13000
13001         * options.cc (General_options::parse_plugin_opt): New.
13002         (General_options::add_plugin): The argument now is just the filename.
13003         (General_options::add_plugin_option): New.
13004         * options.h (plugin_opt): New.
13005         (add_plugin): Change argument name.
13006         (add_plugin_option): New.
13007         * plugin.cc (Plugin::load): Don't parse the plugin option.
13008         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13009         (Plugin::add_option): New.
13010         (Plugin::args_): Change type.
13011         (Plugin::filename_): New.
13012         (Plugin_manager::add_plugin_option): New.
13013         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13014         * testsuite/Makefile.in: Regenerate.
13015
13016 2008-12-05  Cary Coutant  <ccoutant@google.com>
13017
13018         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13019         Handle --strip-lto-sections option.
13020         * options.h (strip_lto_sections): New option.
13021
13022 2008-12-01  Cary Coutant  <ccoutant@google.com>
13023
13024         * plugin.cc (ld_plugin_message): Change format parameter to const.
13025         Fix mismatch between new[] and delete.
13026
13027 2008-11-14  Cary Coutant  <ccoutant@google.com>
13028
13029         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13030         instead of -1U.
13031
13032 2008-11-05  Craig Silverstein  <csilvers@google.com>
13033
13034         * options.cc (General_options::parse_dynamic_list): New function.
13035         * options.h (General_options): New flags dynamic_list,
13036         dynamic_list_data, dynamic_list_cpp_new, and
13037         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13038         (General_options::in_dynamic_list): New function.
13039         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13040         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13041         (Lex::can_continue_name): Likewise.
13042         (yylex): Likewise.
13043         (read_script_file): New parameter script_options.
13044         (read_dynamic_list): New function.
13045         (Script_options::define_dynamic_list): New function.
13046         (dynamic_list_keyword_parsecodes): New variable.
13047         (dynamic_list_keywords): New variable.
13048         * script.h (Script_options::define_dynamic_list): New function
13049         prototype.
13050         (read_dynamic_list): New function prototype.
13051         * symtab.cc (strprefix): New macro.
13052         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13053         dynamic_list_data, dynamic_list_cpp_new, and
13054         dynamic_list_cpp_typeinfo.
13055         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13056         (dynamic_list_expr): New rule.
13057         (dynamic_list_nodes): Likewise.
13058         (dynamic_list_node): Likewise.
13059         * testsuite/Makefile.am (dynamic_list): New test.
13060         * testsuite/Makefile.in: Regenerated.
13061         * testsuite/dynamic_list.t: New file.
13062         * testsuite/dynamic_list.sh: New file.
13063
13064 2008-11-05  Craig Silverstein  <csilvers@google.com>
13065
13066         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13067         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13068         (t11_last): Likewise.
13069         * testsuite/ver_test_6.c (main): Likewise.
13070
13071 2008-10-07  Cary Coutant  <ccoutant@google.com>
13072
13073         * options.c (General_options::finalize): Add check for -static and
13074         -shared.
13075         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13076         is not empty.
13077
13078 2008-10-02  Cary Coutant  <ccoutant@google.com>
13079
13080         * plugin.cc (make_sized_plugin_object): Fix conditional
13081         compilation to work when not all targets are enabled.
13082
13083 2008-09-29  Cary Coutant  <ccoutant@google.com>
13084
13085         * archive.cc (Archive::get_file_and_offset): Use filename instead
13086         of name to get library path.
13087         (Archive::include_member): Unlock external member of a thin archive.
13088
13089         * testsuite/Makefile.am (TEST_AR): New variable.
13090         (thin_archive_test_1): New test.
13091         (thin_archive_test_2): New test.
13092         * testsuite/Makefile.in: Regenerate.
13093         * testsuite/thin_archive_main.cc: New file.
13094         * testsuite/thin_archive_test_1.cc: New file.
13095         * testsuite/thin_archive_test_2.cc: New file.
13096         * testsuite/thin_archive_test_3.cc: New file.
13097         * testsuite/thin_archive_test_4.cc: New file.
13098
13099 2008-09-29  Cary Coutant  <ccoutant@google.com>
13100
13101         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13102         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13103         instead of -1U.
13104         (Sized_relobj::do_finalize_local_symbols): Likewise.
13105         (Sized_relobj::map_to_kept_section): Likewise.
13106         * object.h (Sized_relobj::invalid_address): New constant.
13107         (Sized_relobj::do_output_section_offset): Check for invalid_address
13108         and return -1ULL.
13109         * output.cc (Output_reloc::local_section_offset): Use constant
13110         invalid_address instead of -1U.
13111         (Output_reloc::get_address): Likewise.
13112         (Output_section::output_address): Change -1U to -1ULL.
13113         * output.h (Output_reloc::invalid_address): New constant.
13114         * reloc.cc (Sized_relobj::write_sections): Use constant
13115         invalid_address instead of -1U.
13116         (Sized_relobj::relocate_sections): Likewise.
13117         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13118         values for merge sections.
13119         * target-reloc.h (relocate_for_relocatable): Use constant
13120         invalid_address instead of -1U.
13121
13122 2008-09-19  Cary Coutant  <ccoutant@google.com>
13123
13124         Add plugin functionality for link-time optimization (LTO).
13125         * configure.ac (plugins): Add --enable-plugins option.
13126         * configure: Regenerate.
13127         * config.in: Regenerate.
13128         * Makefile.am (LIBDL): New variable.
13129         (CCFILES): Add plugin.cc.
13130         (HFILES): Add plugin.h.
13131         (ldadd_var): Add LIBDL.
13132         * Makefile.in: Regenerate.
13133
13134         * archive.cc: Include "plugin.h".
13135         (Archive::setup): Don't preread archive symbols when using a plugin.
13136         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13137         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13138         files.
13139         (Archive::include_member): Add symbols from plugin objects.
13140         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13141         * descriptors.cc (Descriptors::open): Check for file descriptors
13142         abandoned by plugins.
13143         (Descriptors::claim_for_plugin): New function.
13144         * descriptors.h (Descriptors::claim_for_plugin): New function.
13145         (Open_descriptor::is_claimed): New field.
13146         (claim_descriptor_for_plugin): New function.
13147         * fileread.cc (File_read::claim_for_plugin): New function.
13148         * fileread.h (File_read::claim_for_plugin): New function.
13149         (File_read::descriptor): New function.
13150         * gold.cc: Include "plugin.h".
13151         (queue_initial_tasks): Add task to call plugin hooks for generating
13152         new object files.
13153         * main.cc: Include "plugin.h".
13154         (main): Load plugin libraries.
13155         * object.h (Pluginobj): Declare.
13156         (Object::pluginobj): New function.
13157         (Object::do_pluginobj): New function.
13158         (Object::set_target): New function.
13159         * options.cc: Include "plugin.h".
13160         (General_options::parse_plugin): New function.
13161         (General_options::General_options): Initialize plugins_ field.
13162         (General_options::add_plugin): New function.
13163         * options.h (Plugin_manager): Declare.
13164         (General_options): Add --plugin option.
13165         (General_options::has_plugins): New function.
13166         (General_options::plugins): New function.
13167         (General_options::add_plugin): New function.
13168         (General_options::plugins_): New field.
13169         * plugin.cc: New file.
13170         * plugin.h: New file.
13171         * readsyms.cc: Include "plugin.h".
13172         (Read_symbols::do_read_symbols): Check for archive before checking
13173         for ELF file.  Call plugin hooks to claim files.
13174         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13175         from a real object file; force override when processing replacement
13176         files.
13177         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13178         (Symbol::init_base_object): Likewise.
13179         (Symbol::init_base_output_data): Likewise.
13180         (Symbol::init_base_output_segment): Likewise.
13181         (Symbol::init_base_constant): Likewise.
13182         (Symbol::init_base_undefined): Likewise.
13183         (Symbol::output_section): Assert that object is not a plugin.
13184         (Symbol_table::add_from_pluginobj): New function.
13185         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13186         undefined.
13187         (Symbol_table::sized_write_globals): Likewise.
13188         (Symbol_table::add_from_pluginobj): Instantiate template.
13189         * symtab.h (Sized_pluginobj): Declare.
13190         (Symbol::in_real_elf): New function.
13191         (Symbol::set_in_real_elf): New function.
13192         (Symbol::in_real_elf_): New field.
13193         (Symbol_table::add_from_pluginobj): New function.
13194
13195         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13196         (LIBDL): New variable.
13197         (LDADD): Add LIBDL.
13198         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13199         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13200         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13201         (MOSTLYCLEANFILES): Likewise.
13202         * testsuite/Makefile.in: Regenerate.
13203         * testsuite/plugin_test.c: New file.
13204         * testsuite/plugin_test_1.sh: New file.
13205         * testsuite/plugin_test_2.sh: New file.
13206
13207 2008-09-16  Ian Lance Taylor  <iant@google.com>
13208
13209         * target-reloc.h (relocate_section): Check whether a symbol is
13210         defined by the ABI before reporting an undefined symbol error.
13211         * target.h (Target::is_defined_by_abi): Make parameter const.
13212         (Target::do_is_defined_by_abi): Likewise.
13213         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13214         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13215         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13216         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13217         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13218         * testsuite/Makefile.in: Rebuild.
13219
13220         * fileread.cc (make_view): Add casts to avoid warning.
13221
13222 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13223
13224         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13225         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13226
13227 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13228
13229         * options.h (General_options::output_is_executable): New.
13230         (General_options::output_is_pie): New.
13231         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13232         for shared libraries.
13233         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13234
13235 2008-09-11  Chris Demetriou  <cgd@google.com>
13236
13237         * options.h (origin): New -z option.
13238         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13239         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13240         in DT_FLAGS_1.
13241
13242 2008-09-05  Cary Coutant  <ccoutant@google.com>
13243
13244         * fileread.cc (File_read::make_view): Add check for attempt to map
13245         beyond end of file.
13246
13247 2008-09-05  Cary Coutant  <ccoutant@google.com>
13248
13249         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13250         explicit instantiations.
13251
13252 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13253
13254         PR gold/6858
13255         * options.cc (General_options::finalize): Allow undefined symbols
13256         in shlibs if linking -shared.
13257
13258         PR gold/6859
13259         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13260         symbols as not needing a dynsym entry.
13261
13262 2008-08-20  Craig Silverstein  <csilvers@google.com>
13263
13264         * fileread.cc (File_read::open): Do not lock the file unless it
13265         was successfully opened.
13266
13267 2008-08-14  Cary Coutant  <ccoutant@google.com>
13268
13269         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13270         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13271         * testsuite/tls_test.cc (struct int128): 128-bit struct
13272         for testing TLS relocs with non-zero addend.
13273         (v12): New TLS variable.
13274         (t12): New test.
13275         (t_last): Add check for v12.
13276         * testsuite/tls_test.h (t12): New function.
13277         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13278
13279 2008-08-13  Ian Lance Taylor  <iant@google.com>
13280
13281         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13282         set tls_segment_ or relro_segment_.
13283         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13284         when appropriate.
13285         * output.h (Output_section::clear_is_relro): New function.
13286         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13287         sections specially even when output_data_ is empty.
13288         (Output_segment::maximum_alignment): When first section is relro,
13289         only force alignment for PT_LOAD segments.
13290         * script.cc (script_data_segment_align): New function.
13291         (script_data_segment_relro_end): New function.
13292         * script-c.h (script_data_segment_align): Declare.
13293         (script_data_segment_relro_end): Declare.
13294         * script-sections.h (class Script_sections): Declare
13295         data_segment_align and data_segment_relro_end.  Add fields
13296         segment_align_index_ and saw_relro_end_.
13297         * script-sections.cc (class Sections_element): Add set_is_relro
13298         virtual function.  Add new bool* parameter to place_orphan_here.
13299         Add get_output_section virtual function.
13300         (class Output_section_definition): Add set_is_relro.  Add new
13301         bool* parameter to place_orphan_here.  Add get_output_section.
13302         Add is_relro_ field.
13303         (Output_section_definition::Output_section_definition): Initialize
13304         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13305         and is_relro_ fields.
13306         (Output_section_definition::place_orphan_here): Add is_relro
13307         parameter.
13308         (Output_section_definition::set_section_addresses): Set relro for
13309         output section.
13310         (Output_section_definition::alternate_constraint): Likewise.
13311         (class Orphan_output_section): Add new bool* parameter to
13312         place_orphan_here.  Add get_output_section.
13313         (Orphan_output_section::place_orphan_here): Add is_relro
13314         parameter.
13315         (Script_sections::Script_sections): Initialize
13316         data_segment_align_index_ and saw_relro_end_.
13317         (Script_sections::data_segment_align): New function.
13318         (Script_sections::data_segment_relro_end): New function.
13319         (Script_sections::place_orphan): Set or clear is_relro.
13320         (Script_sections::set_section_addresses): Force alignment of first
13321         TLS section.
13322         * yyscript.y (exp): Call script_data_segment_align and
13323         script_data_segment_relro_end.
13324         * testsuite/relro_script_test.t: New file.
13325         * testsuite/relro_test.cc (using_script): Declare.
13326         (t1, t2): Test using_script.
13327         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13328         (relro_script_test_SOURCES): Define.
13329         (relro_script_test_DEPENDENCIES): Define.
13330         (relro_script_test_LDFLAGS): Define.
13331         (relro_script_test_LDADD): Define.
13332         (relro_script_test.so): New target.
13333         * testsuite/Makefile.in: Rebuild.
13334
13335 2008-08-06  Cary Coutant <ccoutant@google.com>
13336
13337         * archive.cc (Archive::total_archives, Archive::total_members)
13338         (Archive::total_members_loaded): New variables.
13339         (Archive::setup): Add parameter.  Add option to preread
13340         archive symbols.
13341         (Archive::read_armap): Add counter.
13342         (Archive::get_file_and_offset): New function.
13343         (Archive::get_elf_object_for_member): New function.
13344         (Archive::read_all_symbols): New function.
13345         (Archive::read_symbols): New function.
13346         (Archive::add_symbols): Add counters.
13347         (Archive::include_all_members): Use armap to find members if it's
13348         already built.
13349         (Archive::include_member): Skip reading symbols if already read.
13350         Factored code into Archive::get_file_and_offset and
13351         Archive::get_elf_object_for_member.  Changed call to
13352         Mapfile::report_include_archive_member.
13353         (Archive::print_stats): New function.
13354         * archive.h: Declare Object and Read_symbols_data classes.
13355         (Archive::Archive): Add initializers for new members.
13356         (Archive::setup): Add parameter.
13357         (Archive::print_stats): New function.
13358         (Archive::total_archives, Archive::total_members)
13359         (Archive::total_members_loaded): New variables.
13360         (Archive::get_file_and_offset): New function.
13361         (Archive::get_elf_object_for_member): New function.
13362         (Archive::read_all_symbols): New function.
13363         (Archive::read_symbols): New function.
13364         (Archive::Archive_member): New class.
13365         (Archive::members_): New member.
13366         (Archive::num_members_): New member.
13367         * main.cc: Include archive.h.
13368         (main): Call Archive::print_stats.
13369         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13370         archive parameter; member_name is now the fully-decorated name.
13371         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13372         * options.h: (General_options): Add --preread-archive-symbols option.
13373         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13374         Archive::setup.
13375
13376 2008-08-04  Ian Lance Taylor  <iant@google.com>
13377
13378         * symtab.h (Symbol::use_plt_offset): New function.
13379         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13380         * powerpc.cc (Relocate::relocate): Likewise.
13381         * sparc.cc (Relocate::relocate): Likewise.
13382         * x86_64.cc (Relocate::relocate): Likewise.
13383         * testsuite/weak_plt.sh: New test.
13384         * testsuite/weak_plt_main.cc: New test.
13385         * testsuite/weak_plt_shared.cc: New test.
13386         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13387         (check_PROGRAMS): Add weak_plt.
13388         (check_DATA): Add weak_plt_shared.so.
13389         (weak_plt_main_pic.o, weak_plt): New targets.
13390         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13391         * testsuite/Makefile.in: Rebuild.
13392
13393         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13394         gcctestdir/ld.
13395         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13396         * testsuite/Makefile.in: Rebuild.
13397
13398 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13399
13400         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13401         * Makefile.in: Regenerate.
13402         * po/POTFILES.in: Regenerate.
13403
13404 2008-07-29  Ian Lance Taylor  <iant@google.com>
13405
13406         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13407         symbols before other symbols.
13408         * testsuite/script_test_2.cc (test_addr): Declare.
13409         (test_addr_alias): Declare.
13410         (main): Check that test_addr and test_addr_alias have the right
13411         values.
13412         * testsuite/script_test_2.t: Define test_addr_alias and
13413         test_addr.
13414
13415 2008-07-24  Ian Lance Taylor  <iant@google.com>
13416
13417         PR 5990
13418         * descriptors.cc: New file.
13419         * descriptors.h: New file.
13420         * gold-threads.h (class Hold_optional_lock): New class.
13421         * fileread.cc: Include "descriptors.h".
13422         (File_read::~File_read): Release descriptor rather than closing
13423         it.
13424         (File_read::open) [file]: Call open_descriptor rather than open.
13425         Set is_descriptor_opened_.
13426         (File_read::open) [memory]: Assert that descriptor is not open.
13427         (File_read::reopen_descriptor): New function.
13428         (File_read::release): Release descriptor.
13429         (File_read::do_read): Make non-const.  Reopen descriptor.
13430         (File_read::read): Make non-const.
13431         (File_read::make_view): Reopen descriptor.
13432         (File_read::do_readv): Likewise.
13433         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13434         Update declarations.
13435         * layout.cc: Include "descriptors.h".
13436         (Layout::create_build_id): Use open_descriptor rather than open.
13437         * output.cc: Include "descriptors.h".
13438         (Output_file::open): Use open_descriptor rather than open.
13439         * archive.cc (Archive::const_iterator): Change Archive to be
13440         non-const.
13441         (Archive::begin, Archive::end): Make non-const.
13442         (Archive::count_members): Likewise.
13443         * archive.h (class Archive): Update declarations.
13444         * object.h (Object::read): Make non-const.
13445         * Makefile.am (CCFILES): Add descriptors.cc.
13446         (HFILES): Add descriptors.h.
13447         * Makefile.in: Rebuild.
13448
13449         PR 6716
13450         * gold.h: Always include <clocale>.  Add Solaris workarounds
13451         following code in binutils/sysdep.h.
13452
13453         PR 6048
13454         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13455         this->eh_frame_hdr_ is NULL before using it.
13456
13457         * dynobj.cc (Versions::Versions): Update comment.
13458
13459         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13460         the base version name.
13461
13462         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13463         array size plus one.
13464         (Stringpool_template::set_string_offsets): Subtract one from key
13465         before using it as an array index.
13466         (Stringpool_template::get_offset_with_length): Likewise.
13467         (Stringpool_template::write_to_buffer): Likewise.
13468         * stringpool.h (Stringpool_template::get_offset_from_key):
13469         Likewise.
13470
13471 2008-07-23  Ian Lance Taylor  <iant@google.com>
13472
13473         PR 6658
13474         * object.h (Merged_symbol_value::value): Do our best to handle a
13475         negative addend.
13476
13477         PR 6647
13478         * script.cc (Version_script_info::get_versions): Don't add empty
13479         version tag to return value.
13480         (Version_script_info::get_symbol_version_helper): Change return
13481         type to bool.  Add pversion parameter.  Change all callers.
13482         (script_register_vers_node): Don't require a non-NULL tag.
13483         * script.h (class Version_script_info): Update declarations.
13484         (Version_script_info::get_symbol_version): Change return type to
13485         bool.  Add version parameter.  Change all callers.
13486         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13487         handling.  Handle an empty version from a version script.
13488         (Symbol_table::define_special_symbol): Likewise.
13489         * testsuite/ver_test_10.script: New file.
13490         * testsuite/ver_test_10.sh: New file.
13491         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13492         (check_DATA): Add ver_test_10.syms.
13493         (ver_test_10.syms, ver_test_10.so): New target.
13494         * testsuite/Makefile.in: Rebuild.
13495
13496 2008-07-23  Simon Baldwin  <simonb@google.com>
13497
13498         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13499         to zero for undefined symbols from dynamic libraries.
13500
13501 2008-07-23  Ian Lance Taylor  <iant@google.com>
13502
13503         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13504         Change all callers.
13505         * symtab.h (class Symbol_table): Update declaration.
13506         * testsuite/ver_test_9.cc: New file.
13507         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13508         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13509         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13510         (ver_test_9.so, ver_test_9.o): New targets.
13511         * testsuite/Makefile.in: Rebuild.
13512
13513 2008-07-22  Ian Lance Taylor  <iant@google.com>
13514
13515         * options.h (class General_options): Define --check-sections.
13516         * layout.cc (Layout::set_segment_offsets): Handle
13517         --check-sections.
13518
13519         * options.h (class General_options): Define -n/--nmagic and
13520         -N/--omagic.
13521         * options.cc (General_options::finalize): For -n/--nmagic or
13522         -N/--omagic, set -static.
13523         * layout.cc (Layout::attach_allocated_section_to_segment): If
13524         -N/--omagic, don't put read-only and read-write sections in
13525         different segments.
13526         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13527         finding a read-only segment.
13528         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13529         don't set the minimum segment alignment to the common page size,
13530         and don't set the file offset to the address modulo the page size.
13531         * script-sections.cc (Script_sections::create_segments): If
13532         -n/--omagic, don't put read-only and read-write sections in
13533         different segments.
13534
13535         * cref.cc: New file.
13536         * cref.h: New file.
13537         * options.h (class General_options): Add --print-symbol-counts.
13538         * main.cc (main): Issue defined symbol report if requested.
13539         * archive.cc (Archive::interpret_header): Make into a const member
13540         function.
13541         (Archive::add_symbols): Call Input_objects::archive_start and
13542         archive_stop.
13543         (Archive::const_iterator): Define new class.
13544         (Archive::begin, Archive::end): New functions.
13545         (Archive::include_all_members): Rewrite to use iterator.
13546         (Archive::count_members): New function.
13547         * archive.h (class Archive): Update declarations.
13548         (Archive::filename): New function.
13549         * object.cc: Include "cref.h".
13550         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13551         (Sized_relobj::do_get_global_symbol_counts): New function.
13552         (Input_objects::add_object): Add object to cross-referencer.
13553         (Input_objects::archive_start): New function.
13554         (Input_objects::archive_stop): New function.
13555         (Input_objects::print_symbol_counts): New function.
13556         * object.h: Declare Cref and Archive.
13557         (Object::get_global_symbol_counts): New function.
13558         (Object::do_get_global_symbol_counts): New pure virtual function.
13559         (class Sized_relobj): Add defined_count_ field.  Update
13560         declarations.
13561         (class Input_objects): Add cref_ field.  Update constructor.
13562         Update declarations.
13563         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13564         defined_count_.
13565         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13566         symbol counts.
13567         (Sized_dynobj::do_get_global_symbol_counts): New function.
13568         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13569         defined_count_.  Update declarations.  Define Symbols typedef.
13570         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13571         parameter.  Change all callers.
13572         (Symbol_table::add_from_dynobj): Add sympointers and defined
13573         parameters.  Change all callers.
13574         * symtab.h (class Symbol_table): Update declarations.
13575         * Makefile.am (CCFILES): Add cref.cc.
13576         (HFILES): Add cref.h.
13577         * Makefile.in: Rebuild.
13578
13579 2008-07-22  Simon Baldwin  <simonb@google.com>
13580
13581         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13582         to zero when writing undefined symbols.
13583
13584 2008-07-22  Ian Lance Taylor  <iant@google.com>
13585
13586         * output.cc (Output_section::add_input_section): Don't try to
13587         merge empty merge sections.
13588
13589 2008-07-21  Craig Silverstein  <csilvers@google.com>
13590
13591         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13592         Include symbol version in error message.
13593
13594 2008-07-20  Chris Demetriou  <cgd@google.com>
13595
13596         * configure.ac (gold_cv_c_random_seed): New configured variable.
13597         (RANDOM_SEED_CFLAGS): New substituted variable.
13598         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13599         * configure: Rebuild.
13600         * Makefile.in: Likewise.
13601         * testsuite/Makefile.in: Likewise.
13602
13603 2008-07-18  Ian Lance Taylor  <iant@google.com>
13604
13605         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13606         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13607         * testsuite/ver_test_main.cc (main): Call t4.
13608         (t4, t4_2a): Define.
13609         * testsuite/ver_test_2.cc (t4_2): Define.
13610         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13611         * testsuite/ver_test_4.cc (t4_2a): Define.
13612         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13613         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13614
13615 2008-07-17  Ian Lance Taylor  <iant@google.com>
13616
13617         * dynobj.cc (Versions::add_def): If we give an error about a
13618         missing version, go ahead and create the version anyhow.
13619
13620 2008-07-10  Ian Lance Taylor  <iant@google.com>
13621
13622         Handle output sections with more than 0x7fffffff bytes.
13623         * object.h (class Relobj): Change map_to_output_ to
13624         output_sections_, and just keep a section pointer.  Change all
13625         uses.  Move comdat group support to Sized_relobj.
13626         (Relobj::is_section_specially_mapped): Remove.
13627         (Relobj::output_section): Remove poff parameter.  Change all
13628         callers.
13629         (Relobj::output_section_offset): New function.
13630         (Relobj::set_section_offset): Rewrite.
13631         (Relobj::map_to_output): Remove.
13632         (Relobj::output_sections): New function.
13633         (Relobj::do_output_section_offset): New pure virtual function.
13634         (Relobj::do_set_section_offset): Likewise.
13635         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13636         group support from Relobj.  Update declarations.
13637         (Sized_relobj::get_output_section_offset): New function.
13638         (Sized_relobj::do_output_section_offset): New function.
13639         (Sized_relobj::do_set_section_offset): New function.
13640         * object.cc (Relobj::output_section_address): Remove.
13641         (Sized_relobj::Sized_relobj): Initialize new fields.
13642         (Sized_relobj::include_section_group): Cast find_kept_object to
13643         Sized_relobj.
13644         (Sized_relobj::include_linkonce_section): Likewise.
13645         (Sized_relobj::do_layout): Use separate arrays for output section
13646         and output offset.
13647         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13648         output_sections.
13649         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13650         output_sections and section_offsets.
13651         (Sized_relobj::write_local_symbols): Likewise.
13652         (map_to_kept_section): Compute output address directly.
13653         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13654         output_sections and section_offsets.
13655         (Sized_relobj::write_sections): Likewise.
13656         (Sized_relobj::relocate_sections): Likewise.
13657         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13658         * output.h (class Output_reloc): Update declarations.  Change
13659         u2_.relobj to Sized_relobj*.
13660         (class Output_data_reloc): Change add functions to use
13661         Sized_relobj*.
13662         * output.cc (Output_reloc::Output_reloc): Change relobj to
13663         Sized_relobj*.
13664         (Output_reloc::local_section_offset): Change return type to
13665         Elf_Addr.  Use get_output_section_offset.
13666         (Output_reloc::get_address): Likewise.
13667         (Output_section::is_input_address_mapped): Don't call
13668         is_section_specially_mapped.
13669         (Output_section::output_offset): Likewise.
13670         (Output_section::output_address): Likewise.
13671         (Output_section::starting_output_address): Likewise.
13672         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13673         parameter to Sized_relobj*.
13674         (Copy_relocs::need_copy_reloc): Likewise.
13675         (Copy_relocs::save): Likewise.
13676         * copy-relocs.h (class Copy_relocs): Update declarations.
13677         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13678         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13679         * target-reloc.h (relocate_for_relocatable): Change
13680         offset_in_output_section type to Elf_Addr.  Change code that uses
13681         it as well.
13682         * layout.cc (Layout::layout): Always set *off.
13683         * mapfile.cc (Mapfile::print_input_section): Use
13684         output_section_offset.
13685         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13686         Sized_relobj*.
13687         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13688         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13689         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13690
13691 2008-07-03  Ian Lance Taylor  <iant@google.com>
13692
13693         * layout.cc (Layout::include_section): Do not discard unrecognized
13694         SHT_STRTAB sections.
13695
13696 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13697
13698         * script.cc (Lex::can_continue_name): Make '?' allowable in
13699         version-script names.
13700         * testsuite/version_script.map: Change glob pattern to use '?'
13701
13702 2008-06-30  Manish Singh  <yosh@gimp.org>
13703
13704         PR 6585
13705         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13706         Correct typo.
13707
13708 2008-06-30  Ian Lance Taylor  <iant@google.com>
13709
13710         PR 6660
13711         PR 6682
13712         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13713         versions]: Don't try to read the value in the contents, since we
13714         don't use it.  Use the template endianness when writing.
13715
13716 2008-06-25  Cary Coutant  <ccoutant@google.com>
13717
13718         * fileread.cc (File_read::make_view): Assert on zero-length view.
13719         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13720         symbol table when there are no symbols to read.
13721
13722 2008-06-23  Craig Silverstein  <csilvers@google.com>
13723
13724         * version.cc (version_string): Bump to 1.7
13725
13726 2008-06-18  Craig Silverstein  <csilvers@google.com>
13727
13728         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13729         constant 0xFFFF to type Valtype.
13730         (Powerpc_relocate_functions::rel16_ha): Likewise.
13731
13732 2008-06-17  Ian Lance Taylor  <iant@google.com>
13733
13734         * output.h (Output_section::Input_section): Initialize p2align_ to
13735         zero for Output_section_data constructors.
13736         (Output_section::Input_section::addralign): If not an input
13737         section, return the alignment of the Output_section_data.
13738         * testsuite/copy_test.cc: New file.
13739         * testsuite/copy_test_1.cc: New file.
13740         * testsuite/copy_test_2.cc: New file.
13741         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13742         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13743         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13744         (copy_test_1_pic.o, copy_test_1.so): New targets.
13745         (copy_test_2_pic.o, copy_test_2.so): New targets.
13746         * testsuite/Makefile.in: Rebuild.
13747
13748         * script-sections.cc (Script_sections::place_orphan): Initialize
13749         local variable exact.
13750
13751 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13752
13753         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13754
13755 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13756             David S. Miller  <davem@davemloft.net>
13757
13758         * powerpc.cc: New file.
13759         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13760         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13761         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13762         * Makefile.in: Rebuild.
13763
13764 2008-06-09  Ian Lance Taylor  <iant@google.com>
13765
13766         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13767         <exception>.
13768         (throwing, orig_terminate): New static variables.
13769         (terminate_handler): New static function.
13770         (t2): Set terminate handler.
13771
13772 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13773
13774         PR 6584
13775         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13776         alignment.
13777
13778 2008-05-30  Cary Coutant  <ccoutant@google.com>
13779
13780         * archive.cc (Archive::include_all_members) Correct to step
13781         over symbol table and extended name table in thin archives.
13782
13783 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13784
13785         PR 6407
13786         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13787         calculation.
13788
13789 2008-05-28  Caleb Howe  <cshowe@google.com>
13790
13791         * reduced_debug_output.cc: New file.
13792         * reduced_debug_output.h: New file.
13793         * options.h (class General_options): Add --strip-debug-non-line.
13794         * options.cc (General_options::finalize): Add strip_debug_non_line
13795         to the strip heirarchy.
13796         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13797         fields.
13798         * layout.cc: Include "reduced_debug_output.h".
13799         (Layout::Layout): Initialize new fields.
13800         (line_only_debug_sections): New static array.
13801         (is_lines_only_debug_sections): New static inline function.
13802         (Layout::include_section): Handle --strip-debug-non-line.
13803         (Layout::make_output_section): If --strip-debug-non-line, build
13804         new output sections for .debug_abbrev and .debug_info.
13805         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13806         gold.  Warn about possible overflow.
13807         (read_signed_LEB_128): Likewise.
13808         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13809         (read_signed_LEB_128): Declare.
13810         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13811         (HFILES): Add reduced_debug_output.h.
13812         * Makefile.in: Rebuild.
13813
13814 2008-05-21  Ian Lance Taylor  <iant@google.com>
13815
13816         * mapfile.cc: New file.
13817         * mapfile.h: New file.
13818         * options.h (class General_options): Add -M/--print-map and -Map.
13819         * options.cc (General_options::finalize): Make -M equivalent to
13820         -Map -.
13821         * main.cc: Include <cstdio> and "mapfile.h".
13822         (main): Open mapfile if requested.
13823         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13824         constructor.  Change caller.
13825         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13826         (queue_middle_tasks): Likewise.
13827         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13828         declarations.
13829         * archive.cc: Include "mapfile.h".
13830         (Archive::add_symbols): Add mapfile parameter.  Change all
13831         callers.  Pass mapfile, symbol, and reason to include_member.
13832         (Archive::include_all_members): Add mapfile parameter.  Change all
13833         callers.
13834         (Archive::include_member): Add mapfile, sym, and why parameters.
13835         Change all callers.  Report inclusion to map file.
13836         * archive.h: Include "fileread.h".
13837         (class Archive): Update declarations.
13838         (Archive::file): New const method.
13839         (class Add_archive_symbols): Add mapfile_ field.  Update
13840         constructor.  Change all callers.
13841         * readsyms.h (class Read_symbols): Likewise.
13842         (class Finish_group): Likewise.
13843         (class Read_script): Likewise.
13844         * common.cc: Include "mapfile.h".
13845         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13846         all callers.
13847         (Symbol_table::do_allocate_commons): Likewise.
13848         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13849         symbol allocation to mapfile.
13850         * common.h (class Allocate_commons_task): Add mapfile_ field.
13851         Update constructor.  Change all callers.
13852         * symtab.h (class Symbol_table): Update declarations.
13853         * layout.cc: Include "mapfile.h".
13854         (Layout_task_runner::run): Print information to mapfile.
13855         (Layout::create_gold_note): Change Output_data_fixed_space to
13856         Output_data_zero_fill.
13857         (Layout::create_build_id): Likewise.
13858         (Layout::print_to_mapfile): New function.
13859         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13860         constructor.  Change caller.
13861         (class Layout): Declare print_to_mapfile.
13862         * output.cc (Output_section::Input_section::print_to_mapfile): New
13863         function.
13864         (Output_section::add_input_section): If producing a map, always
13865         add to input_sections_ list.
13866         (Output_section::do_print_to_mapfile): New function.
13867         (Output_segment::print_sections_to_mapfile): New function.
13868         (Output_segment::print_section_list_to_mapfile): New function.
13869         * output.h: Include "mapfile.h".
13870         (Output_data::print_to_mapfile): New function.
13871         (Output_data::do_print_to_mapfile): New virtual function.
13872         (Output_segment_headers::do_print_to_mapfile): New function.
13873         (Output_file_header::do_print_to_mapfile): New function.
13874         (Output_data_const::do_print_to_mapfile): New function.
13875         (class Output_data_const_buffer): Add map_name_ field.  Update
13876         constructor.  Change all callers.  Add do_print_to_mapfile
13877         function.
13878         (class Output_data_fixed_space): Likewise.
13879         (class Output_data_space): Likewise.
13880         (class Output_data_zero_fill): New class.
13881         (Output_data_strtab::do_print_to_mapfile): New function.
13882         (Output_data_reloc_base::do_print_to_mapfile): New function.
13883         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13884         (Output_data_group::do_print_to_mapfile): New function.
13885         (Output_data_got::do_print_to_mapfile): New function.
13886         (Output_data_dynamic::do_print_to_mapfile): New function.
13887         (Output_symtab_xindex::do_print_to_mapfile): New function.
13888         (class Output_section): Declare do_print_to_mapflie.  Declare
13889         print_to_mapfile in Input_section.
13890         (class Output_segment): Declare new functions.
13891         * object.h (Sized_relobj::symbol_count): New function.
13892         * script-sections.cc
13893         (Output_section_element_dot_assignment::set_section_addresses):
13894         Change Output_data_fixed_space to Output_data_zero_fill.
13895         (Output_data_expression::do_print_to_mapfile): New function.
13896         * script.cc (read_input_script): Add mapfile parameter.  Change
13897         all callers.
13898         * script.h (read_input_script): Update declaration.
13899         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13900         (Eh_frame::do_print_to_mapfile): New function.
13901         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
13902         (Output_merge_string::do_print_to_mapfile): New function.
13903         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
13904         function.
13905         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
13906         function.
13907         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
13908         function.
13909         * Makefile.am (CCFILES): Add mapfile.cc.
13910         (HFILES): Add mapfile.h.
13911         * Makefile.in: Rebuild.
13912
13913 2008-05-19  Ian Lance Taylor  <iant@google.com>
13914
13915         * options.h (class General_options): Add -z relro.
13916         * layout.cc (Layout::Layout): Initialize relro_segment_.
13917         (Layout::add_output_section_data): Return the output section.
13918         (Layout::make_output_section): Rcognize relro sections and mark
13919         them appropriately.
13920         (Layout::attach_allocated_section_to_segment): Put relro sections
13921         in a PT_GNU_RELRO segment.
13922         (Layout::create_initial_dynamic_sections): Mark the .dynamic
13923         section as relro.
13924         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
13925         PT_TLS segments.
13926         (Layout::linkonce_mapping): Map d.rel.ro.local to
13927         .data.rel.ro.local.
13928         (Layout::output_section_name): Us .data.rel.ro.local for any
13929         section which begins with that.
13930         * layout.h (class Layout): Update add_output_section_data
13931         declaration.  Add relro_segment_ field.
13932         * output.cc (Output_section::Output_section): Initialize is_relro_
13933         and is_relro_local_ fields.
13934         (Output_segment::add_output_section): Group relro sections.
13935         (Output_segment::is_first_section_relro): New function.
13936         (Output_segment::maximum_alignment): If there is a relro section,
13937         align the segment to the common page size.
13938         (Output_segment::set_section_addresses): Track whether we are
13939         looking at relro sections.  If the last section is a relro
13940         section, align to the common page size.
13941         (Output_segment::set_section_list_addresses): Add in_relro
13942         parameter.  Change all callers.  Align to the page size when
13943         moving from relro to non-relro section.
13944         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
13945         segment.
13946         * output.h (class Output_section): Add is_relro_ and
13947         is_relro_local_ fields.
13948         (Output_section::is_relro): New function.
13949         (Output_section::set_is_relro): New function.
13950         (Output_section::is_relro_local): New function.
13951         (Output_section::set_is_relro_local): New function.
13952         (class Output_segment): Update declarations.
13953         * i386.cc (Target_i386::got_section): Mark .got section as relro.
13954         * sparc.cc (Target_sparc::got_section): Likewise.
13955         * x86_64.cc (Target_x86_64::got_section): Likewise.
13956         * testsuite/relro_test_main.cc: New file.
13957         * testsuite/relro_test.cc: New file.
13958         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
13959         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
13960         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
13961         (relro_test.so, relro_test_pic.o): New targets.
13962         * testsuite/Makefile.in: Rebuild.
13963
13964 2008-05-16  Ian Lance Taylor  <iant@google.com>
13965
13966         * output.cc (Output_segment::add_output_section): Remove front
13967         parameter.
13968         * output.h (class Output_segment): Remove
13969         add_initial_output_section and overloaded add_output_section.
13970         Update declaration of remaining add_output_section.
13971         * layout.cc (Layout::create_interp): Call add_output_section
13972         rather than add_initial_output_section.
13973         (Layout::finish_dynamic_section): Likewise.
13974
13975         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
13976         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
13977         know the dynamic type.
13978         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
13979         field.  Initialize it in constructor.
13980         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
13981         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
13982         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
13983         reloc.
13984
13985         * output.cc (Output_reloc::get_address): Change return type to
13986         Elf_Addr.
13987         * output.h (class Output_reloc): Update get_address declaration.
13988         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
13989         for section addresses.
13990
13991 2008-05-09  Ian Lance Taylor  <iant@google.com>
13992
13993         PR 6493
13994         * gold.cc (gold_nomem): Use return value of write.
13995
13996 2008-05-08  Ian Lance Taylor  <iant@google.com>
13997
13998         * symtab.c (Symbol::init_base_output_data): Add version
13999         parameter.  Change all callers.
14000         (Symbol::init_base_output_segment): Likewise.
14001         (Symbol::init_base_constant): Likewise.
14002         (Symbol::init_base_undefined): Likewise.
14003         (Sized_symbol::init_output_data): Likewise.
14004         (Sized_symbol::init_output_segment): Likewise.
14005         (Sized_symbol::init_constant): Likewise.
14006         (Sized_symbol::init_undefined): Likewise.
14007         (Symbol_table::do_define_in_output_data): If the new symbol has a
14008         version, mark it as the default.
14009         (Symbol_table::do_define_in_output_segment): Likewise.
14010         (Symbol_table::do_define_as_constant): Likewise.
14011         * symtab.h (class Symbol): Update declarations.
14012         (class Sized_symbol): Likewise.
14013         * resolve.cc (Symbol::override_version): New function.
14014         (Symbol::override_base): Call override_version.
14015         (Symbol::override_base_with_special): Likewise.
14016         * testsuite/ver_script_8.script: New file.
14017         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14018         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14019         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14020         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14021
14022 2008-05-06  Ian Lance Taylor  <iant@google.com>
14023
14024         PR 6049
14025         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14026         functions.
14027         (class General_options): Remove existing --undefined, and add
14028         --no-undefined instead.  Add new --undefined as synonym for -u.
14029         * archive.cc (Archive::add_symbols): Check whether symbol was
14030         named with -u.
14031         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14032         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14033         all uses.  Add IS_UNDEFINED.  Update declarations to split
14034         different versions of init_base.  Declare init_base_undefined.
14035         (Symbol::is_defined): Handle IS_UNDEFINED.
14036         (Symbol::is_undefined): Likewise.
14037         (Symbol::is_weak_undefined): Call is_undefined.
14038         (Symbol::is_absolute): Handle IS_CONSTANT.
14039         (class Sized_symbol): Update declarations to split different
14040         versions of init.  Declare init_undefined.
14041         (class Symbol_table): Declare new functions.
14042         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14043         Change all callers.
14044         (Symbol::init_base_output_data): Likewise.
14045         (Symbol::init_base_output_segment): Likewise.
14046         (Symbol::init_base_constant): Likewise.
14047         (Symbol::init_base_undefined): New function.
14048         (Sized_symbol::init_object): Rename from init.  Change all
14049         callers.
14050         (Sized_symbol::init_output_data): Likewise.
14051         (Sized_symbol::init_output_segment): Likewise.
14052         (Sized_symbol::init_constant): Likewise.
14053         (Sized_symbol::init_undefined): New function.
14054         (Symbol_table::add_undefined_symbols_from_command_line): New
14055         function.
14056         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14057         function.
14058         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14059         (Symbol::output_section): Likewise.
14060         (Symbol::set_output_section): Likewise.
14061         (Symbol_table::sized_finalize_symbol): Likewise.
14062         (Symbol_table::sized_write_globals): Likewise.
14063         * resolve.cc (Symbol_table::should_override): Likewise.
14064         (Symbol::override_base_with_special): Likewise.
14065
14066         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14067         symbol, change it to have default visibility.
14068         * testsuite/protected_1.cc: New file.
14069         * testsuite/protected_2.cc: New file.
14070         * testsuite/protected_3.cc: New file.
14071         * testsuite/protected_main_1.cc: New file.
14072         * testsuite/protected_main_2.cc: New file.
14073         * testsuite/protected_main_3.cc: New file.
14074         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14075         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14076         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14077         (protected_1.so): New target.
14078         (protected_1_pic.o, protected_2_pic.o): New targets.
14079         (protected_3_pic.o): New target.
14080         (check_PROGRAMS): Add protected_2.
14081         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14082         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14083         * testsuite/Makefile.in: Rebuild.
14084
14085         * options.h (DEFINE_var): Add set_user_set_##varname__.
14086         (DEFINE_bool_alias): New macro.
14087         (class General_options): Define -Bstatic using DEFINE_bool_alias
14088         rather than DEFINE_special.  Add --undefined as an alias for -z
14089         defs.
14090         * options.cc (General_options::parse_Bstatic): Remove.
14091
14092         * options.h (class General_options): Add --fatal-warnings.
14093         * main.cc (main): Implement --fatal-warnings.
14094         * errors.h (Errors::warning_count): New function.
14095
14096         * options.h (class General_options): Add -Bsymbolic-functions.
14097         * symtab.h (Symbol::is_preemptible): Check for
14098         -Bsymbolic-functions.
14099
14100 2008-05-05  Ian Lance Taylor  <iant@google.com>
14101
14102         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14103         as noVARNAME rather than no-VARNAME.
14104         (class General_options): Add option -z combreloc.
14105         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14106         get_address.
14107         (Output_reloc::sort_before) [SHT_REL]: New function.
14108         (Output_reloc::sort_before) [SHT_RELA]: New function.
14109         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14110         Sort_relocs_comparison.
14111         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14112         parameter.  Change all callers.
14113         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14114         sort_relocs parameter.  Change all callers.
14115         * output.cc (Output_reloc::get_address): New function, broken out
14116         of write_rel.
14117         (Output_reloc::write_rel): Call it.
14118         (Output_reloc::compare): New function.
14119         (Output_data_reloc_base::do_write): Optionally sort relocs.
14120
14121         * configure.ac: If targ_extra_obj is set, link it in.
14122         * configure.tgt: Initialize all variables.
14123         (x86_64*): Set targ_extra_obj and targ_extra_size.
14124         * configure: Rebuild.
14125
14126         * object.cc (Sized_relobj::include_section_group): Adjust section
14127         indexes read from group data.  Build vector to pass to
14128         layout_group.
14129         * layout.cc (Layout::layout_group): Add flags and shndxes
14130         parameters.  Remove contents parameter.  Change caller.  Update
14131         explicit instantiations.
14132         * layout.h (class Layout): Update layout_group declaration.
14133         * output.cc (Output_data_group::Output_data_group): Add flags and
14134         input_shndxes parameters.  Remove contents parameter.  Change
14135         caller.
14136         (Output_data_group::do_write): Change input_sections_ to
14137         input_shndxes_.
14138         * output.h (class Output_data_group): Update constructor
14139         declaration.  Rename input_sections_ to input_shndxes_.
14140         * testsuite/many_sections_test.cc: Add template.
14141
14142 2008-04-30  Cary Coutant  <ccoutant@google.com>
14143
14144         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14145
14146         * layout.cc (Layout::include_section): Refactored check for debug
14147         info section.
14148         (Layout::add_comdat): Add new parameters.  Change type
14149         of signature parameter.  Add object and shndx to signatures table.
14150         (Layout::find_kept_object): New function.
14151         * layout.h: Include <cstring>.
14152         (Layout::is_debug_info_section): New function.
14153         (Layout::add_comdat): Add new parameters.
14154         (Layout::find_kept_object): New function.
14155         (Layout::Kept_section): New struct.
14156         (Layout::Signatures): Change type of map range.
14157         * object.cc (Relobj::output_section_address): New function.
14158         (Sized_relobj::include_section_group): Add new parameters.  Change
14159         calls to Layout::add_comdat.  Change to build table of kept comdat
14160         groups and table mapping discarded sections to kept sections.
14161         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14162         (Sized_relobj::do_layout): Change calls to include_section_group and
14163         include_linkonce_section.
14164         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14165         value to zero when section is discarded.
14166         (Sized_relobj::map_to_kept_section): New function.
14167         * object.h (Relobj::output_section_address): New function.
14168         (Relobj::Comdat_group): New type.
14169         (Relobj::find_comdat_group): New function.
14170         (Relobj::Comdat_group_table): New type.
14171         (Relobj::Kept_comdat_section): New type.
14172         (Relobj::Kept_comdat_section_table): New type.
14173         (Relobj::add_comdat_group): New function.
14174         (Relobj::set_kept_comdat_section): New function.
14175         (Relobj::get_kept_comdat_section): New function.
14176         (Relobj::comdat_groups_): New field.
14177         (Relobj::kept_comdat_sections_): New field.
14178         (Symbol_value::input_value): Update comment.
14179         (Sized_relobj::map_to_kept_section) New function.
14180         (Sized_relobj::include_linkonce_section): Add new parameter.
14181         * target-reloc.h (Comdat_behavior): New type.
14182         (get_comdat_behavior): New function.
14183         (relocate_section): Add code to map a discarded section to the
14184         corresponding kept section when applying a relocation.
14185
14186 2008-04-30  Craig Silverstein  <csilvers@google.com>
14187
14188         * dwarf_reader.cc (next_generation_count): New static var.
14189         (Addr2line_cache_entry): New struct.
14190         (addr2line_cache): New static var.
14191         (Dwarf_line_info::one_addr2line): Added caching.
14192         (Dwarf_line_info::clear_addr2line_cache): New function.
14193         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14194         cache-size parameter.
14195         (Dwarf_line_info::one_addr2line_cache): New function.
14196         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14197         new cache-size argument to one_addr2line(), and clear cache.
14198
14199 2008-04-28  Cary Coutant  <ccoutant@google.com>
14200
14201         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14202         R_386_PC8 relocations.
14203
14204 2008-04-23  Ian Lance Taylor  <iant@google.com>
14205
14206         * object.cc (Sized_relobj::include_section_group): Check for
14207         invalid section group.
14208
14209         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14210         header size.
14211
14212         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14213         than read for file header.
14214         * archive.cc (Archive::include_member): Likewise.
14215
14216 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14217
14218         * aclocal.m4: Regenerate.
14219         * configure: Regenerate.
14220
14221 2008-04-19  Ian Lance Taylor  <iant@google.com>
14222
14223         * version.cc (version_string): Bump to 1.6.
14224
14225         * testsuite/Makefile.am (many_sections_r_test): New target.
14226         (many_sections_r_test_SOURCES): Remove.
14227         (many_sections_r_test_DEPENDENCIES): Remove.
14228         (many_sections_r_test_LDFLAGS): Remove.
14229         (many_sections_r_test_LDADD): Remove.
14230
14231         * object.cc (Sized_relobj::do_add_symbols): Always pass
14232         local_symbol_count_ to add_from_relobj.
14233
14234         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14235         every thousand variables.
14236         * testsuite/Makefile.in: Rebuild.
14237
14238         * object.cc (Xindex::initialize_symtab_xindex): New function.
14239         (Xindex::read_symtab_xindex): New function.
14240         (Xindex::sym_xindex_to_shndx): New function.
14241         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14242         available.
14243         (Sized_relobj::do_initialize_xindex): New function.
14244         (Sized_relobj::do_read_symbols): Adjust section links.
14245         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14246         parameter.  Change all callers.
14247         (Sized_relobj::include_section_group): Adjust section links and
14248         symbol section indexes.
14249         (Sized_relobj::do_layout): Adjust section links.
14250         (Sized_relobj::do_count_local_symbols): Adjust section links and
14251         symbol section indexes.
14252         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14253         ordinary and special symbols.
14254         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14255         dynsym_xindex parameters.  Change all callers.  Adjust section
14256         links.  Use SHN_XINDEX when needed.
14257         (Sized_relobj::get_symbol_location_info): Adjust section links.
14258         Don't get fooled by special symbols.
14259         * object.h (class Xindex): Define.
14260         (class Object): Add xindex_ parameter.  Declare virtual functoin
14261         do_initialize_xindex.
14262         (Object::adjust_sym_shndx): New function.
14263         (Object::set_xindex): New protected function.
14264         (class Symbol_value): Add is_ordinary_shndx_ field.
14265         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14266         (Symbol_value::value): Assert ordinary section.
14267         (Symbol_value::initialize_input_to_output_map): Likewise.
14268         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14269         Change all callers.
14270         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14271         all callers.
14272         (class Sized_relobj): Update declarations.
14273         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14274         parameter.  Change all callers.
14275         (Sized_relobj::adjust_shndx): New function.
14276         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14277         field.
14278         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14279         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14280         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14281         (Sized_dynobj::read_dynsym_section): Adjust section links.
14282         (Sized_dynobj::read_dynamic): Likewise.
14283         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14284         section links.
14285         (Sized_dynobj::do_initialize_xindex): New function.
14286         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14287         do_initialize_xindex.
14288         (Sized_dynobj::adjust_shndx): New function.
14289         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14290         dynsym_xindex_ fields.
14291         (Layout::finalize): Add a call to set_section_indexes before
14292         creating the symtab sections.
14293         (Layout::set_section_indexes): Don't do anything if the section
14294         already has a section index.
14295         (Layout::create_symtab_sections): Add shnum parameter.  Change
14296         caller.  Create .symtab_shndx section if needed.
14297         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14298         caller.
14299         (Layout::allocated_output_section_count): New function.
14300         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14301         needed.
14302         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14303         fields.  Update declarations.
14304         (Layout::symtab_xindex): New function.
14305         (Layout::dynsym_xindex): New function.
14306         (class Write_symbols_task): Add layout_ field.
14307         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14308         Change caller.
14309         * output.cc (Output_section_headers::Output_section_headers): Add
14310         shstrtab_section parameter.  Change all callers.
14311         (Output_section_headers::do_sized_write): Store overflow values
14312         for section count and section string table section index in
14313         section header zero.
14314         (Output_file_header::do_sized_write): Check for overflow of
14315         section count and section string table section index.
14316         (Output_symtab_xindex::do_write): New function.
14317         (Output_symtab_xindex::endian_do_write): New function.
14318         * output.h (class Output_section_headers): Add shstrtab_section_.
14319         Update declarations.
14320         (class Output_symtab_xindex): Define.
14321         (Output_section::has_out_shndx): New function.
14322         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14323         field.
14324         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14325         Change all callers.
14326         (Sized_symbol::init): Likewise.
14327         (Symbol::output_section): Check for ordinary symbol.
14328         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14329         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14330         callers.
14331         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14332         Change all callers.  Simplify handling of symbols from sections
14333         not included in the link.
14334         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14335         distinction.
14336         (Weak_alias_sorter::operator()): Assert that symbols are
14337         ordinary.
14338         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14339         distinction.
14340         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14341         parameters.  Change all callers.
14342         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14343         symbol distinction.  Use SHN_XINDEX when needed.
14344         (Symbol_table::write_section_symbol): Add symtab_xindex
14345         parameter.  Change all callers.
14346         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14347         SHN_XINDEX when needed.
14348         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14349         declarations.
14350         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14351         (Symbol::is_defined): Check is_ordinary.
14352         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14353         (Symbol::is_absolute, Symbol::is_common): Likewise.
14354         (class Sized_symbol): Update declarations.
14355         (class Symbol_table): Update declarations.
14356         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14357         parameters.  Change all callers.
14358         (Sized_symbol::override): Likewise.
14359         (Symbol_table::override): Likewise.
14360         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14361         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14362         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14363         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14364         to be in an ordinary section.
14365         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14366         object and is_ordinary parameters.  Change all callers.
14367         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14368         Change all callers.  Don't add undefined or non-ordinary symbols
14369         to reloc_map_.
14370         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14371         Change all callers.
14372         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14373         declarations.
14374         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14375         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14376         (Sized_relobj::relocate_sections): Likewise.
14377         * target-reloc.h (scan_relocs): Adjust section symbol index.
14378         (scan_relocatable_relocs): Likewise.
14379         * i386.cc (Scan::local): Check for ordinary symbols.
14380         * sparc.cc (Scan::local): Likewise.
14381         * x86_64.cc (Scan::local): Likewise.
14382         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14383         to symbol_section_and_value.
14384         * testsuite/many_sections_test.cc: New file.
14385         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14386         (check_PROGRAMS): Add many_sections_test.
14387         (many_sections_test_SOURCES): Define.
14388         (many_sections_test_DEPENDENCIES): Define.
14389         (many_sections_test_LDFLAGS): Define.
14390         (BUILT_SOURCES): Add many_sections_define.h.
14391         (many_sections_define.h): New target.
14392         (BUILT_SOURCES): Add many_sections_check.h.
14393         (many_sections_check.h): New target.
14394         (check_PROGRAMS): Add many_sections_r_test.
14395         (many_sections_r_test_SOURCES): Define.
14396         (many_sections_r_test_DEPENDENCIES): Define.
14397         (many_sections_r_test_LDFLAGS): Define.
14398         (many_sections_r_test_LDADD): Define.
14399         (many_sections_r_test.o): New target.
14400         * testsuite/Makefile.in: Rebuild.
14401
14402 2008-04-17  Cary Coutant  <ccoutant@google.com>
14403
14404         * errors.cc (Errors::info): New function.
14405         (gold_info): New function.
14406         * errors.h (Errors::info): New function.
14407         * gold.h (gold_info): New function.
14408         * object.cc (Input_objects::add_object): Print trace output.
14409         * options.cc (options::parse_set): New function.
14410         (General_options::parse_wrap): Deleted.
14411         (General_options::General_options): Deleted initializer.
14412         * options.h (options::String_set): New typedef.
14413         (options::parse_set): New function.
14414         (DEFINE_set): New macro.
14415         (General_options::wrap): Changed to use DEFINE_set. Changed
14416         callers of any_wrap_symbols and is_wrap_symbol.
14417         (General_options::trace, General_options::trace_symbol):
14418         New options.
14419         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14420         (General_options::wrap_symbols_): Deleted.
14421         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14422
14423 2008-04-17  David S. Miller  <davem@davemloft.net>
14424
14425         * options.cc (General_options::parse_V): New function.
14426         * options.h: Add entries for -V and -Qy.
14427
14428 2008-04-17  Ian Lance Taylor  <iant@google.com>
14429
14430         * common.cc (Symbol_table::allocate_commons): Remove options
14431         parameter.  Change caller.
14432         (Symbol_table::do_allocate_commons): Remove options parameter.
14433         Change caller.  Just call do_allocate_commons_list twice.
14434         (Symbol_table::do_allocate_commons_list): New function, broken out
14435         of do_allocate_commons.
14436         * common.h (class Allocate_commons_task): Remove options_ field.
14437         Update constructor.
14438         * symtab.cc (Symbol_table::Symbol_table): Initialize
14439         tls_commons_.
14440         (Symbol_table::add_from_object): Put TLS common symbols on
14441         tls_commons_ list.
14442         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14443         which are IN_OUTPUT_DATA.
14444         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14445         allocate_commons and do_allocate_commons declarations.  Declare
14446         do_allocate_commons_list.
14447         * gold.cc (queue_middle_tasks): Update creation of
14448         Allocate_commons_task to not pass options.
14449         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14450         (TLS_TEST_C_FLAGS): New variable.
14451         (tls_test_c_pic.o): New target.
14452         (tls_test_shared.so): Link in tls_test_c_pic.o.
14453         (tls_test_c_pic_ie.o): New target.
14454         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14455         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14456         (tls_test_c.o): New target.
14457         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14458         (tls_pic_test_LDADD): Likewise.
14459         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14460         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14461         (tls_test_c_gnu2.o): New target.
14462         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14463         tls_test_c_gnu2.o.
14464         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14465         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14466         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14467         * testsuite/tls_test.cc: Include "config.h".
14468         (t_last): Call t11_last.
14469         * testsuite/tls_test.h (t11, t11_last): Declare.
14470         * testsuite/tls_test_c.c: New file.
14471         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14472         * configure.ac: Check for OpenMP support.
14473         * configure, config.in, Makefile.in: Rebuild.
14474         * testsuite/Makefile.in: Rebuild.
14475
14476 2008-04-16  Cary Coutant  <ccoutant@google.com>
14477
14478         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14479         (Target_i386::tls_base_symbol_defined_): New field.
14480         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14481         (Target_i386::Scan::global): Likewise.
14482         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14483         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14484         (Target_x86_64::tls_base_symbol_defined_): New field.
14485         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14486         (Target_x86_64::Scan::global): Likewise.
14487
14488 2008-04-16  Cary Coutant  <ccoutant@google.com>
14489
14490         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14491         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14492         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14493         building shared libraries.
14494         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14495         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14496         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14497         * testsuite/Makefile.in: Rebuild.
14498         * testsuite/weak_undef.h: New file.
14499         * testsuite/weak_undef_file1.cc: Add extra test cases.
14500         * testsuite/weak_undef_file2.cc: Likewise.
14501         * testsuite/weak_undef_test.cc: Likewise.
14502
14503 2008-04-16  David S. Miller  <davem@davemloft.net>
14504
14505         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14506         Add issued_non_pic_error_ field.  Declare check_non_pic.
14507         (Target_sparc::Scan::check_non_pic): New function.
14508         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14509         (Target_sparc::Scan::global): Likewise.
14510
14511         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14512         * configure: Rebuild.
14513
14514         * options.h (DEFINE_enable): New macro.
14515         (new_dtags): New enable option.
14516         (initfirst, interpose, loadfltr, nodefaultlib,
14517         nodelete, nodlopen, nodump): New -z options.
14518         * layout.cc (Layout:finish_dynamic_section): If new
14519         dtags enabled, emit DT_RUNPATH.  Also, emit a
14520         DT_FLAGS_1 containing any specified -z flags.
14521
14522 2008-04-16  Ian Lance Taylor  <iant@google.com>
14523
14524         * copy-relocs.cc: New file.
14525         * copy-relocs.h: New file.
14526         * reloc.cc: Remove Copy_relocs code.
14527         * reloc.h: Likewise.
14528         * reloc-types.h (struct Reloc_types) [both versions]: Add
14529         get_reloc_addend_noerror.
14530         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14531         variants of add_global which take an addend which must be zero.
14532         * i386.cc: Include "copy-relocs.h".
14533         (class Target_i386): Change type of copy_relocs_ to variable,
14534         update initializer.
14535         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14536         Change all callers.
14537         (Target_i386::do_finalize_sections): Change handling of
14538         copy_relocs_.
14539         * sparc.cc: Include "copy-relocs.h".
14540         (class Target_sparc): Change type of copy_relocs_ to variable,
14541         update initializer.
14542         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14543         Change all callers.
14544         (Target_sparc::do_finalize_sections): Change handling of
14545         copy_relocs_.
14546         * x86_64.cc: Include "copy-relocs.h".
14547         (class Target_x86_64): Change type of copy_relocs_ to variable,
14548         update initializer.
14549         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14550         class.  Change all callers.
14551         (Target_x86_64::do_finalize_sections): Change handling of
14552         copy_relocs_.
14553         * Makefile.am (CCFILES): Add copy-relocs.cc.
14554         (HFILES): Add copy-relocs.h.
14555
14556         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14557
14558         * testsuite/script_test_4.sh: Permit leading zeroes.
14559
14560 2008-04-15  Ian Lance Taylor  <iant@google.com>
14561
14562         * script-sections.cc (Script_sections::create_segments): Use
14563         header_size_adjustment even when there is enough room for the
14564         headers.
14565         * testsuite/script_test_4.sh: New file.
14566         * testsuite/script_test_4.t: New file.
14567         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14568         (check_DATA): Add script_test_4.stdout.
14569         (MOSTLYCLEANFILES): Likewise.
14570         (script_test_4): New target.
14571         (script_test_4.stdout): New target.
14572         * testsuite/Makefile.in: Rebuild.
14573
14574         * sparc.cc: Add definitions for Output_data_plt_sparc class
14575         constants.
14576
14577 2008-04-14  David S. Miller  <davem@davemloft.net>
14578
14579         * sparc.cc: New file.
14580         * Makefile.am (TARGETSOURCES): Add sparc.cc
14581         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14582         * configure.tgt: Document targ_extra_size and
14583         targ_extra_big_endian.  Add entries for sparc-* and
14584         sparc64-*.
14585         * configure.ac: Handle targ_extra_size and
14586         targ_extra_big_endian.
14587         * Makefile.in: Rebuild.
14588         * configure: Likewise.
14589         * po/POTFILES.in: Likewise.
14590         * po/gold.pot: Likewise.
14591
14592 2008-04-14  Ian Lance Taylor  <iant@google.com>
14593
14594         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14595         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14596         in the name/type/flags to section mapping.  Don't call
14597         allocate_output_section.
14598         (Layout::choose_output_section): Change parameter from adjust_name
14599         to is_input_section.  Don't permit input sections after sections
14600         are attached to segments.  Don't call allocate_output_section.
14601         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14602         not write_enable_output_section.
14603         (Layout::make_output_section): Don't push to
14604         unattached_section_list_ nor call attach_to_segment.  Call
14605         attach_section_to_segment if sections are attached.
14606         (Layout::attach_sections_to_segments): New function.
14607         (Layout::attach_section_to_segment): New function.
14608         (Layout::attach_allocated_section_to_segment): Rename from
14609         attach_to_segment.  Remove flags parameter.
14610         (Layout::allocate_output_section): Remove function.
14611         (Layout::write_enable_output_section): Remove function.
14612         * layout.h (class Layout): Update for above changes.  Add new
14613         field sections_are_attached_.
14614         * output.h (Output_section::update_flags_for_input_section): New
14615         function.
14616         * output.cc (Output_section::add_input_section): Call
14617         update_flags_for_input_section.
14618         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14619
14620 2008-04-11  Cary Coutant  <ccoutant@google.com>
14621
14622         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14623         thought unnecessary.
14624         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14625
14626 2008-04-11  Ian Lance Taylor  <iant@google.com>
14627
14628         * output.h (class Output_section_data): Remove inline definition
14629         of set_addralign.
14630         * output.cc (Output_section_data::set_addralign): New function.
14631
14632 2008-04-11  Cary Coutant  <ccoutant@google.com>
14633
14634         Add support for TLS descriptors for i386 and x86_64.
14635         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14636         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14637         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14638         GOT_TYPE_TLS_DESC.
14639         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14640         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14641         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14642         relocations.
14643         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14644         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14645         Fix problem with initial-exec relocations.
14646         (Target_i386::Relocate::relocate_tls): Likewise.
14647         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14648         relaxation.
14649         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14650         support for section-plus-offset dynamic table entries.
14651         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14652         (Output_data_dynamic::Dynamic_entry): Add support for
14653         section-plus-offset dynamic table entries.
14654         (Output_data_dynamic::Classification): Likewise.
14655         (Output_data_dynamic::classification_): Renamed offset_.
14656         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14657         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14658         (Target_x86_64::make_plt_section): New function.
14659         (Target_x86_64::reserve_tlsdesc_entries): New function.
14660         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14661         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14662         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14663         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14664         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14665         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14666         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14667         add extra PLT entry for TLS descriptors.
14668         (Output_data_plt_x86_64::got_): New field.
14669         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14670         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14671         fields.
14672         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14673         descriptors.
14674         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14675         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14676         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14677         R_386_TLS_DESC_CALL relocations.
14678         (Target_x86_64::Scan::global): Likewise.
14679         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14680         for TLS descriptors.
14681         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14682         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14683         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14684         GD-to-IE relaxation.
14685         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14686         and TLS_DESCRIPTORS.
14687         * Makefile.in: Rebuild.
14688         * configure: Rebuild.
14689         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14690         (tls_test_shared2.so): New target.
14691         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14692         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14693         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14694         (tls_shared_gd_to_ie_test_LDADD): New variable.
14695         (tls_shared_gnu2_gd_to_ie_test): New target.
14696         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14697         New targets.
14698         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14699         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14700         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14701         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14702         (tls_shared_gnu2_test): New target.
14703         (tls_test_gnu2_shared.so): New target.
14704         (tls_shared_gnu2_test_SOURCES): New variable.
14705         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14706         (tls_shared_gnu2_test_LDFLAGS): New variable.
14707         (tls_shared_gnu2_test_LDADD): New variable.
14708         * testsuite/Makefile.in: Rebuild.
14709         * testsuite/Makefile.
14710
14711 2008-04-11  Ian Lance Taylor  <iant@google.com>
14712
14713         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14714         justsyms.t.
14715         * testsuite/Makefile.in: Rebuild.
14716
14717         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14718         long.
14719         * testsuite/script_test_2.cc (main): Adjust test.
14720
14721 2008-04-11  David S. Miller  <davem@davemloft.net>
14722             Ian Lance Taylor  <iant@google.com>
14723
14724         * options.h (General_options): Add entries for '-Y' and
14725         '-relax'.
14726         * options.cc (General_options:finalize): If -Y was used, add those
14727         entries to the library path instead of the default "/lib" and
14728         "/usr/lib".
14729
14730 2008-04-11  David S. Miller  <davem@davemloft.net>
14731
14732         * testsuite/justsyms.t: Start at 0x100.
14733         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14734         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14735         long.
14736         * testsuite/script_test_2.cc: Adjust string and section length
14737         checks.
14738
14739 2008-04-09  Ian Lance Taylor  <iant@google.com>
14740
14741         PR gold/5996
14742         * script-sections.cc (Sections_element::allocate_to_segment): Add
14743         orphan parameter.
14744         (Output_section_definition::allocate_to_segment): Likewise.
14745         (Orphan_output_section::allocate_to_segment): Likewise.
14746         (Script_sections::attach_sections_using_phdrs_clause): Don't
14747         propagate non-PT_LOAD segments to orphan sections.
14748         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14749         readelf rather than objdump.
14750         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14751         .interp section and PT_INTERP segment are the same size.
14752         * testsuite/Makefile.in: Rebuild.
14753
14754         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14755         aliases for symbols defined in the same object.
14756         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14757         (weak_alias_test_SOURCES): New variable.
14758         (weak_alias_test_DEPENDENCIES): New variable.
14759         (weak_alias_test_LDFLAGS): New variable.
14760         (weak_alias_test_LDADD): New variable.
14761         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14762         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14763         (weak_alias_test_3.o): New target.
14764         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14765         * testsuite/weak_alias_test_main.cc: New file.
14766         * testsuite/weak_alias_test_1.cc: New file.
14767         * testsuite/weak_alias_test_2.cc: New file.
14768         * testsuite/weak_alias_test_3.cc: New file.
14769
14770 2008-04-08  Ian Lance Taylor  <iant@google.com>
14771
14772         * options.h (class General_options): Add --noinhibit-exec option.
14773         * main.cc (main): Check --noinhibit-exec.
14774
14775         * options.h (class General_options): Define --wrap as a special
14776         option.  Add wrap_symbols_ field.
14777         (General_options::any_wrap_symbols): New function.
14778         (General_options::is_wrap_symbol): New function.
14779         * options.cc (General_options::parse_wrap): New function.
14780         (General_options::General_options): Initialize wrap_symbols_.
14781         * symtab.cc (Symbol_table::wrap_symbol): New function.
14782         (Symbol_table::add_from_object): Handle --wrap.
14783         * symtab.h (class Symbol_table): Declare wrap_symbol.
14784         * target.h (Target::wrap_char): New function.
14785         (Target::Target_info): Add wrap_char field.
14786         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14787         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14788         * testsuite/testfile.cc (Target_test::test_target_info):
14789         Likewise.
14790
14791         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14792         there is one.
14793
14794         * layout.h (class Layout): Add added_eh_frame_data_ field.
14795         * layout.cc (Layout::Layout): Initialize new field.
14796         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14797         output section until we find a section we merged successfully.
14798         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14799         that the size be non-zero.
14800
14801         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14802         qualifier.
14803
14804 2008-04-08  Craig Silverstein  <csilvers@google.com>
14805
14806         * configure.ac: Export new conditional variable HAVE_ZLIB.
14807         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14808         on HAVE_ZLIB.
14809         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14810         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14811
14812 2008-04-07  Ian Lance Taylor  <iant@google.com>
14813
14814         * version.cc (version_string): Set to "1.5".
14815
14816         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14817         Add issued_non_pic_error_ field.  Declare check_non_pic.
14818         (Target_x86_64::Scan::check_non_pic): New function.
14819         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14820         (Target_x86_64::Scan::global): Likewise.
14821
14822         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14823         addend parameter.  Change caller.  Handle merge sections.
14824         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14825         Address to Addend.  Don't add in the result of
14826         local_section_offset, pass down the addend and use the returned
14827         value.
14828         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14829         Update declarations of local_section_offset and symbol_value.
14830         * testsuite/two_file_test_1.cc (t18): New function.
14831         * testsuite/two_file_test_2.cc (f18): New function.
14832         * testsuite/two_file_test_main.cc (main): Call t18.
14833         * testsuite/two_file_test.h (t18, f18): Declare.
14834
14835         * configure.ac: Don't test for objdump, c++filt, or readelf.
14836         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14837         conditionals.
14838         (TEST_READELF): New variable.
14839         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14840         (check_PROGRAMS): Add two_file_strip_test.
14841         (two_file_strip_test): New target.
14842         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14843         (two_file_same_shared_strip_test_SOURCES): New variable.
14844         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14845         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14846         (two_file_same_shared_strip_test_LDADD): New variable.
14847         (two_file_shared_strip.so): New target.
14848         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14849         (ver_test_5.syms, ver_test_7.syms): Likewise.
14850         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14851         (strip_test_3.stdout): Use TEST_OBJDUMP.
14852         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14853
14854 2008-04-04  Cary Coutant  <ccoutant@google.com>
14855
14856         * symtab.h (Symbol::is_weak_undefined): New function.
14857         (Symbol::is_strong_undefined): New function.
14858         (Symbol::is_absolute): New function.
14859         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14860         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14861         absolute symbols.
14862         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14863         (weak_undef_test): New target.
14864         * testsuite/Makefile.in: Rebuild.
14865         * testsuite/weak_undef_file1.cc: New file.
14866         * testsuite/weak_undef_file2.cc: New file.
14867         * testsuite/weak_undef_test.cc: New file.
14868
14869 2008-04-03  Craig Silverstein  <csilvers@google.com>
14870
14871         * compressed_output.h (class Output_compressed_section): Use
14872         unsigned buffer.
14873         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14874         add zlib header.
14875         (zlib_compressed_suffix): Removed.
14876         (Output_compressed_section::set_final_data_size): Use unsigned
14877         buffers.
14878         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14879         Fix linker invocation.
14880         (flagstest_o_specialfile_and_compress_debug_sections):
14881         Likewise.
14882         * testsuite/Makefile.in: Regenerated.
14883
14884 2008-04-02  David S. Miller  <davem@davemloft.net>
14885
14886         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14887         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14888
14889 2008-04-02  Craig Silverstein  <csilvers@google.com>
14890
14891         * TODO: New file.
14892
14893 2008-04-02  Ian Lance Taylor  <iant@google.com>
14894
14895         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14896         parameters.  Update for new key type to views_.  Change all
14897         callers.
14898         (File_read::read): Adjust for byteshift in returned view.
14899         (File_read::add_view): New function, broken out of
14900         find_and_make_view.
14901         (File_read::make_view): New function, broken out of
14902         find_and_make_view.
14903         (File_read::find_or_make_view): Add offset and aligned
14904         parameters.  Rewrite accordingly.  Change all callers.
14905         (File_read::get_view): Add offset and aligned parameters.  Adjust
14906         for byteshift in return value.
14907         (File_read::get_lasting_view): Likewise.
14908         * fileread.h (class File_read): Update declarations.
14909         (class File_read::View): Add byteshift_ field.  Add byteshift to
14910         constructor.  Add byteshift method.
14911         * archive.h (Archive::clear_uncached_views): New function.
14912         (Archive::get_view): Add aligned parameter.  Change all callers.
14913         * object.h (Object::get_view): Add aligned parameter.  Change all
14914         callers.
14915         (Object::get_lasting_view): Likewise.
14916
14917         * fileread.cc (File_read::release): Don't call clear_views if
14918         there are multiple objects.
14919         * fileread.h (File_read::clear_uncached_views): New function.
14920         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
14921         on the archive.
14922
14923 2008-03-31  Cary Coutant  <ccoutant@google.com>
14924
14925         Add thin archive support.
14926         * archive.cc (Archive::armagt): New const.
14927         (Archive::setup): Remove task parameter and calls to unlock.
14928         (Archive::unlock_nested_archives): New function.
14929         (Archive::read_header): Add nested_off parameter. Change
14930         all callers.
14931         (Archive::interpret_header): Likewise.
14932         (Archive::include_all_members): Change to handle thin
14933         archives.
14934         (Archive::include_member): Likewise.
14935         * archive.h (Archive::Archive): Add new parameters and
14936         initializers.
14937         (Archive::armagt): New const.
14938         (Archive::setup): Remove task parameter.
14939         (Archive::unlock_nested_archives): New function.
14940         (Archive::read_header): Add nested_off parameter.
14941         (Archive::interpret_header): Likewise.
14942         (Archive::Nested_archive_table): New typedef.
14943         (Archive::is_thin_archive_): New field.
14944         (Archive::nested_archives_): New field.
14945         (Archive::options_): New field.
14946         (Archive::dirpath_): New field.
14947         (Archive::task_): New field.
14948         * readsyms.cc (Read_symbols::do_read_symbols): Add check
14949         for thin archives.  Pass additional parameters to
14950         Archive::Archive.  Unlock the archive file after calling
14951         Archive::setup.
14952
14953 2008-03-29  Ian Lance Taylor  <iant@google.com>
14954
14955         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
14956         version symbol to be local.
14957         * testsuite/ver_test_4.sh: New file.
14958         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
14959         (check_DATA): Add ver_test_4.syms.
14960         (ver_test_4.syms): New target.
14961         * testsuite/Makefile.in: Rebuild.
14962
14963         * output.cc
14964         (Output_section::Input_section_sort_entry::has_priority): New
14965         function.
14966         (Output_section::Input_section_sort_entry::match_file_name): New
14967         function.
14968         (Output_section::Input_section_sort_entry::match_section_name):
14969         Remove.
14970         (Output_section::Input_section_sort_entry::match_section_name_prefix):
14971         Remove.
14972         (Output_section::Input_section_sort_entry::match_section_file):
14973         Remove.
14974         (Output_section::Input_section_sort_compare::operator()): Rewrite
14975         using new Input_section_sort_entry functions.  Sort crtbegin and
14976         crtend first.  Sort sections with no priority before sections with
14977         a priority.
14978         * testsuite/initpri1.c (d3): Check j != 4.
14979         (cd5): New constructor/destructor function.
14980         (main): Check j != 2.
14981
14982         * symtab.cc (Symbol_table::add_from_object): If we don't use the
14983         new symbol when resolving, don't call set_is_default.
14984         * testsuite/ver_test_7.cc: New file.
14985         * testsuite/ver_test_7.sh: New file.
14986         * testsuite/Makefile.am (ver_test_7.so): New target.
14987         (ver_test_7.o): New target.
14988         (check_SCRIPTS): Add ver_test_7.sh.
14989         (check_DATA): Add ver_test_7.syms.
14990         (ver_test_7.syms): New target.
14991
14992 2008-03-28  Ian Lance Taylor  <iant@google.com>
14993
14994         * layout.cc (Layout::layout): If we see an input section with a
14995         name that needs sorting, set the must_sort flag for the output
14996         section.
14997         (Layout::make_output_section): If the name of the output section
14998         indicates that it might require sorting, set the may_sort flag.
14999         * output.h (Output_section::may_sort_attached_input_sections): New
15000         function.
15001         (Output_section::set_may_sort_attached_input_sections): New
15002         function.
15003         (Output_section::must_sort_attached_input_sections): New
15004         function.
15005         (Output_section::set_must_sort_attached_input_sections): New
15006         function.
15007         (class Output_section): Declare Input_section_sort_entry.  Define
15008         Input_section_sort_compare.  Declare
15009         sort_attached_input_sections.  Add new fields:
15010         may_sort_attached_input_sections_,
15011         must_sort_attached_input_sections_,
15012         attached_input_sections_are_sorted_.
15013         * output.cc (Output_section::Output_section): Initialize new
15014         fields.
15015         (Output_section::add_input_section): Add an entry to
15016         input_sections_ if may_sort or must_sort are true.
15017         (Output_section::set_final_data_size): Call
15018         sort_attached_input_sections if necessary.
15019         (Output_section::Input_section_sort_entry): Define new class.
15020         (Output_section::Input_section_sort_compare::operator()): New
15021         function.
15022         (Output_section::sort_attached_input_sections): New function.
15023         * configure.ac: Check whether the compiler supports constructor
15024         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15025         * testsuite/initpri1.c: New file.
15026         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15027         CONSTRUCTOR_PRIORITY.
15028         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15029         (initpri1_LDFLAGS): New variable.
15030         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15031
15032 2008-03-27  Ian Lance Taylor  <iant@google.com>
15033
15034         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15035         * testsuite/common_test_1.c: New file.
15036         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15037         (common_test_1_SOURCES): New variable.
15038         (common_test_1_DEPENDENCIES): New variable.
15039         (common_test_1_LDFLAGS): New variable.
15040
15041         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15042         and commons_ correctly when NAME/VERSION does not override
15043         NAME/NULL.
15044         * testsuite/ver_test_6.c: New file.
15045         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15046         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15047         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15048
15049 2008-03-26  Ian Lance Taylor  <iant@google.com>
15050
15051         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15052         of an undefined symbol from a version script.
15053         * testsuite/Makefile.am (ver_test_5.so): New target.
15054         (ver_test_5.o): New target.
15055         (check_SCRIPTS): Add ver_test_5.sh.
15056         (check_DATA): Add ver_test_5.syms.
15057         (ver_test_5.syms): New target.
15058         * testsuite/ver_test_5.cc: New file.
15059         * testsuite/ver_test_5.script: New file.
15060         * testsuite/ver_test_5.sh: New file.
15061         * Makefile.in, testsuite/Makefile.in: Rebuild.
15062
15063         PR gold/5986
15064         Fix problems building gold with gcc 4.3.0.
15065         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15066         (gold_error_at_location, gold_warning_at_location): Use it.
15067         * configure.ac: Check whether we can compile and use a template
15068         function with a printf attribute.
15069         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15070         when jumping over bytes.
15071         * object.cc: Instantiate Object::read_section_data.
15072         * debug.h: Include <cstring>
15073         * dwarf_reader.cc: Include <algorithm>
15074         * main.cc: Include <cstring>.
15075         * options.cc: Include <cstring>.
15076         * output.cc: Include <cstring>.
15077         * script.cc: Include <cstring>.
15078         * script.h: Include <string>.
15079         * symtab.cc: Include <cstring> and <algorithm>.
15080         * target-select.cc: Include <cstring>.
15081         * version.cc: Include <string>.
15082         * testsuite/testmain.cc: Include <cstdlib>.
15083         * configure, config.in: Rebuild.
15084
15085 2008-03-25  Ian Lance Taylor  <iant@google.com>
15086
15087         * options.cc: Include "../bfd/bfdver.h".
15088         (options::help): Print bug reporting address.
15089
15090         * version.cc (print_version): Adjust output for current value of
15091         BFD_VERSION_STRING.
15092
15093         * NEWS: New file.
15094
15095         * options.cc (options::help): Print list of supported targets.
15096         * target-select.h: Include <vector>.
15097         (class Target_selector): Make machine_, size_, and is_big_endian_
15098         fields const.  Add bfd_name_ and instantiated_target_ fields.
15099         (Target_selector::Target_selector): Add bfd_name parameter.
15100         (Target_selector::recognize): Make non-virtual, call
15101         do_recognize.
15102         (Target_selector::recognize_by_name): Make non-virtual, call
15103         do_recognize_by_name.
15104         (Target_selector::supported_names): New function.
15105         (Target_selector::bfd_name): New function.
15106         (Target_selector::do_instantiate_target): New pure virtual
15107         function.
15108         (Target_selector::do_recognize): New virtual function.
15109         (Target_selector::do_recognize_by_name): New virtual function.
15110         (Target_selector::instantiate_target): New private function.
15111         (supported_target_names): Declare.
15112         * target-select.cc (Target_selector::Target_selector): Update for
15113         new parameter and fields.
15114         (select_target_by_name): Check that the name matches before
15115         calling recognize_by_name.
15116         (supported_target_names): New function.
15117         * i386.cc (class Target_selector_i386): Update Target_selector
15118         constructor call.  Remove recognize and recognize_by_name.  Add
15119         do_instantiate_target.
15120         * x86_64.cc (class Target_selector_x86_64): Likewise.
15121         * testsuite/testfile.cc (class Target_selector_test): Update for
15122         changes to Target_selector.
15123
15124         * README: Rewrite, with some notes on unsupported features.
15125
15126 2008-03-24  Cary Coutant  <ccoutant@google.com>
15127
15128         * i386.cc (Target_i386::Got_type): New enum declaration.
15129         (Target_i386::Scan::local): Updated callers of Output_data_got
15130         member functions.
15131         (Target_i386::Scan::global): Likewise.
15132         (Target_i386::Relocate::relocate): Likewise.
15133         (Target_i386::Relocate::relocate_tls): Likewise.
15134         * object.h (Got_offset_list): New class.
15135         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15136         (Sized_relobj::local_got_offset): Likewise.
15137         (Sized_relobj::set_local_got_offset): Likewise.
15138         (Sized_relobj::local_has_tls_got_offset): Removed.
15139         (Sized_relobj::local_tls_got_offset): Removed.
15140         (Sized_relobj::set_local_tls_got_offset): Removed.
15141         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15142         * output.cc (Output_data_got::add_global): Added got_type parameter.
15143         (Output_data_got::add_global_with_rel): Likewise.
15144         (Output_data_got::add_global_with_rela): Likewise.
15145         (Output_data_got::add_global_pair_with_rel): New function.
15146         (Output_data_got::add_global_pair_with_rela): New function.
15147         (Output_data_got::add_local): Added got_type parameter.
15148         (Output_data_got::add_local_with_rel): Likewise.
15149         (Output_data_got::add_local_with_rela): Likewise.
15150         (Output_data_got::add_local_pair_with_rel): New function.
15151         (Output_data_got::add_local_pair_with_rela): New function.
15152         (Output_data_got::add_global_tls): Removed.
15153         (Output_data_got::add_global_tls_with_rel): Removed.
15154         (Output_data_got::add_global_tls_with_rela): Removed.
15155         (Output_data_got::add_local_tls): Removed.
15156         (Output_data_got::add_local_tls_with_rel): Removed.
15157         (Output_data_got::add_local_tls_with_rela): Removed.
15158         * output.h (Output_data_got::add_global): Added got_type parameter.
15159         (Output_data_got::add_global_with_rel): Likewise.
15160         (Output_data_got::add_global_with_rela): Likewise.
15161         (Output_data_got::add_global_pair_with_rel): New function.
15162         (Output_data_got::add_global_pair_with_rela): New function.
15163         (Output_data_got::add_local): Added got_type parameter.
15164         (Output_data_got::add_local_with_rel): Likewise.
15165         (Output_data_got::add_local_with_rela): Likewise.
15166         (Output_data_got::add_local_pair_with_rel): New function.
15167         (Output_data_got::add_local_pair_with_rela): New function.
15168         (Output_data_got::add_global_tls): Removed.
15169         (Output_data_got::add_global_tls_with_rel): Removed.
15170         (Output_data_got::add_global_tls_with_rela): Removed.
15171         (Output_data_got::add_local_tls): Removed.
15172         (Output_data_got::add_local_tls_with_rel): Removed.
15173         (Output_data_got::add_local_tls_with_rela): Removed.
15174         * resolve.cc (Symbol::override_base_with_special): Removed
15175         reference to has_got_offset_ field.
15176         * symtab.cc (Symbol::init_fields): Replaced initialization
15177         of got_offset_ with got_offsets_.  Removed initialization
15178         of has_got_offset_
15179         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15180         (Symbol::got_offset): Likewise.
15181         (Symbol::set_got_offset): Likewise.
15182         (Symbol::has_tls_got_offset): Removed.
15183         (Symbol::tls_got_offset): Removed.
15184         (Symbol::set_tls_got_offset): Removed.
15185         (Symbol::got_offset_): Removed.
15186         (Symbol::tls_mod_got_offset_): Removed.
15187         (Symbol::tls_pair_got_offset_): Removed.
15188         (Symbol::got_offsets_): New field.
15189         (Symbol::has_got_offset): Removed.
15190         (Symbol::has_tls_mod_got_offset): Removed.
15191         (Symbol::has_tls_pair_got_offset): Removed.
15192         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15193         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15194         member functions.
15195         (Target_x86_64::Scan::global): Likewise.
15196         (Target_x86_64::Relocate::relocate): Likewise.
15197         (Target_x86_64::Relocate::relocate_tls): Likewise.
15198
15199 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15200
15201         * yyscript.y: Fix spelling error in comment.
15202
15203 2008-03-24  Ian Lance Taylor  <iant@google.com>
15204
15205         * options.h (class General_options): Define build_id option.
15206         * layout.h (class Layout): Declare write_build_id, create_note,
15207         create_build_id.  Add build_id_note_ member.
15208         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15209         "libiberty.h", "md5.h", "sha1.h".
15210         (Layout::Layout): Initialize eh_frame_data_,
15211         eh_frame_hdr_section_, and build_id_note_.
15212         (Layout::finalize): Call create_build_id.
15213         (Layout::create_note): New function, broken out of
15214         Layout::create_gold_note.
15215         (Layout::create_gold_note): Call create_note.
15216         (Layout::create_build_id): New function.
15217         (Layout::write_build_id): New function.
15218         (Close_task_runner::run): Call write_build_id.
15219
15220         * x86_64.cc: Correct license to GPLv3.
15221
15222 2008-03-23  Ian Lance Taylor  <iant@google.com>
15223
15224         * options.cc: Include "demangle.h".
15225         (parse_optional_string): New function.
15226         (parse_long_option): Handle takes_optional_argument.
15227         (parse_short_option): Update dash_z initializer.  Handle
15228         takes_optional_argument.
15229         (General_options::General_options): Initialize do_demangle_.
15230         (General_options::finalize): Set do_demangle_.  Handle demangling
15231         style.
15232         * options.h (parse_optional_string): Declare.
15233         (struct One_option): Add optional_arg field.  Update constructor.
15234         Update call constructor calls.  Add takes_optional_argument
15235         function.
15236         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15237         (DEFINE_optional_string): Define.
15238         (General_options::demangle): Change from DEFINE_bool to
15239         DEFINE_optional_string.
15240         (General_options::no_demangle): New function.
15241         (General_options::do_demangle): New function.
15242         (General_options::set_do_demangle): New function.
15243         (General_options::execstack_status_): Move definition to end of
15244         class definition.
15245         (General_options::static_): Likewise.
15246         (General_options::do_demangle_): New field.
15247         * object.cc (big_endian>::get_symbol_location_info): Call
15248         Options::do_demangle, not Options::demangle.
15249         * symtab.cc (demangle): Likewise.
15250
15251 2008-03-22  Ian Lance Taylor  <iant@google.com>
15252
15253         * gold.h: Include <cstddef> and <sys/types.h>
15254         * options.h: Include <cstring>.
15255
15256 2008-03-21  Ian Lance Taylor  <iant@google.com>
15257
15258         * Added source code to GNU binutils.
15259 \f
15260 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15261
15262 Copying and distribution of this file, with or without modification,
15263 are permitted in any medium without royalty provided the copyright
15264 notice and this notice are preserved.
15265
15266 Local Variables:
15267 mode: change-log
15268 left-margin: 8
15269 fill-column: 74
15270 version-control: never
15271 End: