Fix race condition while building EH frame header.
[external/binutils.git] / gold / ChangeLog
1 2013-11-14  Cary Coutant  <ccoutant@google.com>
2
3         PR gold/14860
4         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
5         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
6         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
7         updating fde_offsets_.
8         (Eh_frame_hdr::lock_): New data member.
9
10 2013-11-06  Cary Coutant  <ccoutant@google.com>
11
12         PR gold/15758
13         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
14         before reloc sections.
15
16 2013-10-31  Cary Coutant  <ccoutant@google.com>
17
18         Restore support for dwp v2 DWARF package file format.
19
20         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
21         tu_length parameter.  Adjust all callers.
22         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
23         * dwp.cc: Include dwarf.h.
24         (Section_bounds): New struct type.
25         (Unit_set): New struct type.
26         (Dwo_file::Dwo_file): Initialize new data member.
27         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
28         Combine and rename to...
29         (Dwo_file::read_unit_index): ...this.
30         (Dwo_file::sized_read_compunit_index)
31         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
32         (Dwo_file::sized_read_unit_index): ...this.
33         (Dwo_file::copy_section): Remove section_name, is_str_offsets
34         parameters; add section_id parameter.
35         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
36         (Dwo_file::add_unit_set): ...this.
37         (Dwo_file::shndx_map_): Remove.
38         (Dwo_file::sect_offsets_): New data member.
39         (Dwp_output_file::Dwp_output_file): Initialize new data members.
40         (Dwp_output_file::add_section): Rename to...
41         (Dwp_output_file::add_contribution): ...this.
42         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
43         (Dwp_output_file::add_tu_set): Likewise.
44         (Dwp_output_file::Contribution): New type.
45         (Dwp_output_file::Section::contributions): New data member.
46         (Dwp_output_file::Cu_or_tu_set): Remove.
47         (Dwp_output_file::Section::Section): New ctor.
48         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
49         (Dwp_output_file::Dwp_index::Section_table): New type.
50         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
51         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
52         parameter.
53         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
54         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
55         (Dwp_output_file::Dwp_index::section_table): New member function.
56         (Dwp_output_file::Dwp_index::section_table_end): New member function.
57         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
58         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
59         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
60         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
61         (Dwp_output_file::Dwp_index::section_table_): New data member.
62         (Dwp_output_file::Dwp_index::section_mask_): New data member.
63         (Dwp_output_file::add_output_section): New member function.
64         (Dwp_output_file::write_new_section): New member function.
65         (Dwp_output_file::write_contributions): New member function.
66         (Dwp_output_file::section_id_map_): New data member.
67         (class Dwo_id_info_reader): Remove.
68         (class Unit_reader): New class.
69         (get_dwarf_section_name): New function.
70         (Dwo_file::read_executable): Adjust initializations of class data.
71         (Dwo_file::read): Add support for v2 package file format.
72         (Dwo_file::read_unit_index): Likewise.
73         (Dwo_file::sized_read_unit_index): Likewise.
74         (Dwo_file::copy_section): Likewise.
75         (Dwo_file::add_unit_set): Likewise.
76         (Dwp_output_file::add_output_section): Likewise.
77         (Dwp_output_file::add_contribution): Likewise.
78         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
79         for empty slot.
80         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
81         file format.
82         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
83         slot.
84         (Dwp_output_file::initialize): Remove unused function.
85         (Dwp_output_file::finalize): Add support for v2 package file format.
86         (Dwp_output_file::write_index): Likewise.
87         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
88         function prototype.
89
90 2013-10-31  Cary Coutant  <ccoutant@google.com>
91
92         * configure.ac: Fix check for -fmerge-constants.
93         * configure.ac: Regenerate.
94
95 2013-10-30  Roland McGrath  <mcgrathr@google.com>
96
97         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
98         Correct 9-byte nop sequence to match what the assembler generates.
99
100 2013-10-30  Alan Modra  <amodra@gmail.com>
101
102         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
103         ppc64_local_entry_offset, ppc64_local_entry_offset,
104         do_read_symbols): New functions.
105         (Powerpc_relobj::e_flags_, st_other_): New vars.
106         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
107         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
108         (Powerpc_relobj::e_flags_): New var.
109         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
110         and adjust for ELFv2.
111         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
112         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
113         (Powerpc_dynobj::do_find_special_sections): Likewise.
114         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
115         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
116         to ELFv2 local entry.
117         (Target_powerpc::do_relax): No thread safe barriers needed for
118         ELFv2.
119         (Output_data_plt_powerpc::initial_plt_entry_size_,
120         plt_entry_size): Delete.  Replace all uses with
121         first_plt_entry_offset() and plt_entry_size().
122         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
123         reserved_size parm.  Update callers.
124         (Output_data_plt_powerpc::entry_count): Update.
125         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
126         and use Target_powerpc::first_plt_entry_offset().
127         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
128         rename to plt_entry_size.
129         (Output_data_plt_powerpc::add_ifunc_entry,
130         add_local_ifunc_entry): Adjust reloc for ELFv2.
131         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
132         (glink_eh_frame_fde_64v2): New.
133         (Stub_table::plt_call_size): Support ELFv2 sizing.
134         (Output_data_glink::add_eh_frame): Use the new FDE.
135         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
136         (Stub_table::do_write): Write ELFv2 stubs and glink.
137         (Target_powerpc::Relocate::relocate): Replaces nop after call
138         with ld 2,24(1) and adjust local offset destination for ELFv2.
139
140 2013-10-30  Alan Modra  <amodra@gmail.com>
141
142         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
143         (Target_powerpc::Scan::global, local): Likewise.
144         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
145         on all ppc64 @h and @ha relocs.
146
147 2013-10-14  Alan Modra  <amodra@gmail.com>
148
149         * output.h (Output_data_got::add_constant): Tidy.
150         (Output_data_got::add_constant_pair): New function.
151         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
152         methods used so as to first call reserve_ent().
153
154 2013-10-11  Roland McGrath  <mcgrathr@google.com>
155
156         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
157         add_got_entry and add_got_entry_pair.
158
159         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
160         (HAVE_PUBNAMES): Likewise.
161         * configure: Regenerate.
162
163         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
164         * testsuite/Makefile.in: Regenerate.
165
166         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
167         Remove const from declaration.
168         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
169         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
170         * output.h (Output_file_header): Remove const from member target_
171         and corresponding constructor argument.
172         * output.cc (Output_file_header::Output_file_header): Update prototype.
173         (Output_file_header::do_sized_write): Use this->target_ in place
174         of parameters()->target().
175
176         * testsuite/undef_symbol.cc (Foo::get_a): New method.
177
178         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
179         * configure: Regenerate.
180         * Makefile.in: Regenerate.
181         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
182         * testsuite/merge_string_literals_2.c: Likewise.
183         * testsuite/Makefile.am
184         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
185         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
186         literal -fmerge-constants.
187         * testsuite/Makefile.in: Regenerate.
188
189         * i386.cc (Target_i386): Remove unused member dynbss_.
190         * arm.cc (Target_arm): Likewise.
191         * powerpc.cc (Target_powerpc): Likewise.
192         * sparc.cc (Target_sparc): Likewise.
193         * tilegx.cc (Target_tilegx): Likewise.
194         * x86_64.cc (Target_x86_64): Likewise.
195         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
196         type_signature_, type_offset_.
197         * plugin.h (Plugin_hook): Remove unused member layout_.
198         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
199         mapfile_.
200         (Read_member): Remove unused members input_objects_, symtab_,
201         mapfile_, layout_.
202         (Check_library): Remove unused member symtab_.
203         * archive.h (Lib_group): Remove unused member lib_.
204         * archive.cc (Lib_group::Lib_group): Update initializer.
205         * incremental.h (Incremental_binary): Remove unused member target_.
206         (Incremental_script_entry): Removed unused member script_.
207         * layout.h (Write_symbols_task): Remove unused member input_objects_.
208         * icf.h (Icf): Remove unused member num_tracked_relocs.
209
210         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
211         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
212         its only use.
213         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
214
215         * archive.h: Use struct rather than class for forward declaration
216         of Read_symbols_data.
217
218 2013-10-07  Cary Coutant  <ccoutant@google.com>
219
220         PR gold/16010
221         * testsuite/Makefile.am (icf_test): Fix dependencies.
222         (icf_safe_test): Likewise.
223         (icf_safe_so_test): Likewise.
224         (large_symbol_alignment): Add empty _LDADD rule.
225         * testsuite/Makefile.in: Regenerate.
226
227 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
228
229         PR gold/15927
230         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
231         relocation for R_X86_64_32 on x32.
232
233 2013-08-27  Roland McGrath  <mcgrathr@google.com>
234
235         * output.cc (Output_segment::set_section_addresses): Take new
236         Target* argument.  If target->isolate_execinstr() and the segment
237         is executable and starts at a target->abi_pagesize() boundary,
238         pad its end out to a target->abi_pagesize() boundary with code fill.
239         * output.h (Output_segment::set_section_addresses): Update decl.
240         * layout.h (Layout::check_output_data_for_reset_values): Take new
241         argument RELAX_OUTPUTS.
242         (Layout): New member relax_output_list_.
243         (Layout::add_relax_output): New method.
244         * layout.cc (Layout::Layout): Update constructor.
245         (Layout::reset_relax_output): New method.
246         (Layout::clean_up_after_relaxation): Call it.
247         (Layout::prepare_for_relaxation): Update caller.
248         (Layout::set_segment_offsets): Update callers of set_section_addresses.
249         Call reset_relax_output before re-processing segments for
250         isolate_execinstr case.
251         (Layout::write_data): Handle relax_output_list_.
252         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
253         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
254
255 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
256
257         PR binutils/15834
258         * object.h: Fix typos.
259
260 2013-08-16  Roland McGrath  <mcgrathr@google.com>
261
262         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
263         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
264
265 2013-08-07  Cary Coutant  <ccoutant@google.com>
266
267         Revert support for v2 DWP files:
268
269         2013-03-01  Cary Coutant  <ccoutant@google.com>
270
271             Add dwp support for v2 DWARF package file format.
272             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
273             tu_length parameter.  Adjust all callers.
274             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
275             * dwp.cc: Include dwarf.h.
276             (Section_bounds): New struct type.
277             (Unit_set): New struct type.
278             (Dwo_file::Dwo_file): Initialize new data member.
279             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
280             Combine and rename to...
281             (Dwo_file::read_unit_index): ...this.
282             (Dwo_file::sized_read_compunit_index)
283             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
284             (Dwo_file::sized_read_unit_index): ...this.
285             (Dwo_file::copy_section): Remove section_name, is_str_offsets
286             parameters; add section_id parameter.
287             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
288             (Dwo_file::add_unit_set): ...this.
289             (Dwo_file::shndx_map_): Remove.
290             (Dwo_file::sect_offsets_): New data member.
291             (Dwp_output_file::Dwp_output_file): Initialize new data members.
292             (Dwp_output_file::add_section): Rename to...
293             (Dwp_output_file::add_contribution): ...this.
294             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
295             (Dwp_output_file::add_tu_set): Likewise.
296             (Dwp_output_file::Contribution): New type.
297             (Dwp_output_file::Section::contributions): New data member.
298             (Dwp_output_file::Cu_or_tu_set): Remove.
299             (Dwp_output_file::Section::Section): New ctor.
300             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
301             (Dwp_output_file::Dwp_index::Section_table): New type.
302             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
303             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
304             parameter.
305             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
306             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
307             (Dwp_output_file::Dwp_index::section_table): New member function.
308             (Dwp_output_file::Dwp_index::section_table_end): New member function.
309             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
310             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
311             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
312             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
313             (Dwp_output_file::Dwp_index::section_table_): New data member.
314             (Dwp_output_file::Dwp_index::section_mask_): New data member.
315             (Dwp_output_file::add_output_section): New member function.
316             (Dwp_output_file::write_new_section): New member function.
317             (Dwp_output_file::write_contributions): New member function.
318             (Dwp_output_file::section_id_map_): New data member.
319             (class Dwo_id_info_reader): Remove.
320             (class Unit_reader): New class.
321             (get_dwarf_section_name): New function.
322             (Dwo_file::read_executable): Adjust initializations of class data.
323             (Dwo_file::read): Add support for v2 package file format.
324             (Dwo_file::read_unit_index): Likewise.
325             (Dwo_file::sized_read_unit_index): Likewise.
326             (Dwo_file::copy_section): Likewise.
327             (Dwo_file::add_unit_set): Likewise.
328             (Dwp_output_file::add_output_section): Likewise.
329             (Dwp_output_file::add_contribution): Likewise.
330             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
331             for empty slot.
332             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
333             file format.
334             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
335             slot.
336             (Dwp_output_file::initialize): Remove unused function.
337             (Dwp_output_file::finalize): Add support for v2 package file format.
338             (Dwp_output_file::write_index): Likewise.
339             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
340             function prototype.
341
342 2013-07-31  Cary Coutant  <ccoutant@google.com>
343
344         * object.cc (Sized_relobj::do_output_section_address): New function.
345         (Sized_relobj): Instantiate explicitly.
346         * object.h (Object::output_section_address): New function.
347         (Object::do_output_section_address): New function.
348         (Sized_relobj::do_output_section_address): New function.
349         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
350
351 2013-07-30  Cary Coutant  <ccoutant@google.com>
352             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
353
354         * parameters.cc (Parameters::entry): Return target-specific entry
355         symbol name.
356         * target.h (Target::entry_symbol_name): New function.
357         (Target_info::entry_symbol_name): New data member.
358
359         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
360         * i386.cc (Target_i386::i386_info): Likewise.
361         (Target_i386_nacl::i386_nacl_info): Likewise.
362         * sparc.cc (Target_sparc::sparc_info): Likewise.
363         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
364         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
365         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
366         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
367
368 2013-07-22  Sterling Augustine  <saugustine@google.com>
369
370         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
371         Convert parameter shndx to local variable. Add parameters symtab
372         and symtab_size.  Scan over section names.  Find relocation
373         section corresponding to current section.  Create and initialize
374         reloc_mapper_ and reloc_type_.
375         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
376         unit_length to off_t.  Initialize member unit_length_.  Fill in field
377         cu_offset_.
378         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
379         Initialize new fields unit_length_ and cu_offset_.
380         (Dwarf_pubnames_table::read_section): Update prototype.
381         (Dwarf_pubnames_table::cu_offset): New member function.
382         (Dwarf_pubnames_table::subsection_size): Likewise.
383         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
384         New fields.
385         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
386         member functions public.
387         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
388         Update comment.  Rework logic.  Move repeated parts to...
389         (Gdb_index_info_reader::read_pubtable): ...here. New function.
390         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
391         pubtypes_table_, and stmt_list_offset.
392         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
393         Gdb_index::find_pubtype_offset,
394         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
395         (Gdb_index::pubnames_read): Update prototype and rework logic.
396         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
397         Forward declare.
398         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
399         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
400         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
401         Gdb_index::map_pubtable_to_dies):
402         Declare functions.
403         (Gdb_index::pubnames_read): Update declaration.
404         (Gdb_index::Pubname_offset_map): New type.
405         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
406         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
407         Gdb_index::stmt_list_offset): Declare.
408         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
409         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
410         Gdb_index::pubtypes_offset_): Remove.
411
412 2013-07-19  Roland McGrath  <mcgrathr@google.com>
413
414         * options.h (General_options): Add -Trodata-segment option.
415         * parameters.cc (Parameters::check_rodata_segment): New function.
416         (Parameters::set_target_once): Call it.
417         * parameters.h (Parameters): Declare it (private member function).
418         * layout.cc (load_seg_unusable_for_headers): New function, broken
419         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
420         then validate rodata segment rather than text segment.
421         (relaxation_loop_body): Call that.
422         (is_text_segment): New function.  Don't admit a non-executable
423         segment if TARGET->isolate_execinstr().
424         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
425
426 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
427
428         PR gold/15070
429         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
430         * nacl.h (Sniff_file::View::View): Request aligned view.
431
432 2013-07-11  Cary Coutant  <ccoutant@google.com>
433
434         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
435         correct BRLT entry size.
436
437 2013-07-03  Alan Modra  <amodra@gmail.com>
438
439         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
440         comment.
441
442 2013-07-01  Cary Coutant  <ccoutant@google.com>
443
444         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
445         reloc_type_.
446         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
447         (Dwarf_ranges_table::lookup_reloc): New function.
448         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
449         reloc_type_.
450         (Dwarf_ranges_table::lookup_reloc): New function.
451         (Dwarf_ranges_table::reloc_type_): New data member.
452
453 2013-06-27  Jing Yu  <jingyu@google.com>
454
455         PR gold/15662
456         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
457         function.
458         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
459         (Target_powerpc::do_relax): Call the above.
460
461 2013-06-27  Cary Coutant  <ccoutant@google.com>
462
463         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
464         on garbage collected .opd section.
465
466 2013-06-27  Alan Modra  <amodra@gmail.com>
467
468         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
469         is non-zero.
470         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
471         (Target_powerpc::do_function_location): Likewise for loc->shndx.
472
473 2013-06-14  Cary Coutant  <ccoutant@google.com>
474
475         * resolve.cc (Symbol::override_base): Don't override st_type
476         from plugin placeholder symbols.
477         (Symbol_table::resolve): Likewise.
478         (Symbol_table::should_override): Don't complain about TLS mismatch
479         if the TO symbol is a plugin placeholder.
480         * testsuite/Makefile.am (plugin_test_tls): New test.
481         * testsuite/Makefile.in: Regenerate.
482         * testsuite/plugin_test_tls.sh: New test script.
483         * testsuite/two_file_test_2_tls.cc: New test source.
484         * testsuite/two_file_test_tls.cc: New test source.
485
486 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
487
488         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
489         the maximum segment alignment is larger than the page size.
490         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
491         correctly aligns the symbols with large alignemnt.
492         * testsuite/Makefile.in: Regenerate.
493         * testsuite/large_symbol_alignment.cc: New file.
494
495 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
496             Sriraman Tallam  <tmsriram@google.com>
497
498         * options.h (sort_section): New option.
499         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
500         Rename from Input_section_sort_section_name_special_ordering_compare.
501         (Input_section_sort_section_name_compare): New struct.
502         * output.cc (Output_section::Input_section_sort_section_name_compare::
503         operator()): New function.
504         (Output_section::sort_attached_input_sections): Use new sort function
505         for .text if --sort-section=name is specified.
506         * layout.cc (Layout::make_output_section):
507         Add sorting by name when --sort-section=name is specified.
508         * testsuite/Makefile.am (text_section_grouping): Test option
509         --sort-section=name.
510         * testsuite/Makefile.in: Regenerate.
511         * testsuite/section_sorting_name.cc: New file.
512         * testsuite/section_sorting_name.sh: New file.
513
514 2013-05-21  Cary Coutant  <ccoutant@google.com>
515
516         * symtab.h (Symbol::is_cxx_vtable): New function.
517         * target-reloc.h (relocate_section): Check for vtable symbol.
518         * testsuite/Makefile.am (missing_key_func.sh): New test case.
519         * testsuite/Makefile.in: Regenerate.
520         * testsuite/missing_key_func.cc: New test source.
521         * testsuite/missing_key_func.sh: New test script.
522
523 2013-05-21  Cary Coutant  <ccoutant@google.com>
524
525         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
526         type of enclosing symbol.
527         (Relocate_info::location): Check symbol type when describing symbol.
528         * object.h (Symbol_location_info): Remove unused line_number;
529         add enclosing_symbol_type.
530         * testsuite/debug_msg.sh: Adjust expected output.
531
532 2013-05-13  Cary Coutant  <ccoutant@google.com>
533
534         * configure.ac: Export DEFAULT_TARGET.
535         * configure: Regenerate.
536         * Makefile.in: Regenerate.
537         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
538         * testsuite/Makefile.in: Regenerate.
539         * testsuite/debug_msg.sh: Delete duplicate tests.
540         Don't check undef_int error message match for powerpc where the
541         source file and line number aren't available.
542
543 2013-05-10  Roland McGrath  <mcgrathr@google.com>
544
545         * options.h (General_options): Add --rosegment-gap option.
546         * options.cc (finalize): --rosegment-gap implies --rosegment.
547         * layout.cc (set_segment_offsets): Let user option override
548         target->rosegment_gap().
549
550 2013-05-10  Roland McGrath  <mcgrathr@google.com>
551
552         * options.h (General_options): Remove leading space from help
553         messages for -nostdlib and --rosegment.
554
555 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
556
557         PR ld/15365
558         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
559
560 2013-05-03  Alan Modra  <amodra@gmail.com>
561
562         * merge.cc (Output_merge_string::do_add_input_section): Correct
563         scan for number of strings.  Rename vars to avoid shadowing.
564         Include missing terminator in input_size_.
565
566 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
567
568         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
569         Restore empty string handling.
570
571 2013-05-01  Cary Coutant  <ccoutant@google.com>
572
573         * stringpool.cc (Stringpool_template::new_key_offset): Fix
574         uninitialized warning.
575
576 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
577
578         * output.cc (Output_section::add_merge_input_section): Allow
579         to merge sections if the alignment is more than character size.
580         * merge.h (Output_merge_string::Output_merge_string): Remove
581         assert.
582         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
583         only not-null strings. Check the alignment of strings.
584         * stringpool.h
585         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
586         alignment as the argument.
587         (Stringpool_template<Stringpool_char>::addralign_): New class member.
588         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
589         Align non-zero length strings according to the addralign_.
590         (Stringpool_template<Stringpool_char>::set_string_offsets):
591         Updating offsets according to the given alignment.
592         * testsuite/Makefile.am (text_section_grouping): Test if string
593         literals are getting merged.
594         * testsuite/Makefile.in: Regenerate.
595         * testsuite/merge_string_literals_1.c: New file.
596         * testsuite/merge_string_literals_2.c: Ditto.
597         * testsuite/merge_string_literals.sh: Ditto.
598
599 2013-04-26  Ian Lance Taylor  <iant@google.com>
600
601         * target-reloc.h (relocate_section): If the reloc offset is out of
602         range, pass VIEW as NULL to relocate.relocate.
603         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
604         * i386.cc (Target_i386::Relocate::relocate): Likewise.
605         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
606         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
607         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
608         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
609
610 2013-04-26  Geoff Pike  <gpike@chromium.org>
611
612         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
613         * layout.cc (Hash_task): New class.
614         (Layout::queue_build_id_tasks): New function.
615         (Layout::write_build_id): Handle single-thread portion of build ID
616         computation.  (In some cases, all of it is single-threaded.)  Replace
617         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
618         functionality in fewer lines of code.
619         * layout.h (Layout::queue_build_id_tasks): New function declaration.
620         * options.h (General_options): make "--build-id" default to tree
621         rather than sha1.  Add two new options related to --build-id=tree:
622         --build-id-chunk-size-for-treehash and
623         --build-id-min-file-size-for-treehash.
624         * Makefile.am: add testing of --build-id=tree and related new options
625         (these tests will be invoked by "make check").
626         * Makefile.in: Regenerate.
627
628 2013-04-25  Alan Modra  <amodra@gmail.com>
629
630         * configure.tgt: Add powerpcle and powerpc64le.
631
632 2013-04-22  Alan Modra  <amodra@gmail.com>
633
634         PR gold/15355
635         * layout.cc (Layout::segment_precedes): Allow more than one
636         segment with the same type and flags.
637
638 2013-04-15  Cary Coutant  <ccoutant@google.com>
639
640         * layout.cc (Layout::set_relocatable_section_offsets): Don't
641         allocate space in file for BSS sections.
642
643 2013-04-15  Cary Coutant  <ccoutant@google.com>
644
645         * script-sections.cc (Orphan_output_section): Reset address
646         to zero after each orphaned section for relocatable links.
647
648 2013-04-15  Cary Coutant  <ccoutant@google.com>
649
650         * symtab.cc (Symbol_table::sized_write_globals): Subtract
651         section starting address for relocatable link.
652         * testsuite/Makefile.am (script_test_11): New test.
653         * testsuite/Makefile.in: Regenerate.
654         * testsuite/script_test_11.c: New source file.
655         * testsuite/script_test_11.t: New linker script.
656
657 2013-04-13  Alan Modra  <amodra@gmail.com>
658
659         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
660         owner when sections are not adjacent and exceed group size.
661         (Target_powerpc::group_sections): Handle corner case.
662         (Target_powerpc::Branch_info::make_stub): Handle case where
663         stub table doesn't exist due to branches in non-exec sections.
664         (Target_powerpc::Relocate::relocate): Likewise.
665
666 2013-04-11  Alan Modra  <amodra@gmail.com>
667
668         PR gold/15354
669         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
670         .branch_lt to match bfd ld.  Adjust comments throughout file.
671
672 2013-04-04  Ian Lance Taylor  <iant@google.com>
673
674         GCC PR c++/56840
675         * object.cc (do_layout_deferred_sections): Handle .eh_frame
676         sections before checking whether they are included in the link.
677
678 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
679
680         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
681         object before calling the plugin claim_file handler.  Pass the elf
682         object of the archive to the plugin. Delete the elf object if the
683         plugin claims the file.
684
685 2013-03-21  Alan Modra  <amodra@gmail.com>
686
687         * layout.cc (Layout::set_segment_offsets): Accept writable .text
688         segment when omagic.
689
690 2013-03-21  Alan Modra  <amodra@gmail.com>
691
692         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
693         comparison warning.
694         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
695         uninitialized" warning.
696
697 2013-03-20  Alan Modra  <amodra@gmail.com>
698
699         * symtab.h (Symbol::clear_version): New function.
700         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
701         is_needed by weak references.  Clear version for symbols defined
702         in as-needed objects that are not needed.
703
704 2013-03-15  Alan Modra  <amodra@gmail.com>
705
706         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
707         static and public.  Add report_err param.  Return false for data refs.
708         (Target_powerpc::rela_dyn_section): New overloaded function.
709         (Target_powerpc::plt_, iplt_): Elucidate.
710         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
711         (Output_data_plt_powerpc::do_write): Don't write .iplt.
712         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
713         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
714         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
715         push_branch and make_plt_entry for ifunc syms when
716         reloc_needs_plt_for_ifunc.
717         (Target_powerpc::Relocate::relocate): Don't use plt entry value
718         for ifunc unless reloc_needs_plt_for_ifunc.
719
720 2013-03-15  Alan Modra  <amodra@gmail.com>
721
722         * gc.h (gc_process_relocs): Don't look through function descriptors.
723         * icf.cc (get_section_contents): Do so here instead.
724
725 2013-03-13  Alan Modra  <amodra@gmail.com>
726
727         * powerpc.cc (is_branch_reloc): Forward declare.
728         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
729         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
730         false for 64-bit, true for 32-bit non-branch relocs.
731         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
732         * testsuite/Makefile.am (icf_test): Use linker map file instead of
733         nm output.
734         (icf_safe_test): Generate linker map file as well as nm output.
735         (icf_safe_so_test): Likewise.
736         * testsuite/Makefile.in: Regenerate.
737         * testsuite/icf_test.sh: Parse linker map file to determine
738         section folding.
739         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
740         * testsuite/icf_safe_so_test.sh: Likewise.
741         (X86_32_or_ARM_specific_safe_fold): Merge into..
742         (arch_specific_safe_fold): ..this.
743         (X86_64_specific_safe_fold): Delete unused function.
744
745 2013-03-12  Alan Modra  <amodra@gmail.com>
746
747         * gc.h (gc_process_relocs): Look through function descriptors
748         to determine shndx, symvalue and addend used by ICF.  Tidy
749         variable duplication.
750
751 2013-03-11  Alan Modra  <amodra@gmail.com>
752
753         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
754         * layout.cc (Layout_task_runner::run): ..to here.
755         * symtab.h (struct Symbol_location): Extract from..
756         (class Symbol_table): ..here.
757         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
758         * target.h (class Target): Add function_location and
759         do_function_location functions.
760         (class Sized_target): Add do_function_location.
761         * object.h (class Sized_relobj_file): Move find_shdr..
762         (class Object): ..to here.
763         * object.cc: Likewise.  Update to suit.  Instantiate.
764         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
765         * powerpc.cc (class Powerpc_dynobj): New.
766         (Target_powerpc::do_function_location): New function.
767         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
768         (Powerpc_dynobj::do_read_symbols): New function.
769         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
770
771 2013-03-08  Ian Lance Taylor  <iant@google.com>
772
773         * options.cc (General_options::string_to_object_format): Accept
774         "default".
775
776 2013-03-08  Alan Modra  <amodra@gmail.com>
777
778         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
779         pointer to Post_fde.
780         (struct Post_fde): Move definition to here..
781         * ehframe.cc (struct Post_fde): ..from here.
782         (Cie::write): Don't alloc Post_fde.
783         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
784
785 2013-03-07  Alan Modra  <amodra@gmail.com>
786
787         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
788         relocation referencing .LC0.
789         * testsuite/discard_locals_test.sh: Remove FIXMEs.
790
791 2013-03-07  Alan Modra  <amodra@gmail.com>
792
793         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
794         always_inline.  Add assembly for powerpc to avoid GOT.
795
796 2013-03-07  Alan Modra  <amodra@gmail.com>
797
798         * testsuite/script_test_10.sh: Don't test .bss section
799         header number.
800
801 2013-03-06  Alan Modra  <amodra@gmail.com>
802
803         * powerpc.cc (class Powerpc_relobj): Move some member functions.
804         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
805         all callers.  Handle folded sections.
806         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
807         to Powerpc_relobj.
808         (Global_symbol_visitor_opd::operator()): Likewise.
809
810 2013-03-04  Alan Modra  <amodra@gmail.com>
811
812         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
813         * testsuite/Makefile.in: Regenerate.
814
815 2013-03-01  Cary Coutant  <ccoutant@google.com>
816
817         Add dwp support for v2 DWARF package file format.
818         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
819         tu_length parameter.  Adjust all callers.
820         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
821         * dwp.cc: Include dwarf.h.
822         (Section_bounds): New struct type.
823         (Unit_set): New struct type.
824         (Dwo_file::Dwo_file): Initialize new data member.
825         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
826         Combine and rename to...
827         (Dwo_file::read_unit_index): ...this.
828         (Dwo_file::sized_read_compunit_index)
829         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
830         (Dwo_file::sized_read_unit_index): ...this.
831         (Dwo_file::copy_section): Remove section_name, is_str_offsets
832         parameters; add section_id parameter.
833         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
834         (Dwo_file::add_unit_set): ...this.
835         (Dwo_file::shndx_map_): Remove.
836         (Dwo_file::sect_offsets_): New data member.
837         (Dwp_output_file::Dwp_output_file): Initialize new data members.
838         (Dwp_output_file::add_section): Rename to...
839         (Dwp_output_file::add_contribution): ...this.
840         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
841         (Dwp_output_file::add_tu_set): Likewise.
842         (Dwp_output_file::Contribution): New type.
843         (Dwp_output_file::Section::contributions): New data member.
844         (Dwp_output_file::Cu_or_tu_set): Remove.
845         (Dwp_output_file::Section::Section): New ctor.
846         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
847         (Dwp_output_file::Dwp_index::Section_table): New type.
848         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
849         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
850         parameter.
851         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
852         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
853         (Dwp_output_file::Dwp_index::section_table): New member function.
854         (Dwp_output_file::Dwp_index::section_table_end): New member function.
855         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
856         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
857         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
858         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
859         (Dwp_output_file::Dwp_index::section_table_): New data member.
860         (Dwp_output_file::Dwp_index::section_mask_): New data member.
861         (Dwp_output_file::add_output_section): New member function.
862         (Dwp_output_file::write_new_section): New member function.
863         (Dwp_output_file::write_contributions): New member function.
864         (Dwp_output_file::section_id_map_): New data member.
865         (class Dwo_id_info_reader): Remove.
866         (class Unit_reader): New class.
867         (get_dwarf_section_name): New function.
868         (Dwo_file::read_executable): Adjust initializations of class data.
869         (Dwo_file::read): Add support for v2 package file format.
870         (Dwo_file::read_unit_index): Likewise.
871         (Dwo_file::sized_read_unit_index): Likewise.
872         (Dwo_file::copy_section): Likewise.
873         (Dwo_file::add_unit_set): Likewise.
874         (Dwp_output_file::add_output_section): Likewise.
875         (Dwp_output_file::add_contribution): Likewise.
876         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
877         for empty slot.
878         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
879         file format.
880         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
881         slot.
882         (Dwp_output_file::initialize): Remove unused function.
883         (Dwp_output_file::finalize): Add support for v2 package file format.
884         (Dwp_output_file::write_index): Likewise.
885         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
886         function prototype.
887
888 2013-03-01  Cary Coutant  <ccoutant@google.com>
889
890         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
891         function into class definition in header file.
892         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
893         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
894         New function.
895         (Dwarf_info_reader::check_buffer): Move here from .cc file.
896
897 2013-02-28  Alan Modra  <amodra@gmail.com>
898
899         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
900         * target.cc (Target::do_plt_fde_location): New function.
901         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
902         accessor function, and constructor param.
903         (struct Post_fde, Post_fdes): Declare.
904         (Cie::write): Add post_fdes param.
905         * ehframe.cc (Fde::write): Use plt_fde_location.
906         (struct Post_fde): Define.
907         (Cie::write): Stash FDEs added post merge mapping.
908         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
909         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
910         (Eh_frame::do_sized_write): Arrange to write post map FDES after
911         other FDEs.
912         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
913         (Target_powerpc::has_glink): New function.
914         (Target_powerpc::do_relax): Add eh_frame info for stubs.
915         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
916         glink_eh_frame_fde_32, default_fde): New data.
917         (Stub_table::eh_frame_added_): New var.
918         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
919         Make const.
920         (Stub_table::add_eh_frame): New function.
921         (Output_data_glink::add_eh_frame): New function.
922         (Target_powerpc::make_glink_section): Call add_eh_frame.
923
924 2013-02-15  Ian Lance Taylor  <iant@google.com>
925
926         * options.h (DEFINE_uint64_alias): Define.
927         (class General_options): Add -Ttext-segment as an alias for
928         -Ttext.
929
930 2013-02-15  Alan Modra  <amodra@gmail.com>
931
932         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
933         (Stub_table::do_write): ..here, two places.
934         (Stub_table::plt_call_size): Use it here too.
935
936 2013-02-11  Ian Lance Taylor  <iant@google.com>
937
938         * descriptors.cc (Descriptors::close_all): New function.
939         * descriptors.h (class Descriptors): Declare close_all.
940         (close_all_descriptors): New inline function.
941         * plugin.cc: Include "descriptors.h".
942         (Plugin_manager::cleanup): Call close_all_descriptors.
943
944 2013-02-06  Alan Modra  <amodra@gmail.com>
945
946         * README: Update coding style link.
947
948 2013-01-28  Cary Coutant  <ccoutant@google.com>
949
950         * dwp.cc (File_list): New typedef.
951         (Dwo_name_info_reader): New class.
952         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
953         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
954         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
955         (Dwo_file::read_executable): New function.
956         (Dwo_file::read): Move common setup code to ...
957         (Dwo_file::make_object): ... here.
958         (dwp_options): Add --exec/-e.
959         (usage): Likewise.
960         (main): Likewise.
961
962 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
963
964         * layout.cc (Layout::layout): Check for option text_reorder.
965         (Layout::make_output_section): Ditto.
966         * options.h (text_reorder): New option.
967         * output.cc (Input_section_sort_compare): Remove special ordering
968         of section names.
969         (Output_section::
970          Input_section_sort_section_name_special_ordering_compare::
971          operator()): New function.
972         (Output_section::sort_attached_input_sections): Use new sort function
973         for .text.
974         * output.h (Input_section_sort_section_name_special_ordering_compare):
975         New struct.
976         * testsuite/Makefile.am (text_section_grouping): Test option
977         --no-text-reorder
978         * testsuite/Makefile.in: Regenerate.
979         * testsuite/text_section_grouping.sh: Check order of functions without
980         default text reordering.
981
982 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
983
984         * options.h (General_options): Change default to true for new_dtags.
985
986 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
987
988         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
989         when enable_new_dtags is false.  Only add DT_RUNPATH when
990         enable_new_dtags is true.
991
992 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
993
994         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
995         used in declaration and definition consistent.
996         (Target_powerpc::symval_for_branch): Ditto.
997
998 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
999
1000         * testsuite/plugin_final_layout.cc: Fix comment.
1001
1002 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1003
1004         * layout.cc (Layout::layout): Do not do default sorting for
1005         text sections when section ordering is specified.
1006         (make_output_section): Ditto.
1007         * testsuite/plugin_final_layout.cc: Name the function sections
1008         to catch reordering issues.
1009
1010 2013-01-15  Alan Modra  <amodra@gmail.com>
1011
1012         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1013         plt-thread-safe.
1014
1015 2013-01-15  Alan Modra  <amodra@gmail.com>
1016
1017         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1018         * testsuite/Makefile.in: Regenerate.
1019
1020 2013-01-14  Alan Modra  <amodra@gmail.com>
1021
1022         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1023         * testsuite/Makefile.in: Regenerate.
1024
1025 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1026
1027         PR bfd/14430
1028         Fix mingw gold build with plugins enabled
1029         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1030         * configure.ac: Export DLOPEN_LIBS and add headers check.
1031         * plugin.cc: Handle non-dlfcn case.
1032         * Makefile.in: Regenerate.
1033         * config.in: Regenerate.
1034         * configure: Regenerate.
1035         * testsuite/Makefile.in: Regenerate.
1036
1037 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1038
1039         * output.h (sort_attached_input_sections): Change to be public.
1040         * script-sections.cc
1041         (Output_section_definition::set_section_addresses): Sort
1042         attached input sections according to section order before linker
1043         script assigns section addresses.
1044         (Orphan_output_section::set_section_addresses): Sort
1045         attached input sections according to section order before linker
1046         script assigns section addresses.
1047         * Makefile.am (final_layout.sh): Use a simple linker script to
1048         check if section ordering still works.
1049         * Makefile.in: Regenerate.
1050
1051 2013-01-09  Ben Cheng  <bccheng@google.com>
1052
1053         * arm.cc (Target_arm::attributes_accept_div): New function.
1054         (Target_arm::attributes_forbid_div): New function.
1055         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1056         attribute using the same new functions as what bfd/elf32_arm.c
1057         does.
1058
1059 2013-01-07  Cary Coutant  <ccoutant@google.com>
1060
1061         PR gold/14993
1062         * output.cc (Output_section::add_input_section): For incremental
1063         updates, don't track input sections that are allocated from patch
1064         space.
1065
1066 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1067             Ian Lance Taylor  <iant@google.com>
1068
1069         PR gold/14897
1070         * configure.ac (--enable-ld): Removed.
1071         (install_as_default): Set to yes only for --enable-gold=default
1072         or --disable-ld.
1073         * configure: Regenerated.
1074
1075 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1076
1077         * options.h (General_options): Add -fuse-ld= for GCC linker
1078         option compatibility.
1079
1080 2013-01-04  Cary Coutant  <ccoutant@google.com>
1081
1082         * configure.ac: Fix typo restoring CXXFLAGS.
1083         * configure: Regenerate.
1084
1085 2013-01-04  Cary Coutant  <ccoutant@google.com>
1086
1087         * testsuite/Makefile.am (CXXLINK_S): New macro.
1088         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1089         * testsuite/Makefile.in: Regenerate.
1090
1091 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1092
1093         * version.cc (print_version): Update copyright year to 2013.
1094
1095 2012-12-20  Ian Lance Taylor  <iant@google.com>
1096
1097         * layout.cc (Layout::special_ordering_of_input_section): New
1098         function.
1099         (Layout::layout): If input section requires special ordering, must
1100         sort input sections.
1101         (Layout::make_output_section): May sort .text input sections.
1102         (Layout::is_section_name_prefix_grouped): Remove.
1103         * layout.h (class Layout): Declare
1104         special_ordering_of_input_section.  Don't declare
1105         is_section_name_prefix_grouped.
1106         * output.cc (Output_section::add_input_section): Revert last
1107         change.
1108         (Output_section::Input_section_sort::match_file_name): Don't crash
1109         if called on output section data.
1110         (Output_section::Input_section_sort_compare): Sort based on
1111         special ordering.
1112         (Output_section::Input_section_sort_section_order_index_compare):
1113         Revert last patch.
1114         (Output_section::sort_attached_input_sections): Likewise.
1115
1116 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1117
1118         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1119         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1120         * output.cc (Output_section::add_input_section): Check if section
1121         name contains special prefix.  Keep input sections to sort such
1122         sections.
1123         (Output_section::Input_section_sort_section_order_index_compare
1124          ::operator()): Group sections according to prefixes.
1125         (Output_section::sort_attached_input_sections): Add condition to
1126         Input_section_entry constructor call.
1127         * testsuite/Makefile.am (text_section_grouping): New test.
1128         * testsuite/Makefile.in: Regenerate.
1129         * testsuite/text_section_grouping.cc: New file.
1130         * testsuite/text_section_grouping.sh: New file.
1131
1132 2012-12-17  Nick Clifton  <nickc@redhat.com>
1133
1134         * Makefile.am: Add copyright notice.
1135         * NEWS: Likewise.
1136         * README: Likewise.
1137         * configure.ac: Likewise.
1138         * ftruncate.c: Likewise.
1139         * Makefile.in: Regenerate.
1140
1141 2012-12-14  Cary Coutant  <ccoutant@google.com>
1142
1143         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1144         --no-as-needed flag.
1145         (exception_separate_shared_12_test): Likewise.
1146         (incremental_copy_test): Likewise.
1147         * testsuite/Makefile.in: Regenerate.
1148
1149 2012-12-14  Cary Coutant  <ccoutant@google.com>
1150
1151         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1152         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1153
1154 2012-12-12  Alan Modra  <amodra@gmail.com>
1155
1156         * powerpc.cc (class Track_tls): New.
1157         (class Relocate, class Scan): Inherit Track_tls.
1158         (Target_powerpc::Scan::local, global): Track tls optimization
1159         and avoid creating plt entry for __tls_get_addr if all uses
1160         are optimized away.
1161         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1162
1163 2012-12-12  Alan Modra  <amodra@gmail.com>
1164
1165         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1166         Replace no_toc_optimize with toc_optimize.
1167         * output.h (Output_section::input_sections): Provide non-const variant.
1168         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1169         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1170         accessors.
1171         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1172         (class Sort_toc_sections): New.
1173         (Target_powerpc::do_finalize_sections): Sort toc sections.
1174         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1175
1176 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1177
1178         * testsuite/binary_unittest.cc (read_all): New function.
1179         (Sized_binary_test): Use it instead of ::read.
1180         * fileread.cc (do_read): Don't assume pread always reads the whole
1181         amount in a single call.
1182
1183 2012-12-10  Alan Modra  <amodra@gmail.com>
1184
1185         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1186         Set EM_PPC64 or EM_PPC here.
1187         (Target_selector_powerpc::do_recognize): Delete.
1188
1189 2012-12-10  Alan Modra  <amodra@gmail.com>
1190
1191         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1192         stub_table_.
1193         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1194
1195 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1196
1197         * testsuite/binary_unittest.cc (Sized_binary_test):
1198         Use open_descriptor rather than ::open.
1199
1200 2012-12-07  Alan Modra  <amodra@gmail.com>
1201
1202         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1203         typedef and invalid_address constant.
1204         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1205         instantiate constants.
1206
1207 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1208
1209         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1210         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1211         * aclocal.m4: Regenerate.
1212         * configure: Regenerate.
1213         * Makefile.in: Regenerate.
1214         * testsuite/Makefile.in: Regenerate.
1215
1216 2012-12-07  Alan Modra  <amodra@gmail.com>
1217
1218         * options.h (General_options): Add no_toc_optimize.
1219         * powerpc.cc (ok_lo_toc_insn): New function.
1220         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1221
1222 2012-12-06  Alan Modra  <amodra@gmail.com>
1223
1224         * options.h (General_options): Add plt_align, plt_static_chain,
1225         plt_thread_safe.  Update stub_group_size help text.
1226         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1227         for new plt_thread_safe_ var.
1228         (use_plt_offset): Correct comments.
1229         (Target_powerpc::do_relax): Look for thread creation symbols to
1230         determine default plt_thread_safe value.  Clear plt call stubs
1231         as well as branch stubs each iteration.
1232         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1233         insn constants.
1234         (l, hi, ha, write_insn): Move earlier.
1235         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1236         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1237         plt stubs too.
1238         (Stub_table::update_size): Adjust.
1239         (Stub_table::prev_size, set_prev_size): Delete.
1240         (Stub_table::stub_align): Let --plt-align affect result.
1241         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1242         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1243         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1244         (Stub_table::do_write): Support more stub variants.
1245
1246 2012-12-04  Alan Modra  <amodra@gmail.com>
1247
1248         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1249         (Target_powerpc::do_define_standard_symbols): New function.
1250
1251 2012-12-03  Alan Modra  <amodra@gmail.com>
1252
1253         * output.h: Formatting, whitespace.
1254
1255 2012-12-03  Alan Modra  <amodra@gmail.com>
1256
1257         * layout.h (Layout::get_executable_sections): Declare.
1258         * layout.cc (Layout::get_executable_sections): New function.
1259         * arm.cc (Target_arm::group_sections): Use it.
1260         (Arm_output_section::group_sections): Delete now redundant test.
1261         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1262         param to handle relative relocs.
1263         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1264         (Output_data_reloc::add_absolute): Adjust.
1265         (Output_data_reloc::add_relative): New function.
1266         (Output_data::reset_data_size): New function.
1267         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1268         (Output_section::set_addralign): New function.
1269         (Output_section::checkpoint_set_addralign): New function.
1270         (Output_section::clear_section_offsets_need_adjustment): New function.
1271         (Output_section::input_sections): Make public.
1272         * powerpc.cc (class Output_data_brlt_powerpc): New.
1273         (class Stub_table, class Stub_control): New.
1274         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1275         stub_table_, set_stub_table, stub_table): New vectors and accessor
1276         functions.
1277         (Target_powerpc::do_may_relax, do_relax, push_branch,
1278         new_stub_table, stub_tables, brlt_section, group_sections,
1279         add_branch_lookup_table, find_branch_lookup_table,
1280         write_branch_lookup_table, make_brlt_section): New functions.
1281         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1282         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1283         branch_info_): New vars.
1284         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1285         make call stubs here.
1286         (Output_data_glink): Remove all call stub handling from this class.
1287         (Target_powerpc::Scan::local, global): Save interesting branch
1288         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1289         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1290         functions on final link.
1291         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1292         Handle long branch destinations too.
1293         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1294         do_plt_address_for_local): Adjust lookup of plt call stubs.
1295
1296 2012-11-30  Alan Modra  <amodra@gmail.com>
1297
1298         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1299         relocs against protected symbols when building 32-bit shared libs.
1300
1301 2012-11-30  Alan Modra  <amodra@gmail.com>
1302
1303         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1304         param.  Call got_section() to make .got.  Update all callers
1305         and their callers and so on.
1306
1307 2012-11-30  Alan Modra  <amodra@gmail.com>
1308
1309         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1310         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1311         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1312         value if it already exists.
1313
1314 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1315
1316         PR gold/14858
1317         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1318
1319 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1320
1321         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1322         than bfc instruction for data sandboxing.
1323
1324 2012-11-08  Alan Modra  <amodra@gmail.com>
1325
1326         * po/POTFILES.in: Regenerate.
1327
1328 2012-11-05  Alan Modra  <amodra@gmail.com>
1329
1330         * configure.ac: Apply 2012-09-10 change to config.in here.
1331         * configure: Regenerate.
1332
1333 2012-11-05  Alan Modra  <amodra@gmail.com>
1334
1335         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1336         (struct Opd_ent): Use "Address" rather than "Offset".
1337         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1338         (Target_powerpc::got_section): Make public.
1339         (Target_powerpc::scan_relocs): Move code setting symbols..
1340         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1341         Create _SDA_BASE_ only when referenced.
1342
1343 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1344
1345         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1346         from last change.
1347
1348 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1349
1350         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1351         for offset_in_output_section parameter.
1352         (Sized_target::relocate_special_relocatable): Likewise.
1353         * arm.cc (Target_arm::relocate_relocs): Likewise.
1354         (Target_arm::relocate_special_relocatable): Likewise.
1355         * i386.cc (Target_i386::relocate_relocs): Likewise.
1356         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1357         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1358         * target-reloc.h (relocate_relocs): Likewise.
1359         * testsuite/testfile.cc (Target_test): Likewise.
1360         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1361         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1362
1363         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1364         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1365
1366         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1367         parameter, which is unused in the [!F_SETFD] case.
1368
1369         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1370         SYMNDX to off_t before comparing it to this->data_size().
1371         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1372         * incremental.cc (Output_section_incremental_inputs::do_write):
1373         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1374
1375         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1376
1377 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1378
1379         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1380         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1381         in EABI_VER5.
1382
1383 2012-10-29  Cary Coutant  <ccoutant@google.com>
1384
1385         * dwp.cc (usage): Add file and exit status parameters;
1386         add --help and --version options.
1387         (print_version): New function.
1388         (main): Add --help and --version options.
1389
1390 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1391
1392         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1393         final_layout_sequence.txt.
1394         * testsuite/Makefile.in: Regenerated.
1395
1396 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1397
1398         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1399         COMPILE generated by automake.
1400         (LINK1): Likewise.
1401         (CXXCOMPILE1): Likewise.
1402         (CXXLINK1): Likewise.
1403         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1404         (LINK): Likewise.
1405         (CXXCOMPILE): Likewise.
1406         (CXXLINK): Likewise.
1407         * testsuite/Makefile.in: Regenerated.
1408
1409 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1410
1411         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1412         on bad fwrite return.
1413
1414 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1415
1416         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1417         on val.
1418
1419 2012-10-23  Cary Coutant  <ccoutant@google.com>
1420
1421         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1422         * testsuite/Makefile.in: Regenerate.
1423         * testsuite/dwp_test.h: New source file.
1424         * testsuite/dwp_test_1.cc: New source file.
1425         * testsuite/dwp_test_1.s: New source file.
1426         * testsuite/dwp_test_1.sh: New source file.
1427         * testsuite/dwp_test_1b.cc: New source file.
1428         * testsuite/dwp_test_1b.s: New source file.
1429         * testsuite/dwp_test_2.cc: New source file.
1430         * testsuite/dwp_test_2.s: New source file.
1431         * testsuite/dwp_test_2.sh: New source file.
1432         * testsuite/dwp_test_main.cc: New source file.
1433         * testsuite/dwp_test_main.s: New source file.
1434
1435 2012-10-23  Cary Coutant  <ccoutant@google.com>
1436
1437         * dwp.h: New header file.
1438         * dwp.cc: New source file.
1439         * gold.h: Move shared declarations to system.h.
1440         * system.h: New header file.
1441         * Makefile.am: Add dwp.
1442         * Makefile.in: Regenerate.
1443
1444 2012-10-23  Cary Coutant  <ccoutant@google.com>
1445
1446         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1447         Dwarf_info_reader::read_from_pointer.
1448         (Dwarf_pubnames_table::read_header): Likewise.
1449         (Dwarf_pubnames_table::next_name): Likewise.
1450         (Dwarf_die::read_attributes): Likewise.
1451         (Dwarf_die::skip_attributes): Likewise.
1452         (Dwarf_info_reader::read_from_pointer): New function template.
1453         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1454         (Dwarf_pubnames_table): Likewise.
1455         (Dwarf_info_reader::read_from_pointer): New function template.
1456         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1457         Dwarf_pubnames_table ctor.
1458
1459 2012-10-23  Cary Coutant  <ccoutant@google.com>
1460
1461         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1462         abbrev_shndx.
1463         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1464         abbrev_shndx_.
1465         (Dwarf_info_reader::set_abbrev_shndx): New method.
1466         (Dwarf_info_reader::abbrev_shndx_): New data member.
1467
1468 2012-10-23  Cary Coutant  <ccoutant@google.com>
1469
1470         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1471         from object, not parameters.
1472         (Dwarf_info_reader::parse): Likewise.
1473         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1474         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1475         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1476         methods.
1477
1478 2012-10-23  Cary Coutant  <ccoutant@google.com>
1479
1480         * fileread.cc (Input_file::Input_file): New constructor.
1481         * fileread.h (class Input_file): Add new constructor.
1482
1483 2012-10-18  Alan Modra  <amodra@gmail.com>
1484
1485         PR gold/14727
1486         * object.cc (Relobj::is_section_name_included): Also match
1487         .sdata personality section.
1488
1489 2012-10-18  Alan Modra  <amodra@gmail.com>
1490
1491         * target-reloc.h (class Default_comdat_behavior): New, package up..
1492         (get_comdat_behaviour): ..this.
1493         (relocate_section): Add Relocate_comdat_behavior template arg,
1494         adjust code to suit.
1495         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1496         (Target_arm::scan_reloc_section): Likewise.
1497         * i386.cc (Target_i386::relocate_section): Likewise.
1498         * sparc.cc (Target_sparc::relocate_section): Likewise.
1499         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1500         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1501         * powerpc.cc (class Relocate_comdat_behavior): New.
1502         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1503         gold::relocate_section with new template arg.
1504
1505 2012-10-18  Alan Modra  <amodra@gmail.com>
1506
1507         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1508         dynamic relocs for GOT_TPREL got entries, without symbol if
1509         resolving locally.
1510         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1511         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1512         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1513
1514 2012-10-17  Alan Modra  <amodra@gmail.com>
1515
1516         PR gold/14726
1517         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1518
1519 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1520
1521         * layout.cc (Layout::include_section): Keep sections marked
1522         SHF_EXCLUDE when doing relocatable links.
1523
1524 2012-10-16  Alan Modra  <amodra@gmail.com>
1525
1526         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1527         (Target_powerpc::do_finalize_sections): Call it.
1528         (Output_data_save_res): New class and supporting functions.
1529         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1530         normal symbols defined in object files.
1531
1532 2012-10-12  Alan Modra  <amodra@gmail.com>
1533
1534         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1535         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1536         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1537         section if scan_opd_relocs not yet called.
1538         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1539
1540 2012-10-12  Alan Modra  <amodra@gmail.com>
1541
1542         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1543         add_local_ifunc_entry): Revert last change.
1544         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1545
1546 2012-10-05  Alan Modra  <amodra@gmail.com>
1547
1548         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1549         do_plt_address_for_global): New functions.
1550         (Output_data_got_powerpc::do_write): Don't segfault when linking
1551         statically.
1552         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1553         add_local_ifunc_entry): Return true on adding entry..
1554         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1555         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1556         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1557         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1558         set up symbols here.
1559         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1560         syms here.  Do so even when no .iplt.  Don't segfault when linking
1561         statically.
1562         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1563         new variants without reloc param.
1564         (Glink_sym_ent::Glink_sym_ent): Likewise.
1565         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1566         reloc when refs will resolve to plt call stub.
1567         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1568         R_PPC_PLTREL24 to resolve locally.
1569         (Target_powerpc::Scan::global): Correct ifunc handling.
1570         (Target_powerpc::Relocate::relocate): Correct local sym glink
1571         lookup.  Don't destroy "value" when we have a plt call stub,
1572         and when checking plt call validity.
1573         (Target_powerpc::do_dynsym_value): Simplify.
1574
1575 2012-10-05  Alan Modra  <amodra@gmail.com>
1576
1577         * i386.cc (Output_data_plt_i386::address_for_global,
1578         address_for_local): Add plt offset to returned value.  Adjust uses.
1579         * sparc.cc (Output_data_plt_sparc::address_for_global,
1580         address_for_local): Likewise.
1581         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1582         address_for_local): Likewise.
1583         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1584         address_for_local): Likewise.
1585         * target.h (Target::plt_address_for_global, plt_address_for_local):
1586         Update comment.
1587         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1588         (Output_data_got::Got_entry::write): Nor here.
1589         * output.h: Comment fix.
1590
1591 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1592
1593         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1594         global_offset_table_ value for larget got.
1595         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1596
1597 2012-09-29  Alan Modra  <amodra@gmail.com>
1598
1599         * powerpc.cc (Target_powerpc::iplt_): New output section.
1600         (Target_powerpc::iplt_section, make_iplt_section,
1601         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1602         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1603         Target_powerpc::plt_entry_count): Count iplt entries too.
1604         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1605         reloc section in constructor.  New params.
1606         (Target_powerpc::make_plt_section): Create reloc section here instead.
1607         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1608         functions.
1609         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1610         (Output_data_glink::add_entry, find_entry): New functions to
1611         deal with local syms.
1612         (Glink_sym_ent): Add support for local syms.
1613         (Output_data_glink::do_write): Handle ifunc plt entries.
1614         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1615         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1616         (Target_powerpc::Relocate::relocate): Likewise.
1617         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1618
1619 2012-09-25  Alan Modra  <amodra@gmail.com>
1620
1621         * object.h (Sized_relobj_file::adjust_local_symbol,
1622         do_adjust_local_symbol): New functions.
1623         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1624         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1625         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1626         and irregular opd entry spacing.
1627         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1628         (Global_symbol_visitor_opd): New functor.
1629         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1630         on deleted opd entries.
1631
1632 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1633
1634         * tilegx.cc: New file.
1635         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1636         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1637         * configure.tgt: Add entries for tilegx*.
1638         * configure.ac: Likewise.
1639         * Makefile.in: Rebuild.
1640         * configure: Likewise.
1641         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1642         tilegx.
1643
1644 2012-09-13  Alan Modra  <amodra@gmail.com>
1645
1646         * target-reloc.h (scan_relocs): Call scan.local for relocs
1647         against symbols in discarded sections.  Pass is_discarded
1648         param.
1649         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1650         Add is_discarded param.
1651         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1652         is_discarded to flag opd entry as discarded.  Don't emit dyn
1653         relocs on such entries.
1654         (Target_powerpc::Scan::global): Similarly detect and handle
1655         such opd entries.
1656         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1657         opd_ent_.  Update all uses.
1658         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1659         (Target_powerpc::relocate_section): Zero out discarded opd
1660         entry relocs.
1661
1662 2012-09-12  Ian Lance Taylor  <iant@google.com>
1663
1664         PR gold/14570
1665         * output.cc: Rename Output_data_got template parameter from size
1666         to got_size for all functions.  Compile all variants of
1667         Output_data_got.
1668         (Output_data_got::Got_entry::write): Correct use of size for
1669         symbol value.  Use local_is_tls rather than casting to
1670         Sized_relobj_file.
1671         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1672         (class Sized_relobj_file): Add do_local_is_tls.
1673         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1674
1675 2012-09-11  Alan Modra  <amodra@gmail.com>
1676
1677         PR gold/14566
1678         * layout.cc (Layout::set_segment_offsets): When using
1679         common-page-size alignment, ensure we are on a new max-page-size
1680         page.
1681         * output.cc (Output_segment::set_section_addresses): Use
1682         abi_pagesize, not common_pagesize for relro boundary.
1683         (Output_segment::set_offset): Likewise.
1684
1685 2012-09-11  Alan Modra  <amodra@gmail.com>
1686
1687         * output.h (Output_data_got::add_global_tls, add_local_tls,
1688         add_local_tls_pair): New functions.
1689         (Output_data_got::add_local_pair_with_rel): Remove second
1690         reloc param.  Expand comment.
1691         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1692         use_plt_or_tls_offset_, similarly for constructor param.
1693         (Output_data_got::Got_entry::write): Add got_index param.
1694         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1695         add_local_tls_pair): New functions.
1696         (Output_data_got::Got_entry::write): Handle tls symbols
1697         with use_plt_or_tls_offset_ set specially.
1698         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1699         (Output_data_got::do_write): Replace iterator with index, pass
1700         index to entry write function.
1701         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1702         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1703         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1704         call.
1705         * i386.cc (Target_i386::Scan::local): Likewise.
1706         * sparc.cc (Target_sparc::Scan::local): Likewise.
1707         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1708         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1709         do_tls_offset_for_global): New functions.
1710         (Target_powerpc::Scan::local): Correct TLS relocations and got
1711         entry values.
1712         (Target_powerpc::Scan::global): Don't emit unnecessary
1713         dynamic relocations on TLS GOT entries.
1714
1715 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1716
1717         * config.in: Disable sanity check for kfreebsd.
1718
1719 2012-09-10  Sterling Augustine  <saugustine@google.com>
1720
1721         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1722         (Gdb_index::pubtypes_read): New parameter.
1723         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1724         to calls.
1725         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1726         pubtypes_object_.
1727
1728 2012-09-09  Alan Modra  <amodra@gmail.com>
1729
1730         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1731         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1732         * gc.h (gc_process_relocs): Call target gc_add_reference.
1733         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1734         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1735         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1736         unnecessary cast.
1737         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1738         to cater for when we don't need code offset.  Update use.
1739         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1740         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1741         set_opd_valid): New functions.
1742         (Target_powerpc::do_gc_add_reference): New function.
1743         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1744         stashed refs.
1745         (Target_powerpc::do_gc_mark_symbol): New function.
1746
1747 2012-09-06  Cary Coutant  <ccoutant@google.com>
1748
1749         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1750         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1751         (Dwarf_die::skip_attributes): Likewise.
1752         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1753         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1754         (main): Call it.
1755         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1756
1757 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1758
1759         * testsuite/script_test_3.t: Add .got.plt output section
1760         statement.
1761         * testsuite/script_test_4.t: Likewise.
1762
1763 2012-09-05  Alan Modra  <amodra@gmail.com>
1764
1765         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1766         update all uses and lose "enum" when using type.
1767
1768 2012-09-05  Alan Modra  <amodra@gmail.com>
1769
1770         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1771         * configure: Regenerate.
1772         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1773         (plugin_final_layout.stdout): Likewise.
1774         (memory_test): Set page sizes to 0x1000.
1775         * testsuite/Makefile.in: Regenerate.
1776         * testsuite/discard_locals_test.sh: Add FIXME comment.
1777         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1778         * testsuite/pr14265.t: Add .got output section statement.
1779         * testsuite/script_test_2.t: Likewise.
1780         * testsuite/script_test_3.t: Likewise.
1781         * testsuite/script_test_4.t: Likewise.
1782         * testsuite/script_test_5.t: Likewise.
1783         * testsuite/script_test_6.t: Likewise.
1784         * testsuite/script_test_7.t: Likewise.
1785         * testsuite/script_test_9.t: Likewise.
1786
1787 2012-09-05  Alan Modra  <amodra@gmail.com>
1788
1789         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1790         (Powerpc_relocate_functions::Status): New typedef.
1791         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1792         (Target_powerpc::Scan::local): Handle REL64.
1793         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1794         for REL32 and REL64.
1795         (Target_powerpc::symval_for_branch): New function, extracted from..
1796         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1797         checks.  Report overflow errors.
1798
1799 2012-09-05  Alan Modra  <amodra@gmail.com>
1800
1801         * object.h (Sized_relobj_file::emit_relocs): Delete.
1802         (Sized_relobj_file::emit_relocs_reltype): Delete.
1803         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1804         relocate_relocs for --emit-relocs.
1805         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1806         * output.h: Update comment.
1807         (Output_segment::first_section): New function.
1808         (Output_segment::first_section_load_address): Use first_section.
1809         * output.cc (Output_segment::first_section): New function extracted..
1810         (Output_segment::first_section_load_address): ..from here.  Delete.
1811         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1812         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1813         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1814         adjust call to target.h function.
1815         * i386.cc (Target_i386): Likewise.
1816         * sparc.cc (Target_sparc): Likewise.
1817         * x86_64.cc (Target_x86_64): Likewise.
1818         * powerpc.cc (Target_powerpc): Likewise.
1819         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1820         first tls section has section symbol for optimised local dynamic
1821         output relocs.
1822         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1823         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1824         optimised tls code.
1825         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1826         Rename to relocate_relocs.  Update error message.
1827
1828 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1829
1830         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1831         --just-symbols.
1832
1833 2012-08-31  Alan Modra  <amodra@gmail.com>
1834
1835         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1836         (Powerpc_relobj::toc_base_offset): New stub function.
1837         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1838         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1839         (Target_powerpc::Relocate::enum skip_tls): New.
1840         (Target_powerpc::call_tls_get_addr_): New var.
1841         (Target_powerpc::is_branch_reloc): Move to file scope.
1842         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1843         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1844         New functions.
1845         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1846         (powerpc_info): Correct common_pagesize for ppc64.
1847         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1848         (Powerpc_relocate_functions): Add overflow check enums and functions.
1849         Add non-shift version of rela, rela_ua.  Delete all rel public
1850         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1851         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1852         addr16_ha3, addr14 functions.
1853         (Output_data_got_powerpc::add_constant_pair): New function.
1854         (Output_data_got_powerpc::got_base_offset): Likewise.
1855         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1856         (instruction constants): Sort, add some more.
1857         (Output_data_glink::do_write): Add and use Address typedef.  Use
1858         object->toc_base_offset() stub for 64-bit.
1859         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1860         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1861         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1862         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1863         Always treat .opd relocs as against locally defined symbol.
1864         Correct condition for RELATIVE relocs.
1865         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1866         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1867         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1868         calculations.  Handle TLS relocs, and more.  Add overflow
1869         checking and adjust for Powerpc_relocate_functions changes.
1870         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1871         Reinstate --emit-relocs code with FIXME.
1872
1873 2012-08-30  Alan Modra  <amodra@gmail.com>
1874
1875         * layout.cc (Layout::set_segment_offsets): Set p_align to
1876         abi_pagesize, not common_pagesize.
1877         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1878         to determine whether file header can go in segment.
1879
1880 2012-08-30  Alan Modra  <amodra@gmail.com>
1881
1882         * output.h (Output_reloc::Output_reloc <output section>): Add
1883         is_relative param.  Adjust calls.
1884         (Output_reloc::add_output_section_relative): New functions.
1885         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1886         is_relative.
1887         (Output_reloc::symbol_value): Handle SECTION_CODE.
1888
1889 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1890
1891         * gold.cc (queue_middle_tasks): Call layout again when unique
1892         segments for sections is desired.
1893         * layout.cc (Layout::Layout): Initialize new members.
1894         (Layout::get_output_section_flags): New function.
1895         (Layout::choose_output_section): Call get_output_section_flags.
1896         (Layout::layout): Make output section for mapping to a unique segment.
1897         (Layout::insert_section_segment_map): New function.
1898         (Layout::attach_allocated_section_to_segment): Make unique segment for
1899         output sections marked so.
1900         (Layout::segment_precedes): Check for unique segments when sorting.
1901         * layout.h (Layout::Unique_segment_info): New struct.
1902         (Layout::Section_segment_map): New typedef.
1903         (Layout::insert_section_segment_map): New function.
1904         (Layout::get_output_section_flags): New function.
1905         (Layout::is_unique_segment_for_sections_specified): New function.
1906         (Layout::set_unique_segment_for_sections_specified): New function.
1907         (Layout::unique_segment_for_sections_specified_): New member.
1908         (Layout::section_segment_map_): New member.
1909         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
1910         Rename is_gc_pass_one to is_pass_one.
1911         Rename is_gc_pass_two to is_pass_two.
1912         Rename is_gc_or_icf to is_two_pass.
1913         Check for which pass based on whether symbols data is present.
1914         Make it two pass when unique segments for sections is desired.
1915         * output.cc (Output_section::Output_section): Initialize new
1916         members.
1917         * output.h (Output_section::is_unique_segment): New function.
1918         (Output_section::set_is_unique_segment): New function.
1919         (Output_section::is_unique_segment_): New member.
1920         (Output_section::extra_segment_flags): New function.
1921         (Output_section::set_extra_segment_flags): New function.
1922         (Output_section::extra_segment_flags_): New member.
1923         (Output_section::segment_alignment): New function.
1924         (Output_section::set_segment_alignment): New function.
1925         (Output_section::segment_alignment_): New member.
1926         (Output_segment::Output_segment): Initialize is_unique_segment_.
1927         (Output_segment::is_unique_segment): New function.
1928         (Output_segment::set_is_unique_segment): New function.
1929         (Output_segment::is_unique_segment_): New member.
1930         * plugin.cc (allow_unique_segment_for_sections): New function.
1931         (unique_segment_for_sections): New function.
1932         (Plugin::load): Add new functions to transfer vector.
1933         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
1934         * Makefile.in: Regenerate.
1935         * testsuite/plugin_final_layout.sh: Check if unique segment
1936         functionality works.
1937         * testsuite/plugin_section_order.c (onload): Check if new interfaces
1938         are available.
1939         (allow_unique_segment_for_sections): New global.
1940         (unique_segment_for_sections): New global.
1941         (claim_file_hook): Call allow_unique_segment_for_sections.
1942         (all_symbols_read_hook): Call unique_segment_for_sections.
1943
1944 2012-08-22  Cary Coutant  <ccoutant@google.com>
1945
1946         * layout.cc (Layout::include_section): Don't assert on GROUP
1947         sections with --emit-relocs.
1948
1949 2012-08-21  Cary Coutant  <ccoutant@google.com>
1950
1951         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
1952         if --export-dynamic-symbol names an undef symbol.
1953
1954 2012-08-18  Alan Modra  <amodra@gmail.com>
1955
1956         * powerpc.cc: Formatting and white space.
1957         (Powerpc_relobj): Rename got2_section_ to special_.
1958         Add opd_ent_shndx_ and opd_ent_off_ vectors.
1959         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
1960         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
1961         (Target_powerpc): Add Address typedef and invalid_address.  Use
1962         throughout.
1963         (Target_powerpc::is_branch_reloc): New function.
1964         (Powerpc_relocate_functions): Add Address typedef, use throughout.
1965         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
1966         for dst_mask, value and addend.
1967         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
1968         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
1969         (Output_data_glink::do_write): Correct toc base.  Don't try to use
1970         uint16_t for 24-bit offset.  Use get_output_section_offset and
1971         check return.
1972         (Target_powerpc::Scan::local): Handle more relocs.
1973         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
1974         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
1975         Plug in toc restoring insn after plt calls.  Translate branches
1976         to function descriptor symbols to corresponding entry point.
1977         (Target_powerpc::relocate_for_relocatable): Check return from
1978         get_output_section_offset.
1979         * symtab.h: Comment typo.
1980
1981 2012-08-14  Ian Lance Taylor  <iant@google.com>
1982
1983         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
1984         unsupported_relocal_local to call unsupported_reloc_global.
1985
1986 2012-08-14  Nick Clifton  <nickc@redhat.com>
1987
1988         PR ld/14265
1989         * script-sections.cc (Sections_element::output_section_name): Add
1990         keep return parameter.
1991         (Output_section_element::match_name): Add keep return parameter.
1992         Return the value of the keep_ member.
1993         * script-sections.h (class Output_section): Update
1994         output_section_name prototype.
1995         * layout.cc (Layout::keep_input_section): New public member
1996         function.
1997         (Layout::choose_output_section): Pass keep parameter to
1998         output_section_name.
1999         * layout.h (class Layout): Add keep_input_section.
2000         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2001         sections.
2002         * testsuite/Makefile.am: Add a test.
2003         * testsuite/Makefile.in: Regenerate.
2004         * testsuite/pr14265.c: Source file for the test.
2005         * testsuite/pr14265.t: Linker script for the test.
2006         * testsuite/pr14265.sh: Shell script for the test.
2007
2008 2012-08-14  Alan Modra  <amodra@gmail.com>
2009
2010         * target.h (Target::output_section_name): New function.
2011         (Target::do_output_section_name): New function.
2012         * layout.cc (Layout::choose_output_section): Call the above.
2013         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2014
2015 2012-08-14  Alan Modra  <amodra@gmail.com>
2016
2017         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2018         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2019         for replace_constant call.
2020         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2021         (Output_data_glink::do_print_to_mapfile): New function.
2022         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2023         (Target_powerpc::Relocate::relocate): Likewise.
2024
2025 2012-08-14  Alan Modra  <amodra@gmail.com>
2026
2027         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2028         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2029         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2030         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2031         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2032         here.
2033         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2034         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2035         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2036         here.
2037         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2038         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2039
2040 2012-08-12  Alan Modra  <amodra@gmail.com>
2041
2042         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2043         (glink insn constants): Use uint32_t.
2044         (Output_data_glink::add_entry): Use insert, not [] operator.
2045
2046 2012-08-11  Alan Modra  <amodra@gmail.com>
2047
2048         * object.h (Sized_relobj_file::find_shdr): New function.
2049         (Sized_relobj_file::find_special_sections): New function.
2050         * object.cc (Sized_relobj_file::find_shdr): New function.
2051         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2052         (Sized_relobj_file::find_special_sections): New function, split out..
2053         (Sized_relobj_file::do_read_symbols): ..from here.
2054         * output.h (Output_data_got::replace_constant): New function.
2055         (Output_data_got::num_entries): New function.
2056         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2057         (Output_data_got::got_offset): Protected rather than private.
2058         (Output_data_got::replace_got_entry): New function.
2059         * output.cc (Output_data_got::replace_got_entry): New function.
2060         * powerpc.cc (class Powerpc_relobj): New.
2061         (class Powerpc_relocate_functions): Delete all psymval variants or
2062         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2063         Implement _ha functions using corresponding _hi function.
2064         (Powerpc_relobj::find_special_sections): New function.
2065         (Target_powerpc::do_make_elf_object): New function.
2066         (class Output_data_got_powerpc): New.
2067         (class Output_data_glink): New.
2068         (class Powerpc_scan_relocatable_reloc): New.
2069         Many more changes througout file.
2070
2071 2012-08-09  Nick Clifton  <nickc@redhat.com>
2072
2073         * po/vi.po: Updated Vietnamese translation.
2074
2075 2012-08-07  Ian Lance Taylor  <iant@google.com>
2076
2077         * layout.cc (Layout::add_target_dynamic_tags): If
2078         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2079         plt_rel.
2080
2081 2012-07-30  Nick Clifton  <nickc@redhat.com>
2082
2083         * po/gold.pot: Updated template.
2084         * po/es.po: Updated Spanish translation.
2085
2086 2012-07-18  Cary Coutant  <ccoutant@google.com>
2087
2088         PR gold/14344
2089         * configure.ac: Add check for -gpubnames support.
2090         * configure: Regenerate.
2091         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2092         support; force -gno-pubnames.
2093         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2094         support.
2095         (gdb_index_test_4): New test.
2096         * testsuite/Makefile.in: Regenerate.
2097         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2098         * testsuite/gdb_index_test_2.sh: Likewise.
2099         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2100         * testsuite/gdb_index_test_4.sh: New script.
2101         * testsuite/gdb_index_test_comm.sh: New script with common code;
2102         don't look for space after colon.
2103
2104 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2105
2106         * gold.cc (queue_middle_tasks): Update function order only after
2107         deferred objects due to plugins are processed.
2108
2109 2012-07-11  Ian Lance Taylor  <iant@google.com>
2110
2111         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2112         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2113         (Target_arm::scan_reloc_for_stub): Likewise.
2114         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2115         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2116         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2117         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2118         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2119
2120 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2121             Ian Lance Taylor  <iant@google.com>
2122
2123         PR gold/14309
2124         * configure.ac: Test whether std::tr1::hash<off_t> works.
2125         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2126         needed.
2127         * output.h (class Output_fill): Add virtual destructor.
2128         * configure, config.in: Rebuild.
2129
2130 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2131
2132         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2133
2134 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2135
2136         * plugin.cc (Plugin::load): Handle position independent executables.
2137
2138 2012-06-06  Cary Coutant  <ccoutant@google.com>
2139
2140         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2141         add .debug_macro.
2142         (lines_only_debug_sections): Likewise.
2143         (gdb_fast_lookup_sections): New static array.
2144         (is_gdb_debug_section): Rename formal parameter.
2145         (is_lines_only_debug_section): Likewise.
2146         (is_gdb_fast_lookup_section): New function.
2147         (Layout::include_section): Check for ".zdebug_" prefix; pass
2148         section name suffix to is_gdb_debug_section, et al.; check for
2149         fast-lookup sections when building .gdb_index.
2150         * options.h (--strip-debug-gdb): Update GDB version number.
2151
2152 2012-06-06  Cary Coutant  <ccoutant@google.com>
2153
2154         * configure.ac: Add check for fallocate.
2155         * configure: Regenerate.
2156         * config.in: Regenerate.
2157
2158         * options.h (class General_options): Add --mmap-output-file and
2159         --posix-fallocate options.
2160         * output.cc: (posix_fallocate): Remove; replace with...
2161         (gold_fallocate): New function.
2162         (Output_file::map_no_anonymous): Call gold_fallocate.
2163         (Output_file::map): Check --mmap-output-file option.
2164
2165 2012-06-05  Jing Yu  <jingyu@google.com>
2166
2167         * gold.h (textdomain): Add do {} to empty while(0).
2168         (bindtextdomain): Likewise.
2169
2170 2012-06-04  Cary Coutant  <ccoutant@google.com>
2171
2172         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2173         has_dynsym_index.
2174
2175 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2176
2177         * symtab.cc (Symbol_table::define_special_symbol):
2178         Initialize *poldsym to prevent uninitialized variable errors.
2179
2180 2012-05-23  Cary Coutant  <ccoutant@google.com>
2181
2182         * layout.cc (Layout::section_name_mapping): Add rules to handle
2183         exact match on .data.rel.ro.local or .data.rel.ro.
2184         (Layout::output_section_name): Check for exact matches.
2185
2186 2012-05-23  Cary Coutant  <ccoutant@google.com>
2187
2188         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2189         more carefully.
2190
2191 2012-05-22  Cary Coutant  <ccoutant@google.com>
2192
2193         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2194         object before exporting symbol.
2195
2196 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2197
2198         * testsuite/tls_test.cc: Include "config.h" first.
2199         * testsuite/tls_test_c.c: Likewise.
2200
2201 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2202             Nick Clifton  <nickc@redhat.com>
2203
2204         PR 14072
2205         * configure.in: Add check that sysdep.h has been included before
2206         any system header files.
2207         * configure: Regenerate.
2208         * config.in: Regenerate.
2209
2210 2012-05-14  Cary Coutant  <ccoutant@google.com>
2211
2212         * layout.cc (Layout::make_output_section): Mark .tdata section
2213         as RELRO.
2214         * testsuite/relro_test.cc: Add a TLS variable.
2215
2216 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2217
2218         PR gold/14091
2219         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2220         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2221         R_X86_64_64.
2222
2223 2012-05-08  Cary Coutant  <ccoutant@google.com>
2224
2225         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2226         (lines_only_debug_sections): Likewise.
2227
2228 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2229
2230         * nacl.cc: New file.
2231         * nacl.h: New file.
2232         * Makefile.am (CCFILES, HFILES): Add them.
2233         * Makefile.in: Regenerate.
2234         * i386.cc (Output_data_plt_i386_nacl): New class.
2235         (Output_data_plt_i386_nacl_exec): New class.
2236         (Output_data_plt_i386_nacl_dyn): New class.
2237         (Target_i386_nacl): New class.
2238         (Target_selector_i386_nacl): New class.
2239         (target_selector_i386): Use it instead of Target_selector_i386.
2240         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2241         (Target_x86_64_nacl): New class.
2242         (Target_selector_x86_64_nacl): New class.
2243         (target_selector_x86_64, target_selector_x32): Use it instead of
2244         Target_selector_x86_64.
2245         * arm.cc (Output_data_plt_arm_nacl): New class.
2246         (Target_arm_nacl): New class.
2247         (Target_selector_arm_nacl): New class.
2248         (target_selector_arm, target_selector_armbe): Use it instead of
2249         Target_selector_arm.
2250
2251         * target-select.cc (select_target): Take new Input_file* and off_t
2252         arguments, pass them on to recognize method of selector.
2253         * object.cc (make_elf_sized_object): Update caller.
2254         * parameters.cc (parameters_force_valid_target): Likewise.
2255         * incremental.cc (make_sized_incremental_binary): Likewise.
2256         * target-select.h: Update decl.
2257         (Target_selector::recognize): Take new Input_file* argument,
2258         pass it on to do_recognize.
2259         (Target_selector::do_recognize): Take new Input_file* argument.
2260         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2261         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2262         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2263         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2264
2265         * target.h (Target::Target_info): New members isolate_execinstr
2266         and rosegment_gap.
2267         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2268         * arm.cc (Target_arm::arm_info): Update initializer.
2269         * i386.cc (Target_i386::i386_info): Likewise.
2270         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2271         * sparc.cc (Target_sparc::sparc_info): Likewise.
2272         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2273         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2274         * layout.cc (Layout::attach_allocated_section_to_segment):
2275         Take new const Target* argument.  If target->isolate_execinstr(), act
2276         like --rosegment.
2277         (Layout::find_first_load_seg): Take new const Target* argument;
2278         if target->isolate_execinstr(), reject PF_X segments.
2279         (Layout::relaxation_loop_body): Update caller.
2280         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2281         reset file offset to zero when we hit LOAD_SEG, and then do a second
2282         loop over the segments before LOAD_SEG to reassign offsets after
2283         addresses have been determined.  Handle target->rosegment_gap().
2284         (Layout::attach_section_to_segment): Take new const Target* argument;
2285         pass it to attach_allocated_section_to_segment.
2286         (Layout::make_output_section): Update caller.
2287         (Layout::attach_sections_to_segments): Take new const Target* argument;
2288         pass it to attach_section_to_segment.
2289         * gold.cc (queue_middle_tasks): Update caller.
2290         * layout.h (Layout): Update method decls with new arguments.
2291
2292         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2293         Target_info pointer to use.
2294         (Target_arm::do_make_data_plt): New virtual method.
2295         (Target_arm::make_data_plt): New method that calls it.
2296         (Target_arm::make_plt_entry): Use it.
2297         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2298         for the section alignment.
2299         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2300         method.
2301         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2302         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2303         method.
2304         (Output_data_plt_arm::get_plt_entry_size): Call it.
2305         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2306         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2307         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2308         method.
2309         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2310         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2311         method instead of sizeof(plt_entry).
2312         (Output_data_plt_arm::add_entry): Likewise.
2313         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2314         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2315         than static method.
2316         (Target_arm::plt_entry_size): Likewise.
2317         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2318         Move to ...
2319         (Output_data_plt_arm_standard): ... here, new class.
2320         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2321         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2322         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2323
2324         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2325         Take additional argument for the PLT entry size.
2326         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2327         Use get_plt_entry_size method rather than plt_entry_size variable.
2328         (Output_data_plt_x86_64::reserve_slot): Likewise.
2329         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2330         (Output_data_plt_x86_64::add_entry): Likewise.
2331         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2332         (Output_data_plt_x86_64::address_for_global): Likewise.
2333         (Output_data_plt_x86_64::address_for_local): Likewise.
2334         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2335         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2336         Make method non-static.
2337         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2338         method.
2339         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2340         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2341         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2342         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2343         virtual method.
2344         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2345         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2346         virtual method.
2347         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2348         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2349         virtual method.
2350         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2351         (Output_data_plt_x86_64::plt_entry_size)
2352         (Output_data_plt_x86_64::first_plt_entry)
2353         (Output_data_plt_x86_64::plt_entry)
2354         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2355         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2356         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2357         (Output_data_plt_x86_64_standard): ... here, new class.
2358         (Target_x86_64::Target_x86_64): Take optional argument for the
2359         Target_info pointer to use.
2360         (Target_x86_64::do_make_data_plt): New virtual method.
2361         (Target_x86_64::make_data_plt): New method to call it.
2362         (Target_x86_64::init_got_plt_for_update): Use that.
2363         Call this->plt_->add_eh_frame method here.
2364         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2365         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2366         rather than static method.
2367         (Target_x86_64::plt_entry_size): Likewise.
2368         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2369         rather than plt_entry_size variable.  Move guts of PLT filling to...
2370         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2371         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2372         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2373
2374         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2375         additional argument for the section alignment.
2376         Don't do add_eh_frame_for_plt here.
2377         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2378         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2379         variable.
2380         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2381         method.
2382         (Output_data_plt_i386::get_plt_entry_size): Call it.
2383         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2384         (Output_data_plt_i386::add_eh_frame): New method to call it.
2385         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2386         method.
2387         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2388         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2389         method.
2390         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2391         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2392         method instead of plt_entry_size.
2393         (Output_data_plt_i386::plt_entry_size)
2394         (Output_data_plt_i386::plt_eh_frame_fde_size)
2395         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2396         (Output_data_plt_i386_standard): ... here, new class.
2397         (Output_data_plt_i386_exec): New class.
2398         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2399         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2400         (Output_data_plt_i386::exec_plt_entry): Move to ...
2401         (Output_data_plt_i386_exec::plt_entry): ... here.
2402         (Output_data_plt_i386_dyn): New class.
2403         (Output_data_plt_i386::first_plt_entry): Move to ...
2404         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2405         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2406         (Output_data_plt_i386_dyn::plt_entry): ... here.
2407         (Target_i386::Target_i386): Take optional argument for the Target_info
2408         pointer to use.
2409         (Target_i386::do_make_data_plt): New virtual method.
2410         (Target_i386::make_data_plt): New method to call it.
2411         (Target_i386::make_plt_section): Use that.
2412         Call this->plt_->add_eh_frame method here.
2413         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2414         rather than plt_entry_size variable.
2415         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2416         (Output_data_plt_i386::address_for_local): Likewise.
2417         (Output_data_plt_i386::do_write): Likewise.
2418         Move guts of PLT filling to...
2419         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2420         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2421         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2422         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2423
2424 2012-05-01  Cary Coutant  <ccoutant@google.com>
2425
2426         * dwarf_reader.cc (Dwarf_die::read_attributes)
2427         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2428         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2429         * reduced_debug_output.cc
2430         (Output_reduced_debug_info_section::get_die_end): Remove
2431         DW_FORM_GNU_ref_index.  Add default case.
2432
2433 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2434
2435         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2436         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2437         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2438         DW_AT_high_pc as offset from DW_AT_low_pc.
2439
2440         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2441         * testsuite/Makefile.in: Regenerate.
2442         * testsuite/gdb_index_test_3.c: New test source file.
2443         * testsuite/gdb_index_test_3.sh: New test source file.
2444
2445 2012-04-25  Ian Lance Taylor  <iant@google.com>
2446
2447         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2448         pointer.
2449         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2450         as a class, not a struct.
2451         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2452         (Target_arm::apply_cortex_a8_workaround): Likewise.
2453         * gc.h: Declare Reloc_types as a struct, not a class.
2454         * object.h: Declare Symbols_data as a struct.
2455         * reloc.h: Declare Read_relocs_data as a struct.
2456         * target.h: Declare Relocate_info as a struct.
2457
2458 2012-04-24  David S. Miller  <davem@davemloft.net>
2459
2460         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2461         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2462         and R_SPARC_WPLT30.
2463
2464 2012-04-24  Cary Coutant  <ccoutant@google.com>
2465
2466         * incremental-dump.cc (find_input_containing_global): Replace
2467         magic number with symbolic constant.
2468         (dump_incremental_inputs): Update version number.
2469         * incremental.cc (Output_section_incremental_inputs): Update version
2470         number; import symbolic constants from Incremental_inputs_reader.
2471         (Incremental_inputs::create_data_sections): Align relocations
2472         section correctly for 64-bit targets.
2473         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2474         constants; add padding.
2475         (Output_section_incremental_inputs::write_header): Add assert for
2476         header_size.
2477         (Output_section_incremental_inputs::write_input_files): Add assert
2478         for input_entry_size.
2479         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2480         add assert for object_info_size, input_section_entry_size,
2481         global_sym_entry_size.
2482         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2483         for data structure sizes; use them.
2484         (Incremental_input_entry_reader): Import symbolic constants from
2485         Incremental_inputs_reader; use them.
2486
2487 2012-04-23  David S. Miller  <davem@davemloft.net>
2488
2489         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2490         and elf_flags_set_.
2491         (Target_sparc::Target_sparc): Initialize new fields.
2492         (Target_sparc::do_make_elf_object): New function.
2493         (Target_sparc::do_adjust_elf_header): New function.
2494
2495 2012-04-23  Cary Coutant  <ccoutant@google.com>
2496
2497         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2498         CU range table of gdb index.
2499
2500 2012-04-20  David S. Miller  <davem@davemloft.net>
2501
2502         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2503         instead of false.
2504
2505 2012-04-16  David S. Miller  <davem@davemloft.net>
2506
2507         * sparc.cc (Target_sparc::got_address): New function.
2508         (Sparc_relocate_functions::gdop_hix22): New function.
2509         (Sparc_relocate_functions::gdop_lox10): New function.
2510         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2511         relocs.
2512         (Target_sparc::Scan::local): Likewise if the global symbol is not
2513         preemptible and is not IFUNC.
2514         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2515         transformations for local and non-preemptible non-IFUNC global
2516         symbols.
2517
2518         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2519         writing out 64-bit part of ranges.
2520
2521         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2522         -fpic and -fpie respectively.
2523         * Makefile.in: Regenerate.
2524
2525         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2526         (Target_sparc::Target_sparc): Initialize new field.
2527         (Target_sparc::do_plt_section_for_global): New function.
2528         (Target_sparc::do_plt_section_for_local): New function.
2529         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2530         (Target_sparc::make_plt_section): New function, broken out of
2531         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2532         (Target_sparc::make_plt_entry): Call make_plt_section.
2533         (Target_sparc::make_local_ifunc_plt_entry): New function.
2534         (Target_sparc::rela_ifunc_section): New function.
2535         (Target_sparc::plt_section): Remove const.
2536         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2537         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2538         and ifunc_count_ fields.
2539         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2540         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2541         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2542         (Output_data_plt_sparc::rela_ifunc): New function.
2543         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2544         (Output_data_plt_sparc::has_ifunc_section): New function.
2545         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2546         (Output_data_plt_sparc::address_for_global): New function.
2547         (Output_data_plt_sparc::address_for_local): New function.
2548         (Output_data_plt_sparc::plt_index_to_offset): New function.
2549         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2550         and entry_count.
2551         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2552         entry_count.
2553         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2554         R_SPARC_JMP_IREL to switch.
2555         (Target_sparc::Scan::check_non_pic): Likewise.
2556         (Target_sparc::Scan::local): Handle IFUNC symbols.
2557         (Target_sparc::Scan::local): Likewise.
2558         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2559         and plt_address_for_local.
2560         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2561         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2562
2563         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2564         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2565         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2566         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2567         global relocs too.
2568         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2569         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2570         calls.
2571         * sparc.cc (Target_sparc::Scan::global): Likewise.
2572         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2573
2574 2012-04-16  Cary Coutant  <ccoutant@google.com>
2575
2576         * archive.cc (Library_base::should_include_member): Check for
2577         --export-dynamic-symbol.
2578         * options.h (class General_options): Add --export-dynamic-symbol.
2579         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2580         --export-dynamic-symbol.
2581         (Symbol_table::gc_mark_undef_symbols): Likewise.
2582         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2583
2584 2012-04-12  David S. Miller  <davem@davemloft.net>
2585
2586         * sparc.cc (Reloc::wdisp10): New relocation method.
2587         (Reloc::h34): Likewise.
2588         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2589         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2590         R_SPARC_WDISP10.
2591         (Target_sparc::Scan::local): Likewise.
2592         (Target_sparc::Scan::global): Likewise.
2593         (Target_sparc::Relocate::relocate): Likewise.
2594
2595 2012-04-09  Cary Coutant  <ccoutant@google.com>
2596
2597         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2598         low_pc == 0.
2599
2600 2012-04-06  Ian Lance Taylor  <iant@google.com>
2601
2602         * timer.cc: #include <unistd.h>.
2603
2604 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2605
2606         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2607         * config.in: Regenerate.
2608         * configure: Regenerate.
2609
2610 2012-04-05  Nick Clifton  <nickc@redhat.com>
2611
2612         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2613         (AM_LC_MESSAGES): Add.
2614         * aclocal.m4: Regenerate.
2615         * config.in: Regenerate.
2616         * configure: Regenerate.
2617
2618 2012-03-21  Cary Coutant  <ccoutant@google.com>
2619
2620         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2621         * Makefile.in: Regenerate.
2622         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2623         (Sized_elf_reloc_mapper::symbol_section): New function.
2624         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2625         (make_elf_reloc_mapper): New function.
2626         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2627         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2628         (Dwarf_abbrev_table::do_get_abbrev): New function.
2629         (Dwarf_ranges_table::read_ranges_table): New function.
2630         (Dwarf_ranges_table::read_range_list): New function.
2631         (Dwarf_pubnames_table::read_section): New function.
2632         (Dwarf_pubnames_table::read_header): New function.
2633         (Dwarf_pubnames_table::next_name): New function.
2634         (Dwarf_die::Dwarf_die): New function.
2635         (Dwarf_die::read_attributes): New function.
2636         (Dwarf_die::skip_attributes): New function.
2637         (Dwarf_die::set_name): New function.
2638         (Dwarf_die::set_linkage_name): New function.
2639         (Dwarf_die::attribute): New function.
2640         (Dwarf_die::string_attribute): New function.
2641         (Dwarf_die::int_attribute): New function.
2642         (Dwarf_die::uint_attribute): New function.
2643         (Dwarf_die::ref_attribute): New function.
2644         (Dwarf_die::child_offset): New function.
2645         (Dwarf_die::sibling_offset): New function.
2646         (Dwarf_info_reader::check_buffer): New function.
2647         (Dwarf_info_reader::parse): New function.
2648         (Dwarf_info_reader::do_parse): New function.
2649         (Dwarf_info_reader::do_read_string_table): New function.
2650         (Dwarf_info_reader::lookup_reloc): New function.
2651         (Dwarf_info_reader::get_string): New function.
2652         (Dwarf_info_reader::visit_compilation_unit): New function.
2653         (Dwarf_info_reader::visit_type_unit): New function.
2654         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2655         Sized_elf_reloc_mapper.
2656         (Sized_dwarf_line_info::symbol_section): Remove function.
2657         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2658         (Sized_dwarf_line_info::read_line_mappings): Remove object
2659         parameter, adjust callers.
2660         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2661         * dwarf_reader.h: Include <sys/types.h>.
2662         (class Track_relocs): Remove forward declaration.
2663         (class Elf_reloc_mapper): New class.
2664         (class Sized_elf_reloc_mapper): New class.
2665         (class Dwarf_abbrev_table): New class.
2666         (class Dwarf_range_list): New class.
2667         (class Dwarf_ranges_table): New class.
2668         (class Dwarf_pubnames_table): New class.
2669         (class Dwarf_die): New class.
2670         (class Dwarf_info_reader): New class.
2671         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2672         (Sized_dwarf_line_info::symbol_section): Remove member function.
2673         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2674         base class.
2675         * gdb-index.cc: New source file.
2676         * gdb-index.h: New source file.
2677         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2678         and .debug_types sections, call Layout::add_to_gdb_index.
2679         (Sized_relobj_incr::do_section_name): Implement.
2680         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2681         return type; Implement.
2682         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2683         return type.
2684         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2685         parameter list and return type.
2686         (Sized_incr_dynobj::do_section_contents): Likewise.
2687         * layout.cc: Include gdb-index.h.
2688         (Layout::Layout): Initialize gdb_index_data_.
2689         (Layout::init_fixed_output_section): Check for .gdb_index section.
2690         (Layout::add_to_gdb_index): New function. Instantiate.
2691         * layout.h: Add forward declaration for class Gdb_index.
2692         (Layout::add_to_gdb_index): New member function.
2693         (Layout::gdb_index_data_): New data member.
2694         * main.cc: Include gdb-index.h.
2695         (main): Print statistics for gdb index.
2696         * object.cc (Object::section_contents): Move code into
2697         do_section_contents.
2698         (need_decompressed_section): Check for sections needed when building
2699         gdb index.
2700         (build_compressed_section_map): Likewise.
2701         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2702         gdb index.
2703         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2704         sections; call Layout::add_to_gdb_index.
2705         (Sized_relobj_file::do_decompressed_section_contents): Call
2706         do_section_contents directly.
2707         * object.h (Object::do_section_contents): Adjust parameter list and
2708         return type.
2709         (Object::do_decompressed_section_contents): Call do_section_contents
2710         directly.
2711         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2712         return type.
2713         * options.h (class General_options): Add --gdb-index option.
2714         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2715         list and return type.
2716         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2717         * reloc.h (Track_relocs::checkpoint): New function.
2718         (Track_relocs::reset): New function.
2719
2720         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2721         New test cases.
2722         * testsuite/Makefile.in: Regenerate.
2723         * testsuite/gdb_index_test.cc: New test source file.
2724         * testsuite/gdb_index_test_1.sh: New test source file.
2725         * testsuite/gdb_index_test_2.sh: New test source file.
2726
2727 2012-03-19  Doug Kwan  <dougkwan@google.com>
2728
2729         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2730         (Target_arm::do_finalize_sections): Remove code which defines
2731         __exidx_start and __exidx_end.  Make symbol table parameter
2732         anonymous as it is not used.
2733         * gold.cc (queue_middle_tasks): Call target hook to define any
2734         target-specific symbols.
2735         * target.h (Target::define_standard_symbols): New method.
2736         (Target::do_define_standard_symbols): Same.
2737         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2738         * testsuite/Makefile.in: Regenerate.
2739         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2740         and __exidx_end.
2741         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2742         relocations are generated for __exidx_start and __exidx_end.
2743
2744 2012-03-16  Doug Kwan  <dougkwan@google.com>
2745
2746         * testsuite/Makefile.am: Disable test initpri3b.
2747         * testsuite/Makefile.in: Regenerate.
2748
2749 2012-03-15  Doug Kwan  <dougkwan@google.com>
2750
2751         * arm.cc (Target_arm::got_section): Make .got section read-only
2752         if -z now is given.
2753
2754 2012-03-15  Ian Lance Taylor  <iant@google.com>
2755
2756         PR gold/13850
2757         * layout.cc (Layout::make_output_section): Correctly mark
2758         SHT_INIT_ARRAY, et. al., as relro.
2759
2760 2012-03-14  Doug Kwan  <dougkwan@google.com>
2761
2762         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2763         dynamic relocations for protected symbols in shared objects.
2764
2765 2012-03-13  Ian Lance Taylor  <iant@google.com>
2766
2767         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2768         keep the larger alignment.
2769
2770 2012-03-12  Cary Coutant  <ccoutant@google.com>
2771
2772         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2773         handling of DW_LNE_define_file.
2774
2775 2012-03-12  Cary Coutant  <ccoutant@google.com>
2776
2777         * reduced_debug_output.cc
2778         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2779         codes to switch.
2780
2781 2012-02-29  Cary Coutant  <ccoutant@google.com>
2782
2783         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2784
2785 2012-02-29  Cary Coutant  <ccoutant@google.com>
2786
2787         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2788         Call Object::decompressed_section_contents.
2789         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2790         New dtor.
2791         (Sized_dwarf_line_info::buffer_start_): New data member.
2792         * merge.cc (Output_merge_data::do_add_input_section): Call
2793         Object::decompressed_section_contents.
2794         (Output_merge_string::do_add_input_section): Likewise.
2795         * object.cc (need_decompressed_section): New function.
2796         (build_compressed_section_map): Decompress sections needed later.
2797         (Sized_relobj_file::do_decompressed_section_contents): New function.
2798         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2799         * object.h (Object::decompressed_section_contents): New function.
2800         (Object::discard_decompressed_sections): New function.
2801         (Object::do_decompressed_section_contents): New function.
2802         (Object::do_discard_decompressed_sections): New function.
2803         (Compressed_section_info): New type.
2804         (Compressed_section_map): Include decompressed section contents.
2805         (Sized_relobj_file::do_decompressed_section_contents): New function.
2806         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2807
2808 2012-02-16  Cary Coutant  <ccoutant@google.com>
2809
2810         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2811         * testsuite/Makefile.in: Regenerate.
2812
2813 2012-02-14  Cary Coutant  <ccoutant@google.com>
2814
2815         * options.cc (General_options::finalize): Disallow -pie and -static.
2816
2817 2012-02-03  Doug Kwan  <dougkwan@google.com>
2818
2819         * arm.cc (Arm_relocate_functions::abs8,
2820         Arm_relocate_functions::abs16): Use
2821         Bits::has_signed_unsigned_overflow32.
2822         (Arm_relocate_functions::thm_abs8): Correct range of
2823         overflow check.
2824         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2825         in assertions.
2826
2827 2012-02-02  Doug Kwan  <dougkwan@google.com>
2828
2829         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2830         position independent outputs, not just shared objects.
2831
2832 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2833
2834         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2835         * configure: Regenerated.
2836
2837 2012-01-27  Ian Lance Taylor  <iant@google.com>
2838
2839         * reloc.h (Bits): New class with static functions, copied from
2840         namespace utils in arm.cc.
2841         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2842         instead.
2843
2844 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2845
2846         * incremental.cc (write_info_blocks): Correct relocation offset.
2847
2848 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2849
2850         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2851         (Relocate::tls_gd_to_le): Likewise.
2852
2853 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2854
2855         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2856
2857 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2858
2859         * configure.ac: Check if -mcmodel=medium works.
2860         * configure: Regenerated.
2861
2862 2012-01-24  Cary Coutant  <ccoutant@google.com>
2863
2864         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2865         definition and ...
2866         (read_unsigned_LEB_128_x): ... this new function.
2867         (read_signed_LEB_128): Replaced with inline definition and ...
2868         (read_signed_LEB_128_x): ... this new function.
2869         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2870         (read_unsigned_LEB_128): Add inline definition.
2871         (read_signed_LEB_128_x): New function.
2872         (read_signed_LEB_128): Add inline definition.
2873         * testsuite/Makefile.am (leb128_unittest): New unit test.
2874         * testsuite/Makefile.in: Regenerate.
2875         * testsuite/leb128_unittest.cc: New unit test.
2876
2877 2012-01-23  Ian Lance Taylor  <iant@google.com>
2878
2879         PR gold/13617
2880         * i386.cc (Target_i386::do_code_fill): When using a jmp
2881         instruction, pad with nop instructions.
2882         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2883
2884 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2885
2886         * x86_64.cc (gc_process_relocs): Add typename on types used in
2887         template.
2888         (scan_relocs): Likewise.
2889         (relocate_section): Likewise.
2890         (apply_relocation): Likewise.
2891
2892 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2893
2894         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
2895         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
2896         under x32.
2897
2898 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
2899
2900         * x86_64.cc: Initial support for x32.
2901
2902 2012-01-03  Cary Coutant  <ccoutant@google.com>
2903
2904         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
2905         Use abstract base class for GOT.
2906         * gold/output.h (class Output_data_got_base): New abstract base class.
2907         (class Output_data_got): Derive from new base class, adjust ctors.
2908         (Output_data_got::reserve_slot): Make virtual; rename to
2909         do_reserve_slot; Adjust callers.
2910         * gold/target.h (Sized_target::init_got_plt_for_update): Return
2911         pointer to abstract base class.
2912         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
2913
2914 2011-12-18  Ian Lance Taylor  <iant@google.com>
2915
2916         * object.h (Relobj::local_symbol_value): New function.
2917         (Relobj::local_plt_offset): New function.
2918         (Relobj::local_has_got_offset): New function.
2919         (Relobj::local_got_offset): New function.
2920         (Relobj::set_local_got_offset): New function.
2921         (Relobj::do_local_symbol_value): New pure virtual function.
2922         (Relobj::do_local_plt_offset): Likewise.
2923         (Relobj::do_local_has_got_offset): Likewise.
2924         (Relobj::do_local_got_offset): Likewise.
2925         (Relobj::do_set_local_got_offset): Likewise.
2926         (Sized_relobj::do_local_has_got_offset): Rename from
2927         local_has_got_offset.
2928         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
2929         (Sized_relobj::do_set_local_got_offset): Rename from
2930         set_local_got_offset.
2931         (Sized_relobj_file::do_local_plt_offset): Rename from
2932         local_plt_offset.
2933         (Sized_relobj_file::do_local_symbol_value): New function.
2934         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
2935         local_plt_offset.
2936         * output.cc (Output_data_got::Got_entry::write): Change object to
2937         Relobj.  Use local_symbol_value.
2938         (Output_data_got::add_global_with_rel): Change rel_dyn to
2939         Output_data_reloc_generic*.  Use add_global_generic.
2940         (Output_data_got::add_global_with_rela): Remove.  Change all
2941         callers to use add_global_with_rel.
2942         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
2943         Output_data_reloc_generic*.  Use add_global_generic.
2944         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
2945         callers to use add_global_pair_with_rel.
2946         (Output_data_got::add_local): Change object to Relobj*.
2947         (Output_data_got::add_local_plt): Likewise.
2948         (Output_data_got::add_local_with_rel): Change object to Relobj*,
2949         change rel_dyn to Output_data_reloc_generic*.  Use
2950         add_local_generic.
2951         (Output_data_got::add_local_with_rela): Remove.  Change all
2952         callers to use all_local_with_rel.
2953         (Output_data_got::add_local_pair_with_rel): Change object to
2954         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
2955         add_output_section_generic.
2956         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
2957         callers to use add_local_pair_with_rel.
2958         (Output_data_got::reserve_local): Change object to Relobj*.
2959         * output.h: (class Output_data_reloc_generic): Add pure virtual
2960         declarations for add_global_generic, add_local_generic,
2961         add_output_section_generic.
2962         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
2963         functions for Output_data_reloc_generic.  Update declarations for
2964         changes listed in output.cc.
2965         (class Output_data_got): Change template parameter to got_size.
2966         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
2967         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
2968         function.
2969         (Sized_relobj_incr::do_local_plt_offset): New function.
2970         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
2971         add_global_generic.
2972
2973 2011-12-17  Cary Coutant  <ccoutant@google.com>
2974
2975         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
2976         * resolve.cc (Symbol_table::resolve): Likewise.
2977         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
2978         arrays.
2979         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2980
2981 2011-12-16  Ian Lance Taylor  <iant@google.com>
2982
2983         * output.h (Output_data_reloc_generic::add): Only call
2984         add_dynamic_reloc if this is a dynamic reloc section.
2985
2986 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
2987
2988         PR gold/13505
2989         * target-reloc.h (apply_relocation): Replace <64, false> with
2990         <size, big_endian>.
2991
2992 2011-11-25  Nick Clifton  <nickc@redhat.com>
2993
2994         * po/it.po: New Italian translation.
2995
2996 2011-11-17  Sterling Augustine  <saugustine@google.com>
2997
2998         * script.cc (script_include_directive): Implement.
2999         (read_script_file): New local variables name and search_path. Update
3000         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3001         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3002         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3003
3004 2011-11-11  Sterling Augustine  <saugustine@google.com>
3005
3006         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3007         (file_or_sections_cmd): Likewise.
3008
3009 2011-11-11  Doug Kwan  <dougkwan@google.com>
3010
3011         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3012         if --just-symbols is given.
3013
3014 2011-11-10  Doug Kwan  <dougkwan@google.com>
3015
3016         PR gold/13362
3017         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3018         when processing data relocs.
3019         * reloc.h (Relocate_functions::rel_unaligned): New method.
3020         (Relocate_functions::pcrel_unaligned): Ditto.
3021         (Relocate_functions::rel32_unaligned): Ditto.
3022         (Relocate_functions::pcrel32_unaligned): Ditto.
3023
3024 2011-11-09  Doug Kwan  <dougkwan@google.com>
3025
3026         PR gold/13362
3027         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3028         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3029         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3030         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3031         (Relocate_functions::rel_unaligned): New.
3032         (Relocate_functions::rel32_unaligned): New.
3033         * target-reloc.h (relocate_for_relocatable): Add code to handle
3034         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3035         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3036         arm_unaligned_reloc_r): New targets.
3037         * testsuite/Makefile.in: Regenerate.
3038         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3039         linking.
3040
3041 2011-11-02  Ian Lance Taylor  <iant@google.com>
3042
3043         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3044         NATIVE_LINKER.
3045         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3046         * options.cc (General_options::finalize): Use library search path
3047         from configure script if specified.  If not native and no sysroot,
3048         only search TOOLLIBDIR.
3049         * options.h (Search_directory::Search_directory): Change name to
3050         const std::string&.
3051         (General_options::add_to_library_path_with_sysroot): Change arg to
3052         const std::string&.
3053         * configure, Makefile.in, config.in: Rebuild.
3054
3055 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3056
3057         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3058         we are working around the ARM1176 Erratum.
3059         * options.h (General_options::fix_arm1176): Add option.
3060         * testsuite/Makefile.am: Add testcases, and keep current ones
3061         working.
3062         * testsuite/Makefile.in: Regenerate.
3063         * testsuite/arm_fix_1176.s: New file.
3064         * testsuite/arm_fix_1176.sh: Likewise.
3065
3066 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3067
3068         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3069         may_use_blx_.
3070         (Target_arm::may_use_blx): Remove method.
3071         (Target_arm::set_may_use_blx): Likewise.
3072         (Target_arm::may_use_v4t_interworking): New method.
3073         (Target_arm::may_use_v5t_interworking): Likewise.
3074         (Target_arm::may_use_blx_): Remove member variable.
3075         (Arm_relocate_functions::arm_branch_common): Check for v5T
3076         interworking.
3077         (Arm_relocate_functions::thumb_branch_common): Likewise.
3078         (Reloc_stub::stub_type_for_reloc): Likewise.
3079         (Target_arm::do_finalize_sections): Correct interworking checks.
3080         * testsuite/Makefile.am: Add new tests.
3081         * testsuite/Makefile.in: Regenerate.
3082         * testsuite/arm_farcall_arm_arm.s: New test.
3083         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3084         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3085         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3086         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3087         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3088         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3089         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3090
3091 2011-10-31  Cary Coutant  <ccoutant@google.com>
3092
3093         PR gold/13023
3094         * expression.cc (Expression::eval_with_dot): Add
3095         is_section_dot_assignment parameter.
3096         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3097         absolute and assigning to dot within a section.
3098         * script-sections.cc
3099         (Output_section_element_assignment::set_section_addresses): Pass
3100         dot_section to set_if_absolute.
3101         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3102         as is_section_dot_assignment flag to eval_with_dot.
3103         (Output_section_element_dot_assignment::set_section_addresses):
3104         Likewise.
3105         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3106         parameter.  Also set value if relative to dot_section; set the
3107         symbol's output_section.
3108         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3109         parameter.  Adjust all callers.
3110         (Expression::eval_maybe_dot): Likewise.
3111         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3112         Adjust all callers.
3113         * testsuite/script_test_2.t: Test assignment of an absolute value
3114         to dot within an output section element.
3115
3116 2011-10-31  Cary Coutant  <ccoutant@google.com>
3117
3118         * options.h (class General_options): Add --[no-]gnu-unique options.
3119         * symtab.cc (Symbol_table::sized_write_globals): Convert
3120         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3121
3122 2011-10-31  Cary Coutant  <ccoutant@google.com>
3123
3124         PR gold/13359
3125         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3126         unnecessary assertion.
3127         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3128
3129 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3130
3131         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3132         gc_mark_symbol.
3133         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3134         gc_mark_symbol.
3135         Change to just keep the section associated with symbol.
3136         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3137         they are externally visible and --export-dynamic is turned on.
3138         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3139
3140 2011-10-19  Ian Lance Taylor  <iant@google.com>
3141
3142         PR gold/13163
3143         * script-sections.cc
3144         (Output_section_element_dot_assignment::needs_output_section): New
3145         function.
3146
3147 2011-10-19  Ian Lance Taylor  <iant@google.com>
3148
3149         PR gold/13204
3150         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3151         --section-start option was seen.
3152         * options.h (General_options::any_section_start): New function.
3153
3154 2011-10-18  David S. Miller  <davem@davemloft.net>
3155
3156         PR binutils/13301
3157         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3158         member to track relocation locations that have moved during TLS
3159         reloc optimizations.
3160         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3161         (Target_sparc::Relocate::relocate): Adjust view down by 4
3162         bytes if it matches reloc_adjust_addr_.
3163         (Target_sparc::Relocate::relocate_tls): Always move the
3164         __tls_get_addr call delay slot instruction forward 4 bytes when
3165         performing relaxation.
3166
3167 2011-10-18  Cary Coutant  <ccoutant@google.com>
3168
3169         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3170         (Output_file::map_no_anonymous): Check for non-zero
3171         return code from posix_fallocate.
3172
3173 2011-10-17  Cary Coutant  <ccoutant@google.com>
3174
3175         PR gold/13245
3176         * plugin.cc (is_visible_from_outside): Check for symbols
3177         referenced from dynamic objects.
3178         * resolve.cc (Symbol_table::resolve): Don't count references
3179         from dynamic objects as references from real ELF files.
3180         * testsuite/plugin_test_2.sh: Adjust expected result.
3181
3182 2011-10-17  Cary Coutant  <ccoutant@google.com>
3183
3184         * gold.cc: Include timer.h.
3185         (queue_middle_tasks): Stamp time.
3186         (queue_final_tasks): Likewise.
3187         * main.cc (main): Store timer in parameters.  Print timers
3188         for each pass.
3189         * parameters.cc (Parameters::Parameters): Initialize timer_.
3190         (Parameters::set_timer): New function.
3191         (set_parameters_timer): New function.
3192         * parameters.h (Parameters::set_timer): New function.
3193         (Parameters::timer): New function.
3194         (Parameters::timer_): New data member.
3195         (set_parameters_timer): New function.
3196         * timer.cc (Timer::stamp): New function.
3197         (Timer::get_pass_time): New function.
3198         * timer.h (Timer::stamp): New function.
3199         (Timer::get_pass_time): New function.
3200         (Timer::pass_times_): New data member.
3201
3202 2011-10-17  Cary Coutant  <ccoutant@google.com>
3203
3204         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3205         task for members of lib groups.
3206
3207 2011-10-17  Cary Coutant  <ccoutant@google.com>
3208
3209         PR gold/13288
3210         * fileread.cc (File_read::find_view): Add assert.
3211         (File_read::make_view): Move bounds check (replace with assert)...
3212         (File_read::find_or_make_view): ... to here.
3213
3214 2011-10-12  Cary Coutant  <ccoutant@google.com>
3215
3216         * output.cc (Output_file::open_base_file): Handle case where
3217         ::read returns less than requested size.
3218
3219 2011-10-10  Cary Coutant  <ccoutant@google.com>
3220
3221         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3222         Initialize defined_count_.
3223         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3224         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3225         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3226         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3227         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3228         * incremental.h (Sized_relobj_incr::defined_count_): New data
3229         member.
3230         (Sized_incr_dynobj::defined_count_): New data member.
3231         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3232         Return zeroes instead of internal error.
3233
3234 2011-10-10  Cary Coutant  <ccoutant@google.com>
3235
3236         PR gold/13249
3237         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3238         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3239         * output.h (class Output_reloc): Add use_plt_offset flag.
3240         (Output_reloc::type_): Adjust size of bit field.
3241         (Output_reloc::use_plt_offset_): New bit field.
3242         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3243         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3244         flag.  Adjust all callers.
3245         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3246         creating RELATIVE relocations.
3247
3248 2011-10-10  Nick Clifton  <nickc@redhat.com>
3249
3250         * po/es.po: Updated Spanish translation.
3251         * po/fi.po: Updated Finnish translation.
3252
3253 2011-10-03   Diego Novillo  <dnovillo@google.com>
3254
3255         * options.cc (parse_uint): Fix dereference of RETVAL.
3256
3257 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3258
3259         * layout.h (section_order_map_): New member.
3260         (get_section_order_map): New member function.
3261         * output.cc (Output_section::add_input_section): Check for patterns
3262         only when --section-ordering-file is specified.
3263         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3264         output_sections have been formed.
3265         * layout.cc (Layout_Layout): Initialize section_order_map_.
3266         * plugin.cc (update_section_order): Store order in order_map. Do not
3267         update the order.
3268         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3269         * testsuite/Makefile.in: Regenerate.
3270         * testsuite/plugin_section_order.c: New file.
3271         * testsuite/plugin_final_layout.cc: New file.
3272         * testsuite/plugin_final_layout.sh: New file.
3273
3274 2011-09-29  Cary Coutant  <ccoutant@google.com>
3275
3276         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3277         Check for NULL.
3278         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3279         symbols during incremental update.
3280         (Symbol_table::add_from_dynobj): Likewise.
3281
3282 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3283             Ian Lance Taylor  <iant@google.com>
3284
3285         * symtab.cc (Symbol_table::define_special_symbol): Always
3286         canonicalize version string.
3287
3288 2011-09-26  Cary Coutant  <ccoutant@google.com>
3289
3290         * gold.cc (queue_initial_tasks): Move option checks ...
3291         * options.cc (General_options::finalize): ... to here. Disable
3292         some options; make others fatal.
3293
3294 2011-09-26  Cary Coutant  <ccoutant@google.com>
3295
3296         gcc PR lto/47247
3297         * plugin.cc (get_symbols_v2): New function.
3298         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3299         (is_referenced_from_outside): New function.
3300         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3301         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3302         (get_symbols): Pass version parameter.
3303         (get_symbols_v2): New function.
3304         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3305         parameter.
3306         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3307         (onload): Add LDPT_GET_SYMBOLS_V2.
3308         (all_symbols_read_hook): Use get_symbols_v2; check for
3309         LDPR_PREVAILING_DEF_IRONLY_EXP.
3310         * testsuite/plugin_test_3.sh: Update expected results.
3311
3312 2011-09-23  Simon Baldwin  <simonb@google.com>
3313
3314         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3315         configuration options.
3316         * configure: Regenerate.
3317         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3318         * Makefile.in: Regenerate.
3319         * testsuite/Makefile.in: Regenerate.
3320
3321 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3322
3323         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3324
3325 2011-09-19  Cary Coutant  <ccoutant@google.com>
3326
3327         * incremental.cc (can_incremental_update): Fix typo in comment.
3328         * incremental.h (can_incremental_update): Likewise.
3329
3330 2011-09-18  Cary Coutant  <ccoutant@google.com>
3331
3332         * incremental.cc (can_incremental_update): New function.
3333         * incremental.h (can_incremental_update): New function.
3334         * layout.cc (Layout::init_fixed_output_section): Call it.
3335         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3336         * object.cc (Sized_relobj_file::do_layout): Call
3337         can_incremental_update.
3338
3339 2011-09-13  Cary Coutant  <ccoutant@google.com>
3340
3341         * configure.ac: Check for glibc support for gnu_indirect_function
3342         support with static linking, setting automake conditional
3343         IFUNC_STATIC.
3344         * Makefile.in: Regenerate.
3345         * configure: Regenerate.
3346
3347         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3348         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3349         for IFUNC_STATIC.
3350         * testsuite/Makefile.in: Regenerate.
3351
3352 2011-09-13  Cary Coutant  <ccoutant@google.com>
3353
3354         * incremental.cc (Sized_relobj_incr::do_layout): Call
3355         report_comdat_group for kept comdat sections.
3356         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3357         * testsuite/Makefile.in: Regenerate.
3358         * testsuite/incr_comdat_test_1.cc: New source file.
3359         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3360         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3361         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3362
3363 2011-09-13  Ian Lance Taylor  <iant@google.com>
3364
3365         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3366         variable external_symbols_offset.
3367
3368 2011-09-12  Ian Lance Taylor  <iant@google.com>
3369
3370         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3371         triggered if object has no symbols.
3372
3373 2011-09-09  David S. Miller  <davem@davemloft.net>
3374
3375         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3376         (Output_fill_debug_line::do_write): Likewise.
3377
3378 2011-08-29  Cary Coutant  <ccoutant@google.com>
3379
3380         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3381         casts to match formatting specs.
3382         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3383
3384 2011-08-26  Cary Coutant  <ccoutant@google.com>
3385
3386         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3387         remaining hole size when allocating.
3388         (Layout::make_output_section): Set fill methods for debug sections.
3389         * layout.h (Free_list::Free_list_node): Move from private to
3390         public.
3391         (Free_list::set_min_hole_size): New function.
3392         (Free_list::begin, Free_list::end): New functions.
3393         (Free_list::min_hole_): New data member.
3394         * output.cc: Include dwarf.h.
3395         (Output_fill_debug_info::do_minimum_hole_size): New function.
3396         (Output_fill_debug_info::do_write): New function.
3397         (Output_fill_debug_line::do_minimum_hole_size): New function.
3398         (Output_fill_debug_line::do_write): New function.
3399         (Output_section::Output_section): Initialize new data member.
3400         (Output_section::set_final_data_size): Ensure patch space is larger
3401         than minimum hole size.
3402         (Output_section::do_write): Fill holes in debug sections.
3403         * output.h (Output_fill): New class.
3404         (Output_fill_debug_info): New class.
3405         (Output_fill_debug_line): New class.
3406         (Output_section::set_free_space_fill): New function.
3407         (Output_section::free_space_fill_): New data member.
3408         * testsuite/Makefile.am (incremental_test_3): Add
3409         --incremental-patch option.
3410         (incremental_test_4): Likewise.
3411         (incremental_test_5): Likewise.
3412         (incremental_test_6): Likewise.
3413         (incremental_copy_test): Likewise.
3414         (incremental_common_test_1): Likewise.
3415         * testsuite/Makefile.in: Regenerate.
3416
3417 2011-08-26  Nick Clifton  <nickc@redhat.com>
3418
3419         * po/es.po: Updated Spanish translation.
3420
3421 2011-08-01  Cary Coutant  <ccoutant@google.com>
3422
3423         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3424         * gold/testsuite/Makefile.in: Regenerate.
3425         * gold/testsuite/justsyms_exec.c: New source file.
3426         * gold/testsuite/justsyms_lib.c: New source file.
3427
3428 2011-08-01  Cary Coutant  <ccoutant@google.com>
3429
3430         * layout.cc (Layout::set_segment_offsets): Don't realign text
3431         segment if -Ttext was specified.
3432         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3433         file type.
3434         * object.h (Sized_relobj_file::e_type): New function.
3435         (Sized_relobj_file::e_type_): New data member.
3436         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3437         base address for ET_EXEC files.
3438         * target.cc (Target::do_make_elf_object_implementation): Allow
3439         ET_EXEC files with --just-symbols option.
3440
3441 2011-07-28  Cary Coutant  <ccoutant@google.com>
3442
3443         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3444         Add thread_number parameter.
3445         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3446         * workqueue-threads.cc
3447         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3448         current thread if its thread number is greater than desired thread
3449         count.
3450         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3451         Add thread_number parameter.
3452         (Workqueue::should_cancel_thread): Likewise.
3453         (Workqueue::find_runnable_or_wait): Pass thread_number to
3454         should_cancel_thread.
3455         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3456         parameter.
3457
3458 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3459
3460         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3461         only after checking if it cannot be forced local.
3462         * symtab.h (is_externally_visible): Check if the symbol is not forced
3463         local.
3464
3465 2011-07-15  Ian Lance Taylor  <iant@google.com>
3466
3467         * options.h (class General_options): Add --print-output-format.
3468         Move -EL next to -EB, for  better --help output.
3469         * target-select.cc: Include <cstdio>, "options.h", and
3470         "parameters.h".
3471         (Target_selector::do_target_bfd_name): New function.
3472         (print_output_format): New function.
3473         * target-select.h (class Target_selector): Update declarations.
3474         (Target_selector::target_bfd_name): New function.
3475         (print_output_format): Declare.
3476         * main.cc: Include "target-select.h".
3477         (main): Handle --print-output-format.
3478         * gold.cc: Include "target-select.h".
3479         (queue_initial_tasks): Handle --print-output-format when there are
3480         no input files.
3481         * parameters.cc (parameters_force_valid_target): Give a better
3482         error message if -EB/-EL does not match target.
3483         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3484         function.
3485
3486 2011-07-15  Ian Lance Taylor  <iant@google.com>
3487
3488         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3489         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3490         (Output_data_plt_i386::do_write): Write address of .dynamic
3491         section to first entry in .got.plt section.
3492         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3493         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3494         Initialize layout_.
3495         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3496         section to first entry in .got.plt section.
3497         * layout.h (Layout::dynamic_section): New function.
3498
3499 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3500
3501         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3502         to claim_file call.
3503         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3504         input_section_position_, and input_section_glob_.
3505         (read_layout_from_file): Call function section_ordering_specified.
3506         * layout.h (is_section_ordering_specified): New function.
3507         (section_ordering_specified): New function.
3508         (section_ordering_specified_): New boolean member.
3509         * main.cc(main): Call load_plugins after layout object is defined.
3510         * output.cc (Output_section::add_input_section): Use
3511         function section_ordering_specified to check if section ordering is
3512         needed.
3513         * output.cc (Output_section::add_relaxed_input_section): Use
3514         function section_ordering_specified to check if section ordering is
3515         needed.
3516         (Output_section::update_section_layout): New function.
3517         (Output_section::sort_attached_input_sections): Check if input section
3518         must be reordered.
3519         * output.h (Output_section::update_section_layout): New function.
3520         * plugin.cc (get_section_count): New function.
3521         (get_section_type): New function.
3522         (get_section_name): New function.
3523         (get_section_contents): New function.
3524         (update_section_order): New function.
3525         (allow_section_ordering): New function.
3526         (Plugin::load): Add the new interfaces to the transfer vector.
3527         (Plugin_manager::load_plugins): New parameter.
3528         (Plugin_manager::all_symbols_read): New parameter.
3529         (Plugin_manager::claim_file): New parameter. Save the elf object for
3530         unclaimed objects.
3531         (Plugin_manager::get_elf_object): New function.
3532         (Plugin_manager::get_view): Change to directly use the bool to check
3533         if get_view is called from claim_file_hook.
3534         * plugin.h (input_objects): New function
3535         (Plugin__manager::load_plugins): New parameter.
3536         (Plugin_manager::claim_file): New parameter.
3537         (Plugin_manager::get_elf_object): New function.
3538         (Plugin_manager::in_claim_file_handler): New function.
3539         (Plugin_manager::in_claim_file_handler_): New member.
3540         (layout): New function.
3541         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3542         handler with an extra parameter. Make the elf object before calling
3543         claim_file handler.
3544         * testsuite/plugin_test.c (get_section_count): New function pointer.
3545         (get_section_type): New function pointer.
3546         (get_section_name): New function pointer.
3547         (get_section_contents): New function pointer.
3548         (update_section_order): New function pointer.
3549         (allow_section_ordering): New function pointer.
3550         (onload): Check if the new interfaces exist.
3551
3552 2011-07-13  Ian Lance Taylor  <iant@google.com>
3553
3554         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3555         relro section.
3556         * x86_64.cc (Target_x86_64::got_section): Likewise.
3557         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3558         (relro_now_test_SOURCES): New variable.
3559         (relro_now_test_DEPENDENCIES): New variable.
3560         (relro_now_test_LDFLAGS): New variable.
3561         (relro_now_test_LDADD): New variable.
3562         (relro_now_test.so): New target.
3563         * testsuite/Makefile.in: Rebuild.
3564
3565 2011-07-12  Ian Lance Taylor  <iant@google.com>
3566
3567         PR gold/12980
3568         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3569         GLOB_DAT relocation rather than a RELATIVE relocation for a
3570         protected symbol when creating a shared library.
3571         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3572         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3573         * testsuite/protected_main_1.cc (main): Test that protected
3574         function has same address.
3575
3576 2011-07-11  Ian Lance Taylor  <iant@google.com>
3577
3578         PR gold/12979
3579         * options.h (class General_options): Add -Bgroup.
3580         * options.cc (General_options::finalize): If -Bgroup is set,
3581         default to --unresolved-symbols=report-all.
3582         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3583         * target-reloc.h (issue_undefined_symbol_error): Handle
3584         --unresolved-symbols=report-all.
3585
3586 2011-07-08  Ian Lance Taylor  <iant@google.com>
3587
3588         PR gold/11985
3589         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3590         if linker script discards key sections.
3591         (Layout::create_dynamic_symtab): Likewise.
3592         (Layout::assign_local_dynsym_offsets): Likewise.
3593         (Layout::sized_create_version_sections): Likewise.
3594         (Layout::create_interp): Likewise.
3595         (Layout::finish_dynamic_section): Likewise.
3596         (Layout::set_dynamic_symbol_size): Likewise.
3597
3598 2011-07-08  Ian Lance Taylor  <iant@google.com>
3599
3600         PR gold/12386
3601         * options.h (class General_options): Add --unresolved-symbols.
3602         * target-reloc.h (issue_undefined_symbol_error): Check
3603         --unresolved-symbols.  Add comments.
3604
3605 2011-07-08  Ian Lance Taylor  <iant@google.com>
3606
3607         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3608         expression more complex.
3609
3610 2011-07-08  Ian Lance Taylor  <iant@google.com>
3611
3612         PR gold/11317
3613         * target-reloc.h (issue_undefined_symbol_error): New inline
3614         function, broken out of relocate_section.
3615         (relocate_section): Call issue_undefined_symbol_error.
3616         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3617         there is no TLS segment if we are about to issue an undefined
3618         symbol error.
3619         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3620
3621 2011-07-08  Ian Lance Taylor  <iant@google.com>
3622
3623         PR gold/12279
3624         * resolve.cc (Symbol_table::should_override): Add fromtype
3625         parameter.  Change all callers.  Give error when linking together
3626         TLS and non-TLS symbol.
3627         (Symbol_table::should_override_with_special): Add fromtype
3628         parameter.  Change all callers.
3629         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3630         there is no TLS segment if we have reported some errors.
3631         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3632
3633 2011-07-08  Ian Lance Taylor  <iant@google.com>
3634
3635         PR gold/12372
3636         * target.h (Target::plt_address_for_global): New function.
3637         (Target::plt_address_for_local): New function.
3638         (Target::plt_section_for_global): Remove.
3639         (Target::plt_section_for_local): Remove.
3640         (Target::do_plt_address_for_global): New virtual function.
3641         (Target::do_plt_address_for_local): New virtual function.
3642         (Target::do_plt_section_for_global): Remove.
3643         (Target::do_plt_section_for_local): Remove.
3644         (Target::register_global_plt_entry): Add Symbol_table and Layout
3645         parameters.
3646         * output.cc (Output_data_got::Got_entry::write): Use
3647         plt_address_for_global and plt_address_for_local.
3648         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3649         address of output section.
3650         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3651         got_irelative_, and irelative_count_ fields.  Update
3652         declarations.
3653         (Output_data_plt_i386::has_irelative_section): New function.
3654         (Output_data_plt_i386::entry_count): Add irelative_count_.
3655         (Output_data_plt_i386::set_final_data_size): Likewise.
3656         (class Target_i386): Add got_irelative_ and rel_irelative_
3657         fields.  Update declarations.
3658         (Target_i386::Target_i386): Initialize new fields.
3659         (Target_i386::do_plt_address_for_global): New function replacing
3660         do_plt_section_for_global.
3661         (Target_i386::do_plt_address_for_local): New function replacing
3662         do_plt_section_for_local.
3663         (Target_i386::got_section): Create got_irelative_.
3664         (Target_i386::rel_irelative_section): New function.
3665         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3666         fields.  Don't define __rel_iplt_{start,end}.
3667         (Output_data_plt_i386::add_entry): Add symtab and layout
3668         parameters.  Change all callers.  Use different PLT and GOT for
3669         IFUNC symbols.
3670         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3671         layout parameters.  Change all callers.  Use different PLT and
3672         GOT.
3673         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3674         (Output_data_plt_i386::rel_irelative): New function.
3675         (Output_data_plt_i386::address_for_global): New function.
3676         (Output_data_plt_i386::address_for_local): New function.
3677         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3678         IRELATIVE GOT when changing IFUNC GOT entries.
3679         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3680         reloc.
3681         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3682         if we didn't create an IRELATIVE GOT.
3683         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3684         plt_address_for_local.
3685         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3686         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3687         got_irelative_, and irelative_count_ fields.  Update
3688         declarations.
3689         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3690         Initialize new fields.  Remove symtab parameter.  Change all
3691         callers.
3692         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3693         irelative_count_.
3694         (Output_data_plt_x86_64::has_irelative_section): New function.
3695         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3696         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3697         fields.  Update declarations.
3698         (Target_x86_64::Target_x86_64): Initialize new fields.
3699         (Target_x86_64::do_plt_address_for_global): New function replacing
3700         do_plt_section_for_global.
3701         (Target_x86_64::do_plt_address_for_local): New function replacing
3702         do_plt_section_for_local.
3703         (Target_x86_64::got_section): Create got_irelative_.
3704         (Target_x86_64::rela_irelative_section): New function.
3705         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3706         all callers.  Don't create __rel_iplt_{start,end}.
3707         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3708         parameters.  Change all callers.  Use different PLT and GOT for
3709         IFUNC symbols.
3710         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3711         layout parameters.  Change all callers.  Use different PLT and
3712         GOT.
3713         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3714         parameters.  Change all callers.  Use different PLT and GOT for
3715         IFUNC symbols.
3716         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3717         (Output_data_plt_x86_64::rela_irelative): New function.
3718         (Output_data_plt_x86_64::address_for_global): New function.
3719         (Output_data_plt_x86_64::address_for_local): New function.
3720         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3721         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3722         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3723         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3724         parameters.
3725         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3726         reloc.
3727         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3728         symbols if we didn't create an IRELATIVE GOT.
3729         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3730         plt_address_for_local.
3731         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3732         * testsuite/ifuncvar1.c: New test file.
3733         * testsuite/ifuncvar2.c: New test file.
3734         * testsuite/ifuncvar3.c: New test file.
3735         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3736         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3737         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3738         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3739         * testsuite/Makefile.in: Rebuild.
3740
3741 2011-07-07  Cary Coutant  <ccoutant@google.com>
3742
3743         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3744         (two_file_test_1_ndebug.o): Likewise.
3745         (two_file_test_1b_ndebug.o): Likewise.
3746         (two_file_test_2_ndebug.o): Likewise.
3747         (two_file_test_main_ndebug.o): Likewise.
3748         (incremental_test_2): Link with no-debug versions.
3749
3750 2011-07-06  Cary Coutant  <ccoutant@google.com>
3751
3752         * gold/incremental.cc
3753         (Output_section_incremental_inputs::write_info_blocks): Check for
3754         hidden and internal symbols.
3755
3756 2011-07-06  Cary Coutant  <ccoutant@google.com>
3757
3758         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3759         Check disposition for startup file.
3760         (Incremental_inputs::report_command_line): Ignore
3761         --incremental-startup-unchanged option.
3762         * options.cc (General_options::parse_incremental_startup_unchanged):
3763         New function.
3764         (General_options::General_options): Initialize new data member.
3765         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3766         (General_options): Add --incremental-startup-unchanged option.
3767         (General_options::incremental_startup_disposition): New function.
3768         (General_options::incremental_startup_disposition_): New data member.
3769
3770 2011-07-06  Cary Coutant  <ccoutant@google.com>
3771
3772         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3773         input file index to Script_info ctor.
3774         (Sized_incremental_binary::do_file_has_changed): Find the
3775         command-line argument for files named in scripts.
3776         * incremental.h (Script_info::Script_info): New ctor
3777         with input file index.
3778         (Script_info::input_file_index): New function.
3779         (Script_info::input_file_index_): New data member.
3780         (Incremental_binary::get_library): Add const.
3781         (Incremental_binary::get_script_info): Add const.
3782         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3783         * testsuite/Makefile.am (incremental_test_5): New test case.
3784         (incremental_test_6): New test case.
3785         * testsuite/Makefile.in: Regenerate.
3786
3787 2011-07-06  Cary Coutant  <ccoutant@google.com>
3788
3789         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3790         debug output when command lines differ.
3791
3792 2011-07-06  Cary Coutant  <ccoutant@google.com>
3793
3794         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3795         --incremental-patch option.
3796         * layout.cc (Free_list::allocate): Extend allocation beyond original
3797         end if enabled.
3798         (Layout::make_output_section): Mark sections that should get
3799         patch space.
3800         * options.cc (parse_percent): New function.
3801         * options.h (parse_percent): New function.
3802         (DEFINE_percent): New macro.
3803         (General_options): Add --incremental-patch option.
3804         * output.cc (Output_section::Output_section): Initialize new data
3805         members.
3806         (Output_section::add_input_section): Print section name when out
3807         of patch space.
3808         (Output_section::add_output_section_data): Likewise.
3809         (Output_section::set_final_data_size): Add patch space when
3810         doing --incremental-full.
3811         (Output_section::do_reset_address_and_file_offset): Remove patch
3812         space.
3813         (Output_segment::set_section_list_addresses): Print debug output
3814         only if --incremental-update.
3815         * output.h (Output_section::set_is_patch_space_allowed): New function.
3816         (Output_section::is_patch_space_allowed_): New data member.
3817         (Output_section::patch_space_): New data member.
3818         * parameters.cc (Parameters::incremental_full): New function.
3819         * parameters.h (Parameters::incremental_full): New function
3820         * testsuite/Makefile.am (incremental_test_2): Add test for
3821         --incremental-patch option.
3822         * testsuite/Makefile.in: Regenerate.
3823         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3824         (t18): Remove function body.
3825
3826 2011-07-05  Doug Kwan  <dougkwan@google.com>
3827
3828         PR gold/12771
3829         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3830         Arm_Address type for relocation result.
3831         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3832         overflow check.
3833         (Arm_relocate_functions::abs32): Use unaligned access.
3834         (Arm_relocate_functions::rel32): Ditto.
3835         (Arm_relocate_functions::prel31): Ditto.
3836         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3837         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3838         static data relocations.
3839         * testsuite/Makefile.in: Regnerate.
3840         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3841
3842 2011-07-05  Ian Lance Taylor  <iant@google.com>
3843
3844         PR gold/12392
3845         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3846         symbols if necessary.
3847         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3848
3849 2011-07-05  Ian Lance Taylor  <iant@google.com>
3850
3851         PR gold/12952
3852         * resolve.cc (Symbol::override_base_with_special): Simply override
3853         version with special symbol version, ignoring previous version.
3854
3855 2011-07-05  Ian Lance Taylor  <iant@google.com>
3856
3857         * object.cc (Sized_relobj_file::include_section_group): Add
3858         information to comment about signature location.
3859
3860 2011-07-02  Ian Lance Taylor  <iant@google.com>
3861
3862         PR gold/12957
3863         * options.h (class General_options): Add -f and -F.
3864         * options.cc (General_options::finalize): Fatal error if -f/-F
3865         are used without -shared.
3866         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3867
3868 2011-07-02  Ian Lance Taylor  <iant@google.com>
3869
3870         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3871
3872 2011-07-01  Ian Lance Taylor  <iant@google.com>
3873
3874         PR gold/12525
3875         PR gold/12952
3876         * resolve.cc (Symbol::override_base_with_special): Don't override
3877         the version if the overriding symbol has a different name.
3878         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3879         all callers.  If we give an error about an undefined version,
3880         define the base version if necessary.
3881         * dynobj.h (class Versions): Update declaration.
3882         * testsuite/weak_alias_test_5.cc: New file.
3883         * testsuite/weak_alias_test.script: New file.
3884         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3885         and versioned_alias have the right value, and call t2.
3886         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3887         weak_alias_test_5.so.
3888         (weak_alias_test_LDADD): Likewise.
3889         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3890         * testsuite/Makefile.in: Rebuild.
3891
3892 2011-07-01  Ian Lance Taylor  <iant@google.com>
3893
3894         PR gold/12525
3895         * options.h (class General_options): Support -z notext.
3896         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
3897         -Wl,-z,notext.
3898         (two_file_shared_nonpic.so): Likewise.
3899         (two_file_shared_mixed.so): Likewise.
3900         (two_file_shared_mixed_1.so): Likewise.
3901         (weak_undef_lib_nonpic.so): Likewise.
3902         (alt/weak_undef_lib_nonpic.so): Likewise.
3903         (tls_test_shared_nonpic.so): Likewise.
3904         * testsuite/Makefile.in: Rebuild.
3905
3906 2011-07-01  Ian Lance Taylor  <iant@google.com>
3907
3908         PR gold/12525
3909         * configure.ac: Test whether static linking works, setting
3910         the automake conditional HAVE_STATIC.
3911         * testsuite/Makefile.am: Disable tests using -static if
3912         HAVE_STATIC is not true.
3913         * configure, testsuite/Makefile.in: Rebuild.
3914
3915 2011-07-01  Ian Lance Taylor  <iant@google.com>
3916
3917         PR gold/12525
3918         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
3919         Assert if we see DW_EH_PE_indirect.
3920         * target.h (Target::ehframe_datarel_base): New function.
3921         (Target::do_ehframe_datarel_base): New target function.
3922         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
3923         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
3924         function.
3925
3926 2011-07-01  Ian Lance Taylor  <iant@google.com>
3927
3928         PR gold/12571
3929         * options.h (class General_options): Add
3930         --ld-generated-unwind-info.
3931         * ehframe.cc (Fde::write): Add address parameter.  Change all
3932         callers.  If associated with PLT, fill in address and size.
3933         (Cie::set_output_offset): Only add merge mapping if there is an
3934         object.
3935         (Cie::write): Add address parameter.  Change all callers.
3936         (Eh_frame::add_ehframe_for_plt): New function.
3937         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
3938         input_offset_ fields into union u_, with new plt field.
3939         (Fde::Fde): Adjust for new union field.
3940         (Fde::Fde) [Output_data version]: New constructor.
3941         (Fde::add_mapping): Only add merge mapping if there is an object.
3942         (class Cie): Update declarations.
3943         (class Eh_frame): Declare add_ehframe_for_plt.
3944         * layout.cc (Layout::layout_eh_frame): Break out code into
3945         make_eh_frame_section, and call it.
3946         (Layout::make_eh_frame_section): New function.
3947         (Layout::add_eh_frame_for_plt): New function.
3948         * layout.h (class Layout): Update declarations.
3949         * merge.cc (Merge_map::add_mapping): Add assertion.
3950         * i386.cc: Include "dwarf.h".
3951         (class Output_data_plt_i386): Make first_plt_entry,
3952         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
3953         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3954         and plt_eh_frame_fde.
3955         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
3956         boundary.  Call add_eh_frame_for_plt if appropriate.
3957         * x86_64.cc: Include "dwarf.h".
3958         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
3959         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
3960         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
3961         and plt_eh_frame_fde.
3962         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
3963         appropriate.
3964
3965 2011-06-29  Ian Lance Taylor  <iant@google.com>
3966
3967         PR gold/12629
3968         * object.cc (Sized_relobj_file::layout_section): Change shdr
3969         parameter to be const.
3970         (Sized_relobj_file::layout_eh_frame_section): New function, broken
3971         out of do_layout.
3972         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
3973         appropriate.  Call layout_eh_frame_section.
3974         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
3975         sections.
3976         * object.h (class Sized_relobj_file): Update declarations.
3977
3978 2011-06-29  Ian Lance Taylor  <iant@google.com>
3979
3980         PR gold/12652
3981         * script.cc (Token::integer_value): Accept trailing M/m/K/k
3982         modifier.
3983         (Lex::gather_token): Accept trailing M/m/K/k for integers.
3984
3985 2011-06-29  Ian Lance Taylor  <iant@google.com>
3986
3987         PR gold/12675
3988         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
3989         SHT_X86_64_UNWIND.
3990         * layout.cc (Layout::layout_eh_frame): Likewise.
3991
3992 2011-06-29  Ian Lance Taylor  <iant@google.com>
3993
3994         PR gold/12695
3995         * layout.cc (Layout::symtab_section_shndx): New function.
3996         * layout.h (class Layout): Declare symtab_section_shndx.
3997         * output.cc (Output_section::write_header): Call it.
3998
3999 2011-06-29  Ian Lance Taylor  <iant@google.com>
4000
4001         PR gold/12818
4002         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4003         symbols which are not used in a relocation.
4004
4005 2011-06-28  Ian Lance Taylor  <iant@google.com>
4006
4007         PR gold/12898
4008         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4009         script create indistinguishable segments.
4010         (Layout::set_segment_offsets): Use stable_sort when sorting
4011         segments.  Pass this to Compare_segments constructor.
4012         * layout.h (class Layout): Make segment_precedes non-static.
4013         (class Compare_segments): Change from struct to class.  Add
4014         layout_ field.  Add constructor.
4015         * script-sections.cc
4016         (Script_sections::attach_sections_using_phdrs_clause): Rename
4017         local orphan to is_orphan.  Don't report failure to put empty
4018         section in segment.  On attachment failure, report name of
4019         section, and attach to first PT_LOAD segment.
4020
4021 2011-06-28  Ian Lance Taylor  <iant@google.com>
4022
4023         PR gold/12934
4024         * target-select.cc (Target_selector::Target_selector): Add
4025         emulation parameter.  Change all callers.
4026         (select_target_by_bfd_name): Rename from select_target_by_name.
4027         Change all callers.
4028         (select_target_by_emulation): New function.
4029         (supported_emulation_names): New function.
4030         * target-select.h (class Target_selector): Add emulation_ field.
4031         Update declarations.
4032         (Target_selector::recognize_by_bfd_name): Rename from
4033         recognize_by_name.  Change all callers.
4034         (Target_selector::supported_bfd_names): Rename from
4035         supported_names.  Change all callers.
4036         (Target_selector::recognize_by_emulation): New function.
4037         (Target_selector::supported_emulations): New function.
4038         (Target_selector::emulation): New function.
4039         (Target_selector::do_recognize_by_bfd_name): Rename from
4040         do_recognize_by_name.  Change all callers.
4041         (Target_selector::do_supported_bfd_names): Rename from
4042         do_supported_names.  Change all callers.
4043         (Target_selector::do_recognize_by_emulation): New function.
4044         (Target_selector::do_supported_emulations): New function.
4045         (select_target_by_bfd_name): Change name in declaration.
4046         (select_target_by_emulation): Declare.
4047         (supported_emulation_names): Declare.
4048         * parameters.cc (parameters_force_valid_target): Try to find
4049         target based on emulation from -m option.
4050         * options.h (class General_options): Change doc string for -m.
4051         * options.cc (help): Print emulations.
4052         (General_options::parse_V): Likewise.
4053         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4054         Add emulation parameter.  Change all callers.
4055
4056 2011-06-28  Ian Lance Taylor  <iant@google.com>
4057
4058         * target.h (class Target): Add osabi_ field.
4059         (Target::osabi): New function.
4060         (Target::set_osabi): New function.
4061         (Target::Target): Initialize osabi_.
4062         (Target::do_adjust_elf_header): Make pure virtual.
4063         (Sized_target::do_adjust_elf_header): Declare.
4064         * target.cc (Sized_target::do_adjust_elf_header): New function.
4065         (class Sized_target): Instantiate all versions.
4066         * freebsd.h (class Target_freebsd): Remove.
4067         (Target_selector_freebsd::do_recognize): Call set_osabi on
4068         Target.
4069         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4070         (Target_selector_freebsd::set_osabi): Remove.
4071         * i386.cc (class Target_i386): Inherit from Sized_target rather
4072         than Target_freebsd.
4073         * x86_64.cc (class Target_x86_64): Likewise.
4074
4075 2011-06-28  Ian Lance Taylor  <iant@google.com>
4076
4077         * target.h (Target::can_check_for_function_pointers): Rewrite.
4078         Make non-virtual.
4079         (Target::can_icf_inline_merge_sections): Likewise.
4080         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4081         (Target::Target_info): Add can_icf_inline_merge_sections field.
4082         (Target::do_can_check_for_function_pointers): New virtual
4083         function.
4084         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4085         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4086         from can_check_for_function_pointers, move in file.
4087         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4088         section_may_have_icf_unsafe_poineters, move in file.
4089         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4090         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4091         Rename from can_check_for_function_pointers, move in file.
4092         (Target_i386::can_icf_inline_merge_sections): Remove.
4093         (Target_i386::i386_info): Initialize
4094         can_icf_inline_merge_sections.
4095         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4096         Initialize can_icf_inline_merge_sections.
4097         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4098         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4099         Rename from can_check_for_function_pointers, move in file.
4100         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4101         (Target_x86_64::x86_64_info): Initialize
4102         can_icf_inline_merge_sections.
4103         * testsuite/testfile.cc (Target_test::test_target_info):
4104         Likewise.
4105         * icf.cc (get_section_contents): Correct formatting.
4106
4107 2011-06-27  Ian Lance Taylor  <iant@google.com>
4108
4109         * symtab.cc (Symbol::versioned_name): New function.
4110         (Symbol_table::add_to_final_symtab): Use versioned_name when
4111         appropriate.
4112         (Symbol_table::sized_write_symbol): Likewise.
4113         * symtab.h (class Symbol): Declare versioned_name.
4114         * stringpool.h (class Stringpool_template): Add variant of add
4115         which takes a std::basic_string.
4116         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4117         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4118         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4119         (ver_test_12.o): New target.
4120         * testsuite/Makefile.in: Rebuild.
4121
4122 2011-06-27  Doug Kwan  <dougkwan@google.com>
4123
4124         * arm.cc (Arm_relocate_functions::thm_jump8,
4125         Arm_relocate_functions::thm_jump11): Use a wider signed
4126         type to compute offset.
4127         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4128         arm_thm_jump8.
4129         * testsuite/Makefile.in: Regenerate.
4130         * testsuite/arm_branch_in_range.sh: Check test results of
4131         arm_thm_jump11 and arm_thm_jump8.
4132         * testsuite/arm_thm_jump11.s: New test source file.
4133         * testsuite/arm_thm_jump11.t: New linker script.
4134         * testsuite/arm_thm_jump8.s: New test source file.
4135         * testsuite/arm_thm_jump8.t: New linker script.
4136
4137 2011-06-24  Ian Lance Taylor  <iant@google.com>
4138
4139         * layout.cc: Include "object.h".
4140         (ctors_sections_in_init_array): New static variable.
4141         (Layout::is_ctors_in_init_array): New function.
4142         (Layout::layout): Add entry to ctors_sections_in_init_array if
4143         appropriate.
4144         * layout.h (class Layout): Declare is_ctors_in_init_array.
4145         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4146         is_ctors_reverse_view is set.
4147         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4148         all callers.  Set is_ctors_reverse_view field of View_size.
4149         (Sized_relobj_file::reverse_words): New function.
4150         * object.h (Sized_relobj_file::View_size): Add
4151         is_ctors_reverse_view field.
4152         (class Sized_relobj_file): Update declarations.
4153         * testsuite/initpri3.c: New test.
4154         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4155         initpri3b.
4156         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4157         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4158         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4159         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4160         * testsuite/Makefile.in: Rebuild.
4161
4162 2011-06-24  Cary Coutant  <ccoutant@google.com>
4163
4164         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4165         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4166         (debug_msg_cdebug.err): New targets.
4167         * testsuite/Makefile.in: Regenerate.
4168         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4169         Fix checks for link with shared library.
4170
4171 2011-06-24  Doug Kwan  <dougkwan@google.com>
4172
4173         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4174         skip empty text sections.
4175         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4176
4177 2011-06-22  Ian Lance Taylor  <iant@google.com>
4178
4179         PR gold/12910
4180         * options.h (class General_options): Add --ctors-in-init-array.
4181         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4182         friends as SHT_PROGBITS for merging sections.
4183         (Layout::layout): Remove special handling of .init_array and
4184         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4185         and .dtors if ctors_in_init_array.
4186         (Layout::make_output_section): Force correct section types for
4187         .init_array and friends.  Don't sort if doing relocatable link,
4188         Don't sort .ctors and .dtors if ctors_in_init_array.
4189         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4190         (Layout::output_section_name): Add relobj parameter.  Change all
4191         callers.  Handle .ctors. and .dtors. in code rather than table.
4192         Handle .ctors and .dtors if ctors_in_init_array.
4193         (Layout::match_file_name): New function, moved from output.cc.
4194         * layout.h (class Layout): Update declarations.
4195         * output.cc: Include "layout.h".
4196         (Input_section_sort_entry::get_priority): New function.
4197         (Input_section_sort_entry::match_file_name): Just call
4198         Layout::match_file_name.
4199         (Output_section::Input_section_sort_init_fini_compare::operator()):
4200         Handle .ctors and .dtors.  Sort by explicit priority rather than
4201         by name.
4202         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4203         * testsuite/initpri2.c: New test.
4204         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4205         (check_PROGRAMS): Add initpri2.
4206         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4207         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4208         * configure, testsuite/Makefile.in: Rebuild.
4209
4210 2011-06-19  Ian Lance Taylor  <iant@google.com>
4211
4212         PR gold/12880
4213         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4214         .interp section to a PT_INTERP segment even if we have seen a
4215         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4216         clause in a linker script.
4217         (Layout::finalize): Don't create a .interp section if we've
4218         already create a PT_INTERP segment.
4219         (Layout::create_interp): Always call choose_output_section (revert
4220         patch of 2011-06-17).  Don't create PT_INTERP segment.
4221         * script-sections.cc
4222         (Script_sections::create_note_and_tls_segments): Add a .interp
4223         section to a PT_INTERP segment even if we have seen a
4224         --dynamic-linker option.
4225
4226 2011-06-18  Ian Lance Taylor  <iant@google.com>
4227
4228         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4229         merely because a non-PT_LOAD segment has a dynamic reloc.
4230
4231 2011-06-18  Ian Lance Taylor  <iant@google.com>
4232
4233         * layout.cc (Layout::finish_dynamic_section): Don't create
4234         DT_FLAGS entry if not needed.
4235
4236 2011-06-18  Ian Lance Taylor  <iant@google.com>
4237
4238         PR gold/12745
4239         * layout.cc (Layout::layout_eh_frame): Correct handling of
4240         writable .eh_frame section.
4241
4242 2011-06-17  Ian Lance Taylor  <iant@google.com>
4243
4244         PR gold/12893
4245         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4246         symbol is redefined with the exact same object and value.
4247
4248 2011-06-17  Ian Lance Taylor  <iant@google.com>
4249
4250         PR gold/12880
4251         * layout.h (class Layout): Add interp_segment_ field.
4252         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4253         (Layout::attach_allocated_section_to_segment): If making shared
4254         library, put .interp section in PT_INTERP segment.
4255         (Layout::finalize): Also call create_interp if -dynamic-linker
4256         option was used.
4257         (Layout::create_interp): Assert that there is no PT_INTERP
4258         segment.  If not using a SECTIONS clause, use make_output_section.
4259         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4260         * script-sections.cc
4261         (Script_sections::create_note_and_tls_segments): If making shared
4262         library, put .interp section in PT_INTERP segment.
4263
4264 2011-06-17  Ian Lance Taylor  <iant@google.com>
4265
4266         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4267         when making a shared library.
4268
4269 2011-06-17  Ian Lance Taylor  <iant@google.com>
4270
4271         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4272         parameter.  Change all callers.  Don't issue warning about PC32
4273         against locally defined symbol.
4274
4275 2011-06-16  Ian Lance Taylor  <iant@google.com>
4276
4277         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4278         occurs in same object.
4279
4280 2011-06-14  Alan Modra  <amodra@gmail.com>
4281
4282         * po/POTFILES.in: Regenerate.
4283
4284 2011-06-09  Ian Lance Taylor  <iant@google.com>
4285
4286         * script-sections.cc
4287         (Orphan_output_section::set_section_addresses): For a relocatable
4288         link set address to 0.
4289
4290 2011-06-09  Cary Coutant  <ccoutant@google.com>
4291
4292         PR gold/12804
4293         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4294         used with --compress-debug-sections.
4295         * gold/object.cc (Sized_relobj_file::do_layout): Report
4296         uncompressed size of compressed input sections.
4297
4298 2011-06-08  Cary Coutant  <ccoutant@google.com>
4299
4300         PR gold/12804
4301         * testsuite/two_file_test_2_v1.cc: Change initialization of
4302         v2 to keep it in .data.
4303
4304 2011-06-07  Cary Coutant  <ccoutant@google.com>
4305
4306         * common.cc (Symbol_table::do_allocate_commons_list): Call
4307         gold_fallback.
4308         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4309         (Errors::fallback): New function.
4310         (gold_fallback): New function.
4311         * errors.h (Errors::fallback): New function.
4312         * gold.cc (gold_exit): Change status parameter to enum; adjust
4313         all callers.
4314         (queue_initial_tasks): Call gold_fallback.
4315         * gold.h: Include cstdlib.
4316         (Exit_status): New enum type.
4317         (gold_exit): Change status parameter to enum.
4318         (gold_fallback): New function.
4319         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4320         (Layout::create_symtab_sections): Likewise.
4321         (Layout::create_shdrs): Likewise.
4322         * main.cc (main): Adjust call to gold_exit.
4323         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4324         (Output_data_got::add_got_entry_pair): Likewise.
4325         (Output_section::add_input_section): Likewise.
4326         (Output_section::add_output_section_data): Likewise.
4327         (Output_segment::set_section_list_addresses): Likewise.
4328         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4329
4330 2011-06-07  Cary Coutant  <ccoutant@google.com>
4331
4332         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4333         for incremental links.
4334         * output.cc (Output_segment::set_section_list_addresses): Remove
4335         FIXME and test for TLS or BSS.
4336
4337 2011-06-07  Cary Coutant  <ccoutant@google.com>
4338
4339         * testsuite/Makefile.am: Add incremental_copy_test,
4340         incremental_common_test_1.
4341         * testsuite/Makefile.in: Regenerate.
4342         * testsuite/common_test_1_v1.c: New source file.
4343         * testsuite/common_test_1_v2.c: New source file.
4344         * testsuite/copy_test_v1.cc: New source file.
4345
4346 2011-06-07  Cary Coutant  <ccoutant@google.com>
4347
4348         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4349         update, allocate common from bss section's free list.
4350         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4351         linker-defined symbols.
4352         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4353         Skip GOT and PLT entries that are no longer referenced.
4354         (Output_section_incremental_inputs::write_info_blocks): Mark
4355         linker-defined symbols.
4356         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4357         * output.cc (Output_section::allocate): New function.
4358         * output.h (Output_section::allocate): New function.
4359         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4360         linker-defined symbols.
4361         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4362         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4363         (Symbol::init_base_output_data): Likewise.
4364         (Symbol::init_base_output_segment): Likewise.
4365         (Symbol::init_base_constant): Likewise.
4366         (Sized_symbol::init_output_data): Likewise.
4367         (Sized_symbol::init_output_segment): Likewise.
4368         (Sized_symbol::init_constant): Likewise.
4369         (Symbol_table::do_define_in_output_data): Likewise.
4370         (Symbol_table::do_define_in_output_segment): Likewise.
4371         (Symbol_table::do_define_as_constant): Likewise.
4372         * symtab.h (Symbol::is_predefined): New function.
4373         (Symbol::init_base_output_data): Add is_predefined parameter.
4374         (Symbol::init_base_output_segment): Likewise.
4375         (Symbol::init_base_constant): Likewise.
4376         (Symbol::is_predefined_): New data member.
4377         (Sized_symbol::init_output_data): Add is_predefined parameter.
4378         (Sized_symbol::init_output_segment): Likewise.
4379         (Sized_symbol::init_constant): Likewise.
4380         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4381
4382 2011-06-07  Cary Coutant  <ccoutant@google.com>
4383
4384         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4385         instead of emit_copy_reloc.
4386         (Copy_relocs::emit_copy_reloc): Refactor.
4387         (Copy_relocs::make_copy_reloc): New function.
4388         (Copy_relocs::add_copy_reloc): Remove.
4389         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4390         section.
4391         (Copy_relocs::make_copy_reloc): New function.
4392         (Copy_relocs::add_copy_reloc): Remove.
4393         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4394         unchanged input files.
4395         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4396         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4397         Reserve BSS space for COPY relocations.
4398         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4399         (Output_section_incremental_inputs::write_info_blocks): Record
4400         whether a symbol is copied from a shared object.
4401         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4402         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4403         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4404         (Incremental_input_entry_reader::get_output_symbol_index): Add
4405         is_copy parameter.
4406         (Incremental_binary::emit_copy_relocs): New function.
4407         (Incremental_binary::do_emit_copy_relocs): New function.
4408         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4409         new data member.
4410         (Sized_incremental_binary::add_copy_reloc): New function.
4411         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4412         (Sized_incremental_binary::Copy_reloc): New struct.
4413         (Sized_incremental_binary::Copy_relocs): New typedef.
4414         (Sized_incremental_binary::copy_relocs_): New data member.
4415         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4416         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4417         * target.h (Sized_target::emit_copy_reloc): New function.
4418         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4419
4420 2011-06-02  Cary Coutant  <ccoutant@google.com>
4421
4422         PR gold/12163
4423         * gold/archive.cc (Archive::Archive): Initialize new data member.
4424         (Archive::include_all_members): Return if archive has already been
4425         included.
4426         * gold/archive.h (Archive::include_all_members_): New data member.
4427
4428 2011-06-02  Nick Clifton  <nickc@redhat.com>
4429
4430         * dynobj.h: Fix spelling mistake in comment.
4431         * output.cc: Likewise.
4432
4433 2011-05-31  Doug Kwan  <dougkwan@google.com>
4434             Asier Llano
4435
4436         PR gold/12826
4437         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4438         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4439         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4440         redundant arm_exidx_test.so.
4441         * testsuite/Makefile.in: Regenerate.
4442         (check_SCRIPTS): Add pr12826.sh
4443         (check_DATA): Add pr12826.stdout
4444         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4445         * testsuite/pr12826.sh: New file.
4446         * testsuite/pr12826_1.s: Ditto.
4447         * testsuite/pr12826_1.s: Ditto.
4448
4449 2011-05-30  Ian Lance Taylor  <iant@google.com>
4450
4451         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4452         sections.
4453
4454 2011-05-29  Ian Lance Taylor  <iant@google.com>
4455
4456         PR gold/12804
4457         * testsuite/Makefile.am: Use different file name for two_file_test
4458         temporary file for each incremental test.
4459         * testsuite/Makefile.in: Rebuild.
4460
4461 2011-05-29  Ian Lance Taylor  <iant@google.com>
4462
4463         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4464         binary input file is empty.
4465
4466 2011-05-27  Ian Lance Taylor  <iant@google.com>
4467
4468         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4469         (ver_test_9.so): Likewise.
4470         * testsuite/Makefile.in: Rebuild.
4471
4472 2011-05-26 Cary Coutant  <ccoutant@google.com>
4473
4474         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4475         * incremental.cc (Incremental_inputs::report_input_section): Fix
4476         comment, indentation.
4477         (Incremental_inputs::report_comdat_group): New function.
4478         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4479         of data for incremental input file entry.
4480         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4481         group count, COMDAT group signatures.
4482         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4483         an unchanged input file.
4484         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4485         Initialize new data member.
4486         (Incremental_object_entry::add_comdat_group): New function.
4487         (Incremental_object_entry::get_comdat_group_count): New function.
4488         (Incremental_object_entry::get_comdat_signature_key): New function.
4489         (Incremental_object_entry::groups_): New data member.
4490         (Incremental_inputs::report_comdat_group): New function.
4491         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4492         data for incremental input file entry.
4493         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4494         (Incremental_input_entry_reader::get_input_section): Adjust size of
4495         data for incremental input file entry.
4496         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4497         (Incremental_input_entry_reader::get_comdat_group_signature): New
4498         function.
4499         * object.cc (Sized_relobj::include_section_group): Report kept
4500         COMDAT groups for incremental links.
4501
4502 2011-05-24  David Meyer  <pdox@google.com>
4503
4504         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4505         with name parameter.  Add found_name parameter.
4506         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4507         * dirsearch.h (class Dirsearch): Update declaration.
4508
4509 2011-05-24  Ian Lance Taylor  <iant@google.com>
4510
4511         * archive.cc (Library_base::should_include_member): Pull in object
4512         from archive if it defines the entry symbol.
4513         * parameters.cc (Parameters::entry): New function.
4514         * parameters.h (class Parameters): Declare entry.
4515         * output.h (class Output_file_header): Remove entry_ field.
4516         * output.cc (Output_file_header::Output_file_header): Remove entry
4517         parameter.  Change all callers.
4518         (Output_file_header::entry): Use parameters->entry.
4519         * gold.cc (queue_middle_tasks): Likewise.
4520         * plugin.cc (Plugin_hook::run): Likewise.
4521
4522 2011-05-24 Cary Coutant  <ccoutant@google.com>
4523
4524         * gold.cc (queue_initial_tasks): Pass incremental base filename
4525         to Output_file::open_base_file; don't print error message.
4526         * incremental-dump.cc (main): Adjust call to
4527         Output_file::open_for_modification.
4528         * incremental-dump.cc (main): Likewise.
4529         * incremental.cc (Incremental_inputs::report_command_line):
4530         Ignore --incremental-base option when comparing command lines.
4531         Ignore parameter when given as separate argument.
4532         * options.h (class General_options): Add --incremental-base.
4533         * output.cc (Output_file::Output_file):
4534         (Output_file::open_base_file): Add base_name and writable parameters;
4535         read base file into new file; print error message here.
4536         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4537         callers.
4538         * output.h (Output_file::open_for_modification): Rename to...
4539         (Output_file::open_base_file): ...this; add base_name and
4540         writable parameters; adjust all callers.
4541         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4542         callers.
4543         * testsuite/Makefile.am (incremental_test_4): Test
4544         --incremental-base.
4545         * testsuite/Makefile.in: Regenerate.
4546
4547 2011-05-24 Cary Coutant  <ccoutant@google.com>
4548
4549         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4550         incremental_test_4.
4551         * testsuite/Makefile.in: Regenerate.
4552         * testsuite/two_file_test_1_v1.cc: New test source file.
4553         * testsuite/two_file_test_1b_v1.cc: New test source file.
4554         * testsuite/two_file_test_2_v1.cc: New test source file.
4555
4556 2011-05-24 Cary Coutant  <ccoutant@google.com>
4557
4558         * dynobj.h (Dynobj::do_dynobj): New function.
4559         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4560         flag and soname for shared objects.
4561         * incremental.cc (Incremental_inputs::report_object): Make
4562         either Incremental_object_entry or Incremental_dynobj_entry; add
4563         soname to string table.
4564         (Incremental_inputs::report_input_section): Add assertion.
4565         (Output_section_incremental_inputs::set_final_data_size): Adjust
4566         type of input file entry for shared libraries; adjust size of
4567         shared library info entry.
4568         (Output_section_incremental_inputs::write_input_files): Write
4569         as_needed flag for shared libraries.
4570         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4571         of input file entry for shared libraries; write soname.
4572         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4573         soname from incremental info.
4574         * incremental.h (enum Incremental_input_flags): Add
4575         INCREMENTAL_INPUT_AS_NEEDED.
4576         (Incremental_input_entry::Incremental_input_entry): Initialize new
4577         data member.
4578         (Incremental_input_entry::set_as_needed): New function.
4579         (Incremental_input_entry::as_needed): New function.
4580         (Incremental_input_entry::do_dynobj_entry): New function.
4581         (Incremental_input_entry::as_needed_): New data member.
4582         (Incremental_object_entry::Incremental_object_entry): Don't check
4583         for shared library.
4584         (Incremental_object_entry::do_type): Likewise.
4585         (class Incremental_dynobj_entry): New class.
4586         (Incremental_input_entry_reader::as_needed): New function.
4587         (Incremental_input_entry_reader::get_soname): New function.
4588         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4589         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4590         size of shared library info entry.
4591         * layout.cc (Layout::finish_dynamic_section): Don't test for
4592         incremental link when adding DT_NEEDED entries.
4593         * object.h (Object::Object): Initialize new data member.
4594         (Object::dynobj): New function.
4595         (Object::set_as_needed): New function.
4596         (Object::as_needed): New function.
4597         (Object::do_dynobj): New function.
4598         (Object::as_needed_): New data member.
4599
4600 2011-05-24 Cary Coutant  <ccoutant@google.com>
4601
4602         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4603         info; adjust display of GOT entries.
4604         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4605         vector of input objects; remove file_status_.
4606         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4607         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4608         got_plt reader; call target hooks to reserve GOT entries.
4609         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4610         of input file info header and GOT info entry.
4611         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4612         relocation info.
4613         (Got_plt_view_info::got_descriptor): Remove.
4614         (Got_plt_view_info::sym_index): New data member.
4615         (Got_plt_view_info::input_index): New data member.
4616         (Local_got_offset_visitor::visit): Write input file index.
4617         (Global_got_offset_visitor::visit): Write 0 for input file index.
4618         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4619         with sym_index and input_index.
4620         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4621         incremental info GOT entry; replace got_descriptor with input_index.
4622         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4623         map from input file index to object.
4624         (Sized_relobj_incr::do_layout): Replace direct data member reference
4625         with accessor function.
4626         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4627         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4628         Adjust size of input file info header.
4629         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4630         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4631         (Incremental_input_entry_reader::get_input_section): Adjust size of
4632         input file info header.
4633         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4634         of incremental info GOT entry.
4635         (Incremental_got_plt_reader::get_got_desc): Remove.
4636         (Incremental_got_plt_reader::get_got_symndx): New function.
4637         (Incremental_got_plt_reader::get_got_input_index): New function.
4638         (Sized_incremental_binary::Sized_incremental_binary): Remove
4639         file_status_; add input_objects_.
4640         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4641         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4642         (Sized_incremental_binary::file_is_unchanged): Remove.
4643         (Sized_incremental_binary::set_input_object): New function.
4644         (Sized_incremental_binary::input_object): New function.
4645         (Sized_incremental_binary::file_status_): Remove.
4646         (Sized_incremental_binary::input_objects_): New data member.
4647         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4648         references.
4649         (Sized_relobj_incr::invalid_address): Move to base class.
4650         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4651         class.
4652         (Sized_relobj_incr::do_output_section_offset): Likewise.
4653         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4654         (Sized_relobj_incr::section_offsets_): Likewise.
4655         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4656         function.
4657         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4658         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4659         with accessor function.
4660         (Sized_relobj_file::do_layout): Likewise.
4661         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4662         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4663         (Sized_relobj_file::compute_final_local_value): Replace refs to
4664         section_offsets_ with accessor function.
4665         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4666         * object.h (Relobj::Relobj): Initialize new data members.
4667         (Relobj::add_dyn_reloc): New function.
4668         (Relobj::first_dyn_reloc): New function.
4669         (Relobj::dyn_reloc_count): New function.
4670         (Relobj::first_dyn_reloc_): New data member.
4671         (Relobj::dyn_reloc_count_): New data member.
4672         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4673         references.
4674         (Sized_relobj::Address): New typedef.
4675         (Sized_relobj::invalid_address): Move here from child class.
4676         (Sized_relobj::Sized_relobj): Initialize new data members.
4677         (Sized_relobj::sized_relobj): New function.
4678         (Sized_relobj::is_output_section_offset_invalid): Move here from
4679         child class.
4680         (Sized_relobj::get_output_section_offset): Likewise.
4681         (Sized_relobj::local_has_got_offset): Likewise.
4682         (Sized_relobj::local_got_offset): Likewise.
4683         (Sized_relobj::set_local_got_offset): Likewise.
4684         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4685         (Sized_relobj::clear_got_offsets): New function.
4686         (Sized_relobj::section_offsets): Move here from child class.
4687         (Sized_relobj::do_output_section_offset): Likewise.
4688         (Sized_relobj::do_set_section_offset): Likewise.
4689         (Sized_relobj::Local_got_offsets): Likewise.
4690         (Sized_relobj::local_got_offsets_): Likewise.
4691         (Sized_relobj::section_offsets_): Likewise.
4692         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4693         references.
4694         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4695         class.
4696         (Sized_relobj_file::sized_relobj): New function
4697         (Sized_relobj_file::local_has_got_offset): Move to base class.
4698         (Sized_relobj_file::local_got_offset): Likewise.
4699         (Sized_relobj_file::set_local_got_offset): Likewise.
4700         (Sized_relobj_file::get_output_section_offset): Likewise.
4701         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4702         (Sized_relobj_file::do_output_section_offset): Likewise.
4703         (Sized_relobj_file::do_set_section_offset): Likewise.
4704         (Sized_relobj_file::Local_got_offsets): Likewise.
4705         (Sized_relobj_file::local_got_offsets_): Likewise.
4706         (Sized_relobj_file::section_offsets_): Likewise.
4707         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4708         (all constructors).
4709         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4710         (Output_reloc::get_symbol_index): Likewise.
4711         (Output_reloc::local_section_offset): Likewise.
4712         (Output_reloc::get_address): Likewise.
4713         (Output_reloc::symbol_value): Likewise.
4714         (Output_data_got::reserve_slot): Move to class definition.
4715         (Output_data_got::reserve_local): New function.
4716         (Output_data_got::reserve_slot_for_global): Remove.
4717         (Output_data_got::reserve_global): New function.
4718         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4719         (all constructors, two instantiations).
4720         (Output_reloc::get_relobj): New function (two instantiations).
4721         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4722         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4723         (Output_data_reloc::add_global): Adjust type of relobj.
4724         (Output_data_reloc::add_global_relative): Likewise.
4725         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4726         (Output_data_reloc::add_local): Likewise.
4727         (Output_data_reloc::add_local_relative): Likewise.
4728         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4729         (Output_data_reloc::add_local_section): Likewise.
4730         (Output_data_reloc::add_output_section): Likewise.
4731         (Output_data_reloc::add_absolute): Likewise.
4732         (Output_data_reloc::add_target_specific): Likewise.
4733         (Output_data_got::reserve_slot): Move definition here.
4734         (Output_data_got::reserve_local): New function.
4735         (Output_data_got::reserve_global): New function.
4736         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4737         section_offsets_ with accessor function.
4738         (Sized_relobj_file::write_sections): Likewise.
4739         (Sized_relobj_file::do_relocate_sections): Likewise.
4740         * target.h (Sized_target::reserve_local_got_entry): New function.
4741         (Sized_target::reserve_global_got_entry): New function.
4742         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4743         (Target_x86_64::reserve_global_got_entry): New function.
4744         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4745
4746 2011-05-23 Cary Coutant  <ccoutant@google.com>
4747
4748         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4749         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4750         bit when checking got_type.
4751         * incremental.cc (Sized_incremental_binary::setup_readers):
4752         Store symbol table and string table locations; initialize bit vector
4753         of file status flags.
4754         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4755         unchanged files.
4756         (Sized_incremental_binary::do_process_got_plt): New function.
4757         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4758         (Output_section_incremental_inputs::set_final_data_size): Record
4759         file index for each input file.
4760         (Output_section_incremental_inputs::write_got_plt): Store file index
4761         instead of input entry offset for each GOT entry.
4762         * incremental.h
4763         (Incremental_input_entry::Incremental_input_entry): Initialize new
4764         data member.
4765         (Incremental_input_entry::set_offset): Store file index.
4766         (Incremental_input_entry::get_file_index): New function.
4767         (Incremental_input_entry::file_index_): New data member.
4768         (Incremental_binary::process_got_plt): New function.
4769         (Incremental_binary::do_process_got_plt): New function.
4770         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4771         data members.
4772         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4773         (Sized_incremental_binary::set_file_is_unchanged): New function.
4774         (Sized_incremental_binary::file_is_unchanged): New function.
4775         (Sized_incremental_binary::do_process_got_plt): New function.
4776         (Sized_incremental_binary::file_status_): New data member.
4777         (Sized_incremental_binary::main_symtab_loc_): New data member.
4778         (Sized_incremental_binary::main_strtab_loc_): New data member.
4779         * output.cc (Output_data_got::Got_entry::write): Add case
4780         RESERVED_CODE.
4781         (Output_data_got::add_global): Call add_got_entry.
4782         (Output_data_got::add_global_plt): Likewise.
4783         (Output_data_got::add_global_with_rel): Likewise.
4784         (Output_data_got::add_global_with_rela): Likewise.
4785         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4786         (Output_data_got::add_global_pair_with_rela): Likewise.
4787         (Output_data_got::add_local): Call add_got_entry.
4788         (Output_data_got::add_local_plt): Likewise.
4789         (Output_data_got::add_local_with_rel): Likewise.
4790         (Output_data_got::add_local_with_rela): Likewise.
4791         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4792         (Output_data_got::add_local_pair_with_rela): Likewise.
4793         (Output_data_got::reserve_slot): New function.
4794         (Output_data_got::reserve_slot_for_global): New function.
4795         (Output_data_got::add_got_entry): New function.
4796         (Output_data_got::add_got_entry_pair): New function.
4797         (Output_section::add_output_section_data): Edit FIXME.
4798         * output.h
4799         (Output_section_data_build::Output_section_data_build): New
4800         constructor with size parameter.
4801         (Output_data_space::Output_data_space): Likewise.
4802         (Output_data_got::Output_data_got): Initialize new data member; new
4803         constructor with size parameter.
4804         (Output_data_got::add_constant): Call add_got_entry.
4805         (Output_data_got::reserve_slot): New function.
4806         (Output_data_got::reserve_slot_for_global): New function.
4807         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4808         (Output_data_got::add_got_entry): New function.
4809         (Output_data_got::add_got_entry_pair): New function.
4810         (Output_data_got::free_list_): New data member.
4811         * target.h (Sized_target::init_got_plt_for_update): New function.
4812         (Sized_target::register_global_plt_entry): New function.
4813         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4814         Initialize new data member; call init; add constructor with PLT count.
4815         (Output_data_plt_x86_64::init): New function.
4816         (Output_data_plt_x86_64::add_relocation): New function.
4817         (Output_data_plt_x86_64::reserve_slot): New function.
4818         (Output_data_plt_x86_64::free_list_): New data member.
4819         (Target_x86_64::init_got_plt_for_update): New function.
4820         (Target_x86_64::register_global_plt_entry): New function.
4821         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4822         incremental updates.
4823         (Output_data_plt_x86_64::add_relocation): New function.
4824         * testsuite/object_unittest.cc (Object_test): Set default options.
4825
4826 2011-05-16  Ian Lance Taylor  <iant@google.com>
4827
4828         * options.h (class General_options): Make -i a synonym for -r.
4829
4830 2011-05-16  Ian Lance Taylor  <iant@google.com>
4831
4832         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4833
4834 2011-05-10 Cary Coutant  <ccoutant@google.com>
4835
4836         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4837         strip_all (-s).
4838
4839 2011-05-06  Ian Lance Taylor  <iant@google.com>
4840
4841         * layout.cc (Layout::layout): If the output section flags change,
4842         update the ordering.
4843
4844 2011-04-25 Cary Coutant  <ccoutant@google.com>
4845
4846         * incremental-dump.cc (dump_incremental_inputs): Print local
4847         symbol info for each input file.
4848         * incremental.cc
4849         (Output_section_incremental_inputs::set_final_data_size): Add local
4850         symbol info to input file entries in incremental info.
4851         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4852         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4853         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4854         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4855         implementation.
4856         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4857         (Sized_incr_relobj::do_relocate): Write the local symbols.
4858         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4859         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4860         Adjust size of input file header.
4861         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4862         (Incremental_inputs_reader::get_local_symbol_count): New function.
4863         (Incremental_inputs_reader::get_input_section): Adjust size of input
4864         file header.
4865         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4866         (Sized_incr_relobj::This): New typedef.
4867         (Sized_incr_relobj::sym_size): New const data member.
4868         (Sized_incr_relobj::Local_symbol): New struct.
4869         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4870         (Sized_incr_relobj::do_local_symbol_offset): New function.
4871         (Sized_incr_relobj::local_symbol_count_): New data member.
4872         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4873         (Sized_incr_relobj::local_symbol_index_): New data member.
4874         (Sized_incr_relobj::local_symbol_offset_): New data member.
4875         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4876         (Sized_incr_relobj::local_symbols_): New data member.
4877         * object.h (Relobj::output_local_symbol_count): New function.
4878         (Relobj::local_symbol_offset): New function.
4879         (Relobj::do_output_local_symbol_count): New function.
4880         (Relobj::do_local_symbol_offset): New function.
4881         (Sized_relobj::do_output_local_symbol_count): New function.
4882         (Sized_relobj::do_local_symbol_offset): New function.
4883
4884 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4885
4886         * descriptors.cc (set_close_on_exec): New function.
4887         (Descriptors::open): Use set_close_on_exec.
4888         * output.cc (S_ISLNK): Define if not defined.
4889
4890 2011-04-22 Cary Coutant  <ccoutant@google.com>
4891
4892         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4893         global symbol map.
4894         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4895         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
4896         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
4897         relocations.
4898         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
4899         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
4900         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
4901         * incremental.h
4902         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
4903         function.
4904         (Incremental_binary::apply_incremental_relocs): New function.
4905         (Incremental_binary::do_apply_incremental_relocs): New function.
4906         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4907         data member.
4908         (Sized_incremental_binary::add_global_symbol): New function.
4909         (Sized_incremental_binary::global_symbol): New function.
4910         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
4911         (Sized_incremental_binary::symbol_map_): New data member.
4912         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
4913         * target.h (Sized_target::apply_relocation): New function.
4914         * target-reloc.h (apply_relocation): New function.
4915         * x86_64.cc (Target_x86_64::apply_relocation): New function.
4916
4917 2011-04-22  Doug Kwan  <dougkwan@google.com>
4918
4919         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
4920         flag of a SHT_ARM_EXIDX section.
4921         * testsuite/Makefile.am (arm_exidx_test): New test rules.
4922         * testsuite/Makefile.in: Regenerate.
4923         * testsuite/arm_exidx_test.s: New file.
4924         * testsuite/arm_exidx_test.sh: Same.
4925
4926 2011-04-20 Cary Coutant  <ccoutant@google.com>
4927
4928         PR gold/12689
4929         * archive.h (Incremental_archive_entry::Archive_member):
4930         Initialize arg_serial_ (second constructor).
4931
4932 2011-04-17  Ian Lance Taylor  <iant@google.com>
4933
4934         * object.cc (Relocate_info::location): Simplify location string.
4935         * errors.cc (Errors::error_at_location): Don't print program
4936         name.
4937         (Errors::warning_at_location): Likewise.
4938         (Errors::undefined_symbol): Likewise.
4939         * testsuite/debug_msg.sh: Update accordingly.
4940
4941 2011-04-14 Cary Coutant  <ccoutant@google.com>
4942
4943         * gold/layout.cc (Layout::symtab_section_offset): New function.
4944         * gold/layout.h (Layout::symtab_section_offset): New function.
4945         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
4946
4947 2011-04-12  Ian Lance Taylor  <iant@google.com>
4948
4949         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
4950         with MREMAP_MAYMOVE.
4951         * output.h (class Output_file): Add map_is_allocated_ field.
4952         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
4953         not available, provide stubs.  If mremap is not available, #define
4954         it to gold_mremap.
4955         (MREMAP_MAYMOVE): Define if not defined.
4956         (Output_file::Output_file): Initialize map_is_allocated_.
4957         (Output_file::resize): Check map_is_allocated_.
4958         (Output_file::map_anonymous): If mmap fails, use malloc.
4959         (Output_file::unmap): Don't do anything for an anonymous map.
4960         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
4961         is not available, provide stubs.
4962         (File_read::View::~View): Use free rather than delete[].
4963         (File_read::make_view): Use malloc rather than new[].  If mmap
4964         fails, use malloc.
4965         (File_read::find_or_make_view): Use malloc rather than new[].
4966         * gold.h: Remove HAVE_REMAP code.
4967         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
4968         exists.  Rename mremap to gold_mremap.  If mmap is not available
4969         don't do anything.
4970         * configure, config.in: Rebuild.
4971
4972 2011-04-11  Ian Lance Taylor  <iant@google.com>
4973
4974         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
4975         initialize local variable v.
4976
4977 2011-04-11  Cary Coutant  <ccoutant@google.com>
4978
4979         * archive.cc (Archive::include_member): Adjust call to
4980         report_object.
4981         (Add_archive_symbols::run): Track argument serial numbers.
4982         (Lib_group::include_member): Likewise.
4983         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
4984         * archive.h (Incremental_archive_entry::Archive_member):
4985         Initialize arg_serial_.
4986         (Archive_member::arg_serial_): New data member.
4987         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
4988         (Sized_dynobj::do_add_symbols): Track symbols when doing an
4989         incremental link.
4990         (Sized_dynobj::do_for_all_local_got_entries): New function.
4991         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
4992         function.
4993         * fileread.cc (get_mtime): New function.
4994         * fileread.h (get_mtime): New function.
4995         * gold.cc (queue_initial_tasks): Check for incremental update.
4996         (process_incremental_input): New function.
4997         (queue_middle_tasks): Don't force valid target for incremental
4998         update.
4999         * incremental-dump.cc (find_input_containing_global): Adjust
5000         size of symbol info entry.
5001         (dump_incremental_inputs): Dump argument serial number and
5002         in_system_directory flag; bias shndx by 1; print symbol names
5003         when dumping per-file symbol lists; use new symbol info readers.
5004         * incremental.cc
5005         (Output_section_incremental_inputs:update_data_size): New function.
5006         (Sized_incremental_binary::setup_readers): Setup input readers
5007         for each input file; build maps for files added from libraries
5008         and scripts.
5009         (Sized_incremental_binary::check_input_args): New function.
5010         (Sized_incremental_binary::do_check_inputs): Build map of argument
5011         serial numbers to input arguments.
5012         (Sized_incremental_binary::do_file_has_changed): Rename
5013         do_file_is_unchanged to this; compare file modification times.
5014         (Sized_incremental_binary::do_init_layout): New function.
5015         (Sized_incremental_binary::do_reserve_layout): New function.
5016         (Sized_incremental_binary::do_get_input_reader): Remove.
5017         (Sized_incremental_binary::get_symtab_view): New function.
5018         (Incremental_checker::can_incrementally_link_output_file): Remove.
5019         (Incremental_inputs::report_command_line): Exclude --debug options.
5020         (Incremental_inputs::report_archive_begin): Add parameter; track
5021         argument serial numbers; don't put input file entry for archive
5022         before archive members.
5023         (Incremental_inputs::report_archive_end): Put input file entry
5024         for archive after archive members.
5025         (Incremental_inputs::report_object): Add parameter; track argument
5026         serial numbers and in_system_directory flag.
5027         (Incremental_inputs::report_script): Add parameter; track argument
5028         serial numbers.
5029         (Output_section_incremental_inputs::set_final_data_size): Adjust
5030         size of symbol info entry; check for forwarding symbols.
5031         (Output_section_incremental_inputs::write_input_files): Write
5032         in_system_directory flag and argument serial number.
5033         (Output_section_incremental_inputs::write_info_blocks): Map section
5034         indices between incremental info and original input file; store
5035         input section index for each symbol.
5036         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5037         change operator() to visit().
5038         (class Global_got_offset_visitor): Likewise.
5039         (class Global_symbol_visitor_got_plt):
5040         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5041         classes.
5042         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5043         (Sized_incr_relobj::do_read_symbols): New function.
5044         (Sized_incr_relobj::do_layout): New function.
5045         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5046         (Sized_incr_relobj::do_add_symbols): New function.
5047         (Sized_incr_relobj::do_should_include_member): New function.
5048         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5049         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5050         (Sized_incr_relobj::do_section_size): New function.
5051         (Sized_incr_relobj::do_section_name): New function.
5052         (Sized_incr_relobj::do_section_contents): New function.
5053         (Sized_incr_relobj::do_section_flags): New function.
5054         (Sized_incr_relobj::do_section_entsize): New function.
5055         (Sized_incr_relobj::do_section_address): New function.
5056         (Sized_incr_relobj::do_section_type): New function.
5057         (Sized_incr_relobj::do_section_link): New function.
5058         (Sized_incr_relobj::do_section_info): New function.
5059         (Sized_incr_relobj::do_section_addralign): New function.
5060         (Sized_incr_relobj::do_initialize_xindex): New function.
5061         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5062         (Sized_incr_relobj::do_read_relocs): New function.
5063         (Sized_incr_relobj::do_gc_process_relocs): New function.
5064         (Sized_incr_relobj::do_scan_relocs): New function.
5065         (Sized_incr_relobj::do_count_local_symbols): New function.
5066         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5067         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5068         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5069         (Sized_incr_relobj::do_relocate): New function.
5070         (Sized_incr_relobj::do_set_section_offset): New function.
5071         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5072         (Sized_incr_dynobj::do_read_symbols): New function.
5073         (Sized_incr_dynobj::do_layout): New function.
5074         (Sized_incr_dynobj::do_add_symbols): New function.
5075         (Sized_incr_dynobj::do_should_include_member): New function.
5076         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5077         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5078         (Sized_incr_dynobj::do_section_size): New function.
5079         (Sized_incr_dynobj::do_section_name): New function.
5080         (Sized_incr_dynobj::do_section_contents): New function.
5081         (Sized_incr_dynobj::do_section_flags): New function.
5082         (Sized_incr_dynobj::do_section_entsize): New function.
5083         (Sized_incr_dynobj::do_section_address): New function.
5084         (Sized_incr_dynobj::do_section_type): New function.
5085         (Sized_incr_dynobj::do_section_link): New function.
5086         (Sized_incr_dynobj::do_section_info): New function.
5087         (Sized_incr_dynobj::do_section_addralign): New function.
5088         (Sized_incr_dynobj::do_initialize_xindex): New function.
5089         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5090         (make_sized_incremental_object): New function.
5091         (Incremental_library::copy_unused_symbols): New function.
5092         (Incremental_library::do_for_all_unused_symbols): New function.
5093         * incremental.h (enum Incremental_input_flags): New type.
5094         (class Incremental_checker): Remove.
5095         (Incremental_input_entry::Incremental_input_entry): Add argument
5096         serial number.
5097         (Incremental_input_entry::arg_serial): New function.
5098         (Incremental_input_entry::set_is_in_system_directory): New function.
5099         (Incremental_input_entry::is_in_system_directory): New function.
5100         (Incremental_input_entry::arg_serial_): New data member.
5101         (Incremental_input_entry::is_in_system_directory_): New data member.
5102         (class Script_info): Move here from script.h.
5103         (Script_info::Script_info): Add filename parameter.
5104         (Script_info::filename): New function.
5105         (Script_info::filename_): New data member.
5106         (Incremental_script_entry::Incremental_script_entry): Add argument
5107         serial number.
5108         (Incremental_object_entry::Incremental_object_entry): Likewise.
5109         (Incremental_object_entry::add_input_section): Build list of input
5110         sections with map to original shndx.
5111         (Incremental_object_entry::get_input_section_index): New function.
5112         (Incremental_object_entry::shndx_): New data member.
5113         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5114         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5115         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5116         serial number.
5117         (Incremental_inputs::report_archive_begin): Likewise.
5118         (Incremental_inputs::report_object): Likewise.
5119         (Incremental_inputs::report_script): Likewise.
5120         (class Incremental_global_symbol_reader): New class.
5121         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5122         and store flags and input file type.
5123         (Incremental_input_entry_reader::arg_serial): New function.
5124         (Incremental_input_entry_reader::type): Extract type from flags.
5125         (Incremental_input_entry_reader::is_in_system_directory): New function.
5126         (Incremental_input_entry_reader::get_input_section_count): Call
5127         accessor function for type.
5128         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5129         function for type; adjust size of global symbol entry.
5130         (Incremental_input_entry_reader::get_global_symbol_count): Call
5131         accessor function for type.
5132         (Incremental_input_entry_reader::get_object_count): Likewise.
5133         (Incremental_input_entry_reader::get_object_offset): Likewise.
5134         (Incremental_input_entry_reader::get_member_count): Likewise.
5135         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5136         (Incremental_input_entry_reader::get_member_offset): Likewise.
5137         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5138         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5139         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5140         (Incremental_input_entry_reader::get_global_symbol_reader): New
5141         function.
5142         (Incremental_input_entry_reader::get_output_symbol_index): New
5143         function.
5144         (Incremental_input_entry_reader::type_): Remove.
5145         (Incremental_input_entry_reader::flags_): New data member.
5146         (Incremental_inputs_reader::input_file_offset): New function.
5147         (Incremental_inputs_reader::input_file_index): New function.
5148         (Incremental_inputs_reader::input_file): Call input_file_offset.
5149         (Incremental_inputs_reader::input_file_at_offset): New function.
5150         (Incremental_relocs_reader::get_r_type): Reformat.
5151         (Incremental_relocs_reader::get_r_shndx): Reformat.
5152         (Incremental_relocs_reader::get_r_offset): Reformat.
5153         (Incremental_relocs_reader::data): New function.
5154         (Incremental_binary::Incremental_binary): Initialize new data members.
5155         (Incremental_binary::check_inputs): Add cmdline parameter.
5156         (Incremental_binary::file_is_unchanged): Remove.
5157         (Input_reader::arg_serial): New function.
5158         (Input_reader::get_unused_symbol_count): New function.
5159         (Input_reader::get_unused_symbol): New function.
5160         (Input_reader::do_arg_serial): New function.
5161         (Input_reader::do_get_unused_symbol_count): New function.
5162         (Input_reader::do_get_unused_symbol): New function.
5163         (Incremental_binary::input_file_count): New function.
5164         (Incremental_binary::get_input_reader): Change signature to use
5165         index instead of filename.
5166         (Incremental_binary::file_has_changed): New function.
5167         (Incremental_binary::get_input_argument): New function.
5168         (Incremental_binary::get_library): New function.
5169         (Incremental_binary::get_script_info): New function.
5170         (Incremental_binary::init_layout): New function.
5171         (Incremental_binary::reserve_layout): New function.
5172         (Incremental_binary::output_file): New function.
5173         (Incremental_binary::do_check_inputs): New function.
5174         (Incremental_binary::do_file_is_unchanged): Remove.
5175         (Incremental_binary::do_file_has_changed): New function.
5176         (Incremental_binary::do_init_layout): New function.
5177         (Incremental_binary::do_reserve_layout): New function.
5178         (Incremental_binary::do_input_file_count): New function.
5179         (Incremental_binary::do_get_input_reader): Change signature.
5180         (Incremental_binary::input_args_map_): New data member.
5181         (Incremental_binary::library_map_): New data member.
5182         (Incremental_binary::script_map_): New data member.
5183         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5184         new data members.
5185         (Sized_incremental_binary::output_section): New function.
5186         (Sized_incremental_binary::inputs_reader): Add const.
5187         (Sized_incremental_binary::symtab_reader): Add const.
5188         (Sized_incremental_binary::relocs_reader): Add const.
5189         (Sized_incremental_binary::got_plt_reader): Add const.
5190         (Sized_incremental_binary::get_symtab_view): New function.
5191         (Sized_incremental_binary::Inputs_reader): New typedef.
5192         (Sized_incremental_binary::Input_entry_reader): New typedef.
5193         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5194         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5195         (Sized_incremental_binary::do_file_has_changed): New function.
5196         (Sized_incremental_binary::do_init_layout): New function.
5197         (Sized_incremental_binary::do_reserve_layout): New function.
5198         (Sized_input_reader::Inputs_reader): Remove.
5199         (Sized_input_reader::Input_entry_reader): Remove.
5200         (Sized_input_reader::do_arg_serial): New function.
5201         (Sized_input_reader::do_get_unused_symbol_count): New function.
5202         (Sized_input_reader::do_get_unused_symbol): New function.
5203         (Sized_incremental_binary::do_input_file_count): New function.
5204         (Sized_incremental_binary::do_get_input_reader): Change signature;
5205         use index instead of filename.
5206         (Sized_incremental_binary::section_map_): New data member.
5207         (Sized_incremental_binary::input_entry_readers_): New data member.
5208         (class Sized_incr_relobj): New class.
5209         (class Sized_incr_dynobj): New class.
5210         (make_sized_incremental_object): New function.
5211         (class Incremental_library): New class.
5212         * layout.cc (Free_list::num_lists): New static data member.
5213         (Free_list::num_nodes): New static data member.
5214         (Free_list::num_removes): New static data member.
5215         (Free_list::num_remove_visits): New static data member.
5216         (Free_list::num_allocates): New static data member.
5217         (Free_list::num_allocate_visits): New static data member.
5218         (Free_list::init): New function.
5219         (Free_list::remove): New function.
5220         (Free_list::allocate): New function.
5221         (Free_list::dump): New function.
5222         (Free_list::print_stats): New function.
5223         (Layout_task_runner::run): Resize output file for incremental updates.
5224         (Layout::Layout): Initialize new data members.
5225         (Layout::set_incremental_base): New function.
5226         (Layout::init_fixed_output_section): New function.
5227         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5228         incremental updates.
5229         (Layout::create_gold_note): Do not create gold note section for
5230         incremental updates.
5231         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5232         for incremental updates.
5233         (Layout::set_section_offsets): For incremental updates, allocate space
5234         from free list.
5235         (Layout::create_symtab_sections): Layout with offsets relative to
5236         start of section; for incremental updates, allocate space from free
5237         list.
5238         (Layout::create_shdrs): For incremental updates, allocate space from
5239         free list.
5240         (Layout::finish_dynamic_section): For incremental updates, do not
5241         check --as-needed (fixed in subsequent patch).
5242         * layout.h (class Free_list): New class.
5243         (Layout::set_incremental_base): New function.
5244         (Layout::incremental_base): New function.
5245         (Layout::init_fixed_output_section): New function.
5246         (Layout::allocate): New function.
5247         (Layout::incremental_base_): New data member.
5248         (Layout::free_list_): New data member.
5249         * main.cc (main): Print Free_list statistics.
5250         * object.cc (Relobj::finalize_incremental_relocs): Add
5251         clear_counts parameter; clear counts only when clear_counts is set.
5252         (Sized_relobj::Sized_relobj): Initialize new base class.
5253         (Sized_relobj::do_layout): Don't report special sections.
5254         (Sized_relobj::do_for_all_local_got_entries): New function.
5255         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5256         symtab_off to all symbol table offsets.
5257         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5258         * object.h (class Got_offset_list): Move to top of file.
5259         (Object::Object): Allow case where input_file == NULL.
5260         (Object::~Object): Likewise.
5261         (Object::input_file): Assert that input_file != NULL.
5262         (Object::lock): Allow case where input_file == NULL.
5263         (Object::unlock): Likewise.
5264         (Object::is_locked): Likewise.
5265         (Object::token): Likewise.
5266         (Object::release): Likewise.
5267         (Object::is_incremental): New function.
5268         (Object::get_mtime): New function.
5269         (Object::for_all_local_got_entries): New function.
5270         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5271         (Object::set_is_in_system_directory): New function.
5272         (Object::is_in_system_directory): New function.
5273         (Object::do_is_incremental): New function.
5274         (Object::do_get_mtime): New function.
5275         (Object::do_for_all_local_got_entries): New function.
5276         (Object::is_in_system_directory_): New data member.
5277         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5278         (class Sized_relobj_base): New class.
5279         (class Sized_relobj): Derive from Sized_relobj_base.
5280         (class Sized_relobj::Symbols): Redeclare from base class.
5281         (class Sized_relobj::local_got_offset_list): Remove.
5282         (class Sized_relobj::Output_sections): Redeclare from base class.
5283         (class Sized_relobj::do_for_all_local_got_entries): New function.
5284         (class Sized_relobj::write_local_symbols): Add offset parameter.
5285         (class Sized_relobj::local_symbol_offset_): Update comment.
5286         (class Sized_relobj::local_dynsym_offset_): Update comment.
5287         * options.cc (Input_arguments::add_file): Remove const.
5288         * options.h (Input_file_argument::Input_file_argument):
5289         Initialize arg_serial_ (all constructors).
5290         (Input_file_argument::set_arg_serial): New function.
5291         (Input_file_argument::arg_serial): New function.
5292         (Input_file_argument::arg_serial_): New data member.
5293         (Input_arguments::Input_arguments): Initialize file_count_.
5294         (Input_arguments::add_file): Remove const.
5295         (Input_arguments::number_of_input_files): New function.
5296         (Input_arguments::file_count_): New data member.
5297         (Command_line::number_of_input_files): Call
5298         Input_arguments::number_of_input_files.
5299         * output.cc (Output_segment_headers::Output_segment_headers):
5300         Set current size.
5301         (Output_section::Input_section::current_data_size): New function.
5302         (Output_section::Output_section): Initialize new data members.
5303         (Output_section::add_input_section): Don't do merge sections for
5304         an incremental link; allocate space from free list for an
5305         incremental update.
5306         (Output_section::add_output_section_data): Allocate space from
5307         free list for an incremental update.
5308         (Output_section::update_data_size): New function.
5309         (Output_section::set_fixed_layout): New function.
5310         (Output_section::reserve): New function.
5311         (Output_segment::set_section_addresses): Remove const.
5312         (Output_segment::set_section_list_addresses): Remove const; allocate
5313         space from free list for an incremental update.
5314         (Output_segment::set_offset): Adjust size of RELRO segment for an
5315         incremental update.
5316         * output.h (Output_data::current_data_size): Move here from
5317         child classes.
5318         (Output_data::pre_finalize_data_size): New function.
5319         (Output_data::update_data_size): New function.
5320         (Output_section_headers::update_data_size): new function.
5321         (Output_section_data_build::current_data_size): Move to Output_data.
5322         (Output_data_strtab::update_data_size): New function.
5323         (Output_section::current_data_size): Move to Output_data.
5324         (Output_section::set_fixed_layout): New function.
5325         (Output_section::has_fixed_layout): New function.
5326         (Output_section::reserve): New function.
5327         (Output_section::update_data_size): New function.
5328         (Output_section::has_fixed_layout_): New data member.
5329         (Output_section::free_list_): New data member.
5330         (Output_segment::set_section_addresses): Remove const.
5331         (Output_segment::set_section_list_addresses): Remove const.
5332         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5333         New function.
5334         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5335         New function.
5336         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5337         parameter when calling Add_symbols constructor; store argument
5338         serial number for members of a lib group.
5339         (Add_symbols::locks): Allow case where token == NULL.
5340         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5341         (Read_member::~Read_member): New function.
5342         (Read_member::is_runnable): New function.
5343         (Read_member::locks): New function.
5344         (Read_member::run): New function.
5345         (Check_script::~Check_script): New function.
5346         (Check_script::is_runnable): New function.
5347         (Check_script::locks): New function.
5348         (Check_script::run): New function.
5349         (Check_library::~Check_library): New function.
5350         (Check_library::is_runnable): New function.
5351         (Check_library::locks): New function.
5352         (Check_library::run): New function.
5353         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5354         (Add_symbols::library_): New data member.
5355         (class Read_member): New class.
5356         (class Check_script): New class.
5357         (class Check_library): New class.
5358         * reloc.cc (Read_relocs::is_runnable): Allow case where
5359         token == NULL.
5360         (Read_relocs::locks): Likewise.
5361         (Scan_relocs::locks): Likewise.
5362         (Relocate_task::locks): Likewise.
5363         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5364         to clear counters.
5365         (Sized_relobj::incremental_relocs_scan): Fix comment.
5366         (Sized_relobj::do_relocate): Pass output file offset to
5367         write_local_symbols.
5368         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5369         from class declaration.
5370         * script.cc (read_input_script): Allocate Script_info; pass
5371         argument serial number to report_script.
5372         * script.h (class Script_info): Move to incremental.h.
5373         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5374         * symtab.h (Symbol_table::add_from_incrobj): New function.
5375         (Symbol_table::set_file_offset): New function.
5376
5377 2011-04-05  Cary Coutant  <ccoutant@google.com>
5378
5379         * incremental-dump.cc (dump_incremental_inputs): Change signature
5380         to take a Sized_incremental_binary; change caller.  Use readers
5381         in Sized_incremental_binary.
5382         * incremental.cc
5383         (Sized_incremental_binary::find_incremental_inputs_sections):
5384         Rename do_find_incremental_inputs_sections to this.
5385         (Sized_incremental_binary::setup_readers): New function.
5386         (Sized_incremental_binary::do_check_inputs): Check
5387         has_incremental_info_ flag; move setup code to setup_readers;
5388         use input readers.
5389         (Sized_incremental_binary::do_file_is_unchanged): New function.
5390         (Sized_incremental_binary::do_get_input_reader): New function.
5391         * incremental.h (class Incremental_binary): Move to end of file.
5392         (Incremental_binary::file_is_unchanged): New function.
5393         (Incremental_binary::do_file_is_unchanged): New function.
5394         (Incremental_binary::Input_reader): New class.
5395         (Incremental_binary::get_input_reader): New function.
5396         (class Sized_incremental_binary): Move to end of file.
5397         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5398         input section reader classes.
5399         (Sized_incremental_binary::has_incremental_info): New function.
5400         (Sized_incremental_binary::inputs_reader): New function.
5401         (Sized_incremental_binary::symtab_reader): New function.
5402         (Sized_incremental_binary::relocs_reader): New function.
5403         (Sized_incremental_binary::got_plt_reader): New function.
5404         (Sized_incremental_binary::do_file_is_unchanged): New function.
5405         (Sized_incremental_binary::Sized_input_reader): New class.
5406         (Sized_incremental_binary::get_input_reader): New function.
5407         (Sized_incremental_binary::find_incremental_inputs_sections):
5408         Rename do_find_incremental_inputs_sections to this.
5409         (Sized_incremental_binary::setup_readers): New function.
5410         (Sized_incremental_binary::has_incremental_info_): New data member.
5411         (Sized_incremental_binary::inputs_reader_): New data member.
5412         (Sized_incremental_binary::symtab_reader_): New data member.
5413         (Sized_incremental_binary::relocs_reader_): New data member.
5414         (Sized_incremental_binary::got_plt_reader_): New data member.
5415         (Sized_incremental_binary::current_input_file_): New data member.
5416
5417 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5418
5419         PR gold/12640
5420         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5421         violation.
5422
5423 2011-03-30  Cary Coutant  <ccoutant@google.com>
5424
5425         * archive.cc (Archive::include_member): Adjust call to report_object.
5426         (Add_archive_symbols::run): Add script_info to call to
5427         report_archive_begin.
5428         (Lib_group::include_member): Adjust call to report_object.
5429         (Add_lib_group_symbols::run): Adjust call to report_object.
5430         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5431         blocks.  Add object count for script input files.
5432         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5433         script_info parameter; change all callers.
5434         (Incremental_inputs::report_object): Add script_info parameter;
5435         change all callers.
5436         (Incremental_inputs::report_script): Store backpointer to
5437         incremental info entry.
5438         (Output_section_incremental_inputs::set_final_data_size): Record
5439         additional information for scripts.
5440         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5441         * incremental.h (Incremental_script_entry::add_object): New function.
5442         (Incremental_script_entry::get_object_count): New function.
5443         (Incremental_script_entry::get_object): New function.
5444         (Incremental_script_entry::objects_): New data member; adjust
5445         constructor.
5446         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5447         (Incremental_inputs::report_object): Add script_info parameter.
5448         (Incremental_inputs_reader::get_object_count): New function.
5449         (Incremental_inputs_reader::get_object_offset): New function.
5450         * options.cc (Input_arguments::add_file): Return reference to
5451         new input argument.
5452         * options.h (Input_argument::set_script_info): New function.
5453         (Input_argument::script_info): New function.
5454         (Input_argument::script_info_): New data member; adjust all
5455         constructors.
5456         (Input_file_group::add_file): Return reference to new input argument.
5457         (Input_file_lib::add_file): Likewise.
5458         (Input_arguments::add_file): Likewise.
5459         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5460         * script.cc (Parser_closure::Parser_closure): Add script_info
5461         parameter; adjust all callers.
5462         (Parser_closure::script_info): New function.
5463         (Parser_closure::script_info_): New data member.
5464         (read_input_script): Report scripts earlier to incremental info.
5465         (script_add_file): Set script_info in Input_argument.
5466         (script_add_library): Likewise.
5467         * script.h (Script_options::Script_info): Rewrite class.
5468
5469 2011-03-29  Cary Coutant  <ccoutant@google.com>
5470
5471         * archive.cc (Library_base::should_include_member): Move
5472         method here from class Archive.
5473         (Archive::Archive): Initialize base class.
5474         (Archive::should_include_member): Move to base class.
5475         (Archive::do_for_all_unused_symbols): New function.
5476         (Add_archive_symbols::run): Remove redundant access to
5477         incremental_inputs.
5478         (Lib_group::Lib_group): Initialize base class.
5479         (Lib_group::do_filename): New function.
5480         (Lib_group::include_member): Pass pointer to Lib_group to
5481         report_object.
5482         (Lib_group::do_for_all_unused_symbols): New function.
5483         (Add_lib_group_symbols::run): Report archive information for
5484         incremental links.
5485         * archive.h (class Library_base): New base class.
5486         (class Archive): Derive from Library_base.
5487         (Archive::filename): Move to base class.
5488         (Archive::set_incremental_info): Likewise.
5489         (Archive::incremental_info): Likewise.
5490         (Archive::Should_include): Likewise.
5491         (Archive::should_include_member): Likewise.
5492         (Archive::Armap_entry): Remove.
5493         (Archive::Unused_symbol_iterator): Remove.
5494         (Archive::unused_symbols_begin): Remove.
5495         (Archive::unused_symbols_end): Remove.
5496         (Archive::do_filename): New function.
5497         (Archive::do_get_mtime): New function.
5498         (Archive::do_for_all_unused_symbols): New function.
5499         (Archive::task_): Move to base class.
5500         (Archive::incremental_info_): Likewise.
5501         (class Lib_group): Derive from Library_base.
5502         (Lib_group::do_filename): New function.
5503         (Lib_group::do_get_mtime): New function.
5504         (Lib_group::do_for_all_unused_symbols): New function.
5505         (Lib_group::task_): Move to base class.
5506         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5507         function.
5508         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5509         function.
5510         * incremental.cc (Incremental_inputs::report_archive_begin):
5511         Use Library_base; call library's get_mtime; add incremental inputs
5512         entry before members.
5513         (class Unused_symbol_visitor): New class.
5514         (Incremental_inputs::report_archive_end): Use Library_base; use
5515         visitor class to record unused symbols; don't add incremental inputs
5516         entry after members.
5517         (Incremental_inputs::report_object): Use Library_base.
5518         * incremental.h
5519         (Incremental_archive_entry::Incremental_archive_entry): Remove
5520         unused Archive parameter.
5521         (Incremental_inputs::report_archive_begin): Use Library_base.
5522         (Incremental_inputs::report_archive_end): Likewise.
5523         (Incremental_inputs::report_object): Likewise.
5524         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5525         function.
5526         * object.h (Object::for_all_global_symbols): New function.
5527         (Object::do_for_all_global_symbols): New function.
5528         (Sized_relobj::do_for_all_global_symbols): New function.
5529         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5530         function.
5531         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5532         function.
5533
5534 2011-03-27  Ian Lance Taylor  <iant@google.com>
5535
5536         * archive.cc (Archive::interpret_header): Return -1 if something
5537         goes wrong.  Change callers accordingly.
5538
5539 2011-03-25  Cary Coutant  <ccoutant@google.com>
5540
5541         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5542         * testsuite/Makefile.in: Regenerate.
5543
5544 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5545
5546         * plugin.cc (get_view): New.
5547         (Plugin::load): Pass get_view to the plugin.
5548         (Plugin_manager::get_view): New.
5549
5550 2011-03-21  Ian Lance Taylor  <iant@google.com>
5551
5552         * testsuite/final_layout.sh: Rewrite to not use dc.
5553         * testsuite/relro_test.sh: Fail if dc is not present.
5554
5555 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5556
5557         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5558         Change == to -eq.
5559         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5560         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5561         Change == to -eq.
5562         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5563         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5564
5565 2011-03-14  Ian Lance Taylor  <iant@google.com>
5566
5567         * script-sections.cc (Sort_output_sections::script_compare):
5568         Rename from is_before, change return type.
5569         (Sort_output_sections::operator()): Adjust accordingly.
5570
5571 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5572
5573         PR gold/12572
5574         * testsuite/odr_violation2.cc: Add comment to make all error line
5575         numbers double digits.
5576         * testsuite/debug_msg.sh: Adjust expected errors.
5577
5578 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5579
5580         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5581         but mark earlier ones as non-canonical
5582         (offset_to_iterator): Update search target and example
5583         (do_addr2line): Return extra lines in a vector*
5584         (format_file_lineno): Extract from do_addr2line
5585         (one_addr2line): Add vector* out-param
5586         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5587         when a lineno entry appeared last for its instruction
5588         (Dwarf_line_info): Add vector* out-param
5589         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5590         * symtab.cc (Odr_violation_compare): Include the lineno in the
5591         comparison again.
5592         (linenos_from_loc): New. Combine the canonical line for an
5593         address with its other lines.
5594         (True_if_intersect): New. Helper functor to make
5595         std::set_intersection a query.
5596         (detect_odr_violations): Compare sets of lines instead of just
5597         one line for each function. This became less deterministic, but
5598         has fewer false positives.
5599         * symtab.h: Declarations.
5600         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5601         mix an optimized and non-optimized object in the same binary
5602         (odr_violation2.so): Same.
5603         * testsuite/Makefile.in: Regenerate from Makefile.am.
5604         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5605         * testsuite/debug_msg.sh: Update line numbers and add
5606         assertions.
5607         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5608         non-optimized context.
5609         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5610         isn't inlined, and use OdrDerived in an optimized context.
5611         * testsuite/odr_header1.h: Defines OdrDerived, where
5612         optimization will change the
5613         first-instruction-in-the-destructor's file and line number.
5614         * testsuite/odr_header2.h: Defines OdrBase.
5615
5616 2011-03-09  Ian Lance Taylor  <iant@google.com>
5617
5618         * fileread.cc (File_read::clear_views): Don't delete the whole
5619         file view.
5620
5621 2011-03-08  Ian Lance Taylor  <iant@google.com>
5622
5623         PR gold/12525
5624         * fileread.cc: #include <climits>.
5625         (GOLD_IOV_MAX): Define.
5626         (File_read::read_multiple): Limit number of entries by iov_max.
5627         * fileread.h (class File_read): Always set max_readv_entries to
5628         128.
5629
5630 2011-03-07  Ian Lance Taylor  <iant@google.com>
5631
5632         PR gold/12525
5633         * options.h (class General_options): Add -dy and -dn.
5634
5635 2011-03-02  Cary Coutant  <ccoutant@google.com>
5636
5637         * testsuite/script_test_9.t: Add TLS segment.
5638
5639 2011-03-02  Simon Baldwin  <simonb@google.com>
5640
5641         * configure.ac: Add check for gnu_indirect_function support in
5642         the toolchain building binutils.
5643         * configure: Rebuild.
5644
5645 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5646
5647         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5648         plugin only symbols.
5649         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5650         in plugin files as not needed in the symbol table.
5651
5652 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5653
5654         * output.cc (Output_section::add_input_section): Delay fill
5655         generation for section ordering.
5656
5657 2011-02-09  Ian Lance Taylor  <iant@google.com>
5658
5659         PR gold/12316
5660         * object.h (class Sized_relobj): Remove clear_local_symbols.
5661         * reloc.cc (Sized_relobj::do_relocate): Don't call
5662         clear_local_symbols.
5663
5664 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5665
5666         * plugin.cc (is_visible_from_outside): Return true for symbols
5667         in the -u option.
5668
5669 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5670
5671         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5672         filename.
5673
5674 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5675
5676         * icf.h (is_section_foldable_candidate): Change type of parameter
5677         to std::string.
5678         * icf.cc (Icf::find_identical_sections): Change type of local variable
5679         section_name to be std::string.
5680         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5681
5682 2011-01-25  Ian Lance Taylor  <iant@google.com>
5683
5684         * script.cc (script_add_extern): Rewrite to use
5685         add_symbol_reference.
5686
5687 2011-01-25  Doug Kwan  <dougkwan@google.com>
5688
5689         * icf.cc (get_section_contents): Always lock section's object.
5690
5691 2011-01-24  Ian Lance Taylor  <iant@google.com>
5692
5693         * options.h (class General_options): Accept
5694         --no-detect-odr-violations.
5695
5696 2011-01-24  Ian Lance Taylor  <iant@google.com>
5697
5698         * version.cc (version_string): Bump to 1.11.
5699
5700 2011-01-24  Ian Lance Taylor  <iant@google.com>
5701
5702         * plugin.cc (class Plugin_rescan): Define new class.
5703         (Plugin_manager::claim_file): Set any_claimed_.
5704         (Plugin_manager::save_archive): New function.
5705         (Plugin_manager::save_input_group): New function.
5706         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5707         necessary.
5708         (Plugin_manager::new_undefined_symbol): New function.
5709         (Plugin_manager::rescan): New function.
5710         (Plugin_manager::rescannable_defines): New function.
5711         (Plugin_manager::add_input_file): Set any_added_.
5712         * plugin.h (class Plugin_manager): define new fields rescannable_,
5713         undefined_symbols_, any_claimed_, and any_added_.  Declare
5714         Plugin_rescan as friend.  Declare new functions.
5715         (Plugin_manager::Rescannable): Define type.
5716         (Plugin_manager::Rescannable_list): Define type.
5717         (Plugin_manager::Undefined_symbol_list): Define type.
5718         (Plugin_manager::Plugin_manager): Initialize new fields.
5719         * archive.cc (Archive::defines_symbol): New function.
5720         (Add_archive_symbols::run): Pass archive to plugins if any.
5721         * archive.h (class Archive): Declare defines_symbol.
5722         * readsyms.cc (Input_group::~Input_group): New function.
5723         (Finish_group::run): Pass input_group to plugins if any.
5724         * readsyms.h (class Input_group): Declare destructor.
5725         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5726         any.
5727
5728 2011-01-10  Ian Lance Taylor  <iant@google.com>
5729
5730         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5731         section as relro.
5732         (Layout::set_segment_offsets): Reset increase_relro before calling
5733         set_section_addresses a second time.
5734
5735 2011-01-04  Cary Coutant  <ccoutant@google.com>
5736
5737         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5738         sections before NOBITS sections.
5739
5740 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5741
5742         * version.cc (print_version): Update copyright to 2011.
5743
5744 2010-12-23  Cary Coutant  <ccoutant@google.com>
5745
5746         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5747         of OS to this->add.  Add OD parameter to second form of the function.
5748
5749 2010-12-20  Ian Lance Taylor  <iant@google.com>
5750
5751         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5752         second of two consecutive entries with same offset.
5753
5754 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5755
5756         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5757         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5758         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5759         to avoid unneeded links against $(LDADD).
5760         * testsuite/Makefile.in: Regenerate.
5761
5762 2010-12-15  Ian Lance Taylor  <iant@google.com>
5763
5764         PR gold/12324
5765         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5766         for R_X86_64_32 and R_X86_64_PC32.
5767         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5768         ver_matching_def_pic.o.
5769         (ver_matching_def_pic.o): New target.
5770
5771 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5772
5773         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5774         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5775         Move definition before File_read::View member definitions.
5776         (File_read::View::~View): Initialize and hold lock before
5777         updating current_mapped_bytes.
5778
5779 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5780
5781         * dwarf_reader.cc: Remove outdated comment.
5782         * gold-threads.cc: Fix typo in error message.
5783         * archive.cc: Fix typos in comments.
5784         * archive.h: Likewise.
5785         * arm-reloc-property.cc: Likewise.
5786         * arm-reloc-property.h: Likewise.
5787         * arm-reloc.def: Likewise.
5788         * arm.cc: Likewise.
5789         * attributes.h: Likewise.
5790         * cref.cc: Likewise.
5791         * ehframe.cc: Likewise.
5792         * fileread.h: Likewise.
5793         * gold.h: Likewise.
5794         * i386.cc: Likewise.
5795         * icf.cc: Likewise.
5796         * incremental.h: Likewise.
5797         * int_encoding.cc: Likewise.
5798         * layout.h: Likewise.
5799         * main.cc: Likewise.
5800         * merge.h: Likewise.
5801         * object.cc: Likewise.
5802         * object.h: Likewise.
5803         * options.cc: Likewise.
5804         * readsyms.cc: Likewise.
5805         * reduced_debug_output.cc: Likewise.
5806         * reloc.cc: Likewise.
5807         * script-sections.cc: Likewise.
5808         * sparc.cc: Likewise.
5809         * symtab.h: Likewise.
5810         * target-reloc.h: Likewise.
5811         * target.cc: Likewise.
5812         * target.h: Likewise.
5813         * timer.cc: Likewise.
5814         * timer.h: Likewise.
5815         * x86_64.cc: Likewise.
5816
5817 2010-12-09  Cary Coutant  <ccoutant@google.com>
5818
5819         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5820         stack.
5821         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5822         parameter; change all callers.
5823         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5824         * options.h (warn_execstack): New option.
5825
5826 2010-12-07  Doug Kwan  <dougkwan@google.com>
5827
5828         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5829         like function call relocations.
5830
5831 2010-12-07  Ian Lance Taylor  <iant@google.com>
5832
5833         * archive.cc (Archive::get_elf_object_for_member): Permit
5834         punconfigured to be NULL.
5835         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5836         (Archive::include_member): Pass NULL to get_elf_object_for_member
5837         if we searched for the archive and this is the first included
5838         object.
5839
5840 2010-12-01  Ian Lance Taylor  <iant@google.com>
5841
5842         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5843         track_relocs_type_ field.
5844         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5845         Set track_relocs_type_.
5846         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5847         contents when using RELA relocs.
5848         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5849         reloc_map_.
5850         * reloc.cc (Track_relocs::next_addend): New function.
5851         * reloc.h (class Track_relocs): Declare next_addend.
5852
5853 2010-12-01  Ian Lance Taylor  <iant@google.com>
5854
5855         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5856         virtual destructor.
5857
5858 2010-12-01  Ian Lance Taylor  <iant@google.com>
5859
5860         * README: Update compilers known to work and fail.
5861
5862 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5863
5864         * configure.in: For --enable-gold, handle value `default' instead of
5865         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5866         not the default.
5867         * configure: Regenerate.
5868
5869 2010-11-18  Doug Kwan  <dougkwan@google.com>
5870
5871         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5872         and right_alignment to be zero.  Store result alignment only if it is
5873         greater than existing alignment.
5874
5875 2010-11-16  Cary Coutant  <ccoutant@google.com>
5876
5877         PR gold/12220
5878         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5879         Check for ".zdebug_line".
5880
5881 2010-11-16  Doug Kwan  <dougkwan@google.com>
5882             Cary Coutant  <ccoutant@google.com>
5883
5884         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5885         by reference; adjust all callers.
5886         * output.cc (Output_segment::set_section_addresses): Adjust references
5887         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5888         list is empty.
5889         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5890         end at page boundary.
5891
5892 2010-11-16  Cary Coutant  <ccoutant@google.com>
5893
5894         PR gold/12220
5895         * layout.cc (Layout::choose_output_section): Transform names of
5896         compressed sections even when using a script with a SECTIONS clause.
5897         (Layout::output_section_name): Remove code to transform
5898         compressed debug section names.
5899         * output.cc (Output_section::add_input_section): Use uncompressed
5900         section size when tracking input sections.
5901
5902 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
5903
5904         * symtab.h (Symbol::NON_PIC_REF): Remove.
5905         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
5906         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
5907         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
5908         (Symbol::use_plt_offset): Take a flags argument and pass it
5909         directly to needs_dynamic_reloc.  Restrict check for undefined
5910         weak symbols to function calls.
5911         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
5912         (Target_arm::Scan::global): Use it.
5913         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
5914         (Target_arm::Relocate::relocate): Likewise.
5915         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
5916         parameter with an r_type parameter.  Use get_reference_flags
5917         to get the flags.
5918         (Target_arm::Relocate::relocate): Update accordingly.
5919         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
5920         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
5921         (Target_i386::Scan::global): Likewise.
5922         (Target_i386::Relocate::relocate): Likewise.
5923         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
5924         parameter with an r_type parameter.  Use get_reference_flags
5925         to get the flags.
5926         (Target_i386::Relocate::relocate): Update accordingly.
5927         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
5928         (Target_powerpc::Scan::global): Use it.
5929         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
5930         (Target_powerpc::Relocate::relocate): Likewise.
5931         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
5932         (Target_sparc::Scan::global): Use it.
5933         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
5934         (Target_sparc::Relocate::relocate): Likewise.
5935         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
5936         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
5937         (Target_x86_64::Scan::global): Likewise.
5938         (Target_x86_64::Relocate::relocate): Likewise.
5939
5940 2010-11-08  Doug Kwan  <dougkwan@google.com>
5941             Cary Coutant  <ccoutant@google.com>
5942
5943         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
5944         (Arm_exidx_merge_section::section_contents_): New data member.
5945         (Arm_input_section::Arm_input_section): Initialize original_contents_.
5946         (Arm_input_section::~Arm_input_section): De-allocate memory.
5947         (Arm_input_section::original_contents_): New data member.
5948         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
5949         in parameters instead of calling Object::section_contents without
5950         locking.
5951         (Arm_output_section::group_section): New parameter TASK.  Pass it
5952         to callees that need locking objects.
5953         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
5954         to lock EXIDX input sections.  Fix a formatting issue.  Call
5955         Arm_exidx_merged_section::build_contents to create merged section
5956         contents.
5957         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
5958         to lock object of stub table owner.
5959         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
5960         TEXT_SIZE to initialize data member TEXT_SIZE_.
5961         (Arm_exidx_input_section::addralign): Fix typo in comment.
5962         (Arm_exidx_input_section::text_size): New method.
5963         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
5964         that require locking objects.  Lock objects before scanning for stubs
5965         and updating local symbols.
5966         (Arm_input_section<big_endian>::init): Copy contents of original
5967         input section.
5968         (Arm_input_section<big_endian>::do_write): Use saved contents of
5969         original input section instead of calling Object::section_contents
5970         without locking.
5971         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
5972         size without calling Object::section_size().
5973         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
5974         for size.  Allocate a buffer for merged EXIDX entries.
5975         (Arm_exidx_merged_section::build_contents): New method.
5976         (Arm_exidx_merged_section::do_write): Move merge section contents
5977         building code to Arm_exidx_merged_section::build_contetns.  Write
5978         out contetns in buffer instead of building it on the fly.
5979         (Arm_relobj::make_exidx_input_section): Also pass text section size
5980         to Arm_exidx_input_section constructor.
5981         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
5982         (Arm_dynobj::do_read_symbols): Fix memory leak.
5983         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
5984         * target.h: (class Task): Add forward declaration.
5985         (Target::relax): Add new parameter TASK and pass it to
5986         Target::do_relax().
5987         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
5988
5989 2010-11-05  Cary Coutant  <ccoutant@google.com>
5990
5991         PR gold/10708
5992         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
5993         object when reading from the file.
5994         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
5995         second layout pass.
5996         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
5997         when reading section contents.
5998         (get_section_contents): Likewise.
5999         (icf::find_identical_sections): Likewise.
6000         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6001         object when reading from the file.
6002         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6003         the object when doing deferred section layout.
6004
6005 2010-11-03  Nick Clifton  <nickc@redhat.com>
6006
6007         PR gold/12001
6008         * script.h (class Symbol_assignment: name): New member.  Returns
6009         the name of the symbol.
6010         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6011         Returns true if the given symbol name is on the list of
6012         assignments wating to be processed.
6013         * archive.cc (should_incldue_member): If the symbol is undefined,
6014         check to see if it is on the list of symbols pending assignment.
6015
6016 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6017
6018         * script-sections.cc (Script_sections::find_memory_region): Check
6019         for a NULL output section pointer.
6020
6021 2010-10-29  Doug Kwan  <dougkwan@google.com>
6022
6023         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6024         Output_section::add_relaxed_input_section.
6025         * output.cc (Output_section::add_relaxed_input_section): Add new
6026         arguments LAYOUT and NAME.  Set section order index.
6027         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6028         Copy section order index.
6029         * output.h (Output_section::add_relaxed_input_section): Add new
6030         arguments LAYOUT and NAME.
6031
6032 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6033
6034         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6035         NATIVE_OR_CROSS_LINKER.
6036         * testsuite/Makefile.in: Regenerate.
6037
6038 2010-10-20  Doug Kwan  <dougkwan@google.com>
6039
6040         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6041         without SHF_LINK_ORDER flags.
6042         * layout.cc (Layout::choose_output_section): Do not filter
6043         SHF_LINK_ORDER flag in a relocatable link.
6044
6045 2010-10-17  Cary Coutant  <ccoutant@google.com>
6046
6047         * output.h (Output_segment::set_section_addresses): Change function
6048         signature.  Update all callers.
6049         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6050         sections.
6051         (Output_segment::set_section_addresses): Align after last TLS
6052         section.  Add padding before last relro section instead of after.
6053
6054 2010-10-17  Doug Kwan  <dougkwan@google.com>
6055
6056         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6057         GOT output section to be writable.
6058
6059 2010-10-14  Cary Coutant  <ccoutant@google.com>
6060
6061         * debug.h (DEBUG_INCREMENTAL): New flag.
6062         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6063         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6064         mode.
6065         * incremental.cc (report_command_line): Ignore all forms of
6066         --incremental.
6067         * layout.cc (Layout::Layout): Check parameters for incremental link
6068         mode.
6069         * options.cc (General_options::parse_incremental): New function.
6070         (General_options::parse_no_incremental): New function.
6071         (General_options::parse_incremental_full): New function.
6072         (General_options::parse_incremental_update): New function.
6073         (General_options::incremental_mode_): New data member.
6074         (General_options::finalize): Check incremental_mode_.
6075         * options.h (General_options): Update help text for --incremental.
6076         Add --no-incremental, --incremental-full, --incremental-update.
6077         (General_options::Incremental_mode): New enum type.
6078         (General_options::incremental_mode): New function.
6079         (General_options::incremental_mode_): New data member.
6080         * parameters.cc (Parameters::incremental_mode_): New data member.
6081         (Parameters::set_options): Set incremental_mode_.
6082         (Parameters::set_incremental_full): New function.
6083         (Parameters::incremental): New function.
6084         (Parameters::incremental_update): New function.
6085         (set_parameters_incremental_full): New function.
6086         * parameters.h (Parameters::set_incremental_full): New function.
6087         (Parameters::incremental): New function.
6088         (Parameters::incremental_update): New function.
6089         (Parameters::incremental_mode_): New data member.
6090         (set_parameters_incremental_full): New function.
6091         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6092         incremental link mode.
6093         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6094         (Sized_relobj::do_relocate_sections): Likewise.
6095         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6096         option.
6097         * testsuite/Makefile.in: Regenerate.
6098         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6099
6100 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6101
6102         * script-sections.h (class Script_sections): Make
6103         Sections_elements typedef public.
6104         * script-sections.cc (class Sort_output_sections): Add elements_
6105         field.  Add constructor which sets it; change all callers.
6106         (Sort_output_sections::is_before): New function.
6107         (Sort_output_sections::operator()): Call is_before.
6108         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6109         conditional.
6110         * testsuite/script_test_10.sh: New test. Test script section
6111         order.
6112         * testsuite/script_test_10.t: Likewise.
6113         * testsuite/script_test_10.s: Likewise.
6114         * testsuite/Makefile.am: Wrap the cross linker tests and the
6115         common tests into NATIVE_OR_CROSS_LINKER.
6116         (check_SCRIPTS): Add script_test_10.sh.
6117         (check_DATA): Add script_test_10.stdout.
6118         (script_test_10.o, script_test_10): New targets.
6119         (script_test_10.stdout): New target.
6120         * configure, testsuite/Makefile.in: Regenerate.
6121
6122 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6123
6124         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6125         error for the deprecated relocations.
6126         (Target_arm::Scan::global): Likewise.
6127         (Target_arm::Relocate::relocate): Likewise.
6128
6129 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6130
6131         * fileread.cc (Input_file::find_file): Initialize *found_name
6132         and *namep when using the fallback search for case 4.
6133
6134 2010-10-11  Cary Coutant  <ccoutant@google.com>
6135
6136         * options.h (class General_options): Redefine -z lazy as an alias for
6137         the negation of -z now.
6138
6139 2010-10-11  Ian Lance Taylor  <iant@google.com>
6140
6141         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6142         binding.
6143
6144 2010-10-06  Nick Clifton  <nickc@redhat.com>
6145
6146         * script-sections.cc(class Memory_region): Remove
6147         current_lma_offset_ field.  Rename current_vma_offset_ to
6148         current_offset_.  Add last_section_ field.
6149         (Memory_region::get_current_vma_address): Rename to
6150         get_current_address.
6151         (Memory_region::get_current_lma_address): Delete.
6152         (Memory_region::increment_vma_offset): Rename to
6153         increment_offset.
6154         (Memory_region::increment_lma_offset): Delete.
6155         (Memory_region::attributes_compatible): New method.  Returns
6156         true if the provided section is compatible with the region.
6157         (Memory_region::get_last_section): New method.  Returns the last
6158         section to use the region.
6159         (Memory_region::set_last_section): New method.  Stores the last
6160         section to use the region.
6161         (Script_sections::block_in_region): New method.  Returns true if
6162         a block of memory is contained within a region.
6163         (Script_sections::find_memory_region): New method.  Locates a
6164         memory region to be used to set a VMA or LMA address.
6165         (Output_section_definition::set_section_addresses): Add code to
6166         check for addresses set by memory regions.
6167         (Output_segment::set_section_addresses): Remove memory region
6168         walking code.
6169         (Script_sections::create_segment): Add a warning if a header
6170         segment is created outside of any region.
6171         * script-sections.h (class Script_sections): Add prototypes for
6172         find_memory_region and block_in_region methods.
6173         * testsuite/memory_test.s: Use .long instead of .word.
6174         * testsuite/memory_test.t: Add some more output sections.
6175         * testsuite/memory_test.sh: Update expected output.
6176
6177 2010-10-02  Doug Kwan  <dougkwan@google.com>
6178
6179         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6180         defintion to symtab.h
6181         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6182         declaration to defintion.
6183
6184 2010-10-01  Nick Clifton  <nickc@redhat.com>
6185
6186         * expression.cc (eval): Replace dummy argument with NULL.
6187         (eval_maybe_dot): Check for a NULL result section pointer.
6188         (Symbol_expression::value): Likewise.
6189         (Dot_expression::value): Likewise.
6190         (BINARY_EXPRESSION): Likewise.
6191         (Max_expression::value): Likewise.
6192         (Min_expression::value): Likewise.
6193         (Absolute_expression::value): Likewise.
6194         (Addr_expression::value_from_output_section): Likewise.
6195         (Loaddddr_expression::value_from_output_section): Likewise.
6196         (Segment_start_expression::value): Likewise.
6197         * script-sections.cc
6198         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6199         argument with NULL.
6200         (Sections_elememt_dot_assignment::set_section_addresses):
6201         Likewise.
6202         (Output_data_expression::do_write_to_buffer): Likewise.
6203         (Output_section_definition::finalize_symbols): Likewise.
6204         (Output_section_definition::set_section_addresses): Likewise.
6205
6206 2010-09-30  Doug Kwan  <dougkwan@google.com>
6207
6208         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6209
6210 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6211
6212         * target.h (Target::can_icf_inline_merge_sections): New virtual
6213         function.
6214         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6215         virtual function.
6216         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6217         virtual function.
6218         * icf.cc (get_section_contents): Inline merge sections only when
6219         target allows it.
6220
6221 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6222
6223         * configure: Regenerate.
6224
6225 2010-09-17  Ian Lance Taylor  <iant@google.com>
6226
6227         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6228         * testsuite/Makefile.am (memory_test.o): New target.
6229         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6230         memory_test.t.
6231         * testsuite/Makefile.in: Rebuild.
6232
6233 2010-09-17  Doug Kwan  <dougkwan@google.com>
6234
6235         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6236         defintion if relocation uses GOT entries of the symbol.
6237         * testsuite/icf_safe_test.sh: Fix test.
6238         * testsuite/icf_safe_so_test.sh: Fix test.
6239
6240 2010-09-16  Cary Coutant  <ccoutant@google.com>
6241
6242         * script_sections.cc (class Memory_region): Remove "NULL" from
6243         vector initializations.
6244
6245 2010-09-15  Cary Coutant  <ccoutant@google.com>
6246
6247         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6248         Resolve forwarding symbols.
6249
6250 2010-09-15  Doug Kwan  <dougkwan@google.com>
6251
6252         * gold/testsuite/script_test_3.t: Add ARM special sections.
6253         * gold/testsuite/script_test_4.t: Same.
6254         * gold/testsuite/script_test_5.t: Same.
6255         * gold/testsuite/script_test_6.t: Same.
6256         * gold/testsuite/script_test_7.t: Same.
6257         * gold/testsuite/script_test_7.t: Same.
6258         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6259
6260 2010-09-14  Cary Coutant  <ccoutant@google.com>
6261
6262         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6263         (Target_x86_64::Relocate::relocate_tls): Replace check for
6264         saw_tls_block_reloc_ with test for executable section.
6265
6266 2010-09-12  Cary Coutant  <ccoutant@google.com>
6267
6268         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6269         position-independent executables to shared libraries need dynamic
6270         relocations.
6271         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6272         position-independent executables.
6273         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6274         * testsuite/Makefile.in: Regenerate.
6275
6276 2010-09-10  Nick Clifton  <nickc@redhat.com>
6277
6278         PR gold/11997
6279         * testsuite/memory_test.t: Discard any sections that are not
6280         needed.
6281
6282 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6283
6284         PR gold/11996
6285         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6286         "This::" to work around a bug in gcc 4.2.
6287
6288         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6289
6290 2010-09-09  Rafael Espindola  <espindola@google.com>
6291
6292         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6293         sections with different PF_X flags in the same segment.
6294         (Layout::find_first_load_seg): Search all segments to find the first
6295         one.
6296         * options.h (rosegment): New.
6297
6298 2010-09-08  Rafael Espindola  <espindola@google.com>
6299
6300         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6301
6302 2010-09-08  Doug Kwan  <dougkwan@google.com>
6303
6304         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6305         (Arm_relobj::do_relocate_sections): Add new parameter for output
6306         file to match the parent.
6307         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6308         of local symbols instead of input values.  Update code to track
6309         changes in gold::relocate_section.
6310         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6311         (Sized_relobj::compute_final_local_value_internal): New methods.
6312         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6313         body into private version of Sized_relobj::compute_final_local_value.
6314         Call the inline method.
6315         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6316         merged symbol value if there is one.
6317         (Symbol_value::has_output_value): New method defintiion.
6318         (Sized_relobj::Compute_final_local_value_status): New enum type.
6319         (Sized_relobj::compute_final_local_value): New methods.
6320         (Sized_relobj::compute_final_local_value_internal): New methods.
6321         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6322         and arm_cortex_a8.sh.
6323         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6324         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6325         New tests.
6326         * Makefile.in: Regenerate.
6327         * testsuite/arm_bl_out_of_range.s: Update test.
6328         * testsuite/thumb_bl_out_of_range.s: Ditto.
6329         * testsuite/thumb_blx_out_of_range.s: Ditto.
6330         * testsuite/arm_branch_out_of_range.sh: New file.
6331         * testsuite/arm_cortex_a8.sh: Ditto.
6332         * testsuite/arm_cortex_a8_b.s: Ditto.
6333         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6334         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6335         * testsuite/arm_cortex_a8_bl.s: Ditto.
6336         * testsuite/arm_cortex_a8_blx.s: Ditto.
6337         * testsuite/arm_cortex_a8_local.s: Ditto.
6338         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6339         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6340
6341 2010-09-08  Rafael Espindola  <espindola@google.com>
6342
6343         * Makefile.am (memory_test.stdout): Run readelf with -W.
6344         * Makefile.in: Regenerate.
6345         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6346         64 bit output.
6347
6348 2010-09-08  Rafael Espindola  <espindola@google.com>
6349
6350         * script-sections.cc (Script_sections::add_memory_region): Convert
6351         field precision to int.
6352         * script.cc (script_set_section_region, script_set_section_region):
6353         Convert field precision to int.
6354
6355 2010-09-08  Rafael Espindola  <espindola@google.com>
6356
6357         * arm.cc (do_finalize_sections): Create the __exidx_start and
6358         __exdix_end symbols even when the section is missing.
6359
6360 2010-09-08  Nick Clifton  <nickc@redhat.com>
6361
6362         * README: Remove claim that MEMORY is not supported.
6363         * expression.cc (script_exp_function_origin)
6364         (script_exp_function_length): Move from here to ...
6365         * script.cc: ... here.
6366         (script_set_section_region, script_add_memory)
6367         (script_parse_memory_attr, script_include_directive): New
6368         functions.
6369         * script-sections.cc
6370         (class Memory_region): New class.
6371         (class Output_section_definition): Add set_memory_region,
6372         set_section_vma, set_section_lma and get_section_name methods.
6373         (class Script_Sections): Add add_memory_region,
6374         find_memory_region, find_memory_region_origin,
6375         find_memory_region_length and set_memory_region methods.
6376         Have set_section_addresses method walk the list of set memory
6377         regions.
6378         Extend the print methos to display memory regions.
6379         * script-sections.h: Add prototypes for new methods.
6380         Add enum for MEMORY region attributes.
6381         * yyscript.y: Add support for parsing MEMORY regions.
6382         * script-c.h: Add prototypes for new functions.
6383         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6384         * testsuite/Makefile.in: Regenerate.
6385         * testsuite/memory_test.sh: New script.
6386         * testsuite/memory_test.s: New assembler source file.
6387         * testsuite/memory_test.t: New linker script.
6388
6389 2010-08-27  Doug Kwan  <dougkwan@google.com>
6390
6391         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6392         reference override an existing dynamic weak reference.
6393         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6394         * testsuite/Makefile.in: Regenerate.
6395         * testsuite/dyn_weak_ref.sh: New file.
6396         * testsuite/dyn_weak_ref_1.c: Ditto.
6397         * testsuite/dyn_weak_ref_2.c: Ditto.
6398
6399 2010-08-27  Ian Lance Taylor  <iant@google.com>
6400
6401         * incremental.h (class Incremental_input_entry): Add virtual
6402         destructor.
6403
6404 2010-08-27  Ian Lance Taylor  <iant@google.com>
6405
6406         * testsuite/start_lib_test_3.c: Mark t3 as used.
6407
6408 2010-08-27  Nick Clifton  <nickc@redhat.com>
6409
6410         * options.cc (version_script): Fix small typo in previous
6411         whitespace tidyup.
6412
6413 2010-08-25  Nick Clifton  <nickc@redhat.com>
6414
6415         * archive.cc: Formatting fixes: Remove whitespace between
6416         typename and following asterisk.  Remove whitespace between
6417         function name and opening parenthesis.
6418         * archive.h: Likewise.
6419         * arm.cc: Likewise.
6420         * attributes.cc: Likewise.
6421         * attributes.h: Likewise.
6422         * common.cc: Likewise.
6423         * copy-relocs.cc: Likewise.
6424         * dirsearch.h: Likewise.
6425         * dynobj.cc: Likewise.
6426         * ehframe.cc: Likewise.
6427         * ehframe.h: Likewise.
6428         * expression.cc: Likewise.
6429         * fileread.cc: Likewise.
6430         * fileread.h: Likewise.
6431         * gc.h: Likewise.
6432         * gold-threads.cc: Likewise.
6433         * gold.cc: Likewise.
6434         * i386.cc: Likewise.
6435         * icf.h: Likewise.
6436         * incremental-dump.cc: Likewise.
6437         * incremental.cc: Likewise.
6438         * layout.cc: Likewise.
6439         * layout.h: Likewise.
6440         * main.cc: Likewise.
6441         * merge.cc: Likewise.
6442         * merge.h: Likewise.
6443         * object.cc: Likewise.
6444         * object.h: Likewise.
6445         * options.cc: Likewise.
6446         * options.h: Likewise.
6447         * output.cc: Likewise.
6448         * output.h: Likewise.
6449         * plugin.cc: Likewise.
6450         * plugin.h: Likewise.
6451         * powerpc.cc: Likewise.
6452         * reloc.cc: Likewise.
6453         * script-c.h: Likewise.
6454         * script-sections.cc: Likewise.
6455         * script.cc: Likewise.
6456         * stringpool.cc: Likewise.
6457         * symtab.cc: Likewise.
6458         * symtab.h: Likewise.
6459         * target.cc: Likewise.
6460         * timer.cc: Likewise.
6461         * timer.h: Likewise.
6462         * version.cc: Likewise.
6463         * x86_64.cc: Likewise.
6464
6465 2010-08-24  Nick Clifton  <nickc@redhat.com>
6466
6467         PR 11899
6468         * layout.cc (segment_precedes): Sort segments by their physical
6469         addresses, if they have been set.
6470
6471 2010-08-23  Cary Coutant  <ccoutant@google.com>
6472
6473         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6474         symbols data.
6475         (Lib_group::include_member): Unlock object after deleting its
6476         symbols data.
6477         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6478         the bug fixed here.
6479
6480 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6481             Cary Coutant  <ccoutant@google.com>
6482
6483         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6484         constructor, and set_blocker.
6485         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6486         readsyms_blocker_.
6487         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6488         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6489         * testsuite/Makefile.am (start_lib_test): New test case.
6490         * testsuite/Makefile.in: Regenerate.
6491         * testsuite/start_lib_test_main.c: New file.
6492         * testsuite/start_lib_test_1.c: New file.
6493         * testsuite/start_lib_test_2.c: New file.
6494         * testsuite/start_lib_test_3.c: New file.
6495
6496 2010-08-19  Ian Lance Taylor  <iant@google.com>
6497
6498         * Makefile.in: Rebuild with automake 1.11.1.
6499         * aclocal.m4: Likewise.
6500         * testsuite/Makefile.in: Likewise.
6501
6502 2010-08-19  Ian Lance Taylor  <iant@google.com>
6503
6504         PR 10893
6505         * i386.cc (class Output_data_plt_i386): Update declarations.
6506         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6507         local_ifuncs_ fields.
6508         (Target_i386::do_plt_section_for_global): New function.
6509         (Target_i386::do_plt_section_for_local): New function.
6510         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6511         parameter; change all callers.  Initialize global_ifuncs_ and
6512         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6513         __rel_iplt_end.
6514         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6515         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6516         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6517         symbols.
6518         (Target_i386::make_plt_section): New function, broken out of
6519         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6520         (Target_i386::make_plt_entry): Call make_plt_section.
6521         (Target_i386::make_local_ifunc_plt_entry): New function.
6522         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6523         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6524         R_386_IRELATIVE to switch.
6525         (Target_i386::Scan::global): Likewise.
6526         (Target_i386::Relocate::relocate): Likewise.
6527         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6528         switch.
6529         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6530         (Target_x86_64::do_plt_section_for_global): New function.
6531         (Target_x86_64::do_plt_section_for_local): New function.
6532         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6533         parameter; change all callers.  If doing a static link define
6534         __rela_iplt_start and __rela_iplt_end.
6535         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6536         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6537         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6538         to point to .plt.
6539         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6540         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6541         switch.
6542         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6543         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6544         R_X86_64_IRELATIVE to switch.
6545         (Target_x86_64::Scan::global): Likewise.
6546         (Target_x86_64::Relocate::relocate): Likewise.
6547         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6548         switch.
6549         * target.h (class Target): Add plt_section_for_global and
6550         plt_section_for_local functions.  Add do_plt_section_for_global
6551         and do_plt_section_for_local virtual functions.
6552         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6553         clarifying comments.
6554         (Symbol::use_plt_offset): Handle IFUNC symbol.
6555         * object.cc (Sized_relobj::Sized_relobj): Initialize
6556         local_plt_offsets_.
6557         (Sized_relobj::local_has_plt_offset): New function.
6558         (Sized_relobj::local_plt_offset): New function.
6559         (Sized_relobj::set_local_plt_offset): New function.
6560         (Sized_relobj::do_count): Handle IFUNC symbol.
6561         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6562         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6563         is_ifunc_symbol functions.
6564         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6565         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6566         local_plt_offsets_ field.
6567         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6568         * output.h (class Output_section_data): Add non-const
6569         output_section function.
6570         (class Output_data_got): Update declarations.
6571         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6572         Add use_plt_offset parameter to global and local constructors.
6573         Change all callers.  Change local_sym_index_ field to 31 bits.
6574         Change GSYM_CODE and CONSTANT_CODE accordingly.
6575         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6576         doing a static link don't set sh_link field.
6577         (Output_data_got::Got_entry::write): Use PLT offset if
6578         appropriate.
6579         (Output_data_got::add_global_plt): New function.
6580         (Output_data_got::add_local_plt): New function.
6581         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6582         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6583         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6584         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6585         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6586         IFUNC conditional.
6587         * testsuite/ifunc-sel.h: New file.
6588         * testsuite/ifuncmain1.c: New file.
6589         * testsuite/ifuncmain1vis.c: New file.
6590         * testsuite/ifuncmod1.c: New file.
6591         * testsuite/ifuncdep2.c: New file.
6592         * testsuite/ifuncmain2.c: New file.
6593         * testsuite/ifuncmain3.c: New file.
6594         * testsuite/ifuncmod3.c: New file.
6595         * testsuite/ifuncmain4.c: New file.
6596         * testsuite/ifuncmain5.c: New file.
6597         * testsuite/ifuncmod5.c: New file.
6598         * testsuite/ifuncmain6pie.c: New file.
6599         * testsuite/ifuncmod6.c: New file.
6600         * testsuite/ifuncmain7.c: New file.
6601         * configure, testsuite/Makefile.in: Rebuild.
6602
6603 2010-08-18  Ian Lance Taylor  <iant@google.com>
6604
6605         * incremental.cc
6606         (Output_section_incremental_inputs::write_input_files): Add cast
6607         to avoid signed/unsigned comparison warning.
6608         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6609
6610 2010-08-12  Cary Coutant  <ccoutant@google.com>
6611
6612         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6613
6614 2010-08-13  Ian Lance Taylor  <iant@google.com>
6615
6616         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6617
6618 2010-08-12  Cary Coutant  <ccoutant@google.com>
6619             Doug Kwan  <dougkwan@google.com>
6620
6621         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6622         defintion overrides non-weak undef, remember that the original undef
6623         is not weak.
6624         * symtab.cc (Symbol_table::sized_write_global): For undef without
6625         an original weak binding, set binding to global in output.
6626         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6627         * testsuite/Makefile.in: Regenerate.
6628         * testsuite/strong_ref_weak_def.sh: New file.
6629         * testsuite/strong_ref_weak_def_1.c: Ditto.
6630         * testsuite/strong_ref_weak_def_2.c: Ditto.
6631
6632 2010-08-12  Cary Coutant  <ccoutant@google.com>
6633
6634         * testsuite/incremental_test.sh: Rewrite.
6635         * testsuite/incremental_test_1.c: Rewrite.
6636         * testsuite/incremental_test_2.c: Rewrite.
6637
6638 2010-08-12  Cary Coutant  <ccoutant@google.com>
6639
6640         * arm.cc (Target_arm::got_size): Add const.
6641         (Target_arm::got_entry_count): New function.
6642         (Target_arm::plt_entry_count): New function.
6643         (Target_arm::first_plt_entry_offset): New function.
6644         (Target_arm::plt_entry_size): New function.
6645         (Output_data_plt_arm::entry_count): New function.
6646         (Output_data_plt_arm::first_plt_entry_offset): New function.
6647         (Output_data_plt_arm::get_plt_entry_size): New function.
6648         * i386.cc (Target_i386::got_size): Add const.
6649         (Target_i386::got_entry_count): New function.
6650         (Target_i386::plt_entry_count): New function.
6651         (Target_i386::first_plt_entry_offset): New function.
6652         (Target_i386::plt_entry_size): New function.
6653         (Output_data_plt_i386::entry_count): New function.
6654         (Output_data_plt_i386::first_plt_entry_offset): New function.
6655         (Output_data_plt_i386::get_plt_entry_size): New function.
6656         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6657         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6658         * incremental.cc: Include target.h.
6659         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6660         parameter.  Adjust all callers.  Find incremental_got_plt section.
6661         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6662         section.
6663         (Output_section_incremental_inputs::set_final_data_size): Calculate
6664         size of incremental_got_plt section.
6665         (Output_section_incremental_inputs::do_write): Write the
6666         incremental_got_plt section.
6667         (Got_plt_view_info): New struct.
6668         (Local_got_offset_visitor): New class.
6669         (Global_got_offset_visitor): New class.
6670         (Global_symbol_visitor_got_plt): New class.
6671         (Output_section_incremental_inputs::write_got_plt): New function.
6672         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6673         Add parameter.  Adjust all callers.
6674         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6675         (Incremental_inputs::got_plt_section): New function.
6676         (Incremental_inputs::got_plt_section_): New data member.
6677         (Incremental_got_plt_reader): New class.
6678         * layout.cc (Layout::create_incremental_info_sections): Add the
6679         incremental_got_plt section.
6680         * object.h (Got_offset_list::get_list): New function.
6681         (Got offset_list::for_all_got_offsets): New function.
6682         (Sized_relobj::local_got_offset_list): New function.
6683         * powerpc.cc (Target_powerpc::got_size): Add const.
6684         (Target_powerpc::got_entry_count): New function.
6685         (Target_powerpc::plt_entry_count): New function.
6686         (Target_powerpc::first_plt_entry_offset): New function.
6687         (Target_powerpc::plt_entry_size): New function.
6688         (Output_data_plt_powerpc::entry_count): New function.
6689         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6690         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6691         * sparc.cc (Target_sparc::got_size): Add const.
6692         (Target_sparc::got_entry_count): New function.
6693         (Target_sparc::plt_entry_count): New function.
6694         (Target_sparc::first_plt_entry_offset): New function.
6695         (Target_sparc::plt_entry_size): New function.
6696         (Output_data_plt_sparc::entry_count): New function.
6697         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6698         (Output_data_plt_sparc::get_plt_entry_size): New function.
6699         * symtab.h (Symbol::got_offset_list): New function.
6700         (Symbol_table::for_all_symbols): New function.
6701         * target.h (Sized_target::got_entry_count): New function.
6702         (Sized_target::plt_entry_count): New function.
6703         (Sized_target::plt_entry_size): New function.
6704         * x86_64.cc (Target_x86_64::got_size): Add const.
6705         (Target_x86_64::got_entry_count): New function.
6706         (Target_x86_64::plt_entry_count): New function.
6707         (Target_x86_64::first_plt_entry_offset): New function.
6708         (Target_x86_64::plt_entry_size): New function.
6709         (Output_data_plt_x86_64::entry_count): New function.
6710         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6711         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6712
6713 2010-08-12  Cary Coutant  <ccoutant@google.com>
6714
6715         * archive.cc: Include incremental.h.
6716         (Archive::Archive): Initialize incremental_info_.
6717         (Archive::include_member): Record archive members in incremental info.
6718         (Add_archive_symbols::run): Record begin and end of an archive in
6719         incremental info.
6720         (Lib_group::include_member): Record objects in incremental info.
6721         * archive.h (Incremental_archive_entry): Forward declaration.
6722         (Archive::set_incremental_info): New member function.
6723         (Archive::incremental_info): New member function.
6724         (Archive::Unused_symbol_iterator): New class.
6725         (Archive::unused_symbols_begin): New member function.
6726         (Archive::unused_symbols_end): New member function.
6727         (Archive::incremental_info_): New data member.
6728         * incremental-dump.cc (find_input_containing_global): New function.
6729         (dump_incremental_inputs): Dump new incremental info sections.
6730         * incremental.cc: Include symtab.h.
6731         (Output_section_incremental_inputs): New class.
6732         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6733         new incremental info sections.
6734         (Sized_incremental_binary::do_check_inputs): Likewise.
6735         (Incremental_inputs::report_archive): Remove.
6736         (Incremental_inputs::report_archive_begin): New function.
6737         (Incremental_inputs::report_archive_end): New function.
6738         (Incremental_inputs::report_object): New function.
6739         (Incremental_inputs::finalize_inputs): Remove.
6740         (Incremental_inputs::report_input_section): New function.
6741         (Incremental_inputs::report_script): Rewrite.
6742         (Incremental_inputs::finalize): Do nothing but finalize string table.
6743         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6744         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6745         (Incremental_inputs::create_data_sections): New function.
6746         (Incremental_inputs::relocs_entsize): New function.
6747         (Output_section_incremental_inputs::set_final_data_size): New function.
6748         (Output_section_incremental_inputs::do_write): New function.
6749         (Output_section_incremental_inputs::write_header): New function.
6750         (Output_section_incremental_inputs::write_input_files): New function.
6751         (Output_section_incremental_inputs::write_info_blocks): New function.
6752         (Output_section_incremental_inputs::write_symtab): New function.
6753         * incremental.h (Incremental_script_entry): Forward declaration.
6754         (Incremental_object_entry): Forward declaration.
6755         (Incremental_archive_entry): Forward declaration.
6756         (Incremental_inputs): Forward declaration.
6757         (Incremental_inputs_header_data): Remove.
6758         (Incremental_inputs_header): Remove.
6759         (Incremental_inputs_header_write): Remove.
6760         (Incremental_inputs_entry_data): Remove.
6761         (Incremental_inputs_entry): Remove.
6762         (Incremental_inputs_entry_write): Remove.
6763         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6764         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6765         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6766         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6767         Likewise.
6768         (Incremental_input_entry): New class.
6769         (Incremental_script_entry): New class.
6770         (Incremental_object_entry): New class.
6771         (Incremental_archive_entry): New class.
6772         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6773         (Incremental_inputs::report_inputs): Remove.
6774         (Incremental_inputs::report_archive): Remove.
6775         (Incremental_inputs::report_archive_begin): New function.
6776         (Incremental_inputs::report_archive_end): New function.
6777         (Incremental_inputs::report_object): Change prototype.
6778         (Incremental_inputs::report_input_section): New function.
6779         (Incremental_inputs::report_script): Change prototype.
6780         (Incremental_inputs::get_reloc_count): New function.
6781         (Incremental_inputs::set_reloc_count): New function.
6782         (Incremental_inputs::create_data_sections): New function.
6783         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6784         (Incremental_inputs::inputs_section): New function.
6785         (Incremental_inputs::symtab_section): New function.
6786         (Incremental_inputs::relocs_section): New function.
6787         (Incremental_inputs::get_stringpool): Add const.
6788         (Incremental_inputs::command_line): Add const.
6789         (Incremental_inputs::inputs): Remove.
6790         (Incremental_inputs::command_line_key): New function.
6791         (Incremental_inputs::input_file_count): New function.
6792         (Incremental_inputs::input_files): New function.
6793         (Incremental_inputs::relocs_entsize): New function.
6794         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6795         (Incremental_inputs::finalize_inputs): Remove.
6796         (Incremental_inputs::Input_info): Remove.
6797         (Incremental_inputs::lock_): Remove.
6798         (Incremental_inputs::inputs_): Change type.
6799         (Incremental_inputs::inputs_map_): Remove.
6800         (Incremental_inputs::current_object_entry_): New data member.
6801         (Incremental_inputs::inputs_section_): New data member.
6802         (Incremental_inputs::symtab_section_): New data member.
6803         (Incremental_inputs::relocs_section_): New data member.
6804         (Incremental_inputs::reloc_count_): New data member.
6805         (Incremental_inputs_reader): New class.
6806         (Incremental_symtab_reader): New class.
6807         (Incremental_relocs_reader): New class.
6808         * layout.cc (Layout::finalize): Move finalization of incremental info
6809         and creation of incremental info sections to follow finalization of
6810         symbol table.  Set offsets for postprocessing sections.
6811         (Layout::create_incremental_info_sections): Call
6812         Incremental_inputs::create_data_sections.  Add incremental symtab
6813         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6814         sections to layout after input sections.
6815         * layout.h (struct Timespec): Forward declaration.
6816         (Layout::incremental_inputs): Add const.
6817         (Layout::create_incremental_info_sections): Add parameter.
6818         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6819         * object.cc: Include incremental.h.
6820         (Relobj::finalize_incremental_relocs): New function.
6821         (Sized_relobj::do_layout): Record input sections in incremental info.
6822         * object.h (Object::output_section): New function.
6823         (Object::output_section_offset): Moved from Relobj.
6824         (Object::get_incremental_reloc_base): New function.
6825         (Object::get_incremental_reloc_count): New function.
6826         (Object::do_output_section): New function.
6827         (Object::do_output_section_offset): Moved from Relobj.
6828         (Object::do_get_incremental_reloc_base): New function.
6829         (Object::do_get_incremental_reloc_count): New function.
6830         (Object::Object): Initialize new data members.
6831         (Relobj::output_section): Renamed do_output_section and moved to
6832         protected.
6833         (Relobj::output_section_offset): Moved to Object.
6834         (Relobj::do_get_incremental_reloc_base): New function.
6835         (Relobj::do_get_incremental_reloc_count): New function.
6836         (Relobj::allocate_incremental_reloc_counts): New function.
6837         (Relobj::count_incremental_reloc): New function.
6838         (Relobj::finalize_incremental_relocs): New function.
6839         (Relobj::next_incremental_reloc_index): New function.
6840         (Relobj::reloc_counts_): New data member.
6841         (Relobj::reloc_bases_): New data member.
6842         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6843         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6844         (Sized_relobj::incremental_relocs_scan): New function.
6845         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6846         (Sized_relobj::incremental_relocs_write): New function.
6847         (Sized_relobj::incremental_relocs_write_reltype): New function.
6848         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6849         incremental link.
6850         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6851         archives and object files elsewhere.
6852         (Add_symbols::run): Report object files here.
6853         (Finish_group::run): Report end of archive at end of group.
6854         * reloc.cc: Include layout.h, incremental.h.
6855         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6856         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6857         (Sized_relobj::incremental_relocs_scan): New function.
6858         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6859         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6860         (Sized_relobj::incremental_relocs_write): New function.
6861         (Sized_relobj::incremental_relocs_write_reltype): New function.
6862         * script.cc (read_input_script): Rewrite test for incremental link.
6863         Change call to Incremental_inputs::report_script.
6864         * symtab.h (Symbol_table::first_global_index): New function.
6865         (Symbol_table::output_count): New function.
6866
6867 2010-08-12  Doug Kwan  <dougkwan@google.com>
6868
6869         * arm.cc (Target_arm::merge_object_attributes): Check command line
6870         options --no-wchar-size-warning and --no-enum-size-warning.
6871         * options.h (General_options): Add ld-compatible options
6872         --no-enum-size-warning and --no-wchar-size-warning.
6873
6874 2010-08-04  Ian Lance Taylor  <iant@google.com>
6875
6876         * x86_64.cc (Target_x86_64::Scan::local): Use
6877         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6878         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6879         (Target_x86_64::Scan::global): Likewise.
6880         (Target_x86_64::Relocate::relocate): Likewise.
6881         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6882         Likewise.
6883
6884 2010-08-03  Cary Coutant  <ccoutant@google.com>
6885
6886         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6887         to reserve space in merged_strings vector. Keep total input size
6888         for stats.
6889         (Output_merge_string::do_print_merge_stats): Print total input size.
6890         * merge.h (Output_merge_string): Add input_size_ field.
6891         * stringpool.cc (Stringpool_template::string_length): Move
6892         implementations out of Stringpool_template class and place in
6893         stringpool.h.
6894         * stringpool.h (string_length): Move out of Stringpool_template.
6895
6896 2010-08-03  Ian Lance Taylor  <iant@google.com>
6897
6898         PR 11712
6899         * layout.cc (relaxation_loop_body): If address of load segment is
6900         set, adjust address to include headers if possible.
6901
6902 2010-08-03  Ian Lance Taylor  <iant@google.com>
6903
6904         * version.cc (version_string): Bump to 1.10.
6905
6906 2010-08-03  Ian Lance Taylor  <iant@google.com>
6907
6908         PR 11805
6909         * layout.h (enum Output_section_order): Define.
6910         (class Layout): Update declarations.
6911         * layout.cc (Layout::get_output_section): Add order parameter.
6912         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
6913         is_first_non_relro parameters.  Change all callers.
6914         (Layout::choose_output_section): Likewise.
6915         (Layout::add_output_section_data): Likewise.
6916         (Layout::make_output_section): Likewise.  Set order.
6917         (Layout::default_section_order): New function.
6918         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
6919         * output.cc (Output_section::Output_section): Initialize order_.
6920         Don't initialize deleted fields.
6921         (Output_segment::Output_segment): Don't initialize deleted
6922         fields.
6923         (Output_segment::add_output_section_to_load): New function
6924         replacing add_output_section.  Change all callers to call this or
6925         add_output_section_to_nonload.
6926         (Output_segment::add_output_section_to_nonload): New function.
6927         (Output_segment::remove_output_section): Rewrite.
6928         (Output_segment::add_initial_output_data): Likewise.
6929         (Output_segment::has_any_data_sections): Likewise.
6930         (Output_segment::is_first_section_relro): Likewise.
6931         (Output_segment::maximum_alignment): Likewise.
6932         (Output_segment::has_dynamic_reloc): New function replacing
6933         dynamic_reloc_count.  Change all callers.
6934         (Output_segment::has_dynamic_reloc_list): New function replacing
6935         dynamic_reloc_count_list.  Change all callers.
6936         (Output_segment::set_section_addresses): Rewrite.
6937         (Output_segment::set_offset): Rewrite.
6938         (Output_segment::find_first_and_last_list): Remove.
6939         (Output_segment::set_tls_offsets): Rewrite.
6940         (Output_segment::first_section_load_address): Likewise.
6941         (Output_segment::output_section_count): Likewise.
6942         (Output_segment::section_with_lowest_load_address): Likewise.
6943         (Output_segment::write_section_headers): Likewise.
6944         (Output_segment::print_sections_to_map): Likewise.
6945         * output.h (class Output_data): Remove dynamic_reloc_count_
6946         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
6947         (Output_data::add_dynamic_reloc): Rewrite.
6948         (Output_data::has_dynamic_reloc): New function.
6949         (Output_data::dynamic_reloc_count): Remove.
6950         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
6951         is_last_relro_, is_first_non_relro_, is_interp_,
6952         is_dynamic_linker_section_ fields.  Add order and set_order
6953         functions.  Remove is_relro_local, set_is_relro_local,
6954         is_last_relro, set_is_last_relro, is_first_non_relro,
6955         set_is_first_non_relro functions, is_interp, set_is_interp,
6956         is_dynamic_linker_section, and set_is_dynamic_linker_section
6957         functions.
6958         (class Output_segment): Change Output_data_list from std::list to
6959         std:;vector.  Add output_lists_ field.  Remove output_data_ and
6960         output_bss_ fields.  Update declarations.
6961
6962 2010-08-02  Ian Lance Taylor  <iant@google.com>
6963
6964         * arm.cc (Target_arm::gc_process_relocs): Use typename.
6965         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
6966         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
6967
6968 2010-08-02  Ian Lance Taylor  <iant@google.com>
6969
6970         PR 11855
6971         * script.cc (Script_options::Script_options): Initialize
6972         symbol_definitions_ and symbol_references_.
6973         (Script_options::add_symbol_assignment): Update
6974         symbol_definitions_ and symbol_references_.
6975         (Script_options::add_symbol_reference): New function.
6976         (script_symbol): New function.
6977         * script.h (class Script_options): Add symbol_definitions_ and
6978         symbol_references_ fields.
6979         (Script_options::referenced_const_iterator): New type.
6980         (Script_options::referenced_begin): New function.
6981         (Script_options::referenced_end): New function.
6982         (Script_options::is_referenced): New function.
6983         (Script_options::any_unreferenced): New function.
6984         * script-c.h (script_symbol): Declare.
6985         * yyscript.y (exp): Call script_symbol.
6986         * symtab.cc: Include "script.h".
6987         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
6988         Change all callers.  Check symbols referenced by scripts.
6989         (Symbol_table::add_undefined_symbols_from_command_line): Add
6990         layout parameter.  Change all callers.
6991         (Symbol_table::do_add_undefined_symbols_from_command_line):
6992         Likewise.  Break out loop body.  Check symbols referenced by
6993         scripts.
6994         (Symbol_table::add_undefined_symbol_from_command_line): New
6995         function broken out of
6996         do_add_undefined_symbols_from_command_line.
6997         * symtab.h (class Symbol_table): Update declarations.
6998         * archive.cc: Include "layout.h".
6999         (Archive::should_include_member): Add layout parameter.  Change
7000         all callers.  Check for symbol mentioned in expression.
7001         * archive.h (class Archive): Update declaration.
7002         * object.cc (Sized_relobj::do_should_include_member): Add layout
7003         parameter.
7004         * object.h (Object::should_include_member): Add layout parameter.
7005         Change all callers.
7006         (Object::do_should_include_member): Add layout parameter.
7007         (class Sized_relobj): Update declaration.
7008         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7009         parameter.
7010         * dynobj.h (class Sized_dynobj): Update declaration.
7011         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7012         layout parameter.
7013         * plugin.h (class Sized_pluginobj): Update declaration.
7014
7015 2010-08-02  Ian Lance Taylor  <iant@google.com>
7016
7017         PR 11866
7018         * output.cc (Output_segment::set_offset): Search for the first and
7019         last sections rather than assuming that the list is in order.
7020         (Output_segment::find_first_and_last_list): New function.
7021         * output.h (class Output_segment): Update declarations.
7022         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7023         (relro_strip_test_SOURCES): New variable.
7024         (relro_strip_test_DEPENDENCIES): New variable.
7025         (relro_strip_test_LDFLAGS): New variable.
7026         (relro_strip_test_LDADD): New variable.
7027         (relro_strip_test.so): New target.
7028
7029 2010-08-02  Ian Lance Taylor  <iant@google.com>
7030
7031         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7032         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7033         (Target_i386::got_tlsdesc_section): New function.
7034         (Target_i386::got_section): Create space for GOT entries for
7035         TLSDESC relocations.
7036         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7037         R_386_TLS_GOTDESC.
7038         (Target_i386::Scan::global): Likewise.
7039         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7040         using TLSDESC GOT.
7041         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7042         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7043         (Target_x86_64::got_tlsdesc_section): New function.
7044         (Target_x86_64::got_section): Create space for GOT entries for
7045         TLSDESC relocations.
7046         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7047         R_386_TLS_GOTDESC.
7048         (Target_x86_64::Scan::global): Likewise.
7049         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7050         using TLSDESC GOT.
7051
7052 2010-08-02  Ian Lance Taylor  <iant@google.com>
7053
7054         * testsuite/final_layout.sh: Use dc to convert from hex to
7055         decimal.
7056
7057 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7058
7059         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7060         paramter to the call to gold::gc_process_relocs.
7061         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7062         paramter to the call to gold::gc_process_relocs.
7063         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7064         parameter to the call to gold::gc_process_relocs.
7065         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7066         template parameter to the call to gold::gc_process_relocs.
7067         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7068         paramter to the call to gold::gc_process_relocs.
7069         * gc.h (get_embedded_addend_size): New function.
7070         (gc_process_relocs): Save the size of the reloc for use by ICF.
7071         * icf.cc (get_section_contents): Get the addend from the text section
7072         for SHT_REL relocation sections.
7073         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7074         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7075         * int_encoding.h (read_from_pointer): New overloaded function.
7076         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7077         * testsuite/icf_sht_rel_addend_test.sh: New file.
7078         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7079         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7080
7081 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7082
7083         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7084         * Makefile.in: Regenerate.
7085         * testsuite/Makefile.in: Regenerate.
7086
7087 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7088
7089         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7090         * gold/testsuite/debug_msg.cc: Likewise.
7091         * gold/testsuite/odr_violation1.cc
7092         * gold/testsuite/odr_violation2.cc
7093
7094 2010-07-21  Cary Coutant  <ccoutant@google.com>
7095
7096         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7097         string, and length fields.
7098         (Output_merge_string::Merged_strings_list): New type.
7099         (Output_merge_string::Merged_strings_lists): New typedef.
7100         (Output_merge_string): Replace merged_strings_ with
7101         merged_strings_lists_.
7102         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7103         Merged_strings_list per input object and section.  Don't store pointer
7104         to the string.  Don't store length with each merged string entry.
7105         (Output_merge_string::finalize_merged_data): Loop over list of merged
7106         strings lists.  Recompute length of each merged string.
7107
7108 2010-07-15  Cary Coutant  <ccoutant@google.com>
7109
7110         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7111         here.
7112
7113 2010-07-14  Ian Lance Taylor  <iant@google.com>
7114
7115         * descriptors.cc (Descriptors::open): Report correct name in error
7116         message.
7117
7118 2010-07-13  Doug Kwan  <dougkwan@google.com>
7119
7120         * arm.cc (Arm_input_section::Arm_input_section): For a
7121         SHT_ARM_EXIDX section, always keeps the input sections.
7122         (Arm_input_section::set_exidx_section_link): New method.
7123         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7124         has_errors_ to false.
7125         (Arm_exidx_input_section::has_errors,
7126         Arm_exidx_input_section::set_has_errors): New methods.
7127         (Arm_exidx_input_section::has_errors_): New data member.
7128         (Arm_relobj::get_exidx_shndx_list): New method.
7129         (Arm_output_section::append_text_sections_to_list): Do not skip
7130         section without SHF_EXECINSTR.
7131         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7132         errors.
7133         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7134         section header.  Make error messages more verbose.  Check for
7135         a non-executable section linked to an EXIDX section.
7136         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7137         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7138         check that there is no deferred EXIDX section if we exit early.
7139         Instead of not making an EXIDX section in case of an error, make one
7140         and set the has_errors flag of it.
7141         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7142         in a relocatable link.
7143         (Target_arm::do_relax): Look for the EXIDX output section instead of
7144         assuming that it is called .ARM.exidx.
7145         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7146         section list.  Do not check for SHF_EXECINSTR section flags but
7147         skip any input section with errors.
7148         * output.cc (Output_section::Output_section): Initialize
7149         always_keeps_input_sections_ to false.
7150         (Output_section::add_input_section): Check for
7151         always_keeps_input_sections_.
7152         *  output.h (Output_section::always_keeps_input_sections,
7153         Output_section::set_always_keeps_input_sections): New methods.
7154         (Output_section::always_keeps_input_sections): New data member.
7155
7156 2010-07-13  Rafael Espindola  <espindola@google.com>
7157
7158         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7159         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7160
7161 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7162             Ian Lance Taylor  <iant@google.com>
7163
7164         * output.h (Output_section_lookup_maps::add_merge_section):
7165         Correct check of whether value was inserted.
7166         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7167         (Output_section_lookup_maps::add_relaxed_input_section):
7168         Likewise.
7169         * arm.cc (Target_arm::got_section): Remove used local os.
7170         * i386.cc (Target_i386::got_section): Likewise.
7171         * x86_64.cc (Target_x86_64::got_section): Likewise.
7172         * sparc.cc (Target_sparc::got_section): Likewise.
7173         (Target_sparc::relocate): Remove unused local have_got_offset.
7174         * powerpc.cc (Target_powerpc::relocate): Likewise.
7175
7176 2010-07-13  Ian Lance Taylor  <iant@google.com>
7177
7178         * compressed_output.cc (zlib_decompress): Fix signature in
7179         !HAVE_ZLIB_H case.
7180
7181         * archive.cc (Archive::include_member): Unlock an external member
7182         of a thin archive.  Don't bother to delete an object we know is
7183         NULL.
7184
7185 2010-07-12  Cary Coutant  <ccoutant@google.com>
7186
7187         * compressed_output.cc (zlib_decompress): New function.
7188         (get_uncompressed_size): New function.
7189         (decompress_input_section): New function.
7190         * compressed_output.h (get_uncompressed_size): New function.
7191         (decompress_input_section): New function.
7192         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7193         Handle compressed debug sections.
7194         * layout.cc (is_compressed_debug_section): New function.
7195         (Layout::output_section_name): Map compressed section names to
7196         canonical names.
7197         * layout.h (is_compressed_debug_section): New function.
7198         (is_debug_info_section): Recognize compressed debug sections.
7199         * merge.cc: Include compressed_output.h.
7200         (Output_merge_data::do_add_input_section): Handle compressed
7201         debug sections.
7202         (Output_merge_string::do_add_input_section): Handle compressed
7203         debug sections.
7204         * object.cc: Include compressed_output.h.
7205         (Sized_relobj::Sized_relobj): Initialize new data members.
7206         (build_compressed_section_map): New function.
7207         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7208         * object.h (Object::section_is_compressed): New method.
7209         (Object::do_section_is_compressed): New method.
7210         (Sized_relobj::Compressed_section_map): New type.
7211         (Sized_relobj::do_section_is_compressed): New method.
7212         (Sized_relobj::compressed_sections_): New data member.
7213         * output.cc (Output_section::add_input_section): Handle compressed
7214         debug sections.
7215         * reloc.cc: Include compressed_output.h.
7216         (Sized_relobj::write_sections): Handle compressed debug sections.
7217
7218 2010-07-08  Cary Coutant  <ccoutant@google.com>
7219
7220         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7221         weak when resolving to a dynamic def.
7222         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7223         for weak undef/dynamic def cases. Adjust callers.
7224         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7225         undef_binding_weak_.
7226         (Symbol_table::sized_write_globals): Adjust symbol binding.
7227         (Symbol_table::sized_write_symbol): Add binding parameter.
7228         * symtab.h (Symbol::set_undef_binding): New method.
7229         (Symbol::is_undef_binding_weak): New method.
7230         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7231         (Symbol_table::should_override): Add new parameter.
7232         (Symbol_table::sized_write_symbol): Add new parameter.
7233
7234         * testsuite/weak_undef_file1.cc: Add new test case.
7235         * testsuite/weak_undef_file2.cc: Fix header comment.
7236         * testsuite/weak_undef_test.cc: Add new test case.
7237
7238 2010-06-29  Doug Kwan  <dougkwan@google.com>
7239
7240         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7241         Initialize USE_SYMBOL_.
7242         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7243         definition.
7244         (Arm_reloc_property::uses_symbol_): New data member declaration.
7245         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7246         uses symbol value and symbol is undefined but not weakly undefined.
7247
7248 2010-06-28  Rafael Espindola  <espindola@google.com>
7249
7250         * plugin.cc (Plugin::load): Use dlerror.
7251
7252 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7253
7254         * symtab.cc (detect_odr_violations): When reporting an ODR
7255         violation, report an object where the symbol is defined.
7256
7257 2010-06-25  Doug Kwan  <dougkwan@google.com>
7258
7259         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7260         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7261         definition.
7262         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7263         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7264         target hook to detect function points.
7265         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7266         * icf.h (Icf::check_section_for_function_pointers): Change type of
7267         parameter SECTION_NAME to const reference to std::string.  Use
7268         target hook to determine if section may have unsafe pointers.
7269         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7270         method definition.
7271
7272 2010-06-21  Rafael Espindola  <espindola@google.com>
7273
7274         * fileread.cc (Input_file::find_fie): New
7275         (Input_file::open): Use Input_file::find_fie.
7276         * fileread.h (Input_file::find_fie): New
7277         * plugin.cc (set_extra_library_path): New.
7278         (Plugin::load): Add set_extra_library_path to the transfer vector.
7279         (Plugin_manager::set_extra_library_path): New.
7280         (Plugin_manager::add_input_file): Use the extra search path if set.
7281         (set_extra_library_path(): New.
7282         * plugin.h (Plugin_manager): Add set_extra_library_path and
7283         extra_search_path_.
7284
7285 2010-06-19  Cary Coutant  <ccoutant@google.com>
7286
7287         * layout.cc (gdb_sections): Add .debug_types.
7288         (lines_only_debug_sections): Likewise.
7289
7290 2010-06-18  Rafael Espindola  <espindola@google.com>
7291
7292         * plugin.cc (add_input_file,add_input_library)
7293         (Plugin_manager::add_input_file): Make filename arguments const.
7294         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7295         const.
7296
7297 2010-06-16  Doug Kwan  <dougkwan@google.com>
7298
7299         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7300         .ARM.attributes section if we have not merged any input
7301         attributes sections.
7302
7303 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7304
7305         * arm.cc: Allow combining objects with no EABI version
7306         information.
7307
7308 2010-06-15  Rafael Espindola  <espindola@google.com>
7309
7310         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7311
7312 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7313
7314         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7315         (struct iovec): Correct !HAVE_READV definition.
7316
7317 2010-06-10  Cary Coutant  <ccoutant@google.com>
7318
7319         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7320         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7321         reloc sections.
7322         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7323
7324         PR 11683
7325         * symtab.h (Symbol::is_placeholder): New member function.
7326         * target-reloc.h (relocate_section): Check for placeholder symbols.
7327
7328         * testsuite/Makefile.am (plugin_test_8): New test.
7329         (plugin_test_9): New test.
7330         * testsuite/Makefile.in: Regenerate.
7331
7332 2010-06-09  Nick Clifton  <nickc@redhat.com>
7333
7334         * yyscript.y (input_list_element): Allow strings prefixed with
7335         the '-' character.  Treat these as libraries.
7336         * script.cc (script_add_library): New function.  Adds a library
7337         specified by "-l<name>" found in an input script.
7338         * script-c.h: Add prototype for script_add_library.
7339
7340 2010-06-07  Doug Kwan  <dougkwan@google.com>
7341
7342         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7343         Restrict stub-group size to be within long conditional branch
7344         range when working around cortex-A8 erratum.
7345
7346 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7347
7348         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7349         #ifdef typo.
7350
7351 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7352
7353         PR gold/11658
7354         * output.cc
7355         (Output_section::Input_section_sort_entry::compare_section_ordering):
7356         Change to return non-zero correctly.
7357         (Output_section::Input_section_sort_section_order_index_compare
7358         ::operator()): Change to fix ambiguity in comparisons.
7359
7360 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7361
7362         * gold.h (is_wildcard_string): New function.
7363         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7364         (Layout::layout_eh_frame): Ditto.
7365         (Layout::find_section_order_index): New method.
7366         (Layout::read_layout_from_file): New method.
7367         * layout.h (Layout::find_section_order_index): New method.
7368         (Layout::read_layout_from_file): New method.
7369         (Layout::input_section_position_): New private member.
7370         (Layout::input_section_glob_): New private member.
7371         * main.cc (main): Call read_layout_from_file here.
7372         * options.h (--section-ordering-file): New option.
7373         * output.cc (Output_section::input_section_order_specified_): New
7374         member.
7375         (Output_section::Output_section): Initialize new member.
7376         (Output_section::add_input_section): Add new parameter.
7377         Keep input sections when --section-ordering-file is used.
7378         (Output_section::set_final_data_size): Sort input sections when
7379         section ordering file is specified.
7380         (Output_section::Input_section_sort_entry): Add new parameter.
7381         Check sorting type.
7382         (Output_section::Input_section_sort_entry::compare_section_ordering):
7383         New method.
7384         (Output_section::Input_section_sort_compare::operator()): Change to
7385         consider section_order_index.
7386         (Output_section::Input_section_sort_init_fini_compare::operator()):
7387         Change to consider section_order_index.
7388         (Output_section::Input_section_sort_section_order_index_compare
7389         ::operator()): New method.
7390         (Output_section::sort_attached_input_sections): Change to sort
7391         according to section order when specified.
7392         (Output_section::add_input_section<32, true>): Add new parameter.
7393         (Output_section::add_input_section<64, true>): Add new parameter.
7394         (Output_section::add_input_section<32, false>): Add new parameter.
7395         (Output_section::add_input_section<64, false>): Add new parameter.
7396         * output.h (Output_section::add_input_section): Add new parameter.
7397         (Output_section::input_section_order_specified): New
7398         method.
7399         (Output_section::set_input_section_order_specified): New method.
7400         (Input_section::Input_section): Initialize section_order_index_.
7401         (Input_section::section_order_index): New method.
7402         (Input_section::set_section_order_index): New method.
7403         (Input_section::section_order_index_): New member.
7404         (Input_section::Input_section_sort_section_order_index_compare): New
7405         struct.
7406         (Output_section::input_section_order_specified_): New member.
7407         * script-sections.cc (is_wildcard_string): Delete and move modified
7408         method to gold.h.
7409         (Output_section_element_input::Output_section_element_input): Modify
7410         call to is_wildcard_string.
7411         (Output_section_element_input::Input_section_pattern
7412         ::Input_section_pattern): Ditto.
7413         (Output_section_element_input::Output_section_element_input): Ditto.
7414         * testsuite/Makefile.am (final_layout): New test case.
7415         * testsuite/Makefile.in: Regenerate.
7416         * testsuite/final_layout.cc: New file.
7417         * testsuite/final_layout.sh: New file.
7418
7419 2010-06-01  Rafael Espindola  <espindola@google.com>
7420
7421         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7422
7423 2010-06-01  Rafael Espindola  <espindola@google.com>
7424
7425         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7426         visibility of symbols.
7427
7428 2010-05-27  Doug Kwan  <dougkwan@google.com>
7429
7430         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7431         from start of output section instead of address for a local symbol
7432         in a merged or relaxed section when doing a relocatable link.
7433
7434 2010-05-26  Rafael Espindola  <espindola@google.com>
7435
7436         PR 11604
7437         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7438         adding sections the garbage collector removed.
7439         * gold/testsuite/Makefile.am: Add test.
7440         * gold/testsuite/Makefile.in: Regenerate.
7441         * gold/testsuite/plugin_test_7.sh: New.
7442         * gold/testsuite/plugin_test_7_1.c: New.
7443         * gold/testsuite/plugin_test_7_2.c: New.
7444
7445 2010-05-26  Rafael Espindola  <espindola@google.com>
7446
7447         * script-sections.cc (Output_section_definition::set_section_addresses):
7448         Check for --section-start.
7449
7450 2010-05-26  Doug Kwan  <dougkwan@google.com>
7451
7452         * arm.cc (Arm_scan_relocatable_relocs): New class.
7453         (Target_arm::relocate_special_relocatable): New method.
7454         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7455         (Arm_relocate_functions::thumb_branch_common): Same.
7456         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7457         instead of Default_scan_relocatable_relocs.
7458         * target-reloc.h (relocate_for_relocatable): Let target handle
7459         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7460         * target.h (Sized_target::relocate_special_relocatable): New method.
7461
7462 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7463
7464         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7465
7466 2010-05-23  Doug Kwan  <dougkwan@google.com>
7467
7468         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7469         instead of a cast.
7470         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7471         with a direct branch, not a conditional branch, to a stub.
7472         * merge.cc (Output_merge_base::record_input_section): New method
7473         defintion.
7474         (Output_merge_data::do_add_input_section): Record input section if
7475         keeps-input-sections flag is set.
7476         (Output_merge_string::do_add_input_section): Ditto.
7477         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7478         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7479         INPUT_SECTIONS_.
7480         (Output_merge_base::keeps_input_sections,
7481         Output_merge_base::set_keeps_input_sections,
7482         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7483         method definitions.
7484         (Output_merge_base::Input_sections): New type declaration.
7485         (Output_merge_base::input_sections_begin,
7486         Output_merge_base::input_sections_end,
7487         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7488         (Output_merge_base::bool keeps_input_sections_,
7489         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7490         Output_merge_base::input_sections_): New data members.
7491         (Output_merge_data::do_set_keeps_input_sections): New method
7492         defintion.
7493         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7494         * output.cc (Output_section::Input_section::relobj): Move method
7495         defintion from class declaration to here and handle merge sections.
7496         (Output_section::Input_section::shndx): Ditto.
7497         (Output_section::Output_section): Remove initializations of removed
7498         data members and initialize new data member LOOKUP_MAPS_.
7499         (Output_section::add_input_section): Set keeps-input-sections flag
7500         for a newly created merge output section as appropriate.  Adjust code
7501         to use Output_section_lookup_maps class.
7502         (Output_section::add_relaxed_input_section): Adjst code for lookup
7503         maps code refactoring.
7504         (Output_section::add_merge_input_section): Add a new parameter
7505         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7506         class.  If adding input section to a newly created merge output
7507         section fails, remove the new merge section.
7508         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7509         Adjust code for use of the Output_section_lookup_maps class.
7510         (Output_section::find_merge_section): Ditto.
7511         (Output_section::build_lookup_maps): New method defintion.
7512         (Output_section::find_relaxed_input_section): Adjust code to use
7513         Output_section_lookup_maps class.
7514         (Output_section::get_input_sections): Export merge sections.  Adjust
7515         code to use Output_section_lookup_maps class.
7516         (Output_section:::add_script_input_section): Adjust code to use
7517         Output_section_lookup_maps class.  Update lookup maps for merge
7518         sections also.
7519         (Output_section::discard_states): Use Output_section_lookup_maps.
7520         (Output_section::restore_states): Same.
7521         * output.h (Merge_section_properties): Move class defintion out of
7522         Output_section.
7523         (Output_section_lookup_maps): New class.
7524         (Output_section::Input_section::is_merge_section): New method
7525         defintion.
7526         (Output_section::Input_section::relobj): Move defintion out of class
7527         defintion.  Declare method only.
7528         (Output_section::Input_section::shndx): Ditto.
7529         (Output_section::Input_section::output_merge_base): New method defintion.
7530         (Output_section::Input_section::u2_.pomb): New union field.
7531         (Output_section::Merge_section_by_properties_map,
7532         Output_section::Output_section_data_by_input_section_map,
7533         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7534         Remove types.
7535         (Output_section::add_merge_input_section): Add new parameter
7536         KEEPS_INPUT_SECTIONS.
7537         (Output_section::build_lookup_maps): New method declaration.
7538         (Output_section::merge_section_map_,
7539         Output_section::merge_section_by_properties_map_,
7540         Output_section::relaxed_input_section_map_,
7541         Output_section::is_relaxed_input_section_map_valid_): Remove data
7542         members.
7543         (Output_section::lookup_maps_): New data member.
7544
7545 2010-05-21  Doug Kwan  <dougkwan@google.com>
7546
7547         PR gold/11619
7548         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7549         avoid a compilation error.
7550
7551 2010-05-19  Rafael Espindola  <espindola@google.com>
7552
7553         * script-sections.cc (Output_section_definition::allocate_to_segment):
7554         Update the phdrs_list even when the output section is NULL.
7555         * testsuite/Makefile.am: Add test.
7556         * testsuite/Makefile.in: Regenerate.
7557         * testsuite/script_test_9.cc: New.
7558         * testsuite/script_test_9.sh: New.
7559         * testsuite/script_test_9.t: New.
7560
7561 2010-05-19  Doug Kwan  <dougkwan@google.com>
7562
7563         * arm.cc (Arm_input_section::original_size): New method.
7564         (Arm_input_section::do_addralign): Add a cast.
7565         (Arm_input_section::do_output_offset): Remove static cast.
7566         (Arm_input_section::original_addralign,
7567          Arm_input_section::original_size_): Change type to uint32_t.
7568         (Arm_input_section::init): Add safe casts for section alignment
7569         and size.
7570         (Arm_input_section::set_final_data_size): Do not set address and
7571         offset of stub table.
7572         (Arm_output_section::fix_exidx_coverage): Change use of of
7573         Output_section::Simple_input_section to that of
7574         Output_section::Input_section.
7575         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7576         except for the first pass.
7577         * output.cc (Output_section::get_input_sections): Change type of
7578         input_sections to std::list<Input_section>.
7579         (Output_section::add_script_input_section): Rename from
7580         Output_section::add_simple_input_section.  Change type of SIS
7581         parameter from Simple_input_section to Input_section.
7582         * output.h (Output_section::Simple_input_section): Remove class.
7583         (Output_section::Input_section): Change class visibility to public.
7584         (Output_section::Input_section::addralign): Use stored alignments
7585         for special input sections if set.
7586         (Output_section::Input_section::set_addralign): New method.
7587         (Output_section::get_input_sections): Change parameter type from
7588         list of Simple_input_section to list of Input_section.
7589         (Output_section::add_script_input_section): Rename from
7590         Output_section::add_simple_input_section. Change first parameter's
7591         type from Simple_input_section to Input_section and remove the
7592         second and third parameters.
7593         * script-sections.cc (Input_section::Input_section_list): Change
7594         type to list of Output_section::Input_section/
7595         (Input_section_info::Input_section_info): Change parameter type of
7596         INPUT_SECTION to Output_section::Input_section.
7597         (Input_section_info::input_section): Change return type.
7598         (Input_section_info::input_section_): Change type to
7599         Output_section::Input_section.
7600         (Output_section_element_input::set_section_addresses): Adjust code
7601         to use Output_section::Input_section instead of
7602         Output_section::Simple_input_section.  Adjust code for renaming
7603         of Output_section::add_simple_input_section.
7604         (Orphan_output_section::set_section_addresses): Ditto.
7605
7606 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7607
7608         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7609         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7610
7611 2010-05-18  Rafael Espindola  <espindola@google.com>
7612
7613         * options.cc (General_options::finalize): Handle -nostdlib.
7614         * options.h (nostdlib): New option.
7615         * script.cc (script_add_search_dir): Handle -nostdlib.
7616
7617 2010-05-12  Doug Kwan  <dougkwan@google.com>
7618
7619         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7620         attributes section only if there no attributes section after merging.
7621         (Target_arm::merge_object_attributes): Move value of
7622         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7623         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7624         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7625         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7626         and arm_attr_merge_7.stdout.
7627         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7628         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7629         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7630         arm_attr_merge_7b.o): New rules.
7631         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7632         arm_attr_merge_7
7633         * testsuite/Makefile.in: Regenerate.
7634         * testsuite/arm_attr_merge.sh: New file.
7635         * testsuite/arm_attr_merge_[67][ab].s: Same.
7636
7637 2010-05-05  Nick Clifton  <nickc@redhat.com>
7638
7639         * po/es.po: Updated Spanish translation.
7640
7641 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7642
7643         * Makefile.am (install-exec-local): Properly install gold as
7644         default cross linker.
7645         * Makefile.in: Regenerated.
7646
7647 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7648             Nick Clifton  <nickc@redhat.com>
7649
7650         * configure.ac (install_as_default): Define and set to false
7651         unless --enable-gold or --enable-gold=both/gold has been
7652         specified.
7653         * configure: Regenerate.
7654
7655         * Makefile.am (install-exec-local): Install the executable as
7656         'ld.gold'.  If install_as_default is true then also install it as
7657         'ld'.
7658         * Makefile.in: Regenerated.
7659
7660 2010-04-24  Ian Lance Taylor  <iant@google.com>
7661
7662         * layout.cc (Layout::layout_reloc): In relocatable link don't
7663         combine reloc sections for grouped sections.
7664
7665 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7666
7667         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7668         sections that are not ordinary to icf.
7669         * icf.cc (get_section_contents): Handle relocation pointing to section
7670         with no object or shndx information.
7671         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7672         * testsuite/Makefile.in: Regenerate.
7673         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7674         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7675
7676 2010-04-22  Ian Lance Taylor  <iant@google.com>
7677
7678         * expression.cc (Expression::Expression_eval_info): Add
7679         result_alignment_pointer field.
7680         (Expression::eval_with_dot): Add result_alignment_pointer
7681         parameter.  Change all callers.
7682         (Expression::eval_maybe_dot): Likewise.
7683         (class Binary_expression): Add alignment_pointer parameter to
7684         left_value and right_value.  Change all callers.
7685         (BINARY_EXPRESSION): Set result alignment.
7686         (class Trinary_expression): Add alignment_pointer parameter to
7687         arg2_value and arg3_value.  Change all callers.
7688         (Trinary_cond::value): Set result alignment.
7689         (Max_expression::value, Min_expression::value): Likewise.
7690         (Align_expression::value): Likewise.
7691         * script-sections.cc (class Sections_element): Add dot_alignment
7692         parameter to set_section_addresses virtual function.  Update
7693         instantiations.
7694         (class Output_section_element): Likewise.
7695         (Script_sections::create_segments): Add dot_alignment parameter.
7696         Change all callers.
7697         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7698         (Script_sections::set_phdrs_clause_addresses): Likewise.
7699         * script-sections.h: Update declarations.
7700         * script.h: Update declarations.
7701         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7702         min_p_align.
7703         * testsuite/script_test_3.t: Set large alignment.
7704         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7705         segment has expected alignment.
7706
7707 2010-04-22  Nick Clifton  <nickc@redhat.com>
7708
7709         * po/gold.pot: Updated by the Translation project.
7710         * po/vi.po: Updated Vietnamese translation.
7711
7712 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7713
7714         * testsuite/Makefile.am (check_PROGRAMS): Add
7715         icf_virtual_function_folding_test.
7716         * testsuite/Makefile.in: Regenerated.
7717
7718 2010-04-15  Andrew Haley  <aph@redhat.com>
7719
7720         * options.h (merge_exidx_entries): New option.
7721         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7722         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7723         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7724         (Target_arm::merge_exidx_entries): New function.
7725         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7726         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7727         to Arm_exidx_fixup constructor.
7728         Add new arg, merge_exidx_entries.
7729         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7730         Arm_output_section::fix_exidx_coverage.
7731
7732 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7733
7734         * icf.cc (get_section_contents): Check for preemptible functions.
7735         Ignore addend when appropriate.
7736         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7737         section folded.
7738         (add_from_relobj): Check for section folded.
7739         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7740         * symtab.h (should_add_dynsym_entry): Add new parameter.
7741         * target-reloc.h (scan_relocs): Check for section folded.
7742         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7743         Check reloc types for function pointers in shared objects.
7744         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7745         case.
7746         (icf_preemptible_functions_test): New test case.
7747         (icf_string_merge_test): New test case.
7748         * testsuite.Makefile.in: Regenerate.
7749         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7750         bar_glob.  Refactor code.
7751         * testsuite/icf_preemptible_functions_test.cc: New file.
7752         * testsuite/icf_preemptible_functions_test.sh: New file.
7753         * testsuite/icf_string_merge_test.cc: New file.
7754         * testsuite/icf_string_merge_test.sh: New file.
7755         * testsuite/icf_virtual_function_folding_test.cc: New file.
7756         * testsuite/icf_virtual_function_folding_test.sh: New file.
7757
7758 2010-04-14  Doug Kwan  <dougkwan@google.com>
7759
7760         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7761         for local symbol recounting if we remove a section due to ICF.
7762         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7763         there are no regular objects in input.
7764
7765 2010-04-13  Doug Kwan  <dougkwan@google.com>
7766
7767         * arm.cc (Arm_input_section::set_final_data_size): Compute
7768         accurate final data size instead of using current data size.
7769
7770 2010-04-09  Doug Kwan  <dougkwan@google.com>
7771
7772         * layout.cc (Layout::choose_output_section): Handle script section
7773         types.
7774         (Layout::make_output_section_for_script): Add section type parameter.
7775         Handle script section types.
7776         * layout.h (Layout::make_output_section_for_script): Add section
7777         type parameter.
7778         * output.cc (Output_section::Output_section): Initialize data member
7779         is_noload_.
7780         (Output_section::do_reset_address_and_file_offset): Do not set address
7781         to 0 if section is a NOLOAD section.
7782         * output.h (Output_section::is_noload): New method.
7783         (Output_section::set_is_noload): Ditto.
7784         (Output_section::is_noload_): New data member.
7785         * script-c.h (Script_section_type): New enum type.
7786         (struct Parser_output_section_header): Add new file section_type.
7787         * script-sections.cc (Sections_element::output_section_name): Add
7788         parameter for returning script section type.
7789         (Output_section_definition::output_section_name): Ditto.
7790         (Output_section_definition::section_type)P; New method.
7791         (Output_section_definiton::script_section_type_name): Ditto.
7792         (Output_section_definition::script_section_type_): New data member.
7793         (Output_section_definition::Output_section_definition): Initialize
7794         data member Output_section_definition::script_section_type_.
7795         (Output_section_definition::create_sections): Pass script section type
7796         to Layout::make_output_section_for_script.
7797         (Output_section_definition::output_section_name): Return script
7798         section type to caller.
7799         (Output_section_definition::set_section_address): Do not advance
7800         dot value and load address if section type is NOLOAD.  Set address
7801         of NOLOAD sections regardless of section flags.
7802         (Output_section_definition::print): Print section type if it is
7803         not SCRIPT_SECTION_TYPE_NONE.
7804         (Output_section_definition::section_type): New method.
7805         (Output_section_definition::script_section_type_name): Ditto.
7806         (Script_sections::output_section_name): Add new parameter
7807         PSECTION_TYPE for returning script section type.  Pass it to
7808         section elements.  Handle discard sections.
7809         (Sort_output_sections::operator()): Handle NOLOAD sections.
7810         * script-sections.h (Script_sections::Section_type): New enum type.
7811         (Script_sections::output_section_name): Add a new parameter for
7812         returning script section type.
7813         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7814         INFO and NOLOAD.
7815         * yyscript.y (union): Add new field SECTION_TYPE.
7816         (COPY, DSECT, INFO, NOLOAD): New tokens.
7817         (opt_address_and_section_type): Change type to output_section_header.
7818         (section_type): New non-terminal
7819         (section_header): Handle section type.
7820         (opt_address_and_section_type): Return section type value.
7821
7822 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7823
7824         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7825         * testsuite/plugin_common_test_2.c (foo): Likewise.
7826
7827 2010-04-08  Doug Kwan  <dougkwan@google.com>
7828
7829         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7830         Output_merge_data.
7831         * output.cc (Output_section::add_merge_input_section): Simplify
7832         code and return status of Output_merge_base::add_input_section.
7833         Update merge section map only if Output_merge_base::add_input_section
7834         returns true.
7835
7836 2010-04-07  Doug Kwan  <dougkwan@google.com>
7837
7838         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7839         if section is marked as containing instructions but has no mapping
7840         symbols.
7841         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7842         correct section index.
7843         (Arm_relobj::find_linked_text_section): Ditto.
7844
7845 2010-04-07  Cary Coutant  <ccoutant@google.com>
7846
7847         * archive.cc (include_member): Destroy Read_symbols_data object before
7848         releasing file.
7849         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7850         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7851         (Read_symbols_data::~Read_symbols_data) New destructor.
7852         (Section_relocs::Section_relocs) New constructor.
7853         (Section_relocs::~Section_relocs) New destructor.
7854         (Read_relocs_data::Read_relocs_data) New constructor.
7855         (Read_relocs_data::~Read_relocs_data) New destructor.
7856         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7857         pointers to NULL after deleting.
7858
7859 2010-04-07  Doug Kwan  <dougkwan@google.com>
7860
7861         * arm.cc: Replace "endianity" with "endianness" in comments.
7862         (Arm_exidx_cantunwind): Ditto.
7863         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7864         (Arm_relobj::merge_flags_and_attributes): New method.
7865         (Arm_relobj::merge_flags_and_attributes_): New data member.
7866         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7867         (Arm_relobj::scan_sections_for_stubs): Ditto.
7868         (Arm_relobj::do_read_symbols): Check to see if we really want to
7869         merge processor-specific flags and attributes.  Exit early if
7870         an object is empty except for section names and the undefined symbol.
7871         (Target_arm::do_finalize_sections): Move check for ELF format to
7872         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7873         attributes from a regular object only when we have determined that
7874         it is aapropriate.  Do not create an .ARM.attributes section in
7875         output if there is no regular input object.
7876         (Target_arm::merge_processor_specific_flags): Check
7877         --warn-mismatch before printing any error.
7878         (Target_arm::merge_object_attributes): Ditto.
7879         * gold.cc (queue_middle_tasks): Handle the case in which there is
7880         no regular object in input.
7881         * options.cc (General_options::parse_EB): New method.
7882         (General_options::parse_EL): Same.
7883         (General_options::General_options): Initialize endianness_.
7884         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7885         New options.
7886         (General_options::Endianness): New enum.
7887         (General_options::endianness): New method.
7888         (General_options::endianness_): New data member.
7889         * parameters.cc (Parameters::set_options): Check target endianness.
7890         (Parameters::set_target_once): Ditto.
7891         (Parameters::check_target_endianness): New method.
7892         (parameters_force_valid_target): If either -EL or -EB is specified,
7893         use it to define endianness of default target.
7894         * parameters.h (Parameters::check_target_endianness): New method
7895         declaration.
7896         * target.h (class Target): Change "endianity" to "endianness"
7897         in comments.
7898
7899 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7900
7901         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
7902         * configure: Regenerate.
7903         * Makefile.in: Regenerate.
7904         * testsuite/Makefile.in: Regenerate.
7905
7906 2010-04-06  Cary Coutant  <ccoutant@google.com>
7907
7908         gcc PR lto/42757
7909         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
7910         prevailing definitions of common symbols.
7911         * testsuite/plugin_test_6.sh: New test case.
7912         * testsuite/plugin_common_test_1.c: New test case.
7913         * testsuite/plugin_common_test_2.c: New test case.
7914         * testsuite/Makefile.am (plugin_test_6): New test case.
7915         * testsuite/Makefile.in: Regenerate.
7916
7917 2010-04-06  Nick Clifton  <nickc@redhat.com>
7918
7919         * po/vi.po: New Vietnamese translation.
7920
7921 2010-03-30  Doug Kwan  <dougkwan@google.com>
7922
7923         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
7924
7925 2010-03-25  Doug Kwan  <dougkwan@google.com>
7926
7927         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
7928         to avoid a conversion warning on a 32-bit host.
7929
7930 2010-03-24  Ian Lance Taylor  <iant@google.com>
7931
7932         * testsuite/script_test_3.t: Add a TLS segment.
7933         * testsuite/Makefile.am (check_PROGRAMS): Add
7934         tls_phdrs_script_test.
7935         (tls_phdrs_script_test_SOURCES): Define.
7936         (tls_phdrs_script_test_DEPENDENCIES): Define.
7937         (tls_phdrs_script_test_LDFLAGS): Define.
7938         (tls_phdrs_script_test_LDADD): Define.
7939         * testsuite/Makefile.in: Rebuild.
7940
7941 2010-03-23  Cary Coutant  <ccoutant@google.com>
7942
7943         * fileread.cc (find_or_make_view): Fix comment.
7944
7945 2010-03-23  Ian Lance Taylor  <iant@google.com>
7946
7947         * script-sections.cc (class Orphan_section_placement): Define
7948         PLACE_TLS and PLACE_TLS_BSS.
7949         (Orphan_section_placement::Orphan_section_placement): Initialize
7950         new places.
7951         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
7952         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
7953         (tls_script_test_SOURCES): Define.
7954         (tls_script_test_DEPENDENCIES): Define.
7955         (tls_script_test_LDFLAGS): Define.
7956         (tls_script_test_LDADD): Define.
7957         * testsuite/Makefile.in: Rebuild.
7958
7959 2010-03-22  Doug Kwan  <dougkwan@google.com>
7960
7961         * arm.cc (Arm_relocate_functions::abs8,
7962         Arm_relocate_functions::abs16): Use correct check for overflow
7963         specified in the ARM ELF specs.
7964         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
7965         target of a BLX instruction specially.
7966         (Reloc_stub::stub_type_for_reloc): Ditto.
7967         (Relocate::relocate): Use symbolic names instead of numeric relocation
7968         codes to report error.
7969         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
7970         workaround.
7971         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
7972         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
7973         thumb2_blx_out_of_range.stdout
7974         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
7975         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
7976         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
7977         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
7978         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
7979         thumb2_blx_in_range, thumb2_blx_in_range.o,
7980         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
7981         thumb2_blx_out_of_range.o): New rules.
7982         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
7983         thumb2_blx_in_range and thumb2_blx_out_of_range.
7984         * testsuite/Makefile.in: Regenerate.
7985         * arm_branch_in_range.sh: Add tests for THUMB BLX.
7986         * testsuite/thumb_blx_in_range.s: New file.
7987         * testsuite/thumb_blx_out_of_range.s: New file.
7988
7989 2010-03-22  Rafael Espindola  <espindola@google.com>
7990
7991         * archive.cc (Should_include): Move to archive.h.
7992         (should_include_member): Make it a member of Archive.
7993         (Lib_group): New.
7994         (Add_lib_group_symbols): New.
7995         * archive.h: Include options.h.
7996         (Archive_member): Moved from Archive.
7997         (Should_include): Moved from archive.cc.
7998         (Lib_group): New.
7999         (Add_lib_group_symbols): New.
8000         * dynobj.cc (do_should_include_member): New.
8001         * dynobj.h (do_should_include_member): New.
8002         * gold.cc (queue_initial_tasks): Update call to queue.
8003         * main.cc (main): Print lib group stats.
8004         * object.cc (do_should_include_member): New.
8005         * object.h: Include archive.h.
8006         (Object::should_include_member): New.
8007         (Object::do_should_include_member): New.
8008         (Sized_relobj::do_should_include_member): New.
8009         * options.cc (General_options::parse_start_lib): New.
8010         (General_options::parse_end_lib): New.
8011         (Input_arguments::add_file): Handle lib groups.
8012         (Input_arguments::start_group): Check we are not in a lib.
8013         (Input_arguments::start_lib): New.
8014         (Input_arguments::end_lib): New.
8015         * options.h (General_options): Add start_lib and end_lib.
8016         (Input_argument::lib_): New.
8017         (Input_argument::lib): New.
8018         (Input_argument::is_lib): New.
8019         (Input_file_lib): New.
8020         (Input_arguments::in_lib_): New.
8021         (Input_arguments::in_lib): New.
8022         (Input_arguments::start_lib): New.
8023         (Input_arguments::end_lib_): New.
8024         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8025         in unused members as preempted.
8026         (Sized_pluginobj::do_should_include_member): New.
8027         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8028         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8029         return the blocker.
8030         (Read_symbols::do_whole_lib_group): New.
8031         (Read_symbols::do_lib_group): New.
8032         (Read_symbols::do_read_symbols): Handle lib groups.
8033         (Read_symbols::get_name): Handle lib groups.
8034         * readsyms.h (Read_symbols): Add an archive member pointer.
8035         (Read_symbols::do_whole_lib_group): New.
8036         (Read_symbols::do_lib_group): New.
8037         (Read_symbols::member_): New.
8038         * script.cc (read_input_script): Update call to queue_soon.
8039
8040 2010-03-19  Doug Kwan  <dougkwan@google.com>
8041
8042         * arm.cc (Stub_table::Stub_table): Initialize new data members
8043         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8044         (Stub_table::add_reloc_stub): Assign stub offset and update
8045         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8046         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8047         New data members.
8048         (Stub_table::update_data_size_and_addralign): Use
8049         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8050         instead of going over all reloc stubs.
8051         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8052         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8053         Stringpool_template::offset_ to size of Stringpool_char.
8054         (Stringpool_template::new_key_offset): Remove code to initialize
8055         Stringpool_template::offset_.
8056         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8057         Stringpool_template::offset_ to zero.
8058
8059 2010-03-15  Doug Kwan  <dougkwan@google.com>
8060
8061         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8062         offset_.
8063         (Stringpool_template::new_key_offset): New method.
8064         (Stringpool_template::add_string): Assign offsets when adding new
8065         strings.
8066         (Stringpool_template::set_string_offsets): Do not set string offsets
8067         when not optimizing.
8068         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8069         member size_.
8070         (Chunked_vector::clear): Clear size_.
8071         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8072         (Chunked_vector::size): Return size_.
8073         (Chunked_vector::push_back): Use size_ to find insert position.
8074         (Chunked_vector::size_): New data member.
8075         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8076         (Stringpool_template::new_key_offset): New method declaration.
8077         (Stringpool_template::offset_): New data member.
8078
8079 2010-03-15   Rafael Espindola  <espindola@google.com>
8080
8081         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8082         Add_symbols' constructor.
8083         * readsyms.h (Add_symbols): Remove the input_group member.
8084
8085 2010-03-10  Ian Lance Taylor  <iant@google.com>
8086
8087         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8088         target to ask whether a reference to a symbol requires a stack
8089         split.
8090         * target.h (Target::is_call_to_non_split): New function.
8091         (Target::do_is_call_to_non_split): Declare virtual function.
8092         * target.cc: Include "symtab.h".
8093         (Target::do_is_call_to_non_split): New function.
8094         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8095
8096 2010-03-10  Cary Coutant  <ccoutant@google.com>
8097
8098         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8099         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8100         (File_read::open[2]): Add whole_file_view_ to list of views.
8101         (File_read::make_view): Remove test of whole_file_view_.
8102         (File_read::find_or_make_view): Create whole_file_view_ if
8103         necessary.
8104         (File_read::clear_views): Replace bool parameter with enum;
8105         adjust all callers.  Don't delete views with permanent data;
8106         do delete cached views and views from archives if
8107         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8108         if clearing the corresponding view.
8109         * fileread.h (File_read::Clear_views_mode): New enum.
8110         (File_read::View::is_permanent_view): New method.
8111         (File_read::clear_views): Replace bool parameter
8112         with enum; adjust all callers.
8113         * options.h (General_options): Change keep_files_mapped option;
8114         add map_whole_files.
8115         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8116         releasing the file.
8117         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8118         the file.
8119
8120 2010-03-10  David S. Miller  <davem@davemloft.net>
8121
8122         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8123
8124 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8125
8126         * icf.cc (get_section_contents): Add '@' marker after processing the
8127         merge reloc.
8128
8129 2010-03-08  Doug Kwan  <dougkwan@google.com>
8130
8131         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8132         due to a conversion warning.
8133         (Arm_relobj::update_output_local_symbol_count): Check for local
8134         symbol with unset output index.
8135
8136 2010-03-05  Ian Lance Taylor  <iant@google.com>
8137
8138         * options.h (class General_options): Add --spare-dynamic-tags.
8139         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8140         --spare-dynamic-tags.
8141
8142 2010-03-05  Ian Lance Taylor  <iant@google.com>
8143
8144         * incremental.cc: Include "libiberty.h".
8145
8146 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8147
8148         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8149         function, is_info_ member.
8150         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8151         (Versions::Versions): Update caller.
8152         (Versions::define_base_version): Likewise.
8153         (Versions::add_def): Likewise.
8154
8155 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8156
8157         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8158         (Scan::possible_function_pointer_reloc): New function.
8159         (Scan::local_reloc_may_be_function_pointer): Change to call
8160         possible_function_pointer_reloc.
8161         (Scan::global_reloc_may_be_function_pointer): Ditto.
8162         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8163         relocations in ".data.rel.ro._ZTV" section.
8164         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8165         * testsuite/icf_safe_so_test.cc: Ditto.
8166         * testsuite/icf_safe_test.cc: Ditto.
8167         * testsuite/icf_safe_test.sh: Ditto.
8168
8169 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8170             Ian Lance Taylor  <iant@google.com>
8171
8172         * target-reloc.h (relocate_section): Check the symbol table index
8173         for -1U before setting the local symbol index.
8174         (scan_relocatable_relocs): If copying the relocation, record that
8175         the local symbol is required.
8176         * object.h (Symbol_value::is_output_symtab_index_set): New
8177         function.
8178         (Symbol_value::may_be_discarded_from_output_symtab): New
8179         function.
8180         (Symbol_value::has_output_symtab_entry): New function.
8181         (Symbol_value::needs_output_symtab_entry): Remove.
8182         (Symbol_value::output_symtab_index): Make sure the symbol index is
8183         set.
8184         (Symbol_value::set_output_symtab_index): Make sure the symbol
8185         index is not set.  Make sure the new index is valid.
8186         (Symbol_value::set_must_have_output_symtab_entry): New function.
8187         (Symbol_value::has_output_dynsym_entry): New function.
8188         (Symbol_value::set_output_dynsym_index): Make sure the new index
8189         is valid.
8190         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8191         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8192         local symbol if permitted.
8193         (Sized_relobj::do_finalize_local_symbols): Call
8194         is_output_symtab_index_set rather than needs_output_symtab_entry.
8195         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8196         rather than needs_output_symtab_entry.  Call
8197         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8198         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8199         is_output_symtab_index_set rather than needs_output_symtab_entry.
8200         * testsuite/discard_locals_relocatable_test.c: New file.
8201         * testsuite/discard_locals_test.sh: Test -r.
8202         * testsuite/Makefile.am (check_DATA): Add
8203         discard_locals_relocatable_test1.syms,
8204         discard_local_relocatable_test2.syms.
8205         (MOSTLYCLEANFILES): Likewise.  Also add
8206         discard_locals_relocatable_test1.lout and
8207         discard_locals_relocatable_test2.out.
8208         (discard_locals_relocatable_test1.syms): New target.
8209         (discard_locals_relocatable_test.o): New target.
8210         (discard_locals_relocatable_test1.out): New target.
8211         (discard_locals_relocatable_test2.syms): New target.
8212         (discard_locals_relocatable_test2.out): New target.
8213         (various): Add missing ../ld-new dependencies.
8214         * testsuite/Makefile.in: Rebuild.
8215
8216 2010-03-03  Nick Clifton  <nickc@redhat.com>
8217
8218         * po/fi.po: New Finnish translation.
8219
8220 2010-03-01  Doug Kwan  <dougkwan@google.com>
8221
8222         * layout.cc (Layout::Layout): Force section types of .init_array*,
8223         .preinit_array* and .fini_array* sections.
8224         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8225         Fix check of return value of std::string::find.().
8226         (Output_section::Input_section_sort_compare::operator()): Remove
8227         comment about .init_array.
8228         (Output_section::Input_section_sort_init_fini_compare::operator()):
8229         New method.
8230         (Output_section::sort_attached_input_sections): Handle .init_array
8231         and .fini_array specially.
8232         * output.h (Output_section::Inut_section_sort_compare): Update
8233         comment.
8234         (Output_section::Input_section_sort_init_fini_compare): New struct.
8235
8236 2010-02-26  Doug Kwan  <dougkwan@google.com>
8237
8238         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8239         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8240         * testsuite/debug_msg.sh: Avoid matching source line number for
8241         use of global variable undef_int.
8242
8243 2010-02-26  Doug Kwan  <dougkwan@google.com>
8244
8245         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8246         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8247         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8248         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8249         * options.cc (General_options::General_options): Initialize member
8250         fix_v4bx_.
8251         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8252         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8253         and rm_no_fix_v4bx.stdout
8254         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8255         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8256         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8257         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8258         and arm_no_fix_v4bx.
8259         * Makefile.in: Regenerate.
8260         * testsuite/arm_fix_v4bx.s: New file.
8261         * testsuite/arm_fix_v4bx.sh: Ditto.
8262
8263 2010-02-24  Doug Kwan  <dougkwan@google.com>
8264
8265         * arm.cc (Target_arm::got_section): Make the .got section the first
8266         non RELRO section in the data segment.
8267         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8268         suffixes of section names.
8269
8270 2010-02-24  Doug Kwan  <dougkwan@google.com>
8271
8272         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8273         flags and attributes merging if an input file is a binary file.
8274         * fileread.cc (Input_file::open): Record format of original file.
8275         * fileread.h (Input_file::Format): New enum type.
8276         (Input_file::Input_file): Initialize data member format_.
8277         (Input_file::format): New method definition.
8278         (Input_file::format_):: New data member.
8279
8280 2010-02-24  Doug Kwan  <dougkwan@google.com>
8281
8282         * arm.cc (Arm_output_data_got): New class.
8283         (ARM_TCB_SIZE): New constant
8284         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8285         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8286         If user uses a script with a SECTIONS clause, issue only a warning
8287         for a misplaced EXIDX input section.  Otherwise, issue an error.
8288         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8289         garbage collection.
8290         (Target_arm::got_mode_index_entry): Handle static linking.
8291         (Target_arm::Scan::local): Ditto.
8292         (Target_arm::Scan::global): Ditto.
8293         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8294         all incorrectly implemented relocations.
8295         (Target_arm::fix_exidx_coverage): Pass layout to
8296         Arm_output_section::fix_exidx_coverage.
8297         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8298         from ".ARM.exidx." and ".ARM.extab.".
8299
8300 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8301
8302         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8303         section if it does not already exist.
8304         * attributes.cc (Attributes_section_data::Attributes_section_data):
8305         Don't crash if size is zero.
8306
8307 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8308             Ian Lance Taylor  <iant@google.com>
8309
8310         * gold.cc (queue_middle_tasks): If no input files were opened,
8311         exit.
8312         * workqueue.h (Task_function::Task_function): Assert that there is
8313         a blocker.
8314
8315 2010-02-22  Doug Kwan  <dougkwan@google.com>
8316
8317         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8318         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8319         types to avoid warnings due to different uint64_t implementations
8320         on different hosts.
8321
8322 2010-02-21  Doug Kwan  <dougkwan@google.com>
8323
8324         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8325         handling of the maximum backward branch offset.
8326         (Arm_relocate_functions::thumb_branch_common): Ditto.
8327         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8328         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8329         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8330         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8331         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8332         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8333         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8334         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8335         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8336         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8337         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8338         thumb2_bl_out_of_range.o): New rules.
8339         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8340         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8341         thumb2_bl_out_of_range
8342         * testsuite/Makefile.in: Regenerate.
8343         * testsuite/arm_bl_in_range.s: New file.
8344         * testsuite/arm_bl_out_of_range.s: Ditto.
8345         * testsuite/arm_branch_in_range.sh: Ditto.
8346         * testsuite/arm_branch_range.t: Ditto.
8347         * testsuite/thumb2_branch_range.t: Ditto.
8348         * testsuite/thumb_bl_in_range.s: Ditto.
8349         * testsuite/thumb_bl_out_of_range.s: Ditto.
8350         * testsuite/thumb_branch_range.t: Ditto.
8351
8352 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8353
8354         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8355         Add reloc offset information.
8356         * icf.cc (get_section_contents): Change iterators to point to the new
8357         vectors. Add reloc offset information to the contents.
8358         * icf.h (Icf::Sections_reachable_info): New typedef.
8359         (Icf::Sections_reachable_list): New typedef.
8360         (Icf::Offset_info): New typedef.
8361         (Icf::Reloc_info): New struct typedef.
8362         (Icf::Reloc_info_list): New typedef.
8363         (Icf::symbol_reloc_list): Delete method.
8364         (Icf::addend_reloc_list): Delete method.
8365         (Icf::section_reloc_list): Delete method.
8366         (Icf::reloc_info_list): New method.
8367         (Icf::reloc_info_list_): New member.
8368
8369 2010-02-19  Doug Kwan  <dougkwan@google.com>
8370
8371         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8372         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8373         * arm.cc (Arm_relocation_functions): New forward declaration.
8374         (Target_arm::Target_arm): Initialize new data members
8375         got_mod_index_offset_ and tls_base_symbol_defined_.
8376         (Target_arm::Relocate::relocate_tls): New method.
8377         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8378          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8379         New methods.
8380         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8381         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8382         (Target_arm::got_mod_index_offset_,
8383         Target_arm::tls_base_symbol_defined_): New data members.
8384         (Target_arm::Scan::local, Target::Scan::global,
8385         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8386         relocations.
8387
8388 2010-02-18  Doug Kwan  <dougkwan@google.com>
8389
8390         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8391         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8392         text section as a parameter becuase some broken tools may not set
8393         the link in section header.
8394         (Target_arm::has_got_section): New method.
8395         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8396         without any mapping symbol as data only.  Remove warning.
8397         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8398         link in its section header, try to discover the link by inspecting the
8399         REL31 relocation at the beginning of the section.
8400         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8401         in error message.
8402         (Target_arm::Scan::global): Treat any reference to the symbol
8403         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8404
8405 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8406
8407         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8408         (Scan::global_reloc_may_be_function_pointer): New function.
8409         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8410         (Scan::global_reloc_may_be_function_pointer): New function.
8411         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8412         (Scan::global_reloc_may_be_function_pointer): New function.
8413         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8414         (Scan::global_reloc_may_be_function_pointer): New function.
8415         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8416         (Scan::global_reloc_may_be_function_pointer): New function.
8417         (Scan::possible_function_pointer_reloc): New function.
8418         (Target_x86_64::can_check_for_function_pointers): New function.
8419         * gc.h (gc_process_relocs): Scan relocation types to determine if
8420         function pointers were taken for targets that support it.
8421         * icf.cc (Icf::find_identical_sections): Include functions for
8422         folding in safe ICF whose pointer is not taken.
8423         * icf.h (Secn_fptr_taken_set): New typedef.
8424         (fptr_section_id_): New member.
8425         (section_has_function_pointers): New function.
8426         (set_section_has_function_pointers): New function.
8427         (check_section_for_function_pointers): New function.
8428         * options.h: Fix comment for safe ICF option.
8429         * target.h (can_check_for_function_pointers): New function.
8430         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8431         Modify icf_safe_test for X86-64.
8432         * testsuite/Makefile.in: Regenerate.
8433         * testsuite/icf_safe_so_test.cc: New file.
8434         * testsuite/icf_safe_so_test.sh: New file.
8435         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8436         (main): Change to take pointer to function kept_func_3.
8437         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8438         folding is done correctly for X86-64.
8439
8440 2010-02-12  David S. Miller  <davem@davemloft.net>
8441
8442         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8443         is_symbolless parameter.
8444         (Output_reloc<SHT_REL>::is_symbolless): New.
8445         (Output_reloc<SHT_REL>::is_symbolless_): New.
8446         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8447         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8448         (Output_reloc<SHT_RELA>::is_symbolless): New.
8449         (Output_data_reloc::add_global): Handle is_symbolless.
8450         (Output_data_reloc::add_global_relative): Likewise.
8451         (Output_data_reloc::add_local): Likewise.
8452         (Output_data_reloc::add_local_relative): Likewise.
8453         (Output_data_reloc::add_symbolless_global_addend): New.
8454         (Output_data_reloc::add_symbolless_local_addend): New.
8455         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8456         is_symbolless.
8457         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8458         instead of ->is_relative_
8459         (Output_reloc::write): Likewise.
8460         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8461         (Output_reloc::write_rel): Simplify.
8462
8463         * sparc.cc (Target_sparc::Scan::local): Use
8464         ->add_symbolless_local_addend as needed.
8465         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8466         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8467         based upon relocation offset.
8468
8469 2010-02-11  Doug Kwan  <dougkwan@google.com>
8470
8471         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8472         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8473         beginning of function.
8474         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8475         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8476         parameter is_32bit in calls to should_apply_static_reloc.
8477         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8478         (check_DATA): Add arm_abs_global.stdout.
8479         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8480         arm_abs_global.stdout): New rules.
8481         (MOSTLLYCLEANFILES): Add arm_abs_global
8482         * Makefile.in: Regenerate.
8483         * testsuite/arm_abs_global.s: New file.
8484         * testsuite/arm_abs_global.sh: Ditto.
8485         * testsuite/arm_abs_lib.s: Ditto.
8486
8487 2010-02-11  Ian Lance Taylor  <iant@google.com>
8488
8489         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8490         Read_relocs task.
8491         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8492         Allocate_commons_task first.
8493         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8494         task, rather than symtab_lock_.
8495         (Gc_process_relocs::~Gc_process_relocs): New function.
8496         (Gc_process_relocs::is_runnable): Check this_blocker_.
8497         (Gc_process_relocs::locks): Use next_blocker_ rather than
8498         blocker_.
8499         (Scan_relocs::~Scan_relocs): New function.
8500         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8501         symtab_lock_.
8502         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8503         next_blocker_.
8504         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8505         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8506         constructor accordingly.
8507         (class Gc_process_relocs): Likewise.
8508         (class Scan_relocs): Likewise.
8509         * common.h (class Allocate_commons_task): Remove symtab_lock_
8510         field, and corresponding constructor parameter.
8511         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8512         symtab_lock_.
8513         (Allocate_commons_task::locks): Likewise.
8514
8515 2010-02-11  Ian Lance Taylor  <iant@google.com>
8516
8517         * gold-threads.h (class Once): Define.
8518         (class Initialize_lock): Rewrite as child of Once.
8519         * gold-threads.cc (class Once_initialize): Define.
8520         (once_pointer_control): New static variable.
8521         (once_pointer, once_arg): New static variables.
8522         (c_run_once): New static function.
8523         (Once::Once, Once::run_once, Once::internal_run): New functions.
8524         (class Initialize_lock_once): Remove.
8525         (initialize_lock_control): Remove.
8526         (initialize_lock_pointer): Remove.
8527         (initialize_lock_once): Remove.
8528         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8529         (Initialize_lock::initialize): Rewrite.
8530         (Initialize_lock::do_run_once): New function.
8531         * archive.cc (Archive::interpret_header): Only clear name if it is
8532         not already empty.
8533         * fileread.cc: Include "gold-threads.h"
8534         (file_counts_lock): New static variable.
8535         (file_counts_initialize_lock): Likewise.
8536         (File_read::release): Only increment counts when using --stats.
8537         Use a lock around the increment.
8538         * parameters.cc (class Set_parameters_target_once): Define.
8539         (set_parameters_target_once): New static variable.
8540         (Parameters::Parameters): Move here from parameters.h.
8541         (Parameters::set_target): Rewrite.
8542         (Parameters::set_target_once): New function.
8543         (Parameters::clear_target): Move here and rewrite.
8544         * parameters.h (class Parameters): Update declarations.  Add
8545         set_parameters_target_once_ field.
8546         (Parameters::Parameters): Move to parameters.cc.
8547         (Parameters::clear_target): Likewise.
8548         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8549         task.
8550         (Start_group::~Start_group): New function.
8551         (Start_group::is_runnable): New function.
8552         (Start_group::locks, Start_group::run): New functions.
8553         (Finish_group::run): Change saw_undefined to size_t.
8554         * readsyms.h (class Start_group): Define.
8555         (class Finish_group): Change saw_undefined_ field to size_t.
8556         (Finish_group::Finish_group): Remove saw_undefined and
8557         this_blocker parameters.  Change all callers.
8558         (Finish_group::set_saw_undefined): New function.
8559         (Finish_group::set_blocker): New function.
8560         * symtab.h (class Symbol_table): Change saw_undefined to return
8561         size_t.  Change saw_undefined_ field to size_t.
8562         * target-select.cc (Set_target_once::do_run_once): New function.
8563         (Target_selector::Target_selector): Initialize set_target_once_
8564         field.  Don't initialize lock_ and initialize_lock_ fields.
8565         (Target_selector::instantiate_target): Rewrite.
8566         (Target_selector::set_target): New function.
8567         * target-select.h (class Set_target_once): Define.
8568         (class Target_selector): Update declarations.  Make
8569         Set_target_once a friend.  Remove lock_ and initialize_lock_
8570         fields.  Add set_target_once_ field.
8571
8572 2010-02-10  Ian Lance Taylor  <iant@google.com>
8573
8574         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8575         queueing any tasks.
8576         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8577         (queue_middle_tasks): Add all blockers before queueing any tasks.
8578         (queue_final_tasks): Likewise.
8579         * token.h (Task_token::add_blockers): New function.
8580         * object.h (Input_objects::number_of_relobjs): New function.
8581
8582 2010-02-10  Ian Lance Taylor  <iant@google.com>
8583
8584         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8585         shared, not if not position independent.
8586         * x86_64.cc (Relocate::relocate_tls): Likewise.
8587         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8588         (tls_pie_pic_test): New target.
8589         * testsuite/Makefile.in: Rebuild.
8590
8591         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8592         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8593         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8594         * testsuite/Makefile.in: Rebuild.
8595
8596 2010-02-09  David S. Miller  <davem@davemloft.net>
8597
8598         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8599         R_SPARC_RELATIVE using ->add_local_relative().
8600         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8601
8602         * output.h (Output_data_dynamic::add_section_size): New method
8603         that takes two Output_data objects.
8604         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8605         entry param.  Handle it in initializers.
8606         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8607         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8608         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8609         arg.
8610         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8611         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8612         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8613         for dynrel_includes_plt.
8614         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8615         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8616         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8617         before .rela.plt
8618         (Target_sparc::do_finalize_sections): Update to pass true for
8619         dynrel_includes_plt.
8620         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8621         output before .rela.plt
8622         (Target_powerpc::do_finalize_sections): Update to pass true for
8623         dynrel_includes_plt when 32-bit.
8624
8625 2010-02-08  Doug Kwan  <dougkwan@google.com>
8626
8627         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8628         method.
8629         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8630         Arm_relobj::scan_section_for_cortex_a8_stubs,
8631         Arm_relobj::do_relocation_section): Instead of calling
8632         Output_section::output_address, use faster
8633         Arm_relobj::simple_input_section_output_address.
8634
8635 2010-02-08  David S. Miller  <davem@davemloft.net>
8636
8637         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8638         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8639         relocation helper function.
8640
8641         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8642         just like R_SPARC_GOT{10,13,22}.
8643         (Target_sparc::Scan::local): Likewise.
8644         (Target_sparc::Relocate:relocate): Likewise.
8645
8646 2010-02-06  Ian Lance Taylor  <iant@google.com>
8647
8648         * configure.ac: Rewrite targetobjs duplicate removal code to use
8649         only shell constructs.
8650         * configure: Rebuild.
8651
8652 2010-02-05  Doug Kwan  <dougkwan@google.com>
8653
8654         PR 11247
8655         * arm.cc (Arm_relobj::section_is_scannable): New method.
8656         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8657         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8658
8659 2010-02-04  Doug Kwan  <dougkwan@google.com>
8660
8661         PR 11247
8662         * arm-reloc-property.cc (cstdio): Include.
8663         * configure.ac (targetobjs): Remove duplicates.
8664         * configure: Regenerate.
8665         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8666         big and little endian version for a given address size.
8667
8668 2010-02-03  Doug Kwan  <dougkwan@google.com>
8669
8670         * arm-reloc-property.cc
8671         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8672         definition.
8673         * arm-reloc-property.h
8674         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8675         New method definition.
8676         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8677         declaration.
8678         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8679         overflow to N.
8680         (GOT_PREL): Change implemented to Y.
8681         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8682         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8683         (Arm_relocate_functions::movw_abs_nc): Remove method.
8684         (Arm_relocate_functions::movt_abs): Ditto.
8685         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8686         (Arm_relocate_functions::thm_movt_abs): Ditto.
8687         (Arm_relocate_functions::movw_rel_nc): Ditto.
8688         (Arm_relocate_functions::movw_rel): Ditto.
8689         (Arm_relocate_functions::movt_rel): Ditto.
8690         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8691         (Arm_relocate_functions:thm_movw_rel): Ditto.
8692         (Arm_relocate_functions:thm_movt_rel): Ditto.
8693         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8694         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8695         New method definitions.
8696         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8697         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8698         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8699         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8700         (Target_arm::Relocate::relocate): Check for non-static or
8701         unimplemented relocation code and exit early.  Change calls to
8702         Target_arm::reloc_uses_thumb_bit and
8703         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8704         instead.  Refactor code to handle similar relocations to increase
8705         code sharing.  Remove check for unsupported relocation code in switch
8706         statement.
8707         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8708         relocation property table to find out size.  Change error message to
8709         print out the name of a relocation code instead of the numeric value.
8710         (Target_arm::scan_reloc_for_stub): Use relocation property table
8711         instead of calling Target_arm::reloc_uses_thumb_bit().
8712
8713 2010-02-02  Doug Kwan  <dougkwan@google.com>
8714
8715         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8716         types of relaxed input section.
8717
8718 2010-02-02  Doug Kwan  <dougkwan@google.com>
8719
8720         * Makefile.am (HFILES): Add arm-reloc-property.h.
8721         (DEFFILES): New.
8722         (TARGETSOURCES): Add arm-reloc-property.cc
8723         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8724         (libgold_a_SOURCES): $(DEFFILES)
8725         * Makefile.in: Regenerate.
8726         * arm-reloc-property.cc: New file.
8727         * arm-reloc-property.h: New file.
8728         * arm-reloc.def: New file.
8729         * arm.cc: Update comments.
8730         (arm-reloc-property.h): New included header.
8731         (arm_reloc_property_table): New global variable.
8732         (Target_arm::do_select_as_default_target): New method definition.
8733         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8734         arm-reloc-property to targ_extra_obj.
8735         * parameters.cc (set_parameters_target): Call
8736         Target::select_as_default_target().
8737         * target.h (Target::select_as_default_target): New method definition.
8738         (Target::do_select_as_default_target): Same.
8739
8740 2010-02-01  Doug Kwan  <dougkwan@google.com>
8741
8742         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8743         first_output_text_section_.
8744         (Arm_exidx_fixup::first_output_text_section): New method definition.
8745         (Arm_exidx_fixup::first_output_text_section_): New data member.
8746         (Arm_exidx_fixup::process_exidx_section): Record the first text
8747         output section seen.
8748         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8749         and entsize in output section header.
8750
8751 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8752
8753         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8754         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8755         (Arm_relocate_functions::thm_alu11): New Method.
8756         (Arm_relocate_functions::thm_pc8): New Method.
8757         (Arm_relocate_functions::thm_pc12): New Method.
8758         (Target_arm::Scan::local): Handle the relocations.
8759         (Target_arm::Scan::global): Likewise.
8760         (Target_arm::Relocate::relocate): Likewise.
8761         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8762
8763 2010-01-29  Doug Kwan  <dougkwan@google.com>
8764
8765         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8766         of relocation types as ld.
8767
8768 2010-01-29  Doug Kwan  <dougkwan@google.com>
8769
8770         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8771         to public.
8772         (Arm_relocate_functions::thumb_branch_common): Ditto.
8773         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8774         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8775         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8776         Arm_relocate_functions::jump24): Remove.
8777         (Target_arm::Relocate::relocate): Adjust code to call
8778         Arm_relocation_functions::arm_branch_common and
8779         Arm_relocation_functions::thumb_branch_common instead of their removed
8780         wrappers.  Merge switch-cases together to reduce source code size.
8781
8782 2010-01-29  Doug Kwan  <dougkwan@google.com>
8783
8784         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8785         output_local_symbol_count_needs_update_.
8786         (Arm_relobj::output_local_symbol_count_needs_update,
8787          Arm_relobj::set_output_local_symbol_count_needs_update,
8788          Arm_relobj::update_output_local_symbol_count): New methods.
8789         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8790         member.
8791         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8792         of pointed function as in a R_ARM_PREL31 relocation.
8793         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8794         for output local symbol count updating.
8795         (Target_arm::do_relax): Update output local symbol counts in objects
8796         if necessary.
8797         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8798
8799 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8800
8801         * arm.cc: Added support for the ARM relocations:
8802         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8803         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8804         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8805         movw_prel_nc).
8806         (Arm_relocate_functions::movw_rel): New method.
8807         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8808         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8809         thm_movw_prel_nc).
8810         (Arm_relocate_functions::thm_movw_rel): New method.
8811         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8812         thm_movt_prel).
8813         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8814         relocations.
8815         (Target_arm::Scan::global): Likewise.
8816         (Target_arm::Relocate::relocate): Likewise.
8817         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8818         Likewise.
8819
8820 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8821
8822         * arm.cc: Added support for ARM group relocations.
8823         (Target_arm::reloc_needs_sym_origin): New method.
8824         (Arm_relocate_functions::calc_grp_kn): New method.
8825         (Arm_relocate_functions::calc_grp_residual): New method.
8826         (Arm_relocate_functions::calc_grp_gn): New method.
8827         (Arm_relocate_functions::arm_grp_alu): New Method.
8828         (Arm_relocate_functions::arm_grp_ldr): New Method.
8829         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8830         (Arm_relocate_functions::arm_grp_ldc): New Method.
8831         (Target_arm::Scan::local): Handle the ARM group relocations.
8832         (Target_arm::Scan::global): Likewise.
8833         (Target_arm::Relocate::relocate): Likewise.
8834         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8835         Likewise.
8836
8837 2010-01-26  Doug Kwan  <dougkwan@google.com>
8838
8839         * arm.cc (set): Include.
8840         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8841         pointer type.
8842         (Arm_output_section::Text_section_list): New type.
8843         (Arm_output_section::append_text_sections_to_list): New method.
8844         (Arm_output_section::fix_exidx_coverage): Ditto.
8845         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8846         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8847         Relobj::set_section_offset() instead of
8848         Sized_relobj::invalidate_section_offset().
8849         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8850         parameter for section headers. Ignore relocation sections for
8851         unallocated sections and EXIDX sections.
8852         (Target_arm::fix_exidx_coverage): New method.
8853         (Target_arm::output_section_address_less_than): New type.
8854         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8855         linked text section instead of the EXIDX section.
8856         (Arm_output_section::create_stub_group): Add an assertion to check
8857         that this is not an EXIDX output section.
8858         (Arm_output_section::append_text_sections_to_list): New method.
8859         (Arm_output_section::fix_exidx_coverage): Ditto.
8860         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8861         Arm_relobj::section_needs_reloc_stub_scanning.
8862         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8863         first pass.
8864         (Target_arm::fix_exidx_coverage): New method.
8865         * object.h (Relobj::set_output_section): New method.
8866         (Sized_relobj::invalidate_section_offset): Remove method.
8867         (Sized_relobj::do_invalidate_section_offset): Remove method.
8868         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8869
8870 2010-01-25  Doug Kwan  <dougkwan@google.com>
8871
8872         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8873         Fix warning due to signed and unsigned comparison on a 32-bit host.
8874
8875 2010-01-22  Doug Kwan  <dougkwan@google.com>
8876
8877         * arm.cc (Target_arm::do_relax): Record an output section for section
8878         offset adjustment it contains any stub table that has changed.
8879         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8880         offsets in an output section if necessary.
8881         * output.cc (Output_section::Output_section): Initialize
8882         section_offsets_need_adjustments_.
8883         (Output_section::add_input_section_for_script): Renamed to
8884         Output_section::add_simple_input_section.
8885         (Output_section::save_states): Add a comment.
8886         (Output_section::discard_states): New method defintion.
8887         (Output_section::adjust_section_offsets): Same.
8888         * output.h (Output_section::add_input_section_for_script): Renamed to
8889         Output_section::add_simple_input_section.
8890         (Output_section::discard_states): New method declaration.
8891         (Output_section::adjust_section_offsets): Same.
8892         (Output_section::section_offsets_need_adjustment,
8893         Output_section::set_section_offsets_need_adjustment): New method
8894         definitions.
8895         (Output_section::section_offsets_need_adjustment_): New data member.
8896         * script-sections.cc
8897         (Output_section_element_input::set_section_address): Adjust code for
8898         renaming of Output_section::add_input_section_for_script.
8899         (Orphan_output_section::set_section_address): Same.
8900
8901 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8902
8903         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
8904         Fix_v4bx enum values .
8905         * gold/options.h (General_options): New option definitions.
8906         (General_options::fix_v4bx): New method.
8907         (General_options::Fix_v4bx): New enum.
8908         * gold/options.cc (General_options::parse_fix_v4bx): New method.
8909         (General_options::parse_fix_v4bx_interworking): New method.
8910
8911 2010-01-22  Doug Kwan  <dougkwan@google.com>
8912
8913         * arm.cc (Arm_exidx_fixup): New class.
8914
8915 2010-01-21  Doug Kwan  <dougkwan@google.com>
8916
8917         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
8918         classes.
8919         (Arm_exidx_section_offset_map): New type.
8920
8921 2010-01-21  Doug Kwan  <dougkwan@google.com>
8922
8923         * arm.cc (Arm_exidx_input_section): New class.
8924         (Arm_relobj::exidx_input_section_by_link,
8925         Arm_relobj::exidx_input_section_by_shndx,
8926         Arm_relobj::make_exidx_input_section): New methods.
8927         (read_arm_attributes_section): Remove.
8928         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
8929         information about them.
8930         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
8931         to here.
8932
8933 2010-01-20  Doug Kwan  <dougkwan@google.com>
8934
8935         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
8936         Input_section_specifier to Section_id.
8937         (Target_arm::new_arm_input_section: Adjust code for change of key
8938         type.
8939         (Target_arm::find_arm_input_section): Ditto.
8940         * gc.h (object.h): Include for Section_id nand Section_id_hash.
8941         (Section_id): Remove.
8942         (Garbage_collection::Section_id_hash): Remove.
8943         * icf.h (object.h): Include for Section_id nand Section_id_hash.
8944         (Section_id): Remove.
8945         (Icf::Section_id_hash): Remove.
8946         * object.h (Section_id, Const_section_id, Section_id_hash,
8947         Const_section_id_hash): New type definitions.
8948         * output.cc (Output_section::add_relaxed_input_section): Change to
8949         use Const_section_id instead of Input_section_specifier as key type.
8950         (Output_section::add_merge_input_section): Ditto.
8951         (Output_section::build_relaxation_map): Change to use Section_id
8952         instead of Input_section_specifier as key type.
8953         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
8954         Ditto.
8955         (Output_section::convert_input_sections_to_relaxed_sections): Change
8956         to use Const_section_id instead of Input_section_specifier as key type.
8957         (Output_section::find_merge_section): Ditto.
8958         (Output_section::find_relaxed_input_section): Ditto.
8959         * output.h (Input_section_specifier): Remove class.
8960         (Output_section::Output_section_data_by_input_section_map): Change
8961         key type to Const_section_id.
8962         (Output_section::Output_relaxed_input_section_by_input_section_map):
8963         Ditto.
8964         (Output_section::Relaxation_map): Change key type to Section_id.
8965
8966 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8967
8968         * gold/arm.cc: Added support for R_ARM_V4BX relocation
8969         (class Arm_v4bx_stub): New class.
8970         (DEF_STUBS): Updated definition to support v4_veneer_bx.
8971         (Stub_factory::make_arm_v4bx_stub): New method.
8972         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
8973         (Stub_table::empty): Handle v4bx stubs.
8974         (Stub_table::add_arm_v4bx_stub): New method.
8975         (Stub_table::find_arm_v4bx_stub): New method.
8976         (Arm_relocate_functions::v4bx): New method.
8977         (Target_arm::fix_v4bx): New method.
8978         (Target_arm::Target_arm): Handle R_ARM_V4BX.
8979         (Stub_table::relocate_stubs): Likewise.
8980         (Stub_table::do_write): Likewise.
8981         (Stub_table::update_data_size_and_addralign): Likewise.
8982         (Stub_table::finalize_stubs):  Likewise.
8983         (Target_arm::Scan::local): Likewise.
8984         (Target_arm::Scan::global): Likewise.
8985         (Target_arm::do_finalize_sections): Likewise.
8986         (Target_arm::Relocate::relocate): Likewise.
8987         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8988         Likewise.
8989         (Target_arm::scan_reloc_for_stub): Likewise.
8990         (Target_arm::scan_reloc_section_for_stubs): Likewise.
8991
8992 2010-01-19  Ian Lance Taylor  <iant@google.com>
8993
8994         * output.cc (Output_section_headers::do_sized_write): Write large
8995         segment count to sh_info field.
8996         (Output_file_header::do_sized_write): For large segment count,
8997         write PN_XNUM to e_phnum field.
8998
8999 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9000
9001         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9002         (Arm_relocate_functions::thm_jump8): New function.
9003         (Arm_relocate_functions::thm_jump11): New function.
9004         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9005         R_ARM_THM_JUMP11.
9006         (Target_arm::Scan::global): Likewise.
9007         (Target_arm::Relocate::relocate): Likewise.
9008         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9009         Likewise.
9010
9011 2010-01-14  Doug Kwan  <dougkwan@google.com>
9012
9013         * arm.cc (map, utility): Include headers.
9014         (Target_arm::apply_cortex_a8_workaround): New method.
9015         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9016         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9017         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9018         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9019         the --[no-]fix-cortex-a8 command line options.
9020         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9021         (Target_arm::relocate_stub): Use addend in instruction template.
9022         * options.h (DEFINE_bool): Set the user-set flag.
9023         (General_options): Add --[no-]-fix-cortex options.
9024         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9025         : Update fast look-up map after conversion.
9026
9027 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9028
9029         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9030         in the first pass of do_layout.
9031
9032 2010-01-13  Doug Kwan  <dougkwan@google.com>
9033
9034         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9035         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9036         apparent compiler problem of not folding static constant integral
9037         data members of elfcpp::Elf_sizes<32>.
9038
9039 2010-01-13  Doug Kwan  <dougkwan@google.com>
9040
9041         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9042         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9043         Arm_relobj::scan_section_for_cortex_a8_erratum,
9044         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9045         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9046         sections to scan for relocation stubs into a new method
9047         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9048         relocation and Cortex-A8 stub scanning.
9049         (Target_arm::do_relax): Force stubs to be after stubbed sections
9050         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9051         the beginning of a new relaxation pass.  Update a comment.
9052         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9053
9054 2010-01-12  Ian Lance Taylor  <iant@google.com>
9055
9056         * target-reloc.h (visibility_error): New inline function.
9057         (relocate_section): Call visibility_error.
9058         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9059         (MOSTLYCLEANFILES): Likewise.
9060         (protected_4_pic.o, protected_3.err): New targets.
9061         * testsuite/protected_4.cc: New file.
9062
9063 2010-01-12  Doug Kwan  <dougkwan@google.com>
9064
9065         * arm.cc (Cortex_a8_reloc): New class.
9066         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9067         and cortex_a8_relocs_info_.
9068         (Target_arm::fix_cortex_a8): New method definition.
9069         (Target_arm::Cortex_a8_relocs_info): New type.
9070         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9071         New data member declarations.
9072         (Target_arm::scan_reloc_for_stub): Record information about
9073         relocations for THUMB branches that might be exempted from the
9074         Cortex-A8 workaround.
9075         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9076         at the beginning of a relaxation pass.
9077
9078 2010-01-12  Doug Kwan  <dougkwan@google.com>
9079
9080         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9081         (Arm_relobj::Mapping_symbol_position,
9082          Arm_reloj::Mapping_symbol_position_less,
9083          Arm_relobj::Mapping_symbols_info): New types.
9084         (Target_arm::is_mapping_symbol_name): New method definition.
9085         (Arm_relobj::do_count_local_symbols): Save information about mapping
9086         symbols.
9087
9088 2010-01-11  Doug Kwan  <dougkwan@google.com>
9089
9090         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9091         Arm_relocate_functions::thumb32_branch_upper,
9092         Arm_relocate_functions::thumb32_branch_lower,
9093         Arm_relocate_functions::thumb32_cond_branch_offset,
9094         Arm_relocate_functions::thumb32_cond_branch_upper,
9095         Arm_relocate_functions::thumb32_cond_branch_lower,
9096         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9097         branch offset encoding.
9098         (Arm_relocate_functions::thumb_branch_common): Use new branch
9099         offset encoding methods to avoid code duplication.
9100         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9101         (Stub_addend_reader::operator()): Use new branch encoding method
9102         to avoid code duplication.
9103
9104 2010-01-11  Doug Kwan  <dougkwan@google.com>
9105
9106         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9107         (Target_arm::do_finalize_sections): Define special EXIDX section
9108         symbols only if referenced.
9109         * gc.h (Garbage_collection::add_reference): New method.
9110         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9111         code duplication.
9112
9113 2010-01-11  Ian Lance Taylor  <iant@google.com>
9114
9115         * script.cc (Version_script_info::build_expression_list_lookup):
9116         Change complaing about duplicate wildcard match from error to
9117         warning.
9118
9119         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9120         of 2009-12-30.
9121         (Version_script_info::Version_script_info): Initialize globs_,
9122         default_version_, default_is_global_, and exact_.  Don't
9123         initialize globals_ or locals_.
9124         (Version_script_info::build_lookup_tables): Build local symbols
9125         first.
9126         (Version_script_info::unquote): New function.
9127         (Version_script_info::add_exact_match): New function.
9128         (Version_script_info::build_expression_list_lookup): Remove lookup
9129         parameter.  Add is_global parameter.  Change all callers.  Handle
9130         wildcard pattern specially.  Unquote pattern.  Call
9131         add_exact_match.
9132         (Version_script_info::get_name_to_match): New function.
9133         (Version_script_info::get_symbol_version): New function.
9134         (Version_script_info::get_symbol_version_helper): Remove.
9135         (Version_script_info::check_unmatched_names): Call unquote.
9136         * script.h (class Version_script_info): Change get_symbol_version
9137         to be non-inline and add is_global parameter; change all callers.
9138         Rewrite symbol_is_local.  Update declarations.  Define struct
9139         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9140         Remove globals_ and locals_ members.  Add exact_, globs_,
9141         default_version_, is_global_.
9142         (Version_script_info::Glob): Remove pattern, add expression and
9143         is_global.  Update constructor.  Change all callers.
9144         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9145         default version.
9146         (Versions::symbol_section_contents): If a symbol is undefined, or
9147         defined in a dynamic object, set the version index to
9148         VER_NDX_LOCAL.
9149         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9150         symbol_is_local.
9151         (Symbol_table::add_from_pluginobj): Likewise.
9152         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9153
9154 2010-01-11  Doug Kwan  <dougkwan@google.com>
9155
9156         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9157         (incremental_dump_LDADD): Add linking option for libintl.
9158         * Makefile.in: Regenerate.
9159
9160 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9161
9162         PR gold/11144
9163         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9164         instead of -Ds.
9165         * testsuite/Makefile.in: Regenerated.
9166
9167 2010-01-10  Doug Kwan  <dougkwan@google.com>
9168
9169         * options.h (DEFINE_var): Use parentheses around argument varname__
9170         in macro body to avoid any unintended subsequent substitutions.
9171
9172 2010-01-10  Ian Lance Taylor  <iant@google.com>
9173
9174         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9175         candidates before doing symbol resolution.
9176
9177         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9178         ODR candidates if only one is weak.
9179
9180 2010-01-08  Ian Lance Taylor  <iant@google.com>
9181
9182         * script.cc (Version_script_info::build_expression_list_lookup):
9183         Don't warn about ambiguous version, just record the ambiguity.
9184         (Version_script_info::get_symbol_version_helper): Give error if
9185         version is ambiguous.
9186
9187 2010-01-08  Doug Kwan  <dougkwan@google.com>
9188
9189         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9190         prev_data_size_ and prev_addralign_.  Remove initializer for
9191         deleted data member has_been_changed_.
9192         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9193         to determine if the table is empty.
9194         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9195         Remove.
9196         (Stub_table::add_reloc_stub): Define method in class definition
9197         instead of just declaring it there.
9198         (Stub_table::add_cortex_a8_stub): New method definition.
9199         (Stub_table::update_data_size_and_addralign): Ditto.
9200         (Stub_table::finalize_stubs): Ditto.
9201         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9202         (Stub_table::do_addralign_): Return address alignment in the
9203         (Stub_table::do_reset_address_and_file_offset): Define method in
9204         class definition instead of declaring it there.  Set current data
9205         size to be the data size of the previous pass.
9206         (Stub_table::set_final_data_size): Use current data size as the
9207         final data size.
9208         (Stub_table::relocate_stub): Change parameter type of stub from
9209         Reloc_stub pointer to Stub pointer.
9210         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9211         (Stub_table::Cortex_a8_stub_list): New typedef.
9212         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9213          Stub_table::prev_addralign_): New data member.
9214         (Arm_relobj::Arm_relobj): Initialize data member
9215         section_has_cortex_a8_workaround_.
9216         (Arm_relobj::section_has_cortex_a8_workaround,
9217          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9218          definitions.
9219         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9220         declarations.
9221         (Target_arm::relocate_stub): Change parameter type of stub from
9222         Reloc_stub pointer to Stub pointer.
9223         (Insn_template::size, Insn_template::alignment): Handle
9224         THUMB16_SPECIAL_TYPE.
9225         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9226          Stub_table::update_data_size_and_addralign,
9227          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9228         definitions.
9229         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9230         (Stub_table::do_write): Ditto.
9231         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9232
9233 2010-01-08  Ian Lance Taylor  <iant@google.com>
9234
9235         PR 11108
9236         * symtab.h (class Symbol): Remove fields is_target_special_ and
9237         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9238         (Symbol::is_defined_in_discarded_section): New function.
9239         (Symbol::set_is_defined_in_discarded_section): New function.
9240         (Symbol::has_plt_offset): Rewrite.
9241         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9242         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9243         Don't initialize is_target_special_ or has_plt_offset_.
9244         Initialize is_defined_in_discarded_section_.
9245         (Symbol_table::add_from_relobj): If appropriate, set
9246         is_defined_in_discarded_section.
9247         * resolve.cc (Symbol::override_base_with_special): Don't test
9248         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9249         * target-reloc.h (relocate_section): Do special handling for
9250         symbols defined in discarded sections for global symbols as well
9251         as local symbols.
9252
9253 2010-01-08  Ian Lance Taylor  <iant@google.com>
9254
9255         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9256         the SHT_SYMTAB case.
9257
9258 2010-01-08  Ian Lance Taylor  <iant@google.com>
9259
9260         * object.cc (Sized_relobj::do_layout): Don't get confused if
9261         layout_eh_frame returns NULL.
9262
9263 2010-01-08  Ian Lance Taylor  <iant@google.com>
9264
9265         PR 11084
9266         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9267         dynamic symbol table, use the normal symbol table.
9268         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9269         symbol table.
9270
9271 2010-01-08  Ian Lance Taylor  <iant@google.com>
9272
9273         PR 11072
9274         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9275         sections.
9276
9277 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9278
9279         * version.cc (print_version): Change to "Copyright 2010".
9280
9281 2010-01-08  Ian Lance Taylor  <iant@google.com>
9282
9283         PR 10287
9284         PR 11063
9285         * i386.cc (class Target_i386): Change return type of plt_section
9286         to be non-const.
9287         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9288         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9289         tls_desc_rel_ field.
9290         (Output_data_plt_i386::rel_tls_desc): New function.
9291         (Target_i386::rel_tls_desc_section): New function.
9292         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9293         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9294         R_386_TLS_DESC reloc in rel_tls_desc_section.
9295         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9296         Define struct Tlsdesc_info.
9297         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9298         (Target_x86_64::do_reloc_symbol_index): New function.
9299         (Target_x86_64::add_tlsdesc_info): New function.
9300         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9301         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9302         tlsdesc_rel_ field.
9303         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9304         all callers.
9305         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9306         (Target_x86_64::rela_tlsdesc_section): New function.
9307         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9308         handling.
9309         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9310         (Target_x86_64::do_reloc_addend): New function.
9311         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9312         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9313         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9314         (Output_reloc::type): New function.
9315         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9316         (Output_reloc::is_target_specific): New function.
9317         (Output_reloc::target_arg): New function.
9318         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9319         absolute relocs and target specific relocs.
9320         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9321         add_target_specific.
9322         (class Output_data_reloc) [SHT_RELA]: Likewise.
9323         * output.cc (Output_reloc::Output_reloc): Add four new versions
9324         for absolute relocs and target specific relocs.
9325         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9326         (Output_reloc::get_symbol_index): Likewise.
9327         (Output_reloc::local_section_offset): Check that local_sym_index_
9328         is not TARGET_CODE or 0.
9329         (Output_reloc::symbol_value): Likewise.
9330         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9331         reloc.
9332         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9333         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9334         functions.
9335         * layout.cc (add_target_dynamic_tags): Use output section for
9336         DT_PLTRELSZ and DT_JMPREL.
9337
9338 2010-01-07  Ian Lance Taylor  <iant@google.com>
9339
9340         PR 11061
9341         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9342         function.
9343         (class Output_data_reloc_generic): Define.
9344         (class Output_data_reloc_base): Change base class to
9345         Output_data_reloc_generic.  Change add() method to call
9346         bump_relative_reloc_count for a relative reloc.  Remove
9347         sort_relocs_ field.
9348         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9349         to sort_relocs().
9350         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9351         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9352         appropriate.
9353         * layout.h (class Layout): Update declaration.
9354
9355 2010-01-07  Ian Lance Taylor  <iant@google.com>
9356
9357         * output.h (class Output_data): Add const version of
9358         output_section and do_output_section.
9359         (class Output_section_data): Add const version of
9360         do_output_section.
9361         (class Output_section): Likewise.
9362         * layout.cc (Layout::add_target_dynamic_tags): New function.
9363         * layout.h (class Layout): Update declarations.
9364         * arm.cc (Target_arm::do_finalize_sections): Use
9365         add_target_dynamic_tags.
9366         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9367         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9368         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9369         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9370
9371 2010-01-07  Ian Lance Taylor  <iant@google.com>
9372
9373         PR 11042
9374         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9375         object as needed.
9376
9377 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9378             Ian Lance Taylor  <iant@google.com>
9379
9380         PR 11019
9381         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9382         Xindex::read_symtab_xindex.
9383
9384 2010-01-07  Doug Kwan  <dougkwan@google.com>
9385
9386         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9387         (Insn_template::thumb16_bcond_insn): New method declaration.
9388         (Insn_template): Fix spelling.
9389         (Stub::thumb16_special): New method declaration.
9390         (Stub::do_write): Define virtual method which was previously pure
9391         virtual.
9392         (Stub::do_thumb16_special): New method declaration.
9393         (Stub::do_fixed_endian_write): New template member.
9394         (Reloc_stub::do_write): Remove.
9395         (Reloc_stub::do_fixed_endian_write): Remove.
9396         (Cortex_a8_stub): New class definition.
9397         (Stub_factory::make_cortex_a8_stub): New method definition.
9398         (Stub_factory::Stub_factory): Add missing static storage class
9399         qualifier for elf32_arm_stub_a8_veneer_blx.
9400
9401 2010-01-07  Ian Lance Taylor  <iant@google.com>
9402
9403         PR 10980
9404         * options.h (class General_options): Add --warn-unresolved-symbols
9405         and --error-unresolved-symbols.
9406         * errors.cc (Errors::undefined_symbol): Implement
9407         --warn-unresolved-symbols.
9408
9409         * options.h (class General_options): Add -z text and -z textoff.
9410         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9411
9412 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9413
9414         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9415         (Garbage_collection::cident_sections): New function.
9416         (Garbage_collection::add_cident_section): New function.
9417         (Garbage_collection::cident_sections_): New member.
9418         (gc_process_relocs): Add references to sections whose names are C
9419         identifiers.
9420         * gold.h (cident_section_start_prefix): New constant.
9421         (cident_section_stop_prefix): New constant.
9422         (is_cident): New function.
9423         * layout.cc (Layout::define_section_symbols): Replace string constants
9424         with the newly defined constants.
9425         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9426         C identifiers.
9427         * testsuite/Makefile.am: Add gc_orphan_section_test.
9428         * testsuite/Makefile.in: Regenerate.
9429         * testsuite/gc_orphan_section_test.cc: New file.
9430         * testsuite/gc_orphan_section_test.sh: New file.
9431
9432 2010-01-06  Ian Lance Taylor  <iant@google.com>
9433
9434         PR 10980
9435         * options.h (class General_options): Add --warn-shared-textrel.
9436         * layout.cc (Layout::finish_dynamic_section): Implement
9437         --warn-shared-textrel.
9438
9439         PR 10980
9440         * options.h (class General_options): Add --warn-multiple-gp.
9441
9442 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9443
9444         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9445         $(THREADSLIB) and $(LIBDL).
9446         * Makefile.in: Rebuild.
9447
9448 2010-01-06  Ian Lance Taylor  <iant@google.com>
9449
9450         PR 10980
9451         * options.cc (General_options::parse_section_start): New function.
9452         (General_options::section_start): New function.
9453         (General_options::General_options): Initialize all members.
9454         * options.h: Include <map>
9455         (class General_options): Add --section-start.  Add section_starts_
9456         member.
9457         * layout.cc (Layout::attach_allocated_section_to_segment): If
9458         --section-start was used, set the address of the segment.  Remove
9459         local sort_sections.
9460         (Layout::relaxation_loop_body): If the address of the load segment
9461         has been set by --section-start, don't use it.
9462         * output.h (Output_segment::update_flags_for_output_section): New
9463         function.
9464         * output.cc (Output_segment::add_output_section): Call
9465         update_flags_for_output_section.
9466
9467 2010-01-05  Ian Lance Taylor  <iant@google.com>
9468
9469         PR 10980
9470         * options.h (class General_options): Add --undefined-version.
9471         * script.cc (struct Version_expression): Add was_matched_by_symbol
9472         field.
9473         (Version_script_info::matched_symbol): New function.
9474         (Version_script_info::get_symbol_version_helper): Call
9475         matched_symbol.
9476         (Version_script_info::check_unmatched_names): New function.
9477         * script.h (class Version_script_info): Update declarations.
9478         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9479
9480         * options.h (class General_options): Use DEFINE_bool_alias for
9481         allow_multiple_definition.
9482         * resolve.cc (Symbol_table::should_override): Don't test
9483         allow_multiple_definition.
9484
9485         PR 10980
9486         * options.h (class General_options): Add --cref.
9487         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9488         until after printing cref table.
9489         * cref.cc: Include "symtab.h".
9490         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9491         (Cref_table_compare::operator()): New function.
9492         (Cref_inputs::gather_cref): New function.
9493         (filecol): New static const.
9494         (Cref_inputs::print_cref): New function.
9495         (Cref::print_cref): New function.
9496         * cref.h: Include <cstdio>.
9497         (class Cref): Update declarations.
9498         * mapfile.h (Mapfile::file): New function.
9499         * object.h (class Object): Define Symbols.  Declare virtual
9500         do_get_global_symbols.
9501         (Object::get_global_symbols): New function.
9502         * object.cc (Input_objects::add_object): Pass object to cref_ if
9503         --cref.
9504         (Input_objects::archive_start): Likewise.
9505         (Input_objects::archive_stop): Likewise.
9506         (Input_objects::print_cref): New function.
9507         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9508         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9509         --cref.
9510         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9511         function.
9512         * plugin.h (class Sized_pluginobj): Update declarations.
9513
9514 2010-01-05  Ian Lance Taylor  <iant@google.com>
9515
9516         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9517         to is_default_version.  Rename insdef to insdefault.
9518         (Symbol_table::add_from_relobj): Rename def to is_default_version
9519         and local to is_forced_local.
9520         (Symbol_table::add_from_pluginobj): Likewise.
9521         (Symbol_table::add_from_dynobj): Likewise.
9522         (Symbol_table::define_special_symbol): Rename insdef to
9523         insdefault.
9524
9525 2010-01-04  Ian Lance Taylor  <iant@google.com>
9526
9527         PR 10980
9528         * options.h (class General_options): Add
9529         --allow-multiple-definition and -z muldefs.
9530         * resolve.cc (Symbol_table::should_override): Don't warn about a
9531         multiple symbol definition if --allow-multiple-definition or -z
9532         muldefs.
9533
9534         PR 10980
9535         * options.h (class General_options): Add --add-needed and
9536         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9537         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9538         error if --copy-dt-needed-entries aka --add-needed is used and
9539         would cause a change in behaviour.
9540
9541         PR 10980
9542         * options.h (class General_options): Add -G as a short version of
9543         --shared.  Add no-op options -assert, -g, and -i.
9544
9545 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9546
9547         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9548         check for .text or .gnu.linkonce.t sections.
9549         * icf.cc (Icf::find_identical_sections): Ditto.
9550         Change the detection for mangled function name within the section
9551         name.
9552         * icf.h (is_section_foldable_candidate): New function.
9553
9554 2009-12-30  Ian Lance Taylor  <iant@google.com>
9555
9556         PR 10980
9557         * options.h (class General_options): Permit two dashes with
9558         --retain-symbols-file.
9559
9560 2009-12-30  Ian Lance Taylor  <iant@google.com>
9561
9562         PR 10979
9563         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9564         don't put the file header and segment headers in the text
9565         segment.
9566
9567         PR 10979
9568         * common.cc (Sort_commons::operator()): Stabilize sort when both
9569         entries are NULL.
9570         (Symbol_table::do_allocate_commons_list): When allocating common
9571         symbols, skip a symbol which is no longer common.
9572         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9573         an object before checking its type.
9574         * testsuite/common_test_2.c: New file.
9575         * testsuite/common_test_3.c: New file.
9576         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9577         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9578         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9579         (common_test_2_pic.o, common_test_2.so): New targets.
9580         (common_test_3_pic.o, common_test_3.so): New targets.
9581         * testsuite/Makefile.in: Rebuild.
9582
9583         PR 10979
9584         * script.cc (read_input_script): If we see a new SECTIONS clause,
9585         and we have added an input section, give an error.
9586         * layout.h (class Layout): Add have_added_input_section function.
9587         Add have_added_input_section_ field.
9588         * layout.cc (Layout::Layout): Initialize
9589         have_added_input_section_.
9590         (Layout::layout): Set have_added_input_section_.
9591         (Layout::layout_eh_frame): Likewise.
9592
9593 2009-12-30  Ian Lance Taylor  <iant@google.com>
9594
9595         PR 10931
9596         * options.h (class General_options): Add --sort-common option.
9597         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9598         * common.cc (Sort_common): Add sort_order parameter to
9599         constructor.  Add sort_order_ field.
9600         (Sort_commons::operator): Check sort_order_.
9601         (Symbol_table::allocate_commons): Determine the sort order.
9602         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9603         Change all callers.
9604         (Symbol_table::do_allocate_commons_list): Likewise.
9605
9606 2009-12-30  Ian Lance Taylor  <iant@google.com>
9607
9608         PR 10916
9609         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9610         symbols from this object, don't change the visibility of an
9611         undefined symbol.
9612         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9613
9614 2009-12-30  Ian Lance Taylor  <iant@google.com>
9615
9616         PR 10861
9617         * script.h (class Version_script_info): Define Language enum.
9618         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9619         new fields globals_, locals_, and is_finalized_.
9620         * script.cc: Various formatting fixes.
9621         (class Parser_closure): Change language_stack_ from a vector of
9622         std::string to one of Version_script_info::Language.  Adjust all
9623         uses accordingly.
9624         (class Lazy_demangler): Remove.
9625         (struct Version_expression): Change language from std::string to
9626         Version_script_info::Language.
9627         (Version_script_info::Version_script_info): New function.
9628         (Version_script_info::~Version_script_info): Don't call clear.
9629         (Version_script_info::finalize): New function.
9630         (Version_script_info::build_lookup_tables): New function.
9631         (Version_script_info::build_expression_list_lookup): New
9632         function.
9633         (Version_script_info::get_symbol_version_helper): Rewrite to use
9634         lookup tables.
9635         (Version_script_info::print_expression_list): Adjust to use
9636         Version_script_info::Language.
9637         (script_push_lex_into_version_mode): Check that the version script
9638         has not been finalized.
9639         (version_script_push_lang): Change language string to
9640         Version_script_info::Language.
9641         * options.cc (Command_line::version_script): New function.
9642         * options.h (class General_options): Add finalize_dynamic_list
9643         function.  Change version_script from declaration to definition.
9644         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9645         * testsuite/version_script.map: Remove duplicate def of foo.
9646         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9647         version_script.map.
9648         * testsuite/Makefile.in: Rebuild.
9649
9650 2009-12-30  Ian Lance Taylor  <iant@google.com>
9651
9652         PR 10843
9653         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9654         if the input symbol index is 0, make the output symbol index 0.
9655
9656 2009-12-30  Ian Lance Taylor  <iant@google.com>
9657
9658         PR 10670
9659         * options.h (class General_options): Add -x/--discard-all.
9660         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9661         --discard-all.  If the local symbol needs a dynamic entry, check
9662         that before handling --discard-locals.
9663
9664 2009-12-30  Ian Lance Taylor  <iant@google.com>
9665
9666         PR 10450
9667         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9668         flags to PF_R.
9669         (Output_segment::add_output_section): Don't change the flags if
9670         the type is PT_TLS.
9671
9672         PR 10450
9673         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9674         GNU hash table if they need a dynamic value.  Otherwise, don't add
9675         them if they are defined in a dynamic object or are forced local.
9676
9677 2009-12-29  Ian Lance Taylor  <iant@google.com>
9678
9679         PR 10450
9680         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9681         .gnu.hash table for a 32-bit target.
9682
9683         PR 10450
9684         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9685         regular and a dynamic object only needs a dynamic symbol table
9686         entry if it is externally visible.
9687
9688         PR 10450
9689         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9690         constructor.  Add global_offset_table_ field.
9691         (Target_i386::got_section): Set global_offset_table_.
9692         (Target_i386::do_finalize_sections): Set global_offset_table_
9693         size.
9694         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9695         in constructor.  Add global_offset_table_ field.
9696         (Target_x86_64::got_section): Set global_offset_table_.
9697         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9698         size.
9699
9700         * layout.cc (Layout::Layout): Initialize increase_relro_.
9701         (Layout::get_output_section): Add is_relro, is_last_relro, and
9702         is_first_non_relro parameters.  Change all callers.
9703         (Layout::choose_output_section): Likewise.
9704         (Layout::add_output_section_data): Likewise.
9705         (Layout::make_output_section): Likewise.
9706         (Layout::set_segment_offsets): Clear increase_relro when using a
9707         linker script.
9708         * layout.h (class Layout): Add increase_relro method.  Add
9709         increase_relro_ field.  Update declarations.
9710         * output.cc (Output_section::Output_section): Initialize
9711         is_last_relro_ and is_first_non_relro_.
9712         (Output_segment::add_output_section): Group relro sections is
9713         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9714         (Output_segment::maximum_alignment): Remove relro handling.
9715         (Output_segment::set_section_addresses): Add increase_relro
9716         parameter.  Change all callers.  Add initial alignment to align
9717         relro sections on separate page.  Remove old relro handling.
9718         (Output_segment::set_section_list_addresses): Remove in_relro
9719         parameter.  Change all callers.
9720         (Output_segment::set_offset): Add increase parameter.  Change all
9721         callers.  Remove old relro handling.
9722         * output.h (class Output_section): Add new methods: is_last_relro,
9723         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9724         Add is_last_relro_ and is_first_non_relro_ fields.
9725         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9726         Create separate .got.plt section.  Call increase_relro.
9727         * x86_64.cc (Target_x86_64::got_section): Likewise.
9728         * testsuite/relro_script_test.t: Add .got.plt.
9729
9730         PR 10450
9731         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9732         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9733         (Layout::finalize): Call set_dynamic_symbol_size.
9734         (Layout::set_dynamic_symbol_size): New function.
9735         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9736         set_dynamic_symbol_size.
9737
9738         PR 10450
9739         * output.h (class Output_section): Add is_entsize_zero_ field.
9740         * output.cc (Output_section::Output_section): Initialize
9741         is_entsize_zero_.
9742         (Output_section::set_entsize): If two different entsizes are
9743         requested, force it to zero.
9744         (Output_section::add_input_section): Set flags for .debug_str
9745         before updating section flags.  Set entsize.
9746         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9747         and SHF_STRING if all input sections have those flags.
9748
9749 2009-12-29   Rafael Espindola  <espindola@google.com>
9750
9751         * main.cc (main): Fix the sys time reporting.
9752         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9753         reporting.
9754
9755 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9756
9757         * options.cc (General_options::parse_version): Allow -v to exit
9758         without an error if there is nothing to link.
9759
9760 2009-12-29  Ian Lance Taylor  <iant@google.com>
9761
9762         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9763         using a version of gcc before 4.1.
9764         * configure: Rebuild.
9765
9766 2009-12-28  Chris Demetriou  <cgd@google.com>
9767
9768         * attributes.cc (Output_attributes_section_data::do_write): Use
9769         std::vector::front rather than std::vector::data.
9770
9771 2009-12-28  Ian Lance Taylor  <iant@google.com>
9772
9773         * symtab.h (class Symbol_table): Add enum Defined.
9774         * resolve.cc (Symbol_table::should_override): Add defined
9775         parameter.  Change all callers.  Test whether object is NULL
9776         before calling a method on it.
9777         (Symbol_table::report_resolve_problem): Add defined parameter.
9778         Change all callers.
9779         (Symbol_table::should_override_with_special): Likewise.
9780         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9781         parameter.  Change all callers.
9782         (Symbol_table::do_define_in_output_data): Likewise.
9783         (Symbol_table::define_in_output_segment): Likewise.
9784         (Symbol_table::do_define_in_output_segment): Likewise.
9785         (Symbol_table::define_as_constant): Likewise.
9786         (Symbol_table::do_define_as_constant): Likewise.
9787         * script.h (class Symbol_assignment): Add is_defsym parameter to
9788         constructor; change all callers.
9789         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9790         parameter.  Change all callers.  Add is_defsym_ field.
9791         (class Parser_closure): Add parsing_defsym parameter to
9792         constructor; change all callers.  Add parsing_defsym accessor
9793         function.  Add parsing_defsym_ field.
9794
9795 2009-12-28  Ian Lance Taylor  <iant@google.com>
9796
9797         * gold.cc (queue_middle_tasks): Fix formatting.
9798         * object.cc (Relobj::is_section_name_included): Likewise.
9799
9800 2009-12-23  Ian Lance Taylor  <iant@google.com>
9801
9802         * i386.cc (Target_i386::do_calls_non_split): Recognize
9803         -fsplit-stack prologue for a function with a static chain.
9804         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9805         -fsplit-stack prologue when using %r11.
9806
9807 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9808
9809         * options.cc (General_options::parse_version): Make -v continue and do
9810         the link like GNU ld does.
9811
9812 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9813
9814         * Makefile.am (CCFILES): Add timer.cc.
9815         (HFILES): Add timer.h.
9816         * configure.ac: Check for sysconf and times.
9817         * main.cc: include timer.h.
9818         (main): Use Timer instead of get_run_time.
9819         * timer.cc: New.
9820         * timer.h: New.
9821         * workqueue.cc: include timer.h.
9822         (Workqueue::find_and_run_task):
9823         Report user, sys and wall time.
9824         * Makefile.in: Regenerate.
9825         * config.in: Regenerate.
9826         * configure: Regenerate.
9827
9828 2009-12-16  Doug Kwan  <dougkwan@google.com>
9829
9830         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9831         sections.
9832         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9833         relaxed input sections.
9834         * output.cc (Output_section::find_relaxed_input_section): Change
9835         return type to Output_relaxed_input_section pointer.  Adjust code
9836         for new type of relaxed_input_section_map_.
9837         * output.h (Output_section::find_relaxed_input_section): Change
9838         return type to Output_relaxed_input_section pointer.
9839         (Output_section::Output_relaxed_input_section_by_input_section_map):
9840         New type.
9841         (Output_section::relaxed_input_section_map_): Change type to
9842         Output_section::Output_relaxed_input_section_by_input_section_map.
9843         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9844         input section.
9845
9846 2009-12-15  Ian Lance Taylor  <iant@google.com>
9847
9848         * layout.cc (Layout::create_shstrtab): Only write out after input
9849         sections if we are compressing debug sections.
9850
9851 2009-12-15  Ian Lance Taylor  <iant@google.com>
9852
9853         * archive.cc (Archive::add_symbols): Only look up a symbol without
9854         a version if there is, in fact, a version.
9855
9856 2009-12-14  Ian Lance Taylor  <iant@google.com>
9857
9858         Revert -Wshadow changes, all changes from:
9859         2009-12-11  Doug Kwan  <dougkwan@google.com>
9860         2009-12-11  Nick Clifton  <nickc@redhat.com>
9861         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9862
9863 2009-12-11  Doug Kwan  <dougkwan@google.com>
9864
9865         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9866         due to -Wshadow.
9867         * attributes.cc (Object_attribute::size): Ditto.
9868         (Attributes_section_data::size): Ditto.
9869         (Attributes_section_data::Attributes_section_data): Ditto.
9870         (Output_attributes_section_data::do_write): Ditto.
9871         * attributes.h (Object_attribute::set_type): Ditto.
9872         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9873
9874 2009-12-11  Nick Clifton  <nickc@redhat.com>
9875
9876         * archive.cc: Fix shadowed variable warnings.
9877         * arm.cc: Likewise.
9878         * compressed_output.cc: Likewise.
9879         * compressed_output.h: Likewise.
9880         * configure: Likewise.
9881         * dwarf_reader.cc: Likewise.
9882         * dynobj.cc: Likewise.
9883         * dynobj.h: Likewise.
9884         * ehframe.cc: Likewise.
9885         * ehframe.h: Likewise.
9886         * errors.cc: Likewise.
9887         * expression.cc: Likewise.
9888         * fileread.cc: Likewise.
9889         * fileread.h: Likewise.
9890         * freebsd.h: Likewise.
9891         * i386.cc: Likewise.
9892         * icf.cc: Likewise.
9893         * incremental.h: Likewise.
9894         * layout.cc: Likewise.
9895         * layout.h: Likewise.
9896         * mapfile.cc: Likewise.
9897         * merge.cc: Likewise.
9898         * merge.h: Likewise.
9899         * object.cc: Likewise.
9900         * object.h: Likewise.
9901         * options.h: Likewise.
9902         * output.cc: Likewise.
9903         * output.h: Likewise.
9904         * parameters.cc: Likewise.
9905         * plugin.cc: Likewise.
9906         * powerpc.cc: Likewise.
9907         * reduced_debug_output.cc: Likewise.
9908         * reduced_debug_output.h: Likewise.
9909         * reloc.cc: Likewise.
9910         * reloc.h: Likewise.
9911         * resolve.cc: Likewise.
9912         * script-sections.cc: Likewise.
9913         * script.cc: Likewise.
9914         * script.h: Likewise.
9915         * sparc.cc: Likewise.
9916         * symtab.cc: Likewise.
9917         * symtab.h: Likewise.
9918         * target-select.cc: Likewise.
9919         * target-select.h: Likewise.
9920         * token.h: Likewise.
9921         * workqueue.cc: Likewise.
9922         * workqueue.h: Likewise.
9923         * x86_64.cc: Likewise.
9924
9925 2009-12-10  Doug Kwan  <dougkwan@google.com>
9926
9927         * arm.cc (attributes.h): New include.
9928         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
9929         (Arm_relobj::~Arm_relobj): Delete object pointed by
9930         attributes_section_data_.
9931         (Arm_relobj::attributes_section_data): New method definition.
9932         (Arm_relobj::attributes_section_data_): New data member declaration.
9933         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
9934         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
9935         attributes_section_data_.
9936         (Arm_dynobj::attributes_section_data): New method definition.
9937         (Arm_dynobj::attributes_section_data_): New data member declaration.
9938         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
9939         initialization value of may_use_blx_ to false.
9940         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
9941         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
9942         object attributes to compute results instead of hard-coding.
9943         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
9944         Target_arm::get_secondary_compatible_arch,
9945         Target_arm::set_secondary_compatible_arch
9946         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9947         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
9948         New method declarations.
9949         (Target_arm::get_aeabi_object_attribute): New method definition.
9950         (Target_arm::attributes_section_data_): New data member declaration.
9951         (read_arm_attributes_section): New template definition.
9952         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
9953         (Arm_dynobj::do_read_symbols): Ditto.
9954         (Target_arm::do_finalize_sections): Merge attributes sections from
9955         input.  Check for BLX use after attributes section merging.
9956         Fix __exidx_start and __exidx_end visibility.  Create an
9957         .ARM.attributes section if necessary.
9958         (Target_arm::get_secondary_compatible_arch,
9959         Target_arm::set_secondary_compatible_arch,
9960         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
9961         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
9962         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
9963         New method definitions.
9964
9965 2009-12-09  Ian Lance Taylor  <iant@google.com>
9966
9967         * plugin.cc (Plugin::load): Don't cast from void* to a function
9968         pointer.
9969
9970 2009-12-09  Ian Lance Taylor  <iant@google.com>
9971
9972         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
9973         information fields.
9974
9975 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
9976
9977         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
9978         Replace two_file_shared_1.so with two_file_shared_2.so.
9979         * testsuite/Makefile.in: Regenerated.
9980
9981 2009-12-08  Doug Kwan  <dougkwan@google.com>
9982
9983         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
9984         (HFILES): Add attributes.h and int_encoding.h.
9985         * Makefile.in: Regenerate.
9986         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
9987         function definitions to int_encoding.cc
9988         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
9989         prototypes to int_encoding.h
9990         * reduced_debug_output.cc (int_encoding.h): New include.
9991         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
9992         function definitions to int_encoding.cc
9993         (insert_into_vector, read_from_pointer): Move template definitions to
9994         int_encoding.h
9995         * attributes.cc: New file.
9996         * attributes.h: New file.
9997         * int_encoding.cc: New file.
9998         * int_encoding.h: New file.
9999
10000 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10001
10002         PR gold/11055
10003         * incremental-dump.cc (dump_incremental_inputs): New.
10004         (main): Use dump_incremental_inputs.
10005
10006 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10007
10008         PR gold/10893
10009         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10010         checking elfcpp::STT_FUNC.
10011         (Target_i386::Relocate::relocate): Likewise.
10012         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10013
10014         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10015         symbols from shared libraries into normal FUNC symbols.
10016
10017         * symtab.h (Symbol): Add is_func and use it.
10018
10019 2009-12-05  Doug Kwan  <dougkwan@google.com>
10020
10021         * arm.cc (Target_arm::arm_info): Initialize new fields
10022         attributes_section and attributes_vendor.
10023         * i386.cc (Target_i386::i386_info): Same.
10024         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10025         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10026         fields attributes_section and attributes_vendor.
10027         * sparc.cc (Target_sparc::sparc_info): Same.
10028         * target.h (Target::attributes_section, Target::attributes_vendor,
10029         Target::is_attributes_section, Target::attribute_arg_type,
10030         Target::attributes_order): New method definitions.
10031         (Target::Target_info::attributes_section,
10032         Target::Target_info::attributes_vendor): New fields.
10033         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10034         virtual method definitions.
10035         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10036         attributes_section and attributes_vendor.
10037         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10038
10039 2009-12-05  Doug Kwan  <dougkwan@google.com>
10040
10041         * arm.cc: Update comments about interworking and stub generation.
10042         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10043         considered as non-PIC.
10044         (Arm_relocate_functions::base_abs): Fix formatting.
10045         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10046         of function to use GOT entry address instead of offset.
10047         (Target_arm::Scan::global): Issue an error if a symbol would need a
10048         PLT does not get one because it is untyped.  Remove code to create
10049         dynamic symbols for relative branches.
10050         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10051         takes unsigned integer instead of boolean.
10052
10053 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10054
10055         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10056         (two_file_test_LDADD): Likewise.
10057         (common_test_1_LDADD): Likewise.
10058         (exception_test_LDADD) Likewise.
10059         (weak_test_LDADD): Likewise.
10060         (many_sections_test_LDADD): Likewise.
10061         (initpri1_LDADD): Likewise.
10062         (script_test_1_LDADD): Likewise.
10063         (script_test_2_LDADD): Likewise.
10064         (justsyms_LDADD): Likewise.
10065         (binary_test_LDADD): Likewise.
10066         (large_LDADD): Likewise.
10067         * testsuite/Makefile.in: Regenerated.
10068
10069 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10070
10071         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10072         (Symbol_table::override_with_special): Likewise.
10073         (Symbol_table::add_from_object): Likewise.
10074
10075 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10076
10077         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10078         Don't set the data_offset twice.
10079
10080 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10081
10082         * testsuite/Makefile.in: Regenerate.
10083
10084 2009-12-03  Doug Kwan  <dougkwan@google.com>
10085
10086         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10087         (Target_arm::do_finalize_sections): Add parameter for symbol table
10088         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10089         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10090         parameter for symbol table pointer.
10091         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10092         an additional parameter for a pointer to symbol table.
10093         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10094         parameter for a symbol table pointer.
10095         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10096         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10097         Ditto.
10098         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10099         parameter for a symbol table pointer.
10100
10101 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10102
10103         * incremental.cc (Incremental_inputs_header)
10104         (Incremental_inputs_header_write, Incremental_inputs_entry)
10105         (Incremental_inputs_entry_write): Move ...
10106         * incremental.h (Incremental_inputs_header)
10107         (Incremental_inputs_header_write, Incremental_inputs_entry)
10108         (Incremental_inputs_entry_write): here.
10109
10110 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10111
10112         * incremental.cc (make_sized_incremental_binary): Set the target.
10113         Error if it is incompatible.
10114         * output.h (Output_file): Add filename method.
10115
10116 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10117
10118         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10119         from the get_* methods.
10120
10121 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10122
10123         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10124         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10125         Write 0 for the data_offset of scripts.
10126
10127 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10128
10129         * testsuite/Makefile.am: Add the incremental_test.sh test.
10130         * testsuite/incremental_test.sh: New.
10131         * testsuite/incremental_test_1.c: New.
10132         * testsuite/incremental_test_2.c: New.
10133
10134 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10135
10136         * incremental-dump.cc (main): Fix typos.
10137
10138 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10139
10140         PR gold/11025
10141         * incremental-dump.cc (main): Use llu to print 64 bit values.
10142
10143 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10144             H.J. Lu  <hongjiu.lu@intel.com>
10145
10146         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10147         $(LIBDL).
10148         (incremental_dump_LDADD): Likewise.
10149         * Makefile.in: Regenerated.
10150
10151 2009-11-25  Doug Kwan  <dougkwan@google.com>
10152
10153         Revert:
10154
10155         2009-11-25  Doug Kwan  <dougkwan@google.com>
10156
10157                 * arm.cc (Target_arm::Target_arm): Move method definition
10158                 outside of class definition.  Add code to handle
10159                 --target1-rel, --target1-abs and --target2= options.
10160                 (Target_arm::get_reloc_reloc_type): Change method to be
10161                 non-static and const.
10162                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10163                 New data member declaration.
10164                 (Target_arm::Scan::local, Target_arm::Scan::global,
10165                 Target_arm::Relocate::relocate,
10166                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10167                 Adjust call to Target_arm::get_real_reloc_type.
10168                 (Target_arm::get_real_reloc_type): Use command line options
10169                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10170                 * options.h (--target1-rel, --target1-abs, --target2): New
10171                 ARM-only options.
10172
10173 2009-11-25  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10176         class definition.  Add code to handle --target1-rel, --target1-abs
10177         and --target2= options.
10178         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10179         and const.
10180         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10181         member declaration.
10182         (Target_arm::Scan::local, Target_arm::Scan::global,
10183         Target_arm::Relocate::relocate,
10184         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10185         call to Target_arm::get_real_reloc_type.
10186         (Target_arm::get_real_reloc_type): Use command line options to
10187         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10188         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10189         options.
10190
10191 2009-11-25  Doug Kwan  <dougkwan@google.com>
10192
10193         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10194         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10195         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10196         formatting.
10197         (Arm_relocate_functions::thm_call): Replace body with a call to
10198         Arm_relocate_functions::thumb_branch_common.
10199         (Arm_relocate_functions::thm_jump24,
10200         Arm_relocate_functions::thm_xpc22): New method definitions.
10201         (Arm_relocate_functions::thumb_branch_common): New method definition.
10202         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10203         operator.
10204         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10205         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10206
10207 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10208
10209         * Makefile.am: Build incremental-dump
10210         * Makefile.in: Regenerate.
10211         * incremental-dump.cc: New.
10212         * incremental.cc (Incremental_inputs_header_data,
10213         Incremental_inputs_entry_data): Move to incremental.h
10214         * incremental.h: (Incremental_inputs_header_data,
10215         Incremental_inputs_entry_data): Move from incremental.cc
10216
10217 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10218
10219         * incremental.cc (Incremental_inputs_header,
10220         Incremental_inputs_header_write, Incremental_inputs_entry,
10221         Incremental_inputs_entry_write): Add a typedef with the data type.
10222
10223 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10224
10225         * incremental.cc (Incremental_inputs_header,
10226         Incremental_inputs_header_write, Incremental_inputs_entry,
10227         Incremental_inputs_entry_write): Update comment about which
10228         type has the filed descriptions.
10229
10230 2009-11-15  Doug Kwan  <dougkwan@google.com>
10231
10232         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10233         (Arm_relocate_functions::arm_branch_common): Change method defintion
10234         in class definition to a method declaration and update list of formal
10235         parameters.
10236         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10237         Arm_relocation_functions::jump24): Adjust call to
10238         Arm_relocate_functions::arm_branch_common.  Update list of formal
10239         parameters.
10240         (Arm_relocate_functions::xpc25): New method definition.
10241         (Arm_relocate_functions::arm_branch_common): Move method defintion
10242         out from class definition.  Use stubs for mode-switching and extending
10243         branch ranges.
10244         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10245         specially.  Change code to enable use of stubs in ARM branches.
10246
10247 2009-11-10  Doug Kwan  <dougkwan@google.com>
10248
10249         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10250         in method declaration.
10251         (Target_arm::relocate_stub): New method declaration.
10252         (Target_arm::default_target): Change to return a pointer instead of
10253         a const reference.
10254         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10255         Target_arm::default_target.
10256         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10257         method definition.
10258         (Target_arm::relocate_section): Adjust view.
10259         (Target_arm::relocate_stub): New method definition.
10260
10261 2009-11-10  Doug Kwan  <dougkwan@google.com>
10262
10263         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10264         a format warning.
10265         * incremental.cc (open_incremental_binary): Initialized local
10266         variables to avoid warnings.
10267         * object.cc (make_elf_object): Ditto.
10268         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10269         a format warning.
10270
10271 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10272
10273         PR gold/10930
10274         * testsuite/plugin_test.c: Include "config.h".
10275
10276 2009-11-09  Doug Kwan  <dougkwan@google.com>
10277
10278         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10279         (arm_symbol_value): Remove.
10280         (Arm_relocate_functions::arm_branch_common,
10281         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10282         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10283         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10284         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10285         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10286         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10287         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10288         Arm_relocate_functions::thm_mobw_abs_nc,
10289         Arm_relocate_functions::thm_mov_abs,
10290         Arm_relocate_functions::movw_prel_nc,
10291         Arm_relocate_functions::thm_movt_abs,
10292         Arm_relocate_functions::movt_prel,
10293         Arm_relocate_functions::thm_movw_prel_nc,
10294         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10295         (Target_arm::Relocate::relocate): Only decompose address into two
10296         parts if relocation type uses the thumb-bit and pass the actual
10297         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10298         calls to methods in Arm_relocate_functions for this change.
10299
10300 2009-11-08  Ian Lance Taylor  <iant@google.com>
10301
10302         PR 10925
10303         * reloc.cc: Instantiate
10304         Sized_relobj::initialize_input_to_output_maps and
10305         Sized_relobj:free_input_to_output_maps.
10306
10307 2009-11-06  Ian Lance Taylor  <iant@google.com>
10308
10309         PR 10876
10310         * defstd.cc (in_segment): Set only_if_ref true for "end".
10311
10312 2009-11-06  Doug Kwan  <dougkwan@google.com>
10313
10314         * arm.cc (class Reloc_stub): Correct a comment.
10315         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10316         (Target_arm::scan_section_for_stubs): New method declaration.
10317         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10318         Change methods from private to protected.
10319         (Target_arm::do_may_relax): New method definition.
10320         (Target_arm::do_relax, Target_arm::group_sections,
10321         Target_arm::scan_reloc_for_stub,
10322         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10323         (Target_arm::arm_input_section_map_): New data member declaration.
10324         (Target_arm::scan_reloc_for_stub,
10325         Target_arm::scan_reloc_section_for_stubs,
10326         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10327         Target_arm::do_relax): New method definitions.
10328
10329 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10330
10331         * configure.ac: Check for (struct stat)::st_mtim
10332         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10333         * config.in: Regenerate.
10334         * configure: Regenerate.
10335
10336 2009-11-05  Ian Lance Taylor  <iant@google.com>
10337
10338         PR 10910
10339         * output.cc (Output_segment::add_output_section): Add missing
10340         return statement.
10341
10342 2009-11-04  Ian Lance Taylor  <iant@google.com>
10343
10344         PR 10880
10345         * object.h (class Object): Add is_needed and set_is_needed
10346         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10347         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10348         defined in a dynamic object and referenced by a regular object,
10349         set is_needed for the dynamic object.
10350         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10351         if the file is marked with as_needed and it is not needed.
10352
10353 2009-11-04  Ian Lance Taylor  <iant@google.com>
10354
10355         PR 10887
10356         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10357         tags if data is discarded by linker script.
10358         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10359         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10360         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10361         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10362
10363 2009-11-04  Ian Lance Taylor  <iant@google.com>
10364
10365         * layout.cc (Layout::get_output_section): Add is_interp and
10366         is_dynamic_linker_section parameters.  Change all callers.
10367         (Layout::choose_output_section): Likewise.
10368         (Layout::make_output_section): Likewise.
10369         (Layout::add_output_section_data): Add is_dynamic_linker_section
10370         parameter.  Change all callers.
10371         * layout.h (class Layout): Update declarations.
10372         * output.h (class Output_section): Add is_interp, set_is_interp,
10373         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10374         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10375         generate_code_fills_at_write_ to a bitfield.
10376         * output.cc (Output_section::Output_sections): Initialize new
10377         fields.
10378         (Output_segment::add_output_section): Add do_sort parameter.
10379         Change all callers.
10380
10381 2009-11-03  Ian Lance Taylor  <iant@google.com>
10382
10383         PR 10860
10384         * options.h (class General_options): Add --warn-common.
10385         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10386         merging two common symbols.
10387         (Symbol_table::should_override): Handle --warn-common when merging
10388         a common symbol with a defined symbol.  Use report_resolve_problem
10389         for multiple definitions.
10390         (Symbol_table::report_resolve_problem): New function.
10391         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10392
10393 2009-11-03  Doug Kwan  <dougkwan@google.com>
10394
10395         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10396         stub_factory_.
10397         (Target_arm::stub_factory): New method definition.
10398         (Target_arm::new_arm_input_section,
10399         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10400         Target_arm::reloc_uses_thumb_bit): New method declarations.
10401         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10402         New type definitions.
10403         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10404         member declarations.
10405         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10406         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10407         New method definitions.
10408
10409 2009-11-03  Ian Lance Taylor  <iant@google.com>
10410
10411         * options.h (class General_options): Add --warn_constructors.
10412
10413 2009-11-03  Ian Lance Taylor  <iant@google.com>
10414
10415         PR 10893
10416         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10417         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10418
10419 2009-11-03  Ian Lance Taylor  <iant@google.com>
10420
10421         PR 10895
10422         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10423         --msgid-bugs-address.
10424         (install-pdf): New target.
10425         (install-data_yes): Look up one directory to find mkinstalldirs.
10426
10427 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10428
10429         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10430         tree.
10431
10432 2009-10-30  Doug Kwan  <dougkwan@google.com>
10433
10434         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10435
10436 2009-10-30  Doug Kwan  <dougkwan@google.com>
10437
10438         * arm.cc (Stub_addend_reader): New struct template definition
10439         and partial specializations.
10440         (Stub_addend_reader::operator()): New method definition for a
10441         partially specialized template.
10442
10443 2009-10-30  Doug Kwan  <dougkwan@google.com>
10444
10445         * arm.cc (Arm_relobj::processor_specific_flags): New method
10446         definition.
10447         (Arm_relobj::do_read_symbols): New method declaration.
10448         (Arm_relobj::processor_specific_flags_): New data member declaration.
10449         (Arm_dynobj): New class definition.
10450         (Target_arm::do_finalize_sections): Add input_objects parameter.
10451         (Target_arm::do_adjust_elf_header): New method declaration.
10452         (Target_arm::are_eabi_versions_compatible,
10453         (Target_arm::merge_processor_specific_flags): New method declaration.
10454         (Target_arm::do_make_elf_object): New overloaded method definitions
10455         and declaration.
10456         (Arm_relobj::do_read_symbols): New method definition.
10457         (Arm_dynobj::do_read_symbols): Ditto.
10458         (Target_arm::do_finalize_sections): Add input_objects parameters.
10459         Merge processor-specific flags from all input objects.
10460         (Target_arm::are_eabi_versions_compatible,
10461         Target_arm::merge_processor_specific_flags,
10462         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10463         New method definitions.
10464         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10465         Input_objects pointer type parameter.
10466         * layout.cc (Layout::finalize): Pass input objects to target's.
10467         finalize_sections function.
10468         * output.cc (Output_file_header::do_sized_write): Set ELF file
10469         header's processor-specific flags.
10470         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10471         Input_objects pointer type parameter.
10472         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10473         * target.h (Input_objects): New forward class declaration.
10474         (Target::processor_specific_flags,
10475         Target::are_processor_specific_flags_sect): New method definitions.
10476         (Target::finalize_sections): Add input_objects parameter.
10477         (Target::Target): Initialize processor_specific_flags_ and
10478         are_processor_specific_flags_set_.
10479         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10480         parameter.
10481         (Target::set_processor_specific_flags): New method definition.
10482         (Target::processor_specific_flags_,
10483         Target::are_processor_specific_flags_set_): New data member
10484         declarations.
10485         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10486         Input_objects pointer type parameter.
10487
10488 2009-10-30  Doug Kwan  <dougkwan@google.com>
10489
10490         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10491
10492 2009-10-28  Ian Lance Taylor  <iant@google.com>
10493
10494         * object.h (class Relobj): Drop options parameter from
10495         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10496         do_scan_relocs, do_relocate.  Change all callers.
10497         (class Sized_relobj): Drop options parameters from
10498         do_gc_process_relocs, do_scan_relocs, do_relocate,
10499         do_relocate_sections, relocate_sections, emit_relocs_scan,
10500         emit_relocs_scan_reltype.  Change all callers.
10501         (struct Relocate_info): Remove options field and all references to
10502         it.
10503         * reloc.h (class Read_relocs): Remove options constructor
10504         parameter and options_ field.  Change all callers.
10505         (class Gc_process_relocs, class Scan_relocs): Likewise.
10506         (class Relocate_task): Likewise.
10507         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10508         all callers.
10509         (scan_relocatable_relocs): Likewise.
10510         * target.h (class Sized_target): Remove options parameter from
10511         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10512         all callers.
10513         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10514         callers.
10515         * arm.cc: Update functions to remove options parameters.
10516         * i386.cc: Likewise.
10517         * powerpc.cc: Likewise.
10518         * sparc.cc: Likewise.
10519         * x86_64.cc: Likewise.
10520         * testsuite/testfile.cc: Likewise.
10521
10522 2009-10-28  Doug Kwan  <dougkwan@google.com>
10523
10524         * arm.cc (Arm_relobj): New class definition.
10525         (Arm_relobj::scan_sections_for_stubs,
10526         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10527         New method definitions.
10528
10529 2009-10-28  Cary Coutant  <ccoutant@google.com>
10530
10531         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10532         (Plugin::cleanup_done_): New member.
10533         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10534         (Plugin_manager::cleanup_done_): Remove.
10535         (Plugin_manager::add_input_file): Edit error message.
10536         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10537         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10538
10539 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10540
10541         * fileread.cc: (File_read::View::~View): Use the new
10542         data_ownership_ filed.
10543         (File_read::~File_read): Dispose the new whole_file_view_.
10544         (File_read::open): Mmap the whole file if needed.
10545         (File_read::open): Use whole_file_view_ instead of contents_.
10546         (File_read::find_view): Use whole_file_view_ if applicable.
10547         (File_read::do_read): Use whole_file_view_ instead of contents_.
10548         (File_read::make_view): Use whole_file_view_ instead of contents_,
10549         update File_read::View::View call.
10550         (File_read::find_or_make_view): Update File_read::View::View
10551         call.
10552         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10553         remove contents_
10554         (File_read::View::Data_ownership): New enum.
10555         (File_read::View::View): Replace bool mapped_ with Data_ownership
10556         argument.
10557         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10558         (File_read::View::data_ownership_): New field.
10559         (File_read::contents_): Remove (replaced by whole_file_view_).
10560         (File_read::whole_file_view_): New field.
10561         * options.h (class General_options): Add --keep-files-mapped.
10562
10563 2009-10-27  Cary Coutant  <ccoutant@google.com>
10564
10565         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10566         * testsuite/Makefile.am (plugin_test_5): New test case.
10567         * testsuite/Makefile.in: Regenerate.
10568
10569 2009-10-25  Doug Kwan  <dougkwan@google.com>
10570
10571         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10572         from private to protected to allow access by child class.
10573         (Sized_relobj::do_relocate_sections): New method declaration.
10574         (Sized_relobj::relocate_sections): Virtualize.
10575         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10576         Sized_relobj::relocate_sections.  Instantiate template explicitly
10577         for different target sizes and endianity.
10578
10579 2009-10-24  Doug Kwan  <dougkwan@google.com>
10580
10581         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10582         (Arm_input_section::as_arm_input_section): New method.
10583         (Arm_output_section): New class definition.
10584         (Arm_output_section::create_stub_group,
10585         Arm_output_section::group_sections): New method definitions.
10586
10587 2009-10-22  Doug Kwan  <dougkwan@google.com>
10588
10589         * arm.cc (Arm_input_section): New class definition.
10590         (Arm_input_section::init, Arm_input_section:do_write,
10591         Arm_input_section::set_final_data_size,
10592         Arm_input_section::do_reset_address_and_file_offset): New method
10593         definitions.
10594
10595 2009-10-21  Doug Kwan  <dougkwan@google.com>
10596
10597         * arm.cc (Stub_table, Arm_input_section): New forward class
10598         declarations.
10599         (Stub_table): New class defintion.
10600         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10601         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10602         New method definition.
10603
10604 2009-10-21  Doug Kwan  <dougkwan@google.com>
10605
10606         * arm.cc: Update copyright comments.
10607         (Target_arm): New forward class template declaration.
10608         (Arm_address): New type.
10609         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10610         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10611         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10612         constants.
10613         (Insn_template): Same.
10614         (DEF_STUBS): New macro.
10615         (Stub_type): New enum type.
10616         (Stub_template): New class definition.
10617         (Stub): Same.
10618         (Reloc_stub): Same.
10619         (Stub_factory): Same.
10620         (Target_arm::Target_arm): Initialize may_use_blx_ and
10621         should_force_pic_veneer_.
10622         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10623         Target_arm::should_force_pic_veneer,
10624         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10625         Target_arm::using_thumb_only, Target_arm:;default_target): New
10626         method defintions.
10627         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10628         New data member declarations.
10629         (Insn_template::size, Insn_template::alignment): New method defintions.
10630         (Stub_template::Stub_template): New method definition.
10631         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10632         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10633         (Stub_factory::Stub_factory): New method definition.
10634         * gold.h (string_hash): New template.
10635         * output.h (Input_section_specifier::hash_value): Use
10636         gold::string_hash.
10637         (Input_section_specifier::string_hash): Remove.
10638         * stringpool.cc (Stringpool_template::string_hash): Use
10639         gold::string_hash.
10640
10641 2009-10-20  Doug Kwan  <dougkwan@google.com>
10642
10643         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10644         symbols of relaxed input sections.
10645         * output.h (Output_section::find_relaxed_input_section): Make
10646         method public.
10647
10648 2009-10-16  Doug Kwan  <dougkwan@google.com>
10649
10650         * dynobj.cc (Versions::Versions): Initialize version_script_.
10651         Only insert base version symbol definition for a shared object
10652         if version script defines any version versions.
10653         (Versions::define_base_version): New method definition.
10654         (Versions::add_def): Check that base version is not needed.
10655         (Versions::add_need): Define base version lazily.
10656         * dynobj.h (Versions::define_base_version): New method declaration.
10657         (Versions::needs_base_version_): New data member declaration.
10658         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10659         (check_DATA): Add no_version_test.stdout.
10660         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10661         New make rules.
10662         * testsuite/Makefile.in: Regenerate.
10663         * testsuite/no_version_test.c: New file.
10664         * testsuite/no_version_test.sh: Ditto.
10665
10666 2009-10-16  Doug Kwan  <dougkwan@google.com>
10667
10668         * expression.cc (class Segment_start_expression): New class definition.
10669         (Segment_start_expression::value): New method definition.
10670         (script_exp_function_segment_start): Return a new
10671         Segment_start_expression.
10672         * gold/script-c.h (script_saw_segment_start_expression): New function
10673         prototype.
10674         * script-sections.cc (Script_sections::Script_sections): Initialize
10675         SAW_SEGMENT_START_EXPRESSION_ to false.
10676         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10677         and -Tbbs options to specify section addresses if given in
10678         command line and no SEGMENT_START expression is seen in a script.
10679         * script-sections.h (Script_sections::saw_segment_start_expression,
10680         Script_sections::set_saw_segment_start_expression): New method
10681         definition.
10682         (Script_sections::saw_segment_start_expression_): New data member
10683         declaration.
10684         * script.cc (script_saw_segment_start_expression): New function.
10685         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10686         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10687         script_test_7.sh and script_test_8.sh.
10688         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10689         script_test_8.stdout.
10690         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10691         (script_test_6, script_test_6.stdout, script_test_7,
10692         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10693         * Makefile.in: Regenerate.
10694         * testsuite/script_test_6.sh: New file.
10695         * testsuite/script_test_6.t: Same.
10696         * testsuite/script_test_7.sh: Same.
10697         * testsuite/script_test_7.t: Same.
10698         * testsuite/script_test_8.sh: Same.
10699
10700 2009-10-16  Doug Kwan  <dougkwan@google.com>
10701
10702         * output.cc (Output_segment::set_section_list_address): Cast
10703         expressions to unsigned long long type to avoid format warnings.
10704
10705 2009-10-15  Ian Lance Taylor  <iant@google.com>
10706
10707         * script.cc (Script_options::add_symbol_assignment): Always add a
10708         dot assignment to script_sections_.
10709         * script-sections.cc (Script_sections::add_dot_assignment):
10710         Initialize if necessary.
10711
10712         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10713         program headers with no load segment if there is a linker script.
10714
10715         * layout.cc (Layout::set_segment_offsets): Align the file offset
10716         to the segment aligment for -N or -n with no load segment.
10717         * output.cc (Output_segment::add_output_section): Don't crash if
10718         the first section is a TLS section.
10719         (Output_segment::set_section_list_addresses): Print an error
10720         message if the address moves backward in a linker script.
10721         * script-sections.cc
10722         (Output_section_element_input::set_section_addresses): Don't
10723         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10724         (Orphan_output_section::set_section_addresses): Likewise.
10725
10726 2009-10-15  Doug Kwan  <dougkwan@google.com>
10727
10728         * layout.cc (Layout::finish_dynamic_section): Generate tags
10729         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10730         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10731         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10732
10733 2009-10-14  Ian Lance Taylor  <iant@google.com>
10734
10735         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10736         fields.
10737         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10738         data_shdr fields of relinfo.
10739         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10740         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10741         R_386_TLS_LDO_32, adjust based on section flags.
10742         (Target_i386::Relocate::fix_up_ldo): Remove.
10743
10744 2009-10-13  Ian Lance Taylor  <iant@google.com>
10745
10746         Add support for -pie.
10747         * options.h (class General_options): Add -pie and
10748         --pic-executable.
10749         (General_options::output_is_position_independent): Test -pie.
10750         (General_options::output_is_executable): Return true if not shared
10751         and not relocatable.
10752         (General_options::output_is_pie): Remove.
10753         * options.cc (General_options::finalize): Reject incompatible uses
10754         of -pie.
10755         * gold.cc (queue_middle_tasks): A -pie link is not static.
10756         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10757         * symtab.cc (Symbol::final_value_is_known): Return false if
10758         output_is_position_independent.
10759         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10760         output_is_position_independent.
10761         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10762         output_is_position_independent.
10763         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10764         output_is_position_independent.
10765         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10766         two_file_pie_test.
10767         (basic_pie_test.o, basic_pie_test): New targets.
10768         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10769         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10770         (two_file_pie_test): New target.
10771         * testsuite/Makefile.in: Rebuild.
10772         * README: Remove note saying that -pie is not supported.
10773
10774 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10775
10776         * options.h (class General_options): Add -init and -fini.
10777         * layout.cc (Layout::finish_dynamic_section): Emit
10778         given init and fini functions.
10779
10780 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10781
10782         * gc.h (gc_process_relocs): Check if icf is enabled using new
10783         function.
10784         * gold.cc (queue_initial_tasks): Likewise.
10785         (queue_middle_tasks): Likewise.
10786         * object.cc (do_layout): Likewise.
10787         * symtab.cc (is_section_folded): Likewise.
10788         * main.cc (main): Likewise.
10789         * reloc.cc (Read_relocs::run): Likewise.
10790         (Sized_relobj::do_scan_relocs): Likewise.
10791         * icf.cc (is_function_ctor_or_dtor): New function.
10792         (Icf::find_identical_sections): Check if function is ctor or dtor when
10793         safe icf is chosen.
10794         * options.h (General_options::icf): Change option to be an enum.
10795         (Icf_status): New enum.
10796         (icf_enabled): New method.
10797         (icf_safe_folding): New method.
10798         (set_icf_status): New method.
10799         (icf_status_): New variable.
10800         * (options.cc) (General_options::finalize): Set icf_status_.
10801         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10802         icf_test and icf_keep_unique_test to use the --icf enum flag.
10803         * testsuite/icf_safe_test.sh: New file.
10804         * testsuite/icf_safe_test.cc: New file.
10805
10806 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10807
10808         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10809         includes to gc.h and icf.h.
10810         * arm.cc: Include gc.h.
10811         * gold.cc: Likewise.
10812         * i386.cc: Likewise.
10813         * powerpc.cc: Likewise.
10814         * sparc.cc: Likewise.
10815         * x86_64.cc: Likewise.
10816         * gc.h: Include icf.h.
10817
10818 2009-10-11  Ian Lance Taylor  <iant@google.com>
10819
10820         * plugin.cc: Include "gold.h" before other header files.
10821
10822 2009-10-10  Chris Demetriou  <cgd@google.com>
10823
10824         * options.h (Input_file_argument::Input_file_type): New enum.
10825         (Input_file_argument::is_lib_): Replace with...
10826         (Input_file_argument::type_): New member.
10827         (Input_file_argument::Input_file_argument): Take Input_file_type
10828         'type' rather than boolean 'is_lib' as second argument.
10829         (Input_file_argument::is_lib): Use type_.
10830         (Input_file_argument::is_searched_file): New function.
10831         (Input_file_argument::may_need_search): Handle is_searched_file.
10832         * options.cc (General_options::parse_library): Support -l:filename.
10833         (General_options::parse_just_symbols): Update for Input_file_argument
10834         changes.
10835         (Command_line::process): Likewise.
10836         * archive.cc (Archive::get_file_and_offset): Likewise.
10837         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10838         * script.cc (read_script_file, script_add_file): Likewise.
10839         * fileread.cc (Input_file::Input_file): Likewise.
10840         (Input_file::will_search_for): Handle is_searched_file.
10841         (Input_file::open): Likewise.
10842         * readsyms.cc (Read_symbols::get_name): Likewise.
10843         * testsuite/Makefile.am (searched_file_test): New test.
10844         * testsuite/Makefile.in: Regenerate.
10845         * testsuite/searched_file_test.cc: New file.
10846         * testsuite/searched_file_test_lib.cc: New file.
10847
10848 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10849             Ian Lance Taylor  <iant@google.com>
10850
10851         * descriptor.cc: Include <cstdio> and "binary-io.h".
10852         (Descriptors::open): Open the files in binary mode always.
10853         * script.cc (Lex::get_token): Treat \r as whitespace.
10854
10855 2009-10-09  Ian Lance Taylor  <iant@google.com>
10856
10857         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10858
10859 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10860             Ian Lance Taylor  <iant@google.com>
10861
10862         * configure.ac: Check for readv function also.
10863         * fileread.cc (readv): Define if not HAVE_READV.
10864         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10865         does not exist.
10866         * config.in: Regenerate.
10867         * configure: Regenerate.
10868
10869 2009-10-09  Doug Kwan  <dougkwan@google.com>
10870
10871         * layout.cc (Layout::make_output_section): Call target hook to make
10872         ordinary output section.
10873         (Layout::finalize): Adjust parameter list of call the
10874         Target::may_relax().
10875         * layout.h (class Layout::section_list): New method.
10876         * merge.h (Output_merge_base::entsize): Change visibility to public.
10877         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10878         New methods.
10879         (Output_merge_string::do_is_string): New method.
10880         * object.cc (Sized_relobj::do_setup): renamed from
10881         Sized_relobj::set_up.
10882         * object.h (Sized_relobj::adjust_shndx,
10883         Sized_relobj::initializ_input_to_output_maps,
10884         Sized_relobj::free_input_to_output_maps): Change visibilities to
10885         protected.
10886         (Sized_relobj::setup): Virtualize.
10887         (Sized_relobj::do_setup): New method declaration.
10888         (Sized_relobj::invalidate_section_offset,
10889         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10890         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10891         * options.cc (parse_int): New function.
10892         * options.h (parse_int): New declaration.
10893         (DEFINE_int): New macro.
10894         (stub_group_size): New option.
10895         * output.cc (Output_section::Output_section): Initialize memebers
10896         merge_section_map_, merge_section_by_properties_map_,
10897         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
10898         (Output_section::add_input_section): Handled deferred code-fill
10899         generation and remove an old comment.
10900         (Output_section::add_relaxed_input_section): New method definition.
10901         (Output_section::add_merge_input_section): Use merge section by
10902         properties map to speed to search.  Update merge section maps
10903         as appropriate.
10904         (Output_section::build_relaxation_map): New method definition.
10905         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
10906         Same.
10907         (Output_section::relax_input_section): Renamed to
10908         Output_section::convert_input_sections_to_relaxed_sections and change
10909         interface to take a vector of pointers to relaxed sections.
10910         (Output_section::find_merge_section,
10911         Output_section::find_relaxed_input_section): New method definitions.
10912         (Output_section::is_input_address_mapped,
10913         Output_section::output_offset, Output_section::output_address):
10914         Use output section data maps to speed up searching.
10915         (Output_section::find_starting_output_address): Add comments.
10916         (Output_section::do_write,
10917         Output_section::write_to_postprocessing_buffer): Do code-fill
10918         generation as appropriate.
10919         (Output_section::get_input_sections): Invalidate relaxed input section
10920         map.
10921         (Output_section::restore_states): Adjust type of checkpoint .
10922         Invalidate relaxed input section map.
10923         * output.h (Output_merge_base): New class declaration.
10924         (Input_section_specifier): New class defintion.
10925         (class Output_relaxed_input_section) Change base class to
10926         Output_section_data_build.
10927         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
10928         base class initializer.
10929         (Output_section::add_relaxed_input_section): New method declaration.
10930         (Output_section::Input_section): Change visibility to protected.
10931         (Output_section::Input_section::relobj,
10932         Output_section::Input_section::shndx): Handle relaxed input sections.
10933         Output_section::input_sections) Change visibility to protected.  Also
10934         define overload to return a non-const pointer.
10935         (Output_section::Merge_section_properties): New class defintion.
10936         (Output_section::Merge_section_by_properties_map,
10937         Output_section::Output_section_data_by_input_section_map,
10938         Output_section::Relaxation_map): New types.
10939         (Output_section::relax_input_section): Rename method to
10940         Output_section::convert_input_sections_to_relaxed_sections and change
10941         interface to take a vector of relaxed section pointers.
10942         (Output_section::find_merge_section,
10943         Output_section::find_relaxed_input_section,
10944         Output_section::build_relaxation_map,
10945         Output_section::convert_input_sections_in_list_to_relaxed_sections):
10946         New method declarations.
10947         (Output_section::merge_section_map_
10948         Output_section::merge_section_by_properties_map_,
10949         Output_section::relaxed_input_section_map_,
10950         Output_section::is_relaxed_input_section_map_valid_,
10951         Output_section::generate_code_fills_at_write_): New data members.
10952         * script-sections.cc
10953         (Output_section_element_input::set_section_addresses): Call
10954         current_data_size and addralign methods of relaxed input sections.
10955         (Orphan_output_section::set_section_addresses): Call current_data_size
10956         and addralign methods of relaxed input sections.
10957         * symtab.cc (Symbol_table::compute_final_value): Extract template
10958         from the body of Symbol_table::sized_finalize_symbol.
10959         (Symbol_table::sized_finalized_symbol): Call
10960         Symbol_table::compute_final_value.
10961         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
10962         (Symbol_table::compute_final_value): New templated method declaration.
10963         * target.cc (Target::do_make_output_section): New method defintion.
10964         * target.h (Target::make_output_section): New method declaration.
10965         (Target::relax): Add more parameters for input objects, symbol table
10966         and layout.  Adjust call to do_relax.
10967         (Target::do_make_output_section): New method declaration.
10968         (Target::do_relax): Add parameters for input objects, symbol table
10969         and layout.
10970
10971 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10972
10973         * pread.c: Include stdio.h.
10974
10975 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10976
10977         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
10978         defined.
10979
10980 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10981
10982         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
10983         Change read_shndx type to unsigned int.
10984         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10985         int.
10986         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10987         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
10988         Change read_shndx type to unsigned int.
10989         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
10990         int.
10991         (Sized_dwarf_line_info::read_line_mappings): Likewise.
10992         * layout.cc (Layout::create_symtab_sections): Cast the result of
10993         local_symcount * symsize to off_t in the gold_assert.
10994
10995 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
10996
10997         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
10998         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
10999         R_ARM_BASE_ABS.
11000         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11001         (Arm_relocate_functions::thm_abs5): New function.
11002         (Arm_relocate_functions::abs12): New function.
11003         (Arm_relocate_functions::abs16): New function.
11004         (Arm_relocate_functions::base_abs): New function.
11005         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11006         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11007         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11008         R_ARM_BASE_ABS.
11009         (Scan::global): Likewise.
11010         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11011         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11012         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11013         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11014         R_ARM_BASE_ABS.
11015
11016 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11017
11018         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11019         (Arm_relocate_functions::movt_prel): New function.
11020         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11021         (Arm_relocate_functions::thm_movt_prel): New function.
11022         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11023         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11024         (Scan::global, Relocate::relocate): Likewise.
11025         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11026
11027 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11028
11029         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11030         Incremental_checker.
11031         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11032         unsigned int.
11033         (class Incremental_inputs_header): New class.
11034         (Incremental_inputs_header_writer): Edit comment.
11035         (Incremental_inputs_entry): New class.
11036         (Incremental_inputs_entry_writer): Edit comment.
11037         (Sized_incremental_binary::do_find_incremental_inputs_section):
11038         Add *strtab_shndx parameter, fill it.
11039         (Sized_incremental_binary::do_check_inputs): New method.
11040         (Incremental_checker::can_incrementally_link_output_file): Use
11041         Sized_incremental_binary::check_inputs.
11042         (Incremental_inputs::report_command_line): Save command line in
11043         command_line_.
11044         * incremental.h:
11045         (Incremental_binary::find_incremental_inputs_section): New
11046         method.
11047         (Incremental_binary::do_find_incremental_inputs_section): Add
11048         strtab_shndx parameter.
11049         (Incremental_binary::do_check_inputs): New pure virtual method.
11050         (Sized_incremental_binary::do_check_inputs): Declare.
11051         (Incremental_checker::Incremental_checker): Add incremental_inputs
11052         parameter, use it to initialize incremental_inputs_.
11053         (Incremental_checker::incremental_inputs_): New field.
11054         (Incremental_checker::command_line): New method.
11055         (Incremental_checker::inputs): New method.
11056         (Incremental_checker::command_line_): New field.
11057
11058 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11059
11060         * incremental.cc: Include <cstdarg> and "target-select.h".
11061         (vexplain_no_incremental): New function.
11062         (explain_no_incremental): New function.
11063         (Incremental_binary::error): New method.
11064         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11065         method.
11066         (make_sized_incremental_binary): New function.
11067         (open_incremental_binary): New function.
11068         (can_incrementally_link_file): Add checks if output is ELF and has
11069         inputs section.
11070         * incremental.h: Include "elfcpp_file.h" and "output.h".
11071         (Incremental_binary): New class.
11072         (Sized_incremental_binary): New class.
11073         (open_incremental_binary): Declare.
11074         * object.cc (is_elf_object): Use
11075         elfcpp::Elf_recognizer::is_elf_file.
11076         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11077         * output.h (Output_file::filesize): New method.
11078
11079 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11080
11081         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11082         New function.
11083         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11084         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11085         function.
11086         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11087         function.
11088         (Arm_relocate_functions::movw_abs_nc): New function.
11089         (Arm_relocate_functions::movt_abs): New function.
11090         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11091         (Arm_relocate_functions::thm_movt_abs): New function.
11092         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11093         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11094         (Scan::global): Likewise.
11095         (Relocate::relocate): Likewise.
11096         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11097
11098 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11099
11100         * arm.cc (Arm_relocate_functions::got_prel) New function.
11101         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11102         (Relocate::relocate): Likewise.
11103         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11104
11105 2009-10-06  Ian Lance Taylor  <iant@google.com>
11106
11107         * options.h (class General_options): Define
11108         split_stack_adjust_size parameter.
11109         * object.h (class Object): Add uses_split_stack_ and
11110         has_no_split_stack_ fields.  Add uses_split_stack and
11111         has_no_split_stack accessor functions.  Declare
11112         handle_split_stack_section.
11113         (class Reloc_symbol_changes): Define.
11114         (class Sized_relobj): Define Function_offsets.  Declare
11115         split_stack_adjust, split_stack_adjust_reltype, and
11116         find_functions.
11117         * object.cc (Object::handle_split_stack_section): New function.
11118         (Sized_relobj::do_layout): Call handle_split_stack_section.
11119         * dynobj.cc (Sized_dynobj::do_layout): Call
11120         handle_split_stack_section.
11121         * reloc.cc (Sized_relobj::relocate_sections): Call
11122         split_stack_adjust for executable sections in split_stack
11123         objects.  Pass reloc_map to relocate_section.
11124         (Sized_relobj::split_stack_adjust): New function.
11125         (Sized_relobj::split_stack_adjust_reltype): New function.
11126         (Sized_relobj::find_functions): New function.
11127         * target-reloc.h: Include "object.h".
11128         (relocate_section): Add reloc_symbol_changes parameter.  Change
11129         all callers.
11130         * target.h (class Target): Add calls_non_split method.  Declare
11131         do_calls_non_split virtual method.  Declare match_view and
11132         set_view_to_nop.
11133         * target.cc: Include "elfcpp.h".
11134         (Target::do_calls_non_split): New function.
11135         (Target::match_view): New function.
11136         (Target::set_view_to_nop): New function.
11137         * gold.cc (queue_middle_tasks): Give an error if mixing
11138         split-stack and non-split-stack objects with -r.
11139         * i386.cc (Target_i386::relocate_section): Add
11140         reloc_symbol_changes parameter.
11141         (Target_i386::do_calls_non_split): New function.
11142         * x86_64.cc (Target_x86_64::relocate_section): Add
11143         reloc_symbol_changes parameter.
11144         (Target_x86_64::do_calls_non_split): New function.
11145         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11146         parameter.
11147         * powerpc.cc (Target_powerpc::relocate_section): Add
11148         reloc_symbol_changes parameter.
11149         * sparc.cc (Target_sparc::relocate_section): Add
11150         reloc_symbol_changes parameter.
11151         * configure.ac: Call AM_CONDITIONAL for the default target.
11152         * configure: Rebuild.
11153         * testsuite/Makefile.am (TEST_AS): New variable.
11154         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11155         (check_DATA): Add split_i386 and split_x86_64 files.
11156         (SPLIT_DEFSYMS): Define.
11157         (split_i386_[1234n].o): New targets.
11158         (split_i386_[124]): New targets.
11159         (split_i386_[1234r].stdout): New targets.
11160         (split_x86_64_[1234n].o): New targets.
11161         (split_x86_64_[124]): New targets.
11162         (split_x86_64_[1234r].stdout): New targets.
11163         (MOSTLYCLEANFILES): Add new executables.
11164         * testsuite/split_i386.sh: New file.
11165         * testsuite/split_x86_64.sh: New file.
11166         * testsuite/split_i386_1.s: New file.
11167         * testsuite/split_i386_2.s: New file.
11168         * testsuite/split_i386_3.s: New file.
11169         * testsuite/split_i386_4.s: New file.
11170         * testsuite/split_i386_n.s: New file.
11171         * testsuite/split_x86_64_1.s: New file.
11172         * testsuite/split_x86_64_2.s: New file.
11173         * testsuite/split_x86_64_3.s: New file.
11174         * testsuite/split_x86_64_4.s: New file.
11175         * testsuite/split_x86_64_n.s: New file.
11176         * testsuite/testfile.cc (Target_test): Update relocation_section
11177         function.
11178         * testsuite/Makefile.in: Rebuild.
11179
11180 2009-10-06  Ian Lance Taylor  <iant@google.com>
11181
11182         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11183         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11184         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11185         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11186         the address on ldo_addrs_.
11187         (Target_i386::Relocate::fix_up_ldo): New function.
11188
11189 2009-10-06   Rafael Espindola  <espindola@google.com>
11190
11191         * plugin.cc (add_input_library): New.
11192         (Plugin::load): Add add_input_library to tv.
11193         (Plugin_manager::add_input_file): Add the is_lib argument.
11194         (add_input_file): Update call to Plugin_manager::add_input_file.
11195         (add_input_library): New.
11196         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11197
11198 2009-09-30  Doug Kwan  <dougkwan@google.com>
11199
11200         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11201         symbol and call Symbol::may_need_copy_reloc to determine if
11202         a copy reloc is needed.
11203         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11204         nocopyreloc is given in command line.
11205         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11206         given in command line.
11207         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11208         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11209         of the removed Target_i386::may_need_copy_reloc.
11210         * options.h (copyreloc): New option with default value false.
11211         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11212         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11213         instead of the removed Target_powerpc::may_need_copy_reloc.
11214         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11215         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11216         instead of the removed Target_sparc::may_need_copy_reloc.
11217         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11218         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11219         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11220         instead of the removed Target_x86_64::may_need_copy_reloc.
11221
11222 2009-09-30  Ian Lance Taylor  <iant@google.com>
11223
11224         * object.h (class Object): Remove target_ field, and target,
11225         sized_target, and set_target methods.
11226         (Object::sized_target): Remove.
11227         (class Sized_relobj): Update declarations.  Remove sized_target.
11228         * object.cc (Sized_relobj::setup): Remove target parameter.
11229         Change all callers.
11230         (Input_objects::add_object): Don't do anything with the target.
11231         (make_elf_sized_object): Add punconfigured parameter.  Change all
11232         callers.  Set or test parameter target.
11233         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11234         Change all callers.
11235         * parameters.cc (Parameters::set_target): Change parameter type to
11236         be non-const.
11237         (Parameters::default_target): Remove.
11238         (set_parameters_target): Change parameter type to be non-const.
11239         (parameters_force_valid_target): New function.
11240         (parameters_clear_target): New function.
11241         * parameters.h (class Parameters): Update declarations.  Remove
11242         default_target method.  Add sized_target and clear_target
11243         methods.  Change target_ to be non-const.
11244         (set_parameters_target): Update declaration.
11245         (parameters_force_valid_target): Declare.
11246         (parameters_clear_target): Declare.
11247         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11248         as NULL if we aren't searching.
11249         (Add_symbols::run): Don't check for compatible target.
11250         * fileread.cc (Input_file::open_binary): Call
11251         parameters_force_valid_target.
11252         * gold.cc (queue_middle_tasks): Likewise.
11253         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11254         set_target on object.
11255         * dynobj.h (class Sized_dynobj): Update declarations.
11256         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11257         make_elf_object returns NULL.
11258         (Archive::include_member): Don't check whether object target is
11259         compatible.
11260         * output.cc (Output_section::add_input_section): Get target from
11261         parameters.
11262         (Output_section::relax_input_section): Likewise.
11263         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11264         parameters.
11265         (Sized_relobj::do_scan_relocs): Likewise.
11266         (Sized_relobj::relocate_sections): Likewise.
11267         * resolve.cc (Symbol_table::resolve): Likewise.
11268         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11269         parameter.  Change all callers.
11270         (Symbol_table::add_from_object): Get target from parameters.
11271         (Symbol_table::add_from_relobj): Don't check object target.
11272         (Symbol_table::add_from_dynobj): Likewise.
11273         (Symbol_table::define_special_symbol): Get target from
11274         parameters.
11275         * symtab.h (class Symbol_table): Update declaration.
11276         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11277         parameter.  Change all callers.  Clear parameter target.
11278         (Binary_test): Test target here.
11279         * testsuite/object_unittest.cc (gold_testsuite): Remove
11280         target_test_pointer parameter.  Change all callers.
11281         (Object_test): Test target here.
11282
11283 2009-09-26  Ian Lance Taylor  <iant@google.com>
11284
11285         * testsuite/initpri1.c: Don't try to use constructor priorities if
11286         compiling with gcc before 4.3.
11287
11288 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11289
11290         * testsuite/retain_symbols_file_test.sh (check_present): Change
11291         output file name to retain_symbols_file_test.stdout.
11292         (check_absent): Likewise.
11293
11294 2009-09-18  Craig Silverstein  <csilvers@google.com>
11295
11296         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11297         * options.cc: Include <cerrno> and <fstream>.
11298         (General_options::finalize): Parse -retain-symbols-file tag.
11299         * options.h: New flag.
11300         (General_options): New method should_retain_symbol, new
11301         variable symbols_to_retain.
11302         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11303         should_retain_symbol map.
11304         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11305         * testsuite/Makefile.in: Regenerate.
11306         * testsuite/retain_symbols_file_test.sh: New file.
11307
11308 2009-09-18  Nick Clifton  <nickc@redhat.com>
11309
11310         * po/es.po: Updated Spanish translation.
11311
11312 2009-09-17  Doug Kwan  <dougkwan@google.com>
11313
11314         * debug.h (DEBUG_RELAXATION): New constant.
11315         (DEBUG_ALL): Add DEBUG_RELAXATION.
11316         (debug_string_to_enum): Add relaxation debug option.
11317         * layout.cc
11318         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11319         Layout::Relaxation_debug_check::read_sections,
11320         Layout::Relaxation_debug_check::read_sections): New method definitions.
11321         (Layout::Layout): Initialize data members
11322         record_output_section_data_from_scrips_,
11323         script_output_section_data_list_ and relaxation_debug_check_.
11324         (Layout::save_segments, Layout::restore_segments,
11325         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11326         Layout::relaxation_loop_body): New method definitions.
11327         (Layout::finalize): Support relaxation.  Move section layout code to
11328         Layout::relaxation_loop_body.
11329         (Layout::set_asection_address_from_script): Move code for orphan
11330         section placement out.
11331         (Layout::place_orphan_sections_in_script): New method definition.
11332         * layout.h (Output_segment_headers, Output_file_header):
11333         New forward class declarations.
11334         (Layout::~Layout): Define.
11335         (Layout::new_output_section_data_from_script): New method definition.
11336         (Layout::place_orphan_sections_in_script): New method declaration.
11337         (Layout::Segment_states): New type declaration.
11338         (Layout::save_segments, Layout::restore_segments,
11339         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11340         Layout::relaxation_loop_body): New method declarations.
11341         (Layout::Output_section_data_list): New type declaration.
11342         (Layout::Relaxation_debug_check): New class definition.
11343         (Layout::record_output_section_data_from_script_,
11344         Layout::script_output_section_data_list_, Layout::segment_states_,
11345         Layout::relaxation_debug_check_): New data members.
11346         * output.cc: (Output_section_headers::do_size): New method definition.
11347         (Output_section_headers::Output_section_headers): Move size
11348         computation to Output_section_headers::do_size.
11349         (Output_segment_headers::do_size): New method definition.
11350         (Output_file_header::Output_file_header): Move size computation to
11351         Output_file_header::do_size and call it.
11352         (Output_file_header::do_size): New method definition.
11353         (Output_data_group::Output_data_group): Adjust call to
11354         Output_section_data.
11355         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11356         (Output_symtab_xindex::do_write): Add array bound check.
11357         (Output_section::Input_section::print_to_mapfile): Handle
11358         RELAXED_INPUT_SECTION_CODE.
11359         (Output_section::Output_section): Initialize data member checkpoint_.
11360         (Output_section::~Output_section): Delete checkpoint object pointed
11361         by checkpoint_.
11362         (Output_section::add_input_section): Always add an Input_section if
11363         relaxing.
11364         (Output_section::add_merge_input_section): Add assert.
11365         (Output_section::relax_input_section): New method definition.
11366         (Output_section::set_final_data_size): Set load address to zero for
11367         an unallocated section.
11368         (Output_section::do_address_and_file_offset_have_reset_values):
11369         New method definition.
11370         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11371         Handle relaxed input section.
11372         (Output_section::sort_attached_input_sections): Checkpoint input
11373         section list lazily.
11374         (Output_section::get_input_sections): Change type of input_sections to
11375         list of Simple_input_section pointers.  Checkpoint input section list
11376         lazily.  Also handle relaxed input sections.
11377         (Output_section::add_input_section_for_script): Take a reference to
11378         a Simple_input_section object instead of Relobj pointer and section
11379         index as parameter.  Handle relaxed input sections.
11380         (Output_section::save_states, Output_section::restore_states): New
11381         method definitions.
11382         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11383         (Output_data::is_data_size_fixed): New method definition.
11384         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11385         if it is fixed.
11386         (Output_data::address_and_file_offset_have_reset_values): New method
11387         definition.
11388         (Output_data::do_address_and_file_offset_have_reset_values): New method
11389         definition.
11390         (Output_data::set_data_size): Check that data size is not fixed.
11391         (Output_data::fix_data_size): New method definition.
11392         (Output_data::is_data_size_fixed_): New data member.
11393         (Output_section_headers::set_final_data_size): New method definition.
11394         (Output_section_headers::do_size): New method declaration.
11395         (Output_segment_headers::set_final_data_size): New method definition.
11396         (Output_segment_headers::do_size): New method declaration.
11397         (Output_file_header::set_final_data_size)::New method definition.
11398         (Output_file_header::do_size)::New method declaration.
11399         (Output_section_data::Output_section_data): Add new parameter
11400         is_data_size_fixed and use it to fix data size.
11401         (Output_data_const::Output_data_const): Adjust call to base class
11402         constructor and fix data size.
11403         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11404         base class constructor and fix data size.
11405         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11406         base class constructor and fix data size.
11407         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11408         class constructor and fix data size.
11409         (Output_data_group::set_final_data_size): New method definition.
11410         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11411         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11412         class constructor and fix data size.
11413         (Output_relaxed_input_section): New class definition.
11414         (Output_section::Simple_input_section): New class definition.
11415         (Output_section::get_input_sections): Adjust parameter list.
11416         (Output_section::add_input_section_for_script): Same.
11417         (Output_section::save_states, Output_section::restore_states,
11418         Output_section::do_address_and_file_offset_have_reset_values,
11419         (Output_section::Input_section::Input_section): Handle
11420         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11421         Output_relaxed_input_section.
11422         (Output_section::Input_section::is_input_section,
11423         Output_section::Input_section::set_output_section): Handle relaxed
11424         input section.
11425         (Output_section::Input_section::is_relaxed_input_section,
11426         Output_section::Input_section::output_section_data,
11427         Output_section::Input_section::relaxed_input_section): New method
11428         definitions.
11429         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11430         value.
11431         (Output_section::Input_section::u1_): Update comments.
11432         (Output_section::Input_section::u2_): Add new union member poris.
11433         (Output_section::Checkpoint_output_section): New classs definition.
11434         (Output_section::relax_input_section): New method declaration.
11435         (Output_section::checkpoint_): New data member.
11436         (Output_segment): Update comments.
11437         (Output_segment::Output_segment): Un-privatize copy constructor.
11438         (Output_segment::operator=): Un-privatize.
11439         * script-sections.cc (Output_section_element::Input_section_list):
11440         Change element type to Output_section::Simple_input_section.
11441         (Output_section_element_dot_assignment::set_section_addresses):
11442         Register output section data for relaxation clean up.
11443         (Output_data_exression::Output_data_expression): Adjust call to base
11444         constructor to fix data size.
11445         (Output_section_element_data::set_section_addresses): Register
11446         Output_data_expression object for relaxation clean up.
11447         (struct Input_section_info): Replace Relobj pointer and section index
11448         pair with Output_section::Simple_input_section and Convert struct to a
11449         class.
11450         (Input_section_sorter::operator()): Adjust access to
11451         Input_section_info data member to use accessors.
11452         (Output_section_element_input::set_section_addresses): Use layout
11453         parameter.  Adjust code to use Output_section::Simple_input_section
11454         and Input_secction_info classes.  Register filler for relaxation
11455         clean up.
11456         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11457         and section index pair with Output_section::Simple_input_section
11458         class.  Adjust code accordingly.
11459         (Phdrs_element::release_segment): New method definition.
11460         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11461         segment list.
11462         (Script_sections::release_segments): New method definition.
11463         * gold/script-sections.h (Script_sections::release_segments): New
11464         method declaration.
11465         * gold/target.h (Target::may_relax, Target::relax,
11466         Target::do_may_relax, Target::do_relax): New method definitions.
11467
11468 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11469
11470         * arm.cc (has_signed_unsigned_overflow): New function.
11471         (Arm_relocate_functions::abs8): New function.
11472         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11473         (Target_arm::Scan::global): Likewise.
11474         (Target_arm::relocate::relocate): Likewise.
11475         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11476         Likewise.
11477
11478 2009-09-16  Cary Coutant  <ccoutant@google.com>
11479
11480         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11481         * testsuite/Makefile.in: Regenerate.
11482
11483 2009-09-11  Nick Clifton  <nickc@redhat.com>
11484
11485         * po/gold.pot: Updated by the Translation project.
11486
11487 2009-09-08  Cary Coutant  <ccoutant@google.com>
11488
11489         * output.cc (Output_file::open): Add execute permission to empty file.
11490         * testsuite/Makefile.am (permission_test): New test.
11491         * testsuite/Makefile.in: Regenerate.
11492
11493 2009-09-02  Ian Lance Taylor  <iant@google.com>
11494
11495         * output.cc (Output_file::resize): Call map_no_anonymous rather
11496         than map.
11497
11498 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11499
11500         * gold.cc: Include "incremental.h".
11501         (queue_initial_tasks): Call Incremental_checker methods.
11502         * incremental.cc: Include "output.h".
11503         (Incremental_checker::can_incrementally_link_output_file): New
11504         method.
11505         * incremental.h (Incremental_checker): New class.
11506
11507         * output.cc (Output_file::open_for_modification): New method.
11508         (Output_file::map_anonymous): Changed return type to bool.  Record
11509         map in base_ field.
11510         (Output_file::map_no_anonymous): New method, broken out of map.
11511         (Output_file::map): Use map_no_anonymous and map_anonymous.
11512         * output.h (class Output_file): Update declarations.
11513
11514 2009-08-24  Cary Coutant  <ccoutant@google.com>
11515
11516         * options.h (Command_line::Pre_options): New class.
11517         (Command_line::pre_options): New member.
11518         * options.cc (gold::options::ready_to_register): New variable.
11519         (One_option::register_option): Do nothing if not registering options.
11520         Assert if same short option registered twice.
11521         (General_options::General_options): Turn off option registration when
11522         done constructing.
11523         (Command_line::Pre_options::Pre_options): New constructor.
11524
11525 2009-08-24  Cary Coutant  <ccoutant@google.com>
11526
11527         * options.h (General_options::no_keep_memory): Remove incorrect
11528         short option.
11529
11530 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11531
11532         * Makefile.am (am__skiplex, am__skipyacc): New.
11533         * Makefile.in: Regenerate.
11534
11535 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11536
11537         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11538         (INCLUDES): ... this.
11539         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11540         (AM_CPPFLAGS): Renamed from ...
11541         (INCLUDE): ... this.
11542         * Makefile.in, testsuite/Makefile.in: Regenerate.
11543
11544         * Makefile.in: Regenerate.
11545         * aclocal.m4: Likewise.
11546         * config.in: Likewise.
11547         * configure: Likewise.
11548         * testsuite/Makefile.in: Likewise.
11549
11550         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11551         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11552         * Makefile.in: Regenerate.
11553         * testsuite/Makefile.in: Regenerate.
11554
11555 2009-08-19  Cary Coutant  <ccoutant@google.com>
11556
11557         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11558         symbols in shared libraries overridden by hidden or internal symbols
11559         in the main program.
11560
11561 2009-08-19  Chris Demetriou  <cgd@google.com>
11562
11563         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11564         checking source file names in error messages.
11565
11566 2009-08-18  Doug Kwan  <dougkwan@google.com>
11567
11568         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11569         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11570         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11571         an elfcpp::Ehdr as parameter.
11572         * object.cc (Object::set_target): Remove the version that looks up
11573         a target and sets it.
11574         (Sized_relobj::setup): Take a Target object instead of
11575         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11576         (make_elf_sized_object): Find target and ask target to
11577         make an ELF object.
11578         * object.h: (Object::set_target): Remove the version that looks up
11579         a target and sets it.
11580         (Sized_relobj::setup): Take a Target object instead of
11581         an elfcpp:Ehdr as parameter.
11582         * target.cc: Include dynobj.h.
11583         (Target::do_make_elf_object_implementation): New.
11584         (Target::do_make_elf_object): New.
11585         * target.h (Target::make_elf_object): New template declaration.
11586         (Target::do_make_elf_object): New method declarations.
11587         (Target::do_make_elf_object_implementation): New template declaration.
11588
11589 2009-08-14  Ian Lance Taylor  <iant@google.com>
11590
11591         * gold.h (FUNCTION_NAME): Define.
11592         (gold_unreachable): Use FUNCTION_NAME.
11593
11594 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11595
11596         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11597         symbol in the --keep-unique list is not found.
11598
11599 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11600
11601         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11602         been maked as --keep-unique.
11603         (Icf::unfold_section): New function.
11604         * icf.h (Icf::unfold_section): New function.
11605         * options.h (General_options::keep_unique): New option.
11606         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11607         * testsuite/Makefile.in: Regenerate.
11608         * testsuite/icf_keep_unique_test.sh: New file.
11609         * testsuite/icf_keep_unique_test.cc: New file.
11610
11611 2009-08-12  Cary Coutant  <ccoutant@google.com>
11612
11613         PR 10471
11614         * resolve.cc (Symbol_table::resolve): Check for references from
11615         dynamic objects to hidden and internal symbols.
11616         * testsuite/Makefile.am (hidden_test.sh): New test.
11617         * testsuite/Makefile.in: Regenerate.
11618         * testsuite/hidden_test.sh: New script.
11619         * testsuite/hidden_test_1.c: New test source.
11620         * testsuite/hidden_test_main.c: New test source.
11621
11622 2009-08-11  Doug Kwan  <dougkwan@google.com>
11623
11624         * arm.cc: Update comments.
11625         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11626         segment to locate the .ARM.exidx section if present.
11627
11628 2009-08-09  Doug Kwan  <dougkwan@google.com>
11629
11630         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11631         patch.
11632
11633 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11634         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11635         compiler warnings.
11636
11637 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11638
11639         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11640         valid tls_segment only for non-debug-section relocations.
11641         * testsuite/Makefile.am: Add gc_tls_test.
11642         * testsuite/Makefile.in: Regenerate.
11643         * testsuite/gc_tls_test.cc: New file.
11644         * testsuite/gc_tls_test.sh: New file.
11645
11646 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11647
11648         * icf.cc: New file.
11649         * icf.h: New file.
11650         * Makefile.am (CCFILES): Add icf.cc.
11651         (HFILES): Add icf.h
11652         * Makefile.in: Regenerate.
11653         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11654         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11655         section, symbol and addend information for the relocs.
11656         * gold.cc (queue_middle_tasks): Call identical code folding.
11657         * gold.h: Add defines for multimap.
11658         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11659         to the call of finalize_local_symbols.
11660         * main.cc (main): Create object of class Icf.
11661         * object.cc (Sized_relobj::do_layout): Allow this function to be
11662         called twice during icf.
11663         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11664         to sections marked as identical by icf.
11665         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11666         when available.
11667         (Sized_relobj::do_section_entsize): New function.
11668         * object.h (Object::section_entsize): New function.
11669         (Object::do_section_entsize): New pure virtual function.
11670         (Relobj::finalize_local_symbols): Add new parameter.
11671         (Relobj::do_section_entsize): New function.
11672         * options.h (General_options::icf): New option.
11673         (General_options::icf_iterations): New option.
11674         (General_options::print_icf_sections): New option.
11675         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11676         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11677         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11678         icf.
11679         * symtab.cc (Symbol_table::is_section_folded): New function.
11680         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11681         to sections marked as identical by icf.
11682         * symtab.h (Symbol_table::set_icf): New function.
11683         (Symbol_table::icf): New function.
11684         (Symbol_table::is_section_folded): New function.
11685         (Symbol_table::icf_): New data member.
11686         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11687         * testsuite/Makefile.am: Add commands to build icf_test.
11688         * testsuite/Makefile.in: Regenerate.
11689         * testsuite/icf_test.sh: New file.
11690         * testsuite/icf_test.cc: New file.
11691
11692 2009-07-24  Chris Demetriou  <cgd@google.com>
11693
11694         * layout.cc (is_compressible_debug_section): Fix incorrect
11695         comment about compressed section names.
11696
11697 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11698
11699         PR 10419
11700         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11701
11702 2009-07-16  Ian Lance Taylor  <iant@google.com>
11703
11704         PR 10400
11705         * layout.h: #include <map>.
11706         (class Kept_section): Change from struct to class.  Add accessors
11707         and setters.  Add section size to Comdat_group mapping.  Change
11708         Comdat_group to std::map.  Add is_comdat_ field.  Add
11709         linkonce_size field in union.
11710         (class Layout): Update declaration of find_or_add_kept_section.
11711         Don't declare find_kept_object.
11712         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11713         parameter.  Add object, shndx, is_comdat, and is_group_name
11714         parameters.  Change all callers.  Adjust for new Kept_section.
11715         (Layout::find_kept_object): Remove.
11716         * object.cc (Sized_relobj::include_section_group): Update use of
11717         Kept_section.  Rename secnum to shndx.  Only record
11718         Kept_comdat_section if sections are the same size.
11719         (Sized_relobj::include_linkonce_section): Update use of
11720         Kept_section.  Only record Kept_comdat_section if sections are the
11721         same size.  Set size of linkonce section.
11722         (Sized_relobj::map_to_kept_section): Update call to
11723         get_kept_comdat_section.
11724         * object.h (class Sized_relobj): Rename fields in
11725         Kept_comdat_section to drop trailing underscores; change object
11726         field to Relobj*.  Change Kept_comdat_section_table to store
11727         struct rather than pointer.
11728         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11729         Add kept_object and kept_shndx parameters.  Change all callers.
11730         (Sized_relobj::get_kept_comdat_section): Change return type to
11731         bool.  Add kept_object and kept_shndx parameters.  Change all
11732         callers.
11733         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11734         Layout::find_or_add_kept_section.
11735
11736 2009-07-09  Ian Lance Taylor  <iant@google.com>
11737
11738         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11739         Reserve space in the hash table.
11740
11741 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11742
11743         * fileread.cc (File_read::get_mtime): New method.
11744         * fileread.h (Timespec): New structure.
11745         (File_read::get_mtime): New method.
11746         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11747         Renamed from timestamp_nsec.
11748         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11749         Elf_Xword.
11750         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11751         timestamp_nsec.
11752         (Incremental_inputs::report_archive): Save mtime; style fix.
11753         (Incremental_inputs::report_obejct): Save mtime; style fix.
11754         (Incremental_inputs::report_script): Save mtime; style fix.
11755         (Incremental_inputs::finalize_inputs): Style fix.
11756         (Incremental_inputs::finalize): Style fix.
11757         (Incremental_inputs::create_input_section_data): Store inputs
11758         mtime.
11759         * incremental.h (Incremental_inputs::report_script): Add mtime
11760         argument.
11761         (Incremental_inputs::Input_info::Input_info): Intialize only one
11762         union member.
11763         (Incremental_inputs::Input_info::archive): Move to nameless
11764         union.
11765         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11766         (Incremental_inputs::Input_info::script): Move to nameless union.
11767         (Incremental_inputs::mtime): New field.
11768         * script.cc (read_input_script): Pass file mtime to
11769         Incremental_input.
11770         * script.h (Script_info::inputs): Style fix.
11771
11772 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11773
11774         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11775         instead of 32.
11776
11777 2009-06-24  Ian Lance Taylor  <iant@google.com>
11778
11779         PR 10156
11780         * layout.cc (Layout::choose_output_section): If we find an
11781         existing section, update the flags.
11782         (Layout::create_notes): New function, broken out of
11783         Layout::finalize.
11784         (Layout::finalize): Don't create note sections.
11785         (Layout::create_note): Don't crash if linker script discards
11786         section.
11787         (Layout::create_gold_note): Likewise.
11788         (Layout::create_build_id): Likewise.  Don't set
11789         after_input_sections on the section.
11790         (Layout::create_executable_stack_info): Remove target parameter.
11791         Change caller.
11792         * layout.h (class Layout): Declare create_notes.  Update
11793         declaration of create_executable_stack_info.
11794         * gold.cc (queue_middle_tasks): Call create_notes.
11795         * output.cc (Output_section::update_flags_for_input_section): Move
11796         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11797         invalid.
11798         * output.h (Output_data::mark_address_invalid): New function.
11799         (class Output_section): Only declare, not define,
11800         update_flags_for_input_section.  Remove set_flags.
11801
11802 2009-06-24  Ian Lance Taylor  <iant@google.com>
11803
11804         * script-sections.cc (Output_section_definition::
11805         set_section_addresses): Rename shadowing local load_address to
11806         laddr.
11807
11808 2009-06-24  Ian Lance Taylor  <iant@google.com>
11809
11810         PR 10244
11811         * reloc.cc (relocate_sections): Skip empty relocation sections.
11812
11813 2009-06-23  Ian Lance Taylor  <iant@google.com>
11814
11815         PR 10156
11816         * layout.cc (Layout::create_note): Use choose_output_section
11817         rather than make_output_section.
11818
11819 2009-06-23  Ian Lance Taylor  <iant@google.com>
11820
11821         PR 10237
11822         * options.cc (General_options::parse_V): Set printed_version_.
11823         (General_options::General_options): Initialize printed_version_.
11824         * options.h (class General_options): Add printed_version_ field.
11825         * gold.cc (queue_initial_tasks): If there are no input files,
11826         don't give a fatal error if we printed the version information.
11827         (queue_middle_tasks): If using -r with a shared object, give a
11828         fatal error rather than an ordinary error.
11829
11830 2009-06-23  Ian Lance Taylor  <iant@google.com>
11831
11832         PR 10219
11833         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11834         (Layout::make_output_section): Set have_stabstr_section_ if we see
11835         a .stab*str section.
11836         (Layout::finalize): Call link_stabs_sections.
11837         (Layout::link_stabs_sections): New file.
11838         * layout.h (class Layout): Add have_stabstr_section_ field.
11839         Declare link_stabs_sections.
11840
11841 2009-06-23  Doug Kwan  <dougkwan@google.com>
11842
11843         * Makefile.am (libgold_a_LIBADD): New.
11844         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11845         * Makefile.in: Regenerate.
11846         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11847         * configure: Regenerate.
11848         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11849         * fileread.cc: Include sys/state.h
11850         * gold.h: Declare memmem and strndup if found missing.
11851         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11852
11853 2009-06-23  Ian Lance Taylor  <iant@google.com>
11854
11855         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11856         * configure: Rebuild.
11857
11858 2009-06-23  Ian Lance Taylor  <iant@google.com>
11859
11860         PR 10147
11861         * object.cc (Object::section_contents): Don't try to get a view if
11862         the section has length zero.
11863         (Object::handle_gnu_warning_section): If the section is empty, use
11864         the name of the section as the warning.
11865
11866 2009-06-23  Ian Lance Taylor  <iant@google.com>
11867
11868         PR 10133
11869         * stringpool.h (class Stringpool_template): Add optimize_ field.
11870         (Stringpool_template::set_optimize): New function.
11871         * stringpool.cc (Stringpool_template::Stringpool_template):
11872         Initialize optimize_ field.
11873         (Stringpool_template::set_string_offsets): Test local optimize
11874         fild rather than parameter.
11875         * layout.cc (Layout::Layout): Call set_optimize on the section
11876         name stringpool.
11877
11878 2009-06-22  Ian Lance Taylor  <iant@google.com>
11879
11880         PR 10030
11881         * yyscript.y: Parse TARGET.
11882         * script.cc (script_set_target): New function.
11883         * script-c.h (script_set_target): Declare.
11884         * options.cc (General_options::string_to_object_format): Rename
11885         from string_to_object_format in anonymous namespace.  Change
11886         callers.
11887         * options.h (class General_options): Declare
11888         string_to_object_format.
11889
11890 2009-06-22  Ian Lance Taylor  <iant@google.com>
11891
11892         * script-sections.cc (Script_sections::create_segments): Don't put
11893         program headers in a PT_LOAD segment if -n or -N.
11894
11895 2009-06-22  Ian Lance Taylor  <iant@google.com>
11896
11897         PR 10141
11898         * options.h (class General_options): Add -z lazy and -z now.  Sort
11899         -z options into alphabetical order.
11900         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
11901
11902 2009-06-21  Ian Lance Taylor  <iant@google.com>
11903
11904         * layout.cc (Layout::make_output_section): Call
11905         Target::new_output_section.
11906         (Layout::attach_allocated_section_to_segment): Put large section
11907         sections in a separate load segment with the large segment flag
11908         set.
11909         (Layout::segment_precedes): Sort large data segments after other
11910         load segments.
11911         (align_file_offset): New static function.
11912         (Layout::set_segment_offsets): Use align_file_offset.
11913         * output.h (class Output_section): Add is_small_section_ and
11914         is_large_section_ fields.
11915         (Output_section::is_small_section): New function.
11916         (Output_section::set_is_small_section):  New function.
11917         (Output_section::is_large_section): New function.
11918         (Output_section::set_is_large_section): New function.
11919         (Output_section::is_large_data_section): New function.
11920         (class Output_segment): Add is_large_data_segment_ field.
11921         (Output_segment::is_large_data_segment): New function.
11922         (Output_segment::set_is_large_data_segment): New function.
11923         * output.cc (Output_section::Output_section): Initialize new
11924         fields.
11925         (Output_segment::Output_segment): Likewise.
11926         (Output_segment::add_output_section): Add assertion that large
11927         data sections always go in large data segments.  Force small data
11928         sections to the end of the list of data sections.  Force small BSS
11929         sections to the start of the list of BSS sections.  For large BSS
11930         sections to the end of the list of BSS sections.
11931         * symtab.h (class Symbol): Declare is_common_shndx.
11932         (Symbol::is_defined): Check Symbol::is_common_shndx.
11933         (Symbol::is_common): Likewise.
11934         (class Symbol_table): Define enum Commons_section_type.  Update
11935         declarations.  Add small_commons_ and large_commons_ fields.
11936         * symtab.cc (Symbol::is_common_shndx): New function.
11937         (Symbol_table::Symbol_table): Initialize new fields.
11938         (Symbol_table::add_from_object): Put small and large common
11939         symbols in the right list.
11940         (Symbol_table::sized_finalized_symbol): Check
11941         Symbol::is_common_shndx.
11942         (Symbol_table::sized_write_globals): Likewise.
11943         * common.cc (Symbol_table::do_allocate_commons): Allocate new
11944         common symbol lists.  Don't call do_allocate_commons_list if the
11945         list is empty.
11946         (Symbol_table::do_allocate_commons_list): Remove is_tls
11947         parameter.  Add comons_section_type parameter.  Change all
11948         callers.  Handle small and large common symbols.
11949         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
11950         Symbol::is_common_shndx.
11951         * resolve.cc (symbol_to_bits): Likewise.
11952         * target.h (Target::small_common_shndx): New function.
11953         (Target::small_common_section_flags): New function.
11954         (Target::large_common_shndx): New function.
11955         (Target::large_common_section_flags): New function.
11956         (Target::new_output_section): New function.
11957         (Target::Target_info): Add small_common_shndx, large_common_shndx,
11958         small_common_section_flags, and large_common_section_flags
11959         fields.
11960         (Target::do_new_output_section): New virtual function.
11961         * arm.cc (Target_arm::arm_info): Initialize new fields.
11962         * i386.cc (Target_i386::i386_info): Likewise.
11963         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
11964         Likewise.
11965         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
11966         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
11967         (Target_x86_64::do_new_output_section): New function.
11968         * configure.ac: Define conditional MCMODEL_MEDIUM.
11969         * testsuite/Makefile.am (check_PROGRAMS): Add large.
11970         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
11971         (large_LDFLAGS): Define.
11972         * testsuite/large.c: New file.
11973         * testsuite/testfile.cc (Target_test::test_target_info):
11974         Initialize new fields.
11975         * configure, testsuite/Makefile.in: Rebuild.
11976
11977 2009-06-05  Doug Kwan  <dougkwan@google.com>
11978
11979         * Makefile.am (CCFILES): Add target.cc.
11980         * Makefile.in: Regenerate.
11981         * i386.cc (class Target_i386): Define new virtual method to
11982         override do_is_local_label_name in parent.
11983         * object.cc (Sized_relobj::do_count_local_symbols): Discard
11984         local symbols if --discard-locals or -X is given.
11985         * options.h (class General_options): Declare new options
11986         '--discard-locals' and '-X' for discarding locals.
11987         * target.h (class Target): Define new methods is_local_label_name.
11988         Declare new virtual method do_is_local_label_name.
11989         * target.cc: New file.
11990         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
11991         (check_SCRIPTS): Add discard_locals_test.sh.
11992         (check_DATA): Add discard_local_tests.syms.
11993         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
11994         (discard_local_tests.syms, discard_locals_test.o): New make rules.
11995         * testsuite/Makefile.in: Regenerate.
11996         * testsuite/discard_locals_test.c: New file.
11997         * testsuite/discard_locals_test.sh: Same.
11998
11999 2009-06-05  Doug Kwan  <dougkwan@google.com>
12000
12001         * object.cc (Sized_relobj::Sized_relobj): Initialize
12002         discarded_eh_frame_shndx_ to -1U.
12003         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12004         section.
12005         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12006         a discarded .eh_frame section.
12007         (Sized_relobj::do_finalize_local_symbols): Ditto.
12008         * object.h (class Sized_relobj): Declare new member
12009         discarded_eh_frame_shndx_.
12010         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12011         (local_labels_test.o, local_labels_test): New rules.
12012         * testsuite/Makefile.in: Regenerate.
12013
12014 2009-06-04  Doug Kwan  <dougkwan@google.com>
12015
12016         * layout.cc (Layout::section_name_mapping): Add mapping for
12017         special ARM sections.
12018
12019 2009-06-03  Doug Kwan  <dougkwan@google.com>
12020
12021         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12022         (utils::has_overflow): Same.
12023
12024 2009-06-03  Ian Lance Taylor  <iant@google.com>
12025
12026         * layout.cc (Layout::section_name_mapping): New array, replacing
12027         Layout::linkonce_mapping.
12028         (Layout::section_name_mapping_count): New variable, replacing
12029         Layout::linkonce_mapping_count.
12030         (Layout::linkonce_output_name): Remove.
12031         (Layout::output_section_name): Rewrite.
12032         * layout.h (class Layout): Rename Linkonce_mapping to
12033         Section_name_mapping, linkonce_mapping to section_name_mapping,
12034         linkonce_mapping_count to section_name_mapping_count.  Don't
12035         declare linkonce_output_name.
12036
12037 2009-06-03  Doug Kwan  <dougkwan@google.com>
12038
12039         * gold/arm.cc (namespace utils): New.
12040         (Target_arm::reloc_is_non_pic): Define new method.
12041         (class Arm_relocate_functions): New.
12042         (Target_arm::Relocate::relocate): Handle relocation types used by
12043         Android.
12044
12045 2009-06-03  Ian Lance Taylor  <iant@google.com>
12046
12047         * arm.cc (Target_arm::scan::global): Use || instead of |.
12048
12049 2009-06-02  Doug Kwan  <dougkwan@google.com>
12050
12051         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12052         issued_non_pic_error_.
12053         (class Target_arm::Scan): Declare new method check_non_pic.
12054         Define new method symbol_needs_plt_entry.
12055         Declare new data member issued_non_pic_error_.
12056         (class Target_arm::Relocate): Declare new method
12057         should_apply_static_reloc.
12058         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12059         (Target_arm::Scan::check_non_pic): Define new method.
12060         (Target_arm::Scan::local): Handle a small subset of reloc types used
12061         by Android.
12062         (Target_arm::Scan::local): Same.
12063         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12064
12065 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12066
12067         * incremental.cc (Incremental_inputs::report_command_line): Filter
12068         out --incremental-* options.
12069
12070 2009-05-29  Doug Kwan  <dougkwan@google.com>
12071
12072         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12073         template class.
12074         (class Target_arm): Update comment.
12075         (Target_arm::Target_arm): Initialize new data members GOT_,
12076         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12077         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12078         and Target_arm::rel_dyn_section.
12079         Declare new_enum Target_arm::Got_type.
12080         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12081         and DYNBSS_.
12082         Update commments for member do_dynsym_value.
12083         (Target_arm::got_size, Target_arm::plt_section,
12084         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12085         new methods inside class defintion.
12086         (Target_arm::got_section): Define new method.
12087         (Target_arm::rel_dyn_section): Same.
12088         (Output_data_plt_arm): New template class.
12089         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12090         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12091         (Output_data_plt_arm::add_entry): Same.
12092         (Output_data_plt_arm::first_plt_entry): Define new
12093         static data member for PLT instruction template.
12094         (Output_data_plt_arm::plt_entry): Same.
12095         (Output_data_plt_arm::do_write): Define new method.
12096         (Target_arm::make_plt_entry): Same.
12097         (Target_arm::do_finalize_sections): Same.
12098         (Target_arm::do_dynsym_value): Same.
12099
12100 2009-05-28  Doug Kwan  <dougkwan@google.com>
12101
12102         * Makefile.am (TARGETSOURCES): Add arm.cc.
12103         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12104         * Makefile.in: Regenerate.
12105         * arm.cc: New file.
12106         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12107
12108 2009-05-26  Doug Kwan  <dougkwan@google.com>
12109
12110         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12111         (General_options::check_excluded_libs): Strip off directories in
12112         archive name before matching like GNU ld does.
12113         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12114         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12115         (exclude_libs_test_LDFLAGS): Add linker option
12116         -Wl,--exclude-libs,libexclude_libs_test_3
12117         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12118         an explicit archive without using -l.
12119         (alt/libexclude_libs_test_3.a): New make rule.
12120         * testsuite/Makefile.in: Regenerate.
12121         * testsuite/exclude_libs_test.c : Declare lib3_default().
12122         (main): Call it.
12123         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12124         * exclude_libs_test_3.c: New file.
12125
12126 2009-05-26  Nick Clifton  <nickc@redhat.com>
12127
12128         * po/id.po: New Indonesian translation.
12129         * po/gold.pot: Updated template file.
12130
12131 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12132
12133         * testsuite/Makefile.am: Add -ffunction-sections to compile
12134         gc_comdat_test files.  Add -Wl,--gc-sections to build
12135         gc_comdat_test.
12136         * testsuite/Makefile.in: Regenerate.
12137         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12138
12139 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12140
12141         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12142         kept comdat section was garbage collected.
12143         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12144         * testsuite/Makefile.in: Regenerate.
12145         * testsuite/gc_comdat_test.sh: New file.
12146         * testsuite/gc_comdat_test_1.cc: New file.
12147         * testsuite/gc_comdat_test_2.cc: New file.
12148
12149 2009-05-19  Doug Kwan  <dougkwan@google.com>
12150
12151         * archive.cc (Archive::Archive): Move constructor from archive.h
12152         to here.  Initialize no_export_.
12153         (Archive::get_elf_object_for_member): Set no_export flag of object.
12154         * archive.h (Archive::Archive): Move constructor body to
12155         archive.cc.
12156         (Archive::no_export): New method.
12157         (Archive::no_export_): New field.
12158         * object.h (Object::Object): Initialize no_export_ to false.
12159         (Object::no_export, Object::set_no_export): New methods.
12160         (Object::no_export_): New field.
12161         * options.cc (General_options::parse_exclude_libs): New method.
12162         (General_options::check_excluded_libs) Same.
12163         * options.h (exclude_libs): New option.
12164         (General_options::check_excluded_libs): New method declaration.
12165         (General_options::excluded_libs_): New field.
12166         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12167         default or protected visibility if an object has no-export flag set.
12168         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12169         (check_SCRIPTS): Add exclude_libs_test.sh.
12170         (check_DATA): Add exclude_libs_test.syms.
12171         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12172         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12173         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12174         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12175         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12176         libexclude_libs_test_2.a): New rules.
12177         * testsuite/Makefile.in: Regenerate.
12178         * testsuite/exclude_libs_test.c: New file.
12179         * testsuite/exclude_libs_test.sh: Ditto.
12180         * testsuite/exclude_libs_test_1.c: Ditto.
12181         * testsuite/exclude_libs_test_2.c: Ditto.
12182
12183 2009-05-15  Ian Lance Taylor  <iant@google.com>
12184
12185         * configure.ac: Check for declarations for cases where libiberty.h
12186         checks HAVE_DECL_xxx.
12187         * configure, config.in: Rebuild.
12188
12189 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12190
12191         * gold.h (Incremental_argument_list): Remove (invalid) forward
12192         declaration.
12193         * incremental.cc (Incremental_inputs::report_achive): New method.
12194         (Incremental_inputs::report_object): New method.
12195         (Incremental_inputs::report_script): New method.
12196         (Incremental_inputs::finalize_inputs): New method.
12197         (Incremental_inputs::finalize): Call finalize_inputs().
12198         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12199         Create inputs entries.
12200         * incremental.h (Incremental_input_type): New enum.
12201         (Incremental_inputs::Incremental_input): Initialize new fields.
12202         (Incremental_inputs::report_inputs): New method.
12203         (Incremental_inputs::report_achive): New method.
12204         (Incremental_inputs::report_object): New method.
12205         (Incremental_inputs::report_script): New method.
12206         (Incremental_inputs::finalize_inputs): New method.
12207         (Incremental_inputs::Input_info): New struct.
12208         (Incremental_inputs::Input_info_map): New typedef.
12209         (Incremental_inputs::lock_): New field.
12210         (Incremental_inputs::Inputs_): New field.
12211         (Incremental_inputs::Inputs_map): New field.
12212         * main.cc (main): Call Incremental_input::report_inputs.
12213         * options.h (Input_argument_list): Typedef moved from
12214         Input_arguments.
12215         (Input_file_group::Files): Remove, use ::Input_argument_list.
12216         (Input_file_group::Input_argument_list): Remove, use
12217         ::Input_argument_list.
12218         * plugin.cc (Plugin_manager::add_input_file): Add error in
12219         incremental build.
12220         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12221         functions.
12222         * script.cc (read_input_script): Call
12223         Incremental_input::report_script.
12224         * script.h (Script_info): New class.
12225
12226 2009-04-27  Ian Lance Taylor  <iant@google.com>
12227
12228         * x86_64.cc (do_adjust_output_section): Set entsize to
12229         plt_entry_size.
12230
12231 2009-04-23  Elliott Hughes  <enh@google.com>
12232
12233         * output.cc (Output_file::close): After short writes, continue
12234         writing from the correct offset in the buffer being written.
12235
12236 2009-04-23  Chris Demetriou  <cgd@google.com>
12237
12238         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12239         * configure: Regenerate.
12240         * config.in: Regenerate.
12241         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12242         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12243
12244 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12245
12246         * incremental.cc (Incremental_inputs_header_data): Renamed from
12247         Incremental_input_header_data.
12248         (Incremental_inputs_header_data::data_size): New field.
12249         (Incremental_inputs_header_data::put_input_file_count): Renamed
12250         from input_file_count.
12251         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12252         from command_line_offset.
12253         (Incremental_inputs_header_data::put_reserved): Renamed from
12254         put_reserved.
12255         (Incremental_inputs_entry_data): Renamed from
12256         Incremental_input_entry_data.
12257         (Incremental_inputs_entry_data::data_size): New field.
12258         (Incremental_inputs::report_command_line): New method.
12259         (Incremental_inputs::finalize): New method.
12260         (Incremental_inputs::create_incremental_inputs_data): New method.
12261         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12262         * incremental.h: New file.
12263         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12264         (Layout::finalize): Create incremental inputs section in
12265         incremental builds.
12266         (Layout::create_incremental_info_sections): New method.
12267         * layout.h (Layout::incremental_inputs): New method.
12268         (Layout::create_incremental_info_sections): New method.
12269         (Layout::incremental_inputs_): New field.
12270         * main.cc (main): Notify Incremental_input of the command line.
12271
12272 2009-04-01  Ian Lance Taylor  <iant@google.com>
12273             Mikolaj Zalewski  <mikolajz@google.com>
12274
12275         * gold.h (reserve_unordered_map): Define, three versions, one for
12276         each version of Unordered_map.
12277         * layout.cc (Layout::Layout): Remove options parameter.  Add
12278         number_of_input_files parameter.  Don't initialize options_.
12279         Initialize number_of_input_files_ and resized_signatures_.  Move
12280         sections_are_attached_.
12281         (Layout::layout_group): Reserve space for group_signatures_.
12282         (Layout::find_or_add_kept_section): Change name parameter to be a
12283         reference.  Resize signatures_ map when it gets large enough.
12284         (Layout::layout_eh_frame): Use parameters->options() instead of
12285         this->options_.
12286         (Layout::make_output_section): Likewise.
12287         (Layout::attach_allocated_section_to_segment): Likewise.
12288         (Layout::finalize, Layout::create_executable_stack): Likewise.
12289         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12290         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12291         * layout.h (class Layout): Update declarations.  Remove options_
12292         field.  Add number_of_input_files_ and resized_signatures_
12293         fields.  Move sections_are_attached_ field.
12294         * main.cc (main): Pass number of input files to Layout
12295         constructor.  Don't pass options.
12296
12297 2009-03-30  Ian Lance Taylor  <iant@google.com>
12298
12299         * ffsll.c (ffsll): Correct implementation.
12300
12301 2009-03-27  Ian Lance Taylor  <iant@google.com>
12302
12303         * ffsll.c: New file.
12304         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12305         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12306         * ftruncate.c (ftruncate): Declare before definition.
12307         * mremap.c (mremap): Likewise.
12308         * pread.c (pread): Likewise.
12309         * configure, Makefile.in, config.in: Rebuild.
12310
12311         * mremap.c: New file.
12312         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12313         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12314         (mremap): Declare if HAVE_MREMAP is not defined.
12315         * configure, Makefile.in, config.in: Rebuild.
12316
12317 2009-03-27  Cary Coutant  <ccoutant@google.com>
12318
12319         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12320         position independent.
12321         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12322         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12323
12324 2009-03-24  Cary Coutant  <ccoutant@google.com>
12325
12326         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12327         an executable.
12328         (needs_dynamic_reloc): Likewise.
12329
12330 2009-03-24  Ian Lance Taylor  <iant@google.com>
12331
12332         * yyscript.y (file_cmd): Recognize EXTERN.
12333         (extern_name_list, extern_name_list_body): New nonterminals.
12334         * script.cc (script_add_extern): Define.
12335         * script-c.h (script_add_extern): Declare.
12336
12337 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12338
12339         * object.cc (is_elf_object): Define.
12340         * object.h (is_elf_object): Declare.
12341         * archive.cc (Archive::get_elf_object_for_member): Call
12342         is_elf_object.
12343         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12344
12345 2009-03-24  Elliott Hughes  <enh@google.com>
12346
12347         * output.cc (Output_file::map_anonymous): Define.
12348         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12349         try an anonymous one.  Report the size if the mmap fails.
12350         * output.h (class Output_file): Declare map_anonymous.
12351
12352 2009-03-24  Ian Lance Taylor  <iant@google.com>
12353
12354         * target-select.cc (instantiate_target): Don't acquire the lock if
12355         the instantiated_target_ field has already been set.
12356
12357 2009-03-23  Ian Lance Taylor  <iant@google.com>
12358
12359         * gold-threads.h (class Initialize_lock): Define.
12360         * gold-threads.cc (class Initialize_lock_once): Define.
12361         (initialize_lock_control): New static variable.
12362         (initialize_lock_pointer): New static variable.
12363         (initialize_lock_once): New static function.
12364         (Initialize_lock::Initialize_lock): Define.
12365         (Initialize_lock::initialize): Define.
12366         * target-select.h: Include "gold-threads.h".
12367         (class Target_selector): Add lock_ and initialize_lock_ fields.
12368         Don't define instantiate_target, just declare it.
12369         * target-select.cc (Target_selector::Target_selector): Initialize
12370         new fields.
12371         (Target_selector::instantiate_target): Define.
12372         * descriptors.h: Include "gold-threads.h".
12373         (class Descriptors): Add initialize_lock_ field.
12374         * descriptors.cc (Descriptors::Descriptors): Initialize new
12375         field.
12376         (Descriptors::open): Use initialize_lock_ field
12377         * errors.h (class Errors): Add initialize_lock_ field.
12378         * errors.cc (Errors::Errors): Initialize new field.
12379         (Errors::initialize_lock): Use initialize_lock_ field.
12380         * powerpc.cc (class Target_selector_powerpc): Remove
12381         instantiated_target_ field.  In do_recognize call
12382         instantiate_target rather than do_instantiate_target.  In
12383         do_instantiate_target just allocate a new target.
12384         * sparc.cc (class Target_selector_sparc): Likewise.
12385
12386         * freebsd.h: New file.
12387         * i386.cc: Include "freebsd.h".
12388         (Target_i386): Derive from Target_freebsd rather than
12389         Sized_target.
12390         (Target_selector_i386): Derive from Target_selector_freebsd rather
12391         than Target_selector.
12392         * x86_64.cc: Include "freebsd.h".
12393         (Target_x86_64): Derive from Target_freebsd rather than
12394         Sized_target.
12395         (Target_selector_x86_64): Derive from Target_selector_freebsd
12396         rather than Target_selector.
12397         * target.h (class Target): Add adjust_elf_header and
12398         do_adjust_elf_header.
12399         * output.cc (Output_file_header:: do_sized_write): Call target
12400         adjust_elf_header routine.
12401         * configure.tgt: Set targ_osabi.
12402         * configure.ac: Define GOLD_DEFAULT_OSABI.
12403         * parameters.cc (Parameters::default_target): Pass
12404         GOLD_DEFAULT_OSABI to select_target.
12405         * target-select.h (class Target_selector): Make instantiate_target
12406         protected rather than private.
12407         * Makefile.am (HFILES): Add freebsd.h.
12408         * configure, Makefile.in, config.in: Rebuild.
12409
12410         * merge.cc (do_add_input_section): Correct pend value.  Change
12411         message about last entry not being null terminated from error to
12412         warning.
12413
12414 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12415
12416         * incremental.cc: New file.
12417         * Makefile.am (CCFILES): Add incremental.cc.
12418         * Makefile.in: Rebuild.
12419
12420 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12421
12422         * layout.cc (Layout::output_section_name): Preserve names
12423         of '.note.' sections.
12424
12425 2009-03-19  Ian Lance Taylor  <iant@google.com>
12426
12427         * descriptors.cc (Descriptors::open): Check that the options are
12428         valid before using them.
12429
12430 2009-03-18  Ian Lance Taylor  <iant@google.com>
12431
12432         * script-sections.h: Include <list>.
12433         (class Script_sections): Change Sections_elements from std::vector
12434         to std::list.  Typedef public Elements_iterator.  Add
12435         orphan_section_placement_, data_segment_align_start_, and
12436         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12437         field.
12438         * script-sections.cc (class Orphan_section_placement): New class.
12439         (class Sections_element): Add virtual functions is_relro and
12440         orphan_section_init.  Remove virtual function place_orphan_here.
12441         (class Output_section_definition): Add is_relro and
12442         orphan_section_init.  Remove place_orphan_here.
12443         (class Orphan_output_section): Likewise.
12444         (Script_sections::Script_sections): Update for field changes.
12445         (Script_sections::data_segment_align): Set saw_data_segment_align_
12446         and data_segment_align_start_, not data_segment_align_index.
12447         (Script_sections::data_segment_relro_end): Check
12448         saw_data_segment_align_.  Use data_segment_align_start_ rather
12449         than data_segment_align_index_.
12450         (Script_sections::place_orphan): Rewrite to use
12451         Orphan_section_placement.
12452
12453 2009-03-17  Ian Lance Taylor  <iant@google.com>
12454
12455         * archive.cc (Archive::add_symbols): Check for a version attached
12456         to the symbol name in the archive map.
12457         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12458         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12459         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12460         (ver_test_11.a): New target.
12461         * testsuite/Makefile.in: Rebuild.
12462
12463         * configure.ac: Check for chsize and posix_fallocate.  Replace
12464         ftruncate.
12465         * ftruncate.c: New file, from gnulib.
12466         * output.cc (posix_fallocate): Define dummy version if not
12467         HAVE_POSIX_FALLOCATE.
12468         (Output_file::map): Call posix_fallocate rather than lseek and
12469         write.
12470         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12471         * configure, Makefile.in, config.in: Rebuild.
12472
12473 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12474
12475         * layout.h (Layout::create_note): Add section_name parameter.
12476         * layout.cc (Layout::create_note): Likewise.
12477         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12478
12479 2009-03-17  Ian Lance Taylor  <iant@google.com>
12480
12481         * descriptors.cc: Include "options.h".
12482         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12483         (Descriptors::open): Always use O_CLOEXEC when opening a new
12484         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12485         then set FD_CLOEXEC.
12486
12487         * sparc.cc (class Target_sparc): Add has_got_section.
12488         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12489         make sure we have a GOT section.
12490
12491         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12492         (Target_sparc::Scan::local): Likewise.
12493         (Target_sparc::Scan::global): Likewise.
12494         (Target_sparc::Relocate::relocate): Likewise.
12495         (Target_sparc::Relocate::relocate_tls): Likewise.
12496
12497         * symtab.cc (Symbol_table::define_default_version): New function,
12498         broken out of add_from_object.
12499         (Symbol_table::add_from_object): Call define_default_version.
12500         (Symbol_table::define_special_symbol): Add resolve_oldsym
12501         parameter.  Change all callers.  If the version for a symbol comes
12502         from a version script, resolve it with the symbol with the same
12503         name with no version.  Also add the symbol without a version if
12504         appropriate.
12505         (do_define_in_output_data): If resolving with oldsym, don't delete
12506         sym.
12507         (do_define_in_output_segment): Likewise.
12508         (do_define_as_constant): Likewise.
12509         * symtab.h (class Symbol_table): Update declarations.
12510
12511 2009-03-13  Ian Lance Taylor  <iant@google.com>
12512
12513         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12514         (Read_symbols::requeue): New function.
12515         (Read_symbols::do_read_symbols): If make_elf_object fails because
12516         the target type is not configured, and the file was searched for,
12517         issue a warning and retry with the next directory.
12518         (Add_symbols::run): If the file has an incompatible format, and
12519         it was searched for, requeue the Read_symbols task.  On error,
12520         release the object.
12521         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12522         dirindex parameter to constructor.  Change all callers.  Declare
12523         incompatible_warning and requeue.
12524         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12525         input_argument_ and input_group_ fields.  Add them to
12526         constructor.  Change all callers.
12527         (class Read_script): Add dirindex_ field.  Add it to constructor.
12528         Change all callers.
12529         * archive.cc (Archive::setup): Remove input_objects parameter.
12530         Change all callers.
12531         (Archive::get_file_and_offset): Likewise.
12532         (Archive::read_all_symbols): Likewise.
12533         (Archive::read_symbols): Likewise.
12534         (Archive::get_elf_object_for_member): Remove input_objects
12535         parameter.  Add punconfigured parameter.  Change all callers.
12536         (Archive::add_symbols): Change return type to bool.  Check return
12537         value of include_member.
12538         (Archive::include_all_members): Likewise.
12539         (Archive::include_member): Change return type to bool.  Return
12540         false if first included object has incompatible target.  Set
12541         included_member_ field.
12542         (Add_archive_symbols::run): If add_symbols returns false, requeue
12543         Read_symbols task.
12544         * archive.h (class Archive): Add included_member_ field.
12545         Initialize it in constructor.  Add input_file and searched_for
12546         methods.  Update declarations.
12547         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12548         input_argument_ fields.  Add them to constructor.  Change all
12549         callers.
12550         * script.cc: Include "target-select.h".
12551         (class Parser_closure): Add skip_on_incompatible_target_ and
12552         found_incompatible_target_ fields.  Add
12553         skip_on_incompatible_target parameter to constructor.  Change all
12554         callers.  Add methods skip_on_incompatible_target,
12555         clear_skip_on_incompatible_target, found_incompatible_target, and
12556         set_found_incompatible_target.
12557         (read_input_script): Add dirindex parameter.  Change all callers.
12558         If parser finds an incompatible target, requeue Read_symbols
12559         task.
12560         (script_set_symbol): Clear skip_on_incompatible_target in
12561         closure.
12562         (script_add_assertion, script_parse_option): Likewise.
12563         (script_start_sections, script_add_phdr): Likewise.
12564         (script_check_output_format): New function.
12565         * script.h (read_input_script): Update declaration.
12566         * script-c.h (script_check_output_format): Declare.
12567         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12568         (ignore_cmd): Remove OUTPUT_FORMAT.
12569         * fileread.cc (Input_file::Input_file): Add explicit this.
12570         (Input_file::will_search_for): New function.
12571         (Input_file::open): Add pindex parameter.  Change all callers.
12572         * fileread.h (class Input_file): Add input_file_argument method.
12573         Declare will_search_for.  Update declarations.
12574         * object.cc (make_elf_object): Add punconfigured parameter.
12575         Change all callers.
12576         * object.h (class Object): Make input_file public.  Add
12577         searched_for method.
12578         (make_elf_object): Update declaration.
12579         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12580         restart search.
12581         * dirsearch.h (class Dirsearch): Update declaration.
12582         * options.h (class General_options): Add --warn-search-mismatch.
12583         * parameters.cc (Parameters::is_compatible_target): New function.
12584         * parameters.h (class Parameters): Declare is_compatible_target.
12585         * workqueue.cc (Workqueue::add_blocker): New function.
12586         * workqueue.h (class Workqueue): Declare add_blocker.
12587
12588         * fileread.cc (Input_file::open): Remove options parameter.
12589         Change all callers.
12590         (Input_file::open_binary): Likewise.
12591         * script.cc (read_input_script): Likewise.
12592         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12593         options parameter from constructor.  Change all callers.
12594         (class Read_script): Likewise.
12595         * fileread.h (class Input_file): Update declarations.
12596         * script.h (read_input_script): Update declaration.
12597
12598 2009-03-10  Nick Clifton  <nickc@redhat.com>
12599
12600         * po/es.po: New Spanish translation.
12601
12602 2009-03-06  Cary Coutant  <ccoutant@google.com>
12603
12604         * options.cc (parse_short_option): Keep dash_z from registering itself.
12605
12606 2009-03-03  Ian Lance Taylor  <iant@google.com>
12607
12608         PR 9918
12609         * target-reloc.h (relocate_section): Pass output_section to
12610         relocate.
12611         * i386.cc (Target_i386::should_apply_static_reloc): Add
12612         output_section parameter.  Change all callers.
12613         (Target_i386::Relocate::relocate): Add output_section parameter.
12614         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12615         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12616         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12617         * testsuite/two_file_shared.sh: New script.
12618         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12619         (check_DATA): Add two_file_shared.dbg.
12620         (two_file_shared.dbg): New target.
12621         * testsuite/Makefile.in: Rebuild.
12622
12623 2009-03-01  Ian Lance Taylor  <iant@google.com>
12624
12625         * configure.ac: Check for byteswap.h.
12626         * configure: Rebuild.
12627         * config.in: Rebuild.
12628
12629 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12630
12631         * layout.cc (Layout::find_or_add_kept_section): New function.
12632         (Layout::add_comdat): Removed.
12633         * layout.h (struct Kept_section): Move out of class Layout.
12634         Remove trailing underscores from field names.  Add group_sections
12635         field.  Rename group_ field to is_group.  Change all uses.
12636         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12637         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12638         comdat_groups_ field.
12639         (Sized_relobj::include_section_group): Use
12640         find_or_add_kept_section and Kept_section::group_sections.
12641         (Sized_relobj::include_linkonce_section): Likewise.
12642         * object.cc (class Sized_relobj): Don't define Comdat_group or
12643         Comdat_group_table.  Remove find_comdat_group and
12644         add_comdat_group.  Remove comdat_groups_ field.
12645         * plugin.cc (include_comdat_group): Use
12646         Layout::find_or_add_kept_section.
12647
12648 2009-02-28  Ian Lance Taylor  <iant@google.com>
12649
12650         * README: --gc-sections and map files are now supported.  Document
12651         some build requirements.
12652
12653         PR 6992
12654         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12655         relocatable link set the value of the section symbol to zero.
12656         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12657         relocatable link don't include the section address in the local
12658         symbol value.
12659
12660 2009-02-27  Ian Lance Taylor  <iant@google.com>
12661
12662         PR 6811
12663         * options.h (class Search_directory): Add is_system_directory.
12664         (class General_options): Declare is_in_system_directory.
12665         * options.cc (get_relative_sysroot): Make static.
12666         (get_default_sysroot): Make static.
12667         (General_optoins::is_in_system_directory): New function.
12668         * fileread.cc (Input_file::is_in_system_directory): New function.
12669         * fileread.h (class Input_file): Declare is_in_system_directory.
12670         * object.h (class Object): Add is_in_system_directory.
12671         (class Input_objects): Remove system_library_directory_ field.
12672         * object.cc (Input_objects::add_object): Don't set
12673         system_library_directory_.
12674         (input_objects::found_in_system_library_directory): Remove.
12675         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12676         parameter.  Change all callers.
12677         (Symbol_table::sized_write_globals): Likewise.
12678         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12679         Call Object::is_in_system_directory.
12680         * symtab.h (class Symbol_table): Update declarations.
12681
12682         PR 5990
12683         * descriptors.h (Open_descriptor): Add is_on_stack field.
12684         * descriptors.cc (Descriptors::open): If the descriptor is on the
12685         top of the stack, remove it.  Initialize is_on_stack field.
12686         (Descriptors::release): Only add pod to stack if it is not on the
12687         stack already.
12688         (Descriptors::close_some_descriptor): Clear stack_next and
12689         is_on_stack fields.
12690
12691         PR 7091
12692         * output.cc (Output_section::find_starting_output_address): Rename
12693         from starting_output_address; add PADDR parameter; change return
12694         type.
12695         * output.h (class Output_section): Declare
12696         find_starting_output_address instead of starting_output_address.
12697         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12698         section symbol for which we can't find a merge section.
12699
12700         PR 9836
12701         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12702         hidden or internal, force the symbol to be local.
12703         * resolve.cc (Symbol::override_visibility): Define.
12704         (Symbol::override_base): Use override_visibility.
12705         (Symbol_table::resolve): Likewise.
12706         (Symbol::override_base_with_special): Likewise.
12707         (Symbol_table::override_with_special): If the visibility is hidden
12708         or internal, force the symbol to be local.
12709         * symtab.h (class Symbol): Add set_visibility and
12710         override_visibility.
12711         * testsuite/ver_test_1.sh: New file.
12712         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12713         (check_DATA): Add ver_test_1.syms.
12714         (ver_test_1.syms): New target.
12715         * testsuite/Makefile.in: Rebuild.
12716
12717 2009-02-25  Cary Coutant  <ccoutant@google.com>
12718
12719         * layout.cc (Layout::choose_output_section): Don't rename sections
12720         when using a linker script that has a SECTIONS clause.
12721         * Makefile.in: Regenerate.
12722
12723         * testsuite/Makefile.am (script_test_5.sh): New test case.
12724         * testsuite/Makefile.in: Regenerate.
12725         * testsuite/script_test_5.cc: New file.
12726         * testsuite/script_test_5.sh: New file.
12727         * testsuite/script_test_5.t: New file.
12728
12729 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12730
12731         * archive.cc (Archive::include_member): Update calls to add_symbols.
12732         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12733         the Layout argument.
12734         * dynobj.h (do_add_symbols): Add the Layout argument.
12735         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12736         Layout argument.
12737         * object.h (Object::add_symbols): Add the Layout argument.
12738         (Object::do_add_symbols): Add the Layout argument.
12739         (Sized_relobj::do_add_symbols): Add the Layout argument.
12740         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12741         Unify the two versions.
12742         (Add_plugin_symbols): Remove.
12743         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12744         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12745         (Add_plugin_symbols): Remove.
12746         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12747         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12748         (Add_symbols::run): Make it work with Pulginobj.
12749
12750 2009-02-06  Ian Lance Taylor  <iant@google.com>
12751
12752         * object.cc (Sized_relobj::do_layout): Make info message start
12753         with lower case letter.
12754
12755 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12756
12757         * binary.cc: Fix file comment.
12758
12759         * options.h (enum Incremental_disposition): Define.
12760         (class General_options): Add new options: --incremental,
12761         --incremental_changed, --incremental_unchanged,
12762         --incremental_unknown.  Add incremental_disposition_ and
12763         implicit_incremental_ fields.
12764         (General_options::incremental_disposition): New function.
12765         (class Position_dependent_options): Add incremental_disposition
12766         option.
12767         (Position_dependent_options::copy_from_options): Set incremental
12768         dispositions.
12769         * options.cc (General_options::parse_incremental_changed): New
12770         function.
12771         (General_options::parse_incremental_unchanged): New function.
12772         (General_options::parse_incremental_unknown): New function.
12773         (General_options::General_options): Initialize new fields
12774         incremental_disposition_ and implicit_incremental_.
12775         (General_options::finalize): Check for uasge of --incremental-*
12776         without --incremental.
12777
12778 2009-02-06  Chris Demetriou  <cgd@google.com>
12779
12780         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12781         pointer and to report location as the file name associated with
12782         the symbol.
12783         (gold_undefined_symbol_at_location): New function to replace the
12784         old gold_undefined_symbol functionality.
12785         * target-reloc.h (relocate_section): Update to use
12786         gold_undefined_symbol_at_location.
12787         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12788         Call gold_undefined_symbol function rather than gold_error.
12789         * errors.h (Errors::undefined_symbol): Take location as a
12790         string, rather than calculating it from a relocation.
12791         * errors.cc (Errors::fatal): Print "fatal error:" before the
12792         formatted message.
12793         (Errors::error, Errors::error_at_location): Print "error: "
12794         before the formatted message.
12795         (Errors::undefined_symbol): Take location as a string, rather
12796         than calculating it from a relocation.
12797         (gold_undefined_symbol_at_location): New function akin to
12798         old gold_undefined_symbol, calculates location from relocation.
12799         (gold_undefined_symbol): Change to take only a Symbol pointer
12800         and to report location as the file name associated with the symbol.
12801         * testsuite/debug_msg.sh: Update for changed error messages.
12802         * testsuite/undef_symbol.sh: Likewise.
12803
12804 2009-02-04  Duncan Sands  <baldrick@free.fr>
12805
12806         PR 9812
12807         * reduced_debug_output.h
12808         (Output_reduced_debug_abbrev_section::failed): Use format for
12809         gold_warning.
12810         (Output_reduced_debug_info_section::faild): Likewise.
12811
12812 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12813
12814         * script.cc (Lazy_demangler): New class.
12815         (Version_script_info::get_symbol_version_helper): Demangle a
12816         symbol only once.
12817
12818 2009-01-29  Cary Coutant  <ccoutant@google.com>
12819
12820         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12821         to __tls_get_addr.
12822         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12823
12824 2009-01-28  Ian Lance Taylor  <iant@google.com>
12825
12826         * version.cc (version_string): Bump to 1.9.
12827
12828         * gold.h: Include <cstring> and <stdint.h>.
12829         * version.cc: Include <cstdio>.
12830         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12831         warning.
12832         * reduced_debug_output.cc (insert_into_vector): Rename from
12833         Insert_into_vector; change all callers.  Use Swap_unaligned to
12834         avoid aliasing issue; remove union since it is unnecessary.
12835
12836 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12837
12838         * Makefile.am (CCFILES): Add gc.cc.
12839         (HFILES): Add gc.h.
12840         * Makefile.in: Regenerate.
12841         * gold.cc (Gc_runner): New class.
12842         (queue_initial_tasks): Call garbage collection related tasks
12843         when corresponding options are invoked.
12844         (queue_middle_gc_tasks): New function.
12845         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12846         processed early before laying out sections during garbage collection.
12847         * gold.h (queue_middle_gc_tasks): New function.
12848         (is_prefix_of): Move from "layout.cc".
12849         * i386.cc (Target_i386::gc_process_relocs): New function.
12850         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12851         * main.cc (main): Create object of class "Garbage_collection".
12852         * object.cc (Relobj::copy_symbols_data): New function.
12853         (Relobj::is_section_name_included): New function.
12854         (Sized_relobj::do_layout): Allow this function to be called twice
12855         during garbage collection and defer layout of section during the
12856         first call.
12857         * object.h (Relobj::get_symbols_data): New function.
12858         (Relobj::is_section_name_included): New function.
12859         (Relobj::copy_symbols_data): New function.
12860         (Relobj::set_symbols_data): New function.
12861         (Relobj::get_relocs_data): New function.
12862         (Relobj::set_relocs_data): New function.
12863         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12864         (Relobj::gc_process_relocs): New function.
12865         (Relobj::do_gc_process_relocs): New pure virtual function.
12866         (Relobj::sd_): New data member.
12867         (Sized_relobj::is_output_section_offset_invalid): New function.
12868         (Sized_relobj::do_gc_process_relocs): New function.
12869         * options.h (General_options::gc_sections): Modify to not be a no-op.
12870         (General_options::print_gc_sections): New option.
12871         * plugin.cc (Plugin_finish::run): Remove function call to
12872         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12873         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12874         * reloc.cc (Read_relocs::run): Add task to process relocs and
12875         determine unreferenced sections when doing garbage collection.
12876         (Gc_process_relocs): New class.
12877         (Sized_relobj::do_gc_process_relocs): New function.
12878         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12879         sections that are garbage collected.
12880         * reloc.h (Gc_process_relocs): New class.
12881         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12882         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12883         symbols whose corresponding sections are garbage collected.
12884         (Symbol_table::Symbol_table): Add new parameter for the garbage
12885         collection object.
12886         (Symbol_table::gc_mark_undef_symbols): New function.
12887         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12888         (Symbol_table::gc_mark_dyn_syms): New function.
12889         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12890         as garbage.
12891         (Symbol_table::add_from_object): Likewise.
12892         (Symbol_table::add_from_relobj): When building shared objects, do not
12893         treat externally visible symbols as garbage.
12894         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
12895         table information for static and relocatable links.
12896         * symtab.h (Symbol_table::set_gc): New function.
12897         (Symbol_table::gc): New function.
12898         (Symbol_table::gc_mark_undef_symbols): New function.
12899         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12900         (Symbol_table::gc_mark_dyn_syms): New function.
12901         (Symbol_table::gc_): New data member.
12902         * target.h (Sized_target::gc_process_relocs): New pure virtual
12903         function.
12904         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
12905         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
12906
12907 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
12908
12909         * options.h (General_options::gc_sections): Define as a no-op for now.
12910         (General_options::no_keep_memory): Ditto.
12911         (General_options::Bshareable): Define.
12912         * options.cc (General_options::finalize): Honor -Bshareable.
12913
12914 2009-01-20  Andreas Schwab  <schwab@suse.de>
12915
12916         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
12917         read the value in the contents, since we don't use it.  Use the
12918         template endianness when writing.
12919         (Relocate::relocate): Use it for R_PPC_REL16_HA.
12920
12921 2009-01-19  Andreas Schwab  <schwab@suse.de>
12922
12923         * configure.tgt (powerpc64-*): Fix targ_obj.
12924
12925 2009-01-15  Ian Lance Taylor  <iant@google.com>
12926
12927         * object.cc (Sized_relobj::write_local_symbols): Don't write out
12928         local symbols when stripping all symbols.
12929
12930 2009-01-14  Cary Coutant  <ccoutant@google.com>
12931
12932         * output.cc (Output_reloc): Add explicit instantiations.
12933
12934 2009-01-14  Cary Coutant  <ccoutant@google.com>
12935
12936         * archive.cc (Archive::get_elf_object_for_member): Remove call
12937         to File_read::claim_for_plugin.
12938         * descriptors.cc (Descriptors::open): Remove reference to
12939         is_claimed.
12940         (Descriptors::claim_for_plugin): Remove.
12941         * descriptors.h (Descriptors::claim_for_plugin): Remove.
12942         (Descriptors::is_claimed): Remove.
12943         (claim_descriptor_for_plugin): Remove.
12944         * fileread.cc (File_read::claim_for_plugin): Remove.
12945         * fileread.h (File_read::claim_for_plugin): Remove.
12946         (File_read::descriptor): Reopen descriptor if necessary.
12947         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
12948         (Plugin_manager::all_symbols_read): Add task parameter. Change
12949         all callers.
12950         (Plugin_manager::get_input_file): New function.
12951         (Plugin_manager::release_input_file): New function.
12952         (Pluginobj::Pluginobj): Add filesize parameter and initialize
12953         corresponding data member.
12954         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
12955         and pass to base constructor. Change all callers.
12956         (get_input_file, release_input_file): New functions.
12957         (make_sized_plugin_object): Add filesize parameter. Change all callers.
12958         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
12959         (Plugin_manager::all_symbols_read): Add task parameter.
12960         (Plugin_manager::get_input_file): New function.
12961         (Plugin_manager::release_input_file): New function.
12962         (Plugin_manager::task_): New data member.
12963         (Pluginobj::Pluginobj): Add filesize parameter.
12964         (Pluginobj::filename): New function.
12965         (Pluginobj::descriptor): New function.
12966         (Pluginobj::filesize): New function.
12967         (Pluginobj::filesize_): New data member.
12968         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
12969         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
12970         File_read::claim_for_plugin; use Object::unlock to unlock the file.
12971
12972         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
12973         with archive libraries.
12974         * testsuite/Makefile.in: Regenerate.
12975         * testsuite/plugin_test.c (struct sym_info): New type.
12976         (get_input_file, release_input_file): New static variables.
12977         (onload): Capture new transfer vector entries.
12978         (claim_file_hook): Stop reading at end of file according to filesize.
12979         Factor out parsing of readelf output into separate function.
12980         (all_symbols_read_hook): Exercise get_input_file and release_input_file
12981         APIs and get the source file name from the symbol table.  Convert
12982         source file name to corresponding object file name.  Print info
12983         message when adding new input files.
12984         (parse_readelf_line): New function.
12985         * testsuite/plugin_test_1.sh: Add checks for new info messages.
12986         * testsuite/plugin_test_2.sh: Likewise.
12987         * testsuite/plugin_test_3.sh: Likewise.
12988         * testsuite/plugin_test_4.sh: New test case.
12989
12990 2009-01-07  Ian Lance Taylor  <iant@google.com>
12991
12992         * version.cc (version_string): Bump to 1.8.
12993
12994 2008-12-23  Cary Coutant  <ccoutant@google.com>
12995
12996         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
12997         * plugin.cc (Plugin_manager::finish): Rename as
12998         layout_deferred_objects.  Move cleanup to separate function.
12999         (Plugin_manager::cleanup): New function.
13000         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13001         separately.
13002         * plugin.h (Plugin_manager::finish): Rename as
13003         layout_deferred_objects.
13004         (Plugin_manager::cleanup): New function.
13005         (Plugin_manager::cleanup_done): New field.
13006
13007 2008-12-23  Cary Coutant  <ccoutant@google.com>
13008
13009         * plugin.cc (is_visible_from_outside): New function.
13010         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13011         so we don't return "IR only" status for exported symbols or -r links.
13012
13013         * testsuite/Makefile.am (plugin_test_3): New test case.
13014         * testsuite/Makefile.in: Regenerate.
13015         * testsuite/plugin_test_3.sh: New file.
13016
13017 2008-12-22  Cary Coutant  <ccoutant@google.com>
13018
13019         * object.cc (Sized_relobj::layout_section): New function.
13020         (Sized_relobj::do_layout): Defer layout of input sections until after
13021         plugin has provided replacement files.
13022         (Sized_relobj::do_layout_deferred_sections): New function.
13023         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13024         (Relobj::layout_deferred_sections): New function.
13025         (Relobj::do_layout_deferred_sections): New function.
13026         (Sized_relobj::do_layout_deferred_sections): New function.
13027         (Sized_relobj::layout_section): New function.
13028         (Sized_relobj::Deferred_layout): New structure.
13029         (Sized_relobj::deferred_layout_): New field.
13030         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13031         Change all callers.  Layout deferred sections.
13032         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13033         references.
13034         (Plugin_hook::run): Move code from do_plugin_hook inline.
13035         (Plugin_hook::do_plugin_hook): Remove.
13036         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13037         (Plugin_manager::finish): Renamed, was cleanup.
13038         (Plugin_manager::should_defer_layout): New function.
13039         (Plugin_manager::add_deferred_layout_object): New function.
13040         (Plugin_manager::Deferred_layout_list): New type.
13041         (Plugin_manager::deferred_layout_objects_): New field.
13042         (Plugin_hook::do_plugin_hook): Remove.
13043
13044 2008-12-17  Ian Lance Taylor  <iant@google.com>
13045
13046         * options.h (class General_options): Add --no case for
13047         --export-dynamic.
13048
13049 2008-12-16  Cary Coutant  <ccoutant@google.com>
13050
13051         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13052         vector.
13053         (Plugin_manager::claim_file): Create plugin object even if
13054         plugin did not call the add_symbols callback.
13055         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13056         asking for more symbols than were added.
13057         * testsuite/Makefile.am (plugin_test_1): Add test case with
13058         no global symbols.
13059         (empty.syms): New target.
13060         * testsuite/Makefile.in: Regenerate.
13061         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13062         message. Don't call add_symbols if no globals.
13063         (all_symbols_read_hook): Don't provide replacement for empty
13064         claimed file.
13065
13066 2008-12-12  Ian Lance Taylor  <iant@google.com>
13067
13068         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13069         r_type == 0 for a local symbol with r_sym == 0.
13070         (scan_relocatable_relocs): Pass r_sym to
13071         local_non_section_strategy.
13072         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13073         r_sym parameter.
13074
13075         * configure.ac: Update test for TLS descriptors: they are
13076         supported as of glibc 2.9.
13077         * configure: Rebuild.
13078
13079 2008-12-11  Ian Lance Taylor  <iant@google.com>
13080
13081         PR 7091
13082         * target-reloc.h (Default_scan_relocatable_relocs): For each
13083         function, map r_type == 0 to RELOC_DISCARD.
13084
13085 2008-12-10  Cary Coutant  <ccoutant@google.com>
13086
13087         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13088         object to override a kept COMDAT group from a plugin object.
13089
13090 2008-12-09  Ian Lance Taylor  <iant@google.com>
13091
13092         PR 7088
13093         * yyscript.y (file_cmd): Handle INPUT.
13094
13095         * testsuite/initpri1.c: Change all declarations to be full
13096         prototypes by adding void, to avoid compiler warnings.
13097
13098 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13099
13100         * options.cc (General_options::parse_plugin_opt): New.
13101         (General_options::add_plugin): The argument now is just the filename.
13102         (General_options::add_plugin_option): New.
13103         * options.h (plugin_opt): New.
13104         (add_plugin): Change argument name.
13105         (add_plugin_option): New.
13106         * plugin.cc (Plugin::load): Don't parse the plugin option.
13107         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13108         (Plugin::add_option): New.
13109         (Plugin::args_): Change type.
13110         (Plugin::filename_): New.
13111         (Plugin_manager::add_plugin_option): New.
13112         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13113         * testsuite/Makefile.in: Regenerate.
13114
13115 2008-12-05  Cary Coutant  <ccoutant@google.com>
13116
13117         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13118         Handle --strip-lto-sections option.
13119         * options.h (strip_lto_sections): New option.
13120
13121 2008-12-01  Cary Coutant  <ccoutant@google.com>
13122
13123         * plugin.cc (ld_plugin_message): Change format parameter to const.
13124         Fix mismatch between new[] and delete.
13125
13126 2008-11-14  Cary Coutant  <ccoutant@google.com>
13127
13128         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13129         instead of -1U.
13130
13131 2008-11-05  Craig Silverstein  <csilvers@google.com>
13132
13133         * options.cc (General_options::parse_dynamic_list): New function.
13134         * options.h (General_options): New flags dynamic_list,
13135         dynamic_list_data, dynamic_list_cpp_new, and
13136         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13137         (General_options::in_dynamic_list): New function.
13138         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13139         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13140         (Lex::can_continue_name): Likewise.
13141         (yylex): Likewise.
13142         (read_script_file): New parameter script_options.
13143         (read_dynamic_list): New function.
13144         (Script_options::define_dynamic_list): New function.
13145         (dynamic_list_keyword_parsecodes): New variable.
13146         (dynamic_list_keywords): New variable.
13147         * script.h (Script_options::define_dynamic_list): New function
13148         prototype.
13149         (read_dynamic_list): New function prototype.
13150         * symtab.cc (strprefix): New macro.
13151         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13152         dynamic_list_data, dynamic_list_cpp_new, and
13153         dynamic_list_cpp_typeinfo.
13154         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13155         (dynamic_list_expr): New rule.
13156         (dynamic_list_nodes): Likewise.
13157         (dynamic_list_node): Likewise.
13158         * testsuite/Makefile.am (dynamic_list): New test.
13159         * testsuite/Makefile.in: Regenerated.
13160         * testsuite/dynamic_list.t: New file.
13161         * testsuite/dynamic_list.sh: New file.
13162
13163 2008-11-05  Craig Silverstein  <csilvers@google.com>
13164
13165         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13166         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13167         (t11_last): Likewise.
13168         * testsuite/ver_test_6.c (main): Likewise.
13169
13170 2008-10-07  Cary Coutant  <ccoutant@google.com>
13171
13172         * options.c (General_options::finalize): Add check for -static and
13173         -shared.
13174         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13175         is not empty.
13176
13177 2008-10-02  Cary Coutant  <ccoutant@google.com>
13178
13179         * plugin.cc (make_sized_plugin_object): Fix conditional
13180         compilation to work when not all targets are enabled.
13181
13182 2008-09-29  Cary Coutant  <ccoutant@google.com>
13183
13184         * archive.cc (Archive::get_file_and_offset): Use filename instead
13185         of name to get library path.
13186         (Archive::include_member): Unlock external member of a thin archive.
13187
13188         * testsuite/Makefile.am (TEST_AR): New variable.
13189         (thin_archive_test_1): New test.
13190         (thin_archive_test_2): New test.
13191         * testsuite/Makefile.in: Regenerate.
13192         * testsuite/thin_archive_main.cc: New file.
13193         * testsuite/thin_archive_test_1.cc: New file.
13194         * testsuite/thin_archive_test_2.cc: New file.
13195         * testsuite/thin_archive_test_3.cc: New file.
13196         * testsuite/thin_archive_test_4.cc: New file.
13197
13198 2008-09-29  Cary Coutant  <ccoutant@google.com>
13199
13200         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13201         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13202         instead of -1U.
13203         (Sized_relobj::do_finalize_local_symbols): Likewise.
13204         (Sized_relobj::map_to_kept_section): Likewise.
13205         * object.h (Sized_relobj::invalid_address): New constant.
13206         (Sized_relobj::do_output_section_offset): Check for invalid_address
13207         and return -1ULL.
13208         * output.cc (Output_reloc::local_section_offset): Use constant
13209         invalid_address instead of -1U.
13210         (Output_reloc::get_address): Likewise.
13211         (Output_section::output_address): Change -1U to -1ULL.
13212         * output.h (Output_reloc::invalid_address): New constant.
13213         * reloc.cc (Sized_relobj::write_sections): Use constant
13214         invalid_address instead of -1U.
13215         (Sized_relobj::relocate_sections): Likewise.
13216         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13217         values for merge sections.
13218         * target-reloc.h (relocate_for_relocatable): Use constant
13219         invalid_address instead of -1U.
13220
13221 2008-09-19  Cary Coutant  <ccoutant@google.com>
13222
13223         Add plugin functionality for link-time optimization (LTO).
13224         * configure.ac (plugins): Add --enable-plugins option.
13225         * configure: Regenerate.
13226         * config.in: Regenerate.
13227         * Makefile.am (LIBDL): New variable.
13228         (CCFILES): Add plugin.cc.
13229         (HFILES): Add plugin.h.
13230         (ldadd_var): Add LIBDL.
13231         * Makefile.in: Regenerate.
13232
13233         * archive.cc: Include "plugin.h".
13234         (Archive::setup): Don't preread archive symbols when using a plugin.
13235         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13236         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13237         files.
13238         (Archive::include_member): Add symbols from plugin objects.
13239         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13240         * descriptors.cc (Descriptors::open): Check for file descriptors
13241         abandoned by plugins.
13242         (Descriptors::claim_for_plugin): New function.
13243         * descriptors.h (Descriptors::claim_for_plugin): New function.
13244         (Open_descriptor::is_claimed): New field.
13245         (claim_descriptor_for_plugin): New function.
13246         * fileread.cc (File_read::claim_for_plugin): New function.
13247         * fileread.h (File_read::claim_for_plugin): New function.
13248         (File_read::descriptor): New function.
13249         * gold.cc: Include "plugin.h".
13250         (queue_initial_tasks): Add task to call plugin hooks for generating
13251         new object files.
13252         * main.cc: Include "plugin.h".
13253         (main): Load plugin libraries.
13254         * object.h (Pluginobj): Declare.
13255         (Object::pluginobj): New function.
13256         (Object::do_pluginobj): New function.
13257         (Object::set_target): New function.
13258         * options.cc: Include "plugin.h".
13259         (General_options::parse_plugin): New function.
13260         (General_options::General_options): Initialize plugins_ field.
13261         (General_options::add_plugin): New function.
13262         * options.h (Plugin_manager): Declare.
13263         (General_options): Add --plugin option.
13264         (General_options::has_plugins): New function.
13265         (General_options::plugins): New function.
13266         (General_options::add_plugin): New function.
13267         (General_options::plugins_): New field.
13268         * plugin.cc: New file.
13269         * plugin.h: New file.
13270         * readsyms.cc: Include "plugin.h".
13271         (Read_symbols::do_read_symbols): Check for archive before checking
13272         for ELF file.  Call plugin hooks to claim files.
13273         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13274         from a real object file; force override when processing replacement
13275         files.
13276         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13277         (Symbol::init_base_object): Likewise.
13278         (Symbol::init_base_output_data): Likewise.
13279         (Symbol::init_base_output_segment): Likewise.
13280         (Symbol::init_base_constant): Likewise.
13281         (Symbol::init_base_undefined): Likewise.
13282         (Symbol::output_section): Assert that object is not a plugin.
13283         (Symbol_table::add_from_pluginobj): New function.
13284         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13285         undefined.
13286         (Symbol_table::sized_write_globals): Likewise.
13287         (Symbol_table::add_from_pluginobj): Instantiate template.
13288         * symtab.h (Sized_pluginobj): Declare.
13289         (Symbol::in_real_elf): New function.
13290         (Symbol::set_in_real_elf): New function.
13291         (Symbol::in_real_elf_): New field.
13292         (Symbol_table::add_from_pluginobj): New function.
13293
13294         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13295         (LIBDL): New variable.
13296         (LDADD): Add LIBDL.
13297         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13298         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13299         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13300         (MOSTLYCLEANFILES): Likewise.
13301         * testsuite/Makefile.in: Regenerate.
13302         * testsuite/plugin_test.c: New file.
13303         * testsuite/plugin_test_1.sh: New file.
13304         * testsuite/plugin_test_2.sh: New file.
13305
13306 2008-09-16  Ian Lance Taylor  <iant@google.com>
13307
13308         * target-reloc.h (relocate_section): Check whether a symbol is
13309         defined by the ABI before reporting an undefined symbol error.
13310         * target.h (Target::is_defined_by_abi): Make parameter const.
13311         (Target::do_is_defined_by_abi): Likewise.
13312         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13313         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13314         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13315         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13316         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13317         * testsuite/Makefile.in: Rebuild.
13318
13319         * fileread.cc (make_view): Add casts to avoid warning.
13320
13321 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13322
13323         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13324         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13325
13326 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13327
13328         * options.h (General_options::output_is_executable): New.
13329         (General_options::output_is_pie): New.
13330         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13331         for shared libraries.
13332         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13333
13334 2008-09-11  Chris Demetriou  <cgd@google.com>
13335
13336         * options.h (origin): New -z option.
13337         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13338         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13339         in DT_FLAGS_1.
13340
13341 2008-09-05  Cary Coutant  <ccoutant@google.com>
13342
13343         * fileread.cc (File_read::make_view): Add check for attempt to map
13344         beyond end of file.
13345
13346 2008-09-05  Cary Coutant  <ccoutant@google.com>
13347
13348         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13349         explicit instantiations.
13350
13351 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13352
13353         PR gold/6858
13354         * options.cc (General_options::finalize): Allow undefined symbols
13355         in shlibs if linking -shared.
13356
13357         PR gold/6859
13358         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13359         symbols as not needing a dynsym entry.
13360
13361 2008-08-20  Craig Silverstein  <csilvers@google.com>
13362
13363         * fileread.cc (File_read::open): Do not lock the file unless it
13364         was successfully opened.
13365
13366 2008-08-14  Cary Coutant  <ccoutant@google.com>
13367
13368         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13369         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13370         * testsuite/tls_test.cc (struct int128): 128-bit struct
13371         for testing TLS relocs with non-zero addend.
13372         (v12): New TLS variable.
13373         (t12): New test.
13374         (t_last): Add check for v12.
13375         * testsuite/tls_test.h (t12): New function.
13376         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13377
13378 2008-08-13  Ian Lance Taylor  <iant@google.com>
13379
13380         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13381         set tls_segment_ or relro_segment_.
13382         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13383         when appropriate.
13384         * output.h (Output_section::clear_is_relro): New function.
13385         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13386         sections specially even when output_data_ is empty.
13387         (Output_segment::maximum_alignment): When first section is relro,
13388         only force alignment for PT_LOAD segments.
13389         * script.cc (script_data_segment_align): New function.
13390         (script_data_segment_relro_end): New function.
13391         * script-c.h (script_data_segment_align): Declare.
13392         (script_data_segment_relro_end): Declare.
13393         * script-sections.h (class Script_sections): Declare
13394         data_segment_align and data_segment_relro_end.  Add fields
13395         segment_align_index_ and saw_relro_end_.
13396         * script-sections.cc (class Sections_element): Add set_is_relro
13397         virtual function.  Add new bool* parameter to place_orphan_here.
13398         Add get_output_section virtual function.
13399         (class Output_section_definition): Add set_is_relro.  Add new
13400         bool* parameter to place_orphan_here.  Add get_output_section.
13401         Add is_relro_ field.
13402         (Output_section_definition::Output_section_definition): Initialize
13403         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13404         and is_relro_ fields.
13405         (Output_section_definition::place_orphan_here): Add is_relro
13406         parameter.
13407         (Output_section_definition::set_section_addresses): Set relro for
13408         output section.
13409         (Output_section_definition::alternate_constraint): Likewise.
13410         (class Orphan_output_section): Add new bool* parameter to
13411         place_orphan_here.  Add get_output_section.
13412         (Orphan_output_section::place_orphan_here): Add is_relro
13413         parameter.
13414         (Script_sections::Script_sections): Initialize
13415         data_segment_align_index_ and saw_relro_end_.
13416         (Script_sections::data_segment_align): New function.
13417         (Script_sections::data_segment_relro_end): New function.
13418         (Script_sections::place_orphan): Set or clear is_relro.
13419         (Script_sections::set_section_addresses): Force alignment of first
13420         TLS section.
13421         * yyscript.y (exp): Call script_data_segment_align and
13422         script_data_segment_relro_end.
13423         * testsuite/relro_script_test.t: New file.
13424         * testsuite/relro_test.cc (using_script): Declare.
13425         (t1, t2): Test using_script.
13426         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13427         (relro_script_test_SOURCES): Define.
13428         (relro_script_test_DEPENDENCIES): Define.
13429         (relro_script_test_LDFLAGS): Define.
13430         (relro_script_test_LDADD): Define.
13431         (relro_script_test.so): New target.
13432         * testsuite/Makefile.in: Rebuild.
13433
13434 2008-08-06  Cary Coutant <ccoutant@google.com>
13435
13436         * archive.cc (Archive::total_archives, Archive::total_members)
13437         (Archive::total_members_loaded): New variables.
13438         (Archive::setup): Add parameter.  Add option to preread
13439         archive symbols.
13440         (Archive::read_armap): Add counter.
13441         (Archive::get_file_and_offset): New function.
13442         (Archive::get_elf_object_for_member): New function.
13443         (Archive::read_all_symbols): New function.
13444         (Archive::read_symbols): New function.
13445         (Archive::add_symbols): Add counters.
13446         (Archive::include_all_members): Use armap to find members if it's
13447         already built.
13448         (Archive::include_member): Skip reading symbols if already read.
13449         Factored code into Archive::get_file_and_offset and
13450         Archive::get_elf_object_for_member.  Changed call to
13451         Mapfile::report_include_archive_member.
13452         (Archive::print_stats): New function.
13453         * archive.h: Declare Object and Read_symbols_data classes.
13454         (Archive::Archive): Add initializers for new members.
13455         (Archive::setup): Add parameter.
13456         (Archive::print_stats): New function.
13457         (Archive::total_archives, Archive::total_members)
13458         (Archive::total_members_loaded): New variables.
13459         (Archive::get_file_and_offset): New function.
13460         (Archive::get_elf_object_for_member): New function.
13461         (Archive::read_all_symbols): New function.
13462         (Archive::read_symbols): New function.
13463         (Archive::Archive_member): New class.
13464         (Archive::members_): New member.
13465         (Archive::num_members_): New member.
13466         * main.cc: Include archive.h.
13467         (main): Call Archive::print_stats.
13468         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13469         archive parameter; member_name is now the fully-decorated name.
13470         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13471         * options.h: (General_options): Add --preread-archive-symbols option.
13472         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13473         Archive::setup.
13474
13475 2008-08-04  Ian Lance Taylor  <iant@google.com>
13476
13477         * symtab.h (Symbol::use_plt_offset): New function.
13478         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13479         * powerpc.cc (Relocate::relocate): Likewise.
13480         * sparc.cc (Relocate::relocate): Likewise.
13481         * x86_64.cc (Relocate::relocate): Likewise.
13482         * testsuite/weak_plt.sh: New test.
13483         * testsuite/weak_plt_main.cc: New test.
13484         * testsuite/weak_plt_shared.cc: New test.
13485         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13486         (check_PROGRAMS): Add weak_plt.
13487         (check_DATA): Add weak_plt_shared.so.
13488         (weak_plt_main_pic.o, weak_plt): New targets.
13489         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13490         * testsuite/Makefile.in: Rebuild.
13491
13492         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13493         gcctestdir/ld.
13494         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13495         * testsuite/Makefile.in: Rebuild.
13496
13497 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13498
13499         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13500         * Makefile.in: Regenerate.
13501         * po/POTFILES.in: Regenerate.
13502
13503 2008-07-29  Ian Lance Taylor  <iant@google.com>
13504
13505         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13506         symbols before other symbols.
13507         * testsuite/script_test_2.cc (test_addr): Declare.
13508         (test_addr_alias): Declare.
13509         (main): Check that test_addr and test_addr_alias have the right
13510         values.
13511         * testsuite/script_test_2.t: Define test_addr_alias and
13512         test_addr.
13513
13514 2008-07-24  Ian Lance Taylor  <iant@google.com>
13515
13516         PR 5990
13517         * descriptors.cc: New file.
13518         * descriptors.h: New file.
13519         * gold-threads.h (class Hold_optional_lock): New class.
13520         * fileread.cc: Include "descriptors.h".
13521         (File_read::~File_read): Release descriptor rather than closing
13522         it.
13523         (File_read::open) [file]: Call open_descriptor rather than open.
13524         Set is_descriptor_opened_.
13525         (File_read::open) [memory]: Assert that descriptor is not open.
13526         (File_read::reopen_descriptor): New function.
13527         (File_read::release): Release descriptor.
13528         (File_read::do_read): Make non-const.  Reopen descriptor.
13529         (File_read::read): Make non-const.
13530         (File_read::make_view): Reopen descriptor.
13531         (File_read::do_readv): Likewise.
13532         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13533         Update declarations.
13534         * layout.cc: Include "descriptors.h".
13535         (Layout::create_build_id): Use open_descriptor rather than open.
13536         * output.cc: Include "descriptors.h".
13537         (Output_file::open): Use open_descriptor rather than open.
13538         * archive.cc (Archive::const_iterator): Change Archive to be
13539         non-const.
13540         (Archive::begin, Archive::end): Make non-const.
13541         (Archive::count_members): Likewise.
13542         * archive.h (class Archive): Update declarations.
13543         * object.h (Object::read): Make non-const.
13544         * Makefile.am (CCFILES): Add descriptors.cc.
13545         (HFILES): Add descriptors.h.
13546         * Makefile.in: Rebuild.
13547
13548         PR 6716
13549         * gold.h: Always include <clocale>.  Add Solaris workarounds
13550         following code in binutils/sysdep.h.
13551
13552         PR 6048
13553         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13554         this->eh_frame_hdr_ is NULL before using it.
13555
13556         * dynobj.cc (Versions::Versions): Update comment.
13557
13558         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13559         the base version name.
13560
13561         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13562         array size plus one.
13563         (Stringpool_template::set_string_offsets): Subtract one from key
13564         before using it as an array index.
13565         (Stringpool_template::get_offset_with_length): Likewise.
13566         (Stringpool_template::write_to_buffer): Likewise.
13567         * stringpool.h (Stringpool_template::get_offset_from_key):
13568         Likewise.
13569
13570 2008-07-23  Ian Lance Taylor  <iant@google.com>
13571
13572         PR 6658
13573         * object.h (Merged_symbol_value::value): Do our best to handle a
13574         negative addend.
13575
13576         PR 6647
13577         * script.cc (Version_script_info::get_versions): Don't add empty
13578         version tag to return value.
13579         (Version_script_info::get_symbol_version_helper): Change return
13580         type to bool.  Add pversion parameter.  Change all callers.
13581         (script_register_vers_node): Don't require a non-NULL tag.
13582         * script.h (class Version_script_info): Update declarations.
13583         (Version_script_info::get_symbol_version): Change return type to
13584         bool.  Add version parameter.  Change all callers.
13585         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13586         handling.  Handle an empty version from a version script.
13587         (Symbol_table::define_special_symbol): Likewise.
13588         * testsuite/ver_test_10.script: New file.
13589         * testsuite/ver_test_10.sh: New file.
13590         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13591         (check_DATA): Add ver_test_10.syms.
13592         (ver_test_10.syms, ver_test_10.so): New target.
13593         * testsuite/Makefile.in: Rebuild.
13594
13595 2008-07-23  Simon Baldwin  <simonb@google.com>
13596
13597         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13598         to zero for undefined symbols from dynamic libraries.
13599
13600 2008-07-23  Ian Lance Taylor  <iant@google.com>
13601
13602         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13603         Change all callers.
13604         * symtab.h (class Symbol_table): Update declaration.
13605         * testsuite/ver_test_9.cc: New file.
13606         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13607         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13608         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13609         (ver_test_9.so, ver_test_9.o): New targets.
13610         * testsuite/Makefile.in: Rebuild.
13611
13612 2008-07-22  Ian Lance Taylor  <iant@google.com>
13613
13614         * options.h (class General_options): Define --check-sections.
13615         * layout.cc (Layout::set_segment_offsets): Handle
13616         --check-sections.
13617
13618         * options.h (class General_options): Define -n/--nmagic and
13619         -N/--omagic.
13620         * options.cc (General_options::finalize): For -n/--nmagic or
13621         -N/--omagic, set -static.
13622         * layout.cc (Layout::attach_allocated_section_to_segment): If
13623         -N/--omagic, don't put read-only and read-write sections in
13624         different segments.
13625         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13626         finding a read-only segment.
13627         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13628         don't set the minimum segment alignment to the common page size,
13629         and don't set the file offset to the address modulo the page size.
13630         * script-sections.cc (Script_sections::create_segments): If
13631         -n/--omagic, don't put read-only and read-write sections in
13632         different segments.
13633
13634         * cref.cc: New file.
13635         * cref.h: New file.
13636         * options.h (class General_options): Add --print-symbol-counts.
13637         * main.cc (main): Issue defined symbol report if requested.
13638         * archive.cc (Archive::interpret_header): Make into a const member
13639         function.
13640         (Archive::add_symbols): Call Input_objects::archive_start and
13641         archive_stop.
13642         (Archive::const_iterator): Define new class.
13643         (Archive::begin, Archive::end): New functions.
13644         (Archive::include_all_members): Rewrite to use iterator.
13645         (Archive::count_members): New function.
13646         * archive.h (class Archive): Update declarations.
13647         (Archive::filename): New function.
13648         * object.cc: Include "cref.h".
13649         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13650         (Sized_relobj::do_get_global_symbol_counts): New function.
13651         (Input_objects::add_object): Add object to cross-referencer.
13652         (Input_objects::archive_start): New function.
13653         (Input_objects::archive_stop): New function.
13654         (Input_objects::print_symbol_counts): New function.
13655         * object.h: Declare Cref and Archive.
13656         (Object::get_global_symbol_counts): New function.
13657         (Object::do_get_global_symbol_counts): New pure virtual function.
13658         (class Sized_relobj): Add defined_count_ field.  Update
13659         declarations.
13660         (class Input_objects): Add cref_ field.  Update constructor.
13661         Update declarations.
13662         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13663         defined_count_.
13664         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13665         symbol counts.
13666         (Sized_dynobj::do_get_global_symbol_counts): New function.
13667         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13668         defined_count_.  Update declarations.  Define Symbols typedef.
13669         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13670         parameter.  Change all callers.
13671         (Symbol_table::add_from_dynobj): Add sympointers and defined
13672         parameters.  Change all callers.
13673         * symtab.h (class Symbol_table): Update declarations.
13674         * Makefile.am (CCFILES): Add cref.cc.
13675         (HFILES): Add cref.h.
13676         * Makefile.in: Rebuild.
13677
13678 2008-07-22  Simon Baldwin  <simonb@google.com>
13679
13680         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13681         to zero when writing undefined symbols.
13682
13683 2008-07-22  Ian Lance Taylor  <iant@google.com>
13684
13685         * output.cc (Output_section::add_input_section): Don't try to
13686         merge empty merge sections.
13687
13688 2008-07-21  Craig Silverstein  <csilvers@google.com>
13689
13690         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13691         Include symbol version in error message.
13692
13693 2008-07-20  Chris Demetriou  <cgd@google.com>
13694
13695         * configure.ac (gold_cv_c_random_seed): New configured variable.
13696         (RANDOM_SEED_CFLAGS): New substituted variable.
13697         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13698         * configure: Rebuild.
13699         * Makefile.in: Likewise.
13700         * testsuite/Makefile.in: Likewise.
13701
13702 2008-07-18  Ian Lance Taylor  <iant@google.com>
13703
13704         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13705         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13706         * testsuite/ver_test_main.cc (main): Call t4.
13707         (t4, t4_2a): Define.
13708         * testsuite/ver_test_2.cc (t4_2): Define.
13709         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13710         * testsuite/ver_test_4.cc (t4_2a): Define.
13711         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13712         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13713
13714 2008-07-17  Ian Lance Taylor  <iant@google.com>
13715
13716         * dynobj.cc (Versions::add_def): If we give an error about a
13717         missing version, go ahead and create the version anyhow.
13718
13719 2008-07-10  Ian Lance Taylor  <iant@google.com>
13720
13721         Handle output sections with more than 0x7fffffff bytes.
13722         * object.h (class Relobj): Change map_to_output_ to
13723         output_sections_, and just keep a section pointer.  Change all
13724         uses.  Move comdat group support to Sized_relobj.
13725         (Relobj::is_section_specially_mapped): Remove.
13726         (Relobj::output_section): Remove poff parameter.  Change all
13727         callers.
13728         (Relobj::output_section_offset): New function.
13729         (Relobj::set_section_offset): Rewrite.
13730         (Relobj::map_to_output): Remove.
13731         (Relobj::output_sections): New function.
13732         (Relobj::do_output_section_offset): New pure virtual function.
13733         (Relobj::do_set_section_offset): Likewise.
13734         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13735         group support from Relobj.  Update declarations.
13736         (Sized_relobj::get_output_section_offset): New function.
13737         (Sized_relobj::do_output_section_offset): New function.
13738         (Sized_relobj::do_set_section_offset): New function.
13739         * object.cc (Relobj::output_section_address): Remove.
13740         (Sized_relobj::Sized_relobj): Initialize new fields.
13741         (Sized_relobj::include_section_group): Cast find_kept_object to
13742         Sized_relobj.
13743         (Sized_relobj::include_linkonce_section): Likewise.
13744         (Sized_relobj::do_layout): Use separate arrays for output section
13745         and output offset.
13746         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13747         output_sections.
13748         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13749         output_sections and section_offsets.
13750         (Sized_relobj::write_local_symbols): Likewise.
13751         (map_to_kept_section): Compute output address directly.
13752         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13753         output_sections and section_offsets.
13754         (Sized_relobj::write_sections): Likewise.
13755         (Sized_relobj::relocate_sections): Likewise.
13756         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13757         * output.h (class Output_reloc): Update declarations.  Change
13758         u2_.relobj to Sized_relobj*.
13759         (class Output_data_reloc): Change add functions to use
13760         Sized_relobj*.
13761         * output.cc (Output_reloc::Output_reloc): Change relobj to
13762         Sized_relobj*.
13763         (Output_reloc::local_section_offset): Change return type to
13764         Elf_Addr.  Use get_output_section_offset.
13765         (Output_reloc::get_address): Likewise.
13766         (Output_section::is_input_address_mapped): Don't call
13767         is_section_specially_mapped.
13768         (Output_section::output_offset): Likewise.
13769         (Output_section::output_address): Likewise.
13770         (Output_section::starting_output_address): Likewise.
13771         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13772         parameter to Sized_relobj*.
13773         (Copy_relocs::need_copy_reloc): Likewise.
13774         (Copy_relocs::save): Likewise.
13775         * copy-relocs.h (class Copy_relocs): Update declarations.
13776         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13777         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13778         * target-reloc.h (relocate_for_relocatable): Change
13779         offset_in_output_section type to Elf_Addr.  Change code that uses
13780         it as well.
13781         * layout.cc (Layout::layout): Always set *off.
13782         * mapfile.cc (Mapfile::print_input_section): Use
13783         output_section_offset.
13784         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13785         Sized_relobj*.
13786         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13787         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13788         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13789
13790 2008-07-03  Ian Lance Taylor  <iant@google.com>
13791
13792         * layout.cc (Layout::include_section): Do not discard unrecognized
13793         SHT_STRTAB sections.
13794
13795 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13796
13797         * script.cc (Lex::can_continue_name): Make '?' allowable in
13798         version-script names.
13799         * testsuite/version_script.map: Change glob pattern to use '?'
13800
13801 2008-06-30  Manish Singh  <yosh@gimp.org>
13802
13803         PR 6585
13804         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13805         Correct typo.
13806
13807 2008-06-30  Ian Lance Taylor  <iant@google.com>
13808
13809         PR 6660
13810         PR 6682
13811         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13812         versions]: Don't try to read the value in the contents, since we
13813         don't use it.  Use the template endianness when writing.
13814
13815 2008-06-25  Cary Coutant  <ccoutant@google.com>
13816
13817         * fileread.cc (File_read::make_view): Assert on zero-length view.
13818         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13819         symbol table when there are no symbols to read.
13820
13821 2008-06-23  Craig Silverstein  <csilvers@google.com>
13822
13823         * version.cc (version_string): Bump to 1.7
13824
13825 2008-06-18  Craig Silverstein  <csilvers@google.com>
13826
13827         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13828         constant 0xFFFF to type Valtype.
13829         (Powerpc_relocate_functions::rel16_ha): Likewise.
13830
13831 2008-06-17  Ian Lance Taylor  <iant@google.com>
13832
13833         * output.h (Output_section::Input_section): Initialize p2align_ to
13834         zero for Output_section_data constructors.
13835         (Output_section::Input_section::addralign): If not an input
13836         section, return the alignment of the Output_section_data.
13837         * testsuite/copy_test.cc: New file.
13838         * testsuite/copy_test_1.cc: New file.
13839         * testsuite/copy_test_2.cc: New file.
13840         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13841         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13842         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13843         (copy_test_1_pic.o, copy_test_1.so): New targets.
13844         (copy_test_2_pic.o, copy_test_2.so): New targets.
13845         * testsuite/Makefile.in: Rebuild.
13846
13847         * script-sections.cc (Script_sections::place_orphan): Initialize
13848         local variable exact.
13849
13850 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13851
13852         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13853
13854 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13855             David S. Miller  <davem@davemloft.net>
13856
13857         * powerpc.cc: New file.
13858         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13859         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13860         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13861         * Makefile.in: Rebuild.
13862
13863 2008-06-09  Ian Lance Taylor  <iant@google.com>
13864
13865         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13866         <exception>.
13867         (throwing, orig_terminate): New static variables.
13868         (terminate_handler): New static function.
13869         (t2): Set terminate handler.
13870
13871 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13872
13873         PR 6584
13874         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13875         alignment.
13876
13877 2008-05-30  Cary Coutant  <ccoutant@google.com>
13878
13879         * archive.cc (Archive::include_all_members) Correct to step
13880         over symbol table and extended name table in thin archives.
13881
13882 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13883
13884         PR 6407
13885         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13886         calculation.
13887
13888 2008-05-28  Caleb Howe  <cshowe@google.com>
13889
13890         * reduced_debug_output.cc: New file.
13891         * reduced_debug_output.h: New file.
13892         * options.h (class General_options): Add --strip-debug-non-line.
13893         * options.cc (General_options::finalize): Add strip_debug_non_line
13894         to the strip heirarchy.
13895         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
13896         fields.
13897         * layout.cc: Include "reduced_debug_output.h".
13898         (Layout::Layout): Initialize new fields.
13899         (line_only_debug_sections): New static array.
13900         (is_lines_only_debug_sections): New static inline function.
13901         (Layout::include_section): Handle --strip-debug-non-line.
13902         (Layout::make_output_section): If --strip-debug-non-line, build
13903         new output sections for .debug_abbrev and .debug_info.
13904         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
13905         gold.  Warn about possible overflow.
13906         (read_signed_LEB_128): Likewise.
13907         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
13908         (read_signed_LEB_128): Declare.
13909         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
13910         (HFILES): Add reduced_debug_output.h.
13911         * Makefile.in: Rebuild.
13912
13913 2008-05-21  Ian Lance Taylor  <iant@google.com>
13914
13915         * mapfile.cc: New file.
13916         * mapfile.h: New file.
13917         * options.h (class General_options): Add -M/--print-map and -Map.
13918         * options.cc (General_options::finalize): Make -M equivalent to
13919         -Map -.
13920         * main.cc: Include <cstdio> and "mapfile.h".
13921         (main): Open mapfile if requested.
13922         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
13923         constructor.  Change caller.
13924         (queue_initial_tasks): Add mapfile parameter.  Change caller.
13925         (queue_middle_tasks): Likewise.
13926         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
13927         declarations.
13928         * archive.cc: Include "mapfile.h".
13929         (Archive::add_symbols): Add mapfile parameter.  Change all
13930         callers.  Pass mapfile, symbol, and reason to include_member.
13931         (Archive::include_all_members): Add mapfile parameter.  Change all
13932         callers.
13933         (Archive::include_member): Add mapfile, sym, and why parameters.
13934         Change all callers.  Report inclusion to map file.
13935         * archive.h: Include "fileread.h".
13936         (class Archive): Update declarations.
13937         (Archive::file): New const method.
13938         (class Add_archive_symbols): Add mapfile_ field.  Update
13939         constructor.  Change all callers.
13940         * readsyms.h (class Read_symbols): Likewise.
13941         (class Finish_group): Likewise.
13942         (class Read_script): Likewise.
13943         * common.cc: Include "mapfile.h".
13944         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
13945         all callers.
13946         (Symbol_table::do_allocate_commons): Likewise.
13947         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
13948         symbol allocation to mapfile.
13949         * common.h (class Allocate_commons_task): Add mapfile_ field.
13950         Update constructor.  Change all callers.
13951         * symtab.h (class Symbol_table): Update declarations.
13952         * layout.cc: Include "mapfile.h".
13953         (Layout_task_runner::run): Print information to mapfile.
13954         (Layout::create_gold_note): Change Output_data_fixed_space to
13955         Output_data_zero_fill.
13956         (Layout::create_build_id): Likewise.
13957         (Layout::print_to_mapfile): New function.
13958         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
13959         constructor.  Change caller.
13960         (class Layout): Declare print_to_mapfile.
13961         * output.cc (Output_section::Input_section::print_to_mapfile): New
13962         function.
13963         (Output_section::add_input_section): If producing a map, always
13964         add to input_sections_ list.
13965         (Output_section::do_print_to_mapfile): New function.
13966         (Output_segment::print_sections_to_mapfile): New function.
13967         (Output_segment::print_section_list_to_mapfile): New function.
13968         * output.h: Include "mapfile.h".
13969         (Output_data::print_to_mapfile): New function.
13970         (Output_data::do_print_to_mapfile): New virtual function.
13971         (Output_segment_headers::do_print_to_mapfile): New function.
13972         (Output_file_header::do_print_to_mapfile): New function.
13973         (Output_data_const::do_print_to_mapfile): New function.
13974         (class Output_data_const_buffer): Add map_name_ field.  Update
13975         constructor.  Change all callers.  Add do_print_to_mapfile
13976         function.
13977         (class Output_data_fixed_space): Likewise.
13978         (class Output_data_space): Likewise.
13979         (class Output_data_zero_fill): New class.
13980         (Output_data_strtab::do_print_to_mapfile): New function.
13981         (Output_data_reloc_base::do_print_to_mapfile): New function.
13982         (Output_relocatable_relocs::do_print_to_mapfile): New function.
13983         (Output_data_group::do_print_to_mapfile): New function.
13984         (Output_data_got::do_print_to_mapfile): New function.
13985         (Output_data_dynamic::do_print_to_mapfile): New function.
13986         (Output_symtab_xindex::do_print_to_mapfile): New function.
13987         (class Output_section): Declare do_print_to_mapflie.  Declare
13988         print_to_mapfile in Input_section.
13989         (class Output_segment): Declare new functions.
13990         * object.h (Sized_relobj::symbol_count): New function.
13991         * script-sections.cc
13992         (Output_section_element_dot_assignment::set_section_addresses):
13993         Change Output_data_fixed_space to Output_data_zero_fill.
13994         (Output_data_expression::do_print_to_mapfile): New function.
13995         * script.cc (read_input_script): Add mapfile parameter.  Change
13996         all callers.
13997         * script.h (read_input_script): Update declaration.
13998         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
13999         (Eh_frame::do_print_to_mapfile): New function.
14000         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14001         (Output_merge_string::do_print_to_mapfile): New function.
14002         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14003         function.
14004         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14005         function.
14006         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14007         function.
14008         * Makefile.am (CCFILES): Add mapfile.cc.
14009         (HFILES): Add mapfile.h.
14010         * Makefile.in: Rebuild.
14011
14012 2008-05-19  Ian Lance Taylor  <iant@google.com>
14013
14014         * options.h (class General_options): Add -z relro.
14015         * layout.cc (Layout::Layout): Initialize relro_segment_.
14016         (Layout::add_output_section_data): Return the output section.
14017         (Layout::make_output_section): Rcognize relro sections and mark
14018         them appropriately.
14019         (Layout::attach_allocated_section_to_segment): Put relro sections
14020         in a PT_GNU_RELRO segment.
14021         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14022         section as relro.
14023         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14024         PT_TLS segments.
14025         (Layout::linkonce_mapping): Map d.rel.ro.local to
14026         .data.rel.ro.local.
14027         (Layout::output_section_name): Us .data.rel.ro.local for any
14028         section which begins with that.
14029         * layout.h (class Layout): Update add_output_section_data
14030         declaration.  Add relro_segment_ field.
14031         * output.cc (Output_section::Output_section): Initialize is_relro_
14032         and is_relro_local_ fields.
14033         (Output_segment::add_output_section): Group relro sections.
14034         (Output_segment::is_first_section_relro): New function.
14035         (Output_segment::maximum_alignment): If there is a relro section,
14036         align the segment to the common page size.
14037         (Output_segment::set_section_addresses): Track whether we are
14038         looking at relro sections.  If the last section is a relro
14039         section, align to the common page size.
14040         (Output_segment::set_section_list_addresses): Add in_relro
14041         parameter.  Change all callers.  Align to the page size when
14042         moving from relro to non-relro section.
14043         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14044         segment.
14045         * output.h (class Output_section): Add is_relro_ and
14046         is_relro_local_ fields.
14047         (Output_section::is_relro): New function.
14048         (Output_section::set_is_relro): New function.
14049         (Output_section::is_relro_local): New function.
14050         (Output_section::set_is_relro_local): New function.
14051         (class Output_segment): Update declarations.
14052         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14053         * sparc.cc (Target_sparc::got_section): Likewise.
14054         * x86_64.cc (Target_x86_64::got_section): Likewise.
14055         * testsuite/relro_test_main.cc: New file.
14056         * testsuite/relro_test.cc: New file.
14057         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14058         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14059         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14060         (relro_test.so, relro_test_pic.o): New targets.
14061         * testsuite/Makefile.in: Rebuild.
14062
14063 2008-05-16  Ian Lance Taylor  <iant@google.com>
14064
14065         * output.cc (Output_segment::add_output_section): Remove front
14066         parameter.
14067         * output.h (class Output_segment): Remove
14068         add_initial_output_section and overloaded add_output_section.
14069         Update declaration of remaining add_output_section.
14070         * layout.cc (Layout::create_interp): Call add_output_section
14071         rather than add_initial_output_section.
14072         (Layout::finish_dynamic_section): Likewise.
14073
14074         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14075         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14076         know the dynamic type.
14077         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14078         field.  Initialize it in constructor.
14079         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14080         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14081         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14082         reloc.
14083
14084         * output.cc (Output_reloc::get_address): Change return type to
14085         Elf_Addr.
14086         * output.h (class Output_reloc): Update get_address declaration.
14087         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14088         for section addresses.
14089
14090 2008-05-09  Ian Lance Taylor  <iant@google.com>
14091
14092         PR 6493
14093         * gold.cc (gold_nomem): Use return value of write.
14094
14095 2008-05-08  Ian Lance Taylor  <iant@google.com>
14096
14097         * symtab.c (Symbol::init_base_output_data): Add version
14098         parameter.  Change all callers.
14099         (Symbol::init_base_output_segment): Likewise.
14100         (Symbol::init_base_constant): Likewise.
14101         (Symbol::init_base_undefined): Likewise.
14102         (Sized_symbol::init_output_data): Likewise.
14103         (Sized_symbol::init_output_segment): Likewise.
14104         (Sized_symbol::init_constant): Likewise.
14105         (Sized_symbol::init_undefined): Likewise.
14106         (Symbol_table::do_define_in_output_data): If the new symbol has a
14107         version, mark it as the default.
14108         (Symbol_table::do_define_in_output_segment): Likewise.
14109         (Symbol_table::do_define_as_constant): Likewise.
14110         * symtab.h (class Symbol): Update declarations.
14111         (class Sized_symbol): Likewise.
14112         * resolve.cc (Symbol::override_version): New function.
14113         (Symbol::override_base): Call override_version.
14114         (Symbol::override_base_with_special): Likewise.
14115         * testsuite/ver_script_8.script: New file.
14116         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14117         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14118         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14119         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14120
14121 2008-05-06  Ian Lance Taylor  <iant@google.com>
14122
14123         PR 6049
14124         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14125         functions.
14126         (class General_options): Remove existing --undefined, and add
14127         --no-undefined instead.  Add new --undefined as synonym for -u.
14128         * archive.cc (Archive::add_symbols): Check whether symbol was
14129         named with -u.
14130         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14131         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14132         all uses.  Add IS_UNDEFINED.  Update declarations to split
14133         different versions of init_base.  Declare init_base_undefined.
14134         (Symbol::is_defined): Handle IS_UNDEFINED.
14135         (Symbol::is_undefined): Likewise.
14136         (Symbol::is_weak_undefined): Call is_undefined.
14137         (Symbol::is_absolute): Handle IS_CONSTANT.
14138         (class Sized_symbol): Update declarations to split different
14139         versions of init.  Declare init_undefined.
14140         (class Symbol_table): Declare new functions.
14141         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14142         Change all callers.
14143         (Symbol::init_base_output_data): Likewise.
14144         (Symbol::init_base_output_segment): Likewise.
14145         (Symbol::init_base_constant): Likewise.
14146         (Symbol::init_base_undefined): New function.
14147         (Sized_symbol::init_object): Rename from init.  Change all
14148         callers.
14149         (Sized_symbol::init_output_data): Likewise.
14150         (Sized_symbol::init_output_segment): Likewise.
14151         (Sized_symbol::init_constant): Likewise.
14152         (Sized_symbol::init_undefined): New function.
14153         (Symbol_table::add_undefined_symbols_from_command_line): New
14154         function.
14155         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14156         function.
14157         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14158         (Symbol::output_section): Likewise.
14159         (Symbol::set_output_section): Likewise.
14160         (Symbol_table::sized_finalize_symbol): Likewise.
14161         (Symbol_table::sized_write_globals): Likewise.
14162         * resolve.cc (Symbol_table::should_override): Likewise.
14163         (Symbol::override_base_with_special): Likewise.
14164
14165         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14166         symbol, change it to have default visibility.
14167         * testsuite/protected_1.cc: New file.
14168         * testsuite/protected_2.cc: New file.
14169         * testsuite/protected_3.cc: New file.
14170         * testsuite/protected_main_1.cc: New file.
14171         * testsuite/protected_main_2.cc: New file.
14172         * testsuite/protected_main_3.cc: New file.
14173         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14174         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14175         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14176         (protected_1.so): New target.
14177         (protected_1_pic.o, protected_2_pic.o): New targets.
14178         (protected_3_pic.o): New target.
14179         (check_PROGRAMS): Add protected_2.
14180         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14181         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14182         * testsuite/Makefile.in: Rebuild.
14183
14184         * options.h (DEFINE_var): Add set_user_set_##varname__.
14185         (DEFINE_bool_alias): New macro.
14186         (class General_options): Define -Bstatic using DEFINE_bool_alias
14187         rather than DEFINE_special.  Add --undefined as an alias for -z
14188         defs.
14189         * options.cc (General_options::parse_Bstatic): Remove.
14190
14191         * options.h (class General_options): Add --fatal-warnings.
14192         * main.cc (main): Implement --fatal-warnings.
14193         * errors.h (Errors::warning_count): New function.
14194
14195         * options.h (class General_options): Add -Bsymbolic-functions.
14196         * symtab.h (Symbol::is_preemptible): Check for
14197         -Bsymbolic-functions.
14198
14199 2008-05-05  Ian Lance Taylor  <iant@google.com>
14200
14201         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14202         as noVARNAME rather than no-VARNAME.
14203         (class General_options): Add option -z combreloc.
14204         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14205         get_address.
14206         (Output_reloc::sort_before) [SHT_REL]: New function.
14207         (Output_reloc::sort_before) [SHT_RELA]: New function.
14208         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14209         Sort_relocs_comparison.
14210         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14211         parameter.  Change all callers.
14212         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14213         sort_relocs parameter.  Change all callers.
14214         * output.cc (Output_reloc::get_address): New function, broken out
14215         of write_rel.
14216         (Output_reloc::write_rel): Call it.
14217         (Output_reloc::compare): New function.
14218         (Output_data_reloc_base::do_write): Optionally sort relocs.
14219
14220         * configure.ac: If targ_extra_obj is set, link it in.
14221         * configure.tgt: Initialize all variables.
14222         (x86_64*): Set targ_extra_obj and targ_extra_size.
14223         * configure: Rebuild.
14224
14225         * object.cc (Sized_relobj::include_section_group): Adjust section
14226         indexes read from group data.  Build vector to pass to
14227         layout_group.
14228         * layout.cc (Layout::layout_group): Add flags and shndxes
14229         parameters.  Remove contents parameter.  Change caller.  Update
14230         explicit instantiations.
14231         * layout.h (class Layout): Update layout_group declaration.
14232         * output.cc (Output_data_group::Output_data_group): Add flags and
14233         input_shndxes parameters.  Remove contents parameter.  Change
14234         caller.
14235         (Output_data_group::do_write): Change input_sections_ to
14236         input_shndxes_.
14237         * output.h (class Output_data_group): Update constructor
14238         declaration.  Rename input_sections_ to input_shndxes_.
14239         * testsuite/many_sections_test.cc: Add template.
14240
14241 2008-04-30  Cary Coutant  <ccoutant@google.com>
14242
14243         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14244
14245         * layout.cc (Layout::include_section): Refactored check for debug
14246         info section.
14247         (Layout::add_comdat): Add new parameters.  Change type
14248         of signature parameter.  Add object and shndx to signatures table.
14249         (Layout::find_kept_object): New function.
14250         * layout.h: Include <cstring>.
14251         (Layout::is_debug_info_section): New function.
14252         (Layout::add_comdat): Add new parameters.
14253         (Layout::find_kept_object): New function.
14254         (Layout::Kept_section): New struct.
14255         (Layout::Signatures): Change type of map range.
14256         * object.cc (Relobj::output_section_address): New function.
14257         (Sized_relobj::include_section_group): Add new parameters.  Change
14258         calls to Layout::add_comdat.  Change to build table of kept comdat
14259         groups and table mapping discarded sections to kept sections.
14260         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14261         (Sized_relobj::do_layout): Change calls to include_section_group and
14262         include_linkonce_section.
14263         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14264         value to zero when section is discarded.
14265         (Sized_relobj::map_to_kept_section): New function.
14266         * object.h (Relobj::output_section_address): New function.
14267         (Relobj::Comdat_group): New type.
14268         (Relobj::find_comdat_group): New function.
14269         (Relobj::Comdat_group_table): New type.
14270         (Relobj::Kept_comdat_section): New type.
14271         (Relobj::Kept_comdat_section_table): New type.
14272         (Relobj::add_comdat_group): New function.
14273         (Relobj::set_kept_comdat_section): New function.
14274         (Relobj::get_kept_comdat_section): New function.
14275         (Relobj::comdat_groups_): New field.
14276         (Relobj::kept_comdat_sections_): New field.
14277         (Symbol_value::input_value): Update comment.
14278         (Sized_relobj::map_to_kept_section) New function.
14279         (Sized_relobj::include_linkonce_section): Add new parameter.
14280         * target-reloc.h (Comdat_behavior): New type.
14281         (get_comdat_behavior): New function.
14282         (relocate_section): Add code to map a discarded section to the
14283         corresponding kept section when applying a relocation.
14284
14285 2008-04-30  Craig Silverstein  <csilvers@google.com>
14286
14287         * dwarf_reader.cc (next_generation_count): New static var.
14288         (Addr2line_cache_entry): New struct.
14289         (addr2line_cache): New static var.
14290         (Dwarf_line_info::one_addr2line): Added caching.
14291         (Dwarf_line_info::clear_addr2line_cache): New function.
14292         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14293         cache-size parameter.
14294         (Dwarf_line_info::one_addr2line_cache): New function.
14295         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14296         new cache-size argument to one_addr2line(), and clear cache.
14297
14298 2008-04-28  Cary Coutant  <ccoutant@google.com>
14299
14300         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14301         R_386_PC8 relocations.
14302
14303 2008-04-23  Ian Lance Taylor  <iant@google.com>
14304
14305         * object.cc (Sized_relobj::include_section_group): Check for
14306         invalid section group.
14307
14308         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14309         header size.
14310
14311         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14312         than read for file header.
14313         * archive.cc (Archive::include_member): Likewise.
14314
14315 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14316
14317         * aclocal.m4: Regenerate.
14318         * configure: Regenerate.
14319
14320 2008-04-19  Ian Lance Taylor  <iant@google.com>
14321
14322         * version.cc (version_string): Bump to 1.6.
14323
14324         * testsuite/Makefile.am (many_sections_r_test): New target.
14325         (many_sections_r_test_SOURCES): Remove.
14326         (many_sections_r_test_DEPENDENCIES): Remove.
14327         (many_sections_r_test_LDFLAGS): Remove.
14328         (many_sections_r_test_LDADD): Remove.
14329
14330         * object.cc (Sized_relobj::do_add_symbols): Always pass
14331         local_symbol_count_ to add_from_relobj.
14332
14333         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14334         every thousand variables.
14335         * testsuite/Makefile.in: Rebuild.
14336
14337         * object.cc (Xindex::initialize_symtab_xindex): New function.
14338         (Xindex::read_symtab_xindex): New function.
14339         (Xindex::sym_xindex_to_shndx): New function.
14340         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14341         available.
14342         (Sized_relobj::do_initialize_xindex): New function.
14343         (Sized_relobj::do_read_symbols): Adjust section links.
14344         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14345         parameter.  Change all callers.
14346         (Sized_relobj::include_section_group): Adjust section links and
14347         symbol section indexes.
14348         (Sized_relobj::do_layout): Adjust section links.
14349         (Sized_relobj::do_count_local_symbols): Adjust section links and
14350         symbol section indexes.
14351         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14352         ordinary and special symbols.
14353         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14354         dynsym_xindex parameters.  Change all callers.  Adjust section
14355         links.  Use SHN_XINDEX when needed.
14356         (Sized_relobj::get_symbol_location_info): Adjust section links.
14357         Don't get fooled by special symbols.
14358         * object.h (class Xindex): Define.
14359         (class Object): Add xindex_ parameter.  Declare virtual functoin
14360         do_initialize_xindex.
14361         (Object::adjust_sym_shndx): New function.
14362         (Object::set_xindex): New protected function.
14363         (class Symbol_value): Add is_ordinary_shndx_ field.
14364         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14365         (Symbol_value::value): Assert ordinary section.
14366         (Symbol_value::initialize_input_to_output_map): Likewise.
14367         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14368         Change all callers.
14369         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14370         all callers.
14371         (class Sized_relobj): Update declarations.
14372         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14373         parameter.  Change all callers.
14374         (Sized_relobj::adjust_shndx): New function.
14375         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14376         field.
14377         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14378         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14379         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14380         (Sized_dynobj::read_dynsym_section): Adjust section links.
14381         (Sized_dynobj::read_dynamic): Likewise.
14382         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14383         section links.
14384         (Sized_dynobj::do_initialize_xindex): New function.
14385         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14386         do_initialize_xindex.
14387         (Sized_dynobj::adjust_shndx): New function.
14388         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14389         dynsym_xindex_ fields.
14390         (Layout::finalize): Add a call to set_section_indexes before
14391         creating the symtab sections.
14392         (Layout::set_section_indexes): Don't do anything if the section
14393         already has a section index.
14394         (Layout::create_symtab_sections): Add shnum parameter.  Change
14395         caller.  Create .symtab_shndx section if needed.
14396         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14397         caller.
14398         (Layout::allocated_output_section_count): New function.
14399         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14400         needed.
14401         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14402         fields.  Update declarations.
14403         (Layout::symtab_xindex): New function.
14404         (Layout::dynsym_xindex): New function.
14405         (class Write_symbols_task): Add layout_ field.
14406         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14407         Change caller.
14408         * output.cc (Output_section_headers::Output_section_headers): Add
14409         shstrtab_section parameter.  Change all callers.
14410         (Output_section_headers::do_sized_write): Store overflow values
14411         for section count and section string table section index in
14412         section header zero.
14413         (Output_file_header::do_sized_write): Check for overflow of
14414         section count and section string table section index.
14415         (Output_symtab_xindex::do_write): New function.
14416         (Output_symtab_xindex::endian_do_write): New function.
14417         * output.h (class Output_section_headers): Add shstrtab_section_.
14418         Update declarations.
14419         (class Output_symtab_xindex): Define.
14420         (Output_section::has_out_shndx): New function.
14421         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14422         field.
14423         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14424         Change all callers.
14425         (Sized_symbol::init): Likewise.
14426         (Symbol::output_section): Check for ordinary symbol.
14427         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14428         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14429         callers.
14430         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14431         Change all callers.  Simplify handling of symbols from sections
14432         not included in the link.
14433         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14434         distinction.
14435         (Weak_alias_sorter::operator()): Assert that symbols are
14436         ordinary.
14437         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14438         distinction.
14439         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14440         parameters.  Change all callers.
14441         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14442         symbol distinction.  Use SHN_XINDEX when needed.
14443         (Symbol_table::write_section_symbol): Add symtab_xindex
14444         parameter.  Change all callers.
14445         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14446         SHN_XINDEX when needed.
14447         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14448         declarations.
14449         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14450         (Symbol::is_defined): Check is_ordinary.
14451         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14452         (Symbol::is_absolute, Symbol::is_common): Likewise.
14453         (class Sized_symbol): Update declarations.
14454         (class Symbol_table): Update declarations.
14455         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14456         parameters.  Change all callers.
14457         (Sized_symbol::override): Likewise.
14458         (Symbol_table::override): Likewise.
14459         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14460         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14461         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14462         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14463         to be in an ordinary section.
14464         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14465         object and is_ordinary parameters.  Change all callers.
14466         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14467         Change all callers.  Don't add undefined or non-ordinary symbols
14468         to reloc_map_.
14469         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14470         Change all callers.
14471         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14472         declarations.
14473         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14474         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14475         (Sized_relobj::relocate_sections): Likewise.
14476         * target-reloc.h (scan_relocs): Adjust section symbol index.
14477         (scan_relocatable_relocs): Likewise.
14478         * i386.cc (Scan::local): Check for ordinary symbols.
14479         * sparc.cc (Scan::local): Likewise.
14480         * x86_64.cc (Scan::local): Likewise.
14481         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14482         to symbol_section_and_value.
14483         * testsuite/many_sections_test.cc: New file.
14484         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14485         (check_PROGRAMS): Add many_sections_test.
14486         (many_sections_test_SOURCES): Define.
14487         (many_sections_test_DEPENDENCIES): Define.
14488         (many_sections_test_LDFLAGS): Define.
14489         (BUILT_SOURCES): Add many_sections_define.h.
14490         (many_sections_define.h): New target.
14491         (BUILT_SOURCES): Add many_sections_check.h.
14492         (many_sections_check.h): New target.
14493         (check_PROGRAMS): Add many_sections_r_test.
14494         (many_sections_r_test_SOURCES): Define.
14495         (many_sections_r_test_DEPENDENCIES): Define.
14496         (many_sections_r_test_LDFLAGS): Define.
14497         (many_sections_r_test_LDADD): Define.
14498         (many_sections_r_test.o): New target.
14499         * testsuite/Makefile.in: Rebuild.
14500
14501 2008-04-17  Cary Coutant  <ccoutant@google.com>
14502
14503         * errors.cc (Errors::info): New function.
14504         (gold_info): New function.
14505         * errors.h (Errors::info): New function.
14506         * gold.h (gold_info): New function.
14507         * object.cc (Input_objects::add_object): Print trace output.
14508         * options.cc (options::parse_set): New function.
14509         (General_options::parse_wrap): Deleted.
14510         (General_options::General_options): Deleted initializer.
14511         * options.h (options::String_set): New typedef.
14512         (options::parse_set): New function.
14513         (DEFINE_set): New macro.
14514         (General_options::wrap): Changed to use DEFINE_set. Changed
14515         callers of any_wrap_symbols and is_wrap_symbol.
14516         (General_options::trace, General_options::trace_symbol):
14517         New options.
14518         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14519         (General_options::wrap_symbols_): Deleted.
14520         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14521
14522 2008-04-17  David S. Miller  <davem@davemloft.net>
14523
14524         * options.cc (General_options::parse_V): New function.
14525         * options.h: Add entries for -V and -Qy.
14526
14527 2008-04-17  Ian Lance Taylor  <iant@google.com>
14528
14529         * common.cc (Symbol_table::allocate_commons): Remove options
14530         parameter.  Change caller.
14531         (Symbol_table::do_allocate_commons): Remove options parameter.
14532         Change caller.  Just call do_allocate_commons_list twice.
14533         (Symbol_table::do_allocate_commons_list): New function, broken out
14534         of do_allocate_commons.
14535         * common.h (class Allocate_commons_task): Remove options_ field.
14536         Update constructor.
14537         * symtab.cc (Symbol_table::Symbol_table): Initialize
14538         tls_commons_.
14539         (Symbol_table::add_from_object): Put TLS common symbols on
14540         tls_commons_ list.
14541         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14542         which are IN_OUTPUT_DATA.
14543         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14544         allocate_commons and do_allocate_commons declarations.  Declare
14545         do_allocate_commons_list.
14546         * gold.cc (queue_middle_tasks): Update creation of
14547         Allocate_commons_task to not pass options.
14548         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14549         (TLS_TEST_C_FLAGS): New variable.
14550         (tls_test_c_pic.o): New target.
14551         (tls_test_shared.so): Link in tls_test_c_pic.o.
14552         (tls_test_c_pic_ie.o): New target.
14553         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14554         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14555         (tls_test_c.o): New target.
14556         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14557         (tls_pic_test_LDADD): Likewise.
14558         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14559         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14560         (tls_test_c_gnu2.o): New target.
14561         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14562         tls_test_c_gnu2.o.
14563         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14564         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14565         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14566         * testsuite/tls_test.cc: Include "config.h".
14567         (t_last): Call t11_last.
14568         * testsuite/tls_test.h (t11, t11_last): Declare.
14569         * testsuite/tls_test_c.c: New file.
14570         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14571         * configure.ac: Check for OpenMP support.
14572         * configure, config.in, Makefile.in: Rebuild.
14573         * testsuite/Makefile.in: Rebuild.
14574
14575 2008-04-16  Cary Coutant  <ccoutant@google.com>
14576
14577         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14578         (Target_i386::tls_base_symbol_defined_): New field.
14579         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14580         (Target_i386::Scan::global): Likewise.
14581         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14582         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14583         (Target_x86_64::tls_base_symbol_defined_): New field.
14584         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14585         (Target_x86_64::Scan::global): Likewise.
14586
14587 2008-04-16  Cary Coutant  <ccoutant@google.com>
14588
14589         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14590         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14591         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14592         building shared libraries.
14593         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14594         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14595         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14596         * testsuite/Makefile.in: Rebuild.
14597         * testsuite/weak_undef.h: New file.
14598         * testsuite/weak_undef_file1.cc: Add extra test cases.
14599         * testsuite/weak_undef_file2.cc: Likewise.
14600         * testsuite/weak_undef_test.cc: Likewise.
14601
14602 2008-04-16  David S. Miller  <davem@davemloft.net>
14603
14604         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14605         Add issued_non_pic_error_ field.  Declare check_non_pic.
14606         (Target_sparc::Scan::check_non_pic): New function.
14607         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14608         (Target_sparc::Scan::global): Likewise.
14609
14610         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14611         * configure: Rebuild.
14612
14613         * options.h (DEFINE_enable): New macro.
14614         (new_dtags): New enable option.
14615         (initfirst, interpose, loadfltr, nodefaultlib,
14616         nodelete, nodlopen, nodump): New -z options.
14617         * layout.cc (Layout:finish_dynamic_section): If new
14618         dtags enabled, emit DT_RUNPATH.  Also, emit a
14619         DT_FLAGS_1 containing any specified -z flags.
14620
14621 2008-04-16  Ian Lance Taylor  <iant@google.com>
14622
14623         * copy-relocs.cc: New file.
14624         * copy-relocs.h: New file.
14625         * reloc.cc: Remove Copy_relocs code.
14626         * reloc.h: Likewise.
14627         * reloc-types.h (struct Reloc_types) [both versions]: Add
14628         get_reloc_addend_noerror.
14629         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14630         variants of add_global which take an addend which must be zero.
14631         * i386.cc: Include "copy-relocs.h".
14632         (class Target_i386): Change type of copy_relocs_ to variable,
14633         update initializer.
14634         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14635         Change all callers.
14636         (Target_i386::do_finalize_sections): Change handling of
14637         copy_relocs_.
14638         * sparc.cc: Include "copy-relocs.h".
14639         (class Target_sparc): Change type of copy_relocs_ to variable,
14640         update initializer.
14641         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14642         Change all callers.
14643         (Target_sparc::do_finalize_sections): Change handling of
14644         copy_relocs_.
14645         * x86_64.cc: Include "copy-relocs.h".
14646         (class Target_x86_64): Change type of copy_relocs_ to variable,
14647         update initializer.
14648         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14649         class.  Change all callers.
14650         (Target_x86_64::do_finalize_sections): Change handling of
14651         copy_relocs_.
14652         * Makefile.am (CCFILES): Add copy-relocs.cc.
14653         (HFILES): Add copy-relocs.h.
14654
14655         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14656
14657         * testsuite/script_test_4.sh: Permit leading zeroes.
14658
14659 2008-04-15  Ian Lance Taylor  <iant@google.com>
14660
14661         * script-sections.cc (Script_sections::create_segments): Use
14662         header_size_adjustment even when there is enough room for the
14663         headers.
14664         * testsuite/script_test_4.sh: New file.
14665         * testsuite/script_test_4.t: New file.
14666         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14667         (check_DATA): Add script_test_4.stdout.
14668         (MOSTLYCLEANFILES): Likewise.
14669         (script_test_4): New target.
14670         (script_test_4.stdout): New target.
14671         * testsuite/Makefile.in: Rebuild.
14672
14673         * sparc.cc: Add definitions for Output_data_plt_sparc class
14674         constants.
14675
14676 2008-04-14  David S. Miller  <davem@davemloft.net>
14677
14678         * sparc.cc: New file.
14679         * Makefile.am (TARGETSOURCES): Add sparc.cc
14680         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14681         * configure.tgt: Document targ_extra_size and
14682         targ_extra_big_endian.  Add entries for sparc-* and
14683         sparc64-*.
14684         * configure.ac: Handle targ_extra_size and
14685         targ_extra_big_endian.
14686         * Makefile.in: Rebuild.
14687         * configure: Likewise.
14688         * po/POTFILES.in: Likewise.
14689         * po/gold.pot: Likewise.
14690
14691 2008-04-14  Ian Lance Taylor  <iant@google.com>
14692
14693         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14694         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14695         in the name/type/flags to section mapping.  Don't call
14696         allocate_output_section.
14697         (Layout::choose_output_section): Change parameter from adjust_name
14698         to is_input_section.  Don't permit input sections after sections
14699         are attached to segments.  Don't call allocate_output_section.
14700         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14701         not write_enable_output_section.
14702         (Layout::make_output_section): Don't push to
14703         unattached_section_list_ nor call attach_to_segment.  Call
14704         attach_section_to_segment if sections are attached.
14705         (Layout::attach_sections_to_segments): New function.
14706         (Layout::attach_section_to_segment): New function.
14707         (Layout::attach_allocated_section_to_segment): Rename from
14708         attach_to_segment.  Remove flags parameter.
14709         (Layout::allocate_output_section): Remove function.
14710         (Layout::write_enable_output_section): Remove function.
14711         * layout.h (class Layout): Update for above changes.  Add new
14712         field sections_are_attached_.
14713         * output.h (Output_section::update_flags_for_input_section): New
14714         function.
14715         * output.cc (Output_section::add_input_section): Call
14716         update_flags_for_input_section.
14717         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14718
14719 2008-04-11  Cary Coutant  <ccoutant@google.com>
14720
14721         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14722         thought unnecessary.
14723         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14724
14725 2008-04-11  Ian Lance Taylor  <iant@google.com>
14726
14727         * output.h (class Output_section_data): Remove inline definition
14728         of set_addralign.
14729         * output.cc (Output_section_data::set_addralign): New function.
14730
14731 2008-04-11  Cary Coutant  <ccoutant@google.com>
14732
14733         Add support for TLS descriptors for i386 and x86_64.
14734         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14735         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14736         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14737         GOT_TYPE_TLS_DESC.
14738         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14739         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14740         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14741         relocations.
14742         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14743         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14744         Fix problem with initial-exec relocations.
14745         (Target_i386::Relocate::relocate_tls): Likewise.
14746         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14747         relaxation.
14748         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14749         support for section-plus-offset dynamic table entries.
14750         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14751         (Output_data_dynamic::Dynamic_entry): Add support for
14752         section-plus-offset dynamic table entries.
14753         (Output_data_dynamic::Classification): Likewise.
14754         (Output_data_dynamic::classification_): Renamed offset_.
14755         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14756         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14757         (Target_x86_64::make_plt_section): New function.
14758         (Target_x86_64::reserve_tlsdesc_entries): New function.
14759         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14760         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14761         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14762         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14763         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14764         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14765         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14766         add extra PLT entry for TLS descriptors.
14767         (Output_data_plt_x86_64::got_): New field.
14768         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14769         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14770         fields.
14771         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14772         descriptors.
14773         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14774         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14775         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14776         R_386_TLS_DESC_CALL relocations.
14777         (Target_x86_64::Scan::global): Likewise.
14778         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14779         for TLS descriptors.
14780         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14781         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14782         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14783         GD-to-IE relaxation.
14784         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14785         and TLS_DESCRIPTORS.
14786         * Makefile.in: Rebuild.
14787         * configure: Rebuild.
14788         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14789         (tls_test_shared2.so): New target.
14790         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14791         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14792         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14793         (tls_shared_gd_to_ie_test_LDADD): New variable.
14794         (tls_shared_gnu2_gd_to_ie_test): New target.
14795         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14796         New targets.
14797         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14798         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14799         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14800         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14801         (tls_shared_gnu2_test): New target.
14802         (tls_test_gnu2_shared.so): New target.
14803         (tls_shared_gnu2_test_SOURCES): New variable.
14804         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14805         (tls_shared_gnu2_test_LDFLAGS): New variable.
14806         (tls_shared_gnu2_test_LDADD): New variable.
14807         * testsuite/Makefile.in: Rebuild.
14808         * testsuite/Makefile.
14809
14810 2008-04-11  Ian Lance Taylor  <iant@google.com>
14811
14812         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14813         justsyms.t.
14814         * testsuite/Makefile.in: Rebuild.
14815
14816         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14817         long.
14818         * testsuite/script_test_2.cc (main): Adjust test.
14819
14820 2008-04-11  David S. Miller  <davem@davemloft.net>
14821             Ian Lance Taylor  <iant@google.com>
14822
14823         * options.h (General_options): Add entries for '-Y' and
14824         '-relax'.
14825         * options.cc (General_options:finalize): If -Y was used, add those
14826         entries to the library path instead of the default "/lib" and
14827         "/usr/lib".
14828
14829 2008-04-11  David S. Miller  <davem@davemloft.net>
14830
14831         * testsuite/justsyms.t: Start at 0x100.
14832         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14833         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14834         long.
14835         * testsuite/script_test_2.cc: Adjust string and section length
14836         checks.
14837
14838 2008-04-09  Ian Lance Taylor  <iant@google.com>
14839
14840         PR gold/5996
14841         * script-sections.cc (Sections_element::allocate_to_segment): Add
14842         orphan parameter.
14843         (Output_section_definition::allocate_to_segment): Likewise.
14844         (Orphan_output_section::allocate_to_segment): Likewise.
14845         (Script_sections::attach_sections_using_phdrs_clause): Don't
14846         propagate non-PT_LOAD segments to orphan sections.
14847         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14848         readelf rather than objdump.
14849         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14850         .interp section and PT_INTERP segment are the same size.
14851         * testsuite/Makefile.in: Rebuild.
14852
14853         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14854         aliases for symbols defined in the same object.
14855         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14856         (weak_alias_test_SOURCES): New variable.
14857         (weak_alias_test_DEPENDENCIES): New variable.
14858         (weak_alias_test_LDFLAGS): New variable.
14859         (weak_alias_test_LDADD): New variable.
14860         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14861         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14862         (weak_alias_test_3.o): New target.
14863         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14864         * testsuite/weak_alias_test_main.cc: New file.
14865         * testsuite/weak_alias_test_1.cc: New file.
14866         * testsuite/weak_alias_test_2.cc: New file.
14867         * testsuite/weak_alias_test_3.cc: New file.
14868
14869 2008-04-08  Ian Lance Taylor  <iant@google.com>
14870
14871         * options.h (class General_options): Add --noinhibit-exec option.
14872         * main.cc (main): Check --noinhibit-exec.
14873
14874         * options.h (class General_options): Define --wrap as a special
14875         option.  Add wrap_symbols_ field.
14876         (General_options::any_wrap_symbols): New function.
14877         (General_options::is_wrap_symbol): New function.
14878         * options.cc (General_options::parse_wrap): New function.
14879         (General_options::General_options): Initialize wrap_symbols_.
14880         * symtab.cc (Symbol_table::wrap_symbol): New function.
14881         (Symbol_table::add_from_object): Handle --wrap.
14882         * symtab.h (class Symbol_table): Declare wrap_symbol.
14883         * target.h (Target::wrap_char): New function.
14884         (Target::Target_info): Add wrap_char field.
14885         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14886         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14887         * testsuite/testfile.cc (Target_test::test_target_info):
14888         Likewise.
14889
14890         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14891         there is one.
14892
14893         * layout.h (class Layout): Add added_eh_frame_data_ field.
14894         * layout.cc (Layout::Layout): Initialize new field.
14895         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
14896         output section until we find a section we merged successfully.
14897         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
14898         that the size be non-zero.
14899
14900         * merge.cc (Object_merge_map::get_output_offset): Remove inline
14901         qualifier.
14902
14903 2008-04-08  Craig Silverstein  <csilvers@google.com>
14904
14905         * configure.ac: Export new conditional variable HAVE_ZLIB.
14906         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
14907         on HAVE_ZLIB.
14908         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
14909         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14910
14911 2008-04-07  Ian Lance Taylor  <iant@google.com>
14912
14913         * version.cc (version_string): Set to "1.5".
14914
14915         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
14916         Add issued_non_pic_error_ field.  Declare check_non_pic.
14917         (Target_x86_64::Scan::check_non_pic): New function.
14918         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
14919         (Target_x86_64::Scan::global): Likewise.
14920
14921         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
14922         addend parameter.  Change caller.  Handle merge sections.
14923         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
14924         Address to Addend.  Don't add in the result of
14925         local_section_offset, pass down the addend and use the returned
14926         value.
14927         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
14928         Update declarations of local_section_offset and symbol_value.
14929         * testsuite/two_file_test_1.cc (t18): New function.
14930         * testsuite/two_file_test_2.cc (f18): New function.
14931         * testsuite/two_file_test_main.cc (main): Call t18.
14932         * testsuite/two_file_test.h (t18, f18): Declare.
14933
14934         * configure.ac: Don't test for objdump, c++filt, or readelf.
14935         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
14936         conditionals.
14937         (TEST_READELF): New variable.
14938         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
14939         (check_PROGRAMS): Add two_file_strip_test.
14940         (two_file_strip_test): New target.
14941         (check_PROGRAMS): Add two_file_same_shared_strip_test.
14942         (two_file_same_shared_strip_test_SOURCES): New variable.
14943         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
14944         (two_file_same_shared_strip_test_LDFLAGS): New variable.
14945         (two_file_same_shared_strip_test_LDADD): New variable.
14946         (two_file_shared_strip.so): New target.
14947         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
14948         (ver_test_5.syms, ver_test_7.syms): Likewise.
14949         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
14950         (strip_test_3.stdout): Use TEST_OBJDUMP.
14951         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
14952
14953 2008-04-04  Cary Coutant  <ccoutant@google.com>
14954
14955         * symtab.h (Symbol::is_weak_undefined): New function.
14956         (Symbol::is_strong_undefined): New function.
14957         (Symbol::is_absolute): New function.
14958         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
14959         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
14960         absolute symbols.
14961         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
14962         (weak_undef_test): New target.
14963         * testsuite/Makefile.in: Rebuild.
14964         * testsuite/weak_undef_file1.cc: New file.
14965         * testsuite/weak_undef_file2.cc: New file.
14966         * testsuite/weak_undef_test.cc: New file.
14967
14968 2008-04-03  Craig Silverstein  <csilvers@google.com>
14969
14970         * compressed_output.h (class Output_compressed_section): Use
14971         unsigned buffer.
14972         * compressed_output.cc (zlib_compress): Use unsigned buffers,
14973         add zlib header.
14974         (zlib_compressed_suffix): Removed.
14975         (Output_compressed_section::set_final_data_size): Use unsigned
14976         buffers.
14977         * testsuite/Makefile.am (flagstest_compress_debug_sections):
14978         Fix linker invocation.
14979         (flagstest_o_specialfile_and_compress_debug_sections):
14980         Likewise.
14981         * testsuite/Makefile.in: Regenerated.
14982
14983 2008-04-02  David S. Miller  <davem@davemloft.net>
14984
14985         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
14986         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
14987
14988 2008-04-02  Craig Silverstein  <csilvers@google.com>
14989
14990         * TODO: New file.
14991
14992 2008-04-02  Ian Lance Taylor  <iant@google.com>
14993
14994         * fileread.cc (File_read::find_view): Add byteshift and vshifted
14995         parameters.  Update for new key type to views_.  Change all
14996         callers.
14997         (File_read::read): Adjust for byteshift in returned view.
14998         (File_read::add_view): New function, broken out of
14999         find_and_make_view.
15000         (File_read::make_view): New function, broken out of
15001         find_and_make_view.
15002         (File_read::find_or_make_view): Add offset and aligned
15003         parameters.  Rewrite accordingly.  Change all callers.
15004         (File_read::get_view): Add offset and aligned parameters.  Adjust
15005         for byteshift in return value.
15006         (File_read::get_lasting_view): Likewise.
15007         * fileread.h (class File_read): Update declarations.
15008         (class File_read::View): Add byteshift_ field.  Add byteshift to
15009         constructor.  Add byteshift method.
15010         * archive.h (Archive::clear_uncached_views): New function.
15011         (Archive::get_view): Add aligned parameter.  Change all callers.
15012         * object.h (Object::get_view): Add aligned parameter.  Change all
15013         callers.
15014         (Object::get_lasting_view): Likewise.
15015
15016         * fileread.cc (File_read::release): Don't call clear_views if
15017         there are multiple objects.
15018         * fileread.h (File_read::clear_uncached_views): New function.
15019         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15020         on the archive.
15021
15022 2008-03-31  Cary Coutant  <ccoutant@google.com>
15023
15024         Add thin archive support.
15025         * archive.cc (Archive::armagt): New const.
15026         (Archive::setup): Remove task parameter and calls to unlock.
15027         (Archive::unlock_nested_archives): New function.
15028         (Archive::read_header): Add nested_off parameter. Change
15029         all callers.
15030         (Archive::interpret_header): Likewise.
15031         (Archive::include_all_members): Change to handle thin
15032         archives.
15033         (Archive::include_member): Likewise.
15034         * archive.h (Archive::Archive): Add new parameters and
15035         initializers.
15036         (Archive::armagt): New const.
15037         (Archive::setup): Remove task parameter.
15038         (Archive::unlock_nested_archives): New function.
15039         (Archive::read_header): Add nested_off parameter.
15040         (Archive::interpret_header): Likewise.
15041         (Archive::Nested_archive_table): New typedef.
15042         (Archive::is_thin_archive_): New field.
15043         (Archive::nested_archives_): New field.
15044         (Archive::options_): New field.
15045         (Archive::dirpath_): New field.
15046         (Archive::task_): New field.
15047         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15048         for thin archives.  Pass additional parameters to
15049         Archive::Archive.  Unlock the archive file after calling
15050         Archive::setup.
15051
15052 2008-03-29  Ian Lance Taylor  <iant@google.com>
15053
15054         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15055         version symbol to be local.
15056         * testsuite/ver_test_4.sh: New file.
15057         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15058         (check_DATA): Add ver_test_4.syms.
15059         (ver_test_4.syms): New target.
15060         * testsuite/Makefile.in: Rebuild.
15061
15062         * output.cc
15063         (Output_section::Input_section_sort_entry::has_priority): New
15064         function.
15065         (Output_section::Input_section_sort_entry::match_file_name): New
15066         function.
15067         (Output_section::Input_section_sort_entry::match_section_name):
15068         Remove.
15069         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15070         Remove.
15071         (Output_section::Input_section_sort_entry::match_section_file):
15072         Remove.
15073         (Output_section::Input_section_sort_compare::operator()): Rewrite
15074         using new Input_section_sort_entry functions.  Sort crtbegin and
15075         crtend first.  Sort sections with no priority before sections with
15076         a priority.
15077         * testsuite/initpri1.c (d3): Check j != 4.
15078         (cd5): New constructor/destructor function.
15079         (main): Check j != 2.
15080
15081         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15082         new symbol when resolving, don't call set_is_default.
15083         * testsuite/ver_test_7.cc: New file.
15084         * testsuite/ver_test_7.sh: New file.
15085         * testsuite/Makefile.am (ver_test_7.so): New target.
15086         (ver_test_7.o): New target.
15087         (check_SCRIPTS): Add ver_test_7.sh.
15088         (check_DATA): Add ver_test_7.syms.
15089         (ver_test_7.syms): New target.
15090
15091 2008-03-28  Ian Lance Taylor  <iant@google.com>
15092
15093         * layout.cc (Layout::layout): If we see an input section with a
15094         name that needs sorting, set the must_sort flag for the output
15095         section.
15096         (Layout::make_output_section): If the name of the output section
15097         indicates that it might require sorting, set the may_sort flag.
15098         * output.h (Output_section::may_sort_attached_input_sections): New
15099         function.
15100         (Output_section::set_may_sort_attached_input_sections): New
15101         function.
15102         (Output_section::must_sort_attached_input_sections): New
15103         function.
15104         (Output_section::set_must_sort_attached_input_sections): New
15105         function.
15106         (class Output_section): Declare Input_section_sort_entry.  Define
15107         Input_section_sort_compare.  Declare
15108         sort_attached_input_sections.  Add new fields:
15109         may_sort_attached_input_sections_,
15110         must_sort_attached_input_sections_,
15111         attached_input_sections_are_sorted_.
15112         * output.cc (Output_section::Output_section): Initialize new
15113         fields.
15114         (Output_section::add_input_section): Add an entry to
15115         input_sections_ if may_sort or must_sort are true.
15116         (Output_section::set_final_data_size): Call
15117         sort_attached_input_sections if necessary.
15118         (Output_section::Input_section_sort_entry): Define new class.
15119         (Output_section::Input_section_sort_compare::operator()): New
15120         function.
15121         (Output_section::sort_attached_input_sections): New function.
15122         * configure.ac: Check whether the compiler supports constructor
15123         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15124         * testsuite/initpri1.c: New file.
15125         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15126         CONSTRUCTOR_PRIORITY.
15127         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15128         (initpri1_LDFLAGS): New variable.
15129         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15130
15131 2008-03-27  Ian Lance Taylor  <iant@google.com>
15132
15133         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15134         * testsuite/common_test_1.c: New file.
15135         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15136         (common_test_1_SOURCES): New variable.
15137         (common_test_1_DEPENDENCIES): New variable.
15138         (common_test_1_LDFLAGS): New variable.
15139
15140         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15141         and commons_ correctly when NAME/VERSION does not override
15142         NAME/NULL.
15143         * testsuite/ver_test_6.c: New file.
15144         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15145         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15146         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15147
15148 2008-03-26  Ian Lance Taylor  <iant@google.com>
15149
15150         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15151         of an undefined symbol from a version script.
15152         * testsuite/Makefile.am (ver_test_5.so): New target.
15153         (ver_test_5.o): New target.
15154         (check_SCRIPTS): Add ver_test_5.sh.
15155         (check_DATA): Add ver_test_5.syms.
15156         (ver_test_5.syms): New target.
15157         * testsuite/ver_test_5.cc: New file.
15158         * testsuite/ver_test_5.script: New file.
15159         * testsuite/ver_test_5.sh: New file.
15160         * Makefile.in, testsuite/Makefile.in: Rebuild.
15161
15162         PR gold/5986
15163         Fix problems building gold with gcc 4.3.0.
15164         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15165         (gold_error_at_location, gold_warning_at_location): Use it.
15166         * configure.ac: Check whether we can compile and use a template
15167         function with a printf attribute.
15168         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15169         when jumping over bytes.
15170         * object.cc: Instantiate Object::read_section_data.
15171         * debug.h: Include <cstring>
15172         * dwarf_reader.cc: Include <algorithm>
15173         * main.cc: Include <cstring>.
15174         * options.cc: Include <cstring>.
15175         * output.cc: Include <cstring>.
15176         * script.cc: Include <cstring>.
15177         * script.h: Include <string>.
15178         * symtab.cc: Include <cstring> and <algorithm>.
15179         * target-select.cc: Include <cstring>.
15180         * version.cc: Include <string>.
15181         * testsuite/testmain.cc: Include <cstdlib>.
15182         * configure, config.in: Rebuild.
15183
15184 2008-03-25  Ian Lance Taylor  <iant@google.com>
15185
15186         * options.cc: Include "../bfd/bfdver.h".
15187         (options::help): Print bug reporting address.
15188
15189         * version.cc (print_version): Adjust output for current value of
15190         BFD_VERSION_STRING.
15191
15192         * NEWS: New file.
15193
15194         * options.cc (options::help): Print list of supported targets.
15195         * target-select.h: Include <vector>.
15196         (class Target_selector): Make machine_, size_, and is_big_endian_
15197         fields const.  Add bfd_name_ and instantiated_target_ fields.
15198         (Target_selector::Target_selector): Add bfd_name parameter.
15199         (Target_selector::recognize): Make non-virtual, call
15200         do_recognize.
15201         (Target_selector::recognize_by_name): Make non-virtual, call
15202         do_recognize_by_name.
15203         (Target_selector::supported_names): New function.
15204         (Target_selector::bfd_name): New function.
15205         (Target_selector::do_instantiate_target): New pure virtual
15206         function.
15207         (Target_selector::do_recognize): New virtual function.
15208         (Target_selector::do_recognize_by_name): New virtual function.
15209         (Target_selector::instantiate_target): New private function.
15210         (supported_target_names): Declare.
15211         * target-select.cc (Target_selector::Target_selector): Update for
15212         new parameter and fields.
15213         (select_target_by_name): Check that the name matches before
15214         calling recognize_by_name.
15215         (supported_target_names): New function.
15216         * i386.cc (class Target_selector_i386): Update Target_selector
15217         constructor call.  Remove recognize and recognize_by_name.  Add
15218         do_instantiate_target.
15219         * x86_64.cc (class Target_selector_x86_64): Likewise.
15220         * testsuite/testfile.cc (class Target_selector_test): Update for
15221         changes to Target_selector.
15222
15223         * README: Rewrite, with some notes on unsupported features.
15224
15225 2008-03-24  Cary Coutant  <ccoutant@google.com>
15226
15227         * i386.cc (Target_i386::Got_type): New enum declaration.
15228         (Target_i386::Scan::local): Updated callers of Output_data_got
15229         member functions.
15230         (Target_i386::Scan::global): Likewise.
15231         (Target_i386::Relocate::relocate): Likewise.
15232         (Target_i386::Relocate::relocate_tls): Likewise.
15233         * object.h (Got_offset_list): New class.
15234         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15235         (Sized_relobj::local_got_offset): Likewise.
15236         (Sized_relobj::set_local_got_offset): Likewise.
15237         (Sized_relobj::local_has_tls_got_offset): Removed.
15238         (Sized_relobj::local_tls_got_offset): Removed.
15239         (Sized_relobj::set_local_tls_got_offset): Removed.
15240         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15241         * output.cc (Output_data_got::add_global): Added got_type parameter.
15242         (Output_data_got::add_global_with_rel): Likewise.
15243         (Output_data_got::add_global_with_rela): Likewise.
15244         (Output_data_got::add_global_pair_with_rel): New function.
15245         (Output_data_got::add_global_pair_with_rela): New function.
15246         (Output_data_got::add_local): Added got_type parameter.
15247         (Output_data_got::add_local_with_rel): Likewise.
15248         (Output_data_got::add_local_with_rela): Likewise.
15249         (Output_data_got::add_local_pair_with_rel): New function.
15250         (Output_data_got::add_local_pair_with_rela): New function.
15251         (Output_data_got::add_global_tls): Removed.
15252         (Output_data_got::add_global_tls_with_rel): Removed.
15253         (Output_data_got::add_global_tls_with_rela): Removed.
15254         (Output_data_got::add_local_tls): Removed.
15255         (Output_data_got::add_local_tls_with_rel): Removed.
15256         (Output_data_got::add_local_tls_with_rela): Removed.
15257         * output.h (Output_data_got::add_global): Added got_type parameter.
15258         (Output_data_got::add_global_with_rel): Likewise.
15259         (Output_data_got::add_global_with_rela): Likewise.
15260         (Output_data_got::add_global_pair_with_rel): New function.
15261         (Output_data_got::add_global_pair_with_rela): New function.
15262         (Output_data_got::add_local): Added got_type parameter.
15263         (Output_data_got::add_local_with_rel): Likewise.
15264         (Output_data_got::add_local_with_rela): Likewise.
15265         (Output_data_got::add_local_pair_with_rel): New function.
15266         (Output_data_got::add_local_pair_with_rela): New function.
15267         (Output_data_got::add_global_tls): Removed.
15268         (Output_data_got::add_global_tls_with_rel): Removed.
15269         (Output_data_got::add_global_tls_with_rela): Removed.
15270         (Output_data_got::add_local_tls): Removed.
15271         (Output_data_got::add_local_tls_with_rel): Removed.
15272         (Output_data_got::add_local_tls_with_rela): Removed.
15273         * resolve.cc (Symbol::override_base_with_special): Removed
15274         reference to has_got_offset_ field.
15275         * symtab.cc (Symbol::init_fields): Replaced initialization
15276         of got_offset_ with got_offsets_.  Removed initialization
15277         of has_got_offset_
15278         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15279         (Symbol::got_offset): Likewise.
15280         (Symbol::set_got_offset): Likewise.
15281         (Symbol::has_tls_got_offset): Removed.
15282         (Symbol::tls_got_offset): Removed.
15283         (Symbol::set_tls_got_offset): Removed.
15284         (Symbol::got_offset_): Removed.
15285         (Symbol::tls_mod_got_offset_): Removed.
15286         (Symbol::tls_pair_got_offset_): Removed.
15287         (Symbol::got_offsets_): New field.
15288         (Symbol::has_got_offset): Removed.
15289         (Symbol::has_tls_mod_got_offset): Removed.
15290         (Symbol::has_tls_pair_got_offset): Removed.
15291         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15292         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15293         member functions.
15294         (Target_x86_64::Scan::global): Likewise.
15295         (Target_x86_64::Relocate::relocate): Likewise.
15296         (Target_x86_64::Relocate::relocate_tls): Likewise.
15297
15298 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15299
15300         * yyscript.y: Fix spelling error in comment.
15301
15302 2008-03-24  Ian Lance Taylor  <iant@google.com>
15303
15304         * options.h (class General_options): Define build_id option.
15305         * layout.h (class Layout): Declare write_build_id, create_note,
15306         create_build_id.  Add build_id_note_ member.
15307         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15308         "libiberty.h", "md5.h", "sha1.h".
15309         (Layout::Layout): Initialize eh_frame_data_,
15310         eh_frame_hdr_section_, and build_id_note_.
15311         (Layout::finalize): Call create_build_id.
15312         (Layout::create_note): New function, broken out of
15313         Layout::create_gold_note.
15314         (Layout::create_gold_note): Call create_note.
15315         (Layout::create_build_id): New function.
15316         (Layout::write_build_id): New function.
15317         (Close_task_runner::run): Call write_build_id.
15318
15319         * x86_64.cc: Correct license to GPLv3.
15320
15321 2008-03-23  Ian Lance Taylor  <iant@google.com>
15322
15323         * options.cc: Include "demangle.h".
15324         (parse_optional_string): New function.
15325         (parse_long_option): Handle takes_optional_argument.
15326         (parse_short_option): Update dash_z initializer.  Handle
15327         takes_optional_argument.
15328         (General_options::General_options): Initialize do_demangle_.
15329         (General_options::finalize): Set do_demangle_.  Handle demangling
15330         style.
15331         * options.h (parse_optional_string): Declare.
15332         (struct One_option): Add optional_arg field.  Update constructor.
15333         Update call constructor calls.  Add takes_optional_argument
15334         function.
15335         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15336         (DEFINE_optional_string): Define.
15337         (General_options::demangle): Change from DEFINE_bool to
15338         DEFINE_optional_string.
15339         (General_options::no_demangle): New function.
15340         (General_options::do_demangle): New function.
15341         (General_options::set_do_demangle): New function.
15342         (General_options::execstack_status_): Move definition to end of
15343         class definition.
15344         (General_options::static_): Likewise.
15345         (General_options::do_demangle_): New field.
15346         * object.cc (big_endian>::get_symbol_location_info): Call
15347         Options::do_demangle, not Options::demangle.
15348         * symtab.cc (demangle): Likewise.
15349
15350 2008-03-22  Ian Lance Taylor  <iant@google.com>
15351
15352         * gold.h: Include <cstddef> and <sys/types.h>
15353         * options.h: Include <cstring>.
15354
15355 2008-03-21  Ian Lance Taylor  <iant@google.com>
15356
15357         * Added source code to GNU binutils.
15358 \f
15359 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15360
15361 Copying and distribution of this file, with or without modification,
15362 are permitted in any medium without royalty provided the copyright
15363 notice and this notice are preserved.
15364
15365 Local Variables:
15366 mode: change-log
15367 left-margin: 8
15368 fill-column: 74
15369 version-control: never
15370 End: