Use in-tree assembler for exception_x86_64_bnd_test.
[external/binutils.git] / gold / ChangeLog
1 2013-11-22  Cary Coutant  <ccoutant@google.com>
2
3         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
4         assembler.
5         * testsuite/Makefile.in: Regenerate.
6
7 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
8
9         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
10         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
11         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
12         (Target_x86_64<size>::Scan::local): Likewise.
13         (Target_x86_64<size>::Scan::global): Likewise.
14         (Target_x86_64<size>::Relocate::relocate): Likewise.
15         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
16         Likewise.
17         (Target_x86_64<size>::Scan::check_non_pic(): Handle
18         R_X86_64_PC32_BND.
19
20         * testsuite/Makefile.am (check_PROGRAMS): Add
21         exception_x86_64_bnd_test.
22         (exception_x86_64_bnd_test_SOURCES): New macro.
23         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
24         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
25         (exception_x86_64_bnd_test_LDADD): Likewise.
26         (exception_x86_64_bnd_1.o): New rule.
27         (exception_x86_64_bnd_2.o): Likewise.
28         * testsuite/Makefile.in: Regenerated.
29
30 2013-11-15  Alan Modra  <amodra@gmail.com>
31
32         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
33         accessor.
34         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
35         Only call ppc64_local_entry_offset for 64-bit.  Restrict
36         symval_for_branch lookup to ELFv1.
37         (Stub_table::add_plt_call_entry): Use unsigned int off.
38         (Output_data_glink::Address, invalid_address): New.
39         (Output_data_glink::add_eh_frame): Move out of line.  Add
40         support for ELFv2.
41         (Output_data_glink::add_global_entry, find_global_entry,
42         global_entry_address): New functions.
43         (Output_data_glink::global_entry_stubs_, end_branch_table_,
44         ge_size): New variables.
45         (Output_data_glink::set_final_data_size): Add global entry
46         stub sizing.
47         (Output_data_glink::do_write): Write global entry stubs.
48         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
49         parameter.  Return true for ELFv2.  Adjust callers.
50         (Target_powerpc::Scan::local, global): Restrict opd lookup to
51         ELFv1.  Similarly for ifunc and dynamic relocation processing
52         specific to ELFv1.  Recognize that symbols are defined on
53         their plt entries for ELFv2.
54         (Target_powerpc::symval_for_branch): Assert if called for
55         ELFv2 or ppc32.
56         (Target_powerpc::Relocate::relocate): Use global entry plt
57         stub for symbol value if such exists on ELFv2.
58         (Target_powerpc::Relocate::relocate): Don't call
59         symval_for_branch when ELFv2.  Do adjust for local entry
60         offset when ELFv2.
61         (Target_powerpc::do_dynsym_value): Set symbols to global entry
62         plt stub for ELFv2.
63         (Target_powerpc::do_plt_address_for_global): Similarly.
64
65 2013-11-14  Cary Coutant  <ccoutant@google.com>
66
67         Revert patch -- this did not fix the problem, and there is
68         no race there.
69
70         2013-11-14  Cary Coutant  <ccoutant@google.com>
71
72             PR gold/14860
73             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
74             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
75             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
76             updating fde_offsets_.
77             (Eh_frame_hdr::lock_): New data member.
78
79 2013-11-14  Cary Coutant  <ccoutant@google.com>
80
81         * dwp.cc (Dwo_file_entry): New type.
82         (File_list): Use Dwo_file_entry.
83         (Dwo_file::verify): New function.
84         (Dwo_file::verify_dwo_list): New function.
85         (Dwo_file::sized_verify_dwo_list): New function.
86         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
87         list.
88         (Dwp_options): New enum type.
89         (dwp_options): Add --verify-only.
90         (usage): Likewise.
91         (main): Likewise.
92         * dwp.h (gold_info): Add declaration.
93
94 2013-11-14  Cary Coutant  <ccoutant@google.com>
95
96         PR gold/14860
97         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
98         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
99         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
100         updating fde_offsets_.
101         (Eh_frame_hdr::lock_): New data member.
102
103 2013-11-06  Cary Coutant  <ccoutant@google.com>
104
105         PR gold/15758
106         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
107         before reloc sections.
108
109 2013-11-04  Alan Modra  <amodra@gmail.com>
110
111         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
112         (Symbol::needs_dynamic_reloc): Test new flag.
113         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
114         (Target_powerpc::Scan::get_reference_flags): Add target param.
115         Return FUNC_DESC_ABI for 64-bit ELFv1.
116         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
117         call.
118         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
119         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
120
121 2013-10-31  Cary Coutant  <ccoutant@google.com>
122
123         Restore support for dwp v2 DWARF package file format.
124
125         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
126         tu_length parameter.  Adjust all callers.
127         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
128         * dwp.cc: Include dwarf.h.
129         (Section_bounds): New struct type.
130         (Unit_set): New struct type.
131         (Dwo_file::Dwo_file): Initialize new data member.
132         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
133         Combine and rename to...
134         (Dwo_file::read_unit_index): ...this.
135         (Dwo_file::sized_read_compunit_index)
136         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
137         (Dwo_file::sized_read_unit_index): ...this.
138         (Dwo_file::copy_section): Remove section_name, is_str_offsets
139         parameters; add section_id parameter.
140         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
141         (Dwo_file::add_unit_set): ...this.
142         (Dwo_file::shndx_map_): Remove.
143         (Dwo_file::sect_offsets_): New data member.
144         (Dwp_output_file::Dwp_output_file): Initialize new data members.
145         (Dwp_output_file::add_section): Rename to...
146         (Dwp_output_file::add_contribution): ...this.
147         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
148         (Dwp_output_file::add_tu_set): Likewise.
149         (Dwp_output_file::Contribution): New type.
150         (Dwp_output_file::Section::contributions): New data member.
151         (Dwp_output_file::Cu_or_tu_set): Remove.
152         (Dwp_output_file::Section::Section): New ctor.
153         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
154         (Dwp_output_file::Dwp_index::Section_table): New type.
155         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
156         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
157         parameter.
158         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
159         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
160         (Dwp_output_file::Dwp_index::section_table): New member function.
161         (Dwp_output_file::Dwp_index::section_table_end): New member function.
162         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
163         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
164         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
165         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
166         (Dwp_output_file::Dwp_index::section_table_): New data member.
167         (Dwp_output_file::Dwp_index::section_mask_): New data member.
168         (Dwp_output_file::add_output_section): New member function.
169         (Dwp_output_file::write_new_section): New member function.
170         (Dwp_output_file::write_contributions): New member function.
171         (Dwp_output_file::section_id_map_): New data member.
172         (class Dwo_id_info_reader): Remove.
173         (class Unit_reader): New class.
174         (get_dwarf_section_name): New function.
175         (Dwo_file::read_executable): Adjust initializations of class data.
176         (Dwo_file::read): Add support for v2 package file format.
177         (Dwo_file::read_unit_index): Likewise.
178         (Dwo_file::sized_read_unit_index): Likewise.
179         (Dwo_file::copy_section): Likewise.
180         (Dwo_file::add_unit_set): Likewise.
181         (Dwp_output_file::add_output_section): Likewise.
182         (Dwp_output_file::add_contribution): Likewise.
183         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
184         for empty slot.
185         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
186         file format.
187         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
188         slot.
189         (Dwp_output_file::initialize): Remove unused function.
190         (Dwp_output_file::finalize): Add support for v2 package file format.
191         (Dwp_output_file::write_index): Likewise.
192         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
193         function prototype.
194
195 2013-10-31  Cary Coutant  <ccoutant@google.com>
196
197         * configure.ac: Fix check for -fmerge-constants.
198         * configure.ac: Regenerate.
199
200 2013-10-30  Roland McGrath  <mcgrathr@google.com>
201
202         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
203         Correct 9-byte nop sequence to match what the assembler generates.
204
205 2013-10-30  Alan Modra  <amodra@gmail.com>
206
207         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
208         ppc64_local_entry_offset, ppc64_local_entry_offset,
209         do_read_symbols): New functions.
210         (Powerpc_relobj::e_flags_, st_other_): New vars.
211         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
212         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
213         (Powerpc_relobj::e_flags_): New var.
214         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
215         and adjust for ELFv2.
216         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
217         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
218         (Powerpc_dynobj::do_find_special_sections): Likewise.
219         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
220         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
221         to ELFv2 local entry.
222         (Target_powerpc::do_relax): No thread safe barriers needed for
223         ELFv2.
224         (Output_data_plt_powerpc::initial_plt_entry_size_,
225         plt_entry_size): Delete.  Replace all uses with
226         first_plt_entry_offset() and plt_entry_size().
227         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
228         reserved_size parm.  Update callers.
229         (Output_data_plt_powerpc::entry_count): Update.
230         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
231         and use Target_powerpc::first_plt_entry_offset().
232         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
233         rename to plt_entry_size.
234         (Output_data_plt_powerpc::add_ifunc_entry,
235         add_local_ifunc_entry): Adjust reloc for ELFv2.
236         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
237         (glink_eh_frame_fde_64v2): New.
238         (Stub_table::plt_call_size): Support ELFv2 sizing.
239         (Output_data_glink::add_eh_frame): Use the new FDE.
240         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
241         (Stub_table::do_write): Write ELFv2 stubs and glink.
242         (Target_powerpc::Relocate::relocate): Replaces nop after call
243         with ld 2,24(1) and adjust local offset destination for ELFv2.
244
245 2013-10-30  Alan Modra  <amodra@gmail.com>
246
247         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
248         (Target_powerpc::Scan::global, local): Likewise.
249         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
250         on all ppc64 @h and @ha relocs.
251
252 2013-10-14  Alan Modra  <amodra@gmail.com>
253
254         * output.h (Output_data_got::add_constant): Tidy.
255         (Output_data_got::add_constant_pair): New function.
256         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
257         methods used so as to first call reserve_ent().
258
259 2013-10-11  Roland McGrath  <mcgrathr@google.com>
260
261         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
262         add_got_entry and add_got_entry_pair.
263
264         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
265         (HAVE_PUBNAMES): Likewise.
266         * configure: Regenerate.
267
268         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
269         * testsuite/Makefile.in: Regenerate.
270
271         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
272         Remove const from declaration.
273         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
274         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
275         * output.h (Output_file_header): Remove const from member target_
276         and corresponding constructor argument.
277         * output.cc (Output_file_header::Output_file_header): Update prototype.
278         (Output_file_header::do_sized_write): Use this->target_ in place
279         of parameters()->target().
280
281         * testsuite/undef_symbol.cc (Foo::get_a): New method.
282
283         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
284         * configure: Regenerate.
285         * Makefile.in: Regenerate.
286         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
287         * testsuite/merge_string_literals_2.c: Likewise.
288         * testsuite/Makefile.am
289         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
290         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
291         literal -fmerge-constants.
292         * testsuite/Makefile.in: Regenerate.
293
294         * i386.cc (Target_i386): Remove unused member dynbss_.
295         * arm.cc (Target_arm): Likewise.
296         * powerpc.cc (Target_powerpc): Likewise.
297         * sparc.cc (Target_sparc): Likewise.
298         * tilegx.cc (Target_tilegx): Likewise.
299         * x86_64.cc (Target_x86_64): Likewise.
300         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
301         type_signature_, type_offset_.
302         * plugin.h (Plugin_hook): Remove unused member layout_.
303         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
304         mapfile_.
305         (Read_member): Remove unused members input_objects_, symtab_,
306         mapfile_, layout_.
307         (Check_library): Remove unused member symtab_.
308         * archive.h (Lib_group): Remove unused member lib_.
309         * archive.cc (Lib_group::Lib_group): Update initializer.
310         * incremental.h (Incremental_binary): Remove unused member target_.
311         (Incremental_script_entry): Removed unused member script_.
312         * layout.h (Write_symbols_task): Remove unused member input_objects_.
313         * icf.h (Icf): Remove unused member num_tracked_relocs.
314
315         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
316         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
317         its only use.
318         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
319
320         * archive.h: Use struct rather than class for forward declaration
321         of Read_symbols_data.
322
323 2013-10-07  Cary Coutant  <ccoutant@google.com>
324
325         PR gold/16010
326         * testsuite/Makefile.am (icf_test): Fix dependencies.
327         (icf_safe_test): Likewise.
328         (icf_safe_so_test): Likewise.
329         (large_symbol_alignment): Add empty _LDADD rule.
330         * testsuite/Makefile.in: Regenerate.
331
332 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
333
334         PR gold/15927
335         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
336         relocation for R_X86_64_32 on x32.
337
338 2013-08-27  Roland McGrath  <mcgrathr@google.com>
339
340         * output.cc (Output_segment::set_section_addresses): Take new
341         Target* argument.  If target->isolate_execinstr() and the segment
342         is executable and starts at a target->abi_pagesize() boundary,
343         pad its end out to a target->abi_pagesize() boundary with code fill.
344         * output.h (Output_segment::set_section_addresses): Update decl.
345         * layout.h (Layout::check_output_data_for_reset_values): Take new
346         argument RELAX_OUTPUTS.
347         (Layout): New member relax_output_list_.
348         (Layout::add_relax_output): New method.
349         * layout.cc (Layout::Layout): Update constructor.
350         (Layout::reset_relax_output): New method.
351         (Layout::clean_up_after_relaxation): Call it.
352         (Layout::prepare_for_relaxation): Update caller.
353         (Layout::set_segment_offsets): Update callers of set_section_addresses.
354         Call reset_relax_output before re-processing segments for
355         isolate_execinstr case.
356         (Layout::write_data): Handle relax_output_list_.
357         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
358         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
359
360 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
361
362         PR binutils/15834
363         * object.h: Fix typos.
364
365 2013-08-16  Roland McGrath  <mcgrathr@google.com>
366
367         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
368         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
369
370 2013-08-07  Cary Coutant  <ccoutant@google.com>
371
372         Revert support for v2 DWP files:
373
374         2013-03-01  Cary Coutant  <ccoutant@google.com>
375
376             Add dwp support for v2 DWARF package file format.
377             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
378             tu_length parameter.  Adjust all callers.
379             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
380             * dwp.cc: Include dwarf.h.
381             (Section_bounds): New struct type.
382             (Unit_set): New struct type.
383             (Dwo_file::Dwo_file): Initialize new data member.
384             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
385             Combine and rename to...
386             (Dwo_file::read_unit_index): ...this.
387             (Dwo_file::sized_read_compunit_index)
388             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
389             (Dwo_file::sized_read_unit_index): ...this.
390             (Dwo_file::copy_section): Remove section_name, is_str_offsets
391             parameters; add section_id parameter.
392             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
393             (Dwo_file::add_unit_set): ...this.
394             (Dwo_file::shndx_map_): Remove.
395             (Dwo_file::sect_offsets_): New data member.
396             (Dwp_output_file::Dwp_output_file): Initialize new data members.
397             (Dwp_output_file::add_section): Rename to...
398             (Dwp_output_file::add_contribution): ...this.
399             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
400             (Dwp_output_file::add_tu_set): Likewise.
401             (Dwp_output_file::Contribution): New type.
402             (Dwp_output_file::Section::contributions): New data member.
403             (Dwp_output_file::Cu_or_tu_set): Remove.
404             (Dwp_output_file::Section::Section): New ctor.
405             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
406             (Dwp_output_file::Dwp_index::Section_table): New type.
407             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
408             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
409             parameter.
410             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
411             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
412             (Dwp_output_file::Dwp_index::section_table): New member function.
413             (Dwp_output_file::Dwp_index::section_table_end): New member function.
414             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
415             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
416             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
417             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
418             (Dwp_output_file::Dwp_index::section_table_): New data member.
419             (Dwp_output_file::Dwp_index::section_mask_): New data member.
420             (Dwp_output_file::add_output_section): New member function.
421             (Dwp_output_file::write_new_section): New member function.
422             (Dwp_output_file::write_contributions): New member function.
423             (Dwp_output_file::section_id_map_): New data member.
424             (class Dwo_id_info_reader): Remove.
425             (class Unit_reader): New class.
426             (get_dwarf_section_name): New function.
427             (Dwo_file::read_executable): Adjust initializations of class data.
428             (Dwo_file::read): Add support for v2 package file format.
429             (Dwo_file::read_unit_index): Likewise.
430             (Dwo_file::sized_read_unit_index): Likewise.
431             (Dwo_file::copy_section): Likewise.
432             (Dwo_file::add_unit_set): Likewise.
433             (Dwp_output_file::add_output_section): Likewise.
434             (Dwp_output_file::add_contribution): Likewise.
435             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
436             for empty slot.
437             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
438             file format.
439             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
440             slot.
441             (Dwp_output_file::initialize): Remove unused function.
442             (Dwp_output_file::finalize): Add support for v2 package file format.
443             (Dwp_output_file::write_index): Likewise.
444             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
445             function prototype.
446
447 2013-07-31  Cary Coutant  <ccoutant@google.com>
448
449         * object.cc (Sized_relobj::do_output_section_address): New function.
450         (Sized_relobj): Instantiate explicitly.
451         * object.h (Object::output_section_address): New function.
452         (Object::do_output_section_address): New function.
453         (Sized_relobj::do_output_section_address): New function.
454         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
455
456 2013-07-30  Cary Coutant  <ccoutant@google.com>
457             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
458
459         * parameters.cc (Parameters::entry): Return target-specific entry
460         symbol name.
461         * target.h (Target::entry_symbol_name): New function.
462         (Target_info::entry_symbol_name): New data member.
463
464         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
465         * i386.cc (Target_i386::i386_info): Likewise.
466         (Target_i386_nacl::i386_nacl_info): Likewise.
467         * sparc.cc (Target_sparc::sparc_info): Likewise.
468         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
469         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
470         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
471         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
472
473 2013-07-22  Sterling Augustine  <saugustine@google.com>
474
475         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
476         Convert parameter shndx to local variable. Add parameters symtab
477         and symtab_size.  Scan over section names.  Find relocation
478         section corresponding to current section.  Create and initialize
479         reloc_mapper_ and reloc_type_.
480         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
481         unit_length to off_t.  Initialize member unit_length_.  Fill in field
482         cu_offset_.
483         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
484         Initialize new fields unit_length_ and cu_offset_.
485         (Dwarf_pubnames_table::read_section): Update prototype.
486         (Dwarf_pubnames_table::cu_offset): New member function.
487         (Dwarf_pubnames_table::subsection_size): Likewise.
488         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
489         New fields.
490         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
491         member functions public.
492         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
493         Update comment.  Rework logic.  Move repeated parts to...
494         (Gdb_index_info_reader::read_pubtable): ...here. New function.
495         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
496         pubtypes_table_, and stmt_list_offset.
497         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
498         Gdb_index::find_pubtype_offset,
499         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
500         (Gdb_index::pubnames_read): Update prototype and rework logic.
501         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
502         Forward declare.
503         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
504         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
505         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
506         Gdb_index::map_pubtable_to_dies):
507         Declare functions.
508         (Gdb_index::pubnames_read): Update declaration.
509         (Gdb_index::Pubname_offset_map): New type.
510         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
511         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
512         Gdb_index::stmt_list_offset): Declare.
513         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
514         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
515         Gdb_index::pubtypes_offset_): Remove.
516
517 2013-07-19  Roland McGrath  <mcgrathr@google.com>
518
519         * options.h (General_options): Add -Trodata-segment option.
520         * parameters.cc (Parameters::check_rodata_segment): New function.
521         (Parameters::set_target_once): Call it.
522         * parameters.h (Parameters): Declare it (private member function).
523         * layout.cc (load_seg_unusable_for_headers): New function, broken
524         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
525         then validate rodata segment rather than text segment.
526         (relaxation_loop_body): Call that.
527         (is_text_segment): New function.  Don't admit a non-executable
528         segment if TARGET->isolate_execinstr().
529         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
530
531 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
532
533         PR gold/15070
534         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
535         * nacl.h (Sniff_file::View::View): Request aligned view.
536
537 2013-07-11  Cary Coutant  <ccoutant@google.com>
538
539         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
540         correct BRLT entry size.
541
542 2013-07-03  Alan Modra  <amodra@gmail.com>
543
544         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
545         comment.
546
547 2013-07-01  Cary Coutant  <ccoutant@google.com>
548
549         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
550         reloc_type_.
551         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
552         (Dwarf_ranges_table::lookup_reloc): New function.
553         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
554         reloc_type_.
555         (Dwarf_ranges_table::lookup_reloc): New function.
556         (Dwarf_ranges_table::reloc_type_): New data member.
557
558 2013-06-27  Jing Yu  <jingyu@google.com>
559
560         PR gold/15662
561         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
562         function.
563         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
564         (Target_powerpc::do_relax): Call the above.
565
566 2013-06-27  Cary Coutant  <ccoutant@google.com>
567
568         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
569         on garbage collected .opd section.
570
571 2013-06-27  Alan Modra  <amodra@gmail.com>
572
573         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
574         is non-zero.
575         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
576         (Target_powerpc::do_function_location): Likewise for loc->shndx.
577
578 2013-06-14  Cary Coutant  <ccoutant@google.com>
579
580         * resolve.cc (Symbol::override_base): Don't override st_type
581         from plugin placeholder symbols.
582         (Symbol_table::resolve): Likewise.
583         (Symbol_table::should_override): Don't complain about TLS mismatch
584         if the TO symbol is a plugin placeholder.
585         * testsuite/Makefile.am (plugin_test_tls): New test.
586         * testsuite/Makefile.in: Regenerate.
587         * testsuite/plugin_test_tls.sh: New test script.
588         * testsuite/two_file_test_2_tls.cc: New test source.
589         * testsuite/two_file_test_tls.cc: New test source.
590
591 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
592
593         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
594         the maximum segment alignment is larger than the page size.
595         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
596         correctly aligns the symbols with large alignemnt.
597         * testsuite/Makefile.in: Regenerate.
598         * testsuite/large_symbol_alignment.cc: New file.
599
600 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
601             Sriraman Tallam  <tmsriram@google.com>
602
603         * options.h (sort_section): New option.
604         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
605         Rename from Input_section_sort_section_name_special_ordering_compare.
606         (Input_section_sort_section_name_compare): New struct.
607         * output.cc (Output_section::Input_section_sort_section_name_compare::
608         operator()): New function.
609         (Output_section::sort_attached_input_sections): Use new sort function
610         for .text if --sort-section=name is specified.
611         * layout.cc (Layout::make_output_section):
612         Add sorting by name when --sort-section=name is specified.
613         * testsuite/Makefile.am (text_section_grouping): Test option
614         --sort-section=name.
615         * testsuite/Makefile.in: Regenerate.
616         * testsuite/section_sorting_name.cc: New file.
617         * testsuite/section_sorting_name.sh: New file.
618
619 2013-05-21  Cary Coutant  <ccoutant@google.com>
620
621         * symtab.h (Symbol::is_cxx_vtable): New function.
622         * target-reloc.h (relocate_section): Check for vtable symbol.
623         * testsuite/Makefile.am (missing_key_func.sh): New test case.
624         * testsuite/Makefile.in: Regenerate.
625         * testsuite/missing_key_func.cc: New test source.
626         * testsuite/missing_key_func.sh: New test script.
627
628 2013-05-21  Cary Coutant  <ccoutant@google.com>
629
630         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
631         type of enclosing symbol.
632         (Relocate_info::location): Check symbol type when describing symbol.
633         * object.h (Symbol_location_info): Remove unused line_number;
634         add enclosing_symbol_type.
635         * testsuite/debug_msg.sh: Adjust expected output.
636
637 2013-05-13  Cary Coutant  <ccoutant@google.com>
638
639         * configure.ac: Export DEFAULT_TARGET.
640         * configure: Regenerate.
641         * Makefile.in: Regenerate.
642         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
643         * testsuite/Makefile.in: Regenerate.
644         * testsuite/debug_msg.sh: Delete duplicate tests.
645         Don't check undef_int error message match for powerpc where the
646         source file and line number aren't available.
647
648 2013-05-10  Roland McGrath  <mcgrathr@google.com>
649
650         * options.h (General_options): Add --rosegment-gap option.
651         * options.cc (finalize): --rosegment-gap implies --rosegment.
652         * layout.cc (set_segment_offsets): Let user option override
653         target->rosegment_gap().
654
655 2013-05-10  Roland McGrath  <mcgrathr@google.com>
656
657         * options.h (General_options): Remove leading space from help
658         messages for -nostdlib and --rosegment.
659
660 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
661
662         PR ld/15365
663         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
664
665 2013-05-03  Alan Modra  <amodra@gmail.com>
666
667         * merge.cc (Output_merge_string::do_add_input_section): Correct
668         scan for number of strings.  Rename vars to avoid shadowing.
669         Include missing terminator in input_size_.
670
671 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
672
673         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
674         Restore empty string handling.
675
676 2013-05-01  Cary Coutant  <ccoutant@google.com>
677
678         * stringpool.cc (Stringpool_template::new_key_offset): Fix
679         uninitialized warning.
680
681 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
682
683         * output.cc (Output_section::add_merge_input_section): Allow
684         to merge sections if the alignment is more than character size.
685         * merge.h (Output_merge_string::Output_merge_string): Remove
686         assert.
687         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
688         only not-null strings. Check the alignment of strings.
689         * stringpool.h
690         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
691         alignment as the argument.
692         (Stringpool_template<Stringpool_char>::addralign_): New class member.
693         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
694         Align non-zero length strings according to the addralign_.
695         (Stringpool_template<Stringpool_char>::set_string_offsets):
696         Updating offsets according to the given alignment.
697         * testsuite/Makefile.am (text_section_grouping): Test if string
698         literals are getting merged.
699         * testsuite/Makefile.in: Regenerate.
700         * testsuite/merge_string_literals_1.c: New file.
701         * testsuite/merge_string_literals_2.c: Ditto.
702         * testsuite/merge_string_literals.sh: Ditto.
703
704 2013-04-26  Ian Lance Taylor  <iant@google.com>
705
706         * target-reloc.h (relocate_section): If the reloc offset is out of
707         range, pass VIEW as NULL to relocate.relocate.
708         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
709         * i386.cc (Target_i386::Relocate::relocate): Likewise.
710         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
711         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
712         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
713         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
714
715 2013-04-26  Geoff Pike  <gpike@chromium.org>
716
717         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
718         * layout.cc (Hash_task): New class.
719         (Layout::queue_build_id_tasks): New function.
720         (Layout::write_build_id): Handle single-thread portion of build ID
721         computation.  (In some cases, all of it is single-threaded.)  Replace
722         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
723         functionality in fewer lines of code.
724         * layout.h (Layout::queue_build_id_tasks): New function declaration.
725         * options.h (General_options): make "--build-id" default to tree
726         rather than sha1.  Add two new options related to --build-id=tree:
727         --build-id-chunk-size-for-treehash and
728         --build-id-min-file-size-for-treehash.
729         * Makefile.am: add testing of --build-id=tree and related new options
730         (these tests will be invoked by "make check").
731         * Makefile.in: Regenerate.
732
733 2013-04-25  Alan Modra  <amodra@gmail.com>
734
735         * configure.tgt: Add powerpcle and powerpc64le.
736
737 2013-04-22  Alan Modra  <amodra@gmail.com>
738
739         PR gold/15355
740         * layout.cc (Layout::segment_precedes): Allow more than one
741         segment with the same type and flags.
742
743 2013-04-15  Cary Coutant  <ccoutant@google.com>
744
745         * layout.cc (Layout::set_relocatable_section_offsets): Don't
746         allocate space in file for BSS sections.
747
748 2013-04-15  Cary Coutant  <ccoutant@google.com>
749
750         * script-sections.cc (Orphan_output_section): Reset address
751         to zero after each orphaned section for relocatable links.
752
753 2013-04-15  Cary Coutant  <ccoutant@google.com>
754
755         * symtab.cc (Symbol_table::sized_write_globals): Subtract
756         section starting address for relocatable link.
757         * testsuite/Makefile.am (script_test_11): New test.
758         * testsuite/Makefile.in: Regenerate.
759         * testsuite/script_test_11.c: New source file.
760         * testsuite/script_test_11.t: New linker script.
761
762 2013-04-13  Alan Modra  <amodra@gmail.com>
763
764         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
765         owner when sections are not adjacent and exceed group size.
766         (Target_powerpc::group_sections): Handle corner case.
767         (Target_powerpc::Branch_info::make_stub): Handle case where
768         stub table doesn't exist due to branches in non-exec sections.
769         (Target_powerpc::Relocate::relocate): Likewise.
770
771 2013-04-11  Alan Modra  <amodra@gmail.com>
772
773         PR gold/15354
774         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
775         .branch_lt to match bfd ld.  Adjust comments throughout file.
776
777 2013-04-04  Ian Lance Taylor  <iant@google.com>
778
779         GCC PR c++/56840
780         * object.cc (do_layout_deferred_sections): Handle .eh_frame
781         sections before checking whether they are included in the link.
782
783 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
784
785         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
786         object before calling the plugin claim_file handler.  Pass the elf
787         object of the archive to the plugin. Delete the elf object if the
788         plugin claims the file.
789
790 2013-03-21  Alan Modra  <amodra@gmail.com>
791
792         * layout.cc (Layout::set_segment_offsets): Accept writable .text
793         segment when omagic.
794
795 2013-03-21  Alan Modra  <amodra@gmail.com>
796
797         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
798         comparison warning.
799         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
800         uninitialized" warning.
801
802 2013-03-20  Alan Modra  <amodra@gmail.com>
803
804         * symtab.h (Symbol::clear_version): New function.
805         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
806         is_needed by weak references.  Clear version for symbols defined
807         in as-needed objects that are not needed.
808
809 2013-03-15  Alan Modra  <amodra@gmail.com>
810
811         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
812         static and public.  Add report_err param.  Return false for data refs.
813         (Target_powerpc::rela_dyn_section): New overloaded function.
814         (Target_powerpc::plt_, iplt_): Elucidate.
815         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
816         (Output_data_plt_powerpc::do_write): Don't write .iplt.
817         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
818         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
819         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
820         push_branch and make_plt_entry for ifunc syms when
821         reloc_needs_plt_for_ifunc.
822         (Target_powerpc::Relocate::relocate): Don't use plt entry value
823         for ifunc unless reloc_needs_plt_for_ifunc.
824
825 2013-03-15  Alan Modra  <amodra@gmail.com>
826
827         * gc.h (gc_process_relocs): Don't look through function descriptors.
828         * icf.cc (get_section_contents): Do so here instead.
829
830 2013-03-13  Alan Modra  <amodra@gmail.com>
831
832         * powerpc.cc (is_branch_reloc): Forward declare.
833         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
834         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
835         false for 64-bit, true for 32-bit non-branch relocs.
836         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
837         * testsuite/Makefile.am (icf_test): Use linker map file instead of
838         nm output.
839         (icf_safe_test): Generate linker map file as well as nm output.
840         (icf_safe_so_test): Likewise.
841         * testsuite/Makefile.in: Regenerate.
842         * testsuite/icf_test.sh: Parse linker map file to determine
843         section folding.
844         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
845         * testsuite/icf_safe_so_test.sh: Likewise.
846         (X86_32_or_ARM_specific_safe_fold): Merge into..
847         (arch_specific_safe_fold): ..this.
848         (X86_64_specific_safe_fold): Delete unused function.
849
850 2013-03-12  Alan Modra  <amodra@gmail.com>
851
852         * gc.h (gc_process_relocs): Look through function descriptors
853         to determine shndx, symvalue and addend used by ICF.  Tidy
854         variable duplication.
855
856 2013-03-11  Alan Modra  <amodra@gmail.com>
857
858         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
859         * layout.cc (Layout_task_runner::run): ..to here.
860         * symtab.h (struct Symbol_location): Extract from..
861         (class Symbol_table): ..here.
862         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
863         * target.h (class Target): Add function_location and
864         do_function_location functions.
865         (class Sized_target): Add do_function_location.
866         * object.h (class Sized_relobj_file): Move find_shdr..
867         (class Object): ..to here.
868         * object.cc: Likewise.  Update to suit.  Instantiate.
869         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
870         * powerpc.cc (class Powerpc_dynobj): New.
871         (Target_powerpc::do_function_location): New function.
872         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
873         (Powerpc_dynobj::do_read_symbols): New function.
874         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
875
876 2013-03-08  Ian Lance Taylor  <iant@google.com>
877
878         * options.cc (General_options::string_to_object_format): Accept
879         "default".
880
881 2013-03-08  Alan Modra  <amodra@gmail.com>
882
883         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
884         pointer to Post_fde.
885         (struct Post_fde): Move definition to here..
886         * ehframe.cc (struct Post_fde): ..from here.
887         (Cie::write): Don't alloc Post_fde.
888         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
889
890 2013-03-07  Alan Modra  <amodra@gmail.com>
891
892         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
893         relocation referencing .LC0.
894         * testsuite/discard_locals_test.sh: Remove FIXMEs.
895
896 2013-03-07  Alan Modra  <amodra@gmail.com>
897
898         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
899         always_inline.  Add assembly for powerpc to avoid GOT.
900
901 2013-03-07  Alan Modra  <amodra@gmail.com>
902
903         * testsuite/script_test_10.sh: Don't test .bss section
904         header number.
905
906 2013-03-06  Alan Modra  <amodra@gmail.com>
907
908         * powerpc.cc (class Powerpc_relobj): Move some member functions.
909         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
910         all callers.  Handle folded sections.
911         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
912         to Powerpc_relobj.
913         (Global_symbol_visitor_opd::operator()): Likewise.
914
915 2013-03-04  Alan Modra  <amodra@gmail.com>
916
917         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
918         * testsuite/Makefile.in: Regenerate.
919
920 2013-03-01  Cary Coutant  <ccoutant@google.com>
921
922         Add dwp support for v2 DWARF package file format.
923         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
924         tu_length parameter.  Adjust all callers.
925         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
926         * dwp.cc: Include dwarf.h.
927         (Section_bounds): New struct type.
928         (Unit_set): New struct type.
929         (Dwo_file::Dwo_file): Initialize new data member.
930         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
931         Combine and rename to...
932         (Dwo_file::read_unit_index): ...this.
933         (Dwo_file::sized_read_compunit_index)
934         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
935         (Dwo_file::sized_read_unit_index): ...this.
936         (Dwo_file::copy_section): Remove section_name, is_str_offsets
937         parameters; add section_id parameter.
938         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
939         (Dwo_file::add_unit_set): ...this.
940         (Dwo_file::shndx_map_): Remove.
941         (Dwo_file::sect_offsets_): New data member.
942         (Dwp_output_file::Dwp_output_file): Initialize new data members.
943         (Dwp_output_file::add_section): Rename to...
944         (Dwp_output_file::add_contribution): ...this.
945         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
946         (Dwp_output_file::add_tu_set): Likewise.
947         (Dwp_output_file::Contribution): New type.
948         (Dwp_output_file::Section::contributions): New data member.
949         (Dwp_output_file::Cu_or_tu_set): Remove.
950         (Dwp_output_file::Section::Section): New ctor.
951         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
952         (Dwp_output_file::Dwp_index::Section_table): New type.
953         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
954         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
955         parameter.
956         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
957         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
958         (Dwp_output_file::Dwp_index::section_table): New member function.
959         (Dwp_output_file::Dwp_index::section_table_end): New member function.
960         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
961         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
962         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
963         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
964         (Dwp_output_file::Dwp_index::section_table_): New data member.
965         (Dwp_output_file::Dwp_index::section_mask_): New data member.
966         (Dwp_output_file::add_output_section): New member function.
967         (Dwp_output_file::write_new_section): New member function.
968         (Dwp_output_file::write_contributions): New member function.
969         (Dwp_output_file::section_id_map_): New data member.
970         (class Dwo_id_info_reader): Remove.
971         (class Unit_reader): New class.
972         (get_dwarf_section_name): New function.
973         (Dwo_file::read_executable): Adjust initializations of class data.
974         (Dwo_file::read): Add support for v2 package file format.
975         (Dwo_file::read_unit_index): Likewise.
976         (Dwo_file::sized_read_unit_index): Likewise.
977         (Dwo_file::copy_section): Likewise.
978         (Dwo_file::add_unit_set): Likewise.
979         (Dwp_output_file::add_output_section): Likewise.
980         (Dwp_output_file::add_contribution): Likewise.
981         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
982         for empty slot.
983         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
984         file format.
985         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
986         slot.
987         (Dwp_output_file::initialize): Remove unused function.
988         (Dwp_output_file::finalize): Add support for v2 package file format.
989         (Dwp_output_file::write_index): Likewise.
990         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
991         function prototype.
992
993 2013-03-01  Cary Coutant  <ccoutant@google.com>
994
995         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
996         function into class definition in header file.
997         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
998         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
999         New function.
1000         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1001
1002 2013-02-28  Alan Modra  <amodra@gmail.com>
1003
1004         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1005         * target.cc (Target::do_plt_fde_location): New function.
1006         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1007         accessor function, and constructor param.
1008         (struct Post_fde, Post_fdes): Declare.
1009         (Cie::write): Add post_fdes param.
1010         * ehframe.cc (Fde::write): Use plt_fde_location.
1011         (struct Post_fde): Define.
1012         (Cie::write): Stash FDEs added post merge mapping.
1013         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1014         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1015         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1016         other FDEs.
1017         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1018         (Target_powerpc::has_glink): New function.
1019         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1020         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1021         glink_eh_frame_fde_32, default_fde): New data.
1022         (Stub_table::eh_frame_added_): New var.
1023         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1024         Make const.
1025         (Stub_table::add_eh_frame): New function.
1026         (Output_data_glink::add_eh_frame): New function.
1027         (Target_powerpc::make_glink_section): Call add_eh_frame.
1028
1029 2013-02-15  Ian Lance Taylor  <iant@google.com>
1030
1031         * options.h (DEFINE_uint64_alias): Define.
1032         (class General_options): Add -Ttext-segment as an alias for
1033         -Ttext.
1034
1035 2013-02-15  Alan Modra  <amodra@gmail.com>
1036
1037         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1038         (Stub_table::do_write): ..here, two places.
1039         (Stub_table::plt_call_size): Use it here too.
1040
1041 2013-02-11  Ian Lance Taylor  <iant@google.com>
1042
1043         * descriptors.cc (Descriptors::close_all): New function.
1044         * descriptors.h (class Descriptors): Declare close_all.
1045         (close_all_descriptors): New inline function.
1046         * plugin.cc: Include "descriptors.h".
1047         (Plugin_manager::cleanup): Call close_all_descriptors.
1048
1049 2013-02-06  Alan Modra  <amodra@gmail.com>
1050
1051         * README: Update coding style link.
1052
1053 2013-01-28  Cary Coutant  <ccoutant@google.com>
1054
1055         * dwp.cc (File_list): New typedef.
1056         (Dwo_name_info_reader): New class.
1057         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1058         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1059         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1060         (Dwo_file::read_executable): New function.
1061         (Dwo_file::read): Move common setup code to ...
1062         (Dwo_file::make_object): ... here.
1063         (dwp_options): Add --exec/-e.
1064         (usage): Likewise.
1065         (main): Likewise.
1066
1067 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1068
1069         * layout.cc (Layout::layout): Check for option text_reorder.
1070         (Layout::make_output_section): Ditto.
1071         * options.h (text_reorder): New option.
1072         * output.cc (Input_section_sort_compare): Remove special ordering
1073         of section names.
1074         (Output_section::
1075          Input_section_sort_section_name_special_ordering_compare::
1076          operator()): New function.
1077         (Output_section::sort_attached_input_sections): Use new sort function
1078         for .text.
1079         * output.h (Input_section_sort_section_name_special_ordering_compare):
1080         New struct.
1081         * testsuite/Makefile.am (text_section_grouping): Test option
1082         --no-text-reorder
1083         * testsuite/Makefile.in: Regenerate.
1084         * testsuite/text_section_grouping.sh: Check order of functions without
1085         default text reordering.
1086
1087 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1088
1089         * options.h (General_options): Change default to true for new_dtags.
1090
1091 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1092
1093         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1094         when enable_new_dtags is false.  Only add DT_RUNPATH when
1095         enable_new_dtags is true.
1096
1097 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1098
1099         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1100         used in declaration and definition consistent.
1101         (Target_powerpc::symval_for_branch): Ditto.
1102
1103 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1104
1105         * testsuite/plugin_final_layout.cc: Fix comment.
1106
1107 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1108
1109         * layout.cc (Layout::layout): Do not do default sorting for
1110         text sections when section ordering is specified.
1111         (make_output_section): Ditto.
1112         * testsuite/plugin_final_layout.cc: Name the function sections
1113         to catch reordering issues.
1114
1115 2013-01-15  Alan Modra  <amodra@gmail.com>
1116
1117         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1118         plt-thread-safe.
1119
1120 2013-01-15  Alan Modra  <amodra@gmail.com>
1121
1122         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1123         * testsuite/Makefile.in: Regenerate.
1124
1125 2013-01-14  Alan Modra  <amodra@gmail.com>
1126
1127         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1128         * testsuite/Makefile.in: Regenerate.
1129
1130 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1131
1132         PR bfd/14430
1133         Fix mingw gold build with plugins enabled
1134         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1135         * configure.ac: Export DLOPEN_LIBS and add headers check.
1136         * plugin.cc: Handle non-dlfcn case.
1137         * Makefile.in: Regenerate.
1138         * config.in: Regenerate.
1139         * configure: Regenerate.
1140         * testsuite/Makefile.in: Regenerate.
1141
1142 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1143
1144         * output.h (sort_attached_input_sections): Change to be public.
1145         * script-sections.cc
1146         (Output_section_definition::set_section_addresses): Sort
1147         attached input sections according to section order before linker
1148         script assigns section addresses.
1149         (Orphan_output_section::set_section_addresses): Sort
1150         attached input sections according to section order before linker
1151         script assigns section addresses.
1152         * Makefile.am (final_layout.sh): Use a simple linker script to
1153         check if section ordering still works.
1154         * Makefile.in: Regenerate.
1155
1156 2013-01-09  Ben Cheng  <bccheng@google.com>
1157
1158         * arm.cc (Target_arm::attributes_accept_div): New function.
1159         (Target_arm::attributes_forbid_div): New function.
1160         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1161         attribute using the same new functions as what bfd/elf32_arm.c
1162         does.
1163
1164 2013-01-07  Cary Coutant  <ccoutant@google.com>
1165
1166         PR gold/14993
1167         * output.cc (Output_section::add_input_section): For incremental
1168         updates, don't track input sections that are allocated from patch
1169         space.
1170
1171 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1172             Ian Lance Taylor  <iant@google.com>
1173
1174         PR gold/14897
1175         * configure.ac (--enable-ld): Removed.
1176         (install_as_default): Set to yes only for --enable-gold=default
1177         or --disable-ld.
1178         * configure: Regenerated.
1179
1180 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1181
1182         * options.h (General_options): Add -fuse-ld= for GCC linker
1183         option compatibility.
1184
1185 2013-01-04  Cary Coutant  <ccoutant@google.com>
1186
1187         * configure.ac: Fix typo restoring CXXFLAGS.
1188         * configure: Regenerate.
1189
1190 2013-01-04  Cary Coutant  <ccoutant@google.com>
1191
1192         * testsuite/Makefile.am (CXXLINK_S): New macro.
1193         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1194         * testsuite/Makefile.in: Regenerate.
1195
1196 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1197
1198         * version.cc (print_version): Update copyright year to 2013.
1199
1200 2012-12-20  Ian Lance Taylor  <iant@google.com>
1201
1202         * layout.cc (Layout::special_ordering_of_input_section): New
1203         function.
1204         (Layout::layout): If input section requires special ordering, must
1205         sort input sections.
1206         (Layout::make_output_section): May sort .text input sections.
1207         (Layout::is_section_name_prefix_grouped): Remove.
1208         * layout.h (class Layout): Declare
1209         special_ordering_of_input_section.  Don't declare
1210         is_section_name_prefix_grouped.
1211         * output.cc (Output_section::add_input_section): Revert last
1212         change.
1213         (Output_section::Input_section_sort::match_file_name): Don't crash
1214         if called on output section data.
1215         (Output_section::Input_section_sort_compare): Sort based on
1216         special ordering.
1217         (Output_section::Input_section_sort_section_order_index_compare):
1218         Revert last patch.
1219         (Output_section::sort_attached_input_sections): Likewise.
1220
1221 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1222
1223         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1224         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1225         * output.cc (Output_section::add_input_section): Check if section
1226         name contains special prefix.  Keep input sections to sort such
1227         sections.
1228         (Output_section::Input_section_sort_section_order_index_compare
1229          ::operator()): Group sections according to prefixes.
1230         (Output_section::sort_attached_input_sections): Add condition to
1231         Input_section_entry constructor call.
1232         * testsuite/Makefile.am (text_section_grouping): New test.
1233         * testsuite/Makefile.in: Regenerate.
1234         * testsuite/text_section_grouping.cc: New file.
1235         * testsuite/text_section_grouping.sh: New file.
1236
1237 2012-12-17  Nick Clifton  <nickc@redhat.com>
1238
1239         * Makefile.am: Add copyright notice.
1240         * NEWS: Likewise.
1241         * README: Likewise.
1242         * configure.ac: Likewise.
1243         * ftruncate.c: Likewise.
1244         * Makefile.in: Regenerate.
1245
1246 2012-12-14  Cary Coutant  <ccoutant@google.com>
1247
1248         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1249         --no-as-needed flag.
1250         (exception_separate_shared_12_test): Likewise.
1251         (incremental_copy_test): Likewise.
1252         * testsuite/Makefile.in: Regenerate.
1253
1254 2012-12-14  Cary Coutant  <ccoutant@google.com>
1255
1256         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1257         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1258
1259 2012-12-12  Alan Modra  <amodra@gmail.com>
1260
1261         * powerpc.cc (class Track_tls): New.
1262         (class Relocate, class Scan): Inherit Track_tls.
1263         (Target_powerpc::Scan::local, global): Track tls optimization
1264         and avoid creating plt entry for __tls_get_addr if all uses
1265         are optimized away.
1266         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1267
1268 2012-12-12  Alan Modra  <amodra@gmail.com>
1269
1270         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1271         Replace no_toc_optimize with toc_optimize.
1272         * output.h (Output_section::input_sections): Provide non-const variant.
1273         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1274         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1275         accessors.
1276         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1277         (class Sort_toc_sections): New.
1278         (Target_powerpc::do_finalize_sections): Sort toc sections.
1279         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1280
1281 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1282
1283         * testsuite/binary_unittest.cc (read_all): New function.
1284         (Sized_binary_test): Use it instead of ::read.
1285         * fileread.cc (do_read): Don't assume pread always reads the whole
1286         amount in a single call.
1287
1288 2012-12-10  Alan Modra  <amodra@gmail.com>
1289
1290         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1291         Set EM_PPC64 or EM_PPC here.
1292         (Target_selector_powerpc::do_recognize): Delete.
1293
1294 2012-12-10  Alan Modra  <amodra@gmail.com>
1295
1296         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1297         stub_table_.
1298         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1299
1300 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1301
1302         * testsuite/binary_unittest.cc (Sized_binary_test):
1303         Use open_descriptor rather than ::open.
1304
1305 2012-12-07  Alan Modra  <amodra@gmail.com>
1306
1307         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1308         typedef and invalid_address constant.
1309         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1310         instantiate constants.
1311
1312 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1313
1314         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1315         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1316         * aclocal.m4: Regenerate.
1317         * configure: Regenerate.
1318         * Makefile.in: Regenerate.
1319         * testsuite/Makefile.in: Regenerate.
1320
1321 2012-12-07  Alan Modra  <amodra@gmail.com>
1322
1323         * options.h (General_options): Add no_toc_optimize.
1324         * powerpc.cc (ok_lo_toc_insn): New function.
1325         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1326
1327 2012-12-06  Alan Modra  <amodra@gmail.com>
1328
1329         * options.h (General_options): Add plt_align, plt_static_chain,
1330         plt_thread_safe.  Update stub_group_size help text.
1331         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1332         for new plt_thread_safe_ var.
1333         (use_plt_offset): Correct comments.
1334         (Target_powerpc::do_relax): Look for thread creation symbols to
1335         determine default plt_thread_safe value.  Clear plt call stubs
1336         as well as branch stubs each iteration.
1337         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1338         insn constants.
1339         (l, hi, ha, write_insn): Move earlier.
1340         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1341         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1342         plt stubs too.
1343         (Stub_table::update_size): Adjust.
1344         (Stub_table::prev_size, set_prev_size): Delete.
1345         (Stub_table::stub_align): Let --plt-align affect result.
1346         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1347         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1348         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1349         (Stub_table::do_write): Support more stub variants.
1350
1351 2012-12-04  Alan Modra  <amodra@gmail.com>
1352
1353         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1354         (Target_powerpc::do_define_standard_symbols): New function.
1355
1356 2012-12-03  Alan Modra  <amodra@gmail.com>
1357
1358         * output.h: Formatting, whitespace.
1359
1360 2012-12-03  Alan Modra  <amodra@gmail.com>
1361
1362         * layout.h (Layout::get_executable_sections): Declare.
1363         * layout.cc (Layout::get_executable_sections): New function.
1364         * arm.cc (Target_arm::group_sections): Use it.
1365         (Arm_output_section::group_sections): Delete now redundant test.
1366         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1367         param to handle relative relocs.
1368         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1369         (Output_data_reloc::add_absolute): Adjust.
1370         (Output_data_reloc::add_relative): New function.
1371         (Output_data::reset_data_size): New function.
1372         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1373         (Output_section::set_addralign): New function.
1374         (Output_section::checkpoint_set_addralign): New function.
1375         (Output_section::clear_section_offsets_need_adjustment): New function.
1376         (Output_section::input_sections): Make public.
1377         * powerpc.cc (class Output_data_brlt_powerpc): New.
1378         (class Stub_table, class Stub_control): New.
1379         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1380         stub_table_, set_stub_table, stub_table): New vectors and accessor
1381         functions.
1382         (Target_powerpc::do_may_relax, do_relax, push_branch,
1383         new_stub_table, stub_tables, brlt_section, group_sections,
1384         add_branch_lookup_table, find_branch_lookup_table,
1385         write_branch_lookup_table, make_brlt_section): New functions.
1386         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1387         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1388         branch_info_): New vars.
1389         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1390         make call stubs here.
1391         (Output_data_glink): Remove all call stub handling from this class.
1392         (Target_powerpc::Scan::local, global): Save interesting branch
1393         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1394         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1395         functions on final link.
1396         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1397         Handle long branch destinations too.
1398         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1399         do_plt_address_for_local): Adjust lookup of plt call stubs.
1400
1401 2012-11-30  Alan Modra  <amodra@gmail.com>
1402
1403         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1404         relocs against protected symbols when building 32-bit shared libs.
1405
1406 2012-11-30  Alan Modra  <amodra@gmail.com>
1407
1408         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1409         param.  Call got_section() to make .got.  Update all callers
1410         and their callers and so on.
1411
1412 2012-11-30  Alan Modra  <amodra@gmail.com>
1413
1414         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1415         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1416         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1417         value if it already exists.
1418
1419 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1420
1421         PR gold/14858
1422         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1423
1424 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1425
1426         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1427         than bfc instruction for data sandboxing.
1428
1429 2012-11-08  Alan Modra  <amodra@gmail.com>
1430
1431         * po/POTFILES.in: Regenerate.
1432
1433 2012-11-05  Alan Modra  <amodra@gmail.com>
1434
1435         * configure.ac: Apply 2012-09-10 change to config.in here.
1436         * configure: Regenerate.
1437
1438 2012-11-05  Alan Modra  <amodra@gmail.com>
1439
1440         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1441         (struct Opd_ent): Use "Address" rather than "Offset".
1442         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1443         (Target_powerpc::got_section): Make public.
1444         (Target_powerpc::scan_relocs): Move code setting symbols..
1445         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1446         Create _SDA_BASE_ only when referenced.
1447
1448 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1449
1450         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1451         from last change.
1452
1453 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1454
1455         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1456         for offset_in_output_section parameter.
1457         (Sized_target::relocate_special_relocatable): Likewise.
1458         * arm.cc (Target_arm::relocate_relocs): Likewise.
1459         (Target_arm::relocate_special_relocatable): Likewise.
1460         * i386.cc (Target_i386::relocate_relocs): Likewise.
1461         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1462         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1463         * target-reloc.h (relocate_relocs): Likewise.
1464         * testsuite/testfile.cc (Target_test): Likewise.
1465         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1466         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1467
1468         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1469         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1470
1471         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1472         parameter, which is unused in the [!F_SETFD] case.
1473
1474         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1475         SYMNDX to off_t before comparing it to this->data_size().
1476         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1477         * incremental.cc (Output_section_incremental_inputs::do_write):
1478         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1479
1480         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1481
1482 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1483
1484         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1485         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1486         in EABI_VER5.
1487
1488 2012-10-29  Cary Coutant  <ccoutant@google.com>
1489
1490         * dwp.cc (usage): Add file and exit status parameters;
1491         add --help and --version options.
1492         (print_version): New function.
1493         (main): Add --help and --version options.
1494
1495 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1496
1497         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1498         final_layout_sequence.txt.
1499         * testsuite/Makefile.in: Regenerated.
1500
1501 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1502
1503         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1504         COMPILE generated by automake.
1505         (LINK1): Likewise.
1506         (CXXCOMPILE1): Likewise.
1507         (CXXLINK1): Likewise.
1508         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1509         (LINK): Likewise.
1510         (CXXCOMPILE): Likewise.
1511         (CXXLINK): Likewise.
1512         * testsuite/Makefile.in: Regenerated.
1513
1514 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1515
1516         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1517         on bad fwrite return.
1518
1519 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1520
1521         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1522         on val.
1523
1524 2012-10-23  Cary Coutant  <ccoutant@google.com>
1525
1526         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1527         * testsuite/Makefile.in: Regenerate.
1528         * testsuite/dwp_test.h: New source file.
1529         * testsuite/dwp_test_1.cc: New source file.
1530         * testsuite/dwp_test_1.s: New source file.
1531         * testsuite/dwp_test_1.sh: New source file.
1532         * testsuite/dwp_test_1b.cc: New source file.
1533         * testsuite/dwp_test_1b.s: New source file.
1534         * testsuite/dwp_test_2.cc: New source file.
1535         * testsuite/dwp_test_2.s: New source file.
1536         * testsuite/dwp_test_2.sh: New source file.
1537         * testsuite/dwp_test_main.cc: New source file.
1538         * testsuite/dwp_test_main.s: New source file.
1539
1540 2012-10-23  Cary Coutant  <ccoutant@google.com>
1541
1542         * dwp.h: New header file.
1543         * dwp.cc: New source file.
1544         * gold.h: Move shared declarations to system.h.
1545         * system.h: New header file.
1546         * Makefile.am: Add dwp.
1547         * Makefile.in: Regenerate.
1548
1549 2012-10-23  Cary Coutant  <ccoutant@google.com>
1550
1551         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1552         Dwarf_info_reader::read_from_pointer.
1553         (Dwarf_pubnames_table::read_header): Likewise.
1554         (Dwarf_pubnames_table::next_name): Likewise.
1555         (Dwarf_die::read_attributes): Likewise.
1556         (Dwarf_die::skip_attributes): Likewise.
1557         (Dwarf_info_reader::read_from_pointer): New function template.
1558         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1559         (Dwarf_pubnames_table): Likewise.
1560         (Dwarf_info_reader::read_from_pointer): New function template.
1561         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1562         Dwarf_pubnames_table ctor.
1563
1564 2012-10-23  Cary Coutant  <ccoutant@google.com>
1565
1566         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1567         abbrev_shndx.
1568         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1569         abbrev_shndx_.
1570         (Dwarf_info_reader::set_abbrev_shndx): New method.
1571         (Dwarf_info_reader::abbrev_shndx_): New data member.
1572
1573 2012-10-23  Cary Coutant  <ccoutant@google.com>
1574
1575         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1576         from object, not parameters.
1577         (Dwarf_info_reader::parse): Likewise.
1578         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1579         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1580         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1581         methods.
1582
1583 2012-10-23  Cary Coutant  <ccoutant@google.com>
1584
1585         * fileread.cc (Input_file::Input_file): New constructor.
1586         * fileread.h (class Input_file): Add new constructor.
1587
1588 2012-10-18  Alan Modra  <amodra@gmail.com>
1589
1590         PR gold/14727
1591         * object.cc (Relobj::is_section_name_included): Also match
1592         .sdata personality section.
1593
1594 2012-10-18  Alan Modra  <amodra@gmail.com>
1595
1596         * target-reloc.h (class Default_comdat_behavior): New, package up..
1597         (get_comdat_behaviour): ..this.
1598         (relocate_section): Add Relocate_comdat_behavior template arg,
1599         adjust code to suit.
1600         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1601         (Target_arm::scan_reloc_section): Likewise.
1602         * i386.cc (Target_i386::relocate_section): Likewise.
1603         * sparc.cc (Target_sparc::relocate_section): Likewise.
1604         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1605         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1606         * powerpc.cc (class Relocate_comdat_behavior): New.
1607         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1608         gold::relocate_section with new template arg.
1609
1610 2012-10-18  Alan Modra  <amodra@gmail.com>
1611
1612         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1613         dynamic relocs for GOT_TPREL got entries, without symbol if
1614         resolving locally.
1615         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1616         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1617         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1618
1619 2012-10-17  Alan Modra  <amodra@gmail.com>
1620
1621         PR gold/14726
1622         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1623
1624 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1625
1626         * layout.cc (Layout::include_section): Keep sections marked
1627         SHF_EXCLUDE when doing relocatable links.
1628
1629 2012-10-16  Alan Modra  <amodra@gmail.com>
1630
1631         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1632         (Target_powerpc::do_finalize_sections): Call it.
1633         (Output_data_save_res): New class and supporting functions.
1634         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1635         normal symbols defined in object files.
1636
1637 2012-10-12  Alan Modra  <amodra@gmail.com>
1638
1639         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1640         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1641         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1642         section if scan_opd_relocs not yet called.
1643         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1644
1645 2012-10-12  Alan Modra  <amodra@gmail.com>
1646
1647         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1648         add_local_ifunc_entry): Revert last change.
1649         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1650
1651 2012-10-05  Alan Modra  <amodra@gmail.com>
1652
1653         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1654         do_plt_address_for_global): New functions.
1655         (Output_data_got_powerpc::do_write): Don't segfault when linking
1656         statically.
1657         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1658         add_local_ifunc_entry): Return true on adding entry..
1659         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1660         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1661         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1662         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1663         set up symbols here.
1664         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1665         syms here.  Do so even when no .iplt.  Don't segfault when linking
1666         statically.
1667         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1668         new variants without reloc param.
1669         (Glink_sym_ent::Glink_sym_ent): Likewise.
1670         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1671         reloc when refs will resolve to plt call stub.
1672         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1673         R_PPC_PLTREL24 to resolve locally.
1674         (Target_powerpc::Scan::global): Correct ifunc handling.
1675         (Target_powerpc::Relocate::relocate): Correct local sym glink
1676         lookup.  Don't destroy "value" when we have a plt call stub,
1677         and when checking plt call validity.
1678         (Target_powerpc::do_dynsym_value): Simplify.
1679
1680 2012-10-05  Alan Modra  <amodra@gmail.com>
1681
1682         * i386.cc (Output_data_plt_i386::address_for_global,
1683         address_for_local): Add plt offset to returned value.  Adjust uses.
1684         * sparc.cc (Output_data_plt_sparc::address_for_global,
1685         address_for_local): Likewise.
1686         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1687         address_for_local): Likewise.
1688         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1689         address_for_local): Likewise.
1690         * target.h (Target::plt_address_for_global, plt_address_for_local):
1691         Update comment.
1692         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1693         (Output_data_got::Got_entry::write): Nor here.
1694         * output.h: Comment fix.
1695
1696 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1697
1698         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1699         global_offset_table_ value for larget got.
1700         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1701
1702 2012-09-29  Alan Modra  <amodra@gmail.com>
1703
1704         * powerpc.cc (Target_powerpc::iplt_): New output section.
1705         (Target_powerpc::iplt_section, make_iplt_section,
1706         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1707         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1708         Target_powerpc::plt_entry_count): Count iplt entries too.
1709         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1710         reloc section in constructor.  New params.
1711         (Target_powerpc::make_plt_section): Create reloc section here instead.
1712         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1713         functions.
1714         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1715         (Output_data_glink::add_entry, find_entry): New functions to
1716         deal with local syms.
1717         (Glink_sym_ent): Add support for local syms.
1718         (Output_data_glink::do_write): Handle ifunc plt entries.
1719         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1720         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1721         (Target_powerpc::Relocate::relocate): Likewise.
1722         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1723
1724 2012-09-25  Alan Modra  <amodra@gmail.com>
1725
1726         * object.h (Sized_relobj_file::adjust_local_symbol,
1727         do_adjust_local_symbol): New functions.
1728         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1729         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1730         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1731         and irregular opd entry spacing.
1732         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1733         (Global_symbol_visitor_opd): New functor.
1734         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1735         on deleted opd entries.
1736
1737 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1738
1739         * tilegx.cc: New file.
1740         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1741         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1742         * configure.tgt: Add entries for tilegx*.
1743         * configure.ac: Likewise.
1744         * Makefile.in: Rebuild.
1745         * configure: Likewise.
1746         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1747         tilegx.
1748
1749 2012-09-13  Alan Modra  <amodra@gmail.com>
1750
1751         * target-reloc.h (scan_relocs): Call scan.local for relocs
1752         against symbols in discarded sections.  Pass is_discarded
1753         param.
1754         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1755         Add is_discarded param.
1756         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1757         is_discarded to flag opd entry as discarded.  Don't emit dyn
1758         relocs on such entries.
1759         (Target_powerpc::Scan::global): Similarly detect and handle
1760         such opd entries.
1761         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1762         opd_ent_.  Update all uses.
1763         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1764         (Target_powerpc::relocate_section): Zero out discarded opd
1765         entry relocs.
1766
1767 2012-09-12  Ian Lance Taylor  <iant@google.com>
1768
1769         PR gold/14570
1770         * output.cc: Rename Output_data_got template parameter from size
1771         to got_size for all functions.  Compile all variants of
1772         Output_data_got.
1773         (Output_data_got::Got_entry::write): Correct use of size for
1774         symbol value.  Use local_is_tls rather than casting to
1775         Sized_relobj_file.
1776         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1777         (class Sized_relobj_file): Add do_local_is_tls.
1778         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1779
1780 2012-09-11  Alan Modra  <amodra@gmail.com>
1781
1782         PR gold/14566
1783         * layout.cc (Layout::set_segment_offsets): When using
1784         common-page-size alignment, ensure we are on a new max-page-size
1785         page.
1786         * output.cc (Output_segment::set_section_addresses): Use
1787         abi_pagesize, not common_pagesize for relro boundary.
1788         (Output_segment::set_offset): Likewise.
1789
1790 2012-09-11  Alan Modra  <amodra@gmail.com>
1791
1792         * output.h (Output_data_got::add_global_tls, add_local_tls,
1793         add_local_tls_pair): New functions.
1794         (Output_data_got::add_local_pair_with_rel): Remove second
1795         reloc param.  Expand comment.
1796         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1797         use_plt_or_tls_offset_, similarly for constructor param.
1798         (Output_data_got::Got_entry::write): Add got_index param.
1799         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1800         add_local_tls_pair): New functions.
1801         (Output_data_got::Got_entry::write): Handle tls symbols
1802         with use_plt_or_tls_offset_ set specially.
1803         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1804         (Output_data_got::do_write): Replace iterator with index, pass
1805         index to entry write function.
1806         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1807         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1808         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1809         call.
1810         * i386.cc (Target_i386::Scan::local): Likewise.
1811         * sparc.cc (Target_sparc::Scan::local): Likewise.
1812         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1813         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1814         do_tls_offset_for_global): New functions.
1815         (Target_powerpc::Scan::local): Correct TLS relocations and got
1816         entry values.
1817         (Target_powerpc::Scan::global): Don't emit unnecessary
1818         dynamic relocations on TLS GOT entries.
1819
1820 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1821
1822         * config.in: Disable sanity check for kfreebsd.
1823
1824 2012-09-10  Sterling Augustine  <saugustine@google.com>
1825
1826         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1827         (Gdb_index::pubtypes_read): New parameter.
1828         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1829         to calls.
1830         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1831         pubtypes_object_.
1832
1833 2012-09-09  Alan Modra  <amodra@gmail.com>
1834
1835         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1836         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1837         * gc.h (gc_process_relocs): Call target gc_add_reference.
1838         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1839         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1840         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1841         unnecessary cast.
1842         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1843         to cater for when we don't need code offset.  Update use.
1844         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1845         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1846         set_opd_valid): New functions.
1847         (Target_powerpc::do_gc_add_reference): New function.
1848         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1849         stashed refs.
1850         (Target_powerpc::do_gc_mark_symbol): New function.
1851
1852 2012-09-06  Cary Coutant  <ccoutant@google.com>
1853
1854         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1855         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1856         (Dwarf_die::skip_attributes): Likewise.
1857         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1858         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1859         (main): Call it.
1860         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1861
1862 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1863
1864         * testsuite/script_test_3.t: Add .got.plt output section
1865         statement.
1866         * testsuite/script_test_4.t: Likewise.
1867
1868 2012-09-05  Alan Modra  <amodra@gmail.com>
1869
1870         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1871         update all uses and lose "enum" when using type.
1872
1873 2012-09-05  Alan Modra  <amodra@gmail.com>
1874
1875         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1876         * configure: Regenerate.
1877         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1878         (plugin_final_layout.stdout): Likewise.
1879         (memory_test): Set page sizes to 0x1000.
1880         * testsuite/Makefile.in: Regenerate.
1881         * testsuite/discard_locals_test.sh: Add FIXME comment.
1882         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1883         * testsuite/pr14265.t: Add .got output section statement.
1884         * testsuite/script_test_2.t: Likewise.
1885         * testsuite/script_test_3.t: Likewise.
1886         * testsuite/script_test_4.t: Likewise.
1887         * testsuite/script_test_5.t: Likewise.
1888         * testsuite/script_test_6.t: Likewise.
1889         * testsuite/script_test_7.t: Likewise.
1890         * testsuite/script_test_9.t: Likewise.
1891
1892 2012-09-05  Alan Modra  <amodra@gmail.com>
1893
1894         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1895         (Powerpc_relocate_functions::Status): New typedef.
1896         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1897         (Target_powerpc::Scan::local): Handle REL64.
1898         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1899         for REL32 and REL64.
1900         (Target_powerpc::symval_for_branch): New function, extracted from..
1901         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1902         checks.  Report overflow errors.
1903
1904 2012-09-05  Alan Modra  <amodra@gmail.com>
1905
1906         * object.h (Sized_relobj_file::emit_relocs): Delete.
1907         (Sized_relobj_file::emit_relocs_reltype): Delete.
1908         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1909         relocate_relocs for --emit-relocs.
1910         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1911         * output.h: Update comment.
1912         (Output_segment::first_section): New function.
1913         (Output_segment::first_section_load_address): Use first_section.
1914         * output.cc (Output_segment::first_section): New function extracted..
1915         (Output_segment::first_section_load_address): ..from here.  Delete.
1916         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1917         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1918         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1919         adjust call to target.h function.
1920         * i386.cc (Target_i386): Likewise.
1921         * sparc.cc (Target_sparc): Likewise.
1922         * x86_64.cc (Target_x86_64): Likewise.
1923         * powerpc.cc (Target_powerpc): Likewise.
1924         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1925         first tls section has section symbol for optimised local dynamic
1926         output relocs.
1927         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1928         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1929         optimised tls code.
1930         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1931         Rename to relocate_relocs.  Update error message.
1932
1933 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1934
1935         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1936         --just-symbols.
1937
1938 2012-08-31  Alan Modra  <amodra@gmail.com>
1939
1940         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1941         (Powerpc_relobj::toc_base_offset): New stub function.
1942         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1943         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1944         (Target_powerpc::Relocate::enum skip_tls): New.
1945         (Target_powerpc::call_tls_get_addr_): New var.
1946         (Target_powerpc::is_branch_reloc): Move to file scope.
1947         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1948         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1949         New functions.
1950         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1951         (powerpc_info): Correct common_pagesize for ppc64.
1952         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1953         (Powerpc_relocate_functions): Add overflow check enums and functions.
1954         Add non-shift version of rela, rela_ua.  Delete all rel public
1955         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1956         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1957         addr16_ha3, addr14 functions.
1958         (Output_data_got_powerpc::add_constant_pair): New function.
1959         (Output_data_got_powerpc::got_base_offset): Likewise.
1960         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1961         (instruction constants): Sort, add some more.
1962         (Output_data_glink::do_write): Add and use Address typedef.  Use
1963         object->toc_base_offset() stub for 64-bit.
1964         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1965         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1966         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1967         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1968         Always treat .opd relocs as against locally defined symbol.
1969         Correct condition for RELATIVE relocs.
1970         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1971         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1972         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1973         calculations.  Handle TLS relocs, and more.  Add overflow
1974         checking and adjust for Powerpc_relocate_functions changes.
1975         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1976         Reinstate --emit-relocs code with FIXME.
1977
1978 2012-08-30  Alan Modra  <amodra@gmail.com>
1979
1980         * layout.cc (Layout::set_segment_offsets): Set p_align to
1981         abi_pagesize, not common_pagesize.
1982         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1983         to determine whether file header can go in segment.
1984
1985 2012-08-30  Alan Modra  <amodra@gmail.com>
1986
1987         * output.h (Output_reloc::Output_reloc <output section>): Add
1988         is_relative param.  Adjust calls.
1989         (Output_reloc::add_output_section_relative): New functions.
1990         * output.cc (Output_reloc::Output_reloc <output section>): Handle
1991         is_relative.
1992         (Output_reloc::symbol_value): Handle SECTION_CODE.
1993
1994 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
1995
1996         * gold.cc (queue_middle_tasks): Call layout again when unique
1997         segments for sections is desired.
1998         * layout.cc (Layout::Layout): Initialize new members.
1999         (Layout::get_output_section_flags): New function.
2000         (Layout::choose_output_section): Call get_output_section_flags.
2001         (Layout::layout): Make output section for mapping to a unique segment.
2002         (Layout::insert_section_segment_map): New function.
2003         (Layout::attach_allocated_section_to_segment): Make unique segment for
2004         output sections marked so.
2005         (Layout::segment_precedes): Check for unique segments when sorting.
2006         * layout.h (Layout::Unique_segment_info): New struct.
2007         (Layout::Section_segment_map): New typedef.
2008         (Layout::insert_section_segment_map): New function.
2009         (Layout::get_output_section_flags): New function.
2010         (Layout::is_unique_segment_for_sections_specified): New function.
2011         (Layout::set_unique_segment_for_sections_specified): New function.
2012         (Layout::unique_segment_for_sections_specified_): New member.
2013         (Layout::section_segment_map_): New member.
2014         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2015         Rename is_gc_pass_one to is_pass_one.
2016         Rename is_gc_pass_two to is_pass_two.
2017         Rename is_gc_or_icf to is_two_pass.
2018         Check for which pass based on whether symbols data is present.
2019         Make it two pass when unique segments for sections is desired.
2020         * output.cc (Output_section::Output_section): Initialize new
2021         members.
2022         * output.h (Output_section::is_unique_segment): New function.
2023         (Output_section::set_is_unique_segment): New function.
2024         (Output_section::is_unique_segment_): New member.
2025         (Output_section::extra_segment_flags): New function.
2026         (Output_section::set_extra_segment_flags): New function.
2027         (Output_section::extra_segment_flags_): New member.
2028         (Output_section::segment_alignment): New function.
2029         (Output_section::set_segment_alignment): New function.
2030         (Output_section::segment_alignment_): New member.
2031         (Output_segment::Output_segment): Initialize is_unique_segment_.
2032         (Output_segment::is_unique_segment): New function.
2033         (Output_segment::set_is_unique_segment): New function.
2034         (Output_segment::is_unique_segment_): New member.
2035         * plugin.cc (allow_unique_segment_for_sections): New function.
2036         (unique_segment_for_sections): New function.
2037         (Plugin::load): Add new functions to transfer vector.
2038         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2039         * Makefile.in: Regenerate.
2040         * testsuite/plugin_final_layout.sh: Check if unique segment
2041         functionality works.
2042         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2043         are available.
2044         (allow_unique_segment_for_sections): New global.
2045         (unique_segment_for_sections): New global.
2046         (claim_file_hook): Call allow_unique_segment_for_sections.
2047         (all_symbols_read_hook): Call unique_segment_for_sections.
2048
2049 2012-08-22  Cary Coutant  <ccoutant@google.com>
2050
2051         * layout.cc (Layout::include_section): Don't assert on GROUP
2052         sections with --emit-relocs.
2053
2054 2012-08-21  Cary Coutant  <ccoutant@google.com>
2055
2056         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2057         if --export-dynamic-symbol names an undef symbol.
2058
2059 2012-08-18  Alan Modra  <amodra@gmail.com>
2060
2061         * powerpc.cc: Formatting and white space.
2062         (Powerpc_relobj): Rename got2_section_ to special_.
2063         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2064         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2065         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2066         (Target_powerpc): Add Address typedef and invalid_address.  Use
2067         throughout.
2068         (Target_powerpc::is_branch_reloc): New function.
2069         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2070         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2071         for dst_mask, value and addend.
2072         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2073         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2074         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2075         uint16_t for 24-bit offset.  Use get_output_section_offset and
2076         check return.
2077         (Target_powerpc::Scan::local): Handle more relocs.
2078         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2079         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2080         Plug in toc restoring insn after plt calls.  Translate branches
2081         to function descriptor symbols to corresponding entry point.
2082         (Target_powerpc::relocate_for_relocatable): Check return from
2083         get_output_section_offset.
2084         * symtab.h: Comment typo.
2085
2086 2012-08-14  Ian Lance Taylor  <iant@google.com>
2087
2088         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2089         unsupported_relocal_local to call unsupported_reloc_global.
2090
2091 2012-08-14  Nick Clifton  <nickc@redhat.com>
2092
2093         PR ld/14265
2094         * script-sections.cc (Sections_element::output_section_name): Add
2095         keep return parameter.
2096         (Output_section_element::match_name): Add keep return parameter.
2097         Return the value of the keep_ member.
2098         * script-sections.h (class Output_section): Update
2099         output_section_name prototype.
2100         * layout.cc (Layout::keep_input_section): New public member
2101         function.
2102         (Layout::choose_output_section): Pass keep parameter to
2103         output_section_name.
2104         * layout.h (class Layout): Add keep_input_section.
2105         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2106         sections.
2107         * testsuite/Makefile.am: Add a test.
2108         * testsuite/Makefile.in: Regenerate.
2109         * testsuite/pr14265.c: Source file for the test.
2110         * testsuite/pr14265.t: Linker script for the test.
2111         * testsuite/pr14265.sh: Shell script for the test.
2112
2113 2012-08-14  Alan Modra  <amodra@gmail.com>
2114
2115         * target.h (Target::output_section_name): New function.
2116         (Target::do_output_section_name): New function.
2117         * layout.cc (Layout::choose_output_section): Call the above.
2118         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2119
2120 2012-08-14  Alan Modra  <amodra@gmail.com>
2121
2122         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2123         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2124         for replace_constant call.
2125         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2126         (Output_data_glink::do_print_to_mapfile): New function.
2127         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2128         (Target_powerpc::Relocate::relocate): Likewise.
2129
2130 2012-08-14  Alan Modra  <amodra@gmail.com>
2131
2132         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2133         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2134         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2135         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2136         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2137         here.
2138         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2139         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2140         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2141         here.
2142         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2143         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2144
2145 2012-08-12  Alan Modra  <amodra@gmail.com>
2146
2147         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2148         (glink insn constants): Use uint32_t.
2149         (Output_data_glink::add_entry): Use insert, not [] operator.
2150
2151 2012-08-11  Alan Modra  <amodra@gmail.com>
2152
2153         * object.h (Sized_relobj_file::find_shdr): New function.
2154         (Sized_relobj_file::find_special_sections): New function.
2155         * object.cc (Sized_relobj_file::find_shdr): New function.
2156         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2157         (Sized_relobj_file::find_special_sections): New function, split out..
2158         (Sized_relobj_file::do_read_symbols): ..from here.
2159         * output.h (Output_data_got::replace_constant): New function.
2160         (Output_data_got::num_entries): New function.
2161         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2162         (Output_data_got::got_offset): Protected rather than private.
2163         (Output_data_got::replace_got_entry): New function.
2164         * output.cc (Output_data_got::replace_got_entry): New function.
2165         * powerpc.cc (class Powerpc_relobj): New.
2166         (class Powerpc_relocate_functions): Delete all psymval variants or
2167         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2168         Implement _ha functions using corresponding _hi function.
2169         (Powerpc_relobj::find_special_sections): New function.
2170         (Target_powerpc::do_make_elf_object): New function.
2171         (class Output_data_got_powerpc): New.
2172         (class Output_data_glink): New.
2173         (class Powerpc_scan_relocatable_reloc): New.
2174         Many more changes througout file.
2175
2176 2012-08-09  Nick Clifton  <nickc@redhat.com>
2177
2178         * po/vi.po: Updated Vietnamese translation.
2179
2180 2012-08-07  Ian Lance Taylor  <iant@google.com>
2181
2182         * layout.cc (Layout::add_target_dynamic_tags): If
2183         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2184         plt_rel.
2185
2186 2012-07-30  Nick Clifton  <nickc@redhat.com>
2187
2188         * po/gold.pot: Updated template.
2189         * po/es.po: Updated Spanish translation.
2190
2191 2012-07-18  Cary Coutant  <ccoutant@google.com>
2192
2193         PR gold/14344
2194         * configure.ac: Add check for -gpubnames support.
2195         * configure: Regenerate.
2196         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2197         support; force -gno-pubnames.
2198         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2199         support.
2200         (gdb_index_test_4): New test.
2201         * testsuite/Makefile.in: Regenerate.
2202         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2203         * testsuite/gdb_index_test_2.sh: Likewise.
2204         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2205         * testsuite/gdb_index_test_4.sh: New script.
2206         * testsuite/gdb_index_test_comm.sh: New script with common code;
2207         don't look for space after colon.
2208
2209 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2210
2211         * gold.cc (queue_middle_tasks): Update function order only after
2212         deferred objects due to plugins are processed.
2213
2214 2012-07-11  Ian Lance Taylor  <iant@google.com>
2215
2216         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2217         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2218         (Target_arm::scan_reloc_for_stub): Likewise.
2219         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2220         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2221         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2222         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2223         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2224
2225 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2226             Ian Lance Taylor  <iant@google.com>
2227
2228         PR gold/14309
2229         * configure.ac: Test whether std::tr1::hash<off_t> works.
2230         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2231         needed.
2232         * output.h (class Output_fill): Add virtual destructor.
2233         * configure, config.in: Rebuild.
2234
2235 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2236
2237         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2238
2239 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2240
2241         * plugin.cc (Plugin::load): Handle position independent executables.
2242
2243 2012-06-06  Cary Coutant  <ccoutant@google.com>
2244
2245         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2246         add .debug_macro.
2247         (lines_only_debug_sections): Likewise.
2248         (gdb_fast_lookup_sections): New static array.
2249         (is_gdb_debug_section): Rename formal parameter.
2250         (is_lines_only_debug_section): Likewise.
2251         (is_gdb_fast_lookup_section): New function.
2252         (Layout::include_section): Check for ".zdebug_" prefix; pass
2253         section name suffix to is_gdb_debug_section, et al.; check for
2254         fast-lookup sections when building .gdb_index.
2255         * options.h (--strip-debug-gdb): Update GDB version number.
2256
2257 2012-06-06  Cary Coutant  <ccoutant@google.com>
2258
2259         * configure.ac: Add check for fallocate.
2260         * configure: Regenerate.
2261         * config.in: Regenerate.
2262
2263         * options.h (class General_options): Add --mmap-output-file and
2264         --posix-fallocate options.
2265         * output.cc: (posix_fallocate): Remove; replace with...
2266         (gold_fallocate): New function.
2267         (Output_file::map_no_anonymous): Call gold_fallocate.
2268         (Output_file::map): Check --mmap-output-file option.
2269
2270 2012-06-05  Jing Yu  <jingyu@google.com>
2271
2272         * gold.h (textdomain): Add do {} to empty while(0).
2273         (bindtextdomain): Likewise.
2274
2275 2012-06-04  Cary Coutant  <ccoutant@google.com>
2276
2277         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2278         has_dynsym_index.
2279
2280 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2281
2282         * symtab.cc (Symbol_table::define_special_symbol):
2283         Initialize *poldsym to prevent uninitialized variable errors.
2284
2285 2012-05-23  Cary Coutant  <ccoutant@google.com>
2286
2287         * layout.cc (Layout::section_name_mapping): Add rules to handle
2288         exact match on .data.rel.ro.local or .data.rel.ro.
2289         (Layout::output_section_name): Check for exact matches.
2290
2291 2012-05-23  Cary Coutant  <ccoutant@google.com>
2292
2293         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2294         more carefully.
2295
2296 2012-05-22  Cary Coutant  <ccoutant@google.com>
2297
2298         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2299         object before exporting symbol.
2300
2301 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2302
2303         * testsuite/tls_test.cc: Include "config.h" first.
2304         * testsuite/tls_test_c.c: Likewise.
2305
2306 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2307             Nick Clifton  <nickc@redhat.com>
2308
2309         PR 14072
2310         * configure.in: Add check that sysdep.h has been included before
2311         any system header files.
2312         * configure: Regenerate.
2313         * config.in: Regenerate.
2314
2315 2012-05-14  Cary Coutant  <ccoutant@google.com>
2316
2317         * layout.cc (Layout::make_output_section): Mark .tdata section
2318         as RELRO.
2319         * testsuite/relro_test.cc: Add a TLS variable.
2320
2321 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2322
2323         PR gold/14091
2324         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2325         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2326         R_X86_64_64.
2327
2328 2012-05-08  Cary Coutant  <ccoutant@google.com>
2329
2330         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2331         (lines_only_debug_sections): Likewise.
2332
2333 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2334
2335         * nacl.cc: New file.
2336         * nacl.h: New file.
2337         * Makefile.am (CCFILES, HFILES): Add them.
2338         * Makefile.in: Regenerate.
2339         * i386.cc (Output_data_plt_i386_nacl): New class.
2340         (Output_data_plt_i386_nacl_exec): New class.
2341         (Output_data_plt_i386_nacl_dyn): New class.
2342         (Target_i386_nacl): New class.
2343         (Target_selector_i386_nacl): New class.
2344         (target_selector_i386): Use it instead of Target_selector_i386.
2345         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2346         (Target_x86_64_nacl): New class.
2347         (Target_selector_x86_64_nacl): New class.
2348         (target_selector_x86_64, target_selector_x32): Use it instead of
2349         Target_selector_x86_64.
2350         * arm.cc (Output_data_plt_arm_nacl): New class.
2351         (Target_arm_nacl): New class.
2352         (Target_selector_arm_nacl): New class.
2353         (target_selector_arm, target_selector_armbe): Use it instead of
2354         Target_selector_arm.
2355
2356         * target-select.cc (select_target): Take new Input_file* and off_t
2357         arguments, pass them on to recognize method of selector.
2358         * object.cc (make_elf_sized_object): Update caller.
2359         * parameters.cc (parameters_force_valid_target): Likewise.
2360         * incremental.cc (make_sized_incremental_binary): Likewise.
2361         * target-select.h: Update decl.
2362         (Target_selector::recognize): Take new Input_file* argument,
2363         pass it on to do_recognize.
2364         (Target_selector::do_recognize): Take new Input_file* argument.
2365         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2366         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2367         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2368         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2369
2370         * target.h (Target::Target_info): New members isolate_execinstr
2371         and rosegment_gap.
2372         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2373         * arm.cc (Target_arm::arm_info): Update initializer.
2374         * i386.cc (Target_i386::i386_info): Likewise.
2375         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2376         * sparc.cc (Target_sparc::sparc_info): Likewise.
2377         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2378         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2379         * layout.cc (Layout::attach_allocated_section_to_segment):
2380         Take new const Target* argument.  If target->isolate_execinstr(), act
2381         like --rosegment.
2382         (Layout::find_first_load_seg): Take new const Target* argument;
2383         if target->isolate_execinstr(), reject PF_X segments.
2384         (Layout::relaxation_loop_body): Update caller.
2385         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2386         reset file offset to zero when we hit LOAD_SEG, and then do a second
2387         loop over the segments before LOAD_SEG to reassign offsets after
2388         addresses have been determined.  Handle target->rosegment_gap().
2389         (Layout::attach_section_to_segment): Take new const Target* argument;
2390         pass it to attach_allocated_section_to_segment.
2391         (Layout::make_output_section): Update caller.
2392         (Layout::attach_sections_to_segments): Take new const Target* argument;
2393         pass it to attach_section_to_segment.
2394         * gold.cc (queue_middle_tasks): Update caller.
2395         * layout.h (Layout): Update method decls with new arguments.
2396
2397         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2398         Target_info pointer to use.
2399         (Target_arm::do_make_data_plt): New virtual method.
2400         (Target_arm::make_data_plt): New method that calls it.
2401         (Target_arm::make_plt_entry): Use it.
2402         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2403         for the section alignment.
2404         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2405         method.
2406         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2407         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2408         method.
2409         (Output_data_plt_arm::get_plt_entry_size): Call it.
2410         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2411         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2412         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2413         method.
2414         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2415         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2416         method instead of sizeof(plt_entry).
2417         (Output_data_plt_arm::add_entry): Likewise.
2418         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2419         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2420         than static method.
2421         (Target_arm::plt_entry_size): Likewise.
2422         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2423         Move to ...
2424         (Output_data_plt_arm_standard): ... here, new class.
2425         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2426         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2427         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2428
2429         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2430         Take additional argument for the PLT entry size.
2431         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2432         Use get_plt_entry_size method rather than plt_entry_size variable.
2433         (Output_data_plt_x86_64::reserve_slot): Likewise.
2434         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2435         (Output_data_plt_x86_64::add_entry): Likewise.
2436         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2437         (Output_data_plt_x86_64::address_for_global): Likewise.
2438         (Output_data_plt_x86_64::address_for_local): Likewise.
2439         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2440         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2441         Make method non-static.
2442         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2443         method.
2444         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2445         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2446         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2447         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2448         virtual method.
2449         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2450         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2451         virtual method.
2452         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2453         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2454         virtual method.
2455         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2456         (Output_data_plt_x86_64::plt_entry_size)
2457         (Output_data_plt_x86_64::first_plt_entry)
2458         (Output_data_plt_x86_64::plt_entry)
2459         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2460         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2461         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2462         (Output_data_plt_x86_64_standard): ... here, new class.
2463         (Target_x86_64::Target_x86_64): Take optional argument for the
2464         Target_info pointer to use.
2465         (Target_x86_64::do_make_data_plt): New virtual method.
2466         (Target_x86_64::make_data_plt): New method to call it.
2467         (Target_x86_64::init_got_plt_for_update): Use that.
2468         Call this->plt_->add_eh_frame method here.
2469         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2470         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2471         rather than static method.
2472         (Target_x86_64::plt_entry_size): Likewise.
2473         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2474         rather than plt_entry_size variable.  Move guts of PLT filling to...
2475         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2476         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2477         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2478
2479         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2480         additional argument for the section alignment.
2481         Don't do add_eh_frame_for_plt here.
2482         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2483         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2484         variable.
2485         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2486         method.
2487         (Output_data_plt_i386::get_plt_entry_size): Call it.
2488         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2489         (Output_data_plt_i386::add_eh_frame): New method to call it.
2490         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2491         method.
2492         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2493         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2494         method.
2495         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2496         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2497         method instead of plt_entry_size.
2498         (Output_data_plt_i386::plt_entry_size)
2499         (Output_data_plt_i386::plt_eh_frame_fde_size)
2500         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2501         (Output_data_plt_i386_standard): ... here, new class.
2502         (Output_data_plt_i386_exec): New class.
2503         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2504         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2505         (Output_data_plt_i386::exec_plt_entry): Move to ...
2506         (Output_data_plt_i386_exec::plt_entry): ... here.
2507         (Output_data_plt_i386_dyn): New class.
2508         (Output_data_plt_i386::first_plt_entry): Move to ...
2509         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2510         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2511         (Output_data_plt_i386_dyn::plt_entry): ... here.
2512         (Target_i386::Target_i386): Take optional argument for the Target_info
2513         pointer to use.
2514         (Target_i386::do_make_data_plt): New virtual method.
2515         (Target_i386::make_data_plt): New method to call it.
2516         (Target_i386::make_plt_section): Use that.
2517         Call this->plt_->add_eh_frame method here.
2518         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2519         rather than plt_entry_size variable.
2520         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2521         (Output_data_plt_i386::address_for_local): Likewise.
2522         (Output_data_plt_i386::do_write): Likewise.
2523         Move guts of PLT filling to...
2524         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2525         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2526         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2527         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2528
2529 2012-05-01  Cary Coutant  <ccoutant@google.com>
2530
2531         * dwarf_reader.cc (Dwarf_die::read_attributes)
2532         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2533         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2534         * reduced_debug_output.cc
2535         (Output_reduced_debug_info_section::get_die_end): Remove
2536         DW_FORM_GNU_ref_index.  Add default case.
2537
2538 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2539
2540         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2541         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2542         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2543         DW_AT_high_pc as offset from DW_AT_low_pc.
2544
2545         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2546         * testsuite/Makefile.in: Regenerate.
2547         * testsuite/gdb_index_test_3.c: New test source file.
2548         * testsuite/gdb_index_test_3.sh: New test source file.
2549
2550 2012-04-25  Ian Lance Taylor  <iant@google.com>
2551
2552         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2553         pointer.
2554         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2555         as a class, not a struct.
2556         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2557         (Target_arm::apply_cortex_a8_workaround): Likewise.
2558         * gc.h: Declare Reloc_types as a struct, not a class.
2559         * object.h: Declare Symbols_data as a struct.
2560         * reloc.h: Declare Read_relocs_data as a struct.
2561         * target.h: Declare Relocate_info as a struct.
2562
2563 2012-04-24  David S. Miller  <davem@davemloft.net>
2564
2565         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2566         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2567         and R_SPARC_WPLT30.
2568
2569 2012-04-24  Cary Coutant  <ccoutant@google.com>
2570
2571         * incremental-dump.cc (find_input_containing_global): Replace
2572         magic number with symbolic constant.
2573         (dump_incremental_inputs): Update version number.
2574         * incremental.cc (Output_section_incremental_inputs): Update version
2575         number; import symbolic constants from Incremental_inputs_reader.
2576         (Incremental_inputs::create_data_sections): Align relocations
2577         section correctly for 64-bit targets.
2578         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2579         constants; add padding.
2580         (Output_section_incremental_inputs::write_header): Add assert for
2581         header_size.
2582         (Output_section_incremental_inputs::write_input_files): Add assert
2583         for input_entry_size.
2584         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2585         add assert for object_info_size, input_section_entry_size,
2586         global_sym_entry_size.
2587         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2588         for data structure sizes; use them.
2589         (Incremental_input_entry_reader): Import symbolic constants from
2590         Incremental_inputs_reader; use them.
2591
2592 2012-04-23  David S. Miller  <davem@davemloft.net>
2593
2594         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2595         and elf_flags_set_.
2596         (Target_sparc::Target_sparc): Initialize new fields.
2597         (Target_sparc::do_make_elf_object): New function.
2598         (Target_sparc::do_adjust_elf_header): New function.
2599
2600 2012-04-23  Cary Coutant  <ccoutant@google.com>
2601
2602         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2603         CU range table of gdb index.
2604
2605 2012-04-20  David S. Miller  <davem@davemloft.net>
2606
2607         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2608         instead of false.
2609
2610 2012-04-16  David S. Miller  <davem@davemloft.net>
2611
2612         * sparc.cc (Target_sparc::got_address): New function.
2613         (Sparc_relocate_functions::gdop_hix22): New function.
2614         (Sparc_relocate_functions::gdop_lox10): New function.
2615         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2616         relocs.
2617         (Target_sparc::Scan::local): Likewise if the global symbol is not
2618         preemptible and is not IFUNC.
2619         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2620         transformations for local and non-preemptible non-IFUNC global
2621         symbols.
2622
2623         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2624         writing out 64-bit part of ranges.
2625
2626         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2627         -fpic and -fpie respectively.
2628         * Makefile.in: Regenerate.
2629
2630         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2631         (Target_sparc::Target_sparc): Initialize new field.
2632         (Target_sparc::do_plt_section_for_global): New function.
2633         (Target_sparc::do_plt_section_for_local): New function.
2634         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2635         (Target_sparc::make_plt_section): New function, broken out of
2636         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2637         (Target_sparc::make_plt_entry): Call make_plt_section.
2638         (Target_sparc::make_local_ifunc_plt_entry): New function.
2639         (Target_sparc::rela_ifunc_section): New function.
2640         (Target_sparc::plt_section): Remove const.
2641         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2642         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2643         and ifunc_count_ fields.
2644         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2645         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2646         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2647         (Output_data_plt_sparc::rela_ifunc): New function.
2648         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2649         (Output_data_plt_sparc::has_ifunc_section): New function.
2650         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2651         (Output_data_plt_sparc::address_for_global): New function.
2652         (Output_data_plt_sparc::address_for_local): New function.
2653         (Output_data_plt_sparc::plt_index_to_offset): New function.
2654         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2655         and entry_count.
2656         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2657         entry_count.
2658         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2659         R_SPARC_JMP_IREL to switch.
2660         (Target_sparc::Scan::check_non_pic): Likewise.
2661         (Target_sparc::Scan::local): Handle IFUNC symbols.
2662         (Target_sparc::Scan::local): Likewise.
2663         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2664         and plt_address_for_local.
2665         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2666         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2667
2668         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2669         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2670         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2671         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2672         global relocs too.
2673         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2674         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2675         calls.
2676         * sparc.cc (Target_sparc::Scan::global): Likewise.
2677         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2678
2679 2012-04-16  Cary Coutant  <ccoutant@google.com>
2680
2681         * archive.cc (Library_base::should_include_member): Check for
2682         --export-dynamic-symbol.
2683         * options.h (class General_options): Add --export-dynamic-symbol.
2684         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2685         --export-dynamic-symbol.
2686         (Symbol_table::gc_mark_undef_symbols): Likewise.
2687         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2688
2689 2012-04-12  David S. Miller  <davem@davemloft.net>
2690
2691         * sparc.cc (Reloc::wdisp10): New relocation method.
2692         (Reloc::h34): Likewise.
2693         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2694         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2695         R_SPARC_WDISP10.
2696         (Target_sparc::Scan::local): Likewise.
2697         (Target_sparc::Scan::global): Likewise.
2698         (Target_sparc::Relocate::relocate): Likewise.
2699
2700 2012-04-09  Cary Coutant  <ccoutant@google.com>
2701
2702         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2703         low_pc == 0.
2704
2705 2012-04-06  Ian Lance Taylor  <iant@google.com>
2706
2707         * timer.cc: #include <unistd.h>.
2708
2709 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2710
2711         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2712         * config.in: Regenerate.
2713         * configure: Regenerate.
2714
2715 2012-04-05  Nick Clifton  <nickc@redhat.com>
2716
2717         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2718         (AM_LC_MESSAGES): Add.
2719         * aclocal.m4: Regenerate.
2720         * config.in: Regenerate.
2721         * configure: Regenerate.
2722
2723 2012-03-21  Cary Coutant  <ccoutant@google.com>
2724
2725         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2726         * Makefile.in: Regenerate.
2727         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2728         (Sized_elf_reloc_mapper::symbol_section): New function.
2729         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2730         (make_elf_reloc_mapper): New function.
2731         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2732         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2733         (Dwarf_abbrev_table::do_get_abbrev): New function.
2734         (Dwarf_ranges_table::read_ranges_table): New function.
2735         (Dwarf_ranges_table::read_range_list): New function.
2736         (Dwarf_pubnames_table::read_section): New function.
2737         (Dwarf_pubnames_table::read_header): New function.
2738         (Dwarf_pubnames_table::next_name): New function.
2739         (Dwarf_die::Dwarf_die): New function.
2740         (Dwarf_die::read_attributes): New function.
2741         (Dwarf_die::skip_attributes): New function.
2742         (Dwarf_die::set_name): New function.
2743         (Dwarf_die::set_linkage_name): New function.
2744         (Dwarf_die::attribute): New function.
2745         (Dwarf_die::string_attribute): New function.
2746         (Dwarf_die::int_attribute): New function.
2747         (Dwarf_die::uint_attribute): New function.
2748         (Dwarf_die::ref_attribute): New function.
2749         (Dwarf_die::child_offset): New function.
2750         (Dwarf_die::sibling_offset): New function.
2751         (Dwarf_info_reader::check_buffer): New function.
2752         (Dwarf_info_reader::parse): New function.
2753         (Dwarf_info_reader::do_parse): New function.
2754         (Dwarf_info_reader::do_read_string_table): New function.
2755         (Dwarf_info_reader::lookup_reloc): New function.
2756         (Dwarf_info_reader::get_string): New function.
2757         (Dwarf_info_reader::visit_compilation_unit): New function.
2758         (Dwarf_info_reader::visit_type_unit): New function.
2759         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2760         Sized_elf_reloc_mapper.
2761         (Sized_dwarf_line_info::symbol_section): Remove function.
2762         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2763         (Sized_dwarf_line_info::read_line_mappings): Remove object
2764         parameter, adjust callers.
2765         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2766         * dwarf_reader.h: Include <sys/types.h>.
2767         (class Track_relocs): Remove forward declaration.
2768         (class Elf_reloc_mapper): New class.
2769         (class Sized_elf_reloc_mapper): New class.
2770         (class Dwarf_abbrev_table): New class.
2771         (class Dwarf_range_list): New class.
2772         (class Dwarf_ranges_table): New class.
2773         (class Dwarf_pubnames_table): New class.
2774         (class Dwarf_die): New class.
2775         (class Dwarf_info_reader): New class.
2776         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2777         (Sized_dwarf_line_info::symbol_section): Remove member function.
2778         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2779         base class.
2780         * gdb-index.cc: New source file.
2781         * gdb-index.h: New source file.
2782         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2783         and .debug_types sections, call Layout::add_to_gdb_index.
2784         (Sized_relobj_incr::do_section_name): Implement.
2785         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2786         return type; Implement.
2787         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2788         return type.
2789         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2790         parameter list and return type.
2791         (Sized_incr_dynobj::do_section_contents): Likewise.
2792         * layout.cc: Include gdb-index.h.
2793         (Layout::Layout): Initialize gdb_index_data_.
2794         (Layout::init_fixed_output_section): Check for .gdb_index section.
2795         (Layout::add_to_gdb_index): New function. Instantiate.
2796         * layout.h: Add forward declaration for class Gdb_index.
2797         (Layout::add_to_gdb_index): New member function.
2798         (Layout::gdb_index_data_): New data member.
2799         * main.cc: Include gdb-index.h.
2800         (main): Print statistics for gdb index.
2801         * object.cc (Object::section_contents): Move code into
2802         do_section_contents.
2803         (need_decompressed_section): Check for sections needed when building
2804         gdb index.
2805         (build_compressed_section_map): Likewise.
2806         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2807         gdb index.
2808         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2809         sections; call Layout::add_to_gdb_index.
2810         (Sized_relobj_file::do_decompressed_section_contents): Call
2811         do_section_contents directly.
2812         * object.h (Object::do_section_contents): Adjust parameter list and
2813         return type.
2814         (Object::do_decompressed_section_contents): Call do_section_contents
2815         directly.
2816         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2817         return type.
2818         * options.h (class General_options): Add --gdb-index option.
2819         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2820         list and return type.
2821         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2822         * reloc.h (Track_relocs::checkpoint): New function.
2823         (Track_relocs::reset): New function.
2824
2825         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2826         New test cases.
2827         * testsuite/Makefile.in: Regenerate.
2828         * testsuite/gdb_index_test.cc: New test source file.
2829         * testsuite/gdb_index_test_1.sh: New test source file.
2830         * testsuite/gdb_index_test_2.sh: New test source file.
2831
2832 2012-03-19  Doug Kwan  <dougkwan@google.com>
2833
2834         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2835         (Target_arm::do_finalize_sections): Remove code which defines
2836         __exidx_start and __exidx_end.  Make symbol table parameter
2837         anonymous as it is not used.
2838         * gold.cc (queue_middle_tasks): Call target hook to define any
2839         target-specific symbols.
2840         * target.h (Target::define_standard_symbols): New method.
2841         (Target::do_define_standard_symbols): Same.
2842         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2843         * testsuite/Makefile.in: Regenerate.
2844         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2845         and __exidx_end.
2846         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2847         relocations are generated for __exidx_start and __exidx_end.
2848
2849 2012-03-16  Doug Kwan  <dougkwan@google.com>
2850
2851         * testsuite/Makefile.am: Disable test initpri3b.
2852         * testsuite/Makefile.in: Regenerate.
2853
2854 2012-03-15  Doug Kwan  <dougkwan@google.com>
2855
2856         * arm.cc (Target_arm::got_section): Make .got section read-only
2857         if -z now is given.
2858
2859 2012-03-15  Ian Lance Taylor  <iant@google.com>
2860
2861         PR gold/13850
2862         * layout.cc (Layout::make_output_section): Correctly mark
2863         SHT_INIT_ARRAY, et. al., as relro.
2864
2865 2012-03-14  Doug Kwan  <dougkwan@google.com>
2866
2867         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2868         dynamic relocations for protected symbols in shared objects.
2869
2870 2012-03-13  Ian Lance Taylor  <iant@google.com>
2871
2872         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2873         keep the larger alignment.
2874
2875 2012-03-12  Cary Coutant  <ccoutant@google.com>
2876
2877         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2878         handling of DW_LNE_define_file.
2879
2880 2012-03-12  Cary Coutant  <ccoutant@google.com>
2881
2882         * reduced_debug_output.cc
2883         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2884         codes to switch.
2885
2886 2012-02-29  Cary Coutant  <ccoutant@google.com>
2887
2888         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2889
2890 2012-02-29  Cary Coutant  <ccoutant@google.com>
2891
2892         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2893         Call Object::decompressed_section_contents.
2894         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2895         New dtor.
2896         (Sized_dwarf_line_info::buffer_start_): New data member.
2897         * merge.cc (Output_merge_data::do_add_input_section): Call
2898         Object::decompressed_section_contents.
2899         (Output_merge_string::do_add_input_section): Likewise.
2900         * object.cc (need_decompressed_section): New function.
2901         (build_compressed_section_map): Decompress sections needed later.
2902         (Sized_relobj_file::do_decompressed_section_contents): New function.
2903         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2904         * object.h (Object::decompressed_section_contents): New function.
2905         (Object::discard_decompressed_sections): New function.
2906         (Object::do_decompressed_section_contents): New function.
2907         (Object::do_discard_decompressed_sections): New function.
2908         (Compressed_section_info): New type.
2909         (Compressed_section_map): Include decompressed section contents.
2910         (Sized_relobj_file::do_decompressed_section_contents): New function.
2911         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2912
2913 2012-02-16  Cary Coutant  <ccoutant@google.com>
2914
2915         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2916         * testsuite/Makefile.in: Regenerate.
2917
2918 2012-02-14  Cary Coutant  <ccoutant@google.com>
2919
2920         * options.cc (General_options::finalize): Disallow -pie and -static.
2921
2922 2012-02-03  Doug Kwan  <dougkwan@google.com>
2923
2924         * arm.cc (Arm_relocate_functions::abs8,
2925         Arm_relocate_functions::abs16): Use
2926         Bits::has_signed_unsigned_overflow32.
2927         (Arm_relocate_functions::thm_abs8): Correct range of
2928         overflow check.
2929         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2930         in assertions.
2931
2932 2012-02-02  Doug Kwan  <dougkwan@google.com>
2933
2934         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2935         position independent outputs, not just shared objects.
2936
2937 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2938
2939         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2940         * configure: Regenerated.
2941
2942 2012-01-27  Ian Lance Taylor  <iant@google.com>
2943
2944         * reloc.h (Bits): New class with static functions, copied from
2945         namespace utils in arm.cc.
2946         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2947         instead.
2948
2949 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2950
2951         * incremental.cc (write_info_blocks): Correct relocation offset.
2952
2953 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2954
2955         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2956         (Relocate::tls_gd_to_le): Likewise.
2957
2958 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2959
2960         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2961
2962 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2963
2964         * configure.ac: Check if -mcmodel=medium works.
2965         * configure: Regenerated.
2966
2967 2012-01-24  Cary Coutant  <ccoutant@google.com>
2968
2969         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2970         definition and ...
2971         (read_unsigned_LEB_128_x): ... this new function.
2972         (read_signed_LEB_128): Replaced with inline definition and ...
2973         (read_signed_LEB_128_x): ... this new function.
2974         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2975         (read_unsigned_LEB_128): Add inline definition.
2976         (read_signed_LEB_128_x): New function.
2977         (read_signed_LEB_128): Add inline definition.
2978         * testsuite/Makefile.am (leb128_unittest): New unit test.
2979         * testsuite/Makefile.in: Regenerate.
2980         * testsuite/leb128_unittest.cc: New unit test.
2981
2982 2012-01-23  Ian Lance Taylor  <iant@google.com>
2983
2984         PR gold/13617
2985         * i386.cc (Target_i386::do_code_fill): When using a jmp
2986         instruction, pad with nop instructions.
2987         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
2988
2989 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
2990
2991         * x86_64.cc (gc_process_relocs): Add typename on types used in
2992         template.
2993         (scan_relocs): Likewise.
2994         (relocate_section): Likewise.
2995         (apply_relocation): Likewise.
2996
2997 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
2998
2999         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3000         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3001         under x32.
3002
3003 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3004
3005         * x86_64.cc: Initial support for x32.
3006
3007 2012-01-03  Cary Coutant  <ccoutant@google.com>
3008
3009         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3010         Use abstract base class for GOT.
3011         * gold/output.h (class Output_data_got_base): New abstract base class.
3012         (class Output_data_got): Derive from new base class, adjust ctors.
3013         (Output_data_got::reserve_slot): Make virtual; rename to
3014         do_reserve_slot; Adjust callers.
3015         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3016         pointer to abstract base class.
3017         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3018
3019 2011-12-18  Ian Lance Taylor  <iant@google.com>
3020
3021         * object.h (Relobj::local_symbol_value): New function.
3022         (Relobj::local_plt_offset): New function.
3023         (Relobj::local_has_got_offset): New function.
3024         (Relobj::local_got_offset): New function.
3025         (Relobj::set_local_got_offset): New function.
3026         (Relobj::do_local_symbol_value): New pure virtual function.
3027         (Relobj::do_local_plt_offset): Likewise.
3028         (Relobj::do_local_has_got_offset): Likewise.
3029         (Relobj::do_local_got_offset): Likewise.
3030         (Relobj::do_set_local_got_offset): Likewise.
3031         (Sized_relobj::do_local_has_got_offset): Rename from
3032         local_has_got_offset.
3033         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3034         (Sized_relobj::do_set_local_got_offset): Rename from
3035         set_local_got_offset.
3036         (Sized_relobj_file::do_local_plt_offset): Rename from
3037         local_plt_offset.
3038         (Sized_relobj_file::do_local_symbol_value): New function.
3039         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3040         local_plt_offset.
3041         * output.cc (Output_data_got::Got_entry::write): Change object to
3042         Relobj.  Use local_symbol_value.
3043         (Output_data_got::add_global_with_rel): Change rel_dyn to
3044         Output_data_reloc_generic*.  Use add_global_generic.
3045         (Output_data_got::add_global_with_rela): Remove.  Change all
3046         callers to use add_global_with_rel.
3047         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3048         Output_data_reloc_generic*.  Use add_global_generic.
3049         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3050         callers to use add_global_pair_with_rel.
3051         (Output_data_got::add_local): Change object to Relobj*.
3052         (Output_data_got::add_local_plt): Likewise.
3053         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3054         change rel_dyn to Output_data_reloc_generic*.  Use
3055         add_local_generic.
3056         (Output_data_got::add_local_with_rela): Remove.  Change all
3057         callers to use all_local_with_rel.
3058         (Output_data_got::add_local_pair_with_rel): Change object to
3059         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3060         add_output_section_generic.
3061         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3062         callers to use add_local_pair_with_rel.
3063         (Output_data_got::reserve_local): Change object to Relobj*.
3064         * output.h: (class Output_data_reloc_generic): Add pure virtual
3065         declarations for add_global_generic, add_local_generic,
3066         add_output_section_generic.
3067         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3068         functions for Output_data_reloc_generic.  Update declarations for
3069         changes listed in output.cc.
3070         (class Output_data_got): Change template parameter to got_size.
3071         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3072         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3073         function.
3074         (Sized_relobj_incr::do_local_plt_offset): New function.
3075         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3076         add_global_generic.
3077
3078 2011-12-17  Cary Coutant  <ccoutant@google.com>
3079
3080         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3081         * resolve.cc (Symbol_table::resolve): Likewise.
3082         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3083         arrays.
3084         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3085
3086 2011-12-16  Ian Lance Taylor  <iant@google.com>
3087
3088         * output.h (Output_data_reloc_generic::add): Only call
3089         add_dynamic_reloc if this is a dynamic reloc section.
3090
3091 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3092
3093         PR gold/13505
3094         * target-reloc.h (apply_relocation): Replace <64, false> with
3095         <size, big_endian>.
3096
3097 2011-11-25  Nick Clifton  <nickc@redhat.com>
3098
3099         * po/it.po: New Italian translation.
3100
3101 2011-11-17  Sterling Augustine  <saugustine@google.com>
3102
3103         * script.cc (script_include_directive): Implement.
3104         (read_script_file): New local variables name and search_path. Update
3105         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3106         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3107         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3108
3109 2011-11-11  Sterling Augustine  <saugustine@google.com>
3110
3111         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3112         (file_or_sections_cmd): Likewise.
3113
3114 2011-11-11  Doug Kwan  <dougkwan@google.com>
3115
3116         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3117         if --just-symbols is given.
3118
3119 2011-11-10  Doug Kwan  <dougkwan@google.com>
3120
3121         PR gold/13362
3122         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3123         when processing data relocs.
3124         * reloc.h (Relocate_functions::rel_unaligned): New method.
3125         (Relocate_functions::pcrel_unaligned): Ditto.
3126         (Relocate_functions::rel32_unaligned): Ditto.
3127         (Relocate_functions::pcrel32_unaligned): Ditto.
3128
3129 2011-11-09  Doug Kwan  <dougkwan@google.com>
3130
3131         PR gold/13362
3132         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3133         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3134         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3135         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3136         (Relocate_functions::rel_unaligned): New.
3137         (Relocate_functions::rel32_unaligned): New.
3138         * target-reloc.h (relocate_for_relocatable): Add code to handle
3139         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3140         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3141         arm_unaligned_reloc_r): New targets.
3142         * testsuite/Makefile.in: Regenerate.
3143         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3144         linking.
3145
3146 2011-11-02  Ian Lance Taylor  <iant@google.com>
3147
3148         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3149         NATIVE_LINKER.
3150         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3151         * options.cc (General_options::finalize): Use library search path
3152         from configure script if specified.  If not native and no sysroot,
3153         only search TOOLLIBDIR.
3154         * options.h (Search_directory::Search_directory): Change name to
3155         const std::string&.
3156         (General_options::add_to_library_path_with_sysroot): Change arg to
3157         const std::string&.
3158         * configure, Makefile.in, config.in: Rebuild.
3159
3160 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3161
3162         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3163         we are working around the ARM1176 Erratum.
3164         * options.h (General_options::fix_arm1176): Add option.
3165         * testsuite/Makefile.am: Add testcases, and keep current ones
3166         working.
3167         * testsuite/Makefile.in: Regenerate.
3168         * testsuite/arm_fix_1176.s: New file.
3169         * testsuite/arm_fix_1176.sh: Likewise.
3170
3171 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3172
3173         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3174         may_use_blx_.
3175         (Target_arm::may_use_blx): Remove method.
3176         (Target_arm::set_may_use_blx): Likewise.
3177         (Target_arm::may_use_v4t_interworking): New method.
3178         (Target_arm::may_use_v5t_interworking): Likewise.
3179         (Target_arm::may_use_blx_): Remove member variable.
3180         (Arm_relocate_functions::arm_branch_common): Check for v5T
3181         interworking.
3182         (Arm_relocate_functions::thumb_branch_common): Likewise.
3183         (Reloc_stub::stub_type_for_reloc): Likewise.
3184         (Target_arm::do_finalize_sections): Correct interworking checks.
3185         * testsuite/Makefile.am: Add new tests.
3186         * testsuite/Makefile.in: Regenerate.
3187         * testsuite/arm_farcall_arm_arm.s: New test.
3188         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3189         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3190         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3191         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3192         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3193         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3194         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3195
3196 2011-10-31  Cary Coutant  <ccoutant@google.com>
3197
3198         PR gold/13023
3199         * expression.cc (Expression::eval_with_dot): Add
3200         is_section_dot_assignment parameter.
3201         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3202         absolute and assigning to dot within a section.
3203         * script-sections.cc
3204         (Output_section_element_assignment::set_section_addresses): Pass
3205         dot_section to set_if_absolute.
3206         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3207         as is_section_dot_assignment flag to eval_with_dot.
3208         (Output_section_element_dot_assignment::set_section_addresses):
3209         Likewise.
3210         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3211         parameter.  Also set value if relative to dot_section; set the
3212         symbol's output_section.
3213         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3214         parameter.  Adjust all callers.
3215         (Expression::eval_maybe_dot): Likewise.
3216         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3217         Adjust all callers.
3218         * testsuite/script_test_2.t: Test assignment of an absolute value
3219         to dot within an output section element.
3220
3221 2011-10-31  Cary Coutant  <ccoutant@google.com>
3222
3223         * options.h (class General_options): Add --[no-]gnu-unique options.
3224         * symtab.cc (Symbol_table::sized_write_globals): Convert
3225         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3226
3227 2011-10-31  Cary Coutant  <ccoutant@google.com>
3228
3229         PR gold/13359
3230         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3231         unnecessary assertion.
3232         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3233
3234 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3235
3236         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3237         gc_mark_symbol.
3238         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3239         gc_mark_symbol.
3240         Change to just keep the section associated with symbol.
3241         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3242         they are externally visible and --export-dynamic is turned on.
3243         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3244
3245 2011-10-19  Ian Lance Taylor  <iant@google.com>
3246
3247         PR gold/13163
3248         * script-sections.cc
3249         (Output_section_element_dot_assignment::needs_output_section): New
3250         function.
3251
3252 2011-10-19  Ian Lance Taylor  <iant@google.com>
3253
3254         PR gold/13204
3255         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3256         --section-start option was seen.
3257         * options.h (General_options::any_section_start): New function.
3258
3259 2011-10-18  David S. Miller  <davem@davemloft.net>
3260
3261         PR binutils/13301
3262         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3263         member to track relocation locations that have moved during TLS
3264         reloc optimizations.
3265         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3266         (Target_sparc::Relocate::relocate): Adjust view down by 4
3267         bytes if it matches reloc_adjust_addr_.
3268         (Target_sparc::Relocate::relocate_tls): Always move the
3269         __tls_get_addr call delay slot instruction forward 4 bytes when
3270         performing relaxation.
3271
3272 2011-10-18  Cary Coutant  <ccoutant@google.com>
3273
3274         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3275         (Output_file::map_no_anonymous): Check for non-zero
3276         return code from posix_fallocate.
3277
3278 2011-10-17  Cary Coutant  <ccoutant@google.com>
3279
3280         PR gold/13245
3281         * plugin.cc (is_visible_from_outside): Check for symbols
3282         referenced from dynamic objects.
3283         * resolve.cc (Symbol_table::resolve): Don't count references
3284         from dynamic objects as references from real ELF files.
3285         * testsuite/plugin_test_2.sh: Adjust expected result.
3286
3287 2011-10-17  Cary Coutant  <ccoutant@google.com>
3288
3289         * gold.cc: Include timer.h.
3290         (queue_middle_tasks): Stamp time.
3291         (queue_final_tasks): Likewise.
3292         * main.cc (main): Store timer in parameters.  Print timers
3293         for each pass.
3294         * parameters.cc (Parameters::Parameters): Initialize timer_.
3295         (Parameters::set_timer): New function.
3296         (set_parameters_timer): New function.
3297         * parameters.h (Parameters::set_timer): New function.
3298         (Parameters::timer): New function.
3299         (Parameters::timer_): New data member.
3300         (set_parameters_timer): New function.
3301         * timer.cc (Timer::stamp): New function.
3302         (Timer::get_pass_time): New function.
3303         * timer.h (Timer::stamp): New function.
3304         (Timer::get_pass_time): New function.
3305         (Timer::pass_times_): New data member.
3306
3307 2011-10-17  Cary Coutant  <ccoutant@google.com>
3308
3309         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3310         task for members of lib groups.
3311
3312 2011-10-17  Cary Coutant  <ccoutant@google.com>
3313
3314         PR gold/13288
3315         * fileread.cc (File_read::find_view): Add assert.
3316         (File_read::make_view): Move bounds check (replace with assert)...
3317         (File_read::find_or_make_view): ... to here.
3318
3319 2011-10-12  Cary Coutant  <ccoutant@google.com>
3320
3321         * output.cc (Output_file::open_base_file): Handle case where
3322         ::read returns less than requested size.
3323
3324 2011-10-10  Cary Coutant  <ccoutant@google.com>
3325
3326         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3327         Initialize defined_count_.
3328         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3329         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3330         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3331         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3332         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3333         * incremental.h (Sized_relobj_incr::defined_count_): New data
3334         member.
3335         (Sized_incr_dynobj::defined_count_): New data member.
3336         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3337         Return zeroes instead of internal error.
3338
3339 2011-10-10  Cary Coutant  <ccoutant@google.com>
3340
3341         PR gold/13249
3342         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3343         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3344         * output.h (class Output_reloc): Add use_plt_offset flag.
3345         (Output_reloc::type_): Adjust size of bit field.
3346         (Output_reloc::use_plt_offset_): New bit field.
3347         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3348         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3349         flag.  Adjust all callers.
3350         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3351         creating RELATIVE relocations.
3352
3353 2011-10-10  Nick Clifton  <nickc@redhat.com>
3354
3355         * po/es.po: Updated Spanish translation.
3356         * po/fi.po: Updated Finnish translation.
3357
3358 2011-10-03   Diego Novillo  <dnovillo@google.com>
3359
3360         * options.cc (parse_uint): Fix dereference of RETVAL.
3361
3362 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3363
3364         * layout.h (section_order_map_): New member.
3365         (get_section_order_map): New member function.
3366         * output.cc (Output_section::add_input_section): Check for patterns
3367         only when --section-ordering-file is specified.
3368         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3369         output_sections have been formed.
3370         * layout.cc (Layout_Layout): Initialize section_order_map_.
3371         * plugin.cc (update_section_order): Store order in order_map. Do not
3372         update the order.
3373         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3374         * testsuite/Makefile.in: Regenerate.
3375         * testsuite/plugin_section_order.c: New file.
3376         * testsuite/plugin_final_layout.cc: New file.
3377         * testsuite/plugin_final_layout.sh: New file.
3378
3379 2011-09-29  Cary Coutant  <ccoutant@google.com>
3380
3381         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3382         Check for NULL.
3383         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3384         symbols during incremental update.
3385         (Symbol_table::add_from_dynobj): Likewise.
3386
3387 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3388             Ian Lance Taylor  <iant@google.com>
3389
3390         * symtab.cc (Symbol_table::define_special_symbol): Always
3391         canonicalize version string.
3392
3393 2011-09-26  Cary Coutant  <ccoutant@google.com>
3394
3395         * gold.cc (queue_initial_tasks): Move option checks ...
3396         * options.cc (General_options::finalize): ... to here. Disable
3397         some options; make others fatal.
3398
3399 2011-09-26  Cary Coutant  <ccoutant@google.com>
3400
3401         gcc PR lto/47247
3402         * plugin.cc (get_symbols_v2): New function.
3403         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3404         (is_referenced_from_outside): New function.
3405         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3406         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3407         (get_symbols): Pass version parameter.
3408         (get_symbols_v2): New function.
3409         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3410         parameter.
3411         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3412         (onload): Add LDPT_GET_SYMBOLS_V2.
3413         (all_symbols_read_hook): Use get_symbols_v2; check for
3414         LDPR_PREVAILING_DEF_IRONLY_EXP.
3415         * testsuite/plugin_test_3.sh: Update expected results.
3416
3417 2011-09-23  Simon Baldwin  <simonb@google.com>
3418
3419         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3420         configuration options.
3421         * configure: Regenerate.
3422         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3423         * Makefile.in: Regenerate.
3424         * testsuite/Makefile.in: Regenerate.
3425
3426 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3427
3428         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3429
3430 2011-09-19  Cary Coutant  <ccoutant@google.com>
3431
3432         * incremental.cc (can_incremental_update): Fix typo in comment.
3433         * incremental.h (can_incremental_update): Likewise.
3434
3435 2011-09-18  Cary Coutant  <ccoutant@google.com>
3436
3437         * incremental.cc (can_incremental_update): New function.
3438         * incremental.h (can_incremental_update): New function.
3439         * layout.cc (Layout::init_fixed_output_section): Call it.
3440         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3441         * object.cc (Sized_relobj_file::do_layout): Call
3442         can_incremental_update.
3443
3444 2011-09-13  Cary Coutant  <ccoutant@google.com>
3445
3446         * configure.ac: Check for glibc support for gnu_indirect_function
3447         support with static linking, setting automake conditional
3448         IFUNC_STATIC.
3449         * Makefile.in: Regenerate.
3450         * configure: Regenerate.
3451
3452         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3453         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3454         for IFUNC_STATIC.
3455         * testsuite/Makefile.in: Regenerate.
3456
3457 2011-09-13  Cary Coutant  <ccoutant@google.com>
3458
3459         * incremental.cc (Sized_relobj_incr::do_layout): Call
3460         report_comdat_group for kept comdat sections.
3461         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3462         * testsuite/Makefile.in: Regenerate.
3463         * testsuite/incr_comdat_test_1.cc: New source file.
3464         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3465         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3466         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3467
3468 2011-09-13  Ian Lance Taylor  <iant@google.com>
3469
3470         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3471         variable external_symbols_offset.
3472
3473 2011-09-12  Ian Lance Taylor  <iant@google.com>
3474
3475         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3476         triggered if object has no symbols.
3477
3478 2011-09-09  David S. Miller  <davem@davemloft.net>
3479
3480         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3481         (Output_fill_debug_line::do_write): Likewise.
3482
3483 2011-08-29  Cary Coutant  <ccoutant@google.com>
3484
3485         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3486         casts to match formatting specs.
3487         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3488
3489 2011-08-26  Cary Coutant  <ccoutant@google.com>
3490
3491         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3492         remaining hole size when allocating.
3493         (Layout::make_output_section): Set fill methods for debug sections.
3494         * layout.h (Free_list::Free_list_node): Move from private to
3495         public.
3496         (Free_list::set_min_hole_size): New function.
3497         (Free_list::begin, Free_list::end): New functions.
3498         (Free_list::min_hole_): New data member.
3499         * output.cc: Include dwarf.h.
3500         (Output_fill_debug_info::do_minimum_hole_size): New function.
3501         (Output_fill_debug_info::do_write): New function.
3502         (Output_fill_debug_line::do_minimum_hole_size): New function.
3503         (Output_fill_debug_line::do_write): New function.
3504         (Output_section::Output_section): Initialize new data member.
3505         (Output_section::set_final_data_size): Ensure patch space is larger
3506         than minimum hole size.
3507         (Output_section::do_write): Fill holes in debug sections.
3508         * output.h (Output_fill): New class.
3509         (Output_fill_debug_info): New class.
3510         (Output_fill_debug_line): New class.
3511         (Output_section::set_free_space_fill): New function.
3512         (Output_section::free_space_fill_): New data member.
3513         * testsuite/Makefile.am (incremental_test_3): Add
3514         --incremental-patch option.
3515         (incremental_test_4): Likewise.
3516         (incremental_test_5): Likewise.
3517         (incremental_test_6): Likewise.
3518         (incremental_copy_test): Likewise.
3519         (incremental_common_test_1): Likewise.
3520         * testsuite/Makefile.in: Regenerate.
3521
3522 2011-08-26  Nick Clifton  <nickc@redhat.com>
3523
3524         * po/es.po: Updated Spanish translation.
3525
3526 2011-08-01  Cary Coutant  <ccoutant@google.com>
3527
3528         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3529         * gold/testsuite/Makefile.in: Regenerate.
3530         * gold/testsuite/justsyms_exec.c: New source file.
3531         * gold/testsuite/justsyms_lib.c: New source file.
3532
3533 2011-08-01  Cary Coutant  <ccoutant@google.com>
3534
3535         * layout.cc (Layout::set_segment_offsets): Don't realign text
3536         segment if -Ttext was specified.
3537         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3538         file type.
3539         * object.h (Sized_relobj_file::e_type): New function.
3540         (Sized_relobj_file::e_type_): New data member.
3541         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3542         base address for ET_EXEC files.
3543         * target.cc (Target::do_make_elf_object_implementation): Allow
3544         ET_EXEC files with --just-symbols option.
3545
3546 2011-07-28  Cary Coutant  <ccoutant@google.com>
3547
3548         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3549         Add thread_number parameter.
3550         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3551         * workqueue-threads.cc
3552         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3553         current thread if its thread number is greater than desired thread
3554         count.
3555         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3556         Add thread_number parameter.
3557         (Workqueue::should_cancel_thread): Likewise.
3558         (Workqueue::find_runnable_or_wait): Pass thread_number to
3559         should_cancel_thread.
3560         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3561         parameter.
3562
3563 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3564
3565         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3566         only after checking if it cannot be forced local.
3567         * symtab.h (is_externally_visible): Check if the symbol is not forced
3568         local.
3569
3570 2011-07-15  Ian Lance Taylor  <iant@google.com>
3571
3572         * options.h (class General_options): Add --print-output-format.
3573         Move -EL next to -EB, for  better --help output.
3574         * target-select.cc: Include <cstdio>, "options.h", and
3575         "parameters.h".
3576         (Target_selector::do_target_bfd_name): New function.
3577         (print_output_format): New function.
3578         * target-select.h (class Target_selector): Update declarations.
3579         (Target_selector::target_bfd_name): New function.
3580         (print_output_format): Declare.
3581         * main.cc: Include "target-select.h".
3582         (main): Handle --print-output-format.
3583         * gold.cc: Include "target-select.h".
3584         (queue_initial_tasks): Handle --print-output-format when there are
3585         no input files.
3586         * parameters.cc (parameters_force_valid_target): Give a better
3587         error message if -EB/-EL does not match target.
3588         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3589         function.
3590
3591 2011-07-15  Ian Lance Taylor  <iant@google.com>
3592
3593         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3594         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3595         (Output_data_plt_i386::do_write): Write address of .dynamic
3596         section to first entry in .got.plt section.
3597         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3598         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3599         Initialize layout_.
3600         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3601         section to first entry in .got.plt section.
3602         * layout.h (Layout::dynamic_section): New function.
3603
3604 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3605
3606         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3607         to claim_file call.
3608         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3609         input_section_position_, and input_section_glob_.
3610         (read_layout_from_file): Call function section_ordering_specified.
3611         * layout.h (is_section_ordering_specified): New function.
3612         (section_ordering_specified): New function.
3613         (section_ordering_specified_): New boolean member.
3614         * main.cc(main): Call load_plugins after layout object is defined.
3615         * output.cc (Output_section::add_input_section): Use
3616         function section_ordering_specified to check if section ordering is
3617         needed.
3618         * output.cc (Output_section::add_relaxed_input_section): Use
3619         function section_ordering_specified to check if section ordering is
3620         needed.
3621         (Output_section::update_section_layout): New function.
3622         (Output_section::sort_attached_input_sections): Check if input section
3623         must be reordered.
3624         * output.h (Output_section::update_section_layout): New function.
3625         * plugin.cc (get_section_count): New function.
3626         (get_section_type): New function.
3627         (get_section_name): New function.
3628         (get_section_contents): New function.
3629         (update_section_order): New function.
3630         (allow_section_ordering): New function.
3631         (Plugin::load): Add the new interfaces to the transfer vector.
3632         (Plugin_manager::load_plugins): New parameter.
3633         (Plugin_manager::all_symbols_read): New parameter.
3634         (Plugin_manager::claim_file): New parameter. Save the elf object for
3635         unclaimed objects.
3636         (Plugin_manager::get_elf_object): New function.
3637         (Plugin_manager::get_view): Change to directly use the bool to check
3638         if get_view is called from claim_file_hook.
3639         * plugin.h (input_objects): New function
3640         (Plugin__manager::load_plugins): New parameter.
3641         (Plugin_manager::claim_file): New parameter.
3642         (Plugin_manager::get_elf_object): New function.
3643         (Plugin_manager::in_claim_file_handler): New function.
3644         (Plugin_manager::in_claim_file_handler_): New member.
3645         (layout): New function.
3646         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3647         handler with an extra parameter. Make the elf object before calling
3648         claim_file handler.
3649         * testsuite/plugin_test.c (get_section_count): New function pointer.
3650         (get_section_type): New function pointer.
3651         (get_section_name): New function pointer.
3652         (get_section_contents): New function pointer.
3653         (update_section_order): New function pointer.
3654         (allow_section_ordering): New function pointer.
3655         (onload): Check if the new interfaces exist.
3656
3657 2011-07-13  Ian Lance Taylor  <iant@google.com>
3658
3659         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3660         relro section.
3661         * x86_64.cc (Target_x86_64::got_section): Likewise.
3662         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3663         (relro_now_test_SOURCES): New variable.
3664         (relro_now_test_DEPENDENCIES): New variable.
3665         (relro_now_test_LDFLAGS): New variable.
3666         (relro_now_test_LDADD): New variable.
3667         (relro_now_test.so): New target.
3668         * testsuite/Makefile.in: Rebuild.
3669
3670 2011-07-12  Ian Lance Taylor  <iant@google.com>
3671
3672         PR gold/12980
3673         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3674         GLOB_DAT relocation rather than a RELATIVE relocation for a
3675         protected symbol when creating a shared library.
3676         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3677         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3678         * testsuite/protected_main_1.cc (main): Test that protected
3679         function has same address.
3680
3681 2011-07-11  Ian Lance Taylor  <iant@google.com>
3682
3683         PR gold/12979
3684         * options.h (class General_options): Add -Bgroup.
3685         * options.cc (General_options::finalize): If -Bgroup is set,
3686         default to --unresolved-symbols=report-all.
3687         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3688         * target-reloc.h (issue_undefined_symbol_error): Handle
3689         --unresolved-symbols=report-all.
3690
3691 2011-07-08  Ian Lance Taylor  <iant@google.com>
3692
3693         PR gold/11985
3694         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3695         if linker script discards key sections.
3696         (Layout::create_dynamic_symtab): Likewise.
3697         (Layout::assign_local_dynsym_offsets): Likewise.
3698         (Layout::sized_create_version_sections): Likewise.
3699         (Layout::create_interp): Likewise.
3700         (Layout::finish_dynamic_section): Likewise.
3701         (Layout::set_dynamic_symbol_size): Likewise.
3702
3703 2011-07-08  Ian Lance Taylor  <iant@google.com>
3704
3705         PR gold/12386
3706         * options.h (class General_options): Add --unresolved-symbols.
3707         * target-reloc.h (issue_undefined_symbol_error): Check
3708         --unresolved-symbols.  Add comments.
3709
3710 2011-07-08  Ian Lance Taylor  <iant@google.com>
3711
3712         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3713         expression more complex.
3714
3715 2011-07-08  Ian Lance Taylor  <iant@google.com>
3716
3717         PR gold/11317
3718         * target-reloc.h (issue_undefined_symbol_error): New inline
3719         function, broken out of relocate_section.
3720         (relocate_section): Call issue_undefined_symbol_error.
3721         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3722         there is no TLS segment if we are about to issue an undefined
3723         symbol error.
3724         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3725
3726 2011-07-08  Ian Lance Taylor  <iant@google.com>
3727
3728         PR gold/12279
3729         * resolve.cc (Symbol_table::should_override): Add fromtype
3730         parameter.  Change all callers.  Give error when linking together
3731         TLS and non-TLS symbol.
3732         (Symbol_table::should_override_with_special): Add fromtype
3733         parameter.  Change all callers.
3734         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3735         there is no TLS segment if we have reported some errors.
3736         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3737
3738 2011-07-08  Ian Lance Taylor  <iant@google.com>
3739
3740         PR gold/12372
3741         * target.h (Target::plt_address_for_global): New function.
3742         (Target::plt_address_for_local): New function.
3743         (Target::plt_section_for_global): Remove.
3744         (Target::plt_section_for_local): Remove.
3745         (Target::do_plt_address_for_global): New virtual function.
3746         (Target::do_plt_address_for_local): New virtual function.
3747         (Target::do_plt_section_for_global): Remove.
3748         (Target::do_plt_section_for_local): Remove.
3749         (Target::register_global_plt_entry): Add Symbol_table and Layout
3750         parameters.
3751         * output.cc (Output_data_got::Got_entry::write): Use
3752         plt_address_for_global and plt_address_for_local.
3753         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3754         address of output section.
3755         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3756         got_irelative_, and irelative_count_ fields.  Update
3757         declarations.
3758         (Output_data_plt_i386::has_irelative_section): New function.
3759         (Output_data_plt_i386::entry_count): Add irelative_count_.
3760         (Output_data_plt_i386::set_final_data_size): Likewise.
3761         (class Target_i386): Add got_irelative_ and rel_irelative_
3762         fields.  Update declarations.
3763         (Target_i386::Target_i386): Initialize new fields.
3764         (Target_i386::do_plt_address_for_global): New function replacing
3765         do_plt_section_for_global.
3766         (Target_i386::do_plt_address_for_local): New function replacing
3767         do_plt_section_for_local.
3768         (Target_i386::got_section): Create got_irelative_.
3769         (Target_i386::rel_irelative_section): New function.
3770         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3771         fields.  Don't define __rel_iplt_{start,end}.
3772         (Output_data_plt_i386::add_entry): Add symtab and layout
3773         parameters.  Change all callers.  Use different PLT and GOT for
3774         IFUNC symbols.
3775         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3776         layout parameters.  Change all callers.  Use different PLT and
3777         GOT.
3778         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3779         (Output_data_plt_i386::rel_irelative): New function.
3780         (Output_data_plt_i386::address_for_global): New function.
3781         (Output_data_plt_i386::address_for_local): New function.
3782         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3783         IRELATIVE GOT when changing IFUNC GOT entries.
3784         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3785         reloc.
3786         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3787         if we didn't create an IRELATIVE GOT.
3788         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3789         plt_address_for_local.
3790         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3791         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3792         got_irelative_, and irelative_count_ fields.  Update
3793         declarations.
3794         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3795         Initialize new fields.  Remove symtab parameter.  Change all
3796         callers.
3797         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3798         irelative_count_.
3799         (Output_data_plt_x86_64::has_irelative_section): New function.
3800         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3801         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3802         fields.  Update declarations.
3803         (Target_x86_64::Target_x86_64): Initialize new fields.
3804         (Target_x86_64::do_plt_address_for_global): New function replacing
3805         do_plt_section_for_global.
3806         (Target_x86_64::do_plt_address_for_local): New function replacing
3807         do_plt_section_for_local.
3808         (Target_x86_64::got_section): Create got_irelative_.
3809         (Target_x86_64::rela_irelative_section): New function.
3810         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3811         all callers.  Don't create __rel_iplt_{start,end}.
3812         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3813         parameters.  Change all callers.  Use different PLT and GOT for
3814         IFUNC symbols.
3815         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3816         layout parameters.  Change all callers.  Use different PLT and
3817         GOT.
3818         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3819         parameters.  Change all callers.  Use different PLT and GOT for
3820         IFUNC symbols.
3821         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3822         (Output_data_plt_x86_64::rela_irelative): New function.
3823         (Output_data_plt_x86_64::address_for_global): New function.
3824         (Output_data_plt_x86_64::address_for_local): New function.
3825         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3826         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3827         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3828         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3829         parameters.
3830         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3831         reloc.
3832         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3833         symbols if we didn't create an IRELATIVE GOT.
3834         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3835         plt_address_for_local.
3836         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3837         * testsuite/ifuncvar1.c: New test file.
3838         * testsuite/ifuncvar2.c: New test file.
3839         * testsuite/ifuncvar3.c: New test file.
3840         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3841         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3842         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3843         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3844         * testsuite/Makefile.in: Rebuild.
3845
3846 2011-07-07  Cary Coutant  <ccoutant@google.com>
3847
3848         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3849         (two_file_test_1_ndebug.o): Likewise.
3850         (two_file_test_1b_ndebug.o): Likewise.
3851         (two_file_test_2_ndebug.o): Likewise.
3852         (two_file_test_main_ndebug.o): Likewise.
3853         (incremental_test_2): Link with no-debug versions.
3854
3855 2011-07-06  Cary Coutant  <ccoutant@google.com>
3856
3857         * gold/incremental.cc
3858         (Output_section_incremental_inputs::write_info_blocks): Check for
3859         hidden and internal symbols.
3860
3861 2011-07-06  Cary Coutant  <ccoutant@google.com>
3862
3863         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3864         Check disposition for startup file.
3865         (Incremental_inputs::report_command_line): Ignore
3866         --incremental-startup-unchanged option.
3867         * options.cc (General_options::parse_incremental_startup_unchanged):
3868         New function.
3869         (General_options::General_options): Initialize new data member.
3870         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3871         (General_options): Add --incremental-startup-unchanged option.
3872         (General_options::incremental_startup_disposition): New function.
3873         (General_options::incremental_startup_disposition_): New data member.
3874
3875 2011-07-06  Cary Coutant  <ccoutant@google.com>
3876
3877         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3878         input file index to Script_info ctor.
3879         (Sized_incremental_binary::do_file_has_changed): Find the
3880         command-line argument for files named in scripts.
3881         * incremental.h (Script_info::Script_info): New ctor
3882         with input file index.
3883         (Script_info::input_file_index): New function.
3884         (Script_info::input_file_index_): New data member.
3885         (Incremental_binary::get_library): Add const.
3886         (Incremental_binary::get_script_info): Add const.
3887         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3888         * testsuite/Makefile.am (incremental_test_5): New test case.
3889         (incremental_test_6): New test case.
3890         * testsuite/Makefile.in: Regenerate.
3891
3892 2011-07-06  Cary Coutant  <ccoutant@google.com>
3893
3894         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3895         debug output when command lines differ.
3896
3897 2011-07-06  Cary Coutant  <ccoutant@google.com>
3898
3899         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3900         --incremental-patch option.
3901         * layout.cc (Free_list::allocate): Extend allocation beyond original
3902         end if enabled.
3903         (Layout::make_output_section): Mark sections that should get
3904         patch space.
3905         * options.cc (parse_percent): New function.
3906         * options.h (parse_percent): New function.
3907         (DEFINE_percent): New macro.
3908         (General_options): Add --incremental-patch option.
3909         * output.cc (Output_section::Output_section): Initialize new data
3910         members.
3911         (Output_section::add_input_section): Print section name when out
3912         of patch space.
3913         (Output_section::add_output_section_data): Likewise.
3914         (Output_section::set_final_data_size): Add patch space when
3915         doing --incremental-full.
3916         (Output_section::do_reset_address_and_file_offset): Remove patch
3917         space.
3918         (Output_segment::set_section_list_addresses): Print debug output
3919         only if --incremental-update.
3920         * output.h (Output_section::set_is_patch_space_allowed): New function.
3921         (Output_section::is_patch_space_allowed_): New data member.
3922         (Output_section::patch_space_): New data member.
3923         * parameters.cc (Parameters::incremental_full): New function.
3924         * parameters.h (Parameters::incremental_full): New function
3925         * testsuite/Makefile.am (incremental_test_2): Add test for
3926         --incremental-patch option.
3927         * testsuite/Makefile.in: Regenerate.
3928         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3929         (t18): Remove function body.
3930
3931 2011-07-05  Doug Kwan  <dougkwan@google.com>
3932
3933         PR gold/12771
3934         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3935         Arm_Address type for relocation result.
3936         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3937         overflow check.
3938         (Arm_relocate_functions::abs32): Use unaligned access.
3939         (Arm_relocate_functions::rel32): Ditto.
3940         (Arm_relocate_functions::prel31): Ditto.
3941         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3942         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3943         static data relocations.
3944         * testsuite/Makefile.in: Regnerate.
3945         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3946
3947 2011-07-05  Ian Lance Taylor  <iant@google.com>
3948
3949         PR gold/12392
3950         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3951         symbols if necessary.
3952         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3953
3954 2011-07-05  Ian Lance Taylor  <iant@google.com>
3955
3956         PR gold/12952
3957         * resolve.cc (Symbol::override_base_with_special): Simply override
3958         version with special symbol version, ignoring previous version.
3959
3960 2011-07-05  Ian Lance Taylor  <iant@google.com>
3961
3962         * object.cc (Sized_relobj_file::include_section_group): Add
3963         information to comment about signature location.
3964
3965 2011-07-02  Ian Lance Taylor  <iant@google.com>
3966
3967         PR gold/12957
3968         * options.h (class General_options): Add -f and -F.
3969         * options.cc (General_options::finalize): Fatal error if -f/-F
3970         are used without -shared.
3971         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3972
3973 2011-07-02  Ian Lance Taylor  <iant@google.com>
3974
3975         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3976
3977 2011-07-01  Ian Lance Taylor  <iant@google.com>
3978
3979         PR gold/12525
3980         PR gold/12952
3981         * resolve.cc (Symbol::override_base_with_special): Don't override
3982         the version if the overriding symbol has a different name.
3983         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3984         all callers.  If we give an error about an undefined version,
3985         define the base version if necessary.
3986         * dynobj.h (class Versions): Update declaration.
3987         * testsuite/weak_alias_test_5.cc: New file.
3988         * testsuite/weak_alias_test.script: New file.
3989         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
3990         and versioned_alias have the right value, and call t2.
3991         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
3992         weak_alias_test_5.so.
3993         (weak_alias_test_LDADD): Likewise.
3994         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
3995         * testsuite/Makefile.in: Rebuild.
3996
3997 2011-07-01  Ian Lance Taylor  <iant@google.com>
3998
3999         PR gold/12525
4000         * options.h (class General_options): Support -z notext.
4001         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4002         -Wl,-z,notext.
4003         (two_file_shared_nonpic.so): Likewise.
4004         (two_file_shared_mixed.so): Likewise.
4005         (two_file_shared_mixed_1.so): Likewise.
4006         (weak_undef_lib_nonpic.so): Likewise.
4007         (alt/weak_undef_lib_nonpic.so): Likewise.
4008         (tls_test_shared_nonpic.so): Likewise.
4009         * testsuite/Makefile.in: Rebuild.
4010
4011 2011-07-01  Ian Lance Taylor  <iant@google.com>
4012
4013         PR gold/12525
4014         * configure.ac: Test whether static linking works, setting
4015         the automake conditional HAVE_STATIC.
4016         * testsuite/Makefile.am: Disable tests using -static if
4017         HAVE_STATIC is not true.
4018         * configure, testsuite/Makefile.in: Rebuild.
4019
4020 2011-07-01  Ian Lance Taylor  <iant@google.com>
4021
4022         PR gold/12525
4023         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4024         Assert if we see DW_EH_PE_indirect.
4025         * target.h (Target::ehframe_datarel_base): New function.
4026         (Target::do_ehframe_datarel_base): New target function.
4027         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4028         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4029         function.
4030
4031 2011-07-01  Ian Lance Taylor  <iant@google.com>
4032
4033         PR gold/12571
4034         * options.h (class General_options): Add
4035         --ld-generated-unwind-info.
4036         * ehframe.cc (Fde::write): Add address parameter.  Change all
4037         callers.  If associated with PLT, fill in address and size.
4038         (Cie::set_output_offset): Only add merge mapping if there is an
4039         object.
4040         (Cie::write): Add address parameter.  Change all callers.
4041         (Eh_frame::add_ehframe_for_plt): New function.
4042         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4043         input_offset_ fields into union u_, with new plt field.
4044         (Fde::Fde): Adjust for new union field.
4045         (Fde::Fde) [Output_data version]: New constructor.
4046         (Fde::add_mapping): Only add merge mapping if there is an object.
4047         (class Cie): Update declarations.
4048         (class Eh_frame): Declare add_ehframe_for_plt.
4049         * layout.cc (Layout::layout_eh_frame): Break out code into
4050         make_eh_frame_section, and call it.
4051         (Layout::make_eh_frame_section): New function.
4052         (Layout::add_eh_frame_for_plt): New function.
4053         * layout.h (class Layout): Update declarations.
4054         * merge.cc (Merge_map::add_mapping): Add assertion.
4055         * i386.cc: Include "dwarf.h".
4056         (class Output_data_plt_i386): Make first_plt_entry,
4057         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4058         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4059         and plt_eh_frame_fde.
4060         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4061         boundary.  Call add_eh_frame_for_plt if appropriate.
4062         * x86_64.cc: Include "dwarf.h".
4063         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4064         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4065         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4066         and plt_eh_frame_fde.
4067         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4068         appropriate.
4069
4070 2011-06-29  Ian Lance Taylor  <iant@google.com>
4071
4072         PR gold/12629
4073         * object.cc (Sized_relobj_file::layout_section): Change shdr
4074         parameter to be const.
4075         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4076         out of do_layout.
4077         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4078         appropriate.  Call layout_eh_frame_section.
4079         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4080         sections.
4081         * object.h (class Sized_relobj_file): Update declarations.
4082
4083 2011-06-29  Ian Lance Taylor  <iant@google.com>
4084
4085         PR gold/12652
4086         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4087         modifier.
4088         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4089
4090 2011-06-29  Ian Lance Taylor  <iant@google.com>
4091
4092         PR gold/12675
4093         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4094         SHT_X86_64_UNWIND.
4095         * layout.cc (Layout::layout_eh_frame): Likewise.
4096
4097 2011-06-29  Ian Lance Taylor  <iant@google.com>
4098
4099         PR gold/12695
4100         * layout.cc (Layout::symtab_section_shndx): New function.
4101         * layout.h (class Layout): Declare symtab_section_shndx.
4102         * output.cc (Output_section::write_header): Call it.
4103
4104 2011-06-29  Ian Lance Taylor  <iant@google.com>
4105
4106         PR gold/12818
4107         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4108         symbols which are not used in a relocation.
4109
4110 2011-06-28  Ian Lance Taylor  <iant@google.com>
4111
4112         PR gold/12898
4113         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4114         script create indistinguishable segments.
4115         (Layout::set_segment_offsets): Use stable_sort when sorting
4116         segments.  Pass this to Compare_segments constructor.
4117         * layout.h (class Layout): Make segment_precedes non-static.
4118         (class Compare_segments): Change from struct to class.  Add
4119         layout_ field.  Add constructor.
4120         * script-sections.cc
4121         (Script_sections::attach_sections_using_phdrs_clause): Rename
4122         local orphan to is_orphan.  Don't report failure to put empty
4123         section in segment.  On attachment failure, report name of
4124         section, and attach to first PT_LOAD segment.
4125
4126 2011-06-28  Ian Lance Taylor  <iant@google.com>
4127
4128         PR gold/12934
4129         * target-select.cc (Target_selector::Target_selector): Add
4130         emulation parameter.  Change all callers.
4131         (select_target_by_bfd_name): Rename from select_target_by_name.
4132         Change all callers.
4133         (select_target_by_emulation): New function.
4134         (supported_emulation_names): New function.
4135         * target-select.h (class Target_selector): Add emulation_ field.
4136         Update declarations.
4137         (Target_selector::recognize_by_bfd_name): Rename from
4138         recognize_by_name.  Change all callers.
4139         (Target_selector::supported_bfd_names): Rename from
4140         supported_names.  Change all callers.
4141         (Target_selector::recognize_by_emulation): New function.
4142         (Target_selector::supported_emulations): New function.
4143         (Target_selector::emulation): New function.
4144         (Target_selector::do_recognize_by_bfd_name): Rename from
4145         do_recognize_by_name.  Change all callers.
4146         (Target_selector::do_supported_bfd_names): Rename from
4147         do_supported_names.  Change all callers.
4148         (Target_selector::do_recognize_by_emulation): New function.
4149         (Target_selector::do_supported_emulations): New function.
4150         (select_target_by_bfd_name): Change name in declaration.
4151         (select_target_by_emulation): Declare.
4152         (supported_emulation_names): Declare.
4153         * parameters.cc (parameters_force_valid_target): Try to find
4154         target based on emulation from -m option.
4155         * options.h (class General_options): Change doc string for -m.
4156         * options.cc (help): Print emulations.
4157         (General_options::parse_V): Likewise.
4158         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4159         Add emulation parameter.  Change all callers.
4160
4161 2011-06-28  Ian Lance Taylor  <iant@google.com>
4162
4163         * target.h (class Target): Add osabi_ field.
4164         (Target::osabi): New function.
4165         (Target::set_osabi): New function.
4166         (Target::Target): Initialize osabi_.
4167         (Target::do_adjust_elf_header): Make pure virtual.
4168         (Sized_target::do_adjust_elf_header): Declare.
4169         * target.cc (Sized_target::do_adjust_elf_header): New function.
4170         (class Sized_target): Instantiate all versions.
4171         * freebsd.h (class Target_freebsd): Remove.
4172         (Target_selector_freebsd::do_recognize): Call set_osabi on
4173         Target.
4174         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4175         (Target_selector_freebsd::set_osabi): Remove.
4176         * i386.cc (class Target_i386): Inherit from Sized_target rather
4177         than Target_freebsd.
4178         * x86_64.cc (class Target_x86_64): Likewise.
4179
4180 2011-06-28  Ian Lance Taylor  <iant@google.com>
4181
4182         * target.h (Target::can_check_for_function_pointers): Rewrite.
4183         Make non-virtual.
4184         (Target::can_icf_inline_merge_sections): Likewise.
4185         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4186         (Target::Target_info): Add can_icf_inline_merge_sections field.
4187         (Target::do_can_check_for_function_pointers): New virtual
4188         function.
4189         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4190         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4191         from can_check_for_function_pointers, move in file.
4192         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4193         section_may_have_icf_unsafe_poineters, move in file.
4194         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4195         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4196         Rename from can_check_for_function_pointers, move in file.
4197         (Target_i386::can_icf_inline_merge_sections): Remove.
4198         (Target_i386::i386_info): Initialize
4199         can_icf_inline_merge_sections.
4200         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4201         Initialize can_icf_inline_merge_sections.
4202         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4203         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4204         Rename from can_check_for_function_pointers, move in file.
4205         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4206         (Target_x86_64::x86_64_info): Initialize
4207         can_icf_inline_merge_sections.
4208         * testsuite/testfile.cc (Target_test::test_target_info):
4209         Likewise.
4210         * icf.cc (get_section_contents): Correct formatting.
4211
4212 2011-06-27  Ian Lance Taylor  <iant@google.com>
4213
4214         * symtab.cc (Symbol::versioned_name): New function.
4215         (Symbol_table::add_to_final_symtab): Use versioned_name when
4216         appropriate.
4217         (Symbol_table::sized_write_symbol): Likewise.
4218         * symtab.h (class Symbol): Declare versioned_name.
4219         * stringpool.h (class Stringpool_template): Add variant of add
4220         which takes a std::basic_string.
4221         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4222         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4223         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4224         (ver_test_12.o): New target.
4225         * testsuite/Makefile.in: Rebuild.
4226
4227 2011-06-27  Doug Kwan  <dougkwan@google.com>
4228
4229         * arm.cc (Arm_relocate_functions::thm_jump8,
4230         Arm_relocate_functions::thm_jump11): Use a wider signed
4231         type to compute offset.
4232         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4233         arm_thm_jump8.
4234         * testsuite/Makefile.in: Regenerate.
4235         * testsuite/arm_branch_in_range.sh: Check test results of
4236         arm_thm_jump11 and arm_thm_jump8.
4237         * testsuite/arm_thm_jump11.s: New test source file.
4238         * testsuite/arm_thm_jump11.t: New linker script.
4239         * testsuite/arm_thm_jump8.s: New test source file.
4240         * testsuite/arm_thm_jump8.t: New linker script.
4241
4242 2011-06-24  Ian Lance Taylor  <iant@google.com>
4243
4244         * layout.cc: Include "object.h".
4245         (ctors_sections_in_init_array): New static variable.
4246         (Layout::is_ctors_in_init_array): New function.
4247         (Layout::layout): Add entry to ctors_sections_in_init_array if
4248         appropriate.
4249         * layout.h (class Layout): Declare is_ctors_in_init_array.
4250         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4251         is_ctors_reverse_view is set.
4252         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4253         all callers.  Set is_ctors_reverse_view field of View_size.
4254         (Sized_relobj_file::reverse_words): New function.
4255         * object.h (Sized_relobj_file::View_size): Add
4256         is_ctors_reverse_view field.
4257         (class Sized_relobj_file): Update declarations.
4258         * testsuite/initpri3.c: New test.
4259         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4260         initpri3b.
4261         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4262         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4263         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4264         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4265         * testsuite/Makefile.in: Rebuild.
4266
4267 2011-06-24  Cary Coutant  <ccoutant@google.com>
4268
4269         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4270         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4271         (debug_msg_cdebug.err): New targets.
4272         * testsuite/Makefile.in: Regenerate.
4273         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4274         Fix checks for link with shared library.
4275
4276 2011-06-24  Doug Kwan  <dougkwan@google.com>
4277
4278         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4279         skip empty text sections.
4280         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4281
4282 2011-06-22  Ian Lance Taylor  <iant@google.com>
4283
4284         PR gold/12910
4285         * options.h (class General_options): Add --ctors-in-init-array.
4286         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4287         friends as SHT_PROGBITS for merging sections.
4288         (Layout::layout): Remove special handling of .init_array and
4289         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4290         and .dtors if ctors_in_init_array.
4291         (Layout::make_output_section): Force correct section types for
4292         .init_array and friends.  Don't sort if doing relocatable link,
4293         Don't sort .ctors and .dtors if ctors_in_init_array.
4294         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4295         (Layout::output_section_name): Add relobj parameter.  Change all
4296         callers.  Handle .ctors. and .dtors. in code rather than table.
4297         Handle .ctors and .dtors if ctors_in_init_array.
4298         (Layout::match_file_name): New function, moved from output.cc.
4299         * layout.h (class Layout): Update declarations.
4300         * output.cc: Include "layout.h".
4301         (Input_section_sort_entry::get_priority): New function.
4302         (Input_section_sort_entry::match_file_name): Just call
4303         Layout::match_file_name.
4304         (Output_section::Input_section_sort_init_fini_compare::operator()):
4305         Handle .ctors and .dtors.  Sort by explicit priority rather than
4306         by name.
4307         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4308         * testsuite/initpri2.c: New test.
4309         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4310         (check_PROGRAMS): Add initpri2.
4311         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4312         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4313         * configure, testsuite/Makefile.in: Rebuild.
4314
4315 2011-06-19  Ian Lance Taylor  <iant@google.com>
4316
4317         PR gold/12880
4318         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4319         .interp section to a PT_INTERP segment even if we have seen a
4320         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4321         clause in a linker script.
4322         (Layout::finalize): Don't create a .interp section if we've
4323         already create a PT_INTERP segment.
4324         (Layout::create_interp): Always call choose_output_section (revert
4325         patch of 2011-06-17).  Don't create PT_INTERP segment.
4326         * script-sections.cc
4327         (Script_sections::create_note_and_tls_segments): Add a .interp
4328         section to a PT_INTERP segment even if we have seen a
4329         --dynamic-linker option.
4330
4331 2011-06-18  Ian Lance Taylor  <iant@google.com>
4332
4333         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4334         merely because a non-PT_LOAD segment has a dynamic reloc.
4335
4336 2011-06-18  Ian Lance Taylor  <iant@google.com>
4337
4338         * layout.cc (Layout::finish_dynamic_section): Don't create
4339         DT_FLAGS entry if not needed.
4340
4341 2011-06-18  Ian Lance Taylor  <iant@google.com>
4342
4343         PR gold/12745
4344         * layout.cc (Layout::layout_eh_frame): Correct handling of
4345         writable .eh_frame section.
4346
4347 2011-06-17  Ian Lance Taylor  <iant@google.com>
4348
4349         PR gold/12893
4350         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4351         symbol is redefined with the exact same object and value.
4352
4353 2011-06-17  Ian Lance Taylor  <iant@google.com>
4354
4355         PR gold/12880
4356         * layout.h (class Layout): Add interp_segment_ field.
4357         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4358         (Layout::attach_allocated_section_to_segment): If making shared
4359         library, put .interp section in PT_INTERP segment.
4360         (Layout::finalize): Also call create_interp if -dynamic-linker
4361         option was used.
4362         (Layout::create_interp): Assert that there is no PT_INTERP
4363         segment.  If not using a SECTIONS clause, use make_output_section.
4364         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4365         * script-sections.cc
4366         (Script_sections::create_note_and_tls_segments): If making shared
4367         library, put .interp section in PT_INTERP segment.
4368
4369 2011-06-17  Ian Lance Taylor  <iant@google.com>
4370
4371         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4372         when making a shared library.
4373
4374 2011-06-17  Ian Lance Taylor  <iant@google.com>
4375
4376         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4377         parameter.  Change all callers.  Don't issue warning about PC32
4378         against locally defined symbol.
4379
4380 2011-06-16  Ian Lance Taylor  <iant@google.com>
4381
4382         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4383         occurs in same object.
4384
4385 2011-06-14  Alan Modra  <amodra@gmail.com>
4386
4387         * po/POTFILES.in: Regenerate.
4388
4389 2011-06-09  Ian Lance Taylor  <iant@google.com>
4390
4391         * script-sections.cc
4392         (Orphan_output_section::set_section_addresses): For a relocatable
4393         link set address to 0.
4394
4395 2011-06-09  Cary Coutant  <ccoutant@google.com>
4396
4397         PR gold/12804
4398         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4399         used with --compress-debug-sections.
4400         * gold/object.cc (Sized_relobj_file::do_layout): Report
4401         uncompressed size of compressed input sections.
4402
4403 2011-06-08  Cary Coutant  <ccoutant@google.com>
4404
4405         PR gold/12804
4406         * testsuite/two_file_test_2_v1.cc: Change initialization of
4407         v2 to keep it in .data.
4408
4409 2011-06-07  Cary Coutant  <ccoutant@google.com>
4410
4411         * common.cc (Symbol_table::do_allocate_commons_list): Call
4412         gold_fallback.
4413         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4414         (Errors::fallback): New function.
4415         (gold_fallback): New function.
4416         * errors.h (Errors::fallback): New function.
4417         * gold.cc (gold_exit): Change status parameter to enum; adjust
4418         all callers.
4419         (queue_initial_tasks): Call gold_fallback.
4420         * gold.h: Include cstdlib.
4421         (Exit_status): New enum type.
4422         (gold_exit): Change status parameter to enum.
4423         (gold_fallback): New function.
4424         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4425         (Layout::create_symtab_sections): Likewise.
4426         (Layout::create_shdrs): Likewise.
4427         * main.cc (main): Adjust call to gold_exit.
4428         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4429         (Output_data_got::add_got_entry_pair): Likewise.
4430         (Output_section::add_input_section): Likewise.
4431         (Output_section::add_output_section_data): Likewise.
4432         (Output_segment::set_section_list_addresses): Likewise.
4433         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4434
4435 2011-06-07  Cary Coutant  <ccoutant@google.com>
4436
4437         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4438         for incremental links.
4439         * output.cc (Output_segment::set_section_list_addresses): Remove
4440         FIXME and test for TLS or BSS.
4441
4442 2011-06-07  Cary Coutant  <ccoutant@google.com>
4443
4444         * testsuite/Makefile.am: Add incremental_copy_test,
4445         incremental_common_test_1.
4446         * testsuite/Makefile.in: Regenerate.
4447         * testsuite/common_test_1_v1.c: New source file.
4448         * testsuite/common_test_1_v2.c: New source file.
4449         * testsuite/copy_test_v1.cc: New source file.
4450
4451 2011-06-07  Cary Coutant  <ccoutant@google.com>
4452
4453         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4454         update, allocate common from bss section's free list.
4455         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4456         linker-defined symbols.
4457         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4458         Skip GOT and PLT entries that are no longer referenced.
4459         (Output_section_incremental_inputs::write_info_blocks): Mark
4460         linker-defined symbols.
4461         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4462         * output.cc (Output_section::allocate): New function.
4463         * output.h (Output_section::allocate): New function.
4464         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4465         linker-defined symbols.
4466         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4467         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4468         (Symbol::init_base_output_data): Likewise.
4469         (Symbol::init_base_output_segment): Likewise.
4470         (Symbol::init_base_constant): Likewise.
4471         (Sized_symbol::init_output_data): Likewise.
4472         (Sized_symbol::init_output_segment): Likewise.
4473         (Sized_symbol::init_constant): Likewise.
4474         (Symbol_table::do_define_in_output_data): Likewise.
4475         (Symbol_table::do_define_in_output_segment): Likewise.
4476         (Symbol_table::do_define_as_constant): Likewise.
4477         * symtab.h (Symbol::is_predefined): New function.
4478         (Symbol::init_base_output_data): Add is_predefined parameter.
4479         (Symbol::init_base_output_segment): Likewise.
4480         (Symbol::init_base_constant): Likewise.
4481         (Symbol::is_predefined_): New data member.
4482         (Sized_symbol::init_output_data): Add is_predefined parameter.
4483         (Sized_symbol::init_output_segment): Likewise.
4484         (Sized_symbol::init_constant): Likewise.
4485         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4486
4487 2011-06-07  Cary Coutant  <ccoutant@google.com>
4488
4489         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4490         instead of emit_copy_reloc.
4491         (Copy_relocs::emit_copy_reloc): Refactor.
4492         (Copy_relocs::make_copy_reloc): New function.
4493         (Copy_relocs::add_copy_reloc): Remove.
4494         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4495         section.
4496         (Copy_relocs::make_copy_reloc): New function.
4497         (Copy_relocs::add_copy_reloc): Remove.
4498         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4499         unchanged input files.
4500         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4501         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4502         Reserve BSS space for COPY relocations.
4503         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4504         (Output_section_incremental_inputs::write_info_blocks): Record
4505         whether a symbol is copied from a shared object.
4506         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4507         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4508         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4509         (Incremental_input_entry_reader::get_output_symbol_index): Add
4510         is_copy parameter.
4511         (Incremental_binary::emit_copy_relocs): New function.
4512         (Incremental_binary::do_emit_copy_relocs): New function.
4513         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4514         new data member.
4515         (Sized_incremental_binary::add_copy_reloc): New function.
4516         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4517         (Sized_incremental_binary::Copy_reloc): New struct.
4518         (Sized_incremental_binary::Copy_relocs): New typedef.
4519         (Sized_incremental_binary::copy_relocs_): New data member.
4520         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4521         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4522         * target.h (Sized_target::emit_copy_reloc): New function.
4523         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4524
4525 2011-06-02  Cary Coutant  <ccoutant@google.com>
4526
4527         PR gold/12163
4528         * gold/archive.cc (Archive::Archive): Initialize new data member.
4529         (Archive::include_all_members): Return if archive has already been
4530         included.
4531         * gold/archive.h (Archive::include_all_members_): New data member.
4532
4533 2011-06-02  Nick Clifton  <nickc@redhat.com>
4534
4535         * dynobj.h: Fix spelling mistake in comment.
4536         * output.cc: Likewise.
4537
4538 2011-05-31  Doug Kwan  <dougkwan@google.com>
4539             Asier Llano
4540
4541         PR gold/12826
4542         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4543         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4544         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4545         redundant arm_exidx_test.so.
4546         * testsuite/Makefile.in: Regenerate.
4547         (check_SCRIPTS): Add pr12826.sh
4548         (check_DATA): Add pr12826.stdout
4549         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4550         * testsuite/pr12826.sh: New file.
4551         * testsuite/pr12826_1.s: Ditto.
4552         * testsuite/pr12826_1.s: Ditto.
4553
4554 2011-05-30  Ian Lance Taylor  <iant@google.com>
4555
4556         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4557         sections.
4558
4559 2011-05-29  Ian Lance Taylor  <iant@google.com>
4560
4561         PR gold/12804
4562         * testsuite/Makefile.am: Use different file name for two_file_test
4563         temporary file for each incremental test.
4564         * testsuite/Makefile.in: Rebuild.
4565
4566 2011-05-29  Ian Lance Taylor  <iant@google.com>
4567
4568         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4569         binary input file is empty.
4570
4571 2011-05-27  Ian Lance Taylor  <iant@google.com>
4572
4573         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4574         (ver_test_9.so): Likewise.
4575         * testsuite/Makefile.in: Rebuild.
4576
4577 2011-05-26 Cary Coutant  <ccoutant@google.com>
4578
4579         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4580         * incremental.cc (Incremental_inputs::report_input_section): Fix
4581         comment, indentation.
4582         (Incremental_inputs::report_comdat_group): New function.
4583         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4584         of data for incremental input file entry.
4585         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4586         group count, COMDAT group signatures.
4587         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4588         an unchanged input file.
4589         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4590         Initialize new data member.
4591         (Incremental_object_entry::add_comdat_group): New function.
4592         (Incremental_object_entry::get_comdat_group_count): New function.
4593         (Incremental_object_entry::get_comdat_signature_key): New function.
4594         (Incremental_object_entry::groups_): New data member.
4595         (Incremental_inputs::report_comdat_group): New function.
4596         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4597         data for incremental input file entry.
4598         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4599         (Incremental_input_entry_reader::get_input_section): Adjust size of
4600         data for incremental input file entry.
4601         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4602         (Incremental_input_entry_reader::get_comdat_group_signature): New
4603         function.
4604         * object.cc (Sized_relobj::include_section_group): Report kept
4605         COMDAT groups for incremental links.
4606
4607 2011-05-24  David Meyer  <pdox@google.com>
4608
4609         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4610         with name parameter.  Add found_name parameter.
4611         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4612         * dirsearch.h (class Dirsearch): Update declaration.
4613
4614 2011-05-24  Ian Lance Taylor  <iant@google.com>
4615
4616         * archive.cc (Library_base::should_include_member): Pull in object
4617         from archive if it defines the entry symbol.
4618         * parameters.cc (Parameters::entry): New function.
4619         * parameters.h (class Parameters): Declare entry.
4620         * output.h (class Output_file_header): Remove entry_ field.
4621         * output.cc (Output_file_header::Output_file_header): Remove entry
4622         parameter.  Change all callers.
4623         (Output_file_header::entry): Use parameters->entry.
4624         * gold.cc (queue_middle_tasks): Likewise.
4625         * plugin.cc (Plugin_hook::run): Likewise.
4626
4627 2011-05-24 Cary Coutant  <ccoutant@google.com>
4628
4629         * gold.cc (queue_initial_tasks): Pass incremental base filename
4630         to Output_file::open_base_file; don't print error message.
4631         * incremental-dump.cc (main): Adjust call to
4632         Output_file::open_for_modification.
4633         * incremental-dump.cc (main): Likewise.
4634         * incremental.cc (Incremental_inputs::report_command_line):
4635         Ignore --incremental-base option when comparing command lines.
4636         Ignore parameter when given as separate argument.
4637         * options.h (class General_options): Add --incremental-base.
4638         * output.cc (Output_file::Output_file):
4639         (Output_file::open_base_file): Add base_name and writable parameters;
4640         read base file into new file; print error message here.
4641         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4642         callers.
4643         * output.h (Output_file::open_for_modification): Rename to...
4644         (Output_file::open_base_file): ...this; add base_name and
4645         writable parameters; adjust all callers.
4646         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4647         callers.
4648         * testsuite/Makefile.am (incremental_test_4): Test
4649         --incremental-base.
4650         * testsuite/Makefile.in: Regenerate.
4651
4652 2011-05-24 Cary Coutant  <ccoutant@google.com>
4653
4654         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4655         incremental_test_4.
4656         * testsuite/Makefile.in: Regenerate.
4657         * testsuite/two_file_test_1_v1.cc: New test source file.
4658         * testsuite/two_file_test_1b_v1.cc: New test source file.
4659         * testsuite/two_file_test_2_v1.cc: New test source file.
4660
4661 2011-05-24 Cary Coutant  <ccoutant@google.com>
4662
4663         * dynobj.h (Dynobj::do_dynobj): New function.
4664         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4665         flag and soname for shared objects.
4666         * incremental.cc (Incremental_inputs::report_object): Make
4667         either Incremental_object_entry or Incremental_dynobj_entry; add
4668         soname to string table.
4669         (Incremental_inputs::report_input_section): Add assertion.
4670         (Output_section_incremental_inputs::set_final_data_size): Adjust
4671         type of input file entry for shared libraries; adjust size of
4672         shared library info entry.
4673         (Output_section_incremental_inputs::write_input_files): Write
4674         as_needed flag for shared libraries.
4675         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4676         of input file entry for shared libraries; write soname.
4677         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4678         soname from incremental info.
4679         * incremental.h (enum Incremental_input_flags): Add
4680         INCREMENTAL_INPUT_AS_NEEDED.
4681         (Incremental_input_entry::Incremental_input_entry): Initialize new
4682         data member.
4683         (Incremental_input_entry::set_as_needed): New function.
4684         (Incremental_input_entry::as_needed): New function.
4685         (Incremental_input_entry::do_dynobj_entry): New function.
4686         (Incremental_input_entry::as_needed_): New data member.
4687         (Incremental_object_entry::Incremental_object_entry): Don't check
4688         for shared library.
4689         (Incremental_object_entry::do_type): Likewise.
4690         (class Incremental_dynobj_entry): New class.
4691         (Incremental_input_entry_reader::as_needed): New function.
4692         (Incremental_input_entry_reader::get_soname): New function.
4693         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4694         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4695         size of shared library info entry.
4696         * layout.cc (Layout::finish_dynamic_section): Don't test for
4697         incremental link when adding DT_NEEDED entries.
4698         * object.h (Object::Object): Initialize new data member.
4699         (Object::dynobj): New function.
4700         (Object::set_as_needed): New function.
4701         (Object::as_needed): New function.
4702         (Object::do_dynobj): New function.
4703         (Object::as_needed_): New data member.
4704
4705 2011-05-24 Cary Coutant  <ccoutant@google.com>
4706
4707         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4708         info; adjust display of GOT entries.
4709         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4710         vector of input objects; remove file_status_.
4711         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4712         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4713         got_plt reader; call target hooks to reserve GOT entries.
4714         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4715         of input file info header and GOT info entry.
4716         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4717         relocation info.
4718         (Got_plt_view_info::got_descriptor): Remove.
4719         (Got_plt_view_info::sym_index): New data member.
4720         (Got_plt_view_info::input_index): New data member.
4721         (Local_got_offset_visitor::visit): Write input file index.
4722         (Global_got_offset_visitor::visit): Write 0 for input file index.
4723         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4724         with sym_index and input_index.
4725         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4726         incremental info GOT entry; replace got_descriptor with input_index.
4727         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4728         map from input file index to object.
4729         (Sized_relobj_incr::do_layout): Replace direct data member reference
4730         with accessor function.
4731         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4732         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4733         Adjust size of input file info header.
4734         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4735         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4736         (Incremental_input_entry_reader::get_input_section): Adjust size of
4737         input file info header.
4738         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4739         of incremental info GOT entry.
4740         (Incremental_got_plt_reader::get_got_desc): Remove.
4741         (Incremental_got_plt_reader::get_got_symndx): New function.
4742         (Incremental_got_plt_reader::get_got_input_index): New function.
4743         (Sized_incremental_binary::Sized_incremental_binary): Remove
4744         file_status_; add input_objects_.
4745         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4746         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4747         (Sized_incremental_binary::file_is_unchanged): Remove.
4748         (Sized_incremental_binary::set_input_object): New function.
4749         (Sized_incremental_binary::input_object): New function.
4750         (Sized_incremental_binary::file_status_): Remove.
4751         (Sized_incremental_binary::input_objects_): New data member.
4752         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4753         references.
4754         (Sized_relobj_incr::invalid_address): Move to base class.
4755         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4756         class.
4757         (Sized_relobj_incr::do_output_section_offset): Likewise.
4758         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4759         (Sized_relobj_incr::section_offsets_): Likewise.
4760         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4761         function.
4762         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4763         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4764         with accessor function.
4765         (Sized_relobj_file::do_layout): Likewise.
4766         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4767         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4768         (Sized_relobj_file::compute_final_local_value): Replace refs to
4769         section_offsets_ with accessor function.
4770         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4771         * object.h (Relobj::Relobj): Initialize new data members.
4772         (Relobj::add_dyn_reloc): New function.
4773         (Relobj::first_dyn_reloc): New function.
4774         (Relobj::dyn_reloc_count): New function.
4775         (Relobj::first_dyn_reloc_): New data member.
4776         (Relobj::dyn_reloc_count_): New data member.
4777         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4778         references.
4779         (Sized_relobj::Address): New typedef.
4780         (Sized_relobj::invalid_address): Move here from child class.
4781         (Sized_relobj::Sized_relobj): Initialize new data members.
4782         (Sized_relobj::sized_relobj): New function.
4783         (Sized_relobj::is_output_section_offset_invalid): Move here from
4784         child class.
4785         (Sized_relobj::get_output_section_offset): Likewise.
4786         (Sized_relobj::local_has_got_offset): Likewise.
4787         (Sized_relobj::local_got_offset): Likewise.
4788         (Sized_relobj::set_local_got_offset): Likewise.
4789         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4790         (Sized_relobj::clear_got_offsets): New function.
4791         (Sized_relobj::section_offsets): Move here from child class.
4792         (Sized_relobj::do_output_section_offset): Likewise.
4793         (Sized_relobj::do_set_section_offset): Likewise.
4794         (Sized_relobj::Local_got_offsets): Likewise.
4795         (Sized_relobj::local_got_offsets_): Likewise.
4796         (Sized_relobj::section_offsets_): Likewise.
4797         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4798         references.
4799         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4800         class.
4801         (Sized_relobj_file::sized_relobj): New function
4802         (Sized_relobj_file::local_has_got_offset): Move to base class.
4803         (Sized_relobj_file::local_got_offset): Likewise.
4804         (Sized_relobj_file::set_local_got_offset): Likewise.
4805         (Sized_relobj_file::get_output_section_offset): Likewise.
4806         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4807         (Sized_relobj_file::do_output_section_offset): Likewise.
4808         (Sized_relobj_file::do_set_section_offset): Likewise.
4809         (Sized_relobj_file::Local_got_offsets): Likewise.
4810         (Sized_relobj_file::local_got_offsets_): Likewise.
4811         (Sized_relobj_file::section_offsets_): Likewise.
4812         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4813         (all constructors).
4814         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4815         (Output_reloc::get_symbol_index): Likewise.
4816         (Output_reloc::local_section_offset): Likewise.
4817         (Output_reloc::get_address): Likewise.
4818         (Output_reloc::symbol_value): Likewise.
4819         (Output_data_got::reserve_slot): Move to class definition.
4820         (Output_data_got::reserve_local): New function.
4821         (Output_data_got::reserve_slot_for_global): Remove.
4822         (Output_data_got::reserve_global): New function.
4823         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4824         (all constructors, two instantiations).
4825         (Output_reloc::get_relobj): New function (two instantiations).
4826         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4827         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4828         (Output_data_reloc::add_global): Adjust type of relobj.
4829         (Output_data_reloc::add_global_relative): Likewise.
4830         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4831         (Output_data_reloc::add_local): Likewise.
4832         (Output_data_reloc::add_local_relative): Likewise.
4833         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4834         (Output_data_reloc::add_local_section): Likewise.
4835         (Output_data_reloc::add_output_section): Likewise.
4836         (Output_data_reloc::add_absolute): Likewise.
4837         (Output_data_reloc::add_target_specific): Likewise.
4838         (Output_data_got::reserve_slot): Move definition here.
4839         (Output_data_got::reserve_local): New function.
4840         (Output_data_got::reserve_global): New function.
4841         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4842         section_offsets_ with accessor function.
4843         (Sized_relobj_file::write_sections): Likewise.
4844         (Sized_relobj_file::do_relocate_sections): Likewise.
4845         * target.h (Sized_target::reserve_local_got_entry): New function.
4846         (Sized_target::reserve_global_got_entry): New function.
4847         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4848         (Target_x86_64::reserve_global_got_entry): New function.
4849         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4850
4851 2011-05-23 Cary Coutant  <ccoutant@google.com>
4852
4853         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4854         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4855         bit when checking got_type.
4856         * incremental.cc (Sized_incremental_binary::setup_readers):
4857         Store symbol table and string table locations; initialize bit vector
4858         of file status flags.
4859         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4860         unchanged files.
4861         (Sized_incremental_binary::do_process_got_plt): New function.
4862         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4863         (Output_section_incremental_inputs::set_final_data_size): Record
4864         file index for each input file.
4865         (Output_section_incremental_inputs::write_got_plt): Store file index
4866         instead of input entry offset for each GOT entry.
4867         * incremental.h
4868         (Incremental_input_entry::Incremental_input_entry): Initialize new
4869         data member.
4870         (Incremental_input_entry::set_offset): Store file index.
4871         (Incremental_input_entry::get_file_index): New function.
4872         (Incremental_input_entry::file_index_): New data member.
4873         (Incremental_binary::process_got_plt): New function.
4874         (Incremental_binary::do_process_got_plt): New function.
4875         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4876         data members.
4877         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4878         (Sized_incremental_binary::set_file_is_unchanged): New function.
4879         (Sized_incremental_binary::file_is_unchanged): New function.
4880         (Sized_incremental_binary::do_process_got_plt): New function.
4881         (Sized_incremental_binary::file_status_): New data member.
4882         (Sized_incremental_binary::main_symtab_loc_): New data member.
4883         (Sized_incremental_binary::main_strtab_loc_): New data member.
4884         * output.cc (Output_data_got::Got_entry::write): Add case
4885         RESERVED_CODE.
4886         (Output_data_got::add_global): Call add_got_entry.
4887         (Output_data_got::add_global_plt): Likewise.
4888         (Output_data_got::add_global_with_rel): Likewise.
4889         (Output_data_got::add_global_with_rela): Likewise.
4890         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4891         (Output_data_got::add_global_pair_with_rela): Likewise.
4892         (Output_data_got::add_local): Call add_got_entry.
4893         (Output_data_got::add_local_plt): Likewise.
4894         (Output_data_got::add_local_with_rel): Likewise.
4895         (Output_data_got::add_local_with_rela): Likewise.
4896         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4897         (Output_data_got::add_local_pair_with_rela): Likewise.
4898         (Output_data_got::reserve_slot): New function.
4899         (Output_data_got::reserve_slot_for_global): New function.
4900         (Output_data_got::add_got_entry): New function.
4901         (Output_data_got::add_got_entry_pair): New function.
4902         (Output_section::add_output_section_data): Edit FIXME.
4903         * output.h
4904         (Output_section_data_build::Output_section_data_build): New
4905         constructor with size parameter.
4906         (Output_data_space::Output_data_space): Likewise.
4907         (Output_data_got::Output_data_got): Initialize new data member; new
4908         constructor with size parameter.
4909         (Output_data_got::add_constant): Call add_got_entry.
4910         (Output_data_got::reserve_slot): New function.
4911         (Output_data_got::reserve_slot_for_global): New function.
4912         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4913         (Output_data_got::add_got_entry): New function.
4914         (Output_data_got::add_got_entry_pair): New function.
4915         (Output_data_got::free_list_): New data member.
4916         * target.h (Sized_target::init_got_plt_for_update): New function.
4917         (Sized_target::register_global_plt_entry): New function.
4918         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4919         Initialize new data member; call init; add constructor with PLT count.
4920         (Output_data_plt_x86_64::init): New function.
4921         (Output_data_plt_x86_64::add_relocation): New function.
4922         (Output_data_plt_x86_64::reserve_slot): New function.
4923         (Output_data_plt_x86_64::free_list_): New data member.
4924         (Target_x86_64::init_got_plt_for_update): New function.
4925         (Target_x86_64::register_global_plt_entry): New function.
4926         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4927         incremental updates.
4928         (Output_data_plt_x86_64::add_relocation): New function.
4929         * testsuite/object_unittest.cc (Object_test): Set default options.
4930
4931 2011-05-16  Ian Lance Taylor  <iant@google.com>
4932
4933         * options.h (class General_options): Make -i a synonym for -r.
4934
4935 2011-05-16  Ian Lance Taylor  <iant@google.com>
4936
4937         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4938
4939 2011-05-10 Cary Coutant  <ccoutant@google.com>
4940
4941         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4942         strip_all (-s).
4943
4944 2011-05-06  Ian Lance Taylor  <iant@google.com>
4945
4946         * layout.cc (Layout::layout): If the output section flags change,
4947         update the ordering.
4948
4949 2011-04-25 Cary Coutant  <ccoutant@google.com>
4950
4951         * incremental-dump.cc (dump_incremental_inputs): Print local
4952         symbol info for each input file.
4953         * incremental.cc
4954         (Output_section_incremental_inputs::set_final_data_size): Add local
4955         symbol info to input file entries in incremental info.
4956         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4957         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4958         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4959         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4960         implementation.
4961         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4962         (Sized_incr_relobj::do_relocate): Write the local symbols.
4963         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4964         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4965         Adjust size of input file header.
4966         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4967         (Incremental_inputs_reader::get_local_symbol_count): New function.
4968         (Incremental_inputs_reader::get_input_section): Adjust size of input
4969         file header.
4970         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4971         (Sized_incr_relobj::This): New typedef.
4972         (Sized_incr_relobj::sym_size): New const data member.
4973         (Sized_incr_relobj::Local_symbol): New struct.
4974         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4975         (Sized_incr_relobj::do_local_symbol_offset): New function.
4976         (Sized_incr_relobj::local_symbol_count_): New data member.
4977         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4978         (Sized_incr_relobj::local_symbol_index_): New data member.
4979         (Sized_incr_relobj::local_symbol_offset_): New data member.
4980         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4981         (Sized_incr_relobj::local_symbols_): New data member.
4982         * object.h (Relobj::output_local_symbol_count): New function.
4983         (Relobj::local_symbol_offset): New function.
4984         (Relobj::do_output_local_symbol_count): New function.
4985         (Relobj::do_local_symbol_offset): New function.
4986         (Sized_relobj::do_output_local_symbol_count): New function.
4987         (Sized_relobj::do_local_symbol_offset): New function.
4988
4989 2011-04-22  Vladimir Simonov  <sv@sw.ru>
4990
4991         * descriptors.cc (set_close_on_exec): New function.
4992         (Descriptors::open): Use set_close_on_exec.
4993         * output.cc (S_ISLNK): Define if not defined.
4994
4995 2011-04-22 Cary Coutant  <ccoutant@google.com>
4996
4997         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4998         global symbol map.
4999         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5000         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5001         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5002         relocations.
5003         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5004         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5005         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5006         * incremental.h
5007         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5008         function.
5009         (Incremental_binary::apply_incremental_relocs): New function.
5010         (Incremental_binary::do_apply_incremental_relocs): New function.
5011         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5012         data member.
5013         (Sized_incremental_binary::add_global_symbol): New function.
5014         (Sized_incremental_binary::global_symbol): New function.
5015         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5016         (Sized_incremental_binary::symbol_map_): New data member.
5017         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5018         * target.h (Sized_target::apply_relocation): New function.
5019         * target-reloc.h (apply_relocation): New function.
5020         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5021
5022 2011-04-22  Doug Kwan  <dougkwan@google.com>
5023
5024         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5025         flag of a SHT_ARM_EXIDX section.
5026         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5027         * testsuite/Makefile.in: Regenerate.
5028         * testsuite/arm_exidx_test.s: New file.
5029         * testsuite/arm_exidx_test.sh: Same.
5030
5031 2011-04-20 Cary Coutant  <ccoutant@google.com>
5032
5033         PR gold/12689
5034         * archive.h (Incremental_archive_entry::Archive_member):
5035         Initialize arg_serial_ (second constructor).
5036
5037 2011-04-17  Ian Lance Taylor  <iant@google.com>
5038
5039         * object.cc (Relocate_info::location): Simplify location string.
5040         * errors.cc (Errors::error_at_location): Don't print program
5041         name.
5042         (Errors::warning_at_location): Likewise.
5043         (Errors::undefined_symbol): Likewise.
5044         * testsuite/debug_msg.sh: Update accordingly.
5045
5046 2011-04-14 Cary Coutant  <ccoutant@google.com>
5047
5048         * gold/layout.cc (Layout::symtab_section_offset): New function.
5049         * gold/layout.h (Layout::symtab_section_offset): New function.
5050         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5051
5052 2011-04-12  Ian Lance Taylor  <iant@google.com>
5053
5054         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5055         with MREMAP_MAYMOVE.
5056         * output.h (class Output_file): Add map_is_allocated_ field.
5057         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5058         not available, provide stubs.  If mremap is not available, #define
5059         it to gold_mremap.
5060         (MREMAP_MAYMOVE): Define if not defined.
5061         (Output_file::Output_file): Initialize map_is_allocated_.
5062         (Output_file::resize): Check map_is_allocated_.
5063         (Output_file::map_anonymous): If mmap fails, use malloc.
5064         (Output_file::unmap): Don't do anything for an anonymous map.
5065         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5066         is not available, provide stubs.
5067         (File_read::View::~View): Use free rather than delete[].
5068         (File_read::make_view): Use malloc rather than new[].  If mmap
5069         fails, use malloc.
5070         (File_read::find_or_make_view): Use malloc rather than new[].
5071         * gold.h: Remove HAVE_REMAP code.
5072         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5073         exists.  Rename mremap to gold_mremap.  If mmap is not available
5074         don't do anything.
5075         * configure, config.in: Rebuild.
5076
5077 2011-04-11  Ian Lance Taylor  <iant@google.com>
5078
5079         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5080         initialize local variable v.
5081
5082 2011-04-11  Cary Coutant  <ccoutant@google.com>
5083
5084         * archive.cc (Archive::include_member): Adjust call to
5085         report_object.
5086         (Add_archive_symbols::run): Track argument serial numbers.
5087         (Lib_group::include_member): Likewise.
5088         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5089         * archive.h (Incremental_archive_entry::Archive_member):
5090         Initialize arg_serial_.
5091         (Archive_member::arg_serial_): New data member.
5092         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5093         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5094         incremental link.
5095         (Sized_dynobj::do_for_all_local_got_entries): New function.
5096         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5097         function.
5098         * fileread.cc (get_mtime): New function.
5099         * fileread.h (get_mtime): New function.
5100         * gold.cc (queue_initial_tasks): Check for incremental update.
5101         (process_incremental_input): New function.
5102         (queue_middle_tasks): Don't force valid target for incremental
5103         update.
5104         * incremental-dump.cc (find_input_containing_global): Adjust
5105         size of symbol info entry.
5106         (dump_incremental_inputs): Dump argument serial number and
5107         in_system_directory flag; bias shndx by 1; print symbol names
5108         when dumping per-file symbol lists; use new symbol info readers.
5109         * incremental.cc
5110         (Output_section_incremental_inputs:update_data_size): New function.
5111         (Sized_incremental_binary::setup_readers): Setup input readers
5112         for each input file; build maps for files added from libraries
5113         and scripts.
5114         (Sized_incremental_binary::check_input_args): New function.
5115         (Sized_incremental_binary::do_check_inputs): Build map of argument
5116         serial numbers to input arguments.
5117         (Sized_incremental_binary::do_file_has_changed): Rename
5118         do_file_is_unchanged to this; compare file modification times.
5119         (Sized_incremental_binary::do_init_layout): New function.
5120         (Sized_incremental_binary::do_reserve_layout): New function.
5121         (Sized_incremental_binary::do_get_input_reader): Remove.
5122         (Sized_incremental_binary::get_symtab_view): New function.
5123         (Incremental_checker::can_incrementally_link_output_file): Remove.
5124         (Incremental_inputs::report_command_line): Exclude --debug options.
5125         (Incremental_inputs::report_archive_begin): Add parameter; track
5126         argument serial numbers; don't put input file entry for archive
5127         before archive members.
5128         (Incremental_inputs::report_archive_end): Put input file entry
5129         for archive after archive members.
5130         (Incremental_inputs::report_object): Add parameter; track argument
5131         serial numbers and in_system_directory flag.
5132         (Incremental_inputs::report_script): Add parameter; track argument
5133         serial numbers.
5134         (Output_section_incremental_inputs::set_final_data_size): Adjust
5135         size of symbol info entry; check for forwarding symbols.
5136         (Output_section_incremental_inputs::write_input_files): Write
5137         in_system_directory flag and argument serial number.
5138         (Output_section_incremental_inputs::write_info_blocks): Map section
5139         indices between incremental info and original input file; store
5140         input section index for each symbol.
5141         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5142         change operator() to visit().
5143         (class Global_got_offset_visitor): Likewise.
5144         (class Global_symbol_visitor_got_plt):
5145         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5146         classes.
5147         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5148         (Sized_incr_relobj::do_read_symbols): New function.
5149         (Sized_incr_relobj::do_layout): New function.
5150         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5151         (Sized_incr_relobj::do_add_symbols): New function.
5152         (Sized_incr_relobj::do_should_include_member): New function.
5153         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5154         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5155         (Sized_incr_relobj::do_section_size): New function.
5156         (Sized_incr_relobj::do_section_name): New function.
5157         (Sized_incr_relobj::do_section_contents): New function.
5158         (Sized_incr_relobj::do_section_flags): New function.
5159         (Sized_incr_relobj::do_section_entsize): New function.
5160         (Sized_incr_relobj::do_section_address): New function.
5161         (Sized_incr_relobj::do_section_type): New function.
5162         (Sized_incr_relobj::do_section_link): New function.
5163         (Sized_incr_relobj::do_section_info): New function.
5164         (Sized_incr_relobj::do_section_addralign): New function.
5165         (Sized_incr_relobj::do_initialize_xindex): New function.
5166         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5167         (Sized_incr_relobj::do_read_relocs): New function.
5168         (Sized_incr_relobj::do_gc_process_relocs): New function.
5169         (Sized_incr_relobj::do_scan_relocs): New function.
5170         (Sized_incr_relobj::do_count_local_symbols): New function.
5171         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5172         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5173         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5174         (Sized_incr_relobj::do_relocate): New function.
5175         (Sized_incr_relobj::do_set_section_offset): New function.
5176         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5177         (Sized_incr_dynobj::do_read_symbols): New function.
5178         (Sized_incr_dynobj::do_layout): New function.
5179         (Sized_incr_dynobj::do_add_symbols): New function.
5180         (Sized_incr_dynobj::do_should_include_member): New function.
5181         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5182         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5183         (Sized_incr_dynobj::do_section_size): New function.
5184         (Sized_incr_dynobj::do_section_name): New function.
5185         (Sized_incr_dynobj::do_section_contents): New function.
5186         (Sized_incr_dynobj::do_section_flags): New function.
5187         (Sized_incr_dynobj::do_section_entsize): New function.
5188         (Sized_incr_dynobj::do_section_address): New function.
5189         (Sized_incr_dynobj::do_section_type): New function.
5190         (Sized_incr_dynobj::do_section_link): New function.
5191         (Sized_incr_dynobj::do_section_info): New function.
5192         (Sized_incr_dynobj::do_section_addralign): New function.
5193         (Sized_incr_dynobj::do_initialize_xindex): New function.
5194         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5195         (make_sized_incremental_object): New function.
5196         (Incremental_library::copy_unused_symbols): New function.
5197         (Incremental_library::do_for_all_unused_symbols): New function.
5198         * incremental.h (enum Incremental_input_flags): New type.
5199         (class Incremental_checker): Remove.
5200         (Incremental_input_entry::Incremental_input_entry): Add argument
5201         serial number.
5202         (Incremental_input_entry::arg_serial): New function.
5203         (Incremental_input_entry::set_is_in_system_directory): New function.
5204         (Incremental_input_entry::is_in_system_directory): New function.
5205         (Incremental_input_entry::arg_serial_): New data member.
5206         (Incremental_input_entry::is_in_system_directory_): New data member.
5207         (class Script_info): Move here from script.h.
5208         (Script_info::Script_info): Add filename parameter.
5209         (Script_info::filename): New function.
5210         (Script_info::filename_): New data member.
5211         (Incremental_script_entry::Incremental_script_entry): Add argument
5212         serial number.
5213         (Incremental_object_entry::Incremental_object_entry): Likewise.
5214         (Incremental_object_entry::add_input_section): Build list of input
5215         sections with map to original shndx.
5216         (Incremental_object_entry::get_input_section_index): New function.
5217         (Incremental_object_entry::shndx_): New data member.
5218         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5219         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5220         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5221         serial number.
5222         (Incremental_inputs::report_archive_begin): Likewise.
5223         (Incremental_inputs::report_object): Likewise.
5224         (Incremental_inputs::report_script): Likewise.
5225         (class Incremental_global_symbol_reader): New class.
5226         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5227         and store flags and input file type.
5228         (Incremental_input_entry_reader::arg_serial): New function.
5229         (Incremental_input_entry_reader::type): Extract type from flags.
5230         (Incremental_input_entry_reader::is_in_system_directory): New function.
5231         (Incremental_input_entry_reader::get_input_section_count): Call
5232         accessor function for type.
5233         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5234         function for type; adjust size of global symbol entry.
5235         (Incremental_input_entry_reader::get_global_symbol_count): Call
5236         accessor function for type.
5237         (Incremental_input_entry_reader::get_object_count): Likewise.
5238         (Incremental_input_entry_reader::get_object_offset): Likewise.
5239         (Incremental_input_entry_reader::get_member_count): Likewise.
5240         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5241         (Incremental_input_entry_reader::get_member_offset): Likewise.
5242         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5243         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5244         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5245         (Incremental_input_entry_reader::get_global_symbol_reader): New
5246         function.
5247         (Incremental_input_entry_reader::get_output_symbol_index): New
5248         function.
5249         (Incremental_input_entry_reader::type_): Remove.
5250         (Incremental_input_entry_reader::flags_): New data member.
5251         (Incremental_inputs_reader::input_file_offset): New function.
5252         (Incremental_inputs_reader::input_file_index): New function.
5253         (Incremental_inputs_reader::input_file): Call input_file_offset.
5254         (Incremental_inputs_reader::input_file_at_offset): New function.
5255         (Incremental_relocs_reader::get_r_type): Reformat.
5256         (Incremental_relocs_reader::get_r_shndx): Reformat.
5257         (Incremental_relocs_reader::get_r_offset): Reformat.
5258         (Incremental_relocs_reader::data): New function.
5259         (Incremental_binary::Incremental_binary): Initialize new data members.
5260         (Incremental_binary::check_inputs): Add cmdline parameter.
5261         (Incremental_binary::file_is_unchanged): Remove.
5262         (Input_reader::arg_serial): New function.
5263         (Input_reader::get_unused_symbol_count): New function.
5264         (Input_reader::get_unused_symbol): New function.
5265         (Input_reader::do_arg_serial): New function.
5266         (Input_reader::do_get_unused_symbol_count): New function.
5267         (Input_reader::do_get_unused_symbol): New function.
5268         (Incremental_binary::input_file_count): New function.
5269         (Incremental_binary::get_input_reader): Change signature to use
5270         index instead of filename.
5271         (Incremental_binary::file_has_changed): New function.
5272         (Incremental_binary::get_input_argument): New function.
5273         (Incremental_binary::get_library): New function.
5274         (Incremental_binary::get_script_info): New function.
5275         (Incremental_binary::init_layout): New function.
5276         (Incremental_binary::reserve_layout): New function.
5277         (Incremental_binary::output_file): New function.
5278         (Incremental_binary::do_check_inputs): New function.
5279         (Incremental_binary::do_file_is_unchanged): Remove.
5280         (Incremental_binary::do_file_has_changed): New function.
5281         (Incremental_binary::do_init_layout): New function.
5282         (Incremental_binary::do_reserve_layout): New function.
5283         (Incremental_binary::do_input_file_count): New function.
5284         (Incremental_binary::do_get_input_reader): Change signature.
5285         (Incremental_binary::input_args_map_): New data member.
5286         (Incremental_binary::library_map_): New data member.
5287         (Incremental_binary::script_map_): New data member.
5288         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5289         new data members.
5290         (Sized_incremental_binary::output_section): New function.
5291         (Sized_incremental_binary::inputs_reader): Add const.
5292         (Sized_incremental_binary::symtab_reader): Add const.
5293         (Sized_incremental_binary::relocs_reader): Add const.
5294         (Sized_incremental_binary::got_plt_reader): Add const.
5295         (Sized_incremental_binary::get_symtab_view): New function.
5296         (Sized_incremental_binary::Inputs_reader): New typedef.
5297         (Sized_incremental_binary::Input_entry_reader): New typedef.
5298         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5299         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5300         (Sized_incremental_binary::do_file_has_changed): New function.
5301         (Sized_incremental_binary::do_init_layout): New function.
5302         (Sized_incremental_binary::do_reserve_layout): New function.
5303         (Sized_input_reader::Inputs_reader): Remove.
5304         (Sized_input_reader::Input_entry_reader): Remove.
5305         (Sized_input_reader::do_arg_serial): New function.
5306         (Sized_input_reader::do_get_unused_symbol_count): New function.
5307         (Sized_input_reader::do_get_unused_symbol): New function.
5308         (Sized_incremental_binary::do_input_file_count): New function.
5309         (Sized_incremental_binary::do_get_input_reader): Change signature;
5310         use index instead of filename.
5311         (Sized_incremental_binary::section_map_): New data member.
5312         (Sized_incremental_binary::input_entry_readers_): New data member.
5313         (class Sized_incr_relobj): New class.
5314         (class Sized_incr_dynobj): New class.
5315         (make_sized_incremental_object): New function.
5316         (class Incremental_library): New class.
5317         * layout.cc (Free_list::num_lists): New static data member.
5318         (Free_list::num_nodes): New static data member.
5319         (Free_list::num_removes): New static data member.
5320         (Free_list::num_remove_visits): New static data member.
5321         (Free_list::num_allocates): New static data member.
5322         (Free_list::num_allocate_visits): New static data member.
5323         (Free_list::init): New function.
5324         (Free_list::remove): New function.
5325         (Free_list::allocate): New function.
5326         (Free_list::dump): New function.
5327         (Free_list::print_stats): New function.
5328         (Layout_task_runner::run): Resize output file for incremental updates.
5329         (Layout::Layout): Initialize new data members.
5330         (Layout::set_incremental_base): New function.
5331         (Layout::init_fixed_output_section): New function.
5332         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5333         incremental updates.
5334         (Layout::create_gold_note): Do not create gold note section for
5335         incremental updates.
5336         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5337         for incremental updates.
5338         (Layout::set_section_offsets): For incremental updates, allocate space
5339         from free list.
5340         (Layout::create_symtab_sections): Layout with offsets relative to
5341         start of section; for incremental updates, allocate space from free
5342         list.
5343         (Layout::create_shdrs): For incremental updates, allocate space from
5344         free list.
5345         (Layout::finish_dynamic_section): For incremental updates, do not
5346         check --as-needed (fixed in subsequent patch).
5347         * layout.h (class Free_list): New class.
5348         (Layout::set_incremental_base): New function.
5349         (Layout::incremental_base): New function.
5350         (Layout::init_fixed_output_section): New function.
5351         (Layout::allocate): New function.
5352         (Layout::incremental_base_): New data member.
5353         (Layout::free_list_): New data member.
5354         * main.cc (main): Print Free_list statistics.
5355         * object.cc (Relobj::finalize_incremental_relocs): Add
5356         clear_counts parameter; clear counts only when clear_counts is set.
5357         (Sized_relobj::Sized_relobj): Initialize new base class.
5358         (Sized_relobj::do_layout): Don't report special sections.
5359         (Sized_relobj::do_for_all_local_got_entries): New function.
5360         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5361         symtab_off to all symbol table offsets.
5362         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5363         * object.h (class Got_offset_list): Move to top of file.
5364         (Object::Object): Allow case where input_file == NULL.
5365         (Object::~Object): Likewise.
5366         (Object::input_file): Assert that input_file != NULL.
5367         (Object::lock): Allow case where input_file == NULL.
5368         (Object::unlock): Likewise.
5369         (Object::is_locked): Likewise.
5370         (Object::token): Likewise.
5371         (Object::release): Likewise.
5372         (Object::is_incremental): New function.
5373         (Object::get_mtime): New function.
5374         (Object::for_all_local_got_entries): New function.
5375         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5376         (Object::set_is_in_system_directory): New function.
5377         (Object::is_in_system_directory): New function.
5378         (Object::do_is_incremental): New function.
5379         (Object::do_get_mtime): New function.
5380         (Object::do_for_all_local_got_entries): New function.
5381         (Object::is_in_system_directory_): New data member.
5382         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5383         (class Sized_relobj_base): New class.
5384         (class Sized_relobj): Derive from Sized_relobj_base.
5385         (class Sized_relobj::Symbols): Redeclare from base class.
5386         (class Sized_relobj::local_got_offset_list): Remove.
5387         (class Sized_relobj::Output_sections): Redeclare from base class.
5388         (class Sized_relobj::do_for_all_local_got_entries): New function.
5389         (class Sized_relobj::write_local_symbols): Add offset parameter.
5390         (class Sized_relobj::local_symbol_offset_): Update comment.
5391         (class Sized_relobj::local_dynsym_offset_): Update comment.
5392         * options.cc (Input_arguments::add_file): Remove const.
5393         * options.h (Input_file_argument::Input_file_argument):
5394         Initialize arg_serial_ (all constructors).
5395         (Input_file_argument::set_arg_serial): New function.
5396         (Input_file_argument::arg_serial): New function.
5397         (Input_file_argument::arg_serial_): New data member.
5398         (Input_arguments::Input_arguments): Initialize file_count_.
5399         (Input_arguments::add_file): Remove const.
5400         (Input_arguments::number_of_input_files): New function.
5401         (Input_arguments::file_count_): New data member.
5402         (Command_line::number_of_input_files): Call
5403         Input_arguments::number_of_input_files.
5404         * output.cc (Output_segment_headers::Output_segment_headers):
5405         Set current size.
5406         (Output_section::Input_section::current_data_size): New function.
5407         (Output_section::Output_section): Initialize new data members.
5408         (Output_section::add_input_section): Don't do merge sections for
5409         an incremental link; allocate space from free list for an
5410         incremental update.
5411         (Output_section::add_output_section_data): Allocate space from
5412         free list for an incremental update.
5413         (Output_section::update_data_size): New function.
5414         (Output_section::set_fixed_layout): New function.
5415         (Output_section::reserve): New function.
5416         (Output_segment::set_section_addresses): Remove const.
5417         (Output_segment::set_section_list_addresses): Remove const; allocate
5418         space from free list for an incremental update.
5419         (Output_segment::set_offset): Adjust size of RELRO segment for an
5420         incremental update.
5421         * output.h (Output_data::current_data_size): Move here from
5422         child classes.
5423         (Output_data::pre_finalize_data_size): New function.
5424         (Output_data::update_data_size): New function.
5425         (Output_section_headers::update_data_size): new function.
5426         (Output_section_data_build::current_data_size): Move to Output_data.
5427         (Output_data_strtab::update_data_size): New function.
5428         (Output_section::current_data_size): Move to Output_data.
5429         (Output_section::set_fixed_layout): New function.
5430         (Output_section::has_fixed_layout): New function.
5431         (Output_section::reserve): New function.
5432         (Output_section::update_data_size): New function.
5433         (Output_section::has_fixed_layout_): New data member.
5434         (Output_section::free_list_): New data member.
5435         (Output_segment::set_section_addresses): Remove const.
5436         (Output_segment::set_section_list_addresses): Remove const.
5437         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5438         New function.
5439         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5440         New function.
5441         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5442         parameter when calling Add_symbols constructor; store argument
5443         serial number for members of a lib group.
5444         (Add_symbols::locks): Allow case where token == NULL.
5445         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5446         (Read_member::~Read_member): New function.
5447         (Read_member::is_runnable): New function.
5448         (Read_member::locks): New function.
5449         (Read_member::run): New function.
5450         (Check_script::~Check_script): New function.
5451         (Check_script::is_runnable): New function.
5452         (Check_script::locks): New function.
5453         (Check_script::run): New function.
5454         (Check_library::~Check_library): New function.
5455         (Check_library::is_runnable): New function.
5456         (Check_library::locks): New function.
5457         (Check_library::run): New function.
5458         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5459         (Add_symbols::library_): New data member.
5460         (class Read_member): New class.
5461         (class Check_script): New class.
5462         (class Check_library): New class.
5463         * reloc.cc (Read_relocs::is_runnable): Allow case where
5464         token == NULL.
5465         (Read_relocs::locks): Likewise.
5466         (Scan_relocs::locks): Likewise.
5467         (Relocate_task::locks): Likewise.
5468         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5469         to clear counters.
5470         (Sized_relobj::incremental_relocs_scan): Fix comment.
5471         (Sized_relobj::do_relocate): Pass output file offset to
5472         write_local_symbols.
5473         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5474         from class declaration.
5475         * script.cc (read_input_script): Allocate Script_info; pass
5476         argument serial number to report_script.
5477         * script.h (class Script_info): Move to incremental.h.
5478         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5479         * symtab.h (Symbol_table::add_from_incrobj): New function.
5480         (Symbol_table::set_file_offset): New function.
5481
5482 2011-04-05  Cary Coutant  <ccoutant@google.com>
5483
5484         * incremental-dump.cc (dump_incremental_inputs): Change signature
5485         to take a Sized_incremental_binary; change caller.  Use readers
5486         in Sized_incremental_binary.
5487         * incremental.cc
5488         (Sized_incremental_binary::find_incremental_inputs_sections):
5489         Rename do_find_incremental_inputs_sections to this.
5490         (Sized_incremental_binary::setup_readers): New function.
5491         (Sized_incremental_binary::do_check_inputs): Check
5492         has_incremental_info_ flag; move setup code to setup_readers;
5493         use input readers.
5494         (Sized_incremental_binary::do_file_is_unchanged): New function.
5495         (Sized_incremental_binary::do_get_input_reader): New function.
5496         * incremental.h (class Incremental_binary): Move to end of file.
5497         (Incremental_binary::file_is_unchanged): New function.
5498         (Incremental_binary::do_file_is_unchanged): New function.
5499         (Incremental_binary::Input_reader): New class.
5500         (Incremental_binary::get_input_reader): New function.
5501         (class Sized_incremental_binary): Move to end of file.
5502         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5503         input section reader classes.
5504         (Sized_incremental_binary::has_incremental_info): New function.
5505         (Sized_incremental_binary::inputs_reader): New function.
5506         (Sized_incremental_binary::symtab_reader): New function.
5507         (Sized_incremental_binary::relocs_reader): New function.
5508         (Sized_incremental_binary::got_plt_reader): New function.
5509         (Sized_incremental_binary::do_file_is_unchanged): New function.
5510         (Sized_incremental_binary::Sized_input_reader): New class.
5511         (Sized_incremental_binary::get_input_reader): New function.
5512         (Sized_incremental_binary::find_incremental_inputs_sections):
5513         Rename do_find_incremental_inputs_sections to this.
5514         (Sized_incremental_binary::setup_readers): New function.
5515         (Sized_incremental_binary::has_incremental_info_): New data member.
5516         (Sized_incremental_binary::inputs_reader_): New data member.
5517         (Sized_incremental_binary::symtab_reader_): New data member.
5518         (Sized_incremental_binary::relocs_reader_): New data member.
5519         (Sized_incremental_binary::got_plt_reader_): New data member.
5520         (Sized_incremental_binary::current_input_file_): New data member.
5521
5522 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5523
5524         PR gold/12640
5525         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5526         violation.
5527
5528 2011-03-30  Cary Coutant  <ccoutant@google.com>
5529
5530         * archive.cc (Archive::include_member): Adjust call to report_object.
5531         (Add_archive_symbols::run): Add script_info to call to
5532         report_archive_begin.
5533         (Lib_group::include_member): Adjust call to report_object.
5534         (Add_lib_group_symbols::run): Adjust call to report_object.
5535         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5536         blocks.  Add object count for script input files.
5537         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5538         script_info parameter; change all callers.
5539         (Incremental_inputs::report_object): Add script_info parameter;
5540         change all callers.
5541         (Incremental_inputs::report_script): Store backpointer to
5542         incremental info entry.
5543         (Output_section_incremental_inputs::set_final_data_size): Record
5544         additional information for scripts.
5545         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5546         * incremental.h (Incremental_script_entry::add_object): New function.
5547         (Incremental_script_entry::get_object_count): New function.
5548         (Incremental_script_entry::get_object): New function.
5549         (Incremental_script_entry::objects_): New data member; adjust
5550         constructor.
5551         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5552         (Incremental_inputs::report_object): Add script_info parameter.
5553         (Incremental_inputs_reader::get_object_count): New function.
5554         (Incremental_inputs_reader::get_object_offset): New function.
5555         * options.cc (Input_arguments::add_file): Return reference to
5556         new input argument.
5557         * options.h (Input_argument::set_script_info): New function.
5558         (Input_argument::script_info): New function.
5559         (Input_argument::script_info_): New data member; adjust all
5560         constructors.
5561         (Input_file_group::add_file): Return reference to new input argument.
5562         (Input_file_lib::add_file): Likewise.
5563         (Input_arguments::add_file): Likewise.
5564         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5565         * script.cc (Parser_closure::Parser_closure): Add script_info
5566         parameter; adjust all callers.
5567         (Parser_closure::script_info): New function.
5568         (Parser_closure::script_info_): New data member.
5569         (read_input_script): Report scripts earlier to incremental info.
5570         (script_add_file): Set script_info in Input_argument.
5571         (script_add_library): Likewise.
5572         * script.h (Script_options::Script_info): Rewrite class.
5573
5574 2011-03-29  Cary Coutant  <ccoutant@google.com>
5575
5576         * archive.cc (Library_base::should_include_member): Move
5577         method here from class Archive.
5578         (Archive::Archive): Initialize base class.
5579         (Archive::should_include_member): Move to base class.
5580         (Archive::do_for_all_unused_symbols): New function.
5581         (Add_archive_symbols::run): Remove redundant access to
5582         incremental_inputs.
5583         (Lib_group::Lib_group): Initialize base class.
5584         (Lib_group::do_filename): New function.
5585         (Lib_group::include_member): Pass pointer to Lib_group to
5586         report_object.
5587         (Lib_group::do_for_all_unused_symbols): New function.
5588         (Add_lib_group_symbols::run): Report archive information for
5589         incremental links.
5590         * archive.h (class Library_base): New base class.
5591         (class Archive): Derive from Library_base.
5592         (Archive::filename): Move to base class.
5593         (Archive::set_incremental_info): Likewise.
5594         (Archive::incremental_info): Likewise.
5595         (Archive::Should_include): Likewise.
5596         (Archive::should_include_member): Likewise.
5597         (Archive::Armap_entry): Remove.
5598         (Archive::Unused_symbol_iterator): Remove.
5599         (Archive::unused_symbols_begin): Remove.
5600         (Archive::unused_symbols_end): Remove.
5601         (Archive::do_filename): New function.
5602         (Archive::do_get_mtime): New function.
5603         (Archive::do_for_all_unused_symbols): New function.
5604         (Archive::task_): Move to base class.
5605         (Archive::incremental_info_): Likewise.
5606         (class Lib_group): Derive from Library_base.
5607         (Lib_group::do_filename): New function.
5608         (Lib_group::do_get_mtime): New function.
5609         (Lib_group::do_for_all_unused_symbols): New function.
5610         (Lib_group::task_): Move to base class.
5611         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5612         function.
5613         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5614         function.
5615         * incremental.cc (Incremental_inputs::report_archive_begin):
5616         Use Library_base; call library's get_mtime; add incremental inputs
5617         entry before members.
5618         (class Unused_symbol_visitor): New class.
5619         (Incremental_inputs::report_archive_end): Use Library_base; use
5620         visitor class to record unused symbols; don't add incremental inputs
5621         entry after members.
5622         (Incremental_inputs::report_object): Use Library_base.
5623         * incremental.h
5624         (Incremental_archive_entry::Incremental_archive_entry): Remove
5625         unused Archive parameter.
5626         (Incremental_inputs::report_archive_begin): Use Library_base.
5627         (Incremental_inputs::report_archive_end): Likewise.
5628         (Incremental_inputs::report_object): Likewise.
5629         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5630         function.
5631         * object.h (Object::for_all_global_symbols): New function.
5632         (Object::do_for_all_global_symbols): New function.
5633         (Sized_relobj::do_for_all_global_symbols): New function.
5634         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5635         function.
5636         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5637         function.
5638
5639 2011-03-27  Ian Lance Taylor  <iant@google.com>
5640
5641         * archive.cc (Archive::interpret_header): Return -1 if something
5642         goes wrong.  Change callers accordingly.
5643
5644 2011-03-25  Cary Coutant  <ccoutant@google.com>
5645
5646         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5647         * testsuite/Makefile.in: Regenerate.
5648
5649 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5650
5651         * plugin.cc (get_view): New.
5652         (Plugin::load): Pass get_view to the plugin.
5653         (Plugin_manager::get_view): New.
5654
5655 2011-03-21  Ian Lance Taylor  <iant@google.com>
5656
5657         * testsuite/final_layout.sh: Rewrite to not use dc.
5658         * testsuite/relro_test.sh: Fail if dc is not present.
5659
5660 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5661
5662         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5663         Change == to -eq.
5664         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5665         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5666         Change == to -eq.
5667         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5668         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5669
5670 2011-03-14  Ian Lance Taylor  <iant@google.com>
5671
5672         * script-sections.cc (Sort_output_sections::script_compare):
5673         Rename from is_before, change return type.
5674         (Sort_output_sections::operator()): Adjust accordingly.
5675
5676 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5677
5678         PR gold/12572
5679         * testsuite/odr_violation2.cc: Add comment to make all error line
5680         numbers double digits.
5681         * testsuite/debug_msg.sh: Adjust expected errors.
5682
5683 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5684
5685         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5686         but mark earlier ones as non-canonical
5687         (offset_to_iterator): Update search target and example
5688         (do_addr2line): Return extra lines in a vector*
5689         (format_file_lineno): Extract from do_addr2line
5690         (one_addr2line): Add vector* out-param
5691         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5692         when a lineno entry appeared last for its instruction
5693         (Dwarf_line_info): Add vector* out-param
5694         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5695         * symtab.cc (Odr_violation_compare): Include the lineno in the
5696         comparison again.
5697         (linenos_from_loc): New. Combine the canonical line for an
5698         address with its other lines.
5699         (True_if_intersect): New. Helper functor to make
5700         std::set_intersection a query.
5701         (detect_odr_violations): Compare sets of lines instead of just
5702         one line for each function. This became less deterministic, but
5703         has fewer false positives.
5704         * symtab.h: Declarations.
5705         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5706         mix an optimized and non-optimized object in the same binary
5707         (odr_violation2.so): Same.
5708         * testsuite/Makefile.in: Regenerate from Makefile.am.
5709         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5710         * testsuite/debug_msg.sh: Update line numbers and add
5711         assertions.
5712         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5713         non-optimized context.
5714         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5715         isn't inlined, and use OdrDerived in an optimized context.
5716         * testsuite/odr_header1.h: Defines OdrDerived, where
5717         optimization will change the
5718         first-instruction-in-the-destructor's file and line number.
5719         * testsuite/odr_header2.h: Defines OdrBase.
5720
5721 2011-03-09  Ian Lance Taylor  <iant@google.com>
5722
5723         * fileread.cc (File_read::clear_views): Don't delete the whole
5724         file view.
5725
5726 2011-03-08  Ian Lance Taylor  <iant@google.com>
5727
5728         PR gold/12525
5729         * fileread.cc: #include <climits>.
5730         (GOLD_IOV_MAX): Define.
5731         (File_read::read_multiple): Limit number of entries by iov_max.
5732         * fileread.h (class File_read): Always set max_readv_entries to
5733         128.
5734
5735 2011-03-07  Ian Lance Taylor  <iant@google.com>
5736
5737         PR gold/12525
5738         * options.h (class General_options): Add -dy and -dn.
5739
5740 2011-03-02  Cary Coutant  <ccoutant@google.com>
5741
5742         * testsuite/script_test_9.t: Add TLS segment.
5743
5744 2011-03-02  Simon Baldwin  <simonb@google.com>
5745
5746         * configure.ac: Add check for gnu_indirect_function support in
5747         the toolchain building binutils.
5748         * configure: Rebuild.
5749
5750 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5751
5752         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5753         plugin only symbols.
5754         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5755         in plugin files as not needed in the symbol table.
5756
5757 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5758
5759         * output.cc (Output_section::add_input_section): Delay fill
5760         generation for section ordering.
5761
5762 2011-02-09  Ian Lance Taylor  <iant@google.com>
5763
5764         PR gold/12316
5765         * object.h (class Sized_relobj): Remove clear_local_symbols.
5766         * reloc.cc (Sized_relobj::do_relocate): Don't call
5767         clear_local_symbols.
5768
5769 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5770
5771         * plugin.cc (is_visible_from_outside): Return true for symbols
5772         in the -u option.
5773
5774 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5775
5776         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5777         filename.
5778
5779 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5780
5781         * icf.h (is_section_foldable_candidate): Change type of parameter
5782         to std::string.
5783         * icf.cc (Icf::find_identical_sections): Change type of local variable
5784         section_name to be std::string.
5785         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5786
5787 2011-01-25  Ian Lance Taylor  <iant@google.com>
5788
5789         * script.cc (script_add_extern): Rewrite to use
5790         add_symbol_reference.
5791
5792 2011-01-25  Doug Kwan  <dougkwan@google.com>
5793
5794         * icf.cc (get_section_contents): Always lock section's object.
5795
5796 2011-01-24  Ian Lance Taylor  <iant@google.com>
5797
5798         * options.h (class General_options): Accept
5799         --no-detect-odr-violations.
5800
5801 2011-01-24  Ian Lance Taylor  <iant@google.com>
5802
5803         * version.cc (version_string): Bump to 1.11.
5804
5805 2011-01-24  Ian Lance Taylor  <iant@google.com>
5806
5807         * plugin.cc (class Plugin_rescan): Define new class.
5808         (Plugin_manager::claim_file): Set any_claimed_.
5809         (Plugin_manager::save_archive): New function.
5810         (Plugin_manager::save_input_group): New function.
5811         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5812         necessary.
5813         (Plugin_manager::new_undefined_symbol): New function.
5814         (Plugin_manager::rescan): New function.
5815         (Plugin_manager::rescannable_defines): New function.
5816         (Plugin_manager::add_input_file): Set any_added_.
5817         * plugin.h (class Plugin_manager): define new fields rescannable_,
5818         undefined_symbols_, any_claimed_, and any_added_.  Declare
5819         Plugin_rescan as friend.  Declare new functions.
5820         (Plugin_manager::Rescannable): Define type.
5821         (Plugin_manager::Rescannable_list): Define type.
5822         (Plugin_manager::Undefined_symbol_list): Define type.
5823         (Plugin_manager::Plugin_manager): Initialize new fields.
5824         * archive.cc (Archive::defines_symbol): New function.
5825         (Add_archive_symbols::run): Pass archive to plugins if any.
5826         * archive.h (class Archive): Declare defines_symbol.
5827         * readsyms.cc (Input_group::~Input_group): New function.
5828         (Finish_group::run): Pass input_group to plugins if any.
5829         * readsyms.h (class Input_group): Declare destructor.
5830         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5831         any.
5832
5833 2011-01-10  Ian Lance Taylor  <iant@google.com>
5834
5835         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5836         section as relro.
5837         (Layout::set_segment_offsets): Reset increase_relro before calling
5838         set_section_addresses a second time.
5839
5840 2011-01-04  Cary Coutant  <ccoutant@google.com>
5841
5842         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5843         sections before NOBITS sections.
5844
5845 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5846
5847         * version.cc (print_version): Update copyright to 2011.
5848
5849 2010-12-23  Cary Coutant  <ccoutant@google.com>
5850
5851         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5852         of OS to this->add.  Add OD parameter to second form of the function.
5853
5854 2010-12-20  Ian Lance Taylor  <iant@google.com>
5855
5856         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5857         second of two consecutive entries with same offset.
5858
5859 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5860
5861         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5862         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5863         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5864         to avoid unneeded links against $(LDADD).
5865         * testsuite/Makefile.in: Regenerate.
5866
5867 2010-12-15  Ian Lance Taylor  <iant@google.com>
5868
5869         PR gold/12324
5870         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5871         for R_X86_64_32 and R_X86_64_PC32.
5872         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5873         ver_matching_def_pic.o.
5874         (ver_matching_def_pic.o): New target.
5875
5876 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5877
5878         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5879         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5880         Move definition before File_read::View member definitions.
5881         (File_read::View::~View): Initialize and hold lock before
5882         updating current_mapped_bytes.
5883
5884 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5885
5886         * dwarf_reader.cc: Remove outdated comment.
5887         * gold-threads.cc: Fix typo in error message.
5888         * archive.cc: Fix typos in comments.
5889         * archive.h: Likewise.
5890         * arm-reloc-property.cc: Likewise.
5891         * arm-reloc-property.h: Likewise.
5892         * arm-reloc.def: Likewise.
5893         * arm.cc: Likewise.
5894         * attributes.h: Likewise.
5895         * cref.cc: Likewise.
5896         * ehframe.cc: Likewise.
5897         * fileread.h: Likewise.
5898         * gold.h: Likewise.
5899         * i386.cc: Likewise.
5900         * icf.cc: Likewise.
5901         * incremental.h: Likewise.
5902         * int_encoding.cc: Likewise.
5903         * layout.h: Likewise.
5904         * main.cc: Likewise.
5905         * merge.h: Likewise.
5906         * object.cc: Likewise.
5907         * object.h: Likewise.
5908         * options.cc: Likewise.
5909         * readsyms.cc: Likewise.
5910         * reduced_debug_output.cc: Likewise.
5911         * reloc.cc: Likewise.
5912         * script-sections.cc: Likewise.
5913         * sparc.cc: Likewise.
5914         * symtab.h: Likewise.
5915         * target-reloc.h: Likewise.
5916         * target.cc: Likewise.
5917         * target.h: Likewise.
5918         * timer.cc: Likewise.
5919         * timer.h: Likewise.
5920         * x86_64.cc: Likewise.
5921
5922 2010-12-09  Cary Coutant  <ccoutant@google.com>
5923
5924         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5925         stack.
5926         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5927         parameter; change all callers.
5928         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5929         * options.h (warn_execstack): New option.
5930
5931 2010-12-07  Doug Kwan  <dougkwan@google.com>
5932
5933         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5934         like function call relocations.
5935
5936 2010-12-07  Ian Lance Taylor  <iant@google.com>
5937
5938         * archive.cc (Archive::get_elf_object_for_member): Permit
5939         punconfigured to be NULL.
5940         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5941         (Archive::include_member): Pass NULL to get_elf_object_for_member
5942         if we searched for the archive and this is the first included
5943         object.
5944
5945 2010-12-01  Ian Lance Taylor  <iant@google.com>
5946
5947         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5948         track_relocs_type_ field.
5949         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5950         Set track_relocs_type_.
5951         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5952         contents when using RELA relocs.
5953         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5954         reloc_map_.
5955         * reloc.cc (Track_relocs::next_addend): New function.
5956         * reloc.h (class Track_relocs): Declare next_addend.
5957
5958 2010-12-01  Ian Lance Taylor  <iant@google.com>
5959
5960         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5961         virtual destructor.
5962
5963 2010-12-01  Ian Lance Taylor  <iant@google.com>
5964
5965         * README: Update compilers known to work and fail.
5966
5967 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5968
5969         * configure.in: For --enable-gold, handle value `default' instead of
5970         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5971         not the default.
5972         * configure: Regenerate.
5973
5974 2010-11-18  Doug Kwan  <dougkwan@google.com>
5975
5976         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5977         and right_alignment to be zero.  Store result alignment only if it is
5978         greater than existing alignment.
5979
5980 2010-11-16  Cary Coutant  <ccoutant@google.com>
5981
5982         PR gold/12220
5983         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5984         Check for ".zdebug_line".
5985
5986 2010-11-16  Doug Kwan  <dougkwan@google.com>
5987             Cary Coutant  <ccoutant@google.com>
5988
5989         * output.h (Output_segment::set_section_addresses): Pass increase_relro
5990         by reference; adjust all callers.
5991         * output.cc (Output_segment::set_section_addresses): Adjust references
5992         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
5993         list is empty.
5994         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
5995         end at page boundary.
5996
5997 2010-11-16  Cary Coutant  <ccoutant@google.com>
5998
5999         PR gold/12220
6000         * layout.cc (Layout::choose_output_section): Transform names of
6001         compressed sections even when using a script with a SECTIONS clause.
6002         (Layout::output_section_name): Remove code to transform
6003         compressed debug section names.
6004         * output.cc (Output_section::add_input_section): Use uncompressed
6005         section size when tracking input sections.
6006
6007 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6008
6009         * symtab.h (Symbol::NON_PIC_REF): Remove.
6010         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6011         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6012         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6013         (Symbol::use_plt_offset): Take a flags argument and pass it
6014         directly to needs_dynamic_reloc.  Restrict check for undefined
6015         weak symbols to function calls.
6016         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6017         (Target_arm::Scan::global): Use it.
6018         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6019         (Target_arm::Relocate::relocate): Likewise.
6020         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6021         parameter with an r_type parameter.  Use get_reference_flags
6022         to get the flags.
6023         (Target_arm::Relocate::relocate): Update accordingly.
6024         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6025         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6026         (Target_i386::Scan::global): Likewise.
6027         (Target_i386::Relocate::relocate): Likewise.
6028         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6029         parameter with an r_type parameter.  Use get_reference_flags
6030         to get the flags.
6031         (Target_i386::Relocate::relocate): Update accordingly.
6032         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6033         (Target_powerpc::Scan::global): Use it.
6034         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6035         (Target_powerpc::Relocate::relocate): Likewise.
6036         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6037         (Target_sparc::Scan::global): Use it.
6038         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6039         (Target_sparc::Relocate::relocate): Likewise.
6040         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6041         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6042         (Target_x86_64::Scan::global): Likewise.
6043         (Target_x86_64::Relocate::relocate): Likewise.
6044
6045 2010-11-08  Doug Kwan  <dougkwan@google.com>
6046             Cary Coutant  <ccoutant@google.com>
6047
6048         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6049         (Arm_exidx_merge_section::section_contents_): New data member.
6050         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6051         (Arm_input_section::~Arm_input_section): De-allocate memory.
6052         (Arm_input_section::original_contents_): New data member.
6053         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6054         in parameters instead of calling Object::section_contents without
6055         locking.
6056         (Arm_output_section::group_section): New parameter TASK.  Pass it
6057         to callees that need locking objects.
6058         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6059         to lock EXIDX input sections.  Fix a formatting issue.  Call
6060         Arm_exidx_merged_section::build_contents to create merged section
6061         contents.
6062         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6063         to lock object of stub table owner.
6064         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6065         TEXT_SIZE to initialize data member TEXT_SIZE_.
6066         (Arm_exidx_input_section::addralign): Fix typo in comment.
6067         (Arm_exidx_input_section::text_size): New method.
6068         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6069         that require locking objects.  Lock objects before scanning for stubs
6070         and updating local symbols.
6071         (Arm_input_section<big_endian>::init): Copy contents of original
6072         input section.
6073         (Arm_input_section<big_endian>::do_write): Use saved contents of
6074         original input section instead of calling Object::section_contents
6075         without locking.
6076         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6077         size without calling Object::section_size().
6078         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6079         for size.  Allocate a buffer for merged EXIDX entries.
6080         (Arm_exidx_merged_section::build_contents): New method.
6081         (Arm_exidx_merged_section::do_write): Move merge section contents
6082         building code to Arm_exidx_merged_section::build_contetns.  Write
6083         out contetns in buffer instead of building it on the fly.
6084         (Arm_relobj::make_exidx_input_section): Also pass text section size
6085         to Arm_exidx_input_section constructor.
6086         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6087         (Arm_dynobj::do_read_symbols): Fix memory leak.
6088         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6089         * target.h: (class Task): Add forward declaration.
6090         (Target::relax): Add new parameter TASK and pass it to
6091         Target::do_relax().
6092         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6093
6094 2010-11-05  Cary Coutant  <ccoutant@google.com>
6095
6096         PR gold/10708
6097         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6098         object when reading from the file.
6099         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6100         second layout pass.
6101         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6102         when reading section contents.
6103         (get_section_contents): Likewise.
6104         (icf::find_identical_sections): Likewise.
6105         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6106         object when reading from the file.
6107         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6108         the object when doing deferred section layout.
6109
6110 2010-11-03  Nick Clifton  <nickc@redhat.com>
6111
6112         PR gold/12001
6113         * script.h (class Symbol_assignment: name): New member.  Returns
6114         the name of the symbol.
6115         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6116         Returns true if the given symbol name is on the list of
6117         assignments wating to be processed.
6118         * archive.cc (should_incldue_member): If the symbol is undefined,
6119         check to see if it is on the list of symbols pending assignment.
6120
6121 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6122
6123         * script-sections.cc (Script_sections::find_memory_region): Check
6124         for a NULL output section pointer.
6125
6126 2010-10-29  Doug Kwan  <dougkwan@google.com>
6127
6128         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6129         Output_section::add_relaxed_input_section.
6130         * output.cc (Output_section::add_relaxed_input_section): Add new
6131         arguments LAYOUT and NAME.  Set section order index.
6132         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6133         Copy section order index.
6134         * output.h (Output_section::add_relaxed_input_section): Add new
6135         arguments LAYOUT and NAME.
6136
6137 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6138
6139         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6140         NATIVE_OR_CROSS_LINKER.
6141         * testsuite/Makefile.in: Regenerate.
6142
6143 2010-10-20  Doug Kwan  <dougkwan@google.com>
6144
6145         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6146         without SHF_LINK_ORDER flags.
6147         * layout.cc (Layout::choose_output_section): Do not filter
6148         SHF_LINK_ORDER flag in a relocatable link.
6149
6150 2010-10-17  Cary Coutant  <ccoutant@google.com>
6151
6152         * output.h (Output_segment::set_section_addresses): Change function
6153         signature.  Update all callers.
6154         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6155         sections.
6156         (Output_segment::set_section_addresses): Align after last TLS
6157         section.  Add padding before last relro section instead of after.
6158
6159 2010-10-17  Doug Kwan  <dougkwan@google.com>
6160
6161         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6162         GOT output section to be writable.
6163
6164 2010-10-14  Cary Coutant  <ccoutant@google.com>
6165
6166         * debug.h (DEBUG_INCREMENTAL): New flag.
6167         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6168         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6169         mode.
6170         * incremental.cc (report_command_line): Ignore all forms of
6171         --incremental.
6172         * layout.cc (Layout::Layout): Check parameters for incremental link
6173         mode.
6174         * options.cc (General_options::parse_incremental): New function.
6175         (General_options::parse_no_incremental): New function.
6176         (General_options::parse_incremental_full): New function.
6177         (General_options::parse_incremental_update): New function.
6178         (General_options::incremental_mode_): New data member.
6179         (General_options::finalize): Check incremental_mode_.
6180         * options.h (General_options): Update help text for --incremental.
6181         Add --no-incremental, --incremental-full, --incremental-update.
6182         (General_options::Incremental_mode): New enum type.
6183         (General_options::incremental_mode): New function.
6184         (General_options::incremental_mode_): New data member.
6185         * parameters.cc (Parameters::incremental_mode_): New data member.
6186         (Parameters::set_options): Set incremental_mode_.
6187         (Parameters::set_incremental_full): New function.
6188         (Parameters::incremental): New function.
6189         (Parameters::incremental_update): New function.
6190         (set_parameters_incremental_full): New function.
6191         * parameters.h (Parameters::set_incremental_full): New function.
6192         (Parameters::incremental): New function.
6193         (Parameters::incremental_update): New function.
6194         (Parameters::incremental_mode_): New data member.
6195         (set_parameters_incremental_full): New function.
6196         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6197         incremental link mode.
6198         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6199         (Sized_relobj::do_relocate_sections): Likewise.
6200         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6201         option.
6202         * testsuite/Makefile.in: Regenerate.
6203         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6204
6205 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6206
6207         * script-sections.h (class Script_sections): Make
6208         Sections_elements typedef public.
6209         * script-sections.cc (class Sort_output_sections): Add elements_
6210         field.  Add constructor which sets it; change all callers.
6211         (Sort_output_sections::is_before): New function.
6212         (Sort_output_sections::operator()): Call is_before.
6213         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6214         conditional.
6215         * testsuite/script_test_10.sh: New test. Test script section
6216         order.
6217         * testsuite/script_test_10.t: Likewise.
6218         * testsuite/script_test_10.s: Likewise.
6219         * testsuite/Makefile.am: Wrap the cross linker tests and the
6220         common tests into NATIVE_OR_CROSS_LINKER.
6221         (check_SCRIPTS): Add script_test_10.sh.
6222         (check_DATA): Add script_test_10.stdout.
6223         (script_test_10.o, script_test_10): New targets.
6224         (script_test_10.stdout): New target.
6225         * configure, testsuite/Makefile.in: Regenerate.
6226
6227 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6228
6229         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6230         error for the deprecated relocations.
6231         (Target_arm::Scan::global): Likewise.
6232         (Target_arm::Relocate::relocate): Likewise.
6233
6234 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6235
6236         * fileread.cc (Input_file::find_file): Initialize *found_name
6237         and *namep when using the fallback search for case 4.
6238
6239 2010-10-11  Cary Coutant  <ccoutant@google.com>
6240
6241         * options.h (class General_options): Redefine -z lazy as an alias for
6242         the negation of -z now.
6243
6244 2010-10-11  Ian Lance Taylor  <iant@google.com>
6245
6246         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6247         binding.
6248
6249 2010-10-06  Nick Clifton  <nickc@redhat.com>
6250
6251         * script-sections.cc(class Memory_region): Remove
6252         current_lma_offset_ field.  Rename current_vma_offset_ to
6253         current_offset_.  Add last_section_ field.
6254         (Memory_region::get_current_vma_address): Rename to
6255         get_current_address.
6256         (Memory_region::get_current_lma_address): Delete.
6257         (Memory_region::increment_vma_offset): Rename to
6258         increment_offset.
6259         (Memory_region::increment_lma_offset): Delete.
6260         (Memory_region::attributes_compatible): New method.  Returns
6261         true if the provided section is compatible with the region.
6262         (Memory_region::get_last_section): New method.  Returns the last
6263         section to use the region.
6264         (Memory_region::set_last_section): New method.  Stores the last
6265         section to use the region.
6266         (Script_sections::block_in_region): New method.  Returns true if
6267         a block of memory is contained within a region.
6268         (Script_sections::find_memory_region): New method.  Locates a
6269         memory region to be used to set a VMA or LMA address.
6270         (Output_section_definition::set_section_addresses): Add code to
6271         check for addresses set by memory regions.
6272         (Output_segment::set_section_addresses): Remove memory region
6273         walking code.
6274         (Script_sections::create_segment): Add a warning if a header
6275         segment is created outside of any region.
6276         * script-sections.h (class Script_sections): Add prototypes for
6277         find_memory_region and block_in_region methods.
6278         * testsuite/memory_test.s: Use .long instead of .word.
6279         * testsuite/memory_test.t: Add some more output sections.
6280         * testsuite/memory_test.sh: Update expected output.
6281
6282 2010-10-02  Doug Kwan  <dougkwan@google.com>
6283
6284         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6285         defintion to symtab.h
6286         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6287         declaration to defintion.
6288
6289 2010-10-01  Nick Clifton  <nickc@redhat.com>
6290
6291         * expression.cc (eval): Replace dummy argument with NULL.
6292         (eval_maybe_dot): Check for a NULL result section pointer.
6293         (Symbol_expression::value): Likewise.
6294         (Dot_expression::value): Likewise.
6295         (BINARY_EXPRESSION): Likewise.
6296         (Max_expression::value): Likewise.
6297         (Min_expression::value): Likewise.
6298         (Absolute_expression::value): Likewise.
6299         (Addr_expression::value_from_output_section): Likewise.
6300         (Loaddddr_expression::value_from_output_section): Likewise.
6301         (Segment_start_expression::value): Likewise.
6302         * script-sections.cc
6303         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6304         argument with NULL.
6305         (Sections_elememt_dot_assignment::set_section_addresses):
6306         Likewise.
6307         (Output_data_expression::do_write_to_buffer): Likewise.
6308         (Output_section_definition::finalize_symbols): Likewise.
6309         (Output_section_definition::set_section_addresses): Likewise.
6310
6311 2010-09-30  Doug Kwan  <dougkwan@google.com>
6312
6313         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6314
6315 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6316
6317         * target.h (Target::can_icf_inline_merge_sections): New virtual
6318         function.
6319         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6320         virtual function.
6321         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6322         virtual function.
6323         * icf.cc (get_section_contents): Inline merge sections only when
6324         target allows it.
6325
6326 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6327
6328         * configure: Regenerate.
6329
6330 2010-09-17  Ian Lance Taylor  <iant@google.com>
6331
6332         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6333         * testsuite/Makefile.am (memory_test.o): New target.
6334         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6335         memory_test.t.
6336         * testsuite/Makefile.in: Rebuild.
6337
6338 2010-09-17  Doug Kwan  <dougkwan@google.com>
6339
6340         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6341         defintion if relocation uses GOT entries of the symbol.
6342         * testsuite/icf_safe_test.sh: Fix test.
6343         * testsuite/icf_safe_so_test.sh: Fix test.
6344
6345 2010-09-16  Cary Coutant  <ccoutant@google.com>
6346
6347         * script_sections.cc (class Memory_region): Remove "NULL" from
6348         vector initializations.
6349
6350 2010-09-15  Cary Coutant  <ccoutant@google.com>
6351
6352         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6353         Resolve forwarding symbols.
6354
6355 2010-09-15  Doug Kwan  <dougkwan@google.com>
6356
6357         * gold/testsuite/script_test_3.t: Add ARM special sections.
6358         * gold/testsuite/script_test_4.t: Same.
6359         * gold/testsuite/script_test_5.t: Same.
6360         * gold/testsuite/script_test_6.t: Same.
6361         * gold/testsuite/script_test_7.t: Same.
6362         * gold/testsuite/script_test_7.t: Same.
6363         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6364
6365 2010-09-14  Cary Coutant  <ccoutant@google.com>
6366
6367         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6368         (Target_x86_64::Relocate::relocate_tls): Replace check for
6369         saw_tls_block_reloc_ with test for executable section.
6370
6371 2010-09-12  Cary Coutant  <ccoutant@google.com>
6372
6373         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6374         position-independent executables to shared libraries need dynamic
6375         relocations.
6376         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6377         position-independent executables.
6378         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6379         * testsuite/Makefile.in: Regenerate.
6380
6381 2010-09-10  Nick Clifton  <nickc@redhat.com>
6382
6383         PR gold/11997
6384         * testsuite/memory_test.t: Discard any sections that are not
6385         needed.
6386
6387 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6388
6389         PR gold/11996
6390         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6391         "This::" to work around a bug in gcc 4.2.
6392
6393         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6394
6395 2010-09-09  Rafael Espindola  <espindola@google.com>
6396
6397         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6398         sections with different PF_X flags in the same segment.
6399         (Layout::find_first_load_seg): Search all segments to find the first
6400         one.
6401         * options.h (rosegment): New.
6402
6403 2010-09-08  Rafael Espindola  <espindola@google.com>
6404
6405         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6406
6407 2010-09-08  Doug Kwan  <dougkwan@google.com>
6408
6409         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6410         (Arm_relobj::do_relocate_sections): Add new parameter for output
6411         file to match the parent.
6412         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6413         of local symbols instead of input values.  Update code to track
6414         changes in gold::relocate_section.
6415         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6416         (Sized_relobj::compute_final_local_value_internal): New methods.
6417         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6418         body into private version of Sized_relobj::compute_final_local_value.
6419         Call the inline method.
6420         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6421         merged symbol value if there is one.
6422         (Symbol_value::has_output_value): New method defintiion.
6423         (Sized_relobj::Compute_final_local_value_status): New enum type.
6424         (Sized_relobj::compute_final_local_value): New methods.
6425         (Sized_relobj::compute_final_local_value_internal): New methods.
6426         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6427         and arm_cortex_a8.sh.
6428         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6429         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6430         New tests.
6431         * Makefile.in: Regenerate.
6432         * testsuite/arm_bl_out_of_range.s: Update test.
6433         * testsuite/thumb_bl_out_of_range.s: Ditto.
6434         * testsuite/thumb_blx_out_of_range.s: Ditto.
6435         * testsuite/arm_branch_out_of_range.sh: New file.
6436         * testsuite/arm_cortex_a8.sh: Ditto.
6437         * testsuite/arm_cortex_a8_b.s: Ditto.
6438         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6439         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6440         * testsuite/arm_cortex_a8_bl.s: Ditto.
6441         * testsuite/arm_cortex_a8_blx.s: Ditto.
6442         * testsuite/arm_cortex_a8_local.s: Ditto.
6443         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6444         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6445
6446 2010-09-08  Rafael Espindola  <espindola@google.com>
6447
6448         * Makefile.am (memory_test.stdout): Run readelf with -W.
6449         * Makefile.in: Regenerate.
6450         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6451         64 bit output.
6452
6453 2010-09-08  Rafael Espindola  <espindola@google.com>
6454
6455         * script-sections.cc (Script_sections::add_memory_region): Convert
6456         field precision to int.
6457         * script.cc (script_set_section_region, script_set_section_region):
6458         Convert field precision to int.
6459
6460 2010-09-08  Rafael Espindola  <espindola@google.com>
6461
6462         * arm.cc (do_finalize_sections): Create the __exidx_start and
6463         __exdix_end symbols even when the section is missing.
6464
6465 2010-09-08  Nick Clifton  <nickc@redhat.com>
6466
6467         * README: Remove claim that MEMORY is not supported.
6468         * expression.cc (script_exp_function_origin)
6469         (script_exp_function_length): Move from here to ...
6470         * script.cc: ... here.
6471         (script_set_section_region, script_add_memory)
6472         (script_parse_memory_attr, script_include_directive): New
6473         functions.
6474         * script-sections.cc
6475         (class Memory_region): New class.
6476         (class Output_section_definition): Add set_memory_region,
6477         set_section_vma, set_section_lma and get_section_name methods.
6478         (class Script_Sections): Add add_memory_region,
6479         find_memory_region, find_memory_region_origin,
6480         find_memory_region_length and set_memory_region methods.
6481         Have set_section_addresses method walk the list of set memory
6482         regions.
6483         Extend the print methos to display memory regions.
6484         * script-sections.h: Add prototypes for new methods.
6485         Add enum for MEMORY region attributes.
6486         * yyscript.y: Add support for parsing MEMORY regions.
6487         * script-c.h: Add prototypes for new functions.
6488         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6489         * testsuite/Makefile.in: Regenerate.
6490         * testsuite/memory_test.sh: New script.
6491         * testsuite/memory_test.s: New assembler source file.
6492         * testsuite/memory_test.t: New linker script.
6493
6494 2010-08-27  Doug Kwan  <dougkwan@google.com>
6495
6496         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6497         reference override an existing dynamic weak reference.
6498         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6499         * testsuite/Makefile.in: Regenerate.
6500         * testsuite/dyn_weak_ref.sh: New file.
6501         * testsuite/dyn_weak_ref_1.c: Ditto.
6502         * testsuite/dyn_weak_ref_2.c: Ditto.
6503
6504 2010-08-27  Ian Lance Taylor  <iant@google.com>
6505
6506         * incremental.h (class Incremental_input_entry): Add virtual
6507         destructor.
6508
6509 2010-08-27  Ian Lance Taylor  <iant@google.com>
6510
6511         * testsuite/start_lib_test_3.c: Mark t3 as used.
6512
6513 2010-08-27  Nick Clifton  <nickc@redhat.com>
6514
6515         * options.cc (version_script): Fix small typo in previous
6516         whitespace tidyup.
6517
6518 2010-08-25  Nick Clifton  <nickc@redhat.com>
6519
6520         * archive.cc: Formatting fixes: Remove whitespace between
6521         typename and following asterisk.  Remove whitespace between
6522         function name and opening parenthesis.
6523         * archive.h: Likewise.
6524         * arm.cc: Likewise.
6525         * attributes.cc: Likewise.
6526         * attributes.h: Likewise.
6527         * common.cc: Likewise.
6528         * copy-relocs.cc: Likewise.
6529         * dirsearch.h: Likewise.
6530         * dynobj.cc: Likewise.
6531         * ehframe.cc: Likewise.
6532         * ehframe.h: Likewise.
6533         * expression.cc: Likewise.
6534         * fileread.cc: Likewise.
6535         * fileread.h: Likewise.
6536         * gc.h: Likewise.
6537         * gold-threads.cc: Likewise.
6538         * gold.cc: Likewise.
6539         * i386.cc: Likewise.
6540         * icf.h: Likewise.
6541         * incremental-dump.cc: Likewise.
6542         * incremental.cc: Likewise.
6543         * layout.cc: Likewise.
6544         * layout.h: Likewise.
6545         * main.cc: Likewise.
6546         * merge.cc: Likewise.
6547         * merge.h: Likewise.
6548         * object.cc: Likewise.
6549         * object.h: Likewise.
6550         * options.cc: Likewise.
6551         * options.h: Likewise.
6552         * output.cc: Likewise.
6553         * output.h: Likewise.
6554         * plugin.cc: Likewise.
6555         * plugin.h: Likewise.
6556         * powerpc.cc: Likewise.
6557         * reloc.cc: Likewise.
6558         * script-c.h: Likewise.
6559         * script-sections.cc: Likewise.
6560         * script.cc: Likewise.
6561         * stringpool.cc: Likewise.
6562         * symtab.cc: Likewise.
6563         * symtab.h: Likewise.
6564         * target.cc: Likewise.
6565         * timer.cc: Likewise.
6566         * timer.h: Likewise.
6567         * version.cc: Likewise.
6568         * x86_64.cc: Likewise.
6569
6570 2010-08-24  Nick Clifton  <nickc@redhat.com>
6571
6572         PR 11899
6573         * layout.cc (segment_precedes): Sort segments by their physical
6574         addresses, if they have been set.
6575
6576 2010-08-23  Cary Coutant  <ccoutant@google.com>
6577
6578         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6579         symbols data.
6580         (Lib_group::include_member): Unlock object after deleting its
6581         symbols data.
6582         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6583         the bug fixed here.
6584
6585 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6586             Cary Coutant  <ccoutant@google.com>
6587
6588         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6589         constructor, and set_blocker.
6590         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6591         readsyms_blocker_.
6592         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6593         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6594         * testsuite/Makefile.am (start_lib_test): New test case.
6595         * testsuite/Makefile.in: Regenerate.
6596         * testsuite/start_lib_test_main.c: New file.
6597         * testsuite/start_lib_test_1.c: New file.
6598         * testsuite/start_lib_test_2.c: New file.
6599         * testsuite/start_lib_test_3.c: New file.
6600
6601 2010-08-19  Ian Lance Taylor  <iant@google.com>
6602
6603         * Makefile.in: Rebuild with automake 1.11.1.
6604         * aclocal.m4: Likewise.
6605         * testsuite/Makefile.in: Likewise.
6606
6607 2010-08-19  Ian Lance Taylor  <iant@google.com>
6608
6609         PR 10893
6610         * i386.cc (class Output_data_plt_i386): Update declarations.
6611         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6612         local_ifuncs_ fields.
6613         (Target_i386::do_plt_section_for_global): New function.
6614         (Target_i386::do_plt_section_for_local): New function.
6615         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6616         parameter; change all callers.  Initialize global_ifuncs_ and
6617         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6618         __rel_iplt_end.
6619         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6620         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6621         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6622         symbols.
6623         (Target_i386::make_plt_section): New function, broken out of
6624         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6625         (Target_i386::make_plt_entry): Call make_plt_section.
6626         (Target_i386::make_local_ifunc_plt_entry): New function.
6627         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6628         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6629         R_386_IRELATIVE to switch.
6630         (Target_i386::Scan::global): Likewise.
6631         (Target_i386::Relocate::relocate): Likewise.
6632         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6633         switch.
6634         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6635         (Target_x86_64::do_plt_section_for_global): New function.
6636         (Target_x86_64::do_plt_section_for_local): New function.
6637         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6638         parameter; change all callers.  If doing a static link define
6639         __rela_iplt_start and __rela_iplt_end.
6640         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6641         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6642         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6643         to point to .plt.
6644         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6645         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6646         switch.
6647         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6648         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6649         R_X86_64_IRELATIVE to switch.
6650         (Target_x86_64::Scan::global): Likewise.
6651         (Target_x86_64::Relocate::relocate): Likewise.
6652         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6653         switch.
6654         * target.h (class Target): Add plt_section_for_global and
6655         plt_section_for_local functions.  Add do_plt_section_for_global
6656         and do_plt_section_for_local virtual functions.
6657         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6658         clarifying comments.
6659         (Symbol::use_plt_offset): Handle IFUNC symbol.
6660         * object.cc (Sized_relobj::Sized_relobj): Initialize
6661         local_plt_offsets_.
6662         (Sized_relobj::local_has_plt_offset): New function.
6663         (Sized_relobj::local_plt_offset): New function.
6664         (Sized_relobj::set_local_plt_offset): New function.
6665         (Sized_relobj::do_count): Handle IFUNC symbol.
6666         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6667         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6668         is_ifunc_symbol functions.
6669         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6670         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6671         local_plt_offsets_ field.
6672         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6673         * output.h (class Output_section_data): Add non-const
6674         output_section function.
6675         (class Output_data_got): Update declarations.
6676         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6677         Add use_plt_offset parameter to global and local constructors.
6678         Change all callers.  Change local_sym_index_ field to 31 bits.
6679         Change GSYM_CODE and CONSTANT_CODE accordingly.
6680         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6681         doing a static link don't set sh_link field.
6682         (Output_data_got::Got_entry::write): Use PLT offset if
6683         appropriate.
6684         (Output_data_got::add_global_plt): New function.
6685         (Output_data_got::add_local_plt): New function.
6686         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6687         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6688         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6689         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6690         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6691         IFUNC conditional.
6692         * testsuite/ifunc-sel.h: New file.
6693         * testsuite/ifuncmain1.c: New file.
6694         * testsuite/ifuncmain1vis.c: New file.
6695         * testsuite/ifuncmod1.c: New file.
6696         * testsuite/ifuncdep2.c: New file.
6697         * testsuite/ifuncmain2.c: New file.
6698         * testsuite/ifuncmain3.c: New file.
6699         * testsuite/ifuncmod3.c: New file.
6700         * testsuite/ifuncmain4.c: New file.
6701         * testsuite/ifuncmain5.c: New file.
6702         * testsuite/ifuncmod5.c: New file.
6703         * testsuite/ifuncmain6pie.c: New file.
6704         * testsuite/ifuncmod6.c: New file.
6705         * testsuite/ifuncmain7.c: New file.
6706         * configure, testsuite/Makefile.in: Rebuild.
6707
6708 2010-08-18  Ian Lance Taylor  <iant@google.com>
6709
6710         * incremental.cc
6711         (Output_section_incremental_inputs::write_input_files): Add cast
6712         to avoid signed/unsigned comparison warning.
6713         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6714
6715 2010-08-12  Cary Coutant  <ccoutant@google.com>
6716
6717         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6718
6719 2010-08-13  Ian Lance Taylor  <iant@google.com>
6720
6721         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6722
6723 2010-08-12  Cary Coutant  <ccoutant@google.com>
6724             Doug Kwan  <dougkwan@google.com>
6725
6726         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6727         defintion overrides non-weak undef, remember that the original undef
6728         is not weak.
6729         * symtab.cc (Symbol_table::sized_write_global): For undef without
6730         an original weak binding, set binding to global in output.
6731         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6732         * testsuite/Makefile.in: Regenerate.
6733         * testsuite/strong_ref_weak_def.sh: New file.
6734         * testsuite/strong_ref_weak_def_1.c: Ditto.
6735         * testsuite/strong_ref_weak_def_2.c: Ditto.
6736
6737 2010-08-12  Cary Coutant  <ccoutant@google.com>
6738
6739         * testsuite/incremental_test.sh: Rewrite.
6740         * testsuite/incremental_test_1.c: Rewrite.
6741         * testsuite/incremental_test_2.c: Rewrite.
6742
6743 2010-08-12  Cary Coutant  <ccoutant@google.com>
6744
6745         * arm.cc (Target_arm::got_size): Add const.
6746         (Target_arm::got_entry_count): New function.
6747         (Target_arm::plt_entry_count): New function.
6748         (Target_arm::first_plt_entry_offset): New function.
6749         (Target_arm::plt_entry_size): New function.
6750         (Output_data_plt_arm::entry_count): New function.
6751         (Output_data_plt_arm::first_plt_entry_offset): New function.
6752         (Output_data_plt_arm::get_plt_entry_size): New function.
6753         * i386.cc (Target_i386::got_size): Add const.
6754         (Target_i386::got_entry_count): New function.
6755         (Target_i386::plt_entry_count): New function.
6756         (Target_i386::first_plt_entry_offset): New function.
6757         (Target_i386::plt_entry_size): New function.
6758         (Output_data_plt_i386::entry_count): New function.
6759         (Output_data_plt_i386::first_plt_entry_offset): New function.
6760         (Output_data_plt_i386::get_plt_entry_size): New function.
6761         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6762         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6763         * incremental.cc: Include target.h.
6764         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6765         parameter.  Adjust all callers.  Find incremental_got_plt section.
6766         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6767         section.
6768         (Output_section_incremental_inputs::set_final_data_size): Calculate
6769         size of incremental_got_plt section.
6770         (Output_section_incremental_inputs::do_write): Write the
6771         incremental_got_plt section.
6772         (Got_plt_view_info): New struct.
6773         (Local_got_offset_visitor): New class.
6774         (Global_got_offset_visitor): New class.
6775         (Global_symbol_visitor_got_plt): New class.
6776         (Output_section_incremental_inputs::write_got_plt): New function.
6777         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6778         Add parameter.  Adjust all callers.
6779         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6780         (Incremental_inputs::got_plt_section): New function.
6781         (Incremental_inputs::got_plt_section_): New data member.
6782         (Incremental_got_plt_reader): New class.
6783         * layout.cc (Layout::create_incremental_info_sections): Add the
6784         incremental_got_plt section.
6785         * object.h (Got_offset_list::get_list): New function.
6786         (Got offset_list::for_all_got_offsets): New function.
6787         (Sized_relobj::local_got_offset_list): New function.
6788         * powerpc.cc (Target_powerpc::got_size): Add const.
6789         (Target_powerpc::got_entry_count): New function.
6790         (Target_powerpc::plt_entry_count): New function.
6791         (Target_powerpc::first_plt_entry_offset): New function.
6792         (Target_powerpc::plt_entry_size): New function.
6793         (Output_data_plt_powerpc::entry_count): New function.
6794         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6795         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6796         * sparc.cc (Target_sparc::got_size): Add const.
6797         (Target_sparc::got_entry_count): New function.
6798         (Target_sparc::plt_entry_count): New function.
6799         (Target_sparc::first_plt_entry_offset): New function.
6800         (Target_sparc::plt_entry_size): New function.
6801         (Output_data_plt_sparc::entry_count): New function.
6802         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6803         (Output_data_plt_sparc::get_plt_entry_size): New function.
6804         * symtab.h (Symbol::got_offset_list): New function.
6805         (Symbol_table::for_all_symbols): New function.
6806         * target.h (Sized_target::got_entry_count): New function.
6807         (Sized_target::plt_entry_count): New function.
6808         (Sized_target::plt_entry_size): New function.
6809         * x86_64.cc (Target_x86_64::got_size): Add const.
6810         (Target_x86_64::got_entry_count): New function.
6811         (Target_x86_64::plt_entry_count): New function.
6812         (Target_x86_64::first_plt_entry_offset): New function.
6813         (Target_x86_64::plt_entry_size): New function.
6814         (Output_data_plt_x86_64::entry_count): New function.
6815         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6816         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6817
6818 2010-08-12  Cary Coutant  <ccoutant@google.com>
6819
6820         * archive.cc: Include incremental.h.
6821         (Archive::Archive): Initialize incremental_info_.
6822         (Archive::include_member): Record archive members in incremental info.
6823         (Add_archive_symbols::run): Record begin and end of an archive in
6824         incremental info.
6825         (Lib_group::include_member): Record objects in incremental info.
6826         * archive.h (Incremental_archive_entry): Forward declaration.
6827         (Archive::set_incremental_info): New member function.
6828         (Archive::incremental_info): New member function.
6829         (Archive::Unused_symbol_iterator): New class.
6830         (Archive::unused_symbols_begin): New member function.
6831         (Archive::unused_symbols_end): New member function.
6832         (Archive::incremental_info_): New data member.
6833         * incremental-dump.cc (find_input_containing_global): New function.
6834         (dump_incremental_inputs): Dump new incremental info sections.
6835         * incremental.cc: Include symtab.h.
6836         (Output_section_incremental_inputs): New class.
6837         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6838         new incremental info sections.
6839         (Sized_incremental_binary::do_check_inputs): Likewise.
6840         (Incremental_inputs::report_archive): Remove.
6841         (Incremental_inputs::report_archive_begin): New function.
6842         (Incremental_inputs::report_archive_end): New function.
6843         (Incremental_inputs::report_object): New function.
6844         (Incremental_inputs::finalize_inputs): Remove.
6845         (Incremental_inputs::report_input_section): New function.
6846         (Incremental_inputs::report_script): Rewrite.
6847         (Incremental_inputs::finalize): Do nothing but finalize string table.
6848         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6849         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6850         (Incremental_inputs::create_data_sections): New function.
6851         (Incremental_inputs::relocs_entsize): New function.
6852         (Output_section_incremental_inputs::set_final_data_size): New function.
6853         (Output_section_incremental_inputs::do_write): New function.
6854         (Output_section_incremental_inputs::write_header): New function.
6855         (Output_section_incremental_inputs::write_input_files): New function.
6856         (Output_section_incremental_inputs::write_info_blocks): New function.
6857         (Output_section_incremental_inputs::write_symtab): New function.
6858         * incremental.h (Incremental_script_entry): Forward declaration.
6859         (Incremental_object_entry): Forward declaration.
6860         (Incremental_archive_entry): Forward declaration.
6861         (Incremental_inputs): Forward declaration.
6862         (Incremental_inputs_header_data): Remove.
6863         (Incremental_inputs_header): Remove.
6864         (Incremental_inputs_header_write): Remove.
6865         (Incremental_inputs_entry_data): Remove.
6866         (Incremental_inputs_entry): Remove.
6867         (Incremental_inputs_entry_write): Remove.
6868         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6869         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6870         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6871         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6872         Likewise.
6873         (Incremental_input_entry): New class.
6874         (Incremental_script_entry): New class.
6875         (Incremental_object_entry): New class.
6876         (Incremental_archive_entry): New class.
6877         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6878         (Incremental_inputs::report_inputs): Remove.
6879         (Incremental_inputs::report_archive): Remove.
6880         (Incremental_inputs::report_archive_begin): New function.
6881         (Incremental_inputs::report_archive_end): New function.
6882         (Incremental_inputs::report_object): Change prototype.
6883         (Incremental_inputs::report_input_section): New function.
6884         (Incremental_inputs::report_script): Change prototype.
6885         (Incremental_inputs::get_reloc_count): New function.
6886         (Incremental_inputs::set_reloc_count): New function.
6887         (Incremental_inputs::create_data_sections): New function.
6888         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6889         (Incremental_inputs::inputs_section): New function.
6890         (Incremental_inputs::symtab_section): New function.
6891         (Incremental_inputs::relocs_section): New function.
6892         (Incremental_inputs::get_stringpool): Add const.
6893         (Incremental_inputs::command_line): Add const.
6894         (Incremental_inputs::inputs): Remove.
6895         (Incremental_inputs::command_line_key): New function.
6896         (Incremental_inputs::input_file_count): New function.
6897         (Incremental_inputs::input_files): New function.
6898         (Incremental_inputs::relocs_entsize): New function.
6899         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6900         (Incremental_inputs::finalize_inputs): Remove.
6901         (Incremental_inputs::Input_info): Remove.
6902         (Incremental_inputs::lock_): Remove.
6903         (Incremental_inputs::inputs_): Change type.
6904         (Incremental_inputs::inputs_map_): Remove.
6905         (Incremental_inputs::current_object_entry_): New data member.
6906         (Incremental_inputs::inputs_section_): New data member.
6907         (Incremental_inputs::symtab_section_): New data member.
6908         (Incremental_inputs::relocs_section_): New data member.
6909         (Incremental_inputs::reloc_count_): New data member.
6910         (Incremental_inputs_reader): New class.
6911         (Incremental_symtab_reader): New class.
6912         (Incremental_relocs_reader): New class.
6913         * layout.cc (Layout::finalize): Move finalization of incremental info
6914         and creation of incremental info sections to follow finalization of
6915         symbol table.  Set offsets for postprocessing sections.
6916         (Layout::create_incremental_info_sections): Call
6917         Incremental_inputs::create_data_sections.  Add incremental symtab
6918         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6919         sections to layout after input sections.
6920         * layout.h (struct Timespec): Forward declaration.
6921         (Layout::incremental_inputs): Add const.
6922         (Layout::create_incremental_info_sections): Add parameter.
6923         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6924         * object.cc: Include incremental.h.
6925         (Relobj::finalize_incremental_relocs): New function.
6926         (Sized_relobj::do_layout): Record input sections in incremental info.
6927         * object.h (Object::output_section): New function.
6928         (Object::output_section_offset): Moved from Relobj.
6929         (Object::get_incremental_reloc_base): New function.
6930         (Object::get_incremental_reloc_count): New function.
6931         (Object::do_output_section): New function.
6932         (Object::do_output_section_offset): Moved from Relobj.
6933         (Object::do_get_incremental_reloc_base): New function.
6934         (Object::do_get_incremental_reloc_count): New function.
6935         (Object::Object): Initialize new data members.
6936         (Relobj::output_section): Renamed do_output_section and moved to
6937         protected.
6938         (Relobj::output_section_offset): Moved to Object.
6939         (Relobj::do_get_incremental_reloc_base): New function.
6940         (Relobj::do_get_incremental_reloc_count): New function.
6941         (Relobj::allocate_incremental_reloc_counts): New function.
6942         (Relobj::count_incremental_reloc): New function.
6943         (Relobj::finalize_incremental_relocs): New function.
6944         (Relobj::next_incremental_reloc_index): New function.
6945         (Relobj::reloc_counts_): New data member.
6946         (Relobj::reloc_bases_): New data member.
6947         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6948         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6949         (Sized_relobj::incremental_relocs_scan): New function.
6950         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6951         (Sized_relobj::incremental_relocs_write): New function.
6952         (Sized_relobj::incremental_relocs_write_reltype): New function.
6953         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6954         incremental link.
6955         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6956         archives and object files elsewhere.
6957         (Add_symbols::run): Report object files here.
6958         (Finish_group::run): Report end of archive at end of group.
6959         * reloc.cc: Include layout.h, incremental.h.
6960         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6961         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6962         (Sized_relobj::incremental_relocs_scan): New function.
6963         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6964         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6965         (Sized_relobj::incremental_relocs_write): New function.
6966         (Sized_relobj::incremental_relocs_write_reltype): New function.
6967         * script.cc (read_input_script): Rewrite test for incremental link.
6968         Change call to Incremental_inputs::report_script.
6969         * symtab.h (Symbol_table::first_global_index): New function.
6970         (Symbol_table::output_count): New function.
6971
6972 2010-08-12  Doug Kwan  <dougkwan@google.com>
6973
6974         * arm.cc (Target_arm::merge_object_attributes): Check command line
6975         options --no-wchar-size-warning and --no-enum-size-warning.
6976         * options.h (General_options): Add ld-compatible options
6977         --no-enum-size-warning and --no-wchar-size-warning.
6978
6979 2010-08-04  Ian Lance Taylor  <iant@google.com>
6980
6981         * x86_64.cc (Target_x86_64::Scan::local): Use
6982         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6983         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6984         (Target_x86_64::Scan::global): Likewise.
6985         (Target_x86_64::Relocate::relocate): Likewise.
6986         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6987         Likewise.
6988
6989 2010-08-03  Cary Coutant  <ccoutant@google.com>
6990
6991         * merge.cc (Output_merge_string::do_add_input_section): Count strings
6992         to reserve space in merged_strings vector. Keep total input size
6993         for stats.
6994         (Output_merge_string::do_print_merge_stats): Print total input size.
6995         * merge.h (Output_merge_string): Add input_size_ field.
6996         * stringpool.cc (Stringpool_template::string_length): Move
6997         implementations out of Stringpool_template class and place in
6998         stringpool.h.
6999         * stringpool.h (string_length): Move out of Stringpool_template.
7000
7001 2010-08-03  Ian Lance Taylor  <iant@google.com>
7002
7003         PR 11712
7004         * layout.cc (relaxation_loop_body): If address of load segment is
7005         set, adjust address to include headers if possible.
7006
7007 2010-08-03  Ian Lance Taylor  <iant@google.com>
7008
7009         * version.cc (version_string): Bump to 1.10.
7010
7011 2010-08-03  Ian Lance Taylor  <iant@google.com>
7012
7013         PR 11805
7014         * layout.h (enum Output_section_order): Define.
7015         (class Layout): Update declarations.
7016         * layout.cc (Layout::get_output_section): Add order parameter.
7017         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7018         is_first_non_relro parameters.  Change all callers.
7019         (Layout::choose_output_section): Likewise.
7020         (Layout::add_output_section_data): Likewise.
7021         (Layout::make_output_section): Likewise.  Set order.
7022         (Layout::default_section_order): New function.
7023         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7024         * output.cc (Output_section::Output_section): Initialize order_.
7025         Don't initialize deleted fields.
7026         (Output_segment::Output_segment): Don't initialize deleted
7027         fields.
7028         (Output_segment::add_output_section_to_load): New function
7029         replacing add_output_section.  Change all callers to call this or
7030         add_output_section_to_nonload.
7031         (Output_segment::add_output_section_to_nonload): New function.
7032         (Output_segment::remove_output_section): Rewrite.
7033         (Output_segment::add_initial_output_data): Likewise.
7034         (Output_segment::has_any_data_sections): Likewise.
7035         (Output_segment::is_first_section_relro): Likewise.
7036         (Output_segment::maximum_alignment): Likewise.
7037         (Output_segment::has_dynamic_reloc): New function replacing
7038         dynamic_reloc_count.  Change all callers.
7039         (Output_segment::has_dynamic_reloc_list): New function replacing
7040         dynamic_reloc_count_list.  Change all callers.
7041         (Output_segment::set_section_addresses): Rewrite.
7042         (Output_segment::set_offset): Rewrite.
7043         (Output_segment::find_first_and_last_list): Remove.
7044         (Output_segment::set_tls_offsets): Rewrite.
7045         (Output_segment::first_section_load_address): Likewise.
7046         (Output_segment::output_section_count): Likewise.
7047         (Output_segment::section_with_lowest_load_address): Likewise.
7048         (Output_segment::write_section_headers): Likewise.
7049         (Output_segment::print_sections_to_map): Likewise.
7050         * output.h (class Output_data): Remove dynamic_reloc_count_
7051         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7052         (Output_data::add_dynamic_reloc): Rewrite.
7053         (Output_data::has_dynamic_reloc): New function.
7054         (Output_data::dynamic_reloc_count): Remove.
7055         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7056         is_last_relro_, is_first_non_relro_, is_interp_,
7057         is_dynamic_linker_section_ fields.  Add order and set_order
7058         functions.  Remove is_relro_local, set_is_relro_local,
7059         is_last_relro, set_is_last_relro, is_first_non_relro,
7060         set_is_first_non_relro functions, is_interp, set_is_interp,
7061         is_dynamic_linker_section, and set_is_dynamic_linker_section
7062         functions.
7063         (class Output_segment): Change Output_data_list from std::list to
7064         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7065         output_bss_ fields.  Update declarations.
7066
7067 2010-08-02  Ian Lance Taylor  <iant@google.com>
7068
7069         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7070         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7071         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7072
7073 2010-08-02  Ian Lance Taylor  <iant@google.com>
7074
7075         PR 11855
7076         * script.cc (Script_options::Script_options): Initialize
7077         symbol_definitions_ and symbol_references_.
7078         (Script_options::add_symbol_assignment): Update
7079         symbol_definitions_ and symbol_references_.
7080         (Script_options::add_symbol_reference): New function.
7081         (script_symbol): New function.
7082         * script.h (class Script_options): Add symbol_definitions_ and
7083         symbol_references_ fields.
7084         (Script_options::referenced_const_iterator): New type.
7085         (Script_options::referenced_begin): New function.
7086         (Script_options::referenced_end): New function.
7087         (Script_options::is_referenced): New function.
7088         (Script_options::any_unreferenced): New function.
7089         * script-c.h (script_symbol): Declare.
7090         * yyscript.y (exp): Call script_symbol.
7091         * symtab.cc: Include "script.h".
7092         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7093         Change all callers.  Check symbols referenced by scripts.
7094         (Symbol_table::add_undefined_symbols_from_command_line): Add
7095         layout parameter.  Change all callers.
7096         (Symbol_table::do_add_undefined_symbols_from_command_line):
7097         Likewise.  Break out loop body.  Check symbols referenced by
7098         scripts.
7099         (Symbol_table::add_undefined_symbol_from_command_line): New
7100         function broken out of
7101         do_add_undefined_symbols_from_command_line.
7102         * symtab.h (class Symbol_table): Update declarations.
7103         * archive.cc: Include "layout.h".
7104         (Archive::should_include_member): Add layout parameter.  Change
7105         all callers.  Check for symbol mentioned in expression.
7106         * archive.h (class Archive): Update declaration.
7107         * object.cc (Sized_relobj::do_should_include_member): Add layout
7108         parameter.
7109         * object.h (Object::should_include_member): Add layout parameter.
7110         Change all callers.
7111         (Object::do_should_include_member): Add layout parameter.
7112         (class Sized_relobj): Update declaration.
7113         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7114         parameter.
7115         * dynobj.h (class Sized_dynobj): Update declaration.
7116         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7117         layout parameter.
7118         * plugin.h (class Sized_pluginobj): Update declaration.
7119
7120 2010-08-02  Ian Lance Taylor  <iant@google.com>
7121
7122         PR 11866
7123         * output.cc (Output_segment::set_offset): Search for the first and
7124         last sections rather than assuming that the list is in order.
7125         (Output_segment::find_first_and_last_list): New function.
7126         * output.h (class Output_segment): Update declarations.
7127         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7128         (relro_strip_test_SOURCES): New variable.
7129         (relro_strip_test_DEPENDENCIES): New variable.
7130         (relro_strip_test_LDFLAGS): New variable.
7131         (relro_strip_test_LDADD): New variable.
7132         (relro_strip_test.so): New target.
7133
7134 2010-08-02  Ian Lance Taylor  <iant@google.com>
7135
7136         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7137         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7138         (Target_i386::got_tlsdesc_section): New function.
7139         (Target_i386::got_section): Create space for GOT entries for
7140         TLSDESC relocations.
7141         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7142         R_386_TLS_GOTDESC.
7143         (Target_i386::Scan::global): Likewise.
7144         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7145         using TLSDESC GOT.
7146         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7147         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7148         (Target_x86_64::got_tlsdesc_section): New function.
7149         (Target_x86_64::got_section): Create space for GOT entries for
7150         TLSDESC relocations.
7151         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7152         R_386_TLS_GOTDESC.
7153         (Target_x86_64::Scan::global): Likewise.
7154         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7155         using TLSDESC GOT.
7156
7157 2010-08-02  Ian Lance Taylor  <iant@google.com>
7158
7159         * testsuite/final_layout.sh: Use dc to convert from hex to
7160         decimal.
7161
7162 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7163
7164         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7165         paramter to the call to gold::gc_process_relocs.
7166         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7167         paramter to the call to gold::gc_process_relocs.
7168         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7169         parameter to the call to gold::gc_process_relocs.
7170         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7171         template parameter to the call to gold::gc_process_relocs.
7172         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7173         paramter to the call to gold::gc_process_relocs.
7174         * gc.h (get_embedded_addend_size): New function.
7175         (gc_process_relocs): Save the size of the reloc for use by ICF.
7176         * icf.cc (get_section_contents): Get the addend from the text section
7177         for SHT_REL relocation sections.
7178         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7179         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7180         * int_encoding.h (read_from_pointer): New overloaded function.
7181         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7182         * testsuite/icf_sht_rel_addend_test.sh: New file.
7183         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7184         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7185
7186 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7187
7188         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7189         * Makefile.in: Regenerate.
7190         * testsuite/Makefile.in: Regenerate.
7191
7192 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7193
7194         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7195         * gold/testsuite/debug_msg.cc: Likewise.
7196         * gold/testsuite/odr_violation1.cc
7197         * gold/testsuite/odr_violation2.cc
7198
7199 2010-07-21  Cary Coutant  <ccoutant@google.com>
7200
7201         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7202         string, and length fields.
7203         (Output_merge_string::Merged_strings_list): New type.
7204         (Output_merge_string::Merged_strings_lists): New typedef.
7205         (Output_merge_string): Replace merged_strings_ with
7206         merged_strings_lists_.
7207         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7208         Merged_strings_list per input object and section.  Don't store pointer
7209         to the string.  Don't store length with each merged string entry.
7210         (Output_merge_string::finalize_merged_data): Loop over list of merged
7211         strings lists.  Recompute length of each merged string.
7212
7213 2010-07-15  Cary Coutant  <ccoutant@google.com>
7214
7215         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7216         here.
7217
7218 2010-07-14  Ian Lance Taylor  <iant@google.com>
7219
7220         * descriptors.cc (Descriptors::open): Report correct name in error
7221         message.
7222
7223 2010-07-13  Doug Kwan  <dougkwan@google.com>
7224
7225         * arm.cc (Arm_input_section::Arm_input_section): For a
7226         SHT_ARM_EXIDX section, always keeps the input sections.
7227         (Arm_input_section::set_exidx_section_link): New method.
7228         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7229         has_errors_ to false.
7230         (Arm_exidx_input_section::has_errors,
7231         Arm_exidx_input_section::set_has_errors): New methods.
7232         (Arm_exidx_input_section::has_errors_): New data member.
7233         (Arm_relobj::get_exidx_shndx_list): New method.
7234         (Arm_output_section::append_text_sections_to_list): Do not skip
7235         section without SHF_EXECINSTR.
7236         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7237         errors.
7238         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7239         section header.  Make error messages more verbose.  Check for
7240         a non-executable section linked to an EXIDX section.
7241         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7242         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7243         check that there is no deferred EXIDX section if we exit early.
7244         Instead of not making an EXIDX section in case of an error, make one
7245         and set the has_errors flag of it.
7246         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7247         in a relocatable link.
7248         (Target_arm::do_relax): Look for the EXIDX output section instead of
7249         assuming that it is called .ARM.exidx.
7250         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7251         section list.  Do not check for SHF_EXECINSTR section flags but
7252         skip any input section with errors.
7253         * output.cc (Output_section::Output_section): Initialize
7254         always_keeps_input_sections_ to false.
7255         (Output_section::add_input_section): Check for
7256         always_keeps_input_sections_.
7257         *  output.h (Output_section::always_keeps_input_sections,
7258         Output_section::set_always_keeps_input_sections): New methods.
7259         (Output_section::always_keeps_input_sections): New data member.
7260
7261 2010-07-13  Rafael Espindola  <espindola@google.com>
7262
7263         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7264         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7265
7266 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7267             Ian Lance Taylor  <iant@google.com>
7268
7269         * output.h (Output_section_lookup_maps::add_merge_section):
7270         Correct check of whether value was inserted.
7271         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7272         (Output_section_lookup_maps::add_relaxed_input_section):
7273         Likewise.
7274         * arm.cc (Target_arm::got_section): Remove used local os.
7275         * i386.cc (Target_i386::got_section): Likewise.
7276         * x86_64.cc (Target_x86_64::got_section): Likewise.
7277         * sparc.cc (Target_sparc::got_section): Likewise.
7278         (Target_sparc::relocate): Remove unused local have_got_offset.
7279         * powerpc.cc (Target_powerpc::relocate): Likewise.
7280
7281 2010-07-13  Ian Lance Taylor  <iant@google.com>
7282
7283         * compressed_output.cc (zlib_decompress): Fix signature in
7284         !HAVE_ZLIB_H case.
7285
7286         * archive.cc (Archive::include_member): Unlock an external member
7287         of a thin archive.  Don't bother to delete an object we know is
7288         NULL.
7289
7290 2010-07-12  Cary Coutant  <ccoutant@google.com>
7291
7292         * compressed_output.cc (zlib_decompress): New function.
7293         (get_uncompressed_size): New function.
7294         (decompress_input_section): New function.
7295         * compressed_output.h (get_uncompressed_size): New function.
7296         (decompress_input_section): New function.
7297         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7298         Handle compressed debug sections.
7299         * layout.cc (is_compressed_debug_section): New function.
7300         (Layout::output_section_name): Map compressed section names to
7301         canonical names.
7302         * layout.h (is_compressed_debug_section): New function.
7303         (is_debug_info_section): Recognize compressed debug sections.
7304         * merge.cc: Include compressed_output.h.
7305         (Output_merge_data::do_add_input_section): Handle compressed
7306         debug sections.
7307         (Output_merge_string::do_add_input_section): Handle compressed
7308         debug sections.
7309         * object.cc: Include compressed_output.h.
7310         (Sized_relobj::Sized_relobj): Initialize new data members.
7311         (build_compressed_section_map): New function.
7312         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7313         * object.h (Object::section_is_compressed): New method.
7314         (Object::do_section_is_compressed): New method.
7315         (Sized_relobj::Compressed_section_map): New type.
7316         (Sized_relobj::do_section_is_compressed): New method.
7317         (Sized_relobj::compressed_sections_): New data member.
7318         * output.cc (Output_section::add_input_section): Handle compressed
7319         debug sections.
7320         * reloc.cc: Include compressed_output.h.
7321         (Sized_relobj::write_sections): Handle compressed debug sections.
7322
7323 2010-07-08  Cary Coutant  <ccoutant@google.com>
7324
7325         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7326         weak when resolving to a dynamic def.
7327         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7328         for weak undef/dynamic def cases. Adjust callers.
7329         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7330         undef_binding_weak_.
7331         (Symbol_table::sized_write_globals): Adjust symbol binding.
7332         (Symbol_table::sized_write_symbol): Add binding parameter.
7333         * symtab.h (Symbol::set_undef_binding): New method.
7334         (Symbol::is_undef_binding_weak): New method.
7335         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7336         (Symbol_table::should_override): Add new parameter.
7337         (Symbol_table::sized_write_symbol): Add new parameter.
7338
7339         * testsuite/weak_undef_file1.cc: Add new test case.
7340         * testsuite/weak_undef_file2.cc: Fix header comment.
7341         * testsuite/weak_undef_test.cc: Add new test case.
7342
7343 2010-06-29  Doug Kwan  <dougkwan@google.com>
7344
7345         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7346         Initialize USE_SYMBOL_.
7347         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7348         definition.
7349         (Arm_reloc_property::uses_symbol_): New data member declaration.
7350         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7351         uses symbol value and symbol is undefined but not weakly undefined.
7352
7353 2010-06-28  Rafael Espindola  <espindola@google.com>
7354
7355         * plugin.cc (Plugin::load): Use dlerror.
7356
7357 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7358
7359         * symtab.cc (detect_odr_violations): When reporting an ODR
7360         violation, report an object where the symbol is defined.
7361
7362 2010-06-25  Doug Kwan  <dougkwan@google.com>
7363
7364         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7365         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7366         definition.
7367         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7368         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7369         target hook to detect function points.
7370         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7371         * icf.h (Icf::check_section_for_function_pointers): Change type of
7372         parameter SECTION_NAME to const reference to std::string.  Use
7373         target hook to determine if section may have unsafe pointers.
7374         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7375         method definition.
7376
7377 2010-06-21  Rafael Espindola  <espindola@google.com>
7378
7379         * fileread.cc (Input_file::find_fie): New
7380         (Input_file::open): Use Input_file::find_fie.
7381         * fileread.h (Input_file::find_fie): New
7382         * plugin.cc (set_extra_library_path): New.
7383         (Plugin::load): Add set_extra_library_path to the transfer vector.
7384         (Plugin_manager::set_extra_library_path): New.
7385         (Plugin_manager::add_input_file): Use the extra search path if set.
7386         (set_extra_library_path(): New.
7387         * plugin.h (Plugin_manager): Add set_extra_library_path and
7388         extra_search_path_.
7389
7390 2010-06-19  Cary Coutant  <ccoutant@google.com>
7391
7392         * layout.cc (gdb_sections): Add .debug_types.
7393         (lines_only_debug_sections): Likewise.
7394
7395 2010-06-18  Rafael Espindola  <espindola@google.com>
7396
7397         * plugin.cc (add_input_file,add_input_library)
7398         (Plugin_manager::add_input_file): Make filename arguments const.
7399         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7400         const.
7401
7402 2010-06-16  Doug Kwan  <dougkwan@google.com>
7403
7404         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7405         .ARM.attributes section if we have not merged any input
7406         attributes sections.
7407
7408 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7409
7410         * arm.cc: Allow combining objects with no EABI version
7411         information.
7412
7413 2010-06-15  Rafael Espindola  <espindola@google.com>
7414
7415         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7416
7417 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7418
7419         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7420         (struct iovec): Correct !HAVE_READV definition.
7421
7422 2010-06-10  Cary Coutant  <ccoutant@google.com>
7423
7424         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7425         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7426         reloc sections.
7427         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7428
7429         PR 11683
7430         * symtab.h (Symbol::is_placeholder): New member function.
7431         * target-reloc.h (relocate_section): Check for placeholder symbols.
7432
7433         * testsuite/Makefile.am (plugin_test_8): New test.
7434         (plugin_test_9): New test.
7435         * testsuite/Makefile.in: Regenerate.
7436
7437 2010-06-09  Nick Clifton  <nickc@redhat.com>
7438
7439         * yyscript.y (input_list_element): Allow strings prefixed with
7440         the '-' character.  Treat these as libraries.
7441         * script.cc (script_add_library): New function.  Adds a library
7442         specified by "-l<name>" found in an input script.
7443         * script-c.h: Add prototype for script_add_library.
7444
7445 2010-06-07  Doug Kwan  <dougkwan@google.com>
7446
7447         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7448         Restrict stub-group size to be within long conditional branch
7449         range when working around cortex-A8 erratum.
7450
7451 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7452
7453         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7454         #ifdef typo.
7455
7456 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7457
7458         PR gold/11658
7459         * output.cc
7460         (Output_section::Input_section_sort_entry::compare_section_ordering):
7461         Change to return non-zero correctly.
7462         (Output_section::Input_section_sort_section_order_index_compare
7463         ::operator()): Change to fix ambiguity in comparisons.
7464
7465 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7466
7467         * gold.h (is_wildcard_string): New function.
7468         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7469         (Layout::layout_eh_frame): Ditto.
7470         (Layout::find_section_order_index): New method.
7471         (Layout::read_layout_from_file): New method.
7472         * layout.h (Layout::find_section_order_index): New method.
7473         (Layout::read_layout_from_file): New method.
7474         (Layout::input_section_position_): New private member.
7475         (Layout::input_section_glob_): New private member.
7476         * main.cc (main): Call read_layout_from_file here.
7477         * options.h (--section-ordering-file): New option.
7478         * output.cc (Output_section::input_section_order_specified_): New
7479         member.
7480         (Output_section::Output_section): Initialize new member.
7481         (Output_section::add_input_section): Add new parameter.
7482         Keep input sections when --section-ordering-file is used.
7483         (Output_section::set_final_data_size): Sort input sections when
7484         section ordering file is specified.
7485         (Output_section::Input_section_sort_entry): Add new parameter.
7486         Check sorting type.
7487         (Output_section::Input_section_sort_entry::compare_section_ordering):
7488         New method.
7489         (Output_section::Input_section_sort_compare::operator()): Change to
7490         consider section_order_index.
7491         (Output_section::Input_section_sort_init_fini_compare::operator()):
7492         Change to consider section_order_index.
7493         (Output_section::Input_section_sort_section_order_index_compare
7494         ::operator()): New method.
7495         (Output_section::sort_attached_input_sections): Change to sort
7496         according to section order when specified.
7497         (Output_section::add_input_section<32, true>): Add new parameter.
7498         (Output_section::add_input_section<64, true>): Add new parameter.
7499         (Output_section::add_input_section<32, false>): Add new parameter.
7500         (Output_section::add_input_section<64, false>): Add new parameter.
7501         * output.h (Output_section::add_input_section): Add new parameter.
7502         (Output_section::input_section_order_specified): New
7503         method.
7504         (Output_section::set_input_section_order_specified): New method.
7505         (Input_section::Input_section): Initialize section_order_index_.
7506         (Input_section::section_order_index): New method.
7507         (Input_section::set_section_order_index): New method.
7508         (Input_section::section_order_index_): New member.
7509         (Input_section::Input_section_sort_section_order_index_compare): New
7510         struct.
7511         (Output_section::input_section_order_specified_): New member.
7512         * script-sections.cc (is_wildcard_string): Delete and move modified
7513         method to gold.h.
7514         (Output_section_element_input::Output_section_element_input): Modify
7515         call to is_wildcard_string.
7516         (Output_section_element_input::Input_section_pattern
7517         ::Input_section_pattern): Ditto.
7518         (Output_section_element_input::Output_section_element_input): Ditto.
7519         * testsuite/Makefile.am (final_layout): New test case.
7520         * testsuite/Makefile.in: Regenerate.
7521         * testsuite/final_layout.cc: New file.
7522         * testsuite/final_layout.sh: New file.
7523
7524 2010-06-01  Rafael Espindola  <espindola@google.com>
7525
7526         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7527
7528 2010-06-01  Rafael Espindola  <espindola@google.com>
7529
7530         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7531         visibility of symbols.
7532
7533 2010-05-27  Doug Kwan  <dougkwan@google.com>
7534
7535         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7536         from start of output section instead of address for a local symbol
7537         in a merged or relaxed section when doing a relocatable link.
7538
7539 2010-05-26  Rafael Espindola  <espindola@google.com>
7540
7541         PR 11604
7542         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7543         adding sections the garbage collector removed.
7544         * gold/testsuite/Makefile.am: Add test.
7545         * gold/testsuite/Makefile.in: Regenerate.
7546         * gold/testsuite/plugin_test_7.sh: New.
7547         * gold/testsuite/plugin_test_7_1.c: New.
7548         * gold/testsuite/plugin_test_7_2.c: New.
7549
7550 2010-05-26  Rafael Espindola  <espindola@google.com>
7551
7552         * script-sections.cc (Output_section_definition::set_section_addresses):
7553         Check for --section-start.
7554
7555 2010-05-26  Doug Kwan  <dougkwan@google.com>
7556
7557         * arm.cc (Arm_scan_relocatable_relocs): New class.
7558         (Target_arm::relocate_special_relocatable): New method.
7559         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7560         (Arm_relocate_functions::thumb_branch_common): Same.
7561         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7562         instead of Default_scan_relocatable_relocs.
7563         * target-reloc.h (relocate_for_relocatable): Let target handle
7564         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7565         * target.h (Sized_target::relocate_special_relocatable): New method.
7566
7567 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7568
7569         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7570
7571 2010-05-23  Doug Kwan  <dougkwan@google.com>
7572
7573         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7574         instead of a cast.
7575         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7576         with a direct branch, not a conditional branch, to a stub.
7577         * merge.cc (Output_merge_base::record_input_section): New method
7578         defintion.
7579         (Output_merge_data::do_add_input_section): Record input section if
7580         keeps-input-sections flag is set.
7581         (Output_merge_string::do_add_input_section): Ditto.
7582         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7583         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7584         INPUT_SECTIONS_.
7585         (Output_merge_base::keeps_input_sections,
7586         Output_merge_base::set_keeps_input_sections,
7587         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7588         method definitions.
7589         (Output_merge_base::Input_sections): New type declaration.
7590         (Output_merge_base::input_sections_begin,
7591         Output_merge_base::input_sections_end,
7592         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7593         (Output_merge_base::bool keeps_input_sections_,
7594         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7595         Output_merge_base::input_sections_): New data members.
7596         (Output_merge_data::do_set_keeps_input_sections): New method
7597         defintion.
7598         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7599         * output.cc (Output_section::Input_section::relobj): Move method
7600         defintion from class declaration to here and handle merge sections.
7601         (Output_section::Input_section::shndx): Ditto.
7602         (Output_section::Output_section): Remove initializations of removed
7603         data members and initialize new data member LOOKUP_MAPS_.
7604         (Output_section::add_input_section): Set keeps-input-sections flag
7605         for a newly created merge output section as appropriate.  Adjust code
7606         to use Output_section_lookup_maps class.
7607         (Output_section::add_relaxed_input_section): Adjst code for lookup
7608         maps code refactoring.
7609         (Output_section::add_merge_input_section): Add a new parameter
7610         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7611         class.  If adding input section to a newly created merge output
7612         section fails, remove the new merge section.
7613         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7614         Adjust code for use of the Output_section_lookup_maps class.
7615         (Output_section::find_merge_section): Ditto.
7616         (Output_section::build_lookup_maps): New method defintion.
7617         (Output_section::find_relaxed_input_section): Adjust code to use
7618         Output_section_lookup_maps class.
7619         (Output_section::get_input_sections): Export merge sections.  Adjust
7620         code to use Output_section_lookup_maps class.
7621         (Output_section:::add_script_input_section): Adjust code to use
7622         Output_section_lookup_maps class.  Update lookup maps for merge
7623         sections also.
7624         (Output_section::discard_states): Use Output_section_lookup_maps.
7625         (Output_section::restore_states): Same.
7626         * output.h (Merge_section_properties): Move class defintion out of
7627         Output_section.
7628         (Output_section_lookup_maps): New class.
7629         (Output_section::Input_section::is_merge_section): New method
7630         defintion.
7631         (Output_section::Input_section::relobj): Move defintion out of class
7632         defintion.  Declare method only.
7633         (Output_section::Input_section::shndx): Ditto.
7634         (Output_section::Input_section::output_merge_base): New method defintion.
7635         (Output_section::Input_section::u2_.pomb): New union field.
7636         (Output_section::Merge_section_by_properties_map,
7637         Output_section::Output_section_data_by_input_section_map,
7638         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7639         Remove types.
7640         (Output_section::add_merge_input_section): Add new parameter
7641         KEEPS_INPUT_SECTIONS.
7642         (Output_section::build_lookup_maps): New method declaration.
7643         (Output_section::merge_section_map_,
7644         Output_section::merge_section_by_properties_map_,
7645         Output_section::relaxed_input_section_map_,
7646         Output_section::is_relaxed_input_section_map_valid_): Remove data
7647         members.
7648         (Output_section::lookup_maps_): New data member.
7649
7650 2010-05-21  Doug Kwan  <dougkwan@google.com>
7651
7652         PR gold/11619
7653         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7654         avoid a compilation error.
7655
7656 2010-05-19  Rafael Espindola  <espindola@google.com>
7657
7658         * script-sections.cc (Output_section_definition::allocate_to_segment):
7659         Update the phdrs_list even when the output section is NULL.
7660         * testsuite/Makefile.am: Add test.
7661         * testsuite/Makefile.in: Regenerate.
7662         * testsuite/script_test_9.cc: New.
7663         * testsuite/script_test_9.sh: New.
7664         * testsuite/script_test_9.t: New.
7665
7666 2010-05-19  Doug Kwan  <dougkwan@google.com>
7667
7668         * arm.cc (Arm_input_section::original_size): New method.
7669         (Arm_input_section::do_addralign): Add a cast.
7670         (Arm_input_section::do_output_offset): Remove static cast.
7671         (Arm_input_section::original_addralign,
7672          Arm_input_section::original_size_): Change type to uint32_t.
7673         (Arm_input_section::init): Add safe casts for section alignment
7674         and size.
7675         (Arm_input_section::set_final_data_size): Do not set address and
7676         offset of stub table.
7677         (Arm_output_section::fix_exidx_coverage): Change use of of
7678         Output_section::Simple_input_section to that of
7679         Output_section::Input_section.
7680         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7681         except for the first pass.
7682         * output.cc (Output_section::get_input_sections): Change type of
7683         input_sections to std::list<Input_section>.
7684         (Output_section::add_script_input_section): Rename from
7685         Output_section::add_simple_input_section.  Change type of SIS
7686         parameter from Simple_input_section to Input_section.
7687         * output.h (Output_section::Simple_input_section): Remove class.
7688         (Output_section::Input_section): Change class visibility to public.
7689         (Output_section::Input_section::addralign): Use stored alignments
7690         for special input sections if set.
7691         (Output_section::Input_section::set_addralign): New method.
7692         (Output_section::get_input_sections): Change parameter type from
7693         list of Simple_input_section to list of Input_section.
7694         (Output_section::add_script_input_section): Rename from
7695         Output_section::add_simple_input_section. Change first parameter's
7696         type from Simple_input_section to Input_section and remove the
7697         second and third parameters.
7698         * script-sections.cc (Input_section::Input_section_list): Change
7699         type to list of Output_section::Input_section/
7700         (Input_section_info::Input_section_info): Change parameter type of
7701         INPUT_SECTION to Output_section::Input_section.
7702         (Input_section_info::input_section): Change return type.
7703         (Input_section_info::input_section_): Change type to
7704         Output_section::Input_section.
7705         (Output_section_element_input::set_section_addresses): Adjust code
7706         to use Output_section::Input_section instead of
7707         Output_section::Simple_input_section.  Adjust code for renaming
7708         of Output_section::add_simple_input_section.
7709         (Orphan_output_section::set_section_addresses): Ditto.
7710
7711 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7712
7713         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7714         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7715
7716 2010-05-18  Rafael Espindola  <espindola@google.com>
7717
7718         * options.cc (General_options::finalize): Handle -nostdlib.
7719         * options.h (nostdlib): New option.
7720         * script.cc (script_add_search_dir): Handle -nostdlib.
7721
7722 2010-05-12  Doug Kwan  <dougkwan@google.com>
7723
7724         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7725         attributes section only if there no attributes section after merging.
7726         (Target_arm::merge_object_attributes): Move value of
7727         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7728         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7729         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7730         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7731         and arm_attr_merge_7.stdout.
7732         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7733         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7734         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7735         arm_attr_merge_7b.o): New rules.
7736         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7737         arm_attr_merge_7
7738         * testsuite/Makefile.in: Regenerate.
7739         * testsuite/arm_attr_merge.sh: New file.
7740         * testsuite/arm_attr_merge_[67][ab].s: Same.
7741
7742 2010-05-05  Nick Clifton  <nickc@redhat.com>
7743
7744         * po/es.po: Updated Spanish translation.
7745
7746 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7747
7748         * Makefile.am (install-exec-local): Properly install gold as
7749         default cross linker.
7750         * Makefile.in: Regenerated.
7751
7752 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7753             Nick Clifton  <nickc@redhat.com>
7754
7755         * configure.ac (install_as_default): Define and set to false
7756         unless --enable-gold or --enable-gold=both/gold has been
7757         specified.
7758         * configure: Regenerate.
7759
7760         * Makefile.am (install-exec-local): Install the executable as
7761         'ld.gold'.  If install_as_default is true then also install it as
7762         'ld'.
7763         * Makefile.in: Regenerated.
7764
7765 2010-04-24  Ian Lance Taylor  <iant@google.com>
7766
7767         * layout.cc (Layout::layout_reloc): In relocatable link don't
7768         combine reloc sections for grouped sections.
7769
7770 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7771
7772         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7773         sections that are not ordinary to icf.
7774         * icf.cc (get_section_contents): Handle relocation pointing to section
7775         with no object or shndx information.
7776         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7777         * testsuite/Makefile.in: Regenerate.
7778         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7779         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7780
7781 2010-04-22  Ian Lance Taylor  <iant@google.com>
7782
7783         * expression.cc (Expression::Expression_eval_info): Add
7784         result_alignment_pointer field.
7785         (Expression::eval_with_dot): Add result_alignment_pointer
7786         parameter.  Change all callers.
7787         (Expression::eval_maybe_dot): Likewise.
7788         (class Binary_expression): Add alignment_pointer parameter to
7789         left_value and right_value.  Change all callers.
7790         (BINARY_EXPRESSION): Set result alignment.
7791         (class Trinary_expression): Add alignment_pointer parameter to
7792         arg2_value and arg3_value.  Change all callers.
7793         (Trinary_cond::value): Set result alignment.
7794         (Max_expression::value, Min_expression::value): Likewise.
7795         (Align_expression::value): Likewise.
7796         * script-sections.cc (class Sections_element): Add dot_alignment
7797         parameter to set_section_addresses virtual function.  Update
7798         instantiations.
7799         (class Output_section_element): Likewise.
7800         (Script_sections::create_segments): Add dot_alignment parameter.
7801         Change all callers.
7802         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7803         (Script_sections::set_phdrs_clause_addresses): Likewise.
7804         * script-sections.h: Update declarations.
7805         * script.h: Update declarations.
7806         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7807         min_p_align.
7808         * testsuite/script_test_3.t: Set large alignment.
7809         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7810         segment has expected alignment.
7811
7812 2010-04-22  Nick Clifton  <nickc@redhat.com>
7813
7814         * po/gold.pot: Updated by the Translation project.
7815         * po/vi.po: Updated Vietnamese translation.
7816
7817 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7818
7819         * testsuite/Makefile.am (check_PROGRAMS): Add
7820         icf_virtual_function_folding_test.
7821         * testsuite/Makefile.in: Regenerated.
7822
7823 2010-04-15  Andrew Haley  <aph@redhat.com>
7824
7825         * options.h (merge_exidx_entries): New option.
7826         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7827         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7828         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7829         (Target_arm::merge_exidx_entries): New function.
7830         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7831         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7832         to Arm_exidx_fixup constructor.
7833         Add new arg, merge_exidx_entries.
7834         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7835         Arm_output_section::fix_exidx_coverage.
7836
7837 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7838
7839         * icf.cc (get_section_contents): Check for preemptible functions.
7840         Ignore addend when appropriate.
7841         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7842         section folded.
7843         (add_from_relobj): Check for section folded.
7844         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7845         * symtab.h (should_add_dynsym_entry): Add new parameter.
7846         * target-reloc.h (scan_relocs): Check for section folded.
7847         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7848         Check reloc types for function pointers in shared objects.
7849         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7850         case.
7851         (icf_preemptible_functions_test): New test case.
7852         (icf_string_merge_test): New test case.
7853         * testsuite.Makefile.in: Regenerate.
7854         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7855         bar_glob.  Refactor code.
7856         * testsuite/icf_preemptible_functions_test.cc: New file.
7857         * testsuite/icf_preemptible_functions_test.sh: New file.
7858         * testsuite/icf_string_merge_test.cc: New file.
7859         * testsuite/icf_string_merge_test.sh: New file.
7860         * testsuite/icf_virtual_function_folding_test.cc: New file.
7861         * testsuite/icf_virtual_function_folding_test.sh: New file.
7862
7863 2010-04-14  Doug Kwan  <dougkwan@google.com>
7864
7865         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7866         for local symbol recounting if we remove a section due to ICF.
7867         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7868         there are no regular objects in input.
7869
7870 2010-04-13  Doug Kwan  <dougkwan@google.com>
7871
7872         * arm.cc (Arm_input_section::set_final_data_size): Compute
7873         accurate final data size instead of using current data size.
7874
7875 2010-04-09  Doug Kwan  <dougkwan@google.com>
7876
7877         * layout.cc (Layout::choose_output_section): Handle script section
7878         types.
7879         (Layout::make_output_section_for_script): Add section type parameter.
7880         Handle script section types.
7881         * layout.h (Layout::make_output_section_for_script): Add section
7882         type parameter.
7883         * output.cc (Output_section::Output_section): Initialize data member
7884         is_noload_.
7885         (Output_section::do_reset_address_and_file_offset): Do not set address
7886         to 0 if section is a NOLOAD section.
7887         * output.h (Output_section::is_noload): New method.
7888         (Output_section::set_is_noload): Ditto.
7889         (Output_section::is_noload_): New data member.
7890         * script-c.h (Script_section_type): New enum type.
7891         (struct Parser_output_section_header): Add new file section_type.
7892         * script-sections.cc (Sections_element::output_section_name): Add
7893         parameter for returning script section type.
7894         (Output_section_definition::output_section_name): Ditto.
7895         (Output_section_definition::section_type)P; New method.
7896         (Output_section_definiton::script_section_type_name): Ditto.
7897         (Output_section_definition::script_section_type_): New data member.
7898         (Output_section_definition::Output_section_definition): Initialize
7899         data member Output_section_definition::script_section_type_.
7900         (Output_section_definition::create_sections): Pass script section type
7901         to Layout::make_output_section_for_script.
7902         (Output_section_definition::output_section_name): Return script
7903         section type to caller.
7904         (Output_section_definition::set_section_address): Do not advance
7905         dot value and load address if section type is NOLOAD.  Set address
7906         of NOLOAD sections regardless of section flags.
7907         (Output_section_definition::print): Print section type if it is
7908         not SCRIPT_SECTION_TYPE_NONE.
7909         (Output_section_definition::section_type): New method.
7910         (Output_section_definition::script_section_type_name): Ditto.
7911         (Script_sections::output_section_name): Add new parameter
7912         PSECTION_TYPE for returning script section type.  Pass it to
7913         section elements.  Handle discard sections.
7914         (Sort_output_sections::operator()): Handle NOLOAD sections.
7915         * script-sections.h (Script_sections::Section_type): New enum type.
7916         (Script_sections::output_section_name): Add a new parameter for
7917         returning script section type.
7918         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7919         INFO and NOLOAD.
7920         * yyscript.y (union): Add new field SECTION_TYPE.
7921         (COPY, DSECT, INFO, NOLOAD): New tokens.
7922         (opt_address_and_section_type): Change type to output_section_header.
7923         (section_type): New non-terminal
7924         (section_header): Handle section type.
7925         (opt_address_and_section_type): Return section type value.
7926
7927 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7928
7929         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7930         * testsuite/plugin_common_test_2.c (foo): Likewise.
7931
7932 2010-04-08  Doug Kwan  <dougkwan@google.com>
7933
7934         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7935         Output_merge_data.
7936         * output.cc (Output_section::add_merge_input_section): Simplify
7937         code and return status of Output_merge_base::add_input_section.
7938         Update merge section map only if Output_merge_base::add_input_section
7939         returns true.
7940
7941 2010-04-07  Doug Kwan  <dougkwan@google.com>
7942
7943         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7944         if section is marked as containing instructions but has no mapping
7945         symbols.
7946         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7947         correct section index.
7948         (Arm_relobj::find_linked_text_section): Ditto.
7949
7950 2010-04-07  Cary Coutant  <ccoutant@google.com>
7951
7952         * archive.cc (include_member): Destroy Read_symbols_data object before
7953         releasing file.
7954         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7955         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7956         (Read_symbols_data::~Read_symbols_data) New destructor.
7957         (Section_relocs::Section_relocs) New constructor.
7958         (Section_relocs::~Section_relocs) New destructor.
7959         (Read_relocs_data::Read_relocs_data) New constructor.
7960         (Read_relocs_data::~Read_relocs_data) New destructor.
7961         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7962         pointers to NULL after deleting.
7963
7964 2010-04-07  Doug Kwan  <dougkwan@google.com>
7965
7966         * arm.cc: Replace "endianity" with "endianness" in comments.
7967         (Arm_exidx_cantunwind): Ditto.
7968         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7969         (Arm_relobj::merge_flags_and_attributes): New method.
7970         (Arm_relobj::merge_flags_and_attributes_): New data member.
7971         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7972         (Arm_relobj::scan_sections_for_stubs): Ditto.
7973         (Arm_relobj::do_read_symbols): Check to see if we really want to
7974         merge processor-specific flags and attributes.  Exit early if
7975         an object is empty except for section names and the undefined symbol.
7976         (Target_arm::do_finalize_sections): Move check for ELF format to
7977         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7978         attributes from a regular object only when we have determined that
7979         it is aapropriate.  Do not create an .ARM.attributes section in
7980         output if there is no regular input object.
7981         (Target_arm::merge_processor_specific_flags): Check
7982         --warn-mismatch before printing any error.
7983         (Target_arm::merge_object_attributes): Ditto.
7984         * gold.cc (queue_middle_tasks): Handle the case in which there is
7985         no regular object in input.
7986         * options.cc (General_options::parse_EB): New method.
7987         (General_options::parse_EL): Same.
7988         (General_options::General_options): Initialize endianness_.
7989         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
7990         New options.
7991         (General_options::Endianness): New enum.
7992         (General_options::endianness): New method.
7993         (General_options::endianness_): New data member.
7994         * parameters.cc (Parameters::set_options): Check target endianness.
7995         (Parameters::set_target_once): Ditto.
7996         (Parameters::check_target_endianness): New method.
7997         (parameters_force_valid_target): If either -EL or -EB is specified,
7998         use it to define endianness of default target.
7999         * parameters.h (Parameters::check_target_endianness): New method
8000         declaration.
8001         * target.h (class Target): Change "endianity" to "endianness"
8002         in comments.
8003
8004 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8005
8006         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8007         * configure: Regenerate.
8008         * Makefile.in: Regenerate.
8009         * testsuite/Makefile.in: Regenerate.
8010
8011 2010-04-06  Cary Coutant  <ccoutant@google.com>
8012
8013         gcc PR lto/42757
8014         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8015         prevailing definitions of common symbols.
8016         * testsuite/plugin_test_6.sh: New test case.
8017         * testsuite/plugin_common_test_1.c: New test case.
8018         * testsuite/plugin_common_test_2.c: New test case.
8019         * testsuite/Makefile.am (plugin_test_6): New test case.
8020         * testsuite/Makefile.in: Regenerate.
8021
8022 2010-04-06  Nick Clifton  <nickc@redhat.com>
8023
8024         * po/vi.po: New Vietnamese translation.
8025
8026 2010-03-30  Doug Kwan  <dougkwan@google.com>
8027
8028         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8029
8030 2010-03-25  Doug Kwan  <dougkwan@google.com>
8031
8032         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8033         to avoid a conversion warning on a 32-bit host.
8034
8035 2010-03-24  Ian Lance Taylor  <iant@google.com>
8036
8037         * testsuite/script_test_3.t: Add a TLS segment.
8038         * testsuite/Makefile.am (check_PROGRAMS): Add
8039         tls_phdrs_script_test.
8040         (tls_phdrs_script_test_SOURCES): Define.
8041         (tls_phdrs_script_test_DEPENDENCIES): Define.
8042         (tls_phdrs_script_test_LDFLAGS): Define.
8043         (tls_phdrs_script_test_LDADD): Define.
8044         * testsuite/Makefile.in: Rebuild.
8045
8046 2010-03-23  Cary Coutant  <ccoutant@google.com>
8047
8048         * fileread.cc (find_or_make_view): Fix comment.
8049
8050 2010-03-23  Ian Lance Taylor  <iant@google.com>
8051
8052         * script-sections.cc (class Orphan_section_placement): Define
8053         PLACE_TLS and PLACE_TLS_BSS.
8054         (Orphan_section_placement::Orphan_section_placement): Initialize
8055         new places.
8056         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8057         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8058         (tls_script_test_SOURCES): Define.
8059         (tls_script_test_DEPENDENCIES): Define.
8060         (tls_script_test_LDFLAGS): Define.
8061         (tls_script_test_LDADD): Define.
8062         * testsuite/Makefile.in: Rebuild.
8063
8064 2010-03-22  Doug Kwan  <dougkwan@google.com>
8065
8066         * arm.cc (Arm_relocate_functions::abs8,
8067         Arm_relocate_functions::abs16): Use correct check for overflow
8068         specified in the ARM ELF specs.
8069         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8070         target of a BLX instruction specially.
8071         (Reloc_stub::stub_type_for_reloc): Ditto.
8072         (Relocate::relocate): Use symbolic names instead of numeric relocation
8073         codes to report error.
8074         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8075         workaround.
8076         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8077         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8078         thumb2_blx_out_of_range.stdout
8079         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8080         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8081         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8082         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8083         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8084         thumb2_blx_in_range, thumb2_blx_in_range.o,
8085         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8086         thumb2_blx_out_of_range.o): New rules.
8087         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8088         thumb2_blx_in_range and thumb2_blx_out_of_range.
8089         * testsuite/Makefile.in: Regenerate.
8090         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8091         * testsuite/thumb_blx_in_range.s: New file.
8092         * testsuite/thumb_blx_out_of_range.s: New file.
8093
8094 2010-03-22  Rafael Espindola  <espindola@google.com>
8095
8096         * archive.cc (Should_include): Move to archive.h.
8097         (should_include_member): Make it a member of Archive.
8098         (Lib_group): New.
8099         (Add_lib_group_symbols): New.
8100         * archive.h: Include options.h.
8101         (Archive_member): Moved from Archive.
8102         (Should_include): Moved from archive.cc.
8103         (Lib_group): New.
8104         (Add_lib_group_symbols): New.
8105         * dynobj.cc (do_should_include_member): New.
8106         * dynobj.h (do_should_include_member): New.
8107         * gold.cc (queue_initial_tasks): Update call to queue.
8108         * main.cc (main): Print lib group stats.
8109         * object.cc (do_should_include_member): New.
8110         * object.h: Include archive.h.
8111         (Object::should_include_member): New.
8112         (Object::do_should_include_member): New.
8113         (Sized_relobj::do_should_include_member): New.
8114         * options.cc (General_options::parse_start_lib): New.
8115         (General_options::parse_end_lib): New.
8116         (Input_arguments::add_file): Handle lib groups.
8117         (Input_arguments::start_group): Check we are not in a lib.
8118         (Input_arguments::start_lib): New.
8119         (Input_arguments::end_lib): New.
8120         * options.h (General_options): Add start_lib and end_lib.
8121         (Input_argument::lib_): New.
8122         (Input_argument::lib): New.
8123         (Input_argument::is_lib): New.
8124         (Input_file_lib): New.
8125         (Input_arguments::in_lib_): New.
8126         (Input_arguments::in_lib): New.
8127         (Input_arguments::start_lib): New.
8128         (Input_arguments::end_lib_): New.
8129         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8130         in unused members as preempted.
8131         (Sized_pluginobj::do_should_include_member): New.
8132         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8133         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8134         return the blocker.
8135         (Read_symbols::do_whole_lib_group): New.
8136         (Read_symbols::do_lib_group): New.
8137         (Read_symbols::do_read_symbols): Handle lib groups.
8138         (Read_symbols::get_name): Handle lib groups.
8139         * readsyms.h (Read_symbols): Add an archive member pointer.
8140         (Read_symbols::do_whole_lib_group): New.
8141         (Read_symbols::do_lib_group): New.
8142         (Read_symbols::member_): New.
8143         * script.cc (read_input_script): Update call to queue_soon.
8144
8145 2010-03-19  Doug Kwan  <dougkwan@google.com>
8146
8147         * arm.cc (Stub_table::Stub_table): Initialize new data members
8148         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8149         (Stub_table::add_reloc_stub): Assign stub offset and update
8150         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8151         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8152         New data members.
8153         (Stub_table::update_data_size_and_addralign): Use
8154         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8155         instead of going over all reloc stubs.
8156         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8157         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8158         Stringpool_template::offset_ to size of Stringpool_char.
8159         (Stringpool_template::new_key_offset): Remove code to initialize
8160         Stringpool_template::offset_.
8161         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8162         Stringpool_template::offset_ to zero.
8163
8164 2010-03-15  Doug Kwan  <dougkwan@google.com>
8165
8166         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8167         offset_.
8168         (Stringpool_template::new_key_offset): New method.
8169         (Stringpool_template::add_string): Assign offsets when adding new
8170         strings.
8171         (Stringpool_template::set_string_offsets): Do not set string offsets
8172         when not optimizing.
8173         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8174         member size_.
8175         (Chunked_vector::clear): Clear size_.
8176         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8177         (Chunked_vector::size): Return size_.
8178         (Chunked_vector::push_back): Use size_ to find insert position.
8179         (Chunked_vector::size_): New data member.
8180         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8181         (Stringpool_template::new_key_offset): New method declaration.
8182         (Stringpool_template::offset_): New data member.
8183
8184 2010-03-15   Rafael Espindola  <espindola@google.com>
8185
8186         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8187         Add_symbols' constructor.
8188         * readsyms.h (Add_symbols): Remove the input_group member.
8189
8190 2010-03-10  Ian Lance Taylor  <iant@google.com>
8191
8192         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8193         target to ask whether a reference to a symbol requires a stack
8194         split.
8195         * target.h (Target::is_call_to_non_split): New function.
8196         (Target::do_is_call_to_non_split): Declare virtual function.
8197         * target.cc: Include "symtab.h".
8198         (Target::do_is_call_to_non_split): New function.
8199         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8200
8201 2010-03-10  Cary Coutant  <ccoutant@google.com>
8202
8203         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8204         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8205         (File_read::open[2]): Add whole_file_view_ to list of views.
8206         (File_read::make_view): Remove test of whole_file_view_.
8207         (File_read::find_or_make_view): Create whole_file_view_ if
8208         necessary.
8209         (File_read::clear_views): Replace bool parameter with enum;
8210         adjust all callers.  Don't delete views with permanent data;
8211         do delete cached views and views from archives if
8212         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8213         if clearing the corresponding view.
8214         * fileread.h (File_read::Clear_views_mode): New enum.
8215         (File_read::View::is_permanent_view): New method.
8216         (File_read::clear_views): Replace bool parameter
8217         with enum; adjust all callers.
8218         * options.h (General_options): Change keep_files_mapped option;
8219         add map_whole_files.
8220         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8221         releasing the file.
8222         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8223         the file.
8224
8225 2010-03-10  David S. Miller  <davem@davemloft.net>
8226
8227         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8228
8229 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8230
8231         * icf.cc (get_section_contents): Add '@' marker after processing the
8232         merge reloc.
8233
8234 2010-03-08  Doug Kwan  <dougkwan@google.com>
8235
8236         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8237         due to a conversion warning.
8238         (Arm_relobj::update_output_local_symbol_count): Check for local
8239         symbol with unset output index.
8240
8241 2010-03-05  Ian Lance Taylor  <iant@google.com>
8242
8243         * options.h (class General_options): Add --spare-dynamic-tags.
8244         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8245         --spare-dynamic-tags.
8246
8247 2010-03-05  Ian Lance Taylor  <iant@google.com>
8248
8249         * incremental.cc: Include "libiberty.h".
8250
8251 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8252
8253         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8254         function, is_info_ member.
8255         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8256         (Versions::Versions): Update caller.
8257         (Versions::define_base_version): Likewise.
8258         (Versions::add_def): Likewise.
8259
8260 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8261
8262         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8263         (Scan::possible_function_pointer_reloc): New function.
8264         (Scan::local_reloc_may_be_function_pointer): Change to call
8265         possible_function_pointer_reloc.
8266         (Scan::global_reloc_may_be_function_pointer): Ditto.
8267         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8268         relocations in ".data.rel.ro._ZTV" section.
8269         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8270         * testsuite/icf_safe_so_test.cc: Ditto.
8271         * testsuite/icf_safe_test.cc: Ditto.
8272         * testsuite/icf_safe_test.sh: Ditto.
8273
8274 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8275             Ian Lance Taylor  <iant@google.com>
8276
8277         * target-reloc.h (relocate_section): Check the symbol table index
8278         for -1U before setting the local symbol index.
8279         (scan_relocatable_relocs): If copying the relocation, record that
8280         the local symbol is required.
8281         * object.h (Symbol_value::is_output_symtab_index_set): New
8282         function.
8283         (Symbol_value::may_be_discarded_from_output_symtab): New
8284         function.
8285         (Symbol_value::has_output_symtab_entry): New function.
8286         (Symbol_value::needs_output_symtab_entry): Remove.
8287         (Symbol_value::output_symtab_index): Make sure the symbol index is
8288         set.
8289         (Symbol_value::set_output_symtab_index): Make sure the symbol
8290         index is not set.  Make sure the new index is valid.
8291         (Symbol_value::set_must_have_output_symtab_entry): New function.
8292         (Symbol_value::has_output_dynsym_entry): New function.
8293         (Symbol_value::set_output_dynsym_index): Make sure the new index
8294         is valid.
8295         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8296         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8297         local symbol if permitted.
8298         (Sized_relobj::do_finalize_local_symbols): Call
8299         is_output_symtab_index_set rather than needs_output_symtab_entry.
8300         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8301         rather than needs_output_symtab_entry.  Call
8302         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8303         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8304         is_output_symtab_index_set rather than needs_output_symtab_entry.
8305         * testsuite/discard_locals_relocatable_test.c: New file.
8306         * testsuite/discard_locals_test.sh: Test -r.
8307         * testsuite/Makefile.am (check_DATA): Add
8308         discard_locals_relocatable_test1.syms,
8309         discard_local_relocatable_test2.syms.
8310         (MOSTLYCLEANFILES): Likewise.  Also add
8311         discard_locals_relocatable_test1.lout and
8312         discard_locals_relocatable_test2.out.
8313         (discard_locals_relocatable_test1.syms): New target.
8314         (discard_locals_relocatable_test.o): New target.
8315         (discard_locals_relocatable_test1.out): New target.
8316         (discard_locals_relocatable_test2.syms): New target.
8317         (discard_locals_relocatable_test2.out): New target.
8318         (various): Add missing ../ld-new dependencies.
8319         * testsuite/Makefile.in: Rebuild.
8320
8321 2010-03-03  Nick Clifton  <nickc@redhat.com>
8322
8323         * po/fi.po: New Finnish translation.
8324
8325 2010-03-01  Doug Kwan  <dougkwan@google.com>
8326
8327         * layout.cc (Layout::Layout): Force section types of .init_array*,
8328         .preinit_array* and .fini_array* sections.
8329         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8330         Fix check of return value of std::string::find.().
8331         (Output_section::Input_section_sort_compare::operator()): Remove
8332         comment about .init_array.
8333         (Output_section::Input_section_sort_init_fini_compare::operator()):
8334         New method.
8335         (Output_section::sort_attached_input_sections): Handle .init_array
8336         and .fini_array specially.
8337         * output.h (Output_section::Inut_section_sort_compare): Update
8338         comment.
8339         (Output_section::Input_section_sort_init_fini_compare): New struct.
8340
8341 2010-02-26  Doug Kwan  <dougkwan@google.com>
8342
8343         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8344         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8345         * testsuite/debug_msg.sh: Avoid matching source line number for
8346         use of global variable undef_int.
8347
8348 2010-02-26  Doug Kwan  <dougkwan@google.com>
8349
8350         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8351         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8352         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8353         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8354         * options.cc (General_options::General_options): Initialize member
8355         fix_v4bx_.
8356         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8357         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8358         and rm_no_fix_v4bx.stdout
8359         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8360         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8361         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8362         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8363         and arm_no_fix_v4bx.
8364         * Makefile.in: Regenerate.
8365         * testsuite/arm_fix_v4bx.s: New file.
8366         * testsuite/arm_fix_v4bx.sh: Ditto.
8367
8368 2010-02-24  Doug Kwan  <dougkwan@google.com>
8369
8370         * arm.cc (Target_arm::got_section): Make the .got section the first
8371         non RELRO section in the data segment.
8372         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8373         suffixes of section names.
8374
8375 2010-02-24  Doug Kwan  <dougkwan@google.com>
8376
8377         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8378         flags and attributes merging if an input file is a binary file.
8379         * fileread.cc (Input_file::open): Record format of original file.
8380         * fileread.h (Input_file::Format): New enum type.
8381         (Input_file::Input_file): Initialize data member format_.
8382         (Input_file::format): New method definition.
8383         (Input_file::format_):: New data member.
8384
8385 2010-02-24  Doug Kwan  <dougkwan@google.com>
8386
8387         * arm.cc (Arm_output_data_got): New class.
8388         (ARM_TCB_SIZE): New constant
8389         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8390         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8391         If user uses a script with a SECTIONS clause, issue only a warning
8392         for a misplaced EXIDX input section.  Otherwise, issue an error.
8393         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8394         garbage collection.
8395         (Target_arm::got_mode_index_entry): Handle static linking.
8396         (Target_arm::Scan::local): Ditto.
8397         (Target_arm::Scan::global): Ditto.
8398         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8399         all incorrectly implemented relocations.
8400         (Target_arm::fix_exidx_coverage): Pass layout to
8401         Arm_output_section::fix_exidx_coverage.
8402         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8403         from ".ARM.exidx." and ".ARM.extab.".
8404
8405 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8406
8407         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8408         section if it does not already exist.
8409         * attributes.cc (Attributes_section_data::Attributes_section_data):
8410         Don't crash if size is zero.
8411
8412 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8413             Ian Lance Taylor  <iant@google.com>
8414
8415         * gold.cc (queue_middle_tasks): If no input files were opened,
8416         exit.
8417         * workqueue.h (Task_function::Task_function): Assert that there is
8418         a blocker.
8419
8420 2010-02-22  Doug Kwan  <dougkwan@google.com>
8421
8422         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8423         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8424         types to avoid warnings due to different uint64_t implementations
8425         on different hosts.
8426
8427 2010-02-21  Doug Kwan  <dougkwan@google.com>
8428
8429         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8430         handling of the maximum backward branch offset.
8431         (Arm_relocate_functions::thumb_branch_common): Ditto.
8432         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8433         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8434         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8435         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8436         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8437         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8438         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8439         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8440         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8441         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8442         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8443         thumb2_bl_out_of_range.o): New rules.
8444         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8445         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8446         thumb2_bl_out_of_range
8447         * testsuite/Makefile.in: Regenerate.
8448         * testsuite/arm_bl_in_range.s: New file.
8449         * testsuite/arm_bl_out_of_range.s: Ditto.
8450         * testsuite/arm_branch_in_range.sh: Ditto.
8451         * testsuite/arm_branch_range.t: Ditto.
8452         * testsuite/thumb2_branch_range.t: Ditto.
8453         * testsuite/thumb_bl_in_range.s: Ditto.
8454         * testsuite/thumb_bl_out_of_range.s: Ditto.
8455         * testsuite/thumb_branch_range.t: Ditto.
8456
8457 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8458
8459         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8460         Add reloc offset information.
8461         * icf.cc (get_section_contents): Change iterators to point to the new
8462         vectors. Add reloc offset information to the contents.
8463         * icf.h (Icf::Sections_reachable_info): New typedef.
8464         (Icf::Sections_reachable_list): New typedef.
8465         (Icf::Offset_info): New typedef.
8466         (Icf::Reloc_info): New struct typedef.
8467         (Icf::Reloc_info_list): New typedef.
8468         (Icf::symbol_reloc_list): Delete method.
8469         (Icf::addend_reloc_list): Delete method.
8470         (Icf::section_reloc_list): Delete method.
8471         (Icf::reloc_info_list): New method.
8472         (Icf::reloc_info_list_): New member.
8473
8474 2010-02-19  Doug Kwan  <dougkwan@google.com>
8475
8476         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8477         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8478         * arm.cc (Arm_relocation_functions): New forward declaration.
8479         (Target_arm::Target_arm): Initialize new data members
8480         got_mod_index_offset_ and tls_base_symbol_defined_.
8481         (Target_arm::Relocate::relocate_tls): New method.
8482         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8483          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8484         New methods.
8485         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8486         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8487         (Target_arm::got_mod_index_offset_,
8488         Target_arm::tls_base_symbol_defined_): New data members.
8489         (Target_arm::Scan::local, Target::Scan::global,
8490         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8491         relocations.
8492
8493 2010-02-18  Doug Kwan  <dougkwan@google.com>
8494
8495         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8496         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8497         text section as a parameter becuase some broken tools may not set
8498         the link in section header.
8499         (Target_arm::has_got_section): New method.
8500         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8501         without any mapping symbol as data only.  Remove warning.
8502         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8503         link in its section header, try to discover the link by inspecting the
8504         REL31 relocation at the beginning of the section.
8505         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8506         in error message.
8507         (Target_arm::Scan::global): Treat any reference to the symbol
8508         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8509
8510 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8511
8512         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8513         (Scan::global_reloc_may_be_function_pointer): New function.
8514         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8515         (Scan::global_reloc_may_be_function_pointer): New function.
8516         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8517         (Scan::global_reloc_may_be_function_pointer): New function.
8518         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8519         (Scan::global_reloc_may_be_function_pointer): New function.
8520         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8521         (Scan::global_reloc_may_be_function_pointer): New function.
8522         (Scan::possible_function_pointer_reloc): New function.
8523         (Target_x86_64::can_check_for_function_pointers): New function.
8524         * gc.h (gc_process_relocs): Scan relocation types to determine if
8525         function pointers were taken for targets that support it.
8526         * icf.cc (Icf::find_identical_sections): Include functions for
8527         folding in safe ICF whose pointer is not taken.
8528         * icf.h (Secn_fptr_taken_set): New typedef.
8529         (fptr_section_id_): New member.
8530         (section_has_function_pointers): New function.
8531         (set_section_has_function_pointers): New function.
8532         (check_section_for_function_pointers): New function.
8533         * options.h: Fix comment for safe ICF option.
8534         * target.h (can_check_for_function_pointers): New function.
8535         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8536         Modify icf_safe_test for X86-64.
8537         * testsuite/Makefile.in: Regenerate.
8538         * testsuite/icf_safe_so_test.cc: New file.
8539         * testsuite/icf_safe_so_test.sh: New file.
8540         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8541         (main): Change to take pointer to function kept_func_3.
8542         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8543         folding is done correctly for X86-64.
8544
8545 2010-02-12  David S. Miller  <davem@davemloft.net>
8546
8547         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8548         is_symbolless parameter.
8549         (Output_reloc<SHT_REL>::is_symbolless): New.
8550         (Output_reloc<SHT_REL>::is_symbolless_): New.
8551         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8552         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8553         (Output_reloc<SHT_RELA>::is_symbolless): New.
8554         (Output_data_reloc::add_global): Handle is_symbolless.
8555         (Output_data_reloc::add_global_relative): Likewise.
8556         (Output_data_reloc::add_local): Likewise.
8557         (Output_data_reloc::add_local_relative): Likewise.
8558         (Output_data_reloc::add_symbolless_global_addend): New.
8559         (Output_data_reloc::add_symbolless_local_addend): New.
8560         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8561         is_symbolless.
8562         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8563         instead of ->is_relative_
8564         (Output_reloc::write): Likewise.
8565         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8566         (Output_reloc::write_rel): Simplify.
8567
8568         * sparc.cc (Target_sparc::Scan::local): Use
8569         ->add_symbolless_local_addend as needed.
8570         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8571         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8572         based upon relocation offset.
8573
8574 2010-02-11  Doug Kwan  <dougkwan@google.com>
8575
8576         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8577         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8578         beginning of function.
8579         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8580         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8581         parameter is_32bit in calls to should_apply_static_reloc.
8582         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8583         (check_DATA): Add arm_abs_global.stdout.
8584         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8585         arm_abs_global.stdout): New rules.
8586         (MOSTLLYCLEANFILES): Add arm_abs_global
8587         * Makefile.in: Regenerate.
8588         * testsuite/arm_abs_global.s: New file.
8589         * testsuite/arm_abs_global.sh: Ditto.
8590         * testsuite/arm_abs_lib.s: Ditto.
8591
8592 2010-02-11  Ian Lance Taylor  <iant@google.com>
8593
8594         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8595         Read_relocs task.
8596         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8597         Allocate_commons_task first.
8598         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8599         task, rather than symtab_lock_.
8600         (Gc_process_relocs::~Gc_process_relocs): New function.
8601         (Gc_process_relocs::is_runnable): Check this_blocker_.
8602         (Gc_process_relocs::locks): Use next_blocker_ rather than
8603         blocker_.
8604         (Scan_relocs::~Scan_relocs): New function.
8605         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8606         symtab_lock_.
8607         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8608         next_blocker_.
8609         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8610         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8611         constructor accordingly.
8612         (class Gc_process_relocs): Likewise.
8613         (class Scan_relocs): Likewise.
8614         * common.h (class Allocate_commons_task): Remove symtab_lock_
8615         field, and corresponding constructor parameter.
8616         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8617         symtab_lock_.
8618         (Allocate_commons_task::locks): Likewise.
8619
8620 2010-02-11  Ian Lance Taylor  <iant@google.com>
8621
8622         * gold-threads.h (class Once): Define.
8623         (class Initialize_lock): Rewrite as child of Once.
8624         * gold-threads.cc (class Once_initialize): Define.
8625         (once_pointer_control): New static variable.
8626         (once_pointer, once_arg): New static variables.
8627         (c_run_once): New static function.
8628         (Once::Once, Once::run_once, Once::internal_run): New functions.
8629         (class Initialize_lock_once): Remove.
8630         (initialize_lock_control): Remove.
8631         (initialize_lock_pointer): Remove.
8632         (initialize_lock_once): Remove.
8633         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8634         (Initialize_lock::initialize): Rewrite.
8635         (Initialize_lock::do_run_once): New function.
8636         * archive.cc (Archive::interpret_header): Only clear name if it is
8637         not already empty.
8638         * fileread.cc: Include "gold-threads.h"
8639         (file_counts_lock): New static variable.
8640         (file_counts_initialize_lock): Likewise.
8641         (File_read::release): Only increment counts when using --stats.
8642         Use a lock around the increment.
8643         * parameters.cc (class Set_parameters_target_once): Define.
8644         (set_parameters_target_once): New static variable.
8645         (Parameters::Parameters): Move here from parameters.h.
8646         (Parameters::set_target): Rewrite.
8647         (Parameters::set_target_once): New function.
8648         (Parameters::clear_target): Move here and rewrite.
8649         * parameters.h (class Parameters): Update declarations.  Add
8650         set_parameters_target_once_ field.
8651         (Parameters::Parameters): Move to parameters.cc.
8652         (Parameters::clear_target): Likewise.
8653         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8654         task.
8655         (Start_group::~Start_group): New function.
8656         (Start_group::is_runnable): New function.
8657         (Start_group::locks, Start_group::run): New functions.
8658         (Finish_group::run): Change saw_undefined to size_t.
8659         * readsyms.h (class Start_group): Define.
8660         (class Finish_group): Change saw_undefined_ field to size_t.
8661         (Finish_group::Finish_group): Remove saw_undefined and
8662         this_blocker parameters.  Change all callers.
8663         (Finish_group::set_saw_undefined): New function.
8664         (Finish_group::set_blocker): New function.
8665         * symtab.h (class Symbol_table): Change saw_undefined to return
8666         size_t.  Change saw_undefined_ field to size_t.
8667         * target-select.cc (Set_target_once::do_run_once): New function.
8668         (Target_selector::Target_selector): Initialize set_target_once_
8669         field.  Don't initialize lock_ and initialize_lock_ fields.
8670         (Target_selector::instantiate_target): Rewrite.
8671         (Target_selector::set_target): New function.
8672         * target-select.h (class Set_target_once): Define.
8673         (class Target_selector): Update declarations.  Make
8674         Set_target_once a friend.  Remove lock_ and initialize_lock_
8675         fields.  Add set_target_once_ field.
8676
8677 2010-02-10  Ian Lance Taylor  <iant@google.com>
8678
8679         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8680         queueing any tasks.
8681         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8682         (queue_middle_tasks): Add all blockers before queueing any tasks.
8683         (queue_final_tasks): Likewise.
8684         * token.h (Task_token::add_blockers): New function.
8685         * object.h (Input_objects::number_of_relobjs): New function.
8686
8687 2010-02-10  Ian Lance Taylor  <iant@google.com>
8688
8689         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8690         shared, not if not position independent.
8691         * x86_64.cc (Relocate::relocate_tls): Likewise.
8692         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8693         (tls_pie_pic_test): New target.
8694         * testsuite/Makefile.in: Rebuild.
8695
8696         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8697         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8698         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8699         * testsuite/Makefile.in: Rebuild.
8700
8701 2010-02-09  David S. Miller  <davem@davemloft.net>
8702
8703         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8704         R_SPARC_RELATIVE using ->add_local_relative().
8705         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8706
8707         * output.h (Output_data_dynamic::add_section_size): New method
8708         that takes two Output_data objects.
8709         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8710         entry param.  Handle it in initializers.
8711         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8712         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8713         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8714         arg.
8715         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8716         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8717         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8718         for dynrel_includes_plt.
8719         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8720         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8721         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8722         before .rela.plt
8723         (Target_sparc::do_finalize_sections): Update to pass true for
8724         dynrel_includes_plt.
8725         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8726         output before .rela.plt
8727         (Target_powerpc::do_finalize_sections): Update to pass true for
8728         dynrel_includes_plt when 32-bit.
8729
8730 2010-02-08  Doug Kwan  <dougkwan@google.com>
8731
8732         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8733         method.
8734         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8735         Arm_relobj::scan_section_for_cortex_a8_stubs,
8736         Arm_relobj::do_relocation_section): Instead of calling
8737         Output_section::output_address, use faster
8738         Arm_relobj::simple_input_section_output_address.
8739
8740 2010-02-08  David S. Miller  <davem@davemloft.net>
8741
8742         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8743         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8744         relocation helper function.
8745
8746         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8747         just like R_SPARC_GOT{10,13,22}.
8748         (Target_sparc::Scan::local): Likewise.
8749         (Target_sparc::Relocate:relocate): Likewise.
8750
8751 2010-02-06  Ian Lance Taylor  <iant@google.com>
8752
8753         * configure.ac: Rewrite targetobjs duplicate removal code to use
8754         only shell constructs.
8755         * configure: Rebuild.
8756
8757 2010-02-05  Doug Kwan  <dougkwan@google.com>
8758
8759         PR 11247
8760         * arm.cc (Arm_relobj::section_is_scannable): New method.
8761         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8762         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8763
8764 2010-02-04  Doug Kwan  <dougkwan@google.com>
8765
8766         PR 11247
8767         * arm-reloc-property.cc (cstdio): Include.
8768         * configure.ac (targetobjs): Remove duplicates.
8769         * configure: Regenerate.
8770         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8771         big and little endian version for a given address size.
8772
8773 2010-02-03  Doug Kwan  <dougkwan@google.com>
8774
8775         * arm-reloc-property.cc
8776         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8777         definition.
8778         * arm-reloc-property.h
8779         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8780         New method definition.
8781         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8782         declaration.
8783         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8784         overflow to N.
8785         (GOT_PREL): Change implemented to Y.
8786         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8787         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8788         (Arm_relocate_functions::movw_abs_nc): Remove method.
8789         (Arm_relocate_functions::movt_abs): Ditto.
8790         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8791         (Arm_relocate_functions::thm_movt_abs): Ditto.
8792         (Arm_relocate_functions::movw_rel_nc): Ditto.
8793         (Arm_relocate_functions::movw_rel): Ditto.
8794         (Arm_relocate_functions::movt_rel): Ditto.
8795         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8796         (Arm_relocate_functions:thm_movw_rel): Ditto.
8797         (Arm_relocate_functions:thm_movt_rel): Ditto.
8798         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8799         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8800         New method definitions.
8801         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8802         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8803         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8804         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8805         (Target_arm::Relocate::relocate): Check for non-static or
8806         unimplemented relocation code and exit early.  Change calls to
8807         Target_arm::reloc_uses_thumb_bit and
8808         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8809         instead.  Refactor code to handle similar relocations to increase
8810         code sharing.  Remove check for unsupported relocation code in switch
8811         statement.
8812         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8813         relocation property table to find out size.  Change error message to
8814         print out the name of a relocation code instead of the numeric value.
8815         (Target_arm::scan_reloc_for_stub): Use relocation property table
8816         instead of calling Target_arm::reloc_uses_thumb_bit().
8817
8818 2010-02-02  Doug Kwan  <dougkwan@google.com>
8819
8820         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8821         types of relaxed input section.
8822
8823 2010-02-02  Doug Kwan  <dougkwan@google.com>
8824
8825         * Makefile.am (HFILES): Add arm-reloc-property.h.
8826         (DEFFILES): New.
8827         (TARGETSOURCES): Add arm-reloc-property.cc
8828         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8829         (libgold_a_SOURCES): $(DEFFILES)
8830         * Makefile.in: Regenerate.
8831         * arm-reloc-property.cc: New file.
8832         * arm-reloc-property.h: New file.
8833         * arm-reloc.def: New file.
8834         * arm.cc: Update comments.
8835         (arm-reloc-property.h): New included header.
8836         (arm_reloc_property_table): New global variable.
8837         (Target_arm::do_select_as_default_target): New method definition.
8838         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8839         arm-reloc-property to targ_extra_obj.
8840         * parameters.cc (set_parameters_target): Call
8841         Target::select_as_default_target().
8842         * target.h (Target::select_as_default_target): New method definition.
8843         (Target::do_select_as_default_target): Same.
8844
8845 2010-02-01  Doug Kwan  <dougkwan@google.com>
8846
8847         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8848         first_output_text_section_.
8849         (Arm_exidx_fixup::first_output_text_section): New method definition.
8850         (Arm_exidx_fixup::first_output_text_section_): New data member.
8851         (Arm_exidx_fixup::process_exidx_section): Record the first text
8852         output section seen.
8853         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8854         and entsize in output section header.
8855
8856 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8857
8858         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8859         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8860         (Arm_relocate_functions::thm_alu11): New Method.
8861         (Arm_relocate_functions::thm_pc8): New Method.
8862         (Arm_relocate_functions::thm_pc12): New Method.
8863         (Target_arm::Scan::local): Handle the relocations.
8864         (Target_arm::Scan::global): Likewise.
8865         (Target_arm::Relocate::relocate): Likewise.
8866         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8867
8868 2010-01-29  Doug Kwan  <dougkwan@google.com>
8869
8870         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8871         of relocation types as ld.
8872
8873 2010-01-29  Doug Kwan  <dougkwan@google.com>
8874
8875         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8876         to public.
8877         (Arm_relocate_functions::thumb_branch_common): Ditto.
8878         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8879         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8880         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8881         Arm_relocate_functions::jump24): Remove.
8882         (Target_arm::Relocate::relocate): Adjust code to call
8883         Arm_relocation_functions::arm_branch_common and
8884         Arm_relocation_functions::thumb_branch_common instead of their removed
8885         wrappers.  Merge switch-cases together to reduce source code size.
8886
8887 2010-01-29  Doug Kwan  <dougkwan@google.com>
8888
8889         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8890         output_local_symbol_count_needs_update_.
8891         (Arm_relobj::output_local_symbol_count_needs_update,
8892          Arm_relobj::set_output_local_symbol_count_needs_update,
8893          Arm_relobj::update_output_local_symbol_count): New methods.
8894         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8895         member.
8896         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8897         of pointed function as in a R_ARM_PREL31 relocation.
8898         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8899         for output local symbol count updating.
8900         (Target_arm::do_relax): Update output local symbol counts in objects
8901         if necessary.
8902         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8903
8904 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8905
8906         * arm.cc: Added support for the ARM relocations:
8907         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8908         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8909         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8910         movw_prel_nc).
8911         (Arm_relocate_functions::movw_rel): New method.
8912         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8913         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8914         thm_movw_prel_nc).
8915         (Arm_relocate_functions::thm_movw_rel): New method.
8916         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8917         thm_movt_prel).
8918         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8919         relocations.
8920         (Target_arm::Scan::global): Likewise.
8921         (Target_arm::Relocate::relocate): Likewise.
8922         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8923         Likewise.
8924
8925 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8926
8927         * arm.cc: Added support for ARM group relocations.
8928         (Target_arm::reloc_needs_sym_origin): New method.
8929         (Arm_relocate_functions::calc_grp_kn): New method.
8930         (Arm_relocate_functions::calc_grp_residual): New method.
8931         (Arm_relocate_functions::calc_grp_gn): New method.
8932         (Arm_relocate_functions::arm_grp_alu): New Method.
8933         (Arm_relocate_functions::arm_grp_ldr): New Method.
8934         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8935         (Arm_relocate_functions::arm_grp_ldc): New Method.
8936         (Target_arm::Scan::local): Handle the ARM group relocations.
8937         (Target_arm::Scan::global): Likewise.
8938         (Target_arm::Relocate::relocate): Likewise.
8939         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8940         Likewise.
8941
8942 2010-01-26  Doug Kwan  <dougkwan@google.com>
8943
8944         * arm.cc (set): Include.
8945         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8946         pointer type.
8947         (Arm_output_section::Text_section_list): New type.
8948         (Arm_output_section::append_text_sections_to_list): New method.
8949         (Arm_output_section::fix_exidx_coverage): Ditto.
8950         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8951         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8952         Relobj::set_section_offset() instead of
8953         Sized_relobj::invalidate_section_offset().
8954         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8955         parameter for section headers. Ignore relocation sections for
8956         unallocated sections and EXIDX sections.
8957         (Target_arm::fix_exidx_coverage): New method.
8958         (Target_arm::output_section_address_less_than): New type.
8959         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8960         linked text section instead of the EXIDX section.
8961         (Arm_output_section::create_stub_group): Add an assertion to check
8962         that this is not an EXIDX output section.
8963         (Arm_output_section::append_text_sections_to_list): New method.
8964         (Arm_output_section::fix_exidx_coverage): Ditto.
8965         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8966         Arm_relobj::section_needs_reloc_stub_scanning.
8967         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8968         first pass.
8969         (Target_arm::fix_exidx_coverage): New method.
8970         * object.h (Relobj::set_output_section): New method.
8971         (Sized_relobj::invalidate_section_offset): Remove method.
8972         (Sized_relobj::do_invalidate_section_offset): Remove method.
8973         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8974
8975 2010-01-25  Doug Kwan  <dougkwan@google.com>
8976
8977         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8978         Fix warning due to signed and unsigned comparison on a 32-bit host.
8979
8980 2010-01-22  Doug Kwan  <dougkwan@google.com>
8981
8982         * arm.cc (Target_arm::do_relax): Record an output section for section
8983         offset adjustment it contains any stub table that has changed.
8984         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8985         offsets in an output section if necessary.
8986         * output.cc (Output_section::Output_section): Initialize
8987         section_offsets_need_adjustments_.
8988         (Output_section::add_input_section_for_script): Renamed to
8989         Output_section::add_simple_input_section.
8990         (Output_section::save_states): Add a comment.
8991         (Output_section::discard_states): New method defintion.
8992         (Output_section::adjust_section_offsets): Same.
8993         * output.h (Output_section::add_input_section_for_script): Renamed to
8994         Output_section::add_simple_input_section.
8995         (Output_section::discard_states): New method declaration.
8996         (Output_section::adjust_section_offsets): Same.
8997         (Output_section::section_offsets_need_adjustment,
8998         Output_section::set_section_offsets_need_adjustment): New method
8999         definitions.
9000         (Output_section::section_offsets_need_adjustment_): New data member.
9001         * script-sections.cc
9002         (Output_section_element_input::set_section_address): Adjust code for
9003         renaming of Output_section::add_input_section_for_script.
9004         (Orphan_output_section::set_section_address): Same.
9005
9006 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9007
9008         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9009         Fix_v4bx enum values .
9010         * gold/options.h (General_options): New option definitions.
9011         (General_options::fix_v4bx): New method.
9012         (General_options::Fix_v4bx): New enum.
9013         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9014         (General_options::parse_fix_v4bx_interworking): New method.
9015
9016 2010-01-22  Doug Kwan  <dougkwan@google.com>
9017
9018         * arm.cc (Arm_exidx_fixup): New class.
9019
9020 2010-01-21  Doug Kwan  <dougkwan@google.com>
9021
9022         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9023         classes.
9024         (Arm_exidx_section_offset_map): New type.
9025
9026 2010-01-21  Doug Kwan  <dougkwan@google.com>
9027
9028         * arm.cc (Arm_exidx_input_section): New class.
9029         (Arm_relobj::exidx_input_section_by_link,
9030         Arm_relobj::exidx_input_section_by_shndx,
9031         Arm_relobj::make_exidx_input_section): New methods.
9032         (read_arm_attributes_section): Remove.
9033         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9034         information about them.
9035         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9036         to here.
9037
9038 2010-01-20  Doug Kwan  <dougkwan@google.com>
9039
9040         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9041         Input_section_specifier to Section_id.
9042         (Target_arm::new_arm_input_section: Adjust code for change of key
9043         type.
9044         (Target_arm::find_arm_input_section): Ditto.
9045         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9046         (Section_id): Remove.
9047         (Garbage_collection::Section_id_hash): Remove.
9048         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9049         (Section_id): Remove.
9050         (Icf::Section_id_hash): Remove.
9051         * object.h (Section_id, Const_section_id, Section_id_hash,
9052         Const_section_id_hash): New type definitions.
9053         * output.cc (Output_section::add_relaxed_input_section): Change to
9054         use Const_section_id instead of Input_section_specifier as key type.
9055         (Output_section::add_merge_input_section): Ditto.
9056         (Output_section::build_relaxation_map): Change to use Section_id
9057         instead of Input_section_specifier as key type.
9058         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9059         Ditto.
9060         (Output_section::convert_input_sections_to_relaxed_sections): Change
9061         to use Const_section_id instead of Input_section_specifier as key type.
9062         (Output_section::find_merge_section): Ditto.
9063         (Output_section::find_relaxed_input_section): Ditto.
9064         * output.h (Input_section_specifier): Remove class.
9065         (Output_section::Output_section_data_by_input_section_map): Change
9066         key type to Const_section_id.
9067         (Output_section::Output_relaxed_input_section_by_input_section_map):
9068         Ditto.
9069         (Output_section::Relaxation_map): Change key type to Section_id.
9070
9071 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9072
9073         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9074         (class Arm_v4bx_stub): New class.
9075         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9076         (Stub_factory::make_arm_v4bx_stub): New method.
9077         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9078         (Stub_table::empty): Handle v4bx stubs.
9079         (Stub_table::add_arm_v4bx_stub): New method.
9080         (Stub_table::find_arm_v4bx_stub): New method.
9081         (Arm_relocate_functions::v4bx): New method.
9082         (Target_arm::fix_v4bx): New method.
9083         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9084         (Stub_table::relocate_stubs): Likewise.
9085         (Stub_table::do_write): Likewise.
9086         (Stub_table::update_data_size_and_addralign): Likewise.
9087         (Stub_table::finalize_stubs):  Likewise.
9088         (Target_arm::Scan::local): Likewise.
9089         (Target_arm::Scan::global): Likewise.
9090         (Target_arm::do_finalize_sections): Likewise.
9091         (Target_arm::Relocate::relocate): Likewise.
9092         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9093         Likewise.
9094         (Target_arm::scan_reloc_for_stub): Likewise.
9095         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9096
9097 2010-01-19  Ian Lance Taylor  <iant@google.com>
9098
9099         * output.cc (Output_section_headers::do_sized_write): Write large
9100         segment count to sh_info field.
9101         (Output_file_header::do_sized_write): For large segment count,
9102         write PN_XNUM to e_phnum field.
9103
9104 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9105
9106         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9107         (Arm_relocate_functions::thm_jump8): New function.
9108         (Arm_relocate_functions::thm_jump11): New function.
9109         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9110         R_ARM_THM_JUMP11.
9111         (Target_arm::Scan::global): Likewise.
9112         (Target_arm::Relocate::relocate): Likewise.
9113         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9114         Likewise.
9115
9116 2010-01-14  Doug Kwan  <dougkwan@google.com>
9117
9118         * arm.cc (map, utility): Include headers.
9119         (Target_arm::apply_cortex_a8_workaround): New method.
9120         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9121         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9122         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9123         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9124         the --[no-]fix-cortex-a8 command line options.
9125         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9126         (Target_arm::relocate_stub): Use addend in instruction template.
9127         * options.h (DEFINE_bool): Set the user-set flag.
9128         (General_options): Add --[no-]-fix-cortex options.
9129         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9130         : Update fast look-up map after conversion.
9131
9132 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9133
9134         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9135         in the first pass of do_layout.
9136
9137 2010-01-13  Doug Kwan  <dougkwan@google.com>
9138
9139         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9140         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9141         apparent compiler problem of not folding static constant integral
9142         data members of elfcpp::Elf_sizes<32>.
9143
9144 2010-01-13  Doug Kwan  <dougkwan@google.com>
9145
9146         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9147         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9148         Arm_relobj::scan_section_for_cortex_a8_erratum,
9149         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9150         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9151         sections to scan for relocation stubs into a new method
9152         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9153         relocation and Cortex-A8 stub scanning.
9154         (Target_arm::do_relax): Force stubs to be after stubbed sections
9155         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9156         the beginning of a new relaxation pass.  Update a comment.
9157         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9158
9159 2010-01-12  Ian Lance Taylor  <iant@google.com>
9160
9161         * target-reloc.h (visibility_error): New inline function.
9162         (relocate_section): Call visibility_error.
9163         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9164         (MOSTLYCLEANFILES): Likewise.
9165         (protected_4_pic.o, protected_3.err): New targets.
9166         * testsuite/protected_4.cc: New file.
9167
9168 2010-01-12  Doug Kwan  <dougkwan@google.com>
9169
9170         * arm.cc (Cortex_a8_reloc): New class.
9171         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9172         and cortex_a8_relocs_info_.
9173         (Target_arm::fix_cortex_a8): New method definition.
9174         (Target_arm::Cortex_a8_relocs_info): New type.
9175         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9176         New data member declarations.
9177         (Target_arm::scan_reloc_for_stub): Record information about
9178         relocations for THUMB branches that might be exempted from the
9179         Cortex-A8 workaround.
9180         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9181         at the beginning of a relaxation pass.
9182
9183 2010-01-12  Doug Kwan  <dougkwan@google.com>
9184
9185         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9186         (Arm_relobj::Mapping_symbol_position,
9187          Arm_reloj::Mapping_symbol_position_less,
9188          Arm_relobj::Mapping_symbols_info): New types.
9189         (Target_arm::is_mapping_symbol_name): New method definition.
9190         (Arm_relobj::do_count_local_symbols): Save information about mapping
9191         symbols.
9192
9193 2010-01-11  Doug Kwan  <dougkwan@google.com>
9194
9195         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9196         Arm_relocate_functions::thumb32_branch_upper,
9197         Arm_relocate_functions::thumb32_branch_lower,
9198         Arm_relocate_functions::thumb32_cond_branch_offset,
9199         Arm_relocate_functions::thumb32_cond_branch_upper,
9200         Arm_relocate_functions::thumb32_cond_branch_lower,
9201         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9202         branch offset encoding.
9203         (Arm_relocate_functions::thumb_branch_common): Use new branch
9204         offset encoding methods to avoid code duplication.
9205         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9206         (Stub_addend_reader::operator()): Use new branch encoding method
9207         to avoid code duplication.
9208
9209 2010-01-11  Doug Kwan  <dougkwan@google.com>
9210
9211         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9212         (Target_arm::do_finalize_sections): Define special EXIDX section
9213         symbols only if referenced.
9214         * gc.h (Garbage_collection::add_reference): New method.
9215         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9216         code duplication.
9217
9218 2010-01-11  Ian Lance Taylor  <iant@google.com>
9219
9220         * script.cc (Version_script_info::build_expression_list_lookup):
9221         Change complaing about duplicate wildcard match from error to
9222         warning.
9223
9224         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9225         of 2009-12-30.
9226         (Version_script_info::Version_script_info): Initialize globs_,
9227         default_version_, default_is_global_, and exact_.  Don't
9228         initialize globals_ or locals_.
9229         (Version_script_info::build_lookup_tables): Build local symbols
9230         first.
9231         (Version_script_info::unquote): New function.
9232         (Version_script_info::add_exact_match): New function.
9233         (Version_script_info::build_expression_list_lookup): Remove lookup
9234         parameter.  Add is_global parameter.  Change all callers.  Handle
9235         wildcard pattern specially.  Unquote pattern.  Call
9236         add_exact_match.
9237         (Version_script_info::get_name_to_match): New function.
9238         (Version_script_info::get_symbol_version): New function.
9239         (Version_script_info::get_symbol_version_helper): Remove.
9240         (Version_script_info::check_unmatched_names): Call unquote.
9241         * script.h (class Version_script_info): Change get_symbol_version
9242         to be non-inline and add is_global parameter; change all callers.
9243         Rewrite symbol_is_local.  Update declarations.  Define struct
9244         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9245         Remove globals_ and locals_ members.  Add exact_, globs_,
9246         default_version_, is_global_.
9247         (Version_script_info::Glob): Remove pattern, add expression and
9248         is_global.  Update constructor.  Change all callers.
9249         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9250         default version.
9251         (Versions::symbol_section_contents): If a symbol is undefined, or
9252         defined in a dynamic object, set the version index to
9253         VER_NDX_LOCAL.
9254         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9255         symbol_is_local.
9256         (Symbol_table::add_from_pluginobj): Likewise.
9257         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9258
9259 2010-01-11  Doug Kwan  <dougkwan@google.com>
9260
9261         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9262         (incremental_dump_LDADD): Add linking option for libintl.
9263         * Makefile.in: Regenerate.
9264
9265 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9266
9267         PR gold/11144
9268         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9269         instead of -Ds.
9270         * testsuite/Makefile.in: Regenerated.
9271
9272 2010-01-10  Doug Kwan  <dougkwan@google.com>
9273
9274         * options.h (DEFINE_var): Use parentheses around argument varname__
9275         in macro body to avoid any unintended subsequent substitutions.
9276
9277 2010-01-10  Ian Lance Taylor  <iant@google.com>
9278
9279         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9280         candidates before doing symbol resolution.
9281
9282         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9283         ODR candidates if only one is weak.
9284
9285 2010-01-08  Ian Lance Taylor  <iant@google.com>
9286
9287         * script.cc (Version_script_info::build_expression_list_lookup):
9288         Don't warn about ambiguous version, just record the ambiguity.
9289         (Version_script_info::get_symbol_version_helper): Give error if
9290         version is ambiguous.
9291
9292 2010-01-08  Doug Kwan  <dougkwan@google.com>
9293
9294         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9295         prev_data_size_ and prev_addralign_.  Remove initializer for
9296         deleted data member has_been_changed_.
9297         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9298         to determine if the table is empty.
9299         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9300         Remove.
9301         (Stub_table::add_reloc_stub): Define method in class definition
9302         instead of just declaring it there.
9303         (Stub_table::add_cortex_a8_stub): New method definition.
9304         (Stub_table::update_data_size_and_addralign): Ditto.
9305         (Stub_table::finalize_stubs): Ditto.
9306         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9307         (Stub_table::do_addralign_): Return address alignment in the
9308         (Stub_table::do_reset_address_and_file_offset): Define method in
9309         class definition instead of declaring it there.  Set current data
9310         size to be the data size of the previous pass.
9311         (Stub_table::set_final_data_size): Use current data size as the
9312         final data size.
9313         (Stub_table::relocate_stub): Change parameter type of stub from
9314         Reloc_stub pointer to Stub pointer.
9315         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9316         (Stub_table::Cortex_a8_stub_list): New typedef.
9317         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9318          Stub_table::prev_addralign_): New data member.
9319         (Arm_relobj::Arm_relobj): Initialize data member
9320         section_has_cortex_a8_workaround_.
9321         (Arm_relobj::section_has_cortex_a8_workaround,
9322          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9323          definitions.
9324         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9325         declarations.
9326         (Target_arm::relocate_stub): Change parameter type of stub from
9327         Reloc_stub pointer to Stub pointer.
9328         (Insn_template::size, Insn_template::alignment): Handle
9329         THUMB16_SPECIAL_TYPE.
9330         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9331          Stub_table::update_data_size_and_addralign,
9332          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9333         definitions.
9334         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9335         (Stub_table::do_write): Ditto.
9336         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9337
9338 2010-01-08  Ian Lance Taylor  <iant@google.com>
9339
9340         PR 11108
9341         * symtab.h (class Symbol): Remove fields is_target_special_ and
9342         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9343         (Symbol::is_defined_in_discarded_section): New function.
9344         (Symbol::set_is_defined_in_discarded_section): New function.
9345         (Symbol::has_plt_offset): Rewrite.
9346         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9347         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9348         Don't initialize is_target_special_ or has_plt_offset_.
9349         Initialize is_defined_in_discarded_section_.
9350         (Symbol_table::add_from_relobj): If appropriate, set
9351         is_defined_in_discarded_section.
9352         * resolve.cc (Symbol::override_base_with_special): Don't test
9353         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9354         * target-reloc.h (relocate_section): Do special handling for
9355         symbols defined in discarded sections for global symbols as well
9356         as local symbols.
9357
9358 2010-01-08  Ian Lance Taylor  <iant@google.com>
9359
9360         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9361         the SHT_SYMTAB case.
9362
9363 2010-01-08  Ian Lance Taylor  <iant@google.com>
9364
9365         * object.cc (Sized_relobj::do_layout): Don't get confused if
9366         layout_eh_frame returns NULL.
9367
9368 2010-01-08  Ian Lance Taylor  <iant@google.com>
9369
9370         PR 11084
9371         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9372         dynamic symbol table, use the normal symbol table.
9373         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9374         symbol table.
9375
9376 2010-01-08  Ian Lance Taylor  <iant@google.com>
9377
9378         PR 11072
9379         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9380         sections.
9381
9382 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9383
9384         * version.cc (print_version): Change to "Copyright 2010".
9385
9386 2010-01-08  Ian Lance Taylor  <iant@google.com>
9387
9388         PR 10287
9389         PR 11063
9390         * i386.cc (class Target_i386): Change return type of plt_section
9391         to be non-const.
9392         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9393         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9394         tls_desc_rel_ field.
9395         (Output_data_plt_i386::rel_tls_desc): New function.
9396         (Target_i386::rel_tls_desc_section): New function.
9397         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9398         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9399         R_386_TLS_DESC reloc in rel_tls_desc_section.
9400         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9401         Define struct Tlsdesc_info.
9402         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9403         (Target_x86_64::do_reloc_symbol_index): New function.
9404         (Target_x86_64::add_tlsdesc_info): New function.
9405         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9406         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9407         tlsdesc_rel_ field.
9408         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9409         all callers.
9410         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9411         (Target_x86_64::rela_tlsdesc_section): New function.
9412         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9413         handling.
9414         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9415         (Target_x86_64::do_reloc_addend): New function.
9416         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9417         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9418         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9419         (Output_reloc::type): New function.
9420         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9421         (Output_reloc::is_target_specific): New function.
9422         (Output_reloc::target_arg): New function.
9423         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9424         absolute relocs and target specific relocs.
9425         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9426         add_target_specific.
9427         (class Output_data_reloc) [SHT_RELA]: Likewise.
9428         * output.cc (Output_reloc::Output_reloc): Add four new versions
9429         for absolute relocs and target specific relocs.
9430         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9431         (Output_reloc::get_symbol_index): Likewise.
9432         (Output_reloc::local_section_offset): Check that local_sym_index_
9433         is not TARGET_CODE or 0.
9434         (Output_reloc::symbol_value): Likewise.
9435         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9436         reloc.
9437         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9438         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9439         functions.
9440         * layout.cc (add_target_dynamic_tags): Use output section for
9441         DT_PLTRELSZ and DT_JMPREL.
9442
9443 2010-01-07  Ian Lance Taylor  <iant@google.com>
9444
9445         PR 11061
9446         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9447         function.
9448         (class Output_data_reloc_generic): Define.
9449         (class Output_data_reloc_base): Change base class to
9450         Output_data_reloc_generic.  Change add() method to call
9451         bump_relative_reloc_count for a relative reloc.  Remove
9452         sort_relocs_ field.
9453         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9454         to sort_relocs().
9455         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9456         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9457         appropriate.
9458         * layout.h (class Layout): Update declaration.
9459
9460 2010-01-07  Ian Lance Taylor  <iant@google.com>
9461
9462         * output.h (class Output_data): Add const version of
9463         output_section and do_output_section.
9464         (class Output_section_data): Add const version of
9465         do_output_section.
9466         (class Output_section): Likewise.
9467         * layout.cc (Layout::add_target_dynamic_tags): New function.
9468         * layout.h (class Layout): Update declarations.
9469         * arm.cc (Target_arm::do_finalize_sections): Use
9470         add_target_dynamic_tags.
9471         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9472         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9473         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9474         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9475
9476 2010-01-07  Ian Lance Taylor  <iant@google.com>
9477
9478         PR 11042
9479         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9480         object as needed.
9481
9482 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9483             Ian Lance Taylor  <iant@google.com>
9484
9485         PR 11019
9486         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9487         Xindex::read_symtab_xindex.
9488
9489 2010-01-07  Doug Kwan  <dougkwan@google.com>
9490
9491         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9492         (Insn_template::thumb16_bcond_insn): New method declaration.
9493         (Insn_template): Fix spelling.
9494         (Stub::thumb16_special): New method declaration.
9495         (Stub::do_write): Define virtual method which was previously pure
9496         virtual.
9497         (Stub::do_thumb16_special): New method declaration.
9498         (Stub::do_fixed_endian_write): New template member.
9499         (Reloc_stub::do_write): Remove.
9500         (Reloc_stub::do_fixed_endian_write): Remove.
9501         (Cortex_a8_stub): New class definition.
9502         (Stub_factory::make_cortex_a8_stub): New method definition.
9503         (Stub_factory::Stub_factory): Add missing static storage class
9504         qualifier for elf32_arm_stub_a8_veneer_blx.
9505
9506 2010-01-07  Ian Lance Taylor  <iant@google.com>
9507
9508         PR 10980
9509         * options.h (class General_options): Add --warn-unresolved-symbols
9510         and --error-unresolved-symbols.
9511         * errors.cc (Errors::undefined_symbol): Implement
9512         --warn-unresolved-symbols.
9513
9514         * options.h (class General_options): Add -z text and -z textoff.
9515         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9516
9517 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9518
9519         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9520         (Garbage_collection::cident_sections): New function.
9521         (Garbage_collection::add_cident_section): New function.
9522         (Garbage_collection::cident_sections_): New member.
9523         (gc_process_relocs): Add references to sections whose names are C
9524         identifiers.
9525         * gold.h (cident_section_start_prefix): New constant.
9526         (cident_section_stop_prefix): New constant.
9527         (is_cident): New function.
9528         * layout.cc (Layout::define_section_symbols): Replace string constants
9529         with the newly defined constants.
9530         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9531         C identifiers.
9532         * testsuite/Makefile.am: Add gc_orphan_section_test.
9533         * testsuite/Makefile.in: Regenerate.
9534         * testsuite/gc_orphan_section_test.cc: New file.
9535         * testsuite/gc_orphan_section_test.sh: New file.
9536
9537 2010-01-06  Ian Lance Taylor  <iant@google.com>
9538
9539         PR 10980
9540         * options.h (class General_options): Add --warn-shared-textrel.
9541         * layout.cc (Layout::finish_dynamic_section): Implement
9542         --warn-shared-textrel.
9543
9544         PR 10980
9545         * options.h (class General_options): Add --warn-multiple-gp.
9546
9547 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9548
9549         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9550         $(THREADSLIB) and $(LIBDL).
9551         * Makefile.in: Rebuild.
9552
9553 2010-01-06  Ian Lance Taylor  <iant@google.com>
9554
9555         PR 10980
9556         * options.cc (General_options::parse_section_start): New function.
9557         (General_options::section_start): New function.
9558         (General_options::General_options): Initialize all members.
9559         * options.h: Include <map>
9560         (class General_options): Add --section-start.  Add section_starts_
9561         member.
9562         * layout.cc (Layout::attach_allocated_section_to_segment): If
9563         --section-start was used, set the address of the segment.  Remove
9564         local sort_sections.
9565         (Layout::relaxation_loop_body): If the address of the load segment
9566         has been set by --section-start, don't use it.
9567         * output.h (Output_segment::update_flags_for_output_section): New
9568         function.
9569         * output.cc (Output_segment::add_output_section): Call
9570         update_flags_for_output_section.
9571
9572 2010-01-05  Ian Lance Taylor  <iant@google.com>
9573
9574         PR 10980
9575         * options.h (class General_options): Add --undefined-version.
9576         * script.cc (struct Version_expression): Add was_matched_by_symbol
9577         field.
9578         (Version_script_info::matched_symbol): New function.
9579         (Version_script_info::get_symbol_version_helper): Call
9580         matched_symbol.
9581         (Version_script_info::check_unmatched_names): New function.
9582         * script.h (class Version_script_info): Update declarations.
9583         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9584
9585         * options.h (class General_options): Use DEFINE_bool_alias for
9586         allow_multiple_definition.
9587         * resolve.cc (Symbol_table::should_override): Don't test
9588         allow_multiple_definition.
9589
9590         PR 10980
9591         * options.h (class General_options): Add --cref.
9592         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9593         until after printing cref table.
9594         * cref.cc: Include "symtab.h".
9595         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9596         (Cref_table_compare::operator()): New function.
9597         (Cref_inputs::gather_cref): New function.
9598         (filecol): New static const.
9599         (Cref_inputs::print_cref): New function.
9600         (Cref::print_cref): New function.
9601         * cref.h: Include <cstdio>.
9602         (class Cref): Update declarations.
9603         * mapfile.h (Mapfile::file): New function.
9604         * object.h (class Object): Define Symbols.  Declare virtual
9605         do_get_global_symbols.
9606         (Object::get_global_symbols): New function.
9607         * object.cc (Input_objects::add_object): Pass object to cref_ if
9608         --cref.
9609         (Input_objects::archive_start): Likewise.
9610         (Input_objects::archive_stop): Likewise.
9611         (Input_objects::print_cref): New function.
9612         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9613         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9614         --cref.
9615         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9616         function.
9617         * plugin.h (class Sized_pluginobj): Update declarations.
9618
9619 2010-01-05  Ian Lance Taylor  <iant@google.com>
9620
9621         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9622         to is_default_version.  Rename insdef to insdefault.
9623         (Symbol_table::add_from_relobj): Rename def to is_default_version
9624         and local to is_forced_local.
9625         (Symbol_table::add_from_pluginobj): Likewise.
9626         (Symbol_table::add_from_dynobj): Likewise.
9627         (Symbol_table::define_special_symbol): Rename insdef to
9628         insdefault.
9629
9630 2010-01-04  Ian Lance Taylor  <iant@google.com>
9631
9632         PR 10980
9633         * options.h (class General_options): Add
9634         --allow-multiple-definition and -z muldefs.
9635         * resolve.cc (Symbol_table::should_override): Don't warn about a
9636         multiple symbol definition if --allow-multiple-definition or -z
9637         muldefs.
9638
9639         PR 10980
9640         * options.h (class General_options): Add --add-needed and
9641         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9642         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9643         error if --copy-dt-needed-entries aka --add-needed is used and
9644         would cause a change in behaviour.
9645
9646         PR 10980
9647         * options.h (class General_options): Add -G as a short version of
9648         --shared.  Add no-op options -assert, -g, and -i.
9649
9650 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9651
9652         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9653         check for .text or .gnu.linkonce.t sections.
9654         * icf.cc (Icf::find_identical_sections): Ditto.
9655         Change the detection for mangled function name within the section
9656         name.
9657         * icf.h (is_section_foldable_candidate): New function.
9658
9659 2009-12-30  Ian Lance Taylor  <iant@google.com>
9660
9661         PR 10980
9662         * options.h (class General_options): Permit two dashes with
9663         --retain-symbols-file.
9664
9665 2009-12-30  Ian Lance Taylor  <iant@google.com>
9666
9667         PR 10979
9668         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9669         don't put the file header and segment headers in the text
9670         segment.
9671
9672         PR 10979
9673         * common.cc (Sort_commons::operator()): Stabilize sort when both
9674         entries are NULL.
9675         (Symbol_table::do_allocate_commons_list): When allocating common
9676         symbols, skip a symbol which is no longer common.
9677         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9678         an object before checking its type.
9679         * testsuite/common_test_2.c: New file.
9680         * testsuite/common_test_3.c: New file.
9681         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9682         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9683         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9684         (common_test_2_pic.o, common_test_2.so): New targets.
9685         (common_test_3_pic.o, common_test_3.so): New targets.
9686         * testsuite/Makefile.in: Rebuild.
9687
9688         PR 10979
9689         * script.cc (read_input_script): If we see a new SECTIONS clause,
9690         and we have added an input section, give an error.
9691         * layout.h (class Layout): Add have_added_input_section function.
9692         Add have_added_input_section_ field.
9693         * layout.cc (Layout::Layout): Initialize
9694         have_added_input_section_.
9695         (Layout::layout): Set have_added_input_section_.
9696         (Layout::layout_eh_frame): Likewise.
9697
9698 2009-12-30  Ian Lance Taylor  <iant@google.com>
9699
9700         PR 10931
9701         * options.h (class General_options): Add --sort-common option.
9702         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9703         * common.cc (Sort_common): Add sort_order parameter to
9704         constructor.  Add sort_order_ field.
9705         (Sort_commons::operator): Check sort_order_.
9706         (Symbol_table::allocate_commons): Determine the sort order.
9707         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9708         Change all callers.
9709         (Symbol_table::do_allocate_commons_list): Likewise.
9710
9711 2009-12-30  Ian Lance Taylor  <iant@google.com>
9712
9713         PR 10916
9714         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9715         symbols from this object, don't change the visibility of an
9716         undefined symbol.
9717         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9718
9719 2009-12-30  Ian Lance Taylor  <iant@google.com>
9720
9721         PR 10861
9722         * script.h (class Version_script_info): Define Language enum.
9723         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9724         new fields globals_, locals_, and is_finalized_.
9725         * script.cc: Various formatting fixes.
9726         (class Parser_closure): Change language_stack_ from a vector of
9727         std::string to one of Version_script_info::Language.  Adjust all
9728         uses accordingly.
9729         (class Lazy_demangler): Remove.
9730         (struct Version_expression): Change language from std::string to
9731         Version_script_info::Language.
9732         (Version_script_info::Version_script_info): New function.
9733         (Version_script_info::~Version_script_info): Don't call clear.
9734         (Version_script_info::finalize): New function.
9735         (Version_script_info::build_lookup_tables): New function.
9736         (Version_script_info::build_expression_list_lookup): New
9737         function.
9738         (Version_script_info::get_symbol_version_helper): Rewrite to use
9739         lookup tables.
9740         (Version_script_info::print_expression_list): Adjust to use
9741         Version_script_info::Language.
9742         (script_push_lex_into_version_mode): Check that the version script
9743         has not been finalized.
9744         (version_script_push_lang): Change language string to
9745         Version_script_info::Language.
9746         * options.cc (Command_line::version_script): New function.
9747         * options.h (class General_options): Add finalize_dynamic_list
9748         function.  Change version_script from declaration to definition.
9749         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9750         * testsuite/version_script.map: Remove duplicate def of foo.
9751         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9752         version_script.map.
9753         * testsuite/Makefile.in: Rebuild.
9754
9755 2009-12-30  Ian Lance Taylor  <iant@google.com>
9756
9757         PR 10843
9758         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9759         if the input symbol index is 0, make the output symbol index 0.
9760
9761 2009-12-30  Ian Lance Taylor  <iant@google.com>
9762
9763         PR 10670
9764         * options.h (class General_options): Add -x/--discard-all.
9765         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9766         --discard-all.  If the local symbol needs a dynamic entry, check
9767         that before handling --discard-locals.
9768
9769 2009-12-30  Ian Lance Taylor  <iant@google.com>
9770
9771         PR 10450
9772         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9773         flags to PF_R.
9774         (Output_segment::add_output_section): Don't change the flags if
9775         the type is PT_TLS.
9776
9777         PR 10450
9778         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9779         GNU hash table if they need a dynamic value.  Otherwise, don't add
9780         them if they are defined in a dynamic object or are forced local.
9781
9782 2009-12-29  Ian Lance Taylor  <iant@google.com>
9783
9784         PR 10450
9785         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9786         .gnu.hash table for a 32-bit target.
9787
9788         PR 10450
9789         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9790         regular and a dynamic object only needs a dynamic symbol table
9791         entry if it is externally visible.
9792
9793         PR 10450
9794         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9795         constructor.  Add global_offset_table_ field.
9796         (Target_i386::got_section): Set global_offset_table_.
9797         (Target_i386::do_finalize_sections): Set global_offset_table_
9798         size.
9799         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9800         in constructor.  Add global_offset_table_ field.
9801         (Target_x86_64::got_section): Set global_offset_table_.
9802         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9803         size.
9804
9805         * layout.cc (Layout::Layout): Initialize increase_relro_.
9806         (Layout::get_output_section): Add is_relro, is_last_relro, and
9807         is_first_non_relro parameters.  Change all callers.
9808         (Layout::choose_output_section): Likewise.
9809         (Layout::add_output_section_data): Likewise.
9810         (Layout::make_output_section): Likewise.
9811         (Layout::set_segment_offsets): Clear increase_relro when using a
9812         linker script.
9813         * layout.h (class Layout): Add increase_relro method.  Add
9814         increase_relro_ field.  Update declarations.
9815         * output.cc (Output_section::Output_section): Initialize
9816         is_last_relro_ and is_first_non_relro_.
9817         (Output_segment::add_output_section): Group relro sections is
9818         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9819         (Output_segment::maximum_alignment): Remove relro handling.
9820         (Output_segment::set_section_addresses): Add increase_relro
9821         parameter.  Change all callers.  Add initial alignment to align
9822         relro sections on separate page.  Remove old relro handling.
9823         (Output_segment::set_section_list_addresses): Remove in_relro
9824         parameter.  Change all callers.
9825         (Output_segment::set_offset): Add increase parameter.  Change all
9826         callers.  Remove old relro handling.
9827         * output.h (class Output_section): Add new methods: is_last_relro,
9828         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9829         Add is_last_relro_ and is_first_non_relro_ fields.
9830         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9831         Create separate .got.plt section.  Call increase_relro.
9832         * x86_64.cc (Target_x86_64::got_section): Likewise.
9833         * testsuite/relro_script_test.t: Add .got.plt.
9834
9835         PR 10450
9836         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9837         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9838         (Layout::finalize): Call set_dynamic_symbol_size.
9839         (Layout::set_dynamic_symbol_size): New function.
9840         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9841         set_dynamic_symbol_size.
9842
9843         PR 10450
9844         * output.h (class Output_section): Add is_entsize_zero_ field.
9845         * output.cc (Output_section::Output_section): Initialize
9846         is_entsize_zero_.
9847         (Output_section::set_entsize): If two different entsizes are
9848         requested, force it to zero.
9849         (Output_section::add_input_section): Set flags for .debug_str
9850         before updating section flags.  Set entsize.
9851         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9852         and SHF_STRING if all input sections have those flags.
9853
9854 2009-12-29   Rafael Espindola  <espindola@google.com>
9855
9856         * main.cc (main): Fix the sys time reporting.
9857         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9858         reporting.
9859
9860 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9861
9862         * options.cc (General_options::parse_version): Allow -v to exit
9863         without an error if there is nothing to link.
9864
9865 2009-12-29  Ian Lance Taylor  <iant@google.com>
9866
9867         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9868         using a version of gcc before 4.1.
9869         * configure: Rebuild.
9870
9871 2009-12-28  Chris Demetriou  <cgd@google.com>
9872
9873         * attributes.cc (Output_attributes_section_data::do_write): Use
9874         std::vector::front rather than std::vector::data.
9875
9876 2009-12-28  Ian Lance Taylor  <iant@google.com>
9877
9878         * symtab.h (class Symbol_table): Add enum Defined.
9879         * resolve.cc (Symbol_table::should_override): Add defined
9880         parameter.  Change all callers.  Test whether object is NULL
9881         before calling a method on it.
9882         (Symbol_table::report_resolve_problem): Add defined parameter.
9883         Change all callers.
9884         (Symbol_table::should_override_with_special): Likewise.
9885         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9886         parameter.  Change all callers.
9887         (Symbol_table::do_define_in_output_data): Likewise.
9888         (Symbol_table::define_in_output_segment): Likewise.
9889         (Symbol_table::do_define_in_output_segment): Likewise.
9890         (Symbol_table::define_as_constant): Likewise.
9891         (Symbol_table::do_define_as_constant): Likewise.
9892         * script.h (class Symbol_assignment): Add is_defsym parameter to
9893         constructor; change all callers.
9894         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9895         parameter.  Change all callers.  Add is_defsym_ field.
9896         (class Parser_closure): Add parsing_defsym parameter to
9897         constructor; change all callers.  Add parsing_defsym accessor
9898         function.  Add parsing_defsym_ field.
9899
9900 2009-12-28  Ian Lance Taylor  <iant@google.com>
9901
9902         * gold.cc (queue_middle_tasks): Fix formatting.
9903         * object.cc (Relobj::is_section_name_included): Likewise.
9904
9905 2009-12-23  Ian Lance Taylor  <iant@google.com>
9906
9907         * i386.cc (Target_i386::do_calls_non_split): Recognize
9908         -fsplit-stack prologue for a function with a static chain.
9909         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9910         -fsplit-stack prologue when using %r11.
9911
9912 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9913
9914         * options.cc (General_options::parse_version): Make -v continue and do
9915         the link like GNU ld does.
9916
9917 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9918
9919         * Makefile.am (CCFILES): Add timer.cc.
9920         (HFILES): Add timer.h.
9921         * configure.ac: Check for sysconf and times.
9922         * main.cc: include timer.h.
9923         (main): Use Timer instead of get_run_time.
9924         * timer.cc: New.
9925         * timer.h: New.
9926         * workqueue.cc: include timer.h.
9927         (Workqueue::find_and_run_task):
9928         Report user, sys and wall time.
9929         * Makefile.in: Regenerate.
9930         * config.in: Regenerate.
9931         * configure: Regenerate.
9932
9933 2009-12-16  Doug Kwan  <dougkwan@google.com>
9934
9935         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9936         sections.
9937         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9938         relaxed input sections.
9939         * output.cc (Output_section::find_relaxed_input_section): Change
9940         return type to Output_relaxed_input_section pointer.  Adjust code
9941         for new type of relaxed_input_section_map_.
9942         * output.h (Output_section::find_relaxed_input_section): Change
9943         return type to Output_relaxed_input_section pointer.
9944         (Output_section::Output_relaxed_input_section_by_input_section_map):
9945         New type.
9946         (Output_section::relaxed_input_section_map_): Change type to
9947         Output_section::Output_relaxed_input_section_by_input_section_map.
9948         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9949         input section.
9950
9951 2009-12-15  Ian Lance Taylor  <iant@google.com>
9952
9953         * layout.cc (Layout::create_shstrtab): Only write out after input
9954         sections if we are compressing debug sections.
9955
9956 2009-12-15  Ian Lance Taylor  <iant@google.com>
9957
9958         * archive.cc (Archive::add_symbols): Only look up a symbol without
9959         a version if there is, in fact, a version.
9960
9961 2009-12-14  Ian Lance Taylor  <iant@google.com>
9962
9963         Revert -Wshadow changes, all changes from:
9964         2009-12-11  Doug Kwan  <dougkwan@google.com>
9965         2009-12-11  Nick Clifton  <nickc@redhat.com>
9966         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9967
9968 2009-12-11  Doug Kwan  <dougkwan@google.com>
9969
9970         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9971         due to -Wshadow.
9972         * attributes.cc (Object_attribute::size): Ditto.
9973         (Attributes_section_data::size): Ditto.
9974         (Attributes_section_data::Attributes_section_data): Ditto.
9975         (Output_attributes_section_data::do_write): Ditto.
9976         * attributes.h (Object_attribute::set_type): Ditto.
9977         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9978
9979 2009-12-11  Nick Clifton  <nickc@redhat.com>
9980
9981         * archive.cc: Fix shadowed variable warnings.
9982         * arm.cc: Likewise.
9983         * compressed_output.cc: Likewise.
9984         * compressed_output.h: Likewise.
9985         * configure: Likewise.
9986         * dwarf_reader.cc: Likewise.
9987         * dynobj.cc: Likewise.
9988         * dynobj.h: Likewise.
9989         * ehframe.cc: Likewise.
9990         * ehframe.h: Likewise.
9991         * errors.cc: Likewise.
9992         * expression.cc: Likewise.
9993         * fileread.cc: Likewise.
9994         * fileread.h: Likewise.
9995         * freebsd.h: Likewise.
9996         * i386.cc: Likewise.
9997         * icf.cc: Likewise.
9998         * incremental.h: Likewise.
9999         * layout.cc: Likewise.
10000         * layout.h: Likewise.
10001         * mapfile.cc: Likewise.
10002         * merge.cc: Likewise.
10003         * merge.h: Likewise.
10004         * object.cc: Likewise.
10005         * object.h: Likewise.
10006         * options.h: Likewise.
10007         * output.cc: Likewise.
10008         * output.h: Likewise.
10009         * parameters.cc: Likewise.
10010         * plugin.cc: Likewise.
10011         * powerpc.cc: Likewise.
10012         * reduced_debug_output.cc: Likewise.
10013         * reduced_debug_output.h: Likewise.
10014         * reloc.cc: Likewise.
10015         * reloc.h: Likewise.
10016         * resolve.cc: Likewise.
10017         * script-sections.cc: Likewise.
10018         * script.cc: Likewise.
10019         * script.h: Likewise.
10020         * sparc.cc: Likewise.
10021         * symtab.cc: Likewise.
10022         * symtab.h: Likewise.
10023         * target-select.cc: Likewise.
10024         * target-select.h: Likewise.
10025         * token.h: Likewise.
10026         * workqueue.cc: Likewise.
10027         * workqueue.h: Likewise.
10028         * x86_64.cc: Likewise.
10029
10030 2009-12-10  Doug Kwan  <dougkwan@google.com>
10031
10032         * arm.cc (attributes.h): New include.
10033         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10034         (Arm_relobj::~Arm_relobj): Delete object pointed by
10035         attributes_section_data_.
10036         (Arm_relobj::attributes_section_data): New method definition.
10037         (Arm_relobj::attributes_section_data_): New data member declaration.
10038         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10039         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10040         attributes_section_data_.
10041         (Arm_dynobj::attributes_section_data): New method definition.
10042         (Arm_dynobj::attributes_section_data_): New data member declaration.
10043         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10044         initialization value of may_use_blx_ to false.
10045         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10046         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10047         object attributes to compute results instead of hard-coding.
10048         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10049         Target_arm::get_secondary_compatible_arch,
10050         Target_arm::set_secondary_compatible_arch
10051         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10052         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10053         New method declarations.
10054         (Target_arm::get_aeabi_object_attribute): New method definition.
10055         (Target_arm::attributes_section_data_): New data member declaration.
10056         (read_arm_attributes_section): New template definition.
10057         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10058         (Arm_dynobj::do_read_symbols): Ditto.
10059         (Target_arm::do_finalize_sections): Merge attributes sections from
10060         input.  Check for BLX use after attributes section merging.
10061         Fix __exidx_start and __exidx_end visibility.  Create an
10062         .ARM.attributes section if necessary.
10063         (Target_arm::get_secondary_compatible_arch,
10064         Target_arm::set_secondary_compatible_arch,
10065         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10066         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10067         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10068         New method definitions.
10069
10070 2009-12-09  Ian Lance Taylor  <iant@google.com>
10071
10072         * plugin.cc (Plugin::load): Don't cast from void* to a function
10073         pointer.
10074
10075 2009-12-09  Ian Lance Taylor  <iant@google.com>
10076
10077         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10078         information fields.
10079
10080 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10081
10082         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10083         Replace two_file_shared_1.so with two_file_shared_2.so.
10084         * testsuite/Makefile.in: Regenerated.
10085
10086 2009-12-08  Doug Kwan  <dougkwan@google.com>
10087
10088         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10089         (HFILES): Add attributes.h and int_encoding.h.
10090         * Makefile.in: Regenerate.
10091         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10092         function definitions to int_encoding.cc
10093         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10094         prototypes to int_encoding.h
10095         * reduced_debug_output.cc (int_encoding.h): New include.
10096         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10097         function definitions to int_encoding.cc
10098         (insert_into_vector, read_from_pointer): Move template definitions to
10099         int_encoding.h
10100         * attributes.cc: New file.
10101         * attributes.h: New file.
10102         * int_encoding.cc: New file.
10103         * int_encoding.h: New file.
10104
10105 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10106
10107         PR gold/11055
10108         * incremental-dump.cc (dump_incremental_inputs): New.
10109         (main): Use dump_incremental_inputs.
10110
10111 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10112
10113         PR gold/10893
10114         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10115         checking elfcpp::STT_FUNC.
10116         (Target_i386::Relocate::relocate): Likewise.
10117         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10118
10119         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10120         symbols from shared libraries into normal FUNC symbols.
10121
10122         * symtab.h (Symbol): Add is_func and use it.
10123
10124 2009-12-05  Doug Kwan  <dougkwan@google.com>
10125
10126         * arm.cc (Target_arm::arm_info): Initialize new fields
10127         attributes_section and attributes_vendor.
10128         * i386.cc (Target_i386::i386_info): Same.
10129         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10130         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10131         fields attributes_section and attributes_vendor.
10132         * sparc.cc (Target_sparc::sparc_info): Same.
10133         * target.h (Target::attributes_section, Target::attributes_vendor,
10134         Target::is_attributes_section, Target::attribute_arg_type,
10135         Target::attributes_order): New method definitions.
10136         (Target::Target_info::attributes_section,
10137         Target::Target_info::attributes_vendor): New fields.
10138         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10139         virtual method definitions.
10140         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10141         attributes_section and attributes_vendor.
10142         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10143
10144 2009-12-05  Doug Kwan  <dougkwan@google.com>
10145
10146         * arm.cc: Update comments about interworking and stub generation.
10147         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10148         considered as non-PIC.
10149         (Arm_relocate_functions::base_abs): Fix formatting.
10150         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10151         of function to use GOT entry address instead of offset.
10152         (Target_arm::Scan::global): Issue an error if a symbol would need a
10153         PLT does not get one because it is untyped.  Remove code to create
10154         dynamic symbols for relative branches.
10155         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10156         takes unsigned integer instead of boolean.
10157
10158 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10159
10160         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10161         (two_file_test_LDADD): Likewise.
10162         (common_test_1_LDADD): Likewise.
10163         (exception_test_LDADD) Likewise.
10164         (weak_test_LDADD): Likewise.
10165         (many_sections_test_LDADD): Likewise.
10166         (initpri1_LDADD): Likewise.
10167         (script_test_1_LDADD): Likewise.
10168         (script_test_2_LDADD): Likewise.
10169         (justsyms_LDADD): Likewise.
10170         (binary_test_LDADD): Likewise.
10171         (large_LDADD): Likewise.
10172         * testsuite/Makefile.in: Regenerated.
10173
10174 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10175
10176         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10177         (Symbol_table::override_with_special): Likewise.
10178         (Symbol_table::add_from_object): Likewise.
10179
10180 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10181
10182         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10183         Don't set the data_offset twice.
10184
10185 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10186
10187         * testsuite/Makefile.in: Regenerate.
10188
10189 2009-12-03  Doug Kwan  <dougkwan@google.com>
10190
10191         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10192         (Target_arm::do_finalize_sections): Add parameter for symbol table
10193         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10194         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10195         parameter for symbol table pointer.
10196         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10197         an additional parameter for a pointer to symbol table.
10198         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10199         parameter for a symbol table pointer.
10200         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10201         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10202         Ditto.
10203         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10204         parameter for a symbol table pointer.
10205
10206 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10207
10208         * incremental.cc (Incremental_inputs_header)
10209         (Incremental_inputs_header_write, Incremental_inputs_entry)
10210         (Incremental_inputs_entry_write): Move ...
10211         * incremental.h (Incremental_inputs_header)
10212         (Incremental_inputs_header_write, Incremental_inputs_entry)
10213         (Incremental_inputs_entry_write): here.
10214
10215 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10216
10217         * incremental.cc (make_sized_incremental_binary): Set the target.
10218         Error if it is incompatible.
10219         * output.h (Output_file): Add filename method.
10220
10221 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10222
10223         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10224         from the get_* methods.
10225
10226 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10227
10228         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10229         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10230         Write 0 for the data_offset of scripts.
10231
10232 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10233
10234         * testsuite/Makefile.am: Add the incremental_test.sh test.
10235         * testsuite/incremental_test.sh: New.
10236         * testsuite/incremental_test_1.c: New.
10237         * testsuite/incremental_test_2.c: New.
10238
10239 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10240
10241         * incremental-dump.cc (main): Fix typos.
10242
10243 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10244
10245         PR gold/11025
10246         * incremental-dump.cc (main): Use llu to print 64 bit values.
10247
10248 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10249             H.J. Lu  <hongjiu.lu@intel.com>
10250
10251         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10252         $(LIBDL).
10253         (incremental_dump_LDADD): Likewise.
10254         * Makefile.in: Regenerated.
10255
10256 2009-11-25  Doug Kwan  <dougkwan@google.com>
10257
10258         Revert:
10259
10260         2009-11-25  Doug Kwan  <dougkwan@google.com>
10261
10262                 * arm.cc (Target_arm::Target_arm): Move method definition
10263                 outside of class definition.  Add code to handle
10264                 --target1-rel, --target1-abs and --target2= options.
10265                 (Target_arm::get_reloc_reloc_type): Change method to be
10266                 non-static and const.
10267                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10268                 New data member declaration.
10269                 (Target_arm::Scan::local, Target_arm::Scan::global,
10270                 Target_arm::Relocate::relocate,
10271                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10272                 Adjust call to Target_arm::get_real_reloc_type.
10273                 (Target_arm::get_real_reloc_type): Use command line options
10274                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10275                 * options.h (--target1-rel, --target1-abs, --target2): New
10276                 ARM-only options.
10277
10278 2009-11-25  Doug Kwan  <dougkwan@google.com>
10279
10280         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10281         class definition.  Add code to handle --target1-rel, --target1-abs
10282         and --target2= options.
10283         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10284         and const.
10285         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10286         member declaration.
10287         (Target_arm::Scan::local, Target_arm::Scan::global,
10288         Target_arm::Relocate::relocate,
10289         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10290         call to Target_arm::get_real_reloc_type.
10291         (Target_arm::get_real_reloc_type): Use command line options to
10292         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10293         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10294         options.
10295
10296 2009-11-25  Doug Kwan  <dougkwan@google.com>
10297
10298         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10299         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10300         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10301         formatting.
10302         (Arm_relocate_functions::thm_call): Replace body with a call to
10303         Arm_relocate_functions::thumb_branch_common.
10304         (Arm_relocate_functions::thm_jump24,
10305         Arm_relocate_functions::thm_xpc22): New method definitions.
10306         (Arm_relocate_functions::thumb_branch_common): New method definition.
10307         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10308         operator.
10309         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10310         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10311
10312 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10313
10314         * Makefile.am: Build incremental-dump
10315         * Makefile.in: Regenerate.
10316         * incremental-dump.cc: New.
10317         * incremental.cc (Incremental_inputs_header_data,
10318         Incremental_inputs_entry_data): Move to incremental.h
10319         * incremental.h: (Incremental_inputs_header_data,
10320         Incremental_inputs_entry_data): Move from incremental.cc
10321
10322 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10323
10324         * incremental.cc (Incremental_inputs_header,
10325         Incremental_inputs_header_write, Incremental_inputs_entry,
10326         Incremental_inputs_entry_write): Add a typedef with the data type.
10327
10328 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10329
10330         * incremental.cc (Incremental_inputs_header,
10331         Incremental_inputs_header_write, Incremental_inputs_entry,
10332         Incremental_inputs_entry_write): Update comment about which
10333         type has the filed descriptions.
10334
10335 2009-11-15  Doug Kwan  <dougkwan@google.com>
10336
10337         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10338         (Arm_relocate_functions::arm_branch_common): Change method defintion
10339         in class definition to a method declaration and update list of formal
10340         parameters.
10341         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10342         Arm_relocation_functions::jump24): Adjust call to
10343         Arm_relocate_functions::arm_branch_common.  Update list of formal
10344         parameters.
10345         (Arm_relocate_functions::xpc25): New method definition.
10346         (Arm_relocate_functions::arm_branch_common): Move method defintion
10347         out from class definition.  Use stubs for mode-switching and extending
10348         branch ranges.
10349         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10350         specially.  Change code to enable use of stubs in ARM branches.
10351
10352 2009-11-10  Doug Kwan  <dougkwan@google.com>
10353
10354         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10355         in method declaration.
10356         (Target_arm::relocate_stub): New method declaration.
10357         (Target_arm::default_target): Change to return a pointer instead of
10358         a const reference.
10359         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10360         Target_arm::default_target.
10361         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10362         method definition.
10363         (Target_arm::relocate_section): Adjust view.
10364         (Target_arm::relocate_stub): New method definition.
10365
10366 2009-11-10  Doug Kwan  <dougkwan@google.com>
10367
10368         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10369         a format warning.
10370         * incremental.cc (open_incremental_binary): Initialized local
10371         variables to avoid warnings.
10372         * object.cc (make_elf_object): Ditto.
10373         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10374         a format warning.
10375
10376 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10377
10378         PR gold/10930
10379         * testsuite/plugin_test.c: Include "config.h".
10380
10381 2009-11-09  Doug Kwan  <dougkwan@google.com>
10382
10383         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10384         (arm_symbol_value): Remove.
10385         (Arm_relocate_functions::arm_branch_common,
10386         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10387         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10388         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10389         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10390         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10391         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10392         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10393         Arm_relocate_functions::thm_mobw_abs_nc,
10394         Arm_relocate_functions::thm_mov_abs,
10395         Arm_relocate_functions::movw_prel_nc,
10396         Arm_relocate_functions::thm_movt_abs,
10397         Arm_relocate_functions::movt_prel,
10398         Arm_relocate_functions::thm_movw_prel_nc,
10399         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10400         (Target_arm::Relocate::relocate): Only decompose address into two
10401         parts if relocation type uses the thumb-bit and pass the actual
10402         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10403         calls to methods in Arm_relocate_functions for this change.
10404
10405 2009-11-08  Ian Lance Taylor  <iant@google.com>
10406
10407         PR 10925
10408         * reloc.cc: Instantiate
10409         Sized_relobj::initialize_input_to_output_maps and
10410         Sized_relobj:free_input_to_output_maps.
10411
10412 2009-11-06  Ian Lance Taylor  <iant@google.com>
10413
10414         PR 10876
10415         * defstd.cc (in_segment): Set only_if_ref true for "end".
10416
10417 2009-11-06  Doug Kwan  <dougkwan@google.com>
10418
10419         * arm.cc (class Reloc_stub): Correct a comment.
10420         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10421         (Target_arm::scan_section_for_stubs): New method declaration.
10422         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10423         Change methods from private to protected.
10424         (Target_arm::do_may_relax): New method definition.
10425         (Target_arm::do_relax, Target_arm::group_sections,
10426         Target_arm::scan_reloc_for_stub,
10427         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10428         (Target_arm::arm_input_section_map_): New data member declaration.
10429         (Target_arm::scan_reloc_for_stub,
10430         Target_arm::scan_reloc_section_for_stubs,
10431         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10432         Target_arm::do_relax): New method definitions.
10433
10434 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10435
10436         * configure.ac: Check for (struct stat)::st_mtim
10437         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10438         * config.in: Regenerate.
10439         * configure: Regenerate.
10440
10441 2009-11-05  Ian Lance Taylor  <iant@google.com>
10442
10443         PR 10910
10444         * output.cc (Output_segment::add_output_section): Add missing
10445         return statement.
10446
10447 2009-11-04  Ian Lance Taylor  <iant@google.com>
10448
10449         PR 10880
10450         * object.h (class Object): Add is_needed and set_is_needed
10451         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10452         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10453         defined in a dynamic object and referenced by a regular object,
10454         set is_needed for the dynamic object.
10455         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10456         if the file is marked with as_needed and it is not needed.
10457
10458 2009-11-04  Ian Lance Taylor  <iant@google.com>
10459
10460         PR 10887
10461         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10462         tags if data is discarded by linker script.
10463         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10464         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10465         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10466         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10467
10468 2009-11-04  Ian Lance Taylor  <iant@google.com>
10469
10470         * layout.cc (Layout::get_output_section): Add is_interp and
10471         is_dynamic_linker_section parameters.  Change all callers.
10472         (Layout::choose_output_section): Likewise.
10473         (Layout::make_output_section): Likewise.
10474         (Layout::add_output_section_data): Add is_dynamic_linker_section
10475         parameter.  Change all callers.
10476         * layout.h (class Layout): Update declarations.
10477         * output.h (class Output_section): Add is_interp, set_is_interp,
10478         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10479         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10480         generate_code_fills_at_write_ to a bitfield.
10481         * output.cc (Output_section::Output_sections): Initialize new
10482         fields.
10483         (Output_segment::add_output_section): Add do_sort parameter.
10484         Change all callers.
10485
10486 2009-11-03  Ian Lance Taylor  <iant@google.com>
10487
10488         PR 10860
10489         * options.h (class General_options): Add --warn-common.
10490         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10491         merging two common symbols.
10492         (Symbol_table::should_override): Handle --warn-common when merging
10493         a common symbol with a defined symbol.  Use report_resolve_problem
10494         for multiple definitions.
10495         (Symbol_table::report_resolve_problem): New function.
10496         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10497
10498 2009-11-03  Doug Kwan  <dougkwan@google.com>
10499
10500         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10501         stub_factory_.
10502         (Target_arm::stub_factory): New method definition.
10503         (Target_arm::new_arm_input_section,
10504         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10505         Target_arm::reloc_uses_thumb_bit): New method declarations.
10506         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10507         New type definitions.
10508         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10509         member declarations.
10510         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10511         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10512         New method definitions.
10513
10514 2009-11-03  Ian Lance Taylor  <iant@google.com>
10515
10516         * options.h (class General_options): Add --warn_constructors.
10517
10518 2009-11-03  Ian Lance Taylor  <iant@google.com>
10519
10520         PR 10893
10521         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10522         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10523
10524 2009-11-03  Ian Lance Taylor  <iant@google.com>
10525
10526         PR 10895
10527         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10528         --msgid-bugs-address.
10529         (install-pdf): New target.
10530         (install-data_yes): Look up one directory to find mkinstalldirs.
10531
10532 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10533
10534         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10535         tree.
10536
10537 2009-10-30  Doug Kwan  <dougkwan@google.com>
10538
10539         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10540
10541 2009-10-30  Doug Kwan  <dougkwan@google.com>
10542
10543         * arm.cc (Stub_addend_reader): New struct template definition
10544         and partial specializations.
10545         (Stub_addend_reader::operator()): New method definition for a
10546         partially specialized template.
10547
10548 2009-10-30  Doug Kwan  <dougkwan@google.com>
10549
10550         * arm.cc (Arm_relobj::processor_specific_flags): New method
10551         definition.
10552         (Arm_relobj::do_read_symbols): New method declaration.
10553         (Arm_relobj::processor_specific_flags_): New data member declaration.
10554         (Arm_dynobj): New class definition.
10555         (Target_arm::do_finalize_sections): Add input_objects parameter.
10556         (Target_arm::do_adjust_elf_header): New method declaration.
10557         (Target_arm::are_eabi_versions_compatible,
10558         (Target_arm::merge_processor_specific_flags): New method declaration.
10559         (Target_arm::do_make_elf_object): New overloaded method definitions
10560         and declaration.
10561         (Arm_relobj::do_read_symbols): New method definition.
10562         (Arm_dynobj::do_read_symbols): Ditto.
10563         (Target_arm::do_finalize_sections): Add input_objects parameters.
10564         Merge processor-specific flags from all input objects.
10565         (Target_arm::are_eabi_versions_compatible,
10566         Target_arm::merge_processor_specific_flags,
10567         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10568         New method definitions.
10569         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10570         Input_objects pointer type parameter.
10571         * layout.cc (Layout::finalize): Pass input objects to target's.
10572         finalize_sections function.
10573         * output.cc (Output_file_header::do_sized_write): Set ELF file
10574         header's processor-specific flags.
10575         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10576         Input_objects pointer type parameter.
10577         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10578         * target.h (Input_objects): New forward class declaration.
10579         (Target::processor_specific_flags,
10580         Target::are_processor_specific_flags_sect): New method definitions.
10581         (Target::finalize_sections): Add input_objects parameter.
10582         (Target::Target): Initialize processor_specific_flags_ and
10583         are_processor_specific_flags_set_.
10584         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10585         parameter.
10586         (Target::set_processor_specific_flags): New method definition.
10587         (Target::processor_specific_flags_,
10588         Target::are_processor_specific_flags_set_): New data member
10589         declarations.
10590         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10591         Input_objects pointer type parameter.
10592
10593 2009-10-30  Doug Kwan  <dougkwan@google.com>
10594
10595         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10596
10597 2009-10-28  Ian Lance Taylor  <iant@google.com>
10598
10599         * object.h (class Relobj): Drop options parameter from
10600         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10601         do_scan_relocs, do_relocate.  Change all callers.
10602         (class Sized_relobj): Drop options parameters from
10603         do_gc_process_relocs, do_scan_relocs, do_relocate,
10604         do_relocate_sections, relocate_sections, emit_relocs_scan,
10605         emit_relocs_scan_reltype.  Change all callers.
10606         (struct Relocate_info): Remove options field and all references to
10607         it.
10608         * reloc.h (class Read_relocs): Remove options constructor
10609         parameter and options_ field.  Change all callers.
10610         (class Gc_process_relocs, class Scan_relocs): Likewise.
10611         (class Relocate_task): Likewise.
10612         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10613         all callers.
10614         (scan_relocatable_relocs): Likewise.
10615         * target.h (class Sized_target): Remove options parameter from
10616         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10617         all callers.
10618         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10619         callers.
10620         * arm.cc: Update functions to remove options parameters.
10621         * i386.cc: Likewise.
10622         * powerpc.cc: Likewise.
10623         * sparc.cc: Likewise.
10624         * x86_64.cc: Likewise.
10625         * testsuite/testfile.cc: Likewise.
10626
10627 2009-10-28  Doug Kwan  <dougkwan@google.com>
10628
10629         * arm.cc (Arm_relobj): New class definition.
10630         (Arm_relobj::scan_sections_for_stubs,
10631         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10632         New method definitions.
10633
10634 2009-10-28  Cary Coutant  <ccoutant@google.com>
10635
10636         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10637         (Plugin::cleanup_done_): New member.
10638         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10639         (Plugin_manager::cleanup_done_): Remove.
10640         (Plugin_manager::add_input_file): Edit error message.
10641         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10642         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10643
10644 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10645
10646         * fileread.cc: (File_read::View::~View): Use the new
10647         data_ownership_ filed.
10648         (File_read::~File_read): Dispose the new whole_file_view_.
10649         (File_read::open): Mmap the whole file if needed.
10650         (File_read::open): Use whole_file_view_ instead of contents_.
10651         (File_read::find_view): Use whole_file_view_ if applicable.
10652         (File_read::do_read): Use whole_file_view_ instead of contents_.
10653         (File_read::make_view): Use whole_file_view_ instead of contents_,
10654         update File_read::View::View call.
10655         (File_read::find_or_make_view): Update File_read::View::View
10656         call.
10657         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10658         remove contents_
10659         (File_read::View::Data_ownership): New enum.
10660         (File_read::View::View): Replace bool mapped_ with Data_ownership
10661         argument.
10662         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10663         (File_read::View::data_ownership_): New field.
10664         (File_read::contents_): Remove (replaced by whole_file_view_).
10665         (File_read::whole_file_view_): New field.
10666         * options.h (class General_options): Add --keep-files-mapped.
10667
10668 2009-10-27  Cary Coutant  <ccoutant@google.com>
10669
10670         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10671         * testsuite/Makefile.am (plugin_test_5): New test case.
10672         * testsuite/Makefile.in: Regenerate.
10673
10674 2009-10-25  Doug Kwan  <dougkwan@google.com>
10675
10676         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10677         from private to protected to allow access by child class.
10678         (Sized_relobj::do_relocate_sections): New method declaration.
10679         (Sized_relobj::relocate_sections): Virtualize.
10680         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10681         Sized_relobj::relocate_sections.  Instantiate template explicitly
10682         for different target sizes and endianity.
10683
10684 2009-10-24  Doug Kwan  <dougkwan@google.com>
10685
10686         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10687         (Arm_input_section::as_arm_input_section): New method.
10688         (Arm_output_section): New class definition.
10689         (Arm_output_section::create_stub_group,
10690         Arm_output_section::group_sections): New method definitions.
10691
10692 2009-10-22  Doug Kwan  <dougkwan@google.com>
10693
10694         * arm.cc (Arm_input_section): New class definition.
10695         (Arm_input_section::init, Arm_input_section:do_write,
10696         Arm_input_section::set_final_data_size,
10697         Arm_input_section::do_reset_address_and_file_offset): New method
10698         definitions.
10699
10700 2009-10-21  Doug Kwan  <dougkwan@google.com>
10701
10702         * arm.cc (Stub_table, Arm_input_section): New forward class
10703         declarations.
10704         (Stub_table): New class defintion.
10705         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10706         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10707         New method definition.
10708
10709 2009-10-21  Doug Kwan  <dougkwan@google.com>
10710
10711         * arm.cc: Update copyright comments.
10712         (Target_arm): New forward class template declaration.
10713         (Arm_address): New type.
10714         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10715         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10716         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10717         constants.
10718         (Insn_template): Same.
10719         (DEF_STUBS): New macro.
10720         (Stub_type): New enum type.
10721         (Stub_template): New class definition.
10722         (Stub): Same.
10723         (Reloc_stub): Same.
10724         (Stub_factory): Same.
10725         (Target_arm::Target_arm): Initialize may_use_blx_ and
10726         should_force_pic_veneer_.
10727         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10728         Target_arm::should_force_pic_veneer,
10729         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10730         Target_arm::using_thumb_only, Target_arm:;default_target): New
10731         method defintions.
10732         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10733         New data member declarations.
10734         (Insn_template::size, Insn_template::alignment): New method defintions.
10735         (Stub_template::Stub_template): New method definition.
10736         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10737         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10738         (Stub_factory::Stub_factory): New method definition.
10739         * gold.h (string_hash): New template.
10740         * output.h (Input_section_specifier::hash_value): Use
10741         gold::string_hash.
10742         (Input_section_specifier::string_hash): Remove.
10743         * stringpool.cc (Stringpool_template::string_hash): Use
10744         gold::string_hash.
10745
10746 2009-10-20  Doug Kwan  <dougkwan@google.com>
10747
10748         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10749         symbols of relaxed input sections.
10750         * output.h (Output_section::find_relaxed_input_section): Make
10751         method public.
10752
10753 2009-10-16  Doug Kwan  <dougkwan@google.com>
10754
10755         * dynobj.cc (Versions::Versions): Initialize version_script_.
10756         Only insert base version symbol definition for a shared object
10757         if version script defines any version versions.
10758         (Versions::define_base_version): New method definition.
10759         (Versions::add_def): Check that base version is not needed.
10760         (Versions::add_need): Define base version lazily.
10761         * dynobj.h (Versions::define_base_version): New method declaration.
10762         (Versions::needs_base_version_): New data member declaration.
10763         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10764         (check_DATA): Add no_version_test.stdout.
10765         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10766         New make rules.
10767         * testsuite/Makefile.in: Regenerate.
10768         * testsuite/no_version_test.c: New file.
10769         * testsuite/no_version_test.sh: Ditto.
10770
10771 2009-10-16  Doug Kwan  <dougkwan@google.com>
10772
10773         * expression.cc (class Segment_start_expression): New class definition.
10774         (Segment_start_expression::value): New method definition.
10775         (script_exp_function_segment_start): Return a new
10776         Segment_start_expression.
10777         * gold/script-c.h (script_saw_segment_start_expression): New function
10778         prototype.
10779         * script-sections.cc (Script_sections::Script_sections): Initialize
10780         SAW_SEGMENT_START_EXPRESSION_ to false.
10781         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10782         and -Tbbs options to specify section addresses if given in
10783         command line and no SEGMENT_START expression is seen in a script.
10784         * script-sections.h (Script_sections::saw_segment_start_expression,
10785         Script_sections::set_saw_segment_start_expression): New method
10786         definition.
10787         (Script_sections::saw_segment_start_expression_): New data member
10788         declaration.
10789         * script.cc (script_saw_segment_start_expression): New function.
10790         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10791         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10792         script_test_7.sh and script_test_8.sh.
10793         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10794         script_test_8.stdout.
10795         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10796         (script_test_6, script_test_6.stdout, script_test_7,
10797         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10798         * Makefile.in: Regenerate.
10799         * testsuite/script_test_6.sh: New file.
10800         * testsuite/script_test_6.t: Same.
10801         * testsuite/script_test_7.sh: Same.
10802         * testsuite/script_test_7.t: Same.
10803         * testsuite/script_test_8.sh: Same.
10804
10805 2009-10-16  Doug Kwan  <dougkwan@google.com>
10806
10807         * output.cc (Output_segment::set_section_list_address): Cast
10808         expressions to unsigned long long type to avoid format warnings.
10809
10810 2009-10-15  Ian Lance Taylor  <iant@google.com>
10811
10812         * script.cc (Script_options::add_symbol_assignment): Always add a
10813         dot assignment to script_sections_.
10814         * script-sections.cc (Script_sections::add_dot_assignment):
10815         Initialize if necessary.
10816
10817         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10818         program headers with no load segment if there is a linker script.
10819
10820         * layout.cc (Layout::set_segment_offsets): Align the file offset
10821         to the segment aligment for -N or -n with no load segment.
10822         * output.cc (Output_segment::add_output_section): Don't crash if
10823         the first section is a TLS section.
10824         (Output_segment::set_section_list_addresses): Print an error
10825         message if the address moves backward in a linker script.
10826         * script-sections.cc
10827         (Output_section_element_input::set_section_addresses): Don't
10828         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10829         (Orphan_output_section::set_section_addresses): Likewise.
10830
10831 2009-10-15  Doug Kwan  <dougkwan@google.com>
10832
10833         * layout.cc (Layout::finish_dynamic_section): Generate tags
10834         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10835         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10836         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10837
10838 2009-10-14  Ian Lance Taylor  <iant@google.com>
10839
10840         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10841         fields.
10842         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10843         data_shdr fields of relinfo.
10844         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10845         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10846         R_386_TLS_LDO_32, adjust based on section flags.
10847         (Target_i386::Relocate::fix_up_ldo): Remove.
10848
10849 2009-10-13  Ian Lance Taylor  <iant@google.com>
10850
10851         Add support for -pie.
10852         * options.h (class General_options): Add -pie and
10853         --pic-executable.
10854         (General_options::output_is_position_independent): Test -pie.
10855         (General_options::output_is_executable): Return true if not shared
10856         and not relocatable.
10857         (General_options::output_is_pie): Remove.
10858         * options.cc (General_options::finalize): Reject incompatible uses
10859         of -pie.
10860         * gold.cc (queue_middle_tasks): A -pie link is not static.
10861         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10862         * symtab.cc (Symbol::final_value_is_known): Return false if
10863         output_is_position_independent.
10864         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10865         output_is_position_independent.
10866         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10867         output_is_position_independent.
10868         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10869         output_is_position_independent.
10870         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10871         two_file_pie_test.
10872         (basic_pie_test.o, basic_pie_test): New targets.
10873         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10874         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10875         (two_file_pie_test): New target.
10876         * testsuite/Makefile.in: Rebuild.
10877         * README: Remove note saying that -pie is not supported.
10878
10879 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10880
10881         * options.h (class General_options): Add -init and -fini.
10882         * layout.cc (Layout::finish_dynamic_section): Emit
10883         given init and fini functions.
10884
10885 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10886
10887         * gc.h (gc_process_relocs): Check if icf is enabled using new
10888         function.
10889         * gold.cc (queue_initial_tasks): Likewise.
10890         (queue_middle_tasks): Likewise.
10891         * object.cc (do_layout): Likewise.
10892         * symtab.cc (is_section_folded): Likewise.
10893         * main.cc (main): Likewise.
10894         * reloc.cc (Read_relocs::run): Likewise.
10895         (Sized_relobj::do_scan_relocs): Likewise.
10896         * icf.cc (is_function_ctor_or_dtor): New function.
10897         (Icf::find_identical_sections): Check if function is ctor or dtor when
10898         safe icf is chosen.
10899         * options.h (General_options::icf): Change option to be an enum.
10900         (Icf_status): New enum.
10901         (icf_enabled): New method.
10902         (icf_safe_folding): New method.
10903         (set_icf_status): New method.
10904         (icf_status_): New variable.
10905         * (options.cc) (General_options::finalize): Set icf_status_.
10906         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10907         icf_test and icf_keep_unique_test to use the --icf enum flag.
10908         * testsuite/icf_safe_test.sh: New file.
10909         * testsuite/icf_safe_test.cc: New file.
10910
10911 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10912
10913         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10914         includes to gc.h and icf.h.
10915         * arm.cc: Include gc.h.
10916         * gold.cc: Likewise.
10917         * i386.cc: Likewise.
10918         * powerpc.cc: Likewise.
10919         * sparc.cc: Likewise.
10920         * x86_64.cc: Likewise.
10921         * gc.h: Include icf.h.
10922
10923 2009-10-11  Ian Lance Taylor  <iant@google.com>
10924
10925         * plugin.cc: Include "gold.h" before other header files.
10926
10927 2009-10-10  Chris Demetriou  <cgd@google.com>
10928
10929         * options.h (Input_file_argument::Input_file_type): New enum.
10930         (Input_file_argument::is_lib_): Replace with...
10931         (Input_file_argument::type_): New member.
10932         (Input_file_argument::Input_file_argument): Take Input_file_type
10933         'type' rather than boolean 'is_lib' as second argument.
10934         (Input_file_argument::is_lib): Use type_.
10935         (Input_file_argument::is_searched_file): New function.
10936         (Input_file_argument::may_need_search): Handle is_searched_file.
10937         * options.cc (General_options::parse_library): Support -l:filename.
10938         (General_options::parse_just_symbols): Update for Input_file_argument
10939         changes.
10940         (Command_line::process): Likewise.
10941         * archive.cc (Archive::get_file_and_offset): Likewise.
10942         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10943         * script.cc (read_script_file, script_add_file): Likewise.
10944         * fileread.cc (Input_file::Input_file): Likewise.
10945         (Input_file::will_search_for): Handle is_searched_file.
10946         (Input_file::open): Likewise.
10947         * readsyms.cc (Read_symbols::get_name): Likewise.
10948         * testsuite/Makefile.am (searched_file_test): New test.
10949         * testsuite/Makefile.in: Regenerate.
10950         * testsuite/searched_file_test.cc: New file.
10951         * testsuite/searched_file_test_lib.cc: New file.
10952
10953 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10954             Ian Lance Taylor  <iant@google.com>
10955
10956         * descriptor.cc: Include <cstdio> and "binary-io.h".
10957         (Descriptors::open): Open the files in binary mode always.
10958         * script.cc (Lex::get_token): Treat \r as whitespace.
10959
10960 2009-10-09  Ian Lance Taylor  <iant@google.com>
10961
10962         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10963
10964 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10965             Ian Lance Taylor  <iant@google.com>
10966
10967         * configure.ac: Check for readv function also.
10968         * fileread.cc (readv): Define if not HAVE_READV.
10969         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10970         does not exist.
10971         * config.in: Regenerate.
10972         * configure: Regenerate.
10973
10974 2009-10-09  Doug Kwan  <dougkwan@google.com>
10975
10976         * layout.cc (Layout::make_output_section): Call target hook to make
10977         ordinary output section.
10978         (Layout::finalize): Adjust parameter list of call the
10979         Target::may_relax().
10980         * layout.h (class Layout::section_list): New method.
10981         * merge.h (Output_merge_base::entsize): Change visibility to public.
10982         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10983         New methods.
10984         (Output_merge_string::do_is_string): New method.
10985         * object.cc (Sized_relobj::do_setup): renamed from
10986         Sized_relobj::set_up.
10987         * object.h (Sized_relobj::adjust_shndx,
10988         Sized_relobj::initializ_input_to_output_maps,
10989         Sized_relobj::free_input_to_output_maps): Change visibilities to
10990         protected.
10991         (Sized_relobj::setup): Virtualize.
10992         (Sized_relobj::do_setup): New method declaration.
10993         (Sized_relobj::invalidate_section_offset,
10994         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
10995         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
10996         * options.cc (parse_int): New function.
10997         * options.h (parse_int): New declaration.
10998         (DEFINE_int): New macro.
10999         (stub_group_size): New option.
11000         * output.cc (Output_section::Output_section): Initialize memebers
11001         merge_section_map_, merge_section_by_properties_map_,
11002         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11003         (Output_section::add_input_section): Handled deferred code-fill
11004         generation and remove an old comment.
11005         (Output_section::add_relaxed_input_section): New method definition.
11006         (Output_section::add_merge_input_section): Use merge section by
11007         properties map to speed to search.  Update merge section maps
11008         as appropriate.
11009         (Output_section::build_relaxation_map): New method definition.
11010         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11011         Same.
11012         (Output_section::relax_input_section): Renamed to
11013         Output_section::convert_input_sections_to_relaxed_sections and change
11014         interface to take a vector of pointers to relaxed sections.
11015         (Output_section::find_merge_section,
11016         Output_section::find_relaxed_input_section): New method definitions.
11017         (Output_section::is_input_address_mapped,
11018         Output_section::output_offset, Output_section::output_address):
11019         Use output section data maps to speed up searching.
11020         (Output_section::find_starting_output_address): Add comments.
11021         (Output_section::do_write,
11022         Output_section::write_to_postprocessing_buffer): Do code-fill
11023         generation as appropriate.
11024         (Output_section::get_input_sections): Invalidate relaxed input section
11025         map.
11026         (Output_section::restore_states): Adjust type of checkpoint .
11027         Invalidate relaxed input section map.
11028         * output.h (Output_merge_base): New class declaration.
11029         (Input_section_specifier): New class defintion.
11030         (class Output_relaxed_input_section) Change base class to
11031         Output_section_data_build.
11032         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11033         base class initializer.
11034         (Output_section::add_relaxed_input_section): New method declaration.
11035         (Output_section::Input_section): Change visibility to protected.
11036         (Output_section::Input_section::relobj,
11037         Output_section::Input_section::shndx): Handle relaxed input sections.
11038         Output_section::input_sections) Change visibility to protected.  Also
11039         define overload to return a non-const pointer.
11040         (Output_section::Merge_section_properties): New class defintion.
11041         (Output_section::Merge_section_by_properties_map,
11042         Output_section::Output_section_data_by_input_section_map,
11043         Output_section::Relaxation_map): New types.
11044         (Output_section::relax_input_section): Rename method to
11045         Output_section::convert_input_sections_to_relaxed_sections and change
11046         interface to take a vector of relaxed section pointers.
11047         (Output_section::find_merge_section,
11048         Output_section::find_relaxed_input_section,
11049         Output_section::build_relaxation_map,
11050         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11051         New method declarations.
11052         (Output_section::merge_section_map_
11053         Output_section::merge_section_by_properties_map_,
11054         Output_section::relaxed_input_section_map_,
11055         Output_section::is_relaxed_input_section_map_valid_,
11056         Output_section::generate_code_fills_at_write_): New data members.
11057         * script-sections.cc
11058         (Output_section_element_input::set_section_addresses): Call
11059         current_data_size and addralign methods of relaxed input sections.
11060         (Orphan_output_section::set_section_addresses): Call current_data_size
11061         and addralign methods of relaxed input sections.
11062         * symtab.cc (Symbol_table::compute_final_value): Extract template
11063         from the body of Symbol_table::sized_finalize_symbol.
11064         (Symbol_table::sized_finalized_symbol): Call
11065         Symbol_table::compute_final_value.
11066         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11067         (Symbol_table::compute_final_value): New templated method declaration.
11068         * target.cc (Target::do_make_output_section): New method defintion.
11069         * target.h (Target::make_output_section): New method declaration.
11070         (Target::relax): Add more parameters for input objects, symbol table
11071         and layout.  Adjust call to do_relax.
11072         (Target::do_make_output_section): New method declaration.
11073         (Target::do_relax): Add parameters for input objects, symbol table
11074         and layout.
11075
11076 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11077
11078         * pread.c: Include stdio.h.
11079
11080 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11081
11082         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11083         defined.
11084
11085 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11086
11087         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11088         Change read_shndx type to unsigned int.
11089         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11090         int.
11091         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11092         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11093         Change read_shndx type to unsigned int.
11094         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11095         int.
11096         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11097         * layout.cc (Layout::create_symtab_sections): Cast the result of
11098         local_symcount * symsize to off_t in the gold_assert.
11099
11100 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11101
11102         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11103         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11104         R_ARM_BASE_ABS.
11105         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11106         (Arm_relocate_functions::thm_abs5): New function.
11107         (Arm_relocate_functions::abs12): New function.
11108         (Arm_relocate_functions::abs16): New function.
11109         (Arm_relocate_functions::base_abs): New function.
11110         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11111         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11112         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11113         R_ARM_BASE_ABS.
11114         (Scan::global): Likewise.
11115         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11116         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11117         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11118         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11119         R_ARM_BASE_ABS.
11120
11121 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11122
11123         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11124         (Arm_relocate_functions::movt_prel): New function.
11125         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11126         (Arm_relocate_functions::thm_movt_prel): New function.
11127         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11128         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11129         (Scan::global, Relocate::relocate): Likewise.
11130         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11131
11132 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11133
11134         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11135         Incremental_checker.
11136         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11137         unsigned int.
11138         (class Incremental_inputs_header): New class.
11139         (Incremental_inputs_header_writer): Edit comment.
11140         (Incremental_inputs_entry): New class.
11141         (Incremental_inputs_entry_writer): Edit comment.
11142         (Sized_incremental_binary::do_find_incremental_inputs_section):
11143         Add *strtab_shndx parameter, fill it.
11144         (Sized_incremental_binary::do_check_inputs): New method.
11145         (Incremental_checker::can_incrementally_link_output_file): Use
11146         Sized_incremental_binary::check_inputs.
11147         (Incremental_inputs::report_command_line): Save command line in
11148         command_line_.
11149         * incremental.h:
11150         (Incremental_binary::find_incremental_inputs_section): New
11151         method.
11152         (Incremental_binary::do_find_incremental_inputs_section): Add
11153         strtab_shndx parameter.
11154         (Incremental_binary::do_check_inputs): New pure virtual method.
11155         (Sized_incremental_binary::do_check_inputs): Declare.
11156         (Incremental_checker::Incremental_checker): Add incremental_inputs
11157         parameter, use it to initialize incremental_inputs_.
11158         (Incremental_checker::incremental_inputs_): New field.
11159         (Incremental_checker::command_line): New method.
11160         (Incremental_checker::inputs): New method.
11161         (Incremental_checker::command_line_): New field.
11162
11163 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11164
11165         * incremental.cc: Include <cstdarg> and "target-select.h".
11166         (vexplain_no_incremental): New function.
11167         (explain_no_incremental): New function.
11168         (Incremental_binary::error): New method.
11169         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11170         method.
11171         (make_sized_incremental_binary): New function.
11172         (open_incremental_binary): New function.
11173         (can_incrementally_link_file): Add checks if output is ELF and has
11174         inputs section.
11175         * incremental.h: Include "elfcpp_file.h" and "output.h".
11176         (Incremental_binary): New class.
11177         (Sized_incremental_binary): New class.
11178         (open_incremental_binary): Declare.
11179         * object.cc (is_elf_object): Use
11180         elfcpp::Elf_recognizer::is_elf_file.
11181         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11182         * output.h (Output_file::filesize): New method.
11183
11184 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11185
11186         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11187         New function.
11188         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11189         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11190         function.
11191         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11192         function.
11193         (Arm_relocate_functions::movw_abs_nc): New function.
11194         (Arm_relocate_functions::movt_abs): New function.
11195         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11196         (Arm_relocate_functions::thm_movt_abs): New function.
11197         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11198         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11199         (Scan::global): Likewise.
11200         (Relocate::relocate): Likewise.
11201         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11202
11203 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11204
11205         * arm.cc (Arm_relocate_functions::got_prel) New function.
11206         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11207         (Relocate::relocate): Likewise.
11208         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11209
11210 2009-10-06  Ian Lance Taylor  <iant@google.com>
11211
11212         * options.h (class General_options): Define
11213         split_stack_adjust_size parameter.
11214         * object.h (class Object): Add uses_split_stack_ and
11215         has_no_split_stack_ fields.  Add uses_split_stack and
11216         has_no_split_stack accessor functions.  Declare
11217         handle_split_stack_section.
11218         (class Reloc_symbol_changes): Define.
11219         (class Sized_relobj): Define Function_offsets.  Declare
11220         split_stack_adjust, split_stack_adjust_reltype, and
11221         find_functions.
11222         * object.cc (Object::handle_split_stack_section): New function.
11223         (Sized_relobj::do_layout): Call handle_split_stack_section.
11224         * dynobj.cc (Sized_dynobj::do_layout): Call
11225         handle_split_stack_section.
11226         * reloc.cc (Sized_relobj::relocate_sections): Call
11227         split_stack_adjust for executable sections in split_stack
11228         objects.  Pass reloc_map to relocate_section.
11229         (Sized_relobj::split_stack_adjust): New function.
11230         (Sized_relobj::split_stack_adjust_reltype): New function.
11231         (Sized_relobj::find_functions): New function.
11232         * target-reloc.h: Include "object.h".
11233         (relocate_section): Add reloc_symbol_changes parameter.  Change
11234         all callers.
11235         * target.h (class Target): Add calls_non_split method.  Declare
11236         do_calls_non_split virtual method.  Declare match_view and
11237         set_view_to_nop.
11238         * target.cc: Include "elfcpp.h".
11239         (Target::do_calls_non_split): New function.
11240         (Target::match_view): New function.
11241         (Target::set_view_to_nop): New function.
11242         * gold.cc (queue_middle_tasks): Give an error if mixing
11243         split-stack and non-split-stack objects with -r.
11244         * i386.cc (Target_i386::relocate_section): Add
11245         reloc_symbol_changes parameter.
11246         (Target_i386::do_calls_non_split): New function.
11247         * x86_64.cc (Target_x86_64::relocate_section): Add
11248         reloc_symbol_changes parameter.
11249         (Target_x86_64::do_calls_non_split): New function.
11250         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11251         parameter.
11252         * powerpc.cc (Target_powerpc::relocate_section): Add
11253         reloc_symbol_changes parameter.
11254         * sparc.cc (Target_sparc::relocate_section): Add
11255         reloc_symbol_changes parameter.
11256         * configure.ac: Call AM_CONDITIONAL for the default target.
11257         * configure: Rebuild.
11258         * testsuite/Makefile.am (TEST_AS): New variable.
11259         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11260         (check_DATA): Add split_i386 and split_x86_64 files.
11261         (SPLIT_DEFSYMS): Define.
11262         (split_i386_[1234n].o): New targets.
11263         (split_i386_[124]): New targets.
11264         (split_i386_[1234r].stdout): New targets.
11265         (split_x86_64_[1234n].o): New targets.
11266         (split_x86_64_[124]): New targets.
11267         (split_x86_64_[1234r].stdout): New targets.
11268         (MOSTLYCLEANFILES): Add new executables.
11269         * testsuite/split_i386.sh: New file.
11270         * testsuite/split_x86_64.sh: New file.
11271         * testsuite/split_i386_1.s: New file.
11272         * testsuite/split_i386_2.s: New file.
11273         * testsuite/split_i386_3.s: New file.
11274         * testsuite/split_i386_4.s: New file.
11275         * testsuite/split_i386_n.s: New file.
11276         * testsuite/split_x86_64_1.s: New file.
11277         * testsuite/split_x86_64_2.s: New file.
11278         * testsuite/split_x86_64_3.s: New file.
11279         * testsuite/split_x86_64_4.s: New file.
11280         * testsuite/split_x86_64_n.s: New file.
11281         * testsuite/testfile.cc (Target_test): Update relocation_section
11282         function.
11283         * testsuite/Makefile.in: Rebuild.
11284
11285 2009-10-06  Ian Lance Taylor  <iant@google.com>
11286
11287         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11288         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11289         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11290         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11291         the address on ldo_addrs_.
11292         (Target_i386::Relocate::fix_up_ldo): New function.
11293
11294 2009-10-06   Rafael Espindola  <espindola@google.com>
11295
11296         * plugin.cc (add_input_library): New.
11297         (Plugin::load): Add add_input_library to tv.
11298         (Plugin_manager::add_input_file): Add the is_lib argument.
11299         (add_input_file): Update call to Plugin_manager::add_input_file.
11300         (add_input_library): New.
11301         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11302
11303 2009-09-30  Doug Kwan  <dougkwan@google.com>
11304
11305         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11306         symbol and call Symbol::may_need_copy_reloc to determine if
11307         a copy reloc is needed.
11308         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11309         nocopyreloc is given in command line.
11310         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11311         given in command line.
11312         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11313         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11314         of the removed Target_i386::may_need_copy_reloc.
11315         * options.h (copyreloc): New option with default value false.
11316         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11317         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11318         instead of the removed Target_powerpc::may_need_copy_reloc.
11319         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11320         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11321         instead of the removed Target_sparc::may_need_copy_reloc.
11322         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11323         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11324         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11325         instead of the removed Target_x86_64::may_need_copy_reloc.
11326
11327 2009-09-30  Ian Lance Taylor  <iant@google.com>
11328
11329         * object.h (class Object): Remove target_ field, and target,
11330         sized_target, and set_target methods.
11331         (Object::sized_target): Remove.
11332         (class Sized_relobj): Update declarations.  Remove sized_target.
11333         * object.cc (Sized_relobj::setup): Remove target parameter.
11334         Change all callers.
11335         (Input_objects::add_object): Don't do anything with the target.
11336         (make_elf_sized_object): Add punconfigured parameter.  Change all
11337         callers.  Set or test parameter target.
11338         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11339         Change all callers.
11340         * parameters.cc (Parameters::set_target): Change parameter type to
11341         be non-const.
11342         (Parameters::default_target): Remove.
11343         (set_parameters_target): Change parameter type to be non-const.
11344         (parameters_force_valid_target): New function.
11345         (parameters_clear_target): New function.
11346         * parameters.h (class Parameters): Update declarations.  Remove
11347         default_target method.  Add sized_target and clear_target
11348         methods.  Change target_ to be non-const.
11349         (set_parameters_target): Update declaration.
11350         (parameters_force_valid_target): Declare.
11351         (parameters_clear_target): Declare.
11352         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11353         as NULL if we aren't searching.
11354         (Add_symbols::run): Don't check for compatible target.
11355         * fileread.cc (Input_file::open_binary): Call
11356         parameters_force_valid_target.
11357         * gold.cc (queue_middle_tasks): Likewise.
11358         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11359         set_target on object.
11360         * dynobj.h (class Sized_dynobj): Update declarations.
11361         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11362         make_elf_object returns NULL.
11363         (Archive::include_member): Don't check whether object target is
11364         compatible.
11365         * output.cc (Output_section::add_input_section): Get target from
11366         parameters.
11367         (Output_section::relax_input_section): Likewise.
11368         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11369         parameters.
11370         (Sized_relobj::do_scan_relocs): Likewise.
11371         (Sized_relobj::relocate_sections): Likewise.
11372         * resolve.cc (Symbol_table::resolve): Likewise.
11373         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11374         parameter.  Change all callers.
11375         (Symbol_table::add_from_object): Get target from parameters.
11376         (Symbol_table::add_from_relobj): Don't check object target.
11377         (Symbol_table::add_from_dynobj): Likewise.
11378         (Symbol_table::define_special_symbol): Get target from
11379         parameters.
11380         * symtab.h (class Symbol_table): Update declaration.
11381         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11382         parameter.  Change all callers.  Clear parameter target.
11383         (Binary_test): Test target here.
11384         * testsuite/object_unittest.cc (gold_testsuite): Remove
11385         target_test_pointer parameter.  Change all callers.
11386         (Object_test): Test target here.
11387
11388 2009-09-26  Ian Lance Taylor  <iant@google.com>
11389
11390         * testsuite/initpri1.c: Don't try to use constructor priorities if
11391         compiling with gcc before 4.3.
11392
11393 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11394
11395         * testsuite/retain_symbols_file_test.sh (check_present): Change
11396         output file name to retain_symbols_file_test.stdout.
11397         (check_absent): Likewise.
11398
11399 2009-09-18  Craig Silverstein  <csilvers@google.com>
11400
11401         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11402         * options.cc: Include <cerrno> and <fstream>.
11403         (General_options::finalize): Parse -retain-symbols-file tag.
11404         * options.h: New flag.
11405         (General_options): New method should_retain_symbol, new
11406         variable symbols_to_retain.
11407         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11408         should_retain_symbol map.
11409         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11410         * testsuite/Makefile.in: Regenerate.
11411         * testsuite/retain_symbols_file_test.sh: New file.
11412
11413 2009-09-18  Nick Clifton  <nickc@redhat.com>
11414
11415         * po/es.po: Updated Spanish translation.
11416
11417 2009-09-17  Doug Kwan  <dougkwan@google.com>
11418
11419         * debug.h (DEBUG_RELAXATION): New constant.
11420         (DEBUG_ALL): Add DEBUG_RELAXATION.
11421         (debug_string_to_enum): Add relaxation debug option.
11422         * layout.cc
11423         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11424         Layout::Relaxation_debug_check::read_sections,
11425         Layout::Relaxation_debug_check::read_sections): New method definitions.
11426         (Layout::Layout): Initialize data members
11427         record_output_section_data_from_scrips_,
11428         script_output_section_data_list_ and relaxation_debug_check_.
11429         (Layout::save_segments, Layout::restore_segments,
11430         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11431         Layout::relaxation_loop_body): New method definitions.
11432         (Layout::finalize): Support relaxation.  Move section layout code to
11433         Layout::relaxation_loop_body.
11434         (Layout::set_asection_address_from_script): Move code for orphan
11435         section placement out.
11436         (Layout::place_orphan_sections_in_script): New method definition.
11437         * layout.h (Output_segment_headers, Output_file_header):
11438         New forward class declarations.
11439         (Layout::~Layout): Define.
11440         (Layout::new_output_section_data_from_script): New method definition.
11441         (Layout::place_orphan_sections_in_script): New method declaration.
11442         (Layout::Segment_states): New type declaration.
11443         (Layout::save_segments, Layout::restore_segments,
11444         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11445         Layout::relaxation_loop_body): New method declarations.
11446         (Layout::Output_section_data_list): New type declaration.
11447         (Layout::Relaxation_debug_check): New class definition.
11448         (Layout::record_output_section_data_from_script_,
11449         Layout::script_output_section_data_list_, Layout::segment_states_,
11450         Layout::relaxation_debug_check_): New data members.
11451         * output.cc: (Output_section_headers::do_size): New method definition.
11452         (Output_section_headers::Output_section_headers): Move size
11453         computation to Output_section_headers::do_size.
11454         (Output_segment_headers::do_size): New method definition.
11455         (Output_file_header::Output_file_header): Move size computation to
11456         Output_file_header::do_size and call it.
11457         (Output_file_header::do_size): New method definition.
11458         (Output_data_group::Output_data_group): Adjust call to
11459         Output_section_data.
11460         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11461         (Output_symtab_xindex::do_write): Add array bound check.
11462         (Output_section::Input_section::print_to_mapfile): Handle
11463         RELAXED_INPUT_SECTION_CODE.
11464         (Output_section::Output_section): Initialize data member checkpoint_.
11465         (Output_section::~Output_section): Delete checkpoint object pointed
11466         by checkpoint_.
11467         (Output_section::add_input_section): Always add an Input_section if
11468         relaxing.
11469         (Output_section::add_merge_input_section): Add assert.
11470         (Output_section::relax_input_section): New method definition.
11471         (Output_section::set_final_data_size): Set load address to zero for
11472         an unallocated section.
11473         (Output_section::do_address_and_file_offset_have_reset_values):
11474         New method definition.
11475         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11476         Handle relaxed input section.
11477         (Output_section::sort_attached_input_sections): Checkpoint input
11478         section list lazily.
11479         (Output_section::get_input_sections): Change type of input_sections to
11480         list of Simple_input_section pointers.  Checkpoint input section list
11481         lazily.  Also handle relaxed input sections.
11482         (Output_section::add_input_section_for_script): Take a reference to
11483         a Simple_input_section object instead of Relobj pointer and section
11484         index as parameter.  Handle relaxed input sections.
11485         (Output_section::save_states, Output_section::restore_states): New
11486         method definitions.
11487         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11488         (Output_data::is_data_size_fixed): New method definition.
11489         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11490         if it is fixed.
11491         (Output_data::address_and_file_offset_have_reset_values): New method
11492         definition.
11493         (Output_data::do_address_and_file_offset_have_reset_values): New method
11494         definition.
11495         (Output_data::set_data_size): Check that data size is not fixed.
11496         (Output_data::fix_data_size): New method definition.
11497         (Output_data::is_data_size_fixed_): New data member.
11498         (Output_section_headers::set_final_data_size): New method definition.
11499         (Output_section_headers::do_size): New method declaration.
11500         (Output_segment_headers::set_final_data_size): New method definition.
11501         (Output_segment_headers::do_size): New method declaration.
11502         (Output_file_header::set_final_data_size)::New method definition.
11503         (Output_file_header::do_size)::New method declaration.
11504         (Output_section_data::Output_section_data): Add new parameter
11505         is_data_size_fixed and use it to fix data size.
11506         (Output_data_const::Output_data_const): Adjust call to base class
11507         constructor and fix data size.
11508         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11509         base class constructor and fix data size.
11510         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11511         base class constructor and fix data size.
11512         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11513         class constructor and fix data size.
11514         (Output_data_group::set_final_data_size): New method definition.
11515         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11516         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11517         class constructor and fix data size.
11518         (Output_relaxed_input_section): New class definition.
11519         (Output_section::Simple_input_section): New class definition.
11520         (Output_section::get_input_sections): Adjust parameter list.
11521         (Output_section::add_input_section_for_script): Same.
11522         (Output_section::save_states, Output_section::restore_states,
11523         Output_section::do_address_and_file_offset_have_reset_values,
11524         (Output_section::Input_section::Input_section): Handle
11525         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11526         Output_relaxed_input_section.
11527         (Output_section::Input_section::is_input_section,
11528         Output_section::Input_section::set_output_section): Handle relaxed
11529         input section.
11530         (Output_section::Input_section::is_relaxed_input_section,
11531         Output_section::Input_section::output_section_data,
11532         Output_section::Input_section::relaxed_input_section): New method
11533         definitions.
11534         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11535         value.
11536         (Output_section::Input_section::u1_): Update comments.
11537         (Output_section::Input_section::u2_): Add new union member poris.
11538         (Output_section::Checkpoint_output_section): New classs definition.
11539         (Output_section::relax_input_section): New method declaration.
11540         (Output_section::checkpoint_): New data member.
11541         (Output_segment): Update comments.
11542         (Output_segment::Output_segment): Un-privatize copy constructor.
11543         (Output_segment::operator=): Un-privatize.
11544         * script-sections.cc (Output_section_element::Input_section_list):
11545         Change element type to Output_section::Simple_input_section.
11546         (Output_section_element_dot_assignment::set_section_addresses):
11547         Register output section data for relaxation clean up.
11548         (Output_data_exression::Output_data_expression): Adjust call to base
11549         constructor to fix data size.
11550         (Output_section_element_data::set_section_addresses): Register
11551         Output_data_expression object for relaxation clean up.
11552         (struct Input_section_info): Replace Relobj pointer and section index
11553         pair with Output_section::Simple_input_section and Convert struct to a
11554         class.
11555         (Input_section_sorter::operator()): Adjust access to
11556         Input_section_info data member to use accessors.
11557         (Output_section_element_input::set_section_addresses): Use layout
11558         parameter.  Adjust code to use Output_section::Simple_input_section
11559         and Input_secction_info classes.  Register filler for relaxation
11560         clean up.
11561         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11562         and section index pair with Output_section::Simple_input_section
11563         class.  Adjust code accordingly.
11564         (Phdrs_element::release_segment): New method definition.
11565         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11566         segment list.
11567         (Script_sections::release_segments): New method definition.
11568         * gold/script-sections.h (Script_sections::release_segments): New
11569         method declaration.
11570         * gold/target.h (Target::may_relax, Target::relax,
11571         Target::do_may_relax, Target::do_relax): New method definitions.
11572
11573 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11574
11575         * arm.cc (has_signed_unsigned_overflow): New function.
11576         (Arm_relocate_functions::abs8): New function.
11577         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11578         (Target_arm::Scan::global): Likewise.
11579         (Target_arm::relocate::relocate): Likewise.
11580         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11581         Likewise.
11582
11583 2009-09-16  Cary Coutant  <ccoutant@google.com>
11584
11585         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11586         * testsuite/Makefile.in: Regenerate.
11587
11588 2009-09-11  Nick Clifton  <nickc@redhat.com>
11589
11590         * po/gold.pot: Updated by the Translation project.
11591
11592 2009-09-08  Cary Coutant  <ccoutant@google.com>
11593
11594         * output.cc (Output_file::open): Add execute permission to empty file.
11595         * testsuite/Makefile.am (permission_test): New test.
11596         * testsuite/Makefile.in: Regenerate.
11597
11598 2009-09-02  Ian Lance Taylor  <iant@google.com>
11599
11600         * output.cc (Output_file::resize): Call map_no_anonymous rather
11601         than map.
11602
11603 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11604
11605         * gold.cc: Include "incremental.h".
11606         (queue_initial_tasks): Call Incremental_checker methods.
11607         * incremental.cc: Include "output.h".
11608         (Incremental_checker::can_incrementally_link_output_file): New
11609         method.
11610         * incremental.h (Incremental_checker): New class.
11611
11612         * output.cc (Output_file::open_for_modification): New method.
11613         (Output_file::map_anonymous): Changed return type to bool.  Record
11614         map in base_ field.
11615         (Output_file::map_no_anonymous): New method, broken out of map.
11616         (Output_file::map): Use map_no_anonymous and map_anonymous.
11617         * output.h (class Output_file): Update declarations.
11618
11619 2009-08-24  Cary Coutant  <ccoutant@google.com>
11620
11621         * options.h (Command_line::Pre_options): New class.
11622         (Command_line::pre_options): New member.
11623         * options.cc (gold::options::ready_to_register): New variable.
11624         (One_option::register_option): Do nothing if not registering options.
11625         Assert if same short option registered twice.
11626         (General_options::General_options): Turn off option registration when
11627         done constructing.
11628         (Command_line::Pre_options::Pre_options): New constructor.
11629
11630 2009-08-24  Cary Coutant  <ccoutant@google.com>
11631
11632         * options.h (General_options::no_keep_memory): Remove incorrect
11633         short option.
11634
11635 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11636
11637         * Makefile.am (am__skiplex, am__skipyacc): New.
11638         * Makefile.in: Regenerate.
11639
11640 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11641
11642         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11643         (INCLUDES): ... this.
11644         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11645         (AM_CPPFLAGS): Renamed from ...
11646         (INCLUDE): ... this.
11647         * Makefile.in, testsuite/Makefile.in: Regenerate.
11648
11649         * Makefile.in: Regenerate.
11650         * aclocal.m4: Likewise.
11651         * config.in: Likewise.
11652         * configure: Likewise.
11653         * testsuite/Makefile.in: Likewise.
11654
11655         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11656         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11657         * Makefile.in: Regenerate.
11658         * testsuite/Makefile.in: Regenerate.
11659
11660 2009-08-19  Cary Coutant  <ccoutant@google.com>
11661
11662         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11663         symbols in shared libraries overridden by hidden or internal symbols
11664         in the main program.
11665
11666 2009-08-19  Chris Demetriou  <cgd@google.com>
11667
11668         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11669         checking source file names in error messages.
11670
11671 2009-08-18  Doug Kwan  <dougkwan@google.com>
11672
11673         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11674         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11675         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11676         an elfcpp::Ehdr as parameter.
11677         * object.cc (Object::set_target): Remove the version that looks up
11678         a target and sets it.
11679         (Sized_relobj::setup): Take a Target object instead of
11680         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11681         (make_elf_sized_object): Find target and ask target to
11682         make an ELF object.
11683         * object.h: (Object::set_target): Remove the version that looks up
11684         a target and sets it.
11685         (Sized_relobj::setup): Take a Target object instead of
11686         an elfcpp:Ehdr as parameter.
11687         * target.cc: Include dynobj.h.
11688         (Target::do_make_elf_object_implementation): New.
11689         (Target::do_make_elf_object): New.
11690         * target.h (Target::make_elf_object): New template declaration.
11691         (Target::do_make_elf_object): New method declarations.
11692         (Target::do_make_elf_object_implementation): New template declaration.
11693
11694 2009-08-14  Ian Lance Taylor  <iant@google.com>
11695
11696         * gold.h (FUNCTION_NAME): Define.
11697         (gold_unreachable): Use FUNCTION_NAME.
11698
11699 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11700
11701         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11702         symbol in the --keep-unique list is not found.
11703
11704 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11705
11706         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11707         been maked as --keep-unique.
11708         (Icf::unfold_section): New function.
11709         * icf.h (Icf::unfold_section): New function.
11710         * options.h (General_options::keep_unique): New option.
11711         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11712         * testsuite/Makefile.in: Regenerate.
11713         * testsuite/icf_keep_unique_test.sh: New file.
11714         * testsuite/icf_keep_unique_test.cc: New file.
11715
11716 2009-08-12  Cary Coutant  <ccoutant@google.com>
11717
11718         PR 10471
11719         * resolve.cc (Symbol_table::resolve): Check for references from
11720         dynamic objects to hidden and internal symbols.
11721         * testsuite/Makefile.am (hidden_test.sh): New test.
11722         * testsuite/Makefile.in: Regenerate.
11723         * testsuite/hidden_test.sh: New script.
11724         * testsuite/hidden_test_1.c: New test source.
11725         * testsuite/hidden_test_main.c: New test source.
11726
11727 2009-08-11  Doug Kwan  <dougkwan@google.com>
11728
11729         * arm.cc: Update comments.
11730         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11731         segment to locate the .ARM.exidx section if present.
11732
11733 2009-08-09  Doug Kwan  <dougkwan@google.com>
11734
11735         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11736         patch.
11737
11738 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11739         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11740         compiler warnings.
11741
11742 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11743
11744         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11745         valid tls_segment only for non-debug-section relocations.
11746         * testsuite/Makefile.am: Add gc_tls_test.
11747         * testsuite/Makefile.in: Regenerate.
11748         * testsuite/gc_tls_test.cc: New file.
11749         * testsuite/gc_tls_test.sh: New file.
11750
11751 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11752
11753         * icf.cc: New file.
11754         * icf.h: New file.
11755         * Makefile.am (CCFILES): Add icf.cc.
11756         (HFILES): Add icf.h
11757         * Makefile.in: Regenerate.
11758         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11759         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11760         section, symbol and addend information for the relocs.
11761         * gold.cc (queue_middle_tasks): Call identical code folding.
11762         * gold.h: Add defines for multimap.
11763         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11764         to the call of finalize_local_symbols.
11765         * main.cc (main): Create object of class Icf.
11766         * object.cc (Sized_relobj::do_layout): Allow this function to be
11767         called twice during icf.
11768         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11769         to sections marked as identical by icf.
11770         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11771         when available.
11772         (Sized_relobj::do_section_entsize): New function.
11773         * object.h (Object::section_entsize): New function.
11774         (Object::do_section_entsize): New pure virtual function.
11775         (Relobj::finalize_local_symbols): Add new parameter.
11776         (Relobj::do_section_entsize): New function.
11777         * options.h (General_options::icf): New option.
11778         (General_options::icf_iterations): New option.
11779         (General_options::print_icf_sections): New option.
11780         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11781         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11782         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11783         icf.
11784         * symtab.cc (Symbol_table::is_section_folded): New function.
11785         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11786         to sections marked as identical by icf.
11787         * symtab.h (Symbol_table::set_icf): New function.
11788         (Symbol_table::icf): New function.
11789         (Symbol_table::is_section_folded): New function.
11790         (Symbol_table::icf_): New data member.
11791         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11792         * testsuite/Makefile.am: Add commands to build icf_test.
11793         * testsuite/Makefile.in: Regenerate.
11794         * testsuite/icf_test.sh: New file.
11795         * testsuite/icf_test.cc: New file.
11796
11797 2009-07-24  Chris Demetriou  <cgd@google.com>
11798
11799         * layout.cc (is_compressible_debug_section): Fix incorrect
11800         comment about compressed section names.
11801
11802 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11803
11804         PR 10419
11805         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11806
11807 2009-07-16  Ian Lance Taylor  <iant@google.com>
11808
11809         PR 10400
11810         * layout.h: #include <map>.
11811         (class Kept_section): Change from struct to class.  Add accessors
11812         and setters.  Add section size to Comdat_group mapping.  Change
11813         Comdat_group to std::map.  Add is_comdat_ field.  Add
11814         linkonce_size field in union.
11815         (class Layout): Update declaration of find_or_add_kept_section.
11816         Don't declare find_kept_object.
11817         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11818         parameter.  Add object, shndx, is_comdat, and is_group_name
11819         parameters.  Change all callers.  Adjust for new Kept_section.
11820         (Layout::find_kept_object): Remove.
11821         * object.cc (Sized_relobj::include_section_group): Update use of
11822         Kept_section.  Rename secnum to shndx.  Only record
11823         Kept_comdat_section if sections are the same size.
11824         (Sized_relobj::include_linkonce_section): Update use of
11825         Kept_section.  Only record Kept_comdat_section if sections are the
11826         same size.  Set size of linkonce section.
11827         (Sized_relobj::map_to_kept_section): Update call to
11828         get_kept_comdat_section.
11829         * object.h (class Sized_relobj): Rename fields in
11830         Kept_comdat_section to drop trailing underscores; change object
11831         field to Relobj*.  Change Kept_comdat_section_table to store
11832         struct rather than pointer.
11833         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11834         Add kept_object and kept_shndx parameters.  Change all callers.
11835         (Sized_relobj::get_kept_comdat_section): Change return type to
11836         bool.  Add kept_object and kept_shndx parameters.  Change all
11837         callers.
11838         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11839         Layout::find_or_add_kept_section.
11840
11841 2009-07-09  Ian Lance Taylor  <iant@google.com>
11842
11843         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11844         Reserve space in the hash table.
11845
11846 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11847
11848         * fileread.cc (File_read::get_mtime): New method.
11849         * fileread.h (Timespec): New structure.
11850         (File_read::get_mtime): New method.
11851         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11852         Renamed from timestamp_nsec.
11853         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11854         Elf_Xword.
11855         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11856         timestamp_nsec.
11857         (Incremental_inputs::report_archive): Save mtime; style fix.
11858         (Incremental_inputs::report_obejct): Save mtime; style fix.
11859         (Incremental_inputs::report_script): Save mtime; style fix.
11860         (Incremental_inputs::finalize_inputs): Style fix.
11861         (Incremental_inputs::finalize): Style fix.
11862         (Incremental_inputs::create_input_section_data): Store inputs
11863         mtime.
11864         * incremental.h (Incremental_inputs::report_script): Add mtime
11865         argument.
11866         (Incremental_inputs::Input_info::Input_info): Intialize only one
11867         union member.
11868         (Incremental_inputs::Input_info::archive): Move to nameless
11869         union.
11870         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11871         (Incremental_inputs::Input_info::script): Move to nameless union.
11872         (Incremental_inputs::mtime): New field.
11873         * script.cc (read_input_script): Pass file mtime to
11874         Incremental_input.
11875         * script.h (Script_info::inputs): Style fix.
11876
11877 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11878
11879         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11880         instead of 32.
11881
11882 2009-06-24  Ian Lance Taylor  <iant@google.com>
11883
11884         PR 10156
11885         * layout.cc (Layout::choose_output_section): If we find an
11886         existing section, update the flags.
11887         (Layout::create_notes): New function, broken out of
11888         Layout::finalize.
11889         (Layout::finalize): Don't create note sections.
11890         (Layout::create_note): Don't crash if linker script discards
11891         section.
11892         (Layout::create_gold_note): Likewise.
11893         (Layout::create_build_id): Likewise.  Don't set
11894         after_input_sections on the section.
11895         (Layout::create_executable_stack_info): Remove target parameter.
11896         Change caller.
11897         * layout.h (class Layout): Declare create_notes.  Update
11898         declaration of create_executable_stack_info.
11899         * gold.cc (queue_middle_tasks): Call create_notes.
11900         * output.cc (Output_section::update_flags_for_input_section): Move
11901         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11902         invalid.
11903         * output.h (Output_data::mark_address_invalid): New function.
11904         (class Output_section): Only declare, not define,
11905         update_flags_for_input_section.  Remove set_flags.
11906
11907 2009-06-24  Ian Lance Taylor  <iant@google.com>
11908
11909         * script-sections.cc (Output_section_definition::
11910         set_section_addresses): Rename shadowing local load_address to
11911         laddr.
11912
11913 2009-06-24  Ian Lance Taylor  <iant@google.com>
11914
11915         PR 10244
11916         * reloc.cc (relocate_sections): Skip empty relocation sections.
11917
11918 2009-06-23  Ian Lance Taylor  <iant@google.com>
11919
11920         PR 10156
11921         * layout.cc (Layout::create_note): Use choose_output_section
11922         rather than make_output_section.
11923
11924 2009-06-23  Ian Lance Taylor  <iant@google.com>
11925
11926         PR 10237
11927         * options.cc (General_options::parse_V): Set printed_version_.
11928         (General_options::General_options): Initialize printed_version_.
11929         * options.h (class General_options): Add printed_version_ field.
11930         * gold.cc (queue_initial_tasks): If there are no input files,
11931         don't give a fatal error if we printed the version information.
11932         (queue_middle_tasks): If using -r with a shared object, give a
11933         fatal error rather than an ordinary error.
11934
11935 2009-06-23  Ian Lance Taylor  <iant@google.com>
11936
11937         PR 10219
11938         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11939         (Layout::make_output_section): Set have_stabstr_section_ if we see
11940         a .stab*str section.
11941         (Layout::finalize): Call link_stabs_sections.
11942         (Layout::link_stabs_sections): New file.
11943         * layout.h (class Layout): Add have_stabstr_section_ field.
11944         Declare link_stabs_sections.
11945
11946 2009-06-23  Doug Kwan  <dougkwan@google.com>
11947
11948         * Makefile.am (libgold_a_LIBADD): New.
11949         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11950         * Makefile.in: Regenerate.
11951         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11952         * configure: Regenerate.
11953         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11954         * fileread.cc: Include sys/state.h
11955         * gold.h: Declare memmem and strndup if found missing.
11956         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11957
11958 2009-06-23  Ian Lance Taylor  <iant@google.com>
11959
11960         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11961         * configure: Rebuild.
11962
11963 2009-06-23  Ian Lance Taylor  <iant@google.com>
11964
11965         PR 10147
11966         * object.cc (Object::section_contents): Don't try to get a view if
11967         the section has length zero.
11968         (Object::handle_gnu_warning_section): If the section is empty, use
11969         the name of the section as the warning.
11970
11971 2009-06-23  Ian Lance Taylor  <iant@google.com>
11972
11973         PR 10133
11974         * stringpool.h (class Stringpool_template): Add optimize_ field.
11975         (Stringpool_template::set_optimize): New function.
11976         * stringpool.cc (Stringpool_template::Stringpool_template):
11977         Initialize optimize_ field.
11978         (Stringpool_template::set_string_offsets): Test local optimize
11979         fild rather than parameter.
11980         * layout.cc (Layout::Layout): Call set_optimize on the section
11981         name stringpool.
11982
11983 2009-06-22  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 10030
11986         * yyscript.y: Parse TARGET.
11987         * script.cc (script_set_target): New function.
11988         * script-c.h (script_set_target): Declare.
11989         * options.cc (General_options::string_to_object_format): Rename
11990         from string_to_object_format in anonymous namespace.  Change
11991         callers.
11992         * options.h (class General_options): Declare
11993         string_to_object_format.
11994
11995 2009-06-22  Ian Lance Taylor  <iant@google.com>
11996
11997         * script-sections.cc (Script_sections::create_segments): Don't put
11998         program headers in a PT_LOAD segment if -n or -N.
11999
12000 2009-06-22  Ian Lance Taylor  <iant@google.com>
12001
12002         PR 10141
12003         * options.h (class General_options): Add -z lazy and -z now.  Sort
12004         -z options into alphabetical order.
12005         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12006
12007 2009-06-21  Ian Lance Taylor  <iant@google.com>
12008
12009         * layout.cc (Layout::make_output_section): Call
12010         Target::new_output_section.
12011         (Layout::attach_allocated_section_to_segment): Put large section
12012         sections in a separate load segment with the large segment flag
12013         set.
12014         (Layout::segment_precedes): Sort large data segments after other
12015         load segments.
12016         (align_file_offset): New static function.
12017         (Layout::set_segment_offsets): Use align_file_offset.
12018         * output.h (class Output_section): Add is_small_section_ and
12019         is_large_section_ fields.
12020         (Output_section::is_small_section): New function.
12021         (Output_section::set_is_small_section):  New function.
12022         (Output_section::is_large_section): New function.
12023         (Output_section::set_is_large_section): New function.
12024         (Output_section::is_large_data_section): New function.
12025         (class Output_segment): Add is_large_data_segment_ field.
12026         (Output_segment::is_large_data_segment): New function.
12027         (Output_segment::set_is_large_data_segment): New function.
12028         * output.cc (Output_section::Output_section): Initialize new
12029         fields.
12030         (Output_segment::Output_segment): Likewise.
12031         (Output_segment::add_output_section): Add assertion that large
12032         data sections always go in large data segments.  Force small data
12033         sections to the end of the list of data sections.  Force small BSS
12034         sections to the start of the list of BSS sections.  For large BSS
12035         sections to the end of the list of BSS sections.
12036         * symtab.h (class Symbol): Declare is_common_shndx.
12037         (Symbol::is_defined): Check Symbol::is_common_shndx.
12038         (Symbol::is_common): Likewise.
12039         (class Symbol_table): Define enum Commons_section_type.  Update
12040         declarations.  Add small_commons_ and large_commons_ fields.
12041         * symtab.cc (Symbol::is_common_shndx): New function.
12042         (Symbol_table::Symbol_table): Initialize new fields.
12043         (Symbol_table::add_from_object): Put small and large common
12044         symbols in the right list.
12045         (Symbol_table::sized_finalized_symbol): Check
12046         Symbol::is_common_shndx.
12047         (Symbol_table::sized_write_globals): Likewise.
12048         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12049         common symbol lists.  Don't call do_allocate_commons_list if the
12050         list is empty.
12051         (Symbol_table::do_allocate_commons_list): Remove is_tls
12052         parameter.  Add comons_section_type parameter.  Change all
12053         callers.  Handle small and large common symbols.
12054         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12055         Symbol::is_common_shndx.
12056         * resolve.cc (symbol_to_bits): Likewise.
12057         * target.h (Target::small_common_shndx): New function.
12058         (Target::small_common_section_flags): New function.
12059         (Target::large_common_shndx): New function.
12060         (Target::large_common_section_flags): New function.
12061         (Target::new_output_section): New function.
12062         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12063         small_common_section_flags, and large_common_section_flags
12064         fields.
12065         (Target::do_new_output_section): New virtual function.
12066         * arm.cc (Target_arm::arm_info): Initialize new fields.
12067         * i386.cc (Target_i386::i386_info): Likewise.
12068         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12069         Likewise.
12070         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12071         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12072         (Target_x86_64::do_new_output_section): New function.
12073         * configure.ac: Define conditional MCMODEL_MEDIUM.
12074         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12075         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12076         (large_LDFLAGS): Define.
12077         * testsuite/large.c: New file.
12078         * testsuite/testfile.cc (Target_test::test_target_info):
12079         Initialize new fields.
12080         * configure, testsuite/Makefile.in: Rebuild.
12081
12082 2009-06-05  Doug Kwan  <dougkwan@google.com>
12083
12084         * Makefile.am (CCFILES): Add target.cc.
12085         * Makefile.in: Regenerate.
12086         * i386.cc (class Target_i386): Define new virtual method to
12087         override do_is_local_label_name in parent.
12088         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12089         local symbols if --discard-locals or -X is given.
12090         * options.h (class General_options): Declare new options
12091         '--discard-locals' and '-X' for discarding locals.
12092         * target.h (class Target): Define new methods is_local_label_name.
12093         Declare new virtual method do_is_local_label_name.
12094         * target.cc: New file.
12095         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12096         (check_SCRIPTS): Add discard_locals_test.sh.
12097         (check_DATA): Add discard_local_tests.syms.
12098         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12099         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12100         * testsuite/Makefile.in: Regenerate.
12101         * testsuite/discard_locals_test.c: New file.
12102         * testsuite/discard_locals_test.sh: Same.
12103
12104 2009-06-05  Doug Kwan  <dougkwan@google.com>
12105
12106         * object.cc (Sized_relobj::Sized_relobj): Initialize
12107         discarded_eh_frame_shndx_ to -1U.
12108         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12109         section.
12110         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12111         a discarded .eh_frame section.
12112         (Sized_relobj::do_finalize_local_symbols): Ditto.
12113         * object.h (class Sized_relobj): Declare new member
12114         discarded_eh_frame_shndx_.
12115         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12116         (local_labels_test.o, local_labels_test): New rules.
12117         * testsuite/Makefile.in: Regenerate.
12118
12119 2009-06-04  Doug Kwan  <dougkwan@google.com>
12120
12121         * layout.cc (Layout::section_name_mapping): Add mapping for
12122         special ARM sections.
12123
12124 2009-06-03  Doug Kwan  <dougkwan@google.com>
12125
12126         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12127         (utils::has_overflow): Same.
12128
12129 2009-06-03  Ian Lance Taylor  <iant@google.com>
12130
12131         * layout.cc (Layout::section_name_mapping): New array, replacing
12132         Layout::linkonce_mapping.
12133         (Layout::section_name_mapping_count): New variable, replacing
12134         Layout::linkonce_mapping_count.
12135         (Layout::linkonce_output_name): Remove.
12136         (Layout::output_section_name): Rewrite.
12137         * layout.h (class Layout): Rename Linkonce_mapping to
12138         Section_name_mapping, linkonce_mapping to section_name_mapping,
12139         linkonce_mapping_count to section_name_mapping_count.  Don't
12140         declare linkonce_output_name.
12141
12142 2009-06-03  Doug Kwan  <dougkwan@google.com>
12143
12144         * gold/arm.cc (namespace utils): New.
12145         (Target_arm::reloc_is_non_pic): Define new method.
12146         (class Arm_relocate_functions): New.
12147         (Target_arm::Relocate::relocate): Handle relocation types used by
12148         Android.
12149
12150 2009-06-03  Ian Lance Taylor  <iant@google.com>
12151
12152         * arm.cc (Target_arm::scan::global): Use || instead of |.
12153
12154 2009-06-02  Doug Kwan  <dougkwan@google.com>
12155
12156         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12157         issued_non_pic_error_.
12158         (class Target_arm::Scan): Declare new method check_non_pic.
12159         Define new method symbol_needs_plt_entry.
12160         Declare new data member issued_non_pic_error_.
12161         (class Target_arm::Relocate): Declare new method
12162         should_apply_static_reloc.
12163         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12164         (Target_arm::Scan::check_non_pic): Define new method.
12165         (Target_arm::Scan::local): Handle a small subset of reloc types used
12166         by Android.
12167         (Target_arm::Scan::local): Same.
12168         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12169
12170 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12171
12172         * incremental.cc (Incremental_inputs::report_command_line): Filter
12173         out --incremental-* options.
12174
12175 2009-05-29  Doug Kwan  <dougkwan@google.com>
12176
12177         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12178         template class.
12179         (class Target_arm): Update comment.
12180         (Target_arm::Target_arm): Initialize new data members GOT_,
12181         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12182         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12183         and Target_arm::rel_dyn_section.
12184         Declare new_enum Target_arm::Got_type.
12185         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12186         and DYNBSS_.
12187         Update commments for member do_dynsym_value.
12188         (Target_arm::got_size, Target_arm::plt_section,
12189         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12190         new methods inside class defintion.
12191         (Target_arm::got_section): Define new method.
12192         (Target_arm::rel_dyn_section): Same.
12193         (Output_data_plt_arm): New template class.
12194         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12195         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12196         (Output_data_plt_arm::add_entry): Same.
12197         (Output_data_plt_arm::first_plt_entry): Define new
12198         static data member for PLT instruction template.
12199         (Output_data_plt_arm::plt_entry): Same.
12200         (Output_data_plt_arm::do_write): Define new method.
12201         (Target_arm::make_plt_entry): Same.
12202         (Target_arm::do_finalize_sections): Same.
12203         (Target_arm::do_dynsym_value): Same.
12204
12205 2009-05-28  Doug Kwan  <dougkwan@google.com>
12206
12207         * Makefile.am (TARGETSOURCES): Add arm.cc.
12208         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12209         * Makefile.in: Regenerate.
12210         * arm.cc: New file.
12211         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12212
12213 2009-05-26  Doug Kwan  <dougkwan@google.com>
12214
12215         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12216         (General_options::check_excluded_libs): Strip off directories in
12217         archive name before matching like GNU ld does.
12218         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12219         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12220         (exclude_libs_test_LDFLAGS): Add linker option
12221         -Wl,--exclude-libs,libexclude_libs_test_3
12222         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12223         an explicit archive without using -l.
12224         (alt/libexclude_libs_test_3.a): New make rule.
12225         * testsuite/Makefile.in: Regenerate.
12226         * testsuite/exclude_libs_test.c : Declare lib3_default().
12227         (main): Call it.
12228         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12229         * exclude_libs_test_3.c: New file.
12230
12231 2009-05-26  Nick Clifton  <nickc@redhat.com>
12232
12233         * po/id.po: New Indonesian translation.
12234         * po/gold.pot: Updated template file.
12235
12236 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12237
12238         * testsuite/Makefile.am: Add -ffunction-sections to compile
12239         gc_comdat_test files.  Add -Wl,--gc-sections to build
12240         gc_comdat_test.
12241         * testsuite/Makefile.in: Regenerate.
12242         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12243
12244 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12245
12246         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12247         kept comdat section was garbage collected.
12248         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12249         * testsuite/Makefile.in: Regenerate.
12250         * testsuite/gc_comdat_test.sh: New file.
12251         * testsuite/gc_comdat_test_1.cc: New file.
12252         * testsuite/gc_comdat_test_2.cc: New file.
12253
12254 2009-05-19  Doug Kwan  <dougkwan@google.com>
12255
12256         * archive.cc (Archive::Archive): Move constructor from archive.h
12257         to here.  Initialize no_export_.
12258         (Archive::get_elf_object_for_member): Set no_export flag of object.
12259         * archive.h (Archive::Archive): Move constructor body to
12260         archive.cc.
12261         (Archive::no_export): New method.
12262         (Archive::no_export_): New field.
12263         * object.h (Object::Object): Initialize no_export_ to false.
12264         (Object::no_export, Object::set_no_export): New methods.
12265         (Object::no_export_): New field.
12266         * options.cc (General_options::parse_exclude_libs): New method.
12267         (General_options::check_excluded_libs) Same.
12268         * options.h (exclude_libs): New option.
12269         (General_options::check_excluded_libs): New method declaration.
12270         (General_options::excluded_libs_): New field.
12271         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12272         default or protected visibility if an object has no-export flag set.
12273         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12274         (check_SCRIPTS): Add exclude_libs_test.sh.
12275         (check_DATA): Add exclude_libs_test.syms.
12276         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12277         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12278         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12279         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12280         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12281         libexclude_libs_test_2.a): New rules.
12282         * testsuite/Makefile.in: Regenerate.
12283         * testsuite/exclude_libs_test.c: New file.
12284         * testsuite/exclude_libs_test.sh: Ditto.
12285         * testsuite/exclude_libs_test_1.c: Ditto.
12286         * testsuite/exclude_libs_test_2.c: Ditto.
12287
12288 2009-05-15  Ian Lance Taylor  <iant@google.com>
12289
12290         * configure.ac: Check for declarations for cases where libiberty.h
12291         checks HAVE_DECL_xxx.
12292         * configure, config.in: Rebuild.
12293
12294 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12295
12296         * gold.h (Incremental_argument_list): Remove (invalid) forward
12297         declaration.
12298         * incremental.cc (Incremental_inputs::report_achive): New method.
12299         (Incremental_inputs::report_object): New method.
12300         (Incremental_inputs::report_script): New method.
12301         (Incremental_inputs::finalize_inputs): New method.
12302         (Incremental_inputs::finalize): Call finalize_inputs().
12303         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12304         Create inputs entries.
12305         * incremental.h (Incremental_input_type): New enum.
12306         (Incremental_inputs::Incremental_input): Initialize new fields.
12307         (Incremental_inputs::report_inputs): New method.
12308         (Incremental_inputs::report_achive): New method.
12309         (Incremental_inputs::report_object): New method.
12310         (Incremental_inputs::report_script): New method.
12311         (Incremental_inputs::finalize_inputs): New method.
12312         (Incremental_inputs::Input_info): New struct.
12313         (Incremental_inputs::Input_info_map): New typedef.
12314         (Incremental_inputs::lock_): New field.
12315         (Incremental_inputs::Inputs_): New field.
12316         (Incremental_inputs::Inputs_map): New field.
12317         * main.cc (main): Call Incremental_input::report_inputs.
12318         * options.h (Input_argument_list): Typedef moved from
12319         Input_arguments.
12320         (Input_file_group::Files): Remove, use ::Input_argument_list.
12321         (Input_file_group::Input_argument_list): Remove, use
12322         ::Input_argument_list.
12323         * plugin.cc (Plugin_manager::add_input_file): Add error in
12324         incremental build.
12325         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12326         functions.
12327         * script.cc (read_input_script): Call
12328         Incremental_input::report_script.
12329         * script.h (Script_info): New class.
12330
12331 2009-04-27  Ian Lance Taylor  <iant@google.com>
12332
12333         * x86_64.cc (do_adjust_output_section): Set entsize to
12334         plt_entry_size.
12335
12336 2009-04-23  Elliott Hughes  <enh@google.com>
12337
12338         * output.cc (Output_file::close): After short writes, continue
12339         writing from the correct offset in the buffer being written.
12340
12341 2009-04-23  Chris Demetriou  <cgd@google.com>
12342
12343         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12344         * configure: Regenerate.
12345         * config.in: Regenerate.
12346         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12347         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12348
12349 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12350
12351         * incremental.cc (Incremental_inputs_header_data): Renamed from
12352         Incremental_input_header_data.
12353         (Incremental_inputs_header_data::data_size): New field.
12354         (Incremental_inputs_header_data::put_input_file_count): Renamed
12355         from input_file_count.
12356         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12357         from command_line_offset.
12358         (Incremental_inputs_header_data::put_reserved): Renamed from
12359         put_reserved.
12360         (Incremental_inputs_entry_data): Renamed from
12361         Incremental_input_entry_data.
12362         (Incremental_inputs_entry_data::data_size): New field.
12363         (Incremental_inputs::report_command_line): New method.
12364         (Incremental_inputs::finalize): New method.
12365         (Incremental_inputs::create_incremental_inputs_data): New method.
12366         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12367         * incremental.h: New file.
12368         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12369         (Layout::finalize): Create incremental inputs section in
12370         incremental builds.
12371         (Layout::create_incremental_info_sections): New method.
12372         * layout.h (Layout::incremental_inputs): New method.
12373         (Layout::create_incremental_info_sections): New method.
12374         (Layout::incremental_inputs_): New field.
12375         * main.cc (main): Notify Incremental_input of the command line.
12376
12377 2009-04-01  Ian Lance Taylor  <iant@google.com>
12378             Mikolaj Zalewski  <mikolajz@google.com>
12379
12380         * gold.h (reserve_unordered_map): Define, three versions, one for
12381         each version of Unordered_map.
12382         * layout.cc (Layout::Layout): Remove options parameter.  Add
12383         number_of_input_files parameter.  Don't initialize options_.
12384         Initialize number_of_input_files_ and resized_signatures_.  Move
12385         sections_are_attached_.
12386         (Layout::layout_group): Reserve space for group_signatures_.
12387         (Layout::find_or_add_kept_section): Change name parameter to be a
12388         reference.  Resize signatures_ map when it gets large enough.
12389         (Layout::layout_eh_frame): Use parameters->options() instead of
12390         this->options_.
12391         (Layout::make_output_section): Likewise.
12392         (Layout::attach_allocated_section_to_segment): Likewise.
12393         (Layout::finalize, Layout::create_executable_stack): Likewise.
12394         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12395         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12396         * layout.h (class Layout): Update declarations.  Remove options_
12397         field.  Add number_of_input_files_ and resized_signatures_
12398         fields.  Move sections_are_attached_ field.
12399         * main.cc (main): Pass number of input files to Layout
12400         constructor.  Don't pass options.
12401
12402 2009-03-30  Ian Lance Taylor  <iant@google.com>
12403
12404         * ffsll.c (ffsll): Correct implementation.
12405
12406 2009-03-27  Ian Lance Taylor  <iant@google.com>
12407
12408         * ffsll.c: New file.
12409         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12410         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12411         * ftruncate.c (ftruncate): Declare before definition.
12412         * mremap.c (mremap): Likewise.
12413         * pread.c (pread): Likewise.
12414         * configure, Makefile.in, config.in: Rebuild.
12415
12416         * mremap.c: New file.
12417         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12418         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12419         (mremap): Declare if HAVE_MREMAP is not defined.
12420         * configure, Makefile.in, config.in: Rebuild.
12421
12422 2009-03-27  Cary Coutant  <ccoutant@google.com>
12423
12424         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12425         position independent.
12426         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12427         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12428
12429 2009-03-24  Cary Coutant  <ccoutant@google.com>
12430
12431         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12432         an executable.
12433         (needs_dynamic_reloc): Likewise.
12434
12435 2009-03-24  Ian Lance Taylor  <iant@google.com>
12436
12437         * yyscript.y (file_cmd): Recognize EXTERN.
12438         (extern_name_list, extern_name_list_body): New nonterminals.
12439         * script.cc (script_add_extern): Define.
12440         * script-c.h (script_add_extern): Declare.
12441
12442 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12443
12444         * object.cc (is_elf_object): Define.
12445         * object.h (is_elf_object): Declare.
12446         * archive.cc (Archive::get_elf_object_for_member): Call
12447         is_elf_object.
12448         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12449
12450 2009-03-24  Elliott Hughes  <enh@google.com>
12451
12452         * output.cc (Output_file::map_anonymous): Define.
12453         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12454         try an anonymous one.  Report the size if the mmap fails.
12455         * output.h (class Output_file): Declare map_anonymous.
12456
12457 2009-03-24  Ian Lance Taylor  <iant@google.com>
12458
12459         * target-select.cc (instantiate_target): Don't acquire the lock if
12460         the instantiated_target_ field has already been set.
12461
12462 2009-03-23  Ian Lance Taylor  <iant@google.com>
12463
12464         * gold-threads.h (class Initialize_lock): Define.
12465         * gold-threads.cc (class Initialize_lock_once): Define.
12466         (initialize_lock_control): New static variable.
12467         (initialize_lock_pointer): New static variable.
12468         (initialize_lock_once): New static function.
12469         (Initialize_lock::Initialize_lock): Define.
12470         (Initialize_lock::initialize): Define.
12471         * target-select.h: Include "gold-threads.h".
12472         (class Target_selector): Add lock_ and initialize_lock_ fields.
12473         Don't define instantiate_target, just declare it.
12474         * target-select.cc (Target_selector::Target_selector): Initialize
12475         new fields.
12476         (Target_selector::instantiate_target): Define.
12477         * descriptors.h: Include "gold-threads.h".
12478         (class Descriptors): Add initialize_lock_ field.
12479         * descriptors.cc (Descriptors::Descriptors): Initialize new
12480         field.
12481         (Descriptors::open): Use initialize_lock_ field
12482         * errors.h (class Errors): Add initialize_lock_ field.
12483         * errors.cc (Errors::Errors): Initialize new field.
12484         (Errors::initialize_lock): Use initialize_lock_ field.
12485         * powerpc.cc (class Target_selector_powerpc): Remove
12486         instantiated_target_ field.  In do_recognize call
12487         instantiate_target rather than do_instantiate_target.  In
12488         do_instantiate_target just allocate a new target.
12489         * sparc.cc (class Target_selector_sparc): Likewise.
12490
12491         * freebsd.h: New file.
12492         * i386.cc: Include "freebsd.h".
12493         (Target_i386): Derive from Target_freebsd rather than
12494         Sized_target.
12495         (Target_selector_i386): Derive from Target_selector_freebsd rather
12496         than Target_selector.
12497         * x86_64.cc: Include "freebsd.h".
12498         (Target_x86_64): Derive from Target_freebsd rather than
12499         Sized_target.
12500         (Target_selector_x86_64): Derive from Target_selector_freebsd
12501         rather than Target_selector.
12502         * target.h (class Target): Add adjust_elf_header and
12503         do_adjust_elf_header.
12504         * output.cc (Output_file_header:: do_sized_write): Call target
12505         adjust_elf_header routine.
12506         * configure.tgt: Set targ_osabi.
12507         * configure.ac: Define GOLD_DEFAULT_OSABI.
12508         * parameters.cc (Parameters::default_target): Pass
12509         GOLD_DEFAULT_OSABI to select_target.
12510         * target-select.h (class Target_selector): Make instantiate_target
12511         protected rather than private.
12512         * Makefile.am (HFILES): Add freebsd.h.
12513         * configure, Makefile.in, config.in: Rebuild.
12514
12515         * merge.cc (do_add_input_section): Correct pend value.  Change
12516         message about last entry not being null terminated from error to
12517         warning.
12518
12519 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12520
12521         * incremental.cc: New file.
12522         * Makefile.am (CCFILES): Add incremental.cc.
12523         * Makefile.in: Rebuild.
12524
12525 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12526
12527         * layout.cc (Layout::output_section_name): Preserve names
12528         of '.note.' sections.
12529
12530 2009-03-19  Ian Lance Taylor  <iant@google.com>
12531
12532         * descriptors.cc (Descriptors::open): Check that the options are
12533         valid before using them.
12534
12535 2009-03-18  Ian Lance Taylor  <iant@google.com>
12536
12537         * script-sections.h: Include <list>.
12538         (class Script_sections): Change Sections_elements from std::vector
12539         to std::list.  Typedef public Elements_iterator.  Add
12540         orphan_section_placement_, data_segment_align_start_, and
12541         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12542         field.
12543         * script-sections.cc (class Orphan_section_placement): New class.
12544         (class Sections_element): Add virtual functions is_relro and
12545         orphan_section_init.  Remove virtual function place_orphan_here.
12546         (class Output_section_definition): Add is_relro and
12547         orphan_section_init.  Remove place_orphan_here.
12548         (class Orphan_output_section): Likewise.
12549         (Script_sections::Script_sections): Update for field changes.
12550         (Script_sections::data_segment_align): Set saw_data_segment_align_
12551         and data_segment_align_start_, not data_segment_align_index.
12552         (Script_sections::data_segment_relro_end): Check
12553         saw_data_segment_align_.  Use data_segment_align_start_ rather
12554         than data_segment_align_index_.
12555         (Script_sections::place_orphan): Rewrite to use
12556         Orphan_section_placement.
12557
12558 2009-03-17  Ian Lance Taylor  <iant@google.com>
12559
12560         * archive.cc (Archive::add_symbols): Check for a version attached
12561         to the symbol name in the archive map.
12562         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12563         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12564         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12565         (ver_test_11.a): New target.
12566         * testsuite/Makefile.in: Rebuild.
12567
12568         * configure.ac: Check for chsize and posix_fallocate.  Replace
12569         ftruncate.
12570         * ftruncate.c: New file, from gnulib.
12571         * output.cc (posix_fallocate): Define dummy version if not
12572         HAVE_POSIX_FALLOCATE.
12573         (Output_file::map): Call posix_fallocate rather than lseek and
12574         write.
12575         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12576         * configure, Makefile.in, config.in: Rebuild.
12577
12578 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12579
12580         * layout.h (Layout::create_note): Add section_name parameter.
12581         * layout.cc (Layout::create_note): Likewise.
12582         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12583
12584 2009-03-17  Ian Lance Taylor  <iant@google.com>
12585
12586         * descriptors.cc: Include "options.h".
12587         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12588         (Descriptors::open): Always use O_CLOEXEC when opening a new
12589         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12590         then set FD_CLOEXEC.
12591
12592         * sparc.cc (class Target_sparc): Add has_got_section.
12593         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12594         make sure we have a GOT section.
12595
12596         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12597         (Target_sparc::Scan::local): Likewise.
12598         (Target_sparc::Scan::global): Likewise.
12599         (Target_sparc::Relocate::relocate): Likewise.
12600         (Target_sparc::Relocate::relocate_tls): Likewise.
12601
12602         * symtab.cc (Symbol_table::define_default_version): New function,
12603         broken out of add_from_object.
12604         (Symbol_table::add_from_object): Call define_default_version.
12605         (Symbol_table::define_special_symbol): Add resolve_oldsym
12606         parameter.  Change all callers.  If the version for a symbol comes
12607         from a version script, resolve it with the symbol with the same
12608         name with no version.  Also add the symbol without a version if
12609         appropriate.
12610         (do_define_in_output_data): If resolving with oldsym, don't delete
12611         sym.
12612         (do_define_in_output_segment): Likewise.
12613         (do_define_as_constant): Likewise.
12614         * symtab.h (class Symbol_table): Update declarations.
12615
12616 2009-03-13  Ian Lance Taylor  <iant@google.com>
12617
12618         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12619         (Read_symbols::requeue): New function.
12620         (Read_symbols::do_read_symbols): If make_elf_object fails because
12621         the target type is not configured, and the file was searched for,
12622         issue a warning and retry with the next directory.
12623         (Add_symbols::run): If the file has an incompatible format, and
12624         it was searched for, requeue the Read_symbols task.  On error,
12625         release the object.
12626         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12627         dirindex parameter to constructor.  Change all callers.  Declare
12628         incompatible_warning and requeue.
12629         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12630         input_argument_ and input_group_ fields.  Add them to
12631         constructor.  Change all callers.
12632         (class Read_script): Add dirindex_ field.  Add it to constructor.
12633         Change all callers.
12634         * archive.cc (Archive::setup): Remove input_objects parameter.
12635         Change all callers.
12636         (Archive::get_file_and_offset): Likewise.
12637         (Archive::read_all_symbols): Likewise.
12638         (Archive::read_symbols): Likewise.
12639         (Archive::get_elf_object_for_member): Remove input_objects
12640         parameter.  Add punconfigured parameter.  Change all callers.
12641         (Archive::add_symbols): Change return type to bool.  Check return
12642         value of include_member.
12643         (Archive::include_all_members): Likewise.
12644         (Archive::include_member): Change return type to bool.  Return
12645         false if first included object has incompatible target.  Set
12646         included_member_ field.
12647         (Add_archive_symbols::run): If add_symbols returns false, requeue
12648         Read_symbols task.
12649         * archive.h (class Archive): Add included_member_ field.
12650         Initialize it in constructor.  Add input_file and searched_for
12651         methods.  Update declarations.
12652         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12653         input_argument_ fields.  Add them to constructor.  Change all
12654         callers.
12655         * script.cc: Include "target-select.h".
12656         (class Parser_closure): Add skip_on_incompatible_target_ and
12657         found_incompatible_target_ fields.  Add
12658         skip_on_incompatible_target parameter to constructor.  Change all
12659         callers.  Add methods skip_on_incompatible_target,
12660         clear_skip_on_incompatible_target, found_incompatible_target, and
12661         set_found_incompatible_target.
12662         (read_input_script): Add dirindex parameter.  Change all callers.
12663         If parser finds an incompatible target, requeue Read_symbols
12664         task.
12665         (script_set_symbol): Clear skip_on_incompatible_target in
12666         closure.
12667         (script_add_assertion, script_parse_option): Likewise.
12668         (script_start_sections, script_add_phdr): Likewise.
12669         (script_check_output_format): New function.
12670         * script.h (read_input_script): Update declaration.
12671         * script-c.h (script_check_output_format): Declare.
12672         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12673         (ignore_cmd): Remove OUTPUT_FORMAT.
12674         * fileread.cc (Input_file::Input_file): Add explicit this.
12675         (Input_file::will_search_for): New function.
12676         (Input_file::open): Add pindex parameter.  Change all callers.
12677         * fileread.h (class Input_file): Add input_file_argument method.
12678         Declare will_search_for.  Update declarations.
12679         * object.cc (make_elf_object): Add punconfigured parameter.
12680         Change all callers.
12681         * object.h (class Object): Make input_file public.  Add
12682         searched_for method.
12683         (make_elf_object): Update declaration.
12684         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12685         restart search.
12686         * dirsearch.h (class Dirsearch): Update declaration.
12687         * options.h (class General_options): Add --warn-search-mismatch.
12688         * parameters.cc (Parameters::is_compatible_target): New function.
12689         * parameters.h (class Parameters): Declare is_compatible_target.
12690         * workqueue.cc (Workqueue::add_blocker): New function.
12691         * workqueue.h (class Workqueue): Declare add_blocker.
12692
12693         * fileread.cc (Input_file::open): Remove options parameter.
12694         Change all callers.
12695         (Input_file::open_binary): Likewise.
12696         * script.cc (read_input_script): Likewise.
12697         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12698         options parameter from constructor.  Change all callers.
12699         (class Read_script): Likewise.
12700         * fileread.h (class Input_file): Update declarations.
12701         * script.h (read_input_script): Update declaration.
12702
12703 2009-03-10  Nick Clifton  <nickc@redhat.com>
12704
12705         * po/es.po: New Spanish translation.
12706
12707 2009-03-06  Cary Coutant  <ccoutant@google.com>
12708
12709         * options.cc (parse_short_option): Keep dash_z from registering itself.
12710
12711 2009-03-03  Ian Lance Taylor  <iant@google.com>
12712
12713         PR 9918
12714         * target-reloc.h (relocate_section): Pass output_section to
12715         relocate.
12716         * i386.cc (Target_i386::should_apply_static_reloc): Add
12717         output_section parameter.  Change all callers.
12718         (Target_i386::Relocate::relocate): Add output_section parameter.
12719         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12720         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12721         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12722         * testsuite/two_file_shared.sh: New script.
12723         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12724         (check_DATA): Add two_file_shared.dbg.
12725         (two_file_shared.dbg): New target.
12726         * testsuite/Makefile.in: Rebuild.
12727
12728 2009-03-01  Ian Lance Taylor  <iant@google.com>
12729
12730         * configure.ac: Check for byteswap.h.
12731         * configure: Rebuild.
12732         * config.in: Rebuild.
12733
12734 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12735
12736         * layout.cc (Layout::find_or_add_kept_section): New function.
12737         (Layout::add_comdat): Removed.
12738         * layout.h (struct Kept_section): Move out of class Layout.
12739         Remove trailing underscores from field names.  Add group_sections
12740         field.  Rename group_ field to is_group.  Change all uses.
12741         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12742         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12743         comdat_groups_ field.
12744         (Sized_relobj::include_section_group): Use
12745         find_or_add_kept_section and Kept_section::group_sections.
12746         (Sized_relobj::include_linkonce_section): Likewise.
12747         * object.cc (class Sized_relobj): Don't define Comdat_group or
12748         Comdat_group_table.  Remove find_comdat_group and
12749         add_comdat_group.  Remove comdat_groups_ field.
12750         * plugin.cc (include_comdat_group): Use
12751         Layout::find_or_add_kept_section.
12752
12753 2009-02-28  Ian Lance Taylor  <iant@google.com>
12754
12755         * README: --gc-sections and map files are now supported.  Document
12756         some build requirements.
12757
12758         PR 6992
12759         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12760         relocatable link set the value of the section symbol to zero.
12761         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12762         relocatable link don't include the section address in the local
12763         symbol value.
12764
12765 2009-02-27  Ian Lance Taylor  <iant@google.com>
12766
12767         PR 6811
12768         * options.h (class Search_directory): Add is_system_directory.
12769         (class General_options): Declare is_in_system_directory.
12770         * options.cc (get_relative_sysroot): Make static.
12771         (get_default_sysroot): Make static.
12772         (General_optoins::is_in_system_directory): New function.
12773         * fileread.cc (Input_file::is_in_system_directory): New function.
12774         * fileread.h (class Input_file): Declare is_in_system_directory.
12775         * object.h (class Object): Add is_in_system_directory.
12776         (class Input_objects): Remove system_library_directory_ field.
12777         * object.cc (Input_objects::add_object): Don't set
12778         system_library_directory_.
12779         (input_objects::found_in_system_library_directory): Remove.
12780         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12781         parameter.  Change all callers.
12782         (Symbol_table::sized_write_globals): Likewise.
12783         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12784         Call Object::is_in_system_directory.
12785         * symtab.h (class Symbol_table): Update declarations.
12786
12787         PR 5990
12788         * descriptors.h (Open_descriptor): Add is_on_stack field.
12789         * descriptors.cc (Descriptors::open): If the descriptor is on the
12790         top of the stack, remove it.  Initialize is_on_stack field.
12791         (Descriptors::release): Only add pod to stack if it is not on the
12792         stack already.
12793         (Descriptors::close_some_descriptor): Clear stack_next and
12794         is_on_stack fields.
12795
12796         PR 7091
12797         * output.cc (Output_section::find_starting_output_address): Rename
12798         from starting_output_address; add PADDR parameter; change return
12799         type.
12800         * output.h (class Output_section): Declare
12801         find_starting_output_address instead of starting_output_address.
12802         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12803         section symbol for which we can't find a merge section.
12804
12805         PR 9836
12806         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12807         hidden or internal, force the symbol to be local.
12808         * resolve.cc (Symbol::override_visibility): Define.
12809         (Symbol::override_base): Use override_visibility.
12810         (Symbol_table::resolve): Likewise.
12811         (Symbol::override_base_with_special): Likewise.
12812         (Symbol_table::override_with_special): If the visibility is hidden
12813         or internal, force the symbol to be local.
12814         * symtab.h (class Symbol): Add set_visibility and
12815         override_visibility.
12816         * testsuite/ver_test_1.sh: New file.
12817         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12818         (check_DATA): Add ver_test_1.syms.
12819         (ver_test_1.syms): New target.
12820         * testsuite/Makefile.in: Rebuild.
12821
12822 2009-02-25  Cary Coutant  <ccoutant@google.com>
12823
12824         * layout.cc (Layout::choose_output_section): Don't rename sections
12825         when using a linker script that has a SECTIONS clause.
12826         * Makefile.in: Regenerate.
12827
12828         * testsuite/Makefile.am (script_test_5.sh): New test case.
12829         * testsuite/Makefile.in: Regenerate.
12830         * testsuite/script_test_5.cc: New file.
12831         * testsuite/script_test_5.sh: New file.
12832         * testsuite/script_test_5.t: New file.
12833
12834 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12835
12836         * archive.cc (Archive::include_member): Update calls to add_symbols.
12837         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12838         the Layout argument.
12839         * dynobj.h (do_add_symbols): Add the Layout argument.
12840         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12841         Layout argument.
12842         * object.h (Object::add_symbols): Add the Layout argument.
12843         (Object::do_add_symbols): Add the Layout argument.
12844         (Sized_relobj::do_add_symbols): Add the Layout argument.
12845         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12846         Unify the two versions.
12847         (Add_plugin_symbols): Remove.
12848         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12849         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12850         (Add_plugin_symbols): Remove.
12851         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12852         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12853         (Add_symbols::run): Make it work with Pulginobj.
12854
12855 2009-02-06  Ian Lance Taylor  <iant@google.com>
12856
12857         * object.cc (Sized_relobj::do_layout): Make info message start
12858         with lower case letter.
12859
12860 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12861
12862         * binary.cc: Fix file comment.
12863
12864         * options.h (enum Incremental_disposition): Define.
12865         (class General_options): Add new options: --incremental,
12866         --incremental_changed, --incremental_unchanged,
12867         --incremental_unknown.  Add incremental_disposition_ and
12868         implicit_incremental_ fields.
12869         (General_options::incremental_disposition): New function.
12870         (class Position_dependent_options): Add incremental_disposition
12871         option.
12872         (Position_dependent_options::copy_from_options): Set incremental
12873         dispositions.
12874         * options.cc (General_options::parse_incremental_changed): New
12875         function.
12876         (General_options::parse_incremental_unchanged): New function.
12877         (General_options::parse_incremental_unknown): New function.
12878         (General_options::General_options): Initialize new fields
12879         incremental_disposition_ and implicit_incremental_.
12880         (General_options::finalize): Check for uasge of --incremental-*
12881         without --incremental.
12882
12883 2009-02-06  Chris Demetriou  <cgd@google.com>
12884
12885         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12886         pointer and to report location as the file name associated with
12887         the symbol.
12888         (gold_undefined_symbol_at_location): New function to replace the
12889         old gold_undefined_symbol functionality.
12890         * target-reloc.h (relocate_section): Update to use
12891         gold_undefined_symbol_at_location.
12892         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12893         Call gold_undefined_symbol function rather than gold_error.
12894         * errors.h (Errors::undefined_symbol): Take location as a
12895         string, rather than calculating it from a relocation.
12896         * errors.cc (Errors::fatal): Print "fatal error:" before the
12897         formatted message.
12898         (Errors::error, Errors::error_at_location): Print "error: "
12899         before the formatted message.
12900         (Errors::undefined_symbol): Take location as a string, rather
12901         than calculating it from a relocation.
12902         (gold_undefined_symbol_at_location): New function akin to
12903         old gold_undefined_symbol, calculates location from relocation.
12904         (gold_undefined_symbol): Change to take only a Symbol pointer
12905         and to report location as the file name associated with the symbol.
12906         * testsuite/debug_msg.sh: Update for changed error messages.
12907         * testsuite/undef_symbol.sh: Likewise.
12908
12909 2009-02-04  Duncan Sands  <baldrick@free.fr>
12910
12911         PR 9812
12912         * reduced_debug_output.h
12913         (Output_reduced_debug_abbrev_section::failed): Use format for
12914         gold_warning.
12915         (Output_reduced_debug_info_section::faild): Likewise.
12916
12917 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12918
12919         * script.cc (Lazy_demangler): New class.
12920         (Version_script_info::get_symbol_version_helper): Demangle a
12921         symbol only once.
12922
12923 2009-01-29  Cary Coutant  <ccoutant@google.com>
12924
12925         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12926         to __tls_get_addr.
12927         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12928
12929 2009-01-28  Ian Lance Taylor  <iant@google.com>
12930
12931         * version.cc (version_string): Bump to 1.9.
12932
12933         * gold.h: Include <cstring> and <stdint.h>.
12934         * version.cc: Include <cstdio>.
12935         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12936         warning.
12937         * reduced_debug_output.cc (insert_into_vector): Rename from
12938         Insert_into_vector; change all callers.  Use Swap_unaligned to
12939         avoid aliasing issue; remove union since it is unnecessary.
12940
12941 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12942
12943         * Makefile.am (CCFILES): Add gc.cc.
12944         (HFILES): Add gc.h.
12945         * Makefile.in: Regenerate.
12946         * gold.cc (Gc_runner): New class.
12947         (queue_initial_tasks): Call garbage collection related tasks
12948         when corresponding options are invoked.
12949         (queue_middle_gc_tasks): New function.
12950         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12951         processed early before laying out sections during garbage collection.
12952         * gold.h (queue_middle_gc_tasks): New function.
12953         (is_prefix_of): Move from "layout.cc".
12954         * i386.cc (Target_i386::gc_process_relocs): New function.
12955         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12956         * main.cc (main): Create object of class "Garbage_collection".
12957         * object.cc (Relobj::copy_symbols_data): New function.
12958         (Relobj::is_section_name_included): New function.
12959         (Sized_relobj::do_layout): Allow this function to be called twice
12960         during garbage collection and defer layout of section during the
12961         first call.
12962         * object.h (Relobj::get_symbols_data): New function.
12963         (Relobj::is_section_name_included): New function.
12964         (Relobj::copy_symbols_data): New function.
12965         (Relobj::set_symbols_data): New function.
12966         (Relobj::get_relocs_data): New function.
12967         (Relobj::set_relocs_data): New function.
12968         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12969         (Relobj::gc_process_relocs): New function.
12970         (Relobj::do_gc_process_relocs): New pure virtual function.
12971         (Relobj::sd_): New data member.
12972         (Sized_relobj::is_output_section_offset_invalid): New function.
12973         (Sized_relobj::do_gc_process_relocs): New function.
12974         * options.h (General_options::gc_sections): Modify to not be a no-op.
12975         (General_options::print_gc_sections): New option.
12976         * plugin.cc (Plugin_finish::run): Remove function call to
12977         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12978         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12979         * reloc.cc (Read_relocs::run): Add task to process relocs and
12980         determine unreferenced sections when doing garbage collection.
12981         (Gc_process_relocs): New class.
12982         (Sized_relobj::do_gc_process_relocs): New function.
12983         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12984         sections that are garbage collected.
12985         * reloc.h (Gc_process_relocs): New class.
12986         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12987         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
12988         symbols whose corresponding sections are garbage collected.
12989         (Symbol_table::Symbol_table): Add new parameter for the garbage
12990         collection object.
12991         (Symbol_table::gc_mark_undef_symbols): New function.
12992         (Symbol_table::gc_mark_symbol_for_shlib): New function.
12993         (Symbol_table::gc_mark_dyn_syms): New function.
12994         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
12995         as garbage.
12996         (Symbol_table::add_from_object): Likewise.
12997         (Symbol_table::add_from_relobj): When building shared objects, do not
12998         treat externally visible symbols as garbage.
12999         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13000         table information for static and relocatable links.
13001         * symtab.h (Symbol_table::set_gc): New function.
13002         (Symbol_table::gc): New function.
13003         (Symbol_table::gc_mark_undef_symbols): New function.
13004         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13005         (Symbol_table::gc_mark_dyn_syms): New function.
13006         (Symbol_table::gc_): New data member.
13007         * target.h (Sized_target::gc_process_relocs): New pure virtual
13008         function.
13009         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13010         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13011
13012 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13013
13014         * options.h (General_options::gc_sections): Define as a no-op for now.
13015         (General_options::no_keep_memory): Ditto.
13016         (General_options::Bshareable): Define.
13017         * options.cc (General_options::finalize): Honor -Bshareable.
13018
13019 2009-01-20  Andreas Schwab  <schwab@suse.de>
13020
13021         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13022         read the value in the contents, since we don't use it.  Use the
13023         template endianness when writing.
13024         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13025
13026 2009-01-19  Andreas Schwab  <schwab@suse.de>
13027
13028         * configure.tgt (powerpc64-*): Fix targ_obj.
13029
13030 2009-01-15  Ian Lance Taylor  <iant@google.com>
13031
13032         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13033         local symbols when stripping all symbols.
13034
13035 2009-01-14  Cary Coutant  <ccoutant@google.com>
13036
13037         * output.cc (Output_reloc): Add explicit instantiations.
13038
13039 2009-01-14  Cary Coutant  <ccoutant@google.com>
13040
13041         * archive.cc (Archive::get_elf_object_for_member): Remove call
13042         to File_read::claim_for_plugin.
13043         * descriptors.cc (Descriptors::open): Remove reference to
13044         is_claimed.
13045         (Descriptors::claim_for_plugin): Remove.
13046         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13047         (Descriptors::is_claimed): Remove.
13048         (claim_descriptor_for_plugin): Remove.
13049         * fileread.cc (File_read::claim_for_plugin): Remove.
13050         * fileread.h (File_read::claim_for_plugin): Remove.
13051         (File_read::descriptor): Reopen descriptor if necessary.
13052         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13053         (Plugin_manager::all_symbols_read): Add task parameter. Change
13054         all callers.
13055         (Plugin_manager::get_input_file): New function.
13056         (Plugin_manager::release_input_file): New function.
13057         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13058         corresponding data member.
13059         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13060         and pass to base constructor. Change all callers.
13061         (get_input_file, release_input_file): New functions.
13062         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13063         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13064         (Plugin_manager::all_symbols_read): Add task parameter.
13065         (Plugin_manager::get_input_file): New function.
13066         (Plugin_manager::release_input_file): New function.
13067         (Plugin_manager::task_): New data member.
13068         (Pluginobj::Pluginobj): Add filesize parameter.
13069         (Pluginobj::filename): New function.
13070         (Pluginobj::descriptor): New function.
13071         (Pluginobj::filesize): New function.
13072         (Pluginobj::filesize_): New data member.
13073         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13074         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13075         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13076
13077         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13078         with archive libraries.
13079         * testsuite/Makefile.in: Regenerate.
13080         * testsuite/plugin_test.c (struct sym_info): New type.
13081         (get_input_file, release_input_file): New static variables.
13082         (onload): Capture new transfer vector entries.
13083         (claim_file_hook): Stop reading at end of file according to filesize.
13084         Factor out parsing of readelf output into separate function.
13085         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13086         APIs and get the source file name from the symbol table.  Convert
13087         source file name to corresponding object file name.  Print info
13088         message when adding new input files.
13089         (parse_readelf_line): New function.
13090         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13091         * testsuite/plugin_test_2.sh: Likewise.
13092         * testsuite/plugin_test_3.sh: Likewise.
13093         * testsuite/plugin_test_4.sh: New test case.
13094
13095 2009-01-07  Ian Lance Taylor  <iant@google.com>
13096
13097         * version.cc (version_string): Bump to 1.8.
13098
13099 2008-12-23  Cary Coutant  <ccoutant@google.com>
13100
13101         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13102         * plugin.cc (Plugin_manager::finish): Rename as
13103         layout_deferred_objects.  Move cleanup to separate function.
13104         (Plugin_manager::cleanup): New function.
13105         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13106         separately.
13107         * plugin.h (Plugin_manager::finish): Rename as
13108         layout_deferred_objects.
13109         (Plugin_manager::cleanup): New function.
13110         (Plugin_manager::cleanup_done): New field.
13111
13112 2008-12-23  Cary Coutant  <ccoutant@google.com>
13113
13114         * plugin.cc (is_visible_from_outside): New function.
13115         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13116         so we don't return "IR only" status for exported symbols or -r links.
13117
13118         * testsuite/Makefile.am (plugin_test_3): New test case.
13119         * testsuite/Makefile.in: Regenerate.
13120         * testsuite/plugin_test_3.sh: New file.
13121
13122 2008-12-22  Cary Coutant  <ccoutant@google.com>
13123
13124         * object.cc (Sized_relobj::layout_section): New function.
13125         (Sized_relobj::do_layout): Defer layout of input sections until after
13126         plugin has provided replacement files.
13127         (Sized_relobj::do_layout_deferred_sections): New function.
13128         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13129         (Relobj::layout_deferred_sections): New function.
13130         (Relobj::do_layout_deferred_sections): New function.
13131         (Sized_relobj::do_layout_deferred_sections): New function.
13132         (Sized_relobj::layout_section): New function.
13133         (Sized_relobj::Deferred_layout): New structure.
13134         (Sized_relobj::deferred_layout_): New field.
13135         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13136         Change all callers.  Layout deferred sections.
13137         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13138         references.
13139         (Plugin_hook::run): Move code from do_plugin_hook inline.
13140         (Plugin_hook::do_plugin_hook): Remove.
13141         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13142         (Plugin_manager::finish): Renamed, was cleanup.
13143         (Plugin_manager::should_defer_layout): New function.
13144         (Plugin_manager::add_deferred_layout_object): New function.
13145         (Plugin_manager::Deferred_layout_list): New type.
13146         (Plugin_manager::deferred_layout_objects_): New field.
13147         (Plugin_hook::do_plugin_hook): Remove.
13148
13149 2008-12-17  Ian Lance Taylor  <iant@google.com>
13150
13151         * options.h (class General_options): Add --no case for
13152         --export-dynamic.
13153
13154 2008-12-16  Cary Coutant  <ccoutant@google.com>
13155
13156         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13157         vector.
13158         (Plugin_manager::claim_file): Create plugin object even if
13159         plugin did not call the add_symbols callback.
13160         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13161         asking for more symbols than were added.
13162         * testsuite/Makefile.am (plugin_test_1): Add test case with
13163         no global symbols.
13164         (empty.syms): New target.
13165         * testsuite/Makefile.in: Regenerate.
13166         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13167         message. Don't call add_symbols if no globals.
13168         (all_symbols_read_hook): Don't provide replacement for empty
13169         claimed file.
13170
13171 2008-12-12  Ian Lance Taylor  <iant@google.com>
13172
13173         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13174         r_type == 0 for a local symbol with r_sym == 0.
13175         (scan_relocatable_relocs): Pass r_sym to
13176         local_non_section_strategy.
13177         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13178         r_sym parameter.
13179
13180         * configure.ac: Update test for TLS descriptors: they are
13181         supported as of glibc 2.9.
13182         * configure: Rebuild.
13183
13184 2008-12-11  Ian Lance Taylor  <iant@google.com>
13185
13186         PR 7091
13187         * target-reloc.h (Default_scan_relocatable_relocs): For each
13188         function, map r_type == 0 to RELOC_DISCARD.
13189
13190 2008-12-10  Cary Coutant  <ccoutant@google.com>
13191
13192         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13193         object to override a kept COMDAT group from a plugin object.
13194
13195 2008-12-09  Ian Lance Taylor  <iant@google.com>
13196
13197         PR 7088
13198         * yyscript.y (file_cmd): Handle INPUT.
13199
13200         * testsuite/initpri1.c: Change all declarations to be full
13201         prototypes by adding void, to avoid compiler warnings.
13202
13203 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13204
13205         * options.cc (General_options::parse_plugin_opt): New.
13206         (General_options::add_plugin): The argument now is just the filename.
13207         (General_options::add_plugin_option): New.
13208         * options.h (plugin_opt): New.
13209         (add_plugin): Change argument name.
13210         (add_plugin_option): New.
13211         * plugin.cc (Plugin::load): Don't parse the plugin option.
13212         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13213         (Plugin::add_option): New.
13214         (Plugin::args_): Change type.
13215         (Plugin::filename_): New.
13216         (Plugin_manager::add_plugin_option): New.
13217         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13218         * testsuite/Makefile.in: Regenerate.
13219
13220 2008-12-05  Cary Coutant  <ccoutant@google.com>
13221
13222         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13223         Handle --strip-lto-sections option.
13224         * options.h (strip_lto_sections): New option.
13225
13226 2008-12-01  Cary Coutant  <ccoutant@google.com>
13227
13228         * plugin.cc (ld_plugin_message): Change format parameter to const.
13229         Fix mismatch between new[] and delete.
13230
13231 2008-11-14  Cary Coutant  <ccoutant@google.com>
13232
13233         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13234         instead of -1U.
13235
13236 2008-11-05  Craig Silverstein  <csilvers@google.com>
13237
13238         * options.cc (General_options::parse_dynamic_list): New function.
13239         * options.h (General_options): New flags dynamic_list,
13240         dynamic_list_data, dynamic_list_cpp_new, and
13241         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13242         (General_options::in_dynamic_list): New function.
13243         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13244         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13245         (Lex::can_continue_name): Likewise.
13246         (yylex): Likewise.
13247         (read_script_file): New parameter script_options.
13248         (read_dynamic_list): New function.
13249         (Script_options::define_dynamic_list): New function.
13250         (dynamic_list_keyword_parsecodes): New variable.
13251         (dynamic_list_keywords): New variable.
13252         * script.h (Script_options::define_dynamic_list): New function
13253         prototype.
13254         (read_dynamic_list): New function prototype.
13255         * symtab.cc (strprefix): New macro.
13256         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13257         dynamic_list_data, dynamic_list_cpp_new, and
13258         dynamic_list_cpp_typeinfo.
13259         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13260         (dynamic_list_expr): New rule.
13261         (dynamic_list_nodes): Likewise.
13262         (dynamic_list_node): Likewise.
13263         * testsuite/Makefile.am (dynamic_list): New test.
13264         * testsuite/Makefile.in: Regenerated.
13265         * testsuite/dynamic_list.t: New file.
13266         * testsuite/dynamic_list.sh: New file.
13267
13268 2008-11-05  Craig Silverstein  <csilvers@google.com>
13269
13270         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13271         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13272         (t11_last): Likewise.
13273         * testsuite/ver_test_6.c (main): Likewise.
13274
13275 2008-10-07  Cary Coutant  <ccoutant@google.com>
13276
13277         * options.c (General_options::finalize): Add check for -static and
13278         -shared.
13279         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13280         is not empty.
13281
13282 2008-10-02  Cary Coutant  <ccoutant@google.com>
13283
13284         * plugin.cc (make_sized_plugin_object): Fix conditional
13285         compilation to work when not all targets are enabled.
13286
13287 2008-09-29  Cary Coutant  <ccoutant@google.com>
13288
13289         * archive.cc (Archive::get_file_and_offset): Use filename instead
13290         of name to get library path.
13291         (Archive::include_member): Unlock external member of a thin archive.
13292
13293         * testsuite/Makefile.am (TEST_AR): New variable.
13294         (thin_archive_test_1): New test.
13295         (thin_archive_test_2): New test.
13296         * testsuite/Makefile.in: Regenerate.
13297         * testsuite/thin_archive_main.cc: New file.
13298         * testsuite/thin_archive_test_1.cc: New file.
13299         * testsuite/thin_archive_test_2.cc: New file.
13300         * testsuite/thin_archive_test_3.cc: New file.
13301         * testsuite/thin_archive_test_4.cc: New file.
13302
13303 2008-09-29  Cary Coutant  <ccoutant@google.com>
13304
13305         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13306         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13307         instead of -1U.
13308         (Sized_relobj::do_finalize_local_symbols): Likewise.
13309         (Sized_relobj::map_to_kept_section): Likewise.
13310         * object.h (Sized_relobj::invalid_address): New constant.
13311         (Sized_relobj::do_output_section_offset): Check for invalid_address
13312         and return -1ULL.
13313         * output.cc (Output_reloc::local_section_offset): Use constant
13314         invalid_address instead of -1U.
13315         (Output_reloc::get_address): Likewise.
13316         (Output_section::output_address): Change -1U to -1ULL.
13317         * output.h (Output_reloc::invalid_address): New constant.
13318         * reloc.cc (Sized_relobj::write_sections): Use constant
13319         invalid_address instead of -1U.
13320         (Sized_relobj::relocate_sections): Likewise.
13321         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13322         values for merge sections.
13323         * target-reloc.h (relocate_for_relocatable): Use constant
13324         invalid_address instead of -1U.
13325
13326 2008-09-19  Cary Coutant  <ccoutant@google.com>
13327
13328         Add plugin functionality for link-time optimization (LTO).
13329         * configure.ac (plugins): Add --enable-plugins option.
13330         * configure: Regenerate.
13331         * config.in: Regenerate.
13332         * Makefile.am (LIBDL): New variable.
13333         (CCFILES): Add plugin.cc.
13334         (HFILES): Add plugin.h.
13335         (ldadd_var): Add LIBDL.
13336         * Makefile.in: Regenerate.
13337
13338         * archive.cc: Include "plugin.h".
13339         (Archive::setup): Don't preread archive symbols when using a plugin.
13340         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13341         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13342         files.
13343         (Archive::include_member): Add symbols from plugin objects.
13344         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13345         * descriptors.cc (Descriptors::open): Check for file descriptors
13346         abandoned by plugins.
13347         (Descriptors::claim_for_plugin): New function.
13348         * descriptors.h (Descriptors::claim_for_plugin): New function.
13349         (Open_descriptor::is_claimed): New field.
13350         (claim_descriptor_for_plugin): New function.
13351         * fileread.cc (File_read::claim_for_plugin): New function.
13352         * fileread.h (File_read::claim_for_plugin): New function.
13353         (File_read::descriptor): New function.
13354         * gold.cc: Include "plugin.h".
13355         (queue_initial_tasks): Add task to call plugin hooks for generating
13356         new object files.
13357         * main.cc: Include "plugin.h".
13358         (main): Load plugin libraries.
13359         * object.h (Pluginobj): Declare.
13360         (Object::pluginobj): New function.
13361         (Object::do_pluginobj): New function.
13362         (Object::set_target): New function.
13363         * options.cc: Include "plugin.h".
13364         (General_options::parse_plugin): New function.
13365         (General_options::General_options): Initialize plugins_ field.
13366         (General_options::add_plugin): New function.
13367         * options.h (Plugin_manager): Declare.
13368         (General_options): Add --plugin option.
13369         (General_options::has_plugins): New function.
13370         (General_options::plugins): New function.
13371         (General_options::add_plugin): New function.
13372         (General_options::plugins_): New field.
13373         * plugin.cc: New file.
13374         * plugin.h: New file.
13375         * readsyms.cc: Include "plugin.h".
13376         (Read_symbols::do_read_symbols): Check for archive before checking
13377         for ELF file.  Call plugin hooks to claim files.
13378         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13379         from a real object file; force override when processing replacement
13380         files.
13381         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13382         (Symbol::init_base_object): Likewise.
13383         (Symbol::init_base_output_data): Likewise.
13384         (Symbol::init_base_output_segment): Likewise.
13385         (Symbol::init_base_constant): Likewise.
13386         (Symbol::init_base_undefined): Likewise.
13387         (Symbol::output_section): Assert that object is not a plugin.
13388         (Symbol_table::add_from_pluginobj): New function.
13389         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13390         undefined.
13391         (Symbol_table::sized_write_globals): Likewise.
13392         (Symbol_table::add_from_pluginobj): Instantiate template.
13393         * symtab.h (Sized_pluginobj): Declare.
13394         (Symbol::in_real_elf): New function.
13395         (Symbol::set_in_real_elf): New function.
13396         (Symbol::in_real_elf_): New field.
13397         (Symbol_table::add_from_pluginobj): New function.
13398
13399         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13400         (LIBDL): New variable.
13401         (LDADD): Add LIBDL.
13402         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13403         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13404         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13405         (MOSTLYCLEANFILES): Likewise.
13406         * testsuite/Makefile.in: Regenerate.
13407         * testsuite/plugin_test.c: New file.
13408         * testsuite/plugin_test_1.sh: New file.
13409         * testsuite/plugin_test_2.sh: New file.
13410
13411 2008-09-16  Ian Lance Taylor  <iant@google.com>
13412
13413         * target-reloc.h (relocate_section): Check whether a symbol is
13414         defined by the ABI before reporting an undefined symbol error.
13415         * target.h (Target::is_defined_by_abi): Make parameter const.
13416         (Target::do_is_defined_by_abi): Likewise.
13417         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13418         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13419         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13420         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13421         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13422         * testsuite/Makefile.in: Rebuild.
13423
13424         * fileread.cc (make_view): Add casts to avoid warning.
13425
13426 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13427
13428         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13429         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13430
13431 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13432
13433         * options.h (General_options::output_is_executable): New.
13434         (General_options::output_is_pie): New.
13435         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13436         for shared libraries.
13437         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13438
13439 2008-09-11  Chris Demetriou  <cgd@google.com>
13440
13441         * options.h (origin): New -z option.
13442         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13443         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13444         in DT_FLAGS_1.
13445
13446 2008-09-05  Cary Coutant  <ccoutant@google.com>
13447
13448         * fileread.cc (File_read::make_view): Add check for attempt to map
13449         beyond end of file.
13450
13451 2008-09-05  Cary Coutant  <ccoutant@google.com>
13452
13453         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13454         explicit instantiations.
13455
13456 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13457
13458         PR gold/6858
13459         * options.cc (General_options::finalize): Allow undefined symbols
13460         in shlibs if linking -shared.
13461
13462         PR gold/6859
13463         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13464         symbols as not needing a dynsym entry.
13465
13466 2008-08-20  Craig Silverstein  <csilvers@google.com>
13467
13468         * fileread.cc (File_read::open): Do not lock the file unless it
13469         was successfully opened.
13470
13471 2008-08-14  Cary Coutant  <ccoutant@google.com>
13472
13473         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13474         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13475         * testsuite/tls_test.cc (struct int128): 128-bit struct
13476         for testing TLS relocs with non-zero addend.
13477         (v12): New TLS variable.
13478         (t12): New test.
13479         (t_last): Add check for v12.
13480         * testsuite/tls_test.h (t12): New function.
13481         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13482
13483 2008-08-13  Ian Lance Taylor  <iant@google.com>
13484
13485         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13486         set tls_segment_ or relro_segment_.
13487         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13488         when appropriate.
13489         * output.h (Output_section::clear_is_relro): New function.
13490         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13491         sections specially even when output_data_ is empty.
13492         (Output_segment::maximum_alignment): When first section is relro,
13493         only force alignment for PT_LOAD segments.
13494         * script.cc (script_data_segment_align): New function.
13495         (script_data_segment_relro_end): New function.
13496         * script-c.h (script_data_segment_align): Declare.
13497         (script_data_segment_relro_end): Declare.
13498         * script-sections.h (class Script_sections): Declare
13499         data_segment_align and data_segment_relro_end.  Add fields
13500         segment_align_index_ and saw_relro_end_.
13501         * script-sections.cc (class Sections_element): Add set_is_relro
13502         virtual function.  Add new bool* parameter to place_orphan_here.
13503         Add get_output_section virtual function.
13504         (class Output_section_definition): Add set_is_relro.  Add new
13505         bool* parameter to place_orphan_here.  Add get_output_section.
13506         Add is_relro_ field.
13507         (Output_section_definition::Output_section_definition): Initialize
13508         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13509         and is_relro_ fields.
13510         (Output_section_definition::place_orphan_here): Add is_relro
13511         parameter.
13512         (Output_section_definition::set_section_addresses): Set relro for
13513         output section.
13514         (Output_section_definition::alternate_constraint): Likewise.
13515         (class Orphan_output_section): Add new bool* parameter to
13516         place_orphan_here.  Add get_output_section.
13517         (Orphan_output_section::place_orphan_here): Add is_relro
13518         parameter.
13519         (Script_sections::Script_sections): Initialize
13520         data_segment_align_index_ and saw_relro_end_.
13521         (Script_sections::data_segment_align): New function.
13522         (Script_sections::data_segment_relro_end): New function.
13523         (Script_sections::place_orphan): Set or clear is_relro.
13524         (Script_sections::set_section_addresses): Force alignment of first
13525         TLS section.
13526         * yyscript.y (exp): Call script_data_segment_align and
13527         script_data_segment_relro_end.
13528         * testsuite/relro_script_test.t: New file.
13529         * testsuite/relro_test.cc (using_script): Declare.
13530         (t1, t2): Test using_script.
13531         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13532         (relro_script_test_SOURCES): Define.
13533         (relro_script_test_DEPENDENCIES): Define.
13534         (relro_script_test_LDFLAGS): Define.
13535         (relro_script_test_LDADD): Define.
13536         (relro_script_test.so): New target.
13537         * testsuite/Makefile.in: Rebuild.
13538
13539 2008-08-06  Cary Coutant <ccoutant@google.com>
13540
13541         * archive.cc (Archive::total_archives, Archive::total_members)
13542         (Archive::total_members_loaded): New variables.
13543         (Archive::setup): Add parameter.  Add option to preread
13544         archive symbols.
13545         (Archive::read_armap): Add counter.
13546         (Archive::get_file_and_offset): New function.
13547         (Archive::get_elf_object_for_member): New function.
13548         (Archive::read_all_symbols): New function.
13549         (Archive::read_symbols): New function.
13550         (Archive::add_symbols): Add counters.
13551         (Archive::include_all_members): Use armap to find members if it's
13552         already built.
13553         (Archive::include_member): Skip reading symbols if already read.
13554         Factored code into Archive::get_file_and_offset and
13555         Archive::get_elf_object_for_member.  Changed call to
13556         Mapfile::report_include_archive_member.
13557         (Archive::print_stats): New function.
13558         * archive.h: Declare Object and Read_symbols_data classes.
13559         (Archive::Archive): Add initializers for new members.
13560         (Archive::setup): Add parameter.
13561         (Archive::print_stats): New function.
13562         (Archive::total_archives, Archive::total_members)
13563         (Archive::total_members_loaded): New variables.
13564         (Archive::get_file_and_offset): New function.
13565         (Archive::get_elf_object_for_member): New function.
13566         (Archive::read_all_symbols): New function.
13567         (Archive::read_symbols): New function.
13568         (Archive::Archive_member): New class.
13569         (Archive::members_): New member.
13570         (Archive::num_members_): New member.
13571         * main.cc: Include archive.h.
13572         (main): Call Archive::print_stats.
13573         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13574         archive parameter; member_name is now the fully-decorated name.
13575         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13576         * options.h: (General_options): Add --preread-archive-symbols option.
13577         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13578         Archive::setup.
13579
13580 2008-08-04  Ian Lance Taylor  <iant@google.com>
13581
13582         * symtab.h (Symbol::use_plt_offset): New function.
13583         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13584         * powerpc.cc (Relocate::relocate): Likewise.
13585         * sparc.cc (Relocate::relocate): Likewise.
13586         * x86_64.cc (Relocate::relocate): Likewise.
13587         * testsuite/weak_plt.sh: New test.
13588         * testsuite/weak_plt_main.cc: New test.
13589         * testsuite/weak_plt_shared.cc: New test.
13590         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13591         (check_PROGRAMS): Add weak_plt.
13592         (check_DATA): Add weak_plt_shared.so.
13593         (weak_plt_main_pic.o, weak_plt): New targets.
13594         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13595         * testsuite/Makefile.in: Rebuild.
13596
13597         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13598         gcctestdir/ld.
13599         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13600         * testsuite/Makefile.in: Rebuild.
13601
13602 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13603
13604         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13605         * Makefile.in: Regenerate.
13606         * po/POTFILES.in: Regenerate.
13607
13608 2008-07-29  Ian Lance Taylor  <iant@google.com>
13609
13610         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13611         symbols before other symbols.
13612         * testsuite/script_test_2.cc (test_addr): Declare.
13613         (test_addr_alias): Declare.
13614         (main): Check that test_addr and test_addr_alias have the right
13615         values.
13616         * testsuite/script_test_2.t: Define test_addr_alias and
13617         test_addr.
13618
13619 2008-07-24  Ian Lance Taylor  <iant@google.com>
13620
13621         PR 5990
13622         * descriptors.cc: New file.
13623         * descriptors.h: New file.
13624         * gold-threads.h (class Hold_optional_lock): New class.
13625         * fileread.cc: Include "descriptors.h".
13626         (File_read::~File_read): Release descriptor rather than closing
13627         it.
13628         (File_read::open) [file]: Call open_descriptor rather than open.
13629         Set is_descriptor_opened_.
13630         (File_read::open) [memory]: Assert that descriptor is not open.
13631         (File_read::reopen_descriptor): New function.
13632         (File_read::release): Release descriptor.
13633         (File_read::do_read): Make non-const.  Reopen descriptor.
13634         (File_read::read): Make non-const.
13635         (File_read::make_view): Reopen descriptor.
13636         (File_read::do_readv): Likewise.
13637         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13638         Update declarations.
13639         * layout.cc: Include "descriptors.h".
13640         (Layout::create_build_id): Use open_descriptor rather than open.
13641         * output.cc: Include "descriptors.h".
13642         (Output_file::open): Use open_descriptor rather than open.
13643         * archive.cc (Archive::const_iterator): Change Archive to be
13644         non-const.
13645         (Archive::begin, Archive::end): Make non-const.
13646         (Archive::count_members): Likewise.
13647         * archive.h (class Archive): Update declarations.
13648         * object.h (Object::read): Make non-const.
13649         * Makefile.am (CCFILES): Add descriptors.cc.
13650         (HFILES): Add descriptors.h.
13651         * Makefile.in: Rebuild.
13652
13653         PR 6716
13654         * gold.h: Always include <clocale>.  Add Solaris workarounds
13655         following code in binutils/sysdep.h.
13656
13657         PR 6048
13658         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13659         this->eh_frame_hdr_ is NULL before using it.
13660
13661         * dynobj.cc (Versions::Versions): Update comment.
13662
13663         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13664         the base version name.
13665
13666         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13667         array size plus one.
13668         (Stringpool_template::set_string_offsets): Subtract one from key
13669         before using it as an array index.
13670         (Stringpool_template::get_offset_with_length): Likewise.
13671         (Stringpool_template::write_to_buffer): Likewise.
13672         * stringpool.h (Stringpool_template::get_offset_from_key):
13673         Likewise.
13674
13675 2008-07-23  Ian Lance Taylor  <iant@google.com>
13676
13677         PR 6658
13678         * object.h (Merged_symbol_value::value): Do our best to handle a
13679         negative addend.
13680
13681         PR 6647
13682         * script.cc (Version_script_info::get_versions): Don't add empty
13683         version tag to return value.
13684         (Version_script_info::get_symbol_version_helper): Change return
13685         type to bool.  Add pversion parameter.  Change all callers.
13686         (script_register_vers_node): Don't require a non-NULL tag.
13687         * script.h (class Version_script_info): Update declarations.
13688         (Version_script_info::get_symbol_version): Change return type to
13689         bool.  Add version parameter.  Change all callers.
13690         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13691         handling.  Handle an empty version from a version script.
13692         (Symbol_table::define_special_symbol): Likewise.
13693         * testsuite/ver_test_10.script: New file.
13694         * testsuite/ver_test_10.sh: New file.
13695         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13696         (check_DATA): Add ver_test_10.syms.
13697         (ver_test_10.syms, ver_test_10.so): New target.
13698         * testsuite/Makefile.in: Rebuild.
13699
13700 2008-07-23  Simon Baldwin  <simonb@google.com>
13701
13702         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13703         to zero for undefined symbols from dynamic libraries.
13704
13705 2008-07-23  Ian Lance Taylor  <iant@google.com>
13706
13707         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13708         Change all callers.
13709         * symtab.h (class Symbol_table): Update declaration.
13710         * testsuite/ver_test_9.cc: New file.
13711         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13712         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13713         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13714         (ver_test_9.so, ver_test_9.o): New targets.
13715         * testsuite/Makefile.in: Rebuild.
13716
13717 2008-07-22  Ian Lance Taylor  <iant@google.com>
13718
13719         * options.h (class General_options): Define --check-sections.
13720         * layout.cc (Layout::set_segment_offsets): Handle
13721         --check-sections.
13722
13723         * options.h (class General_options): Define -n/--nmagic and
13724         -N/--omagic.
13725         * options.cc (General_options::finalize): For -n/--nmagic or
13726         -N/--omagic, set -static.
13727         * layout.cc (Layout::attach_allocated_section_to_segment): If
13728         -N/--omagic, don't put read-only and read-write sections in
13729         different segments.
13730         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13731         finding a read-only segment.
13732         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13733         don't set the minimum segment alignment to the common page size,
13734         and don't set the file offset to the address modulo the page size.
13735         * script-sections.cc (Script_sections::create_segments): If
13736         -n/--omagic, don't put read-only and read-write sections in
13737         different segments.
13738
13739         * cref.cc: New file.
13740         * cref.h: New file.
13741         * options.h (class General_options): Add --print-symbol-counts.
13742         * main.cc (main): Issue defined symbol report if requested.
13743         * archive.cc (Archive::interpret_header): Make into a const member
13744         function.
13745         (Archive::add_symbols): Call Input_objects::archive_start and
13746         archive_stop.
13747         (Archive::const_iterator): Define new class.
13748         (Archive::begin, Archive::end): New functions.
13749         (Archive::include_all_members): Rewrite to use iterator.
13750         (Archive::count_members): New function.
13751         * archive.h (class Archive): Update declarations.
13752         (Archive::filename): New function.
13753         * object.cc: Include "cref.h".
13754         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13755         (Sized_relobj::do_get_global_symbol_counts): New function.
13756         (Input_objects::add_object): Add object to cross-referencer.
13757         (Input_objects::archive_start): New function.
13758         (Input_objects::archive_stop): New function.
13759         (Input_objects::print_symbol_counts): New function.
13760         * object.h: Declare Cref and Archive.
13761         (Object::get_global_symbol_counts): New function.
13762         (Object::do_get_global_symbol_counts): New pure virtual function.
13763         (class Sized_relobj): Add defined_count_ field.  Update
13764         declarations.
13765         (class Input_objects): Add cref_ field.  Update constructor.
13766         Update declarations.
13767         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13768         defined_count_.
13769         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13770         symbol counts.
13771         (Sized_dynobj::do_get_global_symbol_counts): New function.
13772         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13773         defined_count_.  Update declarations.  Define Symbols typedef.
13774         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13775         parameter.  Change all callers.
13776         (Symbol_table::add_from_dynobj): Add sympointers and defined
13777         parameters.  Change all callers.
13778         * symtab.h (class Symbol_table): Update declarations.
13779         * Makefile.am (CCFILES): Add cref.cc.
13780         (HFILES): Add cref.h.
13781         * Makefile.in: Rebuild.
13782
13783 2008-07-22  Simon Baldwin  <simonb@google.com>
13784
13785         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13786         to zero when writing undefined symbols.
13787
13788 2008-07-22  Ian Lance Taylor  <iant@google.com>
13789
13790         * output.cc (Output_section::add_input_section): Don't try to
13791         merge empty merge sections.
13792
13793 2008-07-21  Craig Silverstein  <csilvers@google.com>
13794
13795         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13796         Include symbol version in error message.
13797
13798 2008-07-20  Chris Demetriou  <cgd@google.com>
13799
13800         * configure.ac (gold_cv_c_random_seed): New configured variable.
13801         (RANDOM_SEED_CFLAGS): New substituted variable.
13802         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13803         * configure: Rebuild.
13804         * Makefile.in: Likewise.
13805         * testsuite/Makefile.in: Likewise.
13806
13807 2008-07-18  Ian Lance Taylor  <iant@google.com>
13808
13809         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13810         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13811         * testsuite/ver_test_main.cc (main): Call t4.
13812         (t4, t4_2a): Define.
13813         * testsuite/ver_test_2.cc (t4_2): Define.
13814         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13815         * testsuite/ver_test_4.cc (t4_2a): Define.
13816         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13817         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13818
13819 2008-07-17  Ian Lance Taylor  <iant@google.com>
13820
13821         * dynobj.cc (Versions::add_def): If we give an error about a
13822         missing version, go ahead and create the version anyhow.
13823
13824 2008-07-10  Ian Lance Taylor  <iant@google.com>
13825
13826         Handle output sections with more than 0x7fffffff bytes.
13827         * object.h (class Relobj): Change map_to_output_ to
13828         output_sections_, and just keep a section pointer.  Change all
13829         uses.  Move comdat group support to Sized_relobj.
13830         (Relobj::is_section_specially_mapped): Remove.
13831         (Relobj::output_section): Remove poff parameter.  Change all
13832         callers.
13833         (Relobj::output_section_offset): New function.
13834         (Relobj::set_section_offset): Rewrite.
13835         (Relobj::map_to_output): Remove.
13836         (Relobj::output_sections): New function.
13837         (Relobj::do_output_section_offset): New pure virtual function.
13838         (Relobj::do_set_section_offset): Likewise.
13839         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13840         group support from Relobj.  Update declarations.
13841         (Sized_relobj::get_output_section_offset): New function.
13842         (Sized_relobj::do_output_section_offset): New function.
13843         (Sized_relobj::do_set_section_offset): New function.
13844         * object.cc (Relobj::output_section_address): Remove.
13845         (Sized_relobj::Sized_relobj): Initialize new fields.
13846         (Sized_relobj::include_section_group): Cast find_kept_object to
13847         Sized_relobj.
13848         (Sized_relobj::include_linkonce_section): Likewise.
13849         (Sized_relobj::do_layout): Use separate arrays for output section
13850         and output offset.
13851         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13852         output_sections.
13853         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13854         output_sections and section_offsets.
13855         (Sized_relobj::write_local_symbols): Likewise.
13856         (map_to_kept_section): Compute output address directly.
13857         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13858         output_sections and section_offsets.
13859         (Sized_relobj::write_sections): Likewise.
13860         (Sized_relobj::relocate_sections): Likewise.
13861         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13862         * output.h (class Output_reloc): Update declarations.  Change
13863         u2_.relobj to Sized_relobj*.
13864         (class Output_data_reloc): Change add functions to use
13865         Sized_relobj*.
13866         * output.cc (Output_reloc::Output_reloc): Change relobj to
13867         Sized_relobj*.
13868         (Output_reloc::local_section_offset): Change return type to
13869         Elf_Addr.  Use get_output_section_offset.
13870         (Output_reloc::get_address): Likewise.
13871         (Output_section::is_input_address_mapped): Don't call
13872         is_section_specially_mapped.
13873         (Output_section::output_offset): Likewise.
13874         (Output_section::output_address): Likewise.
13875         (Output_section::starting_output_address): Likewise.
13876         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13877         parameter to Sized_relobj*.
13878         (Copy_relocs::need_copy_reloc): Likewise.
13879         (Copy_relocs::save): Likewise.
13880         * copy-relocs.h (class Copy_relocs): Update declarations.
13881         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13882         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13883         * target-reloc.h (relocate_for_relocatable): Change
13884         offset_in_output_section type to Elf_Addr.  Change code that uses
13885         it as well.
13886         * layout.cc (Layout::layout): Always set *off.
13887         * mapfile.cc (Mapfile::print_input_section): Use
13888         output_section_offset.
13889         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13890         Sized_relobj*.
13891         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13892         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13893         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13894
13895 2008-07-03  Ian Lance Taylor  <iant@google.com>
13896
13897         * layout.cc (Layout::include_section): Do not discard unrecognized
13898         SHT_STRTAB sections.
13899
13900 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13901
13902         * script.cc (Lex::can_continue_name): Make '?' allowable in
13903         version-script names.
13904         * testsuite/version_script.map: Change glob pattern to use '?'
13905
13906 2008-06-30  Manish Singh  <yosh@gimp.org>
13907
13908         PR 6585
13909         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13910         Correct typo.
13911
13912 2008-06-30  Ian Lance Taylor  <iant@google.com>
13913
13914         PR 6660
13915         PR 6682
13916         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13917         versions]: Don't try to read the value in the contents, since we
13918         don't use it.  Use the template endianness when writing.
13919
13920 2008-06-25  Cary Coutant  <ccoutant@google.com>
13921
13922         * fileread.cc (File_read::make_view): Assert on zero-length view.
13923         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13924         symbol table when there are no symbols to read.
13925
13926 2008-06-23  Craig Silverstein  <csilvers@google.com>
13927
13928         * version.cc (version_string): Bump to 1.7
13929
13930 2008-06-18  Craig Silverstein  <csilvers@google.com>
13931
13932         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13933         constant 0xFFFF to type Valtype.
13934         (Powerpc_relocate_functions::rel16_ha): Likewise.
13935
13936 2008-06-17  Ian Lance Taylor  <iant@google.com>
13937
13938         * output.h (Output_section::Input_section): Initialize p2align_ to
13939         zero for Output_section_data constructors.
13940         (Output_section::Input_section::addralign): If not an input
13941         section, return the alignment of the Output_section_data.
13942         * testsuite/copy_test.cc: New file.
13943         * testsuite/copy_test_1.cc: New file.
13944         * testsuite/copy_test_2.cc: New file.
13945         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13946         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13947         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13948         (copy_test_1_pic.o, copy_test_1.so): New targets.
13949         (copy_test_2_pic.o, copy_test_2.so): New targets.
13950         * testsuite/Makefile.in: Rebuild.
13951
13952         * script-sections.cc (Script_sections::place_orphan): Initialize
13953         local variable exact.
13954
13955 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13956
13957         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13958
13959 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13960             David S. Miller  <davem@davemloft.net>
13961
13962         * powerpc.cc: New file.
13963         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13964         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13965         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13966         * Makefile.in: Rebuild.
13967
13968 2008-06-09  Ian Lance Taylor  <iant@google.com>
13969
13970         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13971         <exception>.
13972         (throwing, orig_terminate): New static variables.
13973         (terminate_handler): New static function.
13974         (t2): Set terminate handler.
13975
13976 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13977
13978         PR 6584
13979         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13980         alignment.
13981
13982 2008-05-30  Cary Coutant  <ccoutant@google.com>
13983
13984         * archive.cc (Archive::include_all_members) Correct to step
13985         over symbol table and extended name table in thin archives.
13986
13987 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
13988
13989         PR 6407
13990         * target-reloc.h (relocate_for_relocatable): Fix new_offset
13991         calculation.
13992
13993 2008-05-28  Caleb Howe  <cshowe@google.com>
13994
13995         * reduced_debug_output.cc: New file.
13996         * reduced_debug_output.h: New file.
13997         * options.h (class General_options): Add --strip-debug-non-line.
13998         * options.cc (General_options::finalize): Add strip_debug_non_line
13999         to the strip heirarchy.
14000         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14001         fields.
14002         * layout.cc: Include "reduced_debug_output.h".
14003         (Layout::Layout): Initialize new fields.
14004         (line_only_debug_sections): New static array.
14005         (is_lines_only_debug_sections): New static inline function.
14006         (Layout::include_section): Handle --strip-debug-non-line.
14007         (Layout::make_output_section): If --strip-debug-non-line, build
14008         new output sections for .debug_abbrev and .debug_info.
14009         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14010         gold.  Warn about possible overflow.
14011         (read_signed_LEB_128): Likewise.
14012         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14013         (read_signed_LEB_128): Declare.
14014         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14015         (HFILES): Add reduced_debug_output.h.
14016         * Makefile.in: Rebuild.
14017
14018 2008-05-21  Ian Lance Taylor  <iant@google.com>
14019
14020         * mapfile.cc: New file.
14021         * mapfile.h: New file.
14022         * options.h (class General_options): Add -M/--print-map and -Map.
14023         * options.cc (General_options::finalize): Make -M equivalent to
14024         -Map -.
14025         * main.cc: Include <cstdio> and "mapfile.h".
14026         (main): Open mapfile if requested.
14027         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14028         constructor.  Change caller.
14029         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14030         (queue_middle_tasks): Likewise.
14031         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14032         declarations.
14033         * archive.cc: Include "mapfile.h".
14034         (Archive::add_symbols): Add mapfile parameter.  Change all
14035         callers.  Pass mapfile, symbol, and reason to include_member.
14036         (Archive::include_all_members): Add mapfile parameter.  Change all
14037         callers.
14038         (Archive::include_member): Add mapfile, sym, and why parameters.
14039         Change all callers.  Report inclusion to map file.
14040         * archive.h: Include "fileread.h".
14041         (class Archive): Update declarations.
14042         (Archive::file): New const method.
14043         (class Add_archive_symbols): Add mapfile_ field.  Update
14044         constructor.  Change all callers.
14045         * readsyms.h (class Read_symbols): Likewise.
14046         (class Finish_group): Likewise.
14047         (class Read_script): Likewise.
14048         * common.cc: Include "mapfile.h".
14049         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14050         all callers.
14051         (Symbol_table::do_allocate_commons): Likewise.
14052         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14053         symbol allocation to mapfile.
14054         * common.h (class Allocate_commons_task): Add mapfile_ field.
14055         Update constructor.  Change all callers.
14056         * symtab.h (class Symbol_table): Update declarations.
14057         * layout.cc: Include "mapfile.h".
14058         (Layout_task_runner::run): Print information to mapfile.
14059         (Layout::create_gold_note): Change Output_data_fixed_space to
14060         Output_data_zero_fill.
14061         (Layout::create_build_id): Likewise.
14062         (Layout::print_to_mapfile): New function.
14063         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14064         constructor.  Change caller.
14065         (class Layout): Declare print_to_mapfile.
14066         * output.cc (Output_section::Input_section::print_to_mapfile): New
14067         function.
14068         (Output_section::add_input_section): If producing a map, always
14069         add to input_sections_ list.
14070         (Output_section::do_print_to_mapfile): New function.
14071         (Output_segment::print_sections_to_mapfile): New function.
14072         (Output_segment::print_section_list_to_mapfile): New function.
14073         * output.h: Include "mapfile.h".
14074         (Output_data::print_to_mapfile): New function.
14075         (Output_data::do_print_to_mapfile): New virtual function.
14076         (Output_segment_headers::do_print_to_mapfile): New function.
14077         (Output_file_header::do_print_to_mapfile): New function.
14078         (Output_data_const::do_print_to_mapfile): New function.
14079         (class Output_data_const_buffer): Add map_name_ field.  Update
14080         constructor.  Change all callers.  Add do_print_to_mapfile
14081         function.
14082         (class Output_data_fixed_space): Likewise.
14083         (class Output_data_space): Likewise.
14084         (class Output_data_zero_fill): New class.
14085         (Output_data_strtab::do_print_to_mapfile): New function.
14086         (Output_data_reloc_base::do_print_to_mapfile): New function.
14087         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14088         (Output_data_group::do_print_to_mapfile): New function.
14089         (Output_data_got::do_print_to_mapfile): New function.
14090         (Output_data_dynamic::do_print_to_mapfile): New function.
14091         (Output_symtab_xindex::do_print_to_mapfile): New function.
14092         (class Output_section): Declare do_print_to_mapflie.  Declare
14093         print_to_mapfile in Input_section.
14094         (class Output_segment): Declare new functions.
14095         * object.h (Sized_relobj::symbol_count): New function.
14096         * script-sections.cc
14097         (Output_section_element_dot_assignment::set_section_addresses):
14098         Change Output_data_fixed_space to Output_data_zero_fill.
14099         (Output_data_expression::do_print_to_mapfile): New function.
14100         * script.cc (read_input_script): Add mapfile parameter.  Change
14101         all callers.
14102         * script.h (read_input_script): Update declaration.
14103         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14104         (Eh_frame::do_print_to_mapfile): New function.
14105         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14106         (Output_merge_string::do_print_to_mapfile): New function.
14107         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14108         function.
14109         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14110         function.
14111         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14112         function.
14113         * Makefile.am (CCFILES): Add mapfile.cc.
14114         (HFILES): Add mapfile.h.
14115         * Makefile.in: Rebuild.
14116
14117 2008-05-19  Ian Lance Taylor  <iant@google.com>
14118
14119         * options.h (class General_options): Add -z relro.
14120         * layout.cc (Layout::Layout): Initialize relro_segment_.
14121         (Layout::add_output_section_data): Return the output section.
14122         (Layout::make_output_section): Rcognize relro sections and mark
14123         them appropriately.
14124         (Layout::attach_allocated_section_to_segment): Put relro sections
14125         in a PT_GNU_RELRO segment.
14126         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14127         section as relro.
14128         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14129         PT_TLS segments.
14130         (Layout::linkonce_mapping): Map d.rel.ro.local to
14131         .data.rel.ro.local.
14132         (Layout::output_section_name): Us .data.rel.ro.local for any
14133         section which begins with that.
14134         * layout.h (class Layout): Update add_output_section_data
14135         declaration.  Add relro_segment_ field.
14136         * output.cc (Output_section::Output_section): Initialize is_relro_
14137         and is_relro_local_ fields.
14138         (Output_segment::add_output_section): Group relro sections.
14139         (Output_segment::is_first_section_relro): New function.
14140         (Output_segment::maximum_alignment): If there is a relro section,
14141         align the segment to the common page size.
14142         (Output_segment::set_section_addresses): Track whether we are
14143         looking at relro sections.  If the last section is a relro
14144         section, align to the common page size.
14145         (Output_segment::set_section_list_addresses): Add in_relro
14146         parameter.  Change all callers.  Align to the page size when
14147         moving from relro to non-relro section.
14148         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14149         segment.
14150         * output.h (class Output_section): Add is_relro_ and
14151         is_relro_local_ fields.
14152         (Output_section::is_relro): New function.
14153         (Output_section::set_is_relro): New function.
14154         (Output_section::is_relro_local): New function.
14155         (Output_section::set_is_relro_local): New function.
14156         (class Output_segment): Update declarations.
14157         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14158         * sparc.cc (Target_sparc::got_section): Likewise.
14159         * x86_64.cc (Target_x86_64::got_section): Likewise.
14160         * testsuite/relro_test_main.cc: New file.
14161         * testsuite/relro_test.cc: New file.
14162         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14163         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14164         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14165         (relro_test.so, relro_test_pic.o): New targets.
14166         * testsuite/Makefile.in: Rebuild.
14167
14168 2008-05-16  Ian Lance Taylor  <iant@google.com>
14169
14170         * output.cc (Output_segment::add_output_section): Remove front
14171         parameter.
14172         * output.h (class Output_segment): Remove
14173         add_initial_output_section and overloaded add_output_section.
14174         Update declaration of remaining add_output_section.
14175         * layout.cc (Layout::create_interp): Call add_output_section
14176         rather than add_initial_output_section.
14177         (Layout::finish_dynamic_section): Likewise.
14178
14179         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14180         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14181         know the dynamic type.
14182         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14183         field.  Initialize it in constructor.
14184         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14185         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14186         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14187         reloc.
14188
14189         * output.cc (Output_reloc::get_address): Change return type to
14190         Elf_Addr.
14191         * output.h (class Output_reloc): Update get_address declaration.
14192         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14193         for section addresses.
14194
14195 2008-05-09  Ian Lance Taylor  <iant@google.com>
14196
14197         PR 6493
14198         * gold.cc (gold_nomem): Use return value of write.
14199
14200 2008-05-08  Ian Lance Taylor  <iant@google.com>
14201
14202         * symtab.c (Symbol::init_base_output_data): Add version
14203         parameter.  Change all callers.
14204         (Symbol::init_base_output_segment): Likewise.
14205         (Symbol::init_base_constant): Likewise.
14206         (Symbol::init_base_undefined): Likewise.
14207         (Sized_symbol::init_output_data): Likewise.
14208         (Sized_symbol::init_output_segment): Likewise.
14209         (Sized_symbol::init_constant): Likewise.
14210         (Sized_symbol::init_undefined): Likewise.
14211         (Symbol_table::do_define_in_output_data): If the new symbol has a
14212         version, mark it as the default.
14213         (Symbol_table::do_define_in_output_segment): Likewise.
14214         (Symbol_table::do_define_as_constant): Likewise.
14215         * symtab.h (class Symbol): Update declarations.
14216         (class Sized_symbol): Likewise.
14217         * resolve.cc (Symbol::override_version): New function.
14218         (Symbol::override_base): Call override_version.
14219         (Symbol::override_base_with_special): Likewise.
14220         * testsuite/ver_script_8.script: New file.
14221         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14222         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14223         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14224         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14225
14226 2008-05-06  Ian Lance Taylor  <iant@google.com>
14227
14228         PR 6049
14229         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14230         functions.
14231         (class General_options): Remove existing --undefined, and add
14232         --no-undefined instead.  Add new --undefined as synonym for -u.
14233         * archive.cc (Archive::add_symbols): Check whether symbol was
14234         named with -u.
14235         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14236         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14237         all uses.  Add IS_UNDEFINED.  Update declarations to split
14238         different versions of init_base.  Declare init_base_undefined.
14239         (Symbol::is_defined): Handle IS_UNDEFINED.
14240         (Symbol::is_undefined): Likewise.
14241         (Symbol::is_weak_undefined): Call is_undefined.
14242         (Symbol::is_absolute): Handle IS_CONSTANT.
14243         (class Sized_symbol): Update declarations to split different
14244         versions of init.  Declare init_undefined.
14245         (class Symbol_table): Declare new functions.
14246         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14247         Change all callers.
14248         (Symbol::init_base_output_data): Likewise.
14249         (Symbol::init_base_output_segment): Likewise.
14250         (Symbol::init_base_constant): Likewise.
14251         (Symbol::init_base_undefined): New function.
14252         (Sized_symbol::init_object): Rename from init.  Change all
14253         callers.
14254         (Sized_symbol::init_output_data): Likewise.
14255         (Sized_symbol::init_output_segment): Likewise.
14256         (Sized_symbol::init_constant): Likewise.
14257         (Sized_symbol::init_undefined): New function.
14258         (Symbol_table::add_undefined_symbols_from_command_line): New
14259         function.
14260         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14261         function.
14262         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14263         (Symbol::output_section): Likewise.
14264         (Symbol::set_output_section): Likewise.
14265         (Symbol_table::sized_finalize_symbol): Likewise.
14266         (Symbol_table::sized_write_globals): Likewise.
14267         * resolve.cc (Symbol_table::should_override): Likewise.
14268         (Symbol::override_base_with_special): Likewise.
14269
14270         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14271         symbol, change it to have default visibility.
14272         * testsuite/protected_1.cc: New file.
14273         * testsuite/protected_2.cc: New file.
14274         * testsuite/protected_3.cc: New file.
14275         * testsuite/protected_main_1.cc: New file.
14276         * testsuite/protected_main_2.cc: New file.
14277         * testsuite/protected_main_3.cc: New file.
14278         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14279         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14280         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14281         (protected_1.so): New target.
14282         (protected_1_pic.o, protected_2_pic.o): New targets.
14283         (protected_3_pic.o): New target.
14284         (check_PROGRAMS): Add protected_2.
14285         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14286         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14287         * testsuite/Makefile.in: Rebuild.
14288
14289         * options.h (DEFINE_var): Add set_user_set_##varname__.
14290         (DEFINE_bool_alias): New macro.
14291         (class General_options): Define -Bstatic using DEFINE_bool_alias
14292         rather than DEFINE_special.  Add --undefined as an alias for -z
14293         defs.
14294         * options.cc (General_options::parse_Bstatic): Remove.
14295
14296         * options.h (class General_options): Add --fatal-warnings.
14297         * main.cc (main): Implement --fatal-warnings.
14298         * errors.h (Errors::warning_count): New function.
14299
14300         * options.h (class General_options): Add -Bsymbolic-functions.
14301         * symtab.h (Symbol::is_preemptible): Check for
14302         -Bsymbolic-functions.
14303
14304 2008-05-05  Ian Lance Taylor  <iant@google.com>
14305
14306         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14307         as noVARNAME rather than no-VARNAME.
14308         (class General_options): Add option -z combreloc.
14309         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14310         get_address.
14311         (Output_reloc::sort_before) [SHT_REL]: New function.
14312         (Output_reloc::sort_before) [SHT_RELA]: New function.
14313         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14314         Sort_relocs_comparison.
14315         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14316         parameter.  Change all callers.
14317         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14318         sort_relocs parameter.  Change all callers.
14319         * output.cc (Output_reloc::get_address): New function, broken out
14320         of write_rel.
14321         (Output_reloc::write_rel): Call it.
14322         (Output_reloc::compare): New function.
14323         (Output_data_reloc_base::do_write): Optionally sort relocs.
14324
14325         * configure.ac: If targ_extra_obj is set, link it in.
14326         * configure.tgt: Initialize all variables.
14327         (x86_64*): Set targ_extra_obj and targ_extra_size.
14328         * configure: Rebuild.
14329
14330         * object.cc (Sized_relobj::include_section_group): Adjust section
14331         indexes read from group data.  Build vector to pass to
14332         layout_group.
14333         * layout.cc (Layout::layout_group): Add flags and shndxes
14334         parameters.  Remove contents parameter.  Change caller.  Update
14335         explicit instantiations.
14336         * layout.h (class Layout): Update layout_group declaration.
14337         * output.cc (Output_data_group::Output_data_group): Add flags and
14338         input_shndxes parameters.  Remove contents parameter.  Change
14339         caller.
14340         (Output_data_group::do_write): Change input_sections_ to
14341         input_shndxes_.
14342         * output.h (class Output_data_group): Update constructor
14343         declaration.  Rename input_sections_ to input_shndxes_.
14344         * testsuite/many_sections_test.cc: Add template.
14345
14346 2008-04-30  Cary Coutant  <ccoutant@google.com>
14347
14348         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14349
14350         * layout.cc (Layout::include_section): Refactored check for debug
14351         info section.
14352         (Layout::add_comdat): Add new parameters.  Change type
14353         of signature parameter.  Add object and shndx to signatures table.
14354         (Layout::find_kept_object): New function.
14355         * layout.h: Include <cstring>.
14356         (Layout::is_debug_info_section): New function.
14357         (Layout::add_comdat): Add new parameters.
14358         (Layout::find_kept_object): New function.
14359         (Layout::Kept_section): New struct.
14360         (Layout::Signatures): Change type of map range.
14361         * object.cc (Relobj::output_section_address): New function.
14362         (Sized_relobj::include_section_group): Add new parameters.  Change
14363         calls to Layout::add_comdat.  Change to build table of kept comdat
14364         groups and table mapping discarded sections to kept sections.
14365         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14366         (Sized_relobj::do_layout): Change calls to include_section_group and
14367         include_linkonce_section.
14368         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14369         value to zero when section is discarded.
14370         (Sized_relobj::map_to_kept_section): New function.
14371         * object.h (Relobj::output_section_address): New function.
14372         (Relobj::Comdat_group): New type.
14373         (Relobj::find_comdat_group): New function.
14374         (Relobj::Comdat_group_table): New type.
14375         (Relobj::Kept_comdat_section): New type.
14376         (Relobj::Kept_comdat_section_table): New type.
14377         (Relobj::add_comdat_group): New function.
14378         (Relobj::set_kept_comdat_section): New function.
14379         (Relobj::get_kept_comdat_section): New function.
14380         (Relobj::comdat_groups_): New field.
14381         (Relobj::kept_comdat_sections_): New field.
14382         (Symbol_value::input_value): Update comment.
14383         (Sized_relobj::map_to_kept_section) New function.
14384         (Sized_relobj::include_linkonce_section): Add new parameter.
14385         * target-reloc.h (Comdat_behavior): New type.
14386         (get_comdat_behavior): New function.
14387         (relocate_section): Add code to map a discarded section to the
14388         corresponding kept section when applying a relocation.
14389
14390 2008-04-30  Craig Silverstein  <csilvers@google.com>
14391
14392         * dwarf_reader.cc (next_generation_count): New static var.
14393         (Addr2line_cache_entry): New struct.
14394         (addr2line_cache): New static var.
14395         (Dwarf_line_info::one_addr2line): Added caching.
14396         (Dwarf_line_info::clear_addr2line_cache): New function.
14397         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14398         cache-size parameter.
14399         (Dwarf_line_info::one_addr2line_cache): New function.
14400         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14401         new cache-size argument to one_addr2line(), and clear cache.
14402
14403 2008-04-28  Cary Coutant  <ccoutant@google.com>
14404
14405         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14406         R_386_PC8 relocations.
14407
14408 2008-04-23  Ian Lance Taylor  <iant@google.com>
14409
14410         * object.cc (Sized_relobj::include_section_group): Check for
14411         invalid section group.
14412
14413         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14414         header size.
14415
14416         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14417         than read for file header.
14418         * archive.cc (Archive::include_member): Likewise.
14419
14420 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14421
14422         * aclocal.m4: Regenerate.
14423         * configure: Regenerate.
14424
14425 2008-04-19  Ian Lance Taylor  <iant@google.com>
14426
14427         * version.cc (version_string): Bump to 1.6.
14428
14429         * testsuite/Makefile.am (many_sections_r_test): New target.
14430         (many_sections_r_test_SOURCES): Remove.
14431         (many_sections_r_test_DEPENDENCIES): Remove.
14432         (many_sections_r_test_LDFLAGS): Remove.
14433         (many_sections_r_test_LDADD): Remove.
14434
14435         * object.cc (Sized_relobj::do_add_symbols): Always pass
14436         local_symbol_count_ to add_from_relobj.
14437
14438         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14439         every thousand variables.
14440         * testsuite/Makefile.in: Rebuild.
14441
14442         * object.cc (Xindex::initialize_symtab_xindex): New function.
14443         (Xindex::read_symtab_xindex): New function.
14444         (Xindex::sym_xindex_to_shndx): New function.
14445         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14446         available.
14447         (Sized_relobj::do_initialize_xindex): New function.
14448         (Sized_relobj::do_read_symbols): Adjust section links.
14449         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14450         parameter.  Change all callers.
14451         (Sized_relobj::include_section_group): Adjust section links and
14452         symbol section indexes.
14453         (Sized_relobj::do_layout): Adjust section links.
14454         (Sized_relobj::do_count_local_symbols): Adjust section links and
14455         symbol section indexes.
14456         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14457         ordinary and special symbols.
14458         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14459         dynsym_xindex parameters.  Change all callers.  Adjust section
14460         links.  Use SHN_XINDEX when needed.
14461         (Sized_relobj::get_symbol_location_info): Adjust section links.
14462         Don't get fooled by special symbols.
14463         * object.h (class Xindex): Define.
14464         (class Object): Add xindex_ parameter.  Declare virtual functoin
14465         do_initialize_xindex.
14466         (Object::adjust_sym_shndx): New function.
14467         (Object::set_xindex): New protected function.
14468         (class Symbol_value): Add is_ordinary_shndx_ field.
14469         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14470         (Symbol_value::value): Assert ordinary section.
14471         (Symbol_value::initialize_input_to_output_map): Likewise.
14472         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14473         Change all callers.
14474         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14475         all callers.
14476         (class Sized_relobj): Update declarations.
14477         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14478         parameter.  Change all callers.
14479         (Sized_relobj::adjust_shndx): New function.
14480         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14481         field.
14482         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14483         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14484         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14485         (Sized_dynobj::read_dynsym_section): Adjust section links.
14486         (Sized_dynobj::read_dynamic): Likewise.
14487         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14488         section links.
14489         (Sized_dynobj::do_initialize_xindex): New function.
14490         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14491         do_initialize_xindex.
14492         (Sized_dynobj::adjust_shndx): New function.
14493         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14494         dynsym_xindex_ fields.
14495         (Layout::finalize): Add a call to set_section_indexes before
14496         creating the symtab sections.
14497         (Layout::set_section_indexes): Don't do anything if the section
14498         already has a section index.
14499         (Layout::create_symtab_sections): Add shnum parameter.  Change
14500         caller.  Create .symtab_shndx section if needed.
14501         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14502         caller.
14503         (Layout::allocated_output_section_count): New function.
14504         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14505         needed.
14506         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14507         fields.  Update declarations.
14508         (Layout::symtab_xindex): New function.
14509         (Layout::dynsym_xindex): New function.
14510         (class Write_symbols_task): Add layout_ field.
14511         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14512         Change caller.
14513         * output.cc (Output_section_headers::Output_section_headers): Add
14514         shstrtab_section parameter.  Change all callers.
14515         (Output_section_headers::do_sized_write): Store overflow values
14516         for section count and section string table section index in
14517         section header zero.
14518         (Output_file_header::do_sized_write): Check for overflow of
14519         section count and section string table section index.
14520         (Output_symtab_xindex::do_write): New function.
14521         (Output_symtab_xindex::endian_do_write): New function.
14522         * output.h (class Output_section_headers): Add shstrtab_section_.
14523         Update declarations.
14524         (class Output_symtab_xindex): Define.
14525         (Output_section::has_out_shndx): New function.
14526         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14527         field.
14528         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14529         Change all callers.
14530         (Sized_symbol::init): Likewise.
14531         (Symbol::output_section): Check for ordinary symbol.
14532         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14533         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14534         callers.
14535         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14536         Change all callers.  Simplify handling of symbols from sections
14537         not included in the link.
14538         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14539         distinction.
14540         (Weak_alias_sorter::operator()): Assert that symbols are
14541         ordinary.
14542         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14543         distinction.
14544         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14545         parameters.  Change all callers.
14546         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14547         symbol distinction.  Use SHN_XINDEX when needed.
14548         (Symbol_table::write_section_symbol): Add symtab_xindex
14549         parameter.  Change all callers.
14550         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14551         SHN_XINDEX when needed.
14552         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14553         declarations.
14554         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14555         (Symbol::is_defined): Check is_ordinary.
14556         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14557         (Symbol::is_absolute, Symbol::is_common): Likewise.
14558         (class Sized_symbol): Update declarations.
14559         (class Symbol_table): Update declarations.
14560         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14561         parameters.  Change all callers.
14562         (Sized_symbol::override): Likewise.
14563         (Symbol_table::override): Likewise.
14564         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14565         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14566         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14567         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14568         to be in an ordinary section.
14569         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14570         object and is_ordinary parameters.  Change all callers.
14571         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14572         Change all callers.  Don't add undefined or non-ordinary symbols
14573         to reloc_map_.
14574         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14575         Change all callers.
14576         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14577         declarations.
14578         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14579         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14580         (Sized_relobj::relocate_sections): Likewise.
14581         * target-reloc.h (scan_relocs): Adjust section symbol index.
14582         (scan_relocatable_relocs): Likewise.
14583         * i386.cc (Scan::local): Check for ordinary symbols.
14584         * sparc.cc (Scan::local): Likewise.
14585         * x86_64.cc (Scan::local): Likewise.
14586         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14587         to symbol_section_and_value.
14588         * testsuite/many_sections_test.cc: New file.
14589         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14590         (check_PROGRAMS): Add many_sections_test.
14591         (many_sections_test_SOURCES): Define.
14592         (many_sections_test_DEPENDENCIES): Define.
14593         (many_sections_test_LDFLAGS): Define.
14594         (BUILT_SOURCES): Add many_sections_define.h.
14595         (many_sections_define.h): New target.
14596         (BUILT_SOURCES): Add many_sections_check.h.
14597         (many_sections_check.h): New target.
14598         (check_PROGRAMS): Add many_sections_r_test.
14599         (many_sections_r_test_SOURCES): Define.
14600         (many_sections_r_test_DEPENDENCIES): Define.
14601         (many_sections_r_test_LDFLAGS): Define.
14602         (many_sections_r_test_LDADD): Define.
14603         (many_sections_r_test.o): New target.
14604         * testsuite/Makefile.in: Rebuild.
14605
14606 2008-04-17  Cary Coutant  <ccoutant@google.com>
14607
14608         * errors.cc (Errors::info): New function.
14609         (gold_info): New function.
14610         * errors.h (Errors::info): New function.
14611         * gold.h (gold_info): New function.
14612         * object.cc (Input_objects::add_object): Print trace output.
14613         * options.cc (options::parse_set): New function.
14614         (General_options::parse_wrap): Deleted.
14615         (General_options::General_options): Deleted initializer.
14616         * options.h (options::String_set): New typedef.
14617         (options::parse_set): New function.
14618         (DEFINE_set): New macro.
14619         (General_options::wrap): Changed to use DEFINE_set. Changed
14620         callers of any_wrap_symbols and is_wrap_symbol.
14621         (General_options::trace, General_options::trace_symbol):
14622         New options.
14623         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14624         (General_options::wrap_symbols_): Deleted.
14625         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14626
14627 2008-04-17  David S. Miller  <davem@davemloft.net>
14628
14629         * options.cc (General_options::parse_V): New function.
14630         * options.h: Add entries for -V and -Qy.
14631
14632 2008-04-17  Ian Lance Taylor  <iant@google.com>
14633
14634         * common.cc (Symbol_table::allocate_commons): Remove options
14635         parameter.  Change caller.
14636         (Symbol_table::do_allocate_commons): Remove options parameter.
14637         Change caller.  Just call do_allocate_commons_list twice.
14638         (Symbol_table::do_allocate_commons_list): New function, broken out
14639         of do_allocate_commons.
14640         * common.h (class Allocate_commons_task): Remove options_ field.
14641         Update constructor.
14642         * symtab.cc (Symbol_table::Symbol_table): Initialize
14643         tls_commons_.
14644         (Symbol_table::add_from_object): Put TLS common symbols on
14645         tls_commons_ list.
14646         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14647         which are IN_OUTPUT_DATA.
14648         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14649         allocate_commons and do_allocate_commons declarations.  Declare
14650         do_allocate_commons_list.
14651         * gold.cc (queue_middle_tasks): Update creation of
14652         Allocate_commons_task to not pass options.
14653         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14654         (TLS_TEST_C_FLAGS): New variable.
14655         (tls_test_c_pic.o): New target.
14656         (tls_test_shared.so): Link in tls_test_c_pic.o.
14657         (tls_test_c_pic_ie.o): New target.
14658         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14659         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14660         (tls_test_c.o): New target.
14661         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14662         (tls_pic_test_LDADD): Likewise.
14663         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14664         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14665         (tls_test_c_gnu2.o): New target.
14666         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14667         tls_test_c_gnu2.o.
14668         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14669         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14670         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14671         * testsuite/tls_test.cc: Include "config.h".
14672         (t_last): Call t11_last.
14673         * testsuite/tls_test.h (t11, t11_last): Declare.
14674         * testsuite/tls_test_c.c: New file.
14675         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14676         * configure.ac: Check for OpenMP support.
14677         * configure, config.in, Makefile.in: Rebuild.
14678         * testsuite/Makefile.in: Rebuild.
14679
14680 2008-04-16  Cary Coutant  <ccoutant@google.com>
14681
14682         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14683         (Target_i386::tls_base_symbol_defined_): New field.
14684         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14685         (Target_i386::Scan::global): Likewise.
14686         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14687         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14688         (Target_x86_64::tls_base_symbol_defined_): New field.
14689         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14690         (Target_x86_64::Scan::global): Likewise.
14691
14692 2008-04-16  Cary Coutant  <ccoutant@google.com>
14693
14694         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14695         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14696         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14697         building shared libraries.
14698         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14699         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14700         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14701         * testsuite/Makefile.in: Rebuild.
14702         * testsuite/weak_undef.h: New file.
14703         * testsuite/weak_undef_file1.cc: Add extra test cases.
14704         * testsuite/weak_undef_file2.cc: Likewise.
14705         * testsuite/weak_undef_test.cc: Likewise.
14706
14707 2008-04-16  David S. Miller  <davem@davemloft.net>
14708
14709         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14710         Add issued_non_pic_error_ field.  Declare check_non_pic.
14711         (Target_sparc::Scan::check_non_pic): New function.
14712         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14713         (Target_sparc::Scan::global): Likewise.
14714
14715         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14716         * configure: Rebuild.
14717
14718         * options.h (DEFINE_enable): New macro.
14719         (new_dtags): New enable option.
14720         (initfirst, interpose, loadfltr, nodefaultlib,
14721         nodelete, nodlopen, nodump): New -z options.
14722         * layout.cc (Layout:finish_dynamic_section): If new
14723         dtags enabled, emit DT_RUNPATH.  Also, emit a
14724         DT_FLAGS_1 containing any specified -z flags.
14725
14726 2008-04-16  Ian Lance Taylor  <iant@google.com>
14727
14728         * copy-relocs.cc: New file.
14729         * copy-relocs.h: New file.
14730         * reloc.cc: Remove Copy_relocs code.
14731         * reloc.h: Likewise.
14732         * reloc-types.h (struct Reloc_types) [both versions]: Add
14733         get_reloc_addend_noerror.
14734         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14735         variants of add_global which take an addend which must be zero.
14736         * i386.cc: Include "copy-relocs.h".
14737         (class Target_i386): Change type of copy_relocs_ to variable,
14738         update initializer.
14739         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14740         Change all callers.
14741         (Target_i386::do_finalize_sections): Change handling of
14742         copy_relocs_.
14743         * sparc.cc: Include "copy-relocs.h".
14744         (class Target_sparc): Change type of copy_relocs_ to variable,
14745         update initializer.
14746         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14747         Change all callers.
14748         (Target_sparc::do_finalize_sections): Change handling of
14749         copy_relocs_.
14750         * x86_64.cc: Include "copy-relocs.h".
14751         (class Target_x86_64): Change type of copy_relocs_ to variable,
14752         update initializer.
14753         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14754         class.  Change all callers.
14755         (Target_x86_64::do_finalize_sections): Change handling of
14756         copy_relocs_.
14757         * Makefile.am (CCFILES): Add copy-relocs.cc.
14758         (HFILES): Add copy-relocs.h.
14759
14760         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14761
14762         * testsuite/script_test_4.sh: Permit leading zeroes.
14763
14764 2008-04-15  Ian Lance Taylor  <iant@google.com>
14765
14766         * script-sections.cc (Script_sections::create_segments): Use
14767         header_size_adjustment even when there is enough room for the
14768         headers.
14769         * testsuite/script_test_4.sh: New file.
14770         * testsuite/script_test_4.t: New file.
14771         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14772         (check_DATA): Add script_test_4.stdout.
14773         (MOSTLYCLEANFILES): Likewise.
14774         (script_test_4): New target.
14775         (script_test_4.stdout): New target.
14776         * testsuite/Makefile.in: Rebuild.
14777
14778         * sparc.cc: Add definitions for Output_data_plt_sparc class
14779         constants.
14780
14781 2008-04-14  David S. Miller  <davem@davemloft.net>
14782
14783         * sparc.cc: New file.
14784         * Makefile.am (TARGETSOURCES): Add sparc.cc
14785         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14786         * configure.tgt: Document targ_extra_size and
14787         targ_extra_big_endian.  Add entries for sparc-* and
14788         sparc64-*.
14789         * configure.ac: Handle targ_extra_size and
14790         targ_extra_big_endian.
14791         * Makefile.in: Rebuild.
14792         * configure: Likewise.
14793         * po/POTFILES.in: Likewise.
14794         * po/gold.pot: Likewise.
14795
14796 2008-04-14  Ian Lance Taylor  <iant@google.com>
14797
14798         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14799         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14800         in the name/type/flags to section mapping.  Don't call
14801         allocate_output_section.
14802         (Layout::choose_output_section): Change parameter from adjust_name
14803         to is_input_section.  Don't permit input sections after sections
14804         are attached to segments.  Don't call allocate_output_section.
14805         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14806         not write_enable_output_section.
14807         (Layout::make_output_section): Don't push to
14808         unattached_section_list_ nor call attach_to_segment.  Call
14809         attach_section_to_segment if sections are attached.
14810         (Layout::attach_sections_to_segments): New function.
14811         (Layout::attach_section_to_segment): New function.
14812         (Layout::attach_allocated_section_to_segment): Rename from
14813         attach_to_segment.  Remove flags parameter.
14814         (Layout::allocate_output_section): Remove function.
14815         (Layout::write_enable_output_section): Remove function.
14816         * layout.h (class Layout): Update for above changes.  Add new
14817         field sections_are_attached_.
14818         * output.h (Output_section::update_flags_for_input_section): New
14819         function.
14820         * output.cc (Output_section::add_input_section): Call
14821         update_flags_for_input_section.
14822         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14823
14824 2008-04-11  Cary Coutant  <ccoutant@google.com>
14825
14826         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14827         thought unnecessary.
14828         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14829
14830 2008-04-11  Ian Lance Taylor  <iant@google.com>
14831
14832         * output.h (class Output_section_data): Remove inline definition
14833         of set_addralign.
14834         * output.cc (Output_section_data::set_addralign): New function.
14835
14836 2008-04-11  Cary Coutant  <ccoutant@google.com>
14837
14838         Add support for TLS descriptors for i386 and x86_64.
14839         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14840         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14841         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14842         GOT_TYPE_TLS_DESC.
14843         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14844         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14845         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14846         relocations.
14847         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14848         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14849         Fix problem with initial-exec relocations.
14850         (Target_i386::Relocate::relocate_tls): Likewise.
14851         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14852         relaxation.
14853         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14854         support for section-plus-offset dynamic table entries.
14855         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14856         (Output_data_dynamic::Dynamic_entry): Add support for
14857         section-plus-offset dynamic table entries.
14858         (Output_data_dynamic::Classification): Likewise.
14859         (Output_data_dynamic::classification_): Renamed offset_.
14860         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14861         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14862         (Target_x86_64::make_plt_section): New function.
14863         (Target_x86_64::reserve_tlsdesc_entries): New function.
14864         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14865         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14866         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14867         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14868         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14869         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14870         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14871         add extra PLT entry for TLS descriptors.
14872         (Output_data_plt_x86_64::got_): New field.
14873         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14874         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14875         fields.
14876         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14877         descriptors.
14878         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14879         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14880         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14881         R_386_TLS_DESC_CALL relocations.
14882         (Target_x86_64::Scan::global): Likewise.
14883         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14884         for TLS descriptors.
14885         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14886         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14887         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14888         GD-to-IE relaxation.
14889         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14890         and TLS_DESCRIPTORS.
14891         * Makefile.in: Rebuild.
14892         * configure: Rebuild.
14893         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14894         (tls_test_shared2.so): New target.
14895         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14896         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14897         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14898         (tls_shared_gd_to_ie_test_LDADD): New variable.
14899         (tls_shared_gnu2_gd_to_ie_test): New target.
14900         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14901         New targets.
14902         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14903         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14904         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14905         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14906         (tls_shared_gnu2_test): New target.
14907         (tls_test_gnu2_shared.so): New target.
14908         (tls_shared_gnu2_test_SOURCES): New variable.
14909         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14910         (tls_shared_gnu2_test_LDFLAGS): New variable.
14911         (tls_shared_gnu2_test_LDADD): New variable.
14912         * testsuite/Makefile.in: Rebuild.
14913         * testsuite/Makefile.
14914
14915 2008-04-11  Ian Lance Taylor  <iant@google.com>
14916
14917         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14918         justsyms.t.
14919         * testsuite/Makefile.in: Rebuild.
14920
14921         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14922         long.
14923         * testsuite/script_test_2.cc (main): Adjust test.
14924
14925 2008-04-11  David S. Miller  <davem@davemloft.net>
14926             Ian Lance Taylor  <iant@google.com>
14927
14928         * options.h (General_options): Add entries for '-Y' and
14929         '-relax'.
14930         * options.cc (General_options:finalize): If -Y was used, add those
14931         entries to the library path instead of the default "/lib" and
14932         "/usr/lib".
14933
14934 2008-04-11  David S. Miller  <davem@davemloft.net>
14935
14936         * testsuite/justsyms.t: Start at 0x100.
14937         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14938         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14939         long.
14940         * testsuite/script_test_2.cc: Adjust string and section length
14941         checks.
14942
14943 2008-04-09  Ian Lance Taylor  <iant@google.com>
14944
14945         PR gold/5996
14946         * script-sections.cc (Sections_element::allocate_to_segment): Add
14947         orphan parameter.
14948         (Output_section_definition::allocate_to_segment): Likewise.
14949         (Orphan_output_section::allocate_to_segment): Likewise.
14950         (Script_sections::attach_sections_using_phdrs_clause): Don't
14951         propagate non-PT_LOAD segments to orphan sections.
14952         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14953         readelf rather than objdump.
14954         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14955         .interp section and PT_INTERP segment are the same size.
14956         * testsuite/Makefile.in: Rebuild.
14957
14958         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14959         aliases for symbols defined in the same object.
14960         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14961         (weak_alias_test_SOURCES): New variable.
14962         (weak_alias_test_DEPENDENCIES): New variable.
14963         (weak_alias_test_LDFLAGS): New variable.
14964         (weak_alias_test_LDADD): New variable.
14965         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14966         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14967         (weak_alias_test_3.o): New target.
14968         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14969         * testsuite/weak_alias_test_main.cc: New file.
14970         * testsuite/weak_alias_test_1.cc: New file.
14971         * testsuite/weak_alias_test_2.cc: New file.
14972         * testsuite/weak_alias_test_3.cc: New file.
14973
14974 2008-04-08  Ian Lance Taylor  <iant@google.com>
14975
14976         * options.h (class General_options): Add --noinhibit-exec option.
14977         * main.cc (main): Check --noinhibit-exec.
14978
14979         * options.h (class General_options): Define --wrap as a special
14980         option.  Add wrap_symbols_ field.
14981         (General_options::any_wrap_symbols): New function.
14982         (General_options::is_wrap_symbol): New function.
14983         * options.cc (General_options::parse_wrap): New function.
14984         (General_options::General_options): Initialize wrap_symbols_.
14985         * symtab.cc (Symbol_table::wrap_symbol): New function.
14986         (Symbol_table::add_from_object): Handle --wrap.
14987         * symtab.h (class Symbol_table): Declare wrap_symbol.
14988         * target.h (Target::wrap_char): New function.
14989         (Target::Target_info): Add wrap_char field.
14990         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
14991         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
14992         * testsuite/testfile.cc (Target_test::test_target_info):
14993         Likewise.
14994
14995         * errors.cc (Errors::undefined_symbol): Mention symbol version if
14996         there is one.
14997
14998         * layout.h (class Layout): Add added_eh_frame_data_ field.
14999         * layout.cc (Layout::Layout): Initialize new field.
15000         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15001         output section until we find a section we merged successfully.
15002         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15003         that the size be non-zero.
15004
15005         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15006         qualifier.
15007
15008 2008-04-08  Craig Silverstein  <csilvers@google.com>
15009
15010         * configure.ac: Export new conditional variable HAVE_ZLIB.
15011         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15012         on HAVE_ZLIB.
15013         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15014         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15015
15016 2008-04-07  Ian Lance Taylor  <iant@google.com>
15017
15018         * version.cc (version_string): Set to "1.5".
15019
15020         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15021         Add issued_non_pic_error_ field.  Declare check_non_pic.
15022         (Target_x86_64::Scan::check_non_pic): New function.
15023         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15024         (Target_x86_64::Scan::global): Likewise.
15025
15026         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15027         addend parameter.  Change caller.  Handle merge sections.
15028         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15029         Address to Addend.  Don't add in the result of
15030         local_section_offset, pass down the addend and use the returned
15031         value.
15032         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15033         Update declarations of local_section_offset and symbol_value.
15034         * testsuite/two_file_test_1.cc (t18): New function.
15035         * testsuite/two_file_test_2.cc (f18): New function.
15036         * testsuite/two_file_test_main.cc (main): Call t18.
15037         * testsuite/two_file_test.h (t18, f18): Declare.
15038
15039         * configure.ac: Don't test for objdump, c++filt, or readelf.
15040         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15041         conditionals.
15042         (TEST_READELF): New variable.
15043         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15044         (check_PROGRAMS): Add two_file_strip_test.
15045         (two_file_strip_test): New target.
15046         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15047         (two_file_same_shared_strip_test_SOURCES): New variable.
15048         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15049         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15050         (two_file_same_shared_strip_test_LDADD): New variable.
15051         (two_file_shared_strip.so): New target.
15052         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15053         (ver_test_5.syms, ver_test_7.syms): Likewise.
15054         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15055         (strip_test_3.stdout): Use TEST_OBJDUMP.
15056         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15057
15058 2008-04-04  Cary Coutant  <ccoutant@google.com>
15059
15060         * symtab.h (Symbol::is_weak_undefined): New function.
15061         (Symbol::is_strong_undefined): New function.
15062         (Symbol::is_absolute): New function.
15063         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15064         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15065         absolute symbols.
15066         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15067         (weak_undef_test): New target.
15068         * testsuite/Makefile.in: Rebuild.
15069         * testsuite/weak_undef_file1.cc: New file.
15070         * testsuite/weak_undef_file2.cc: New file.
15071         * testsuite/weak_undef_test.cc: New file.
15072
15073 2008-04-03  Craig Silverstein  <csilvers@google.com>
15074
15075         * compressed_output.h (class Output_compressed_section): Use
15076         unsigned buffer.
15077         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15078         add zlib header.
15079         (zlib_compressed_suffix): Removed.
15080         (Output_compressed_section::set_final_data_size): Use unsigned
15081         buffers.
15082         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15083         Fix linker invocation.
15084         (flagstest_o_specialfile_and_compress_debug_sections):
15085         Likewise.
15086         * testsuite/Makefile.in: Regenerated.
15087
15088 2008-04-02  David S. Miller  <davem@davemloft.net>
15089
15090         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15091         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15092
15093 2008-04-02  Craig Silverstein  <csilvers@google.com>
15094
15095         * TODO: New file.
15096
15097 2008-04-02  Ian Lance Taylor  <iant@google.com>
15098
15099         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15100         parameters.  Update for new key type to views_.  Change all
15101         callers.
15102         (File_read::read): Adjust for byteshift in returned view.
15103         (File_read::add_view): New function, broken out of
15104         find_and_make_view.
15105         (File_read::make_view): New function, broken out of
15106         find_and_make_view.
15107         (File_read::find_or_make_view): Add offset and aligned
15108         parameters.  Rewrite accordingly.  Change all callers.
15109         (File_read::get_view): Add offset and aligned parameters.  Adjust
15110         for byteshift in return value.
15111         (File_read::get_lasting_view): Likewise.
15112         * fileread.h (class File_read): Update declarations.
15113         (class File_read::View): Add byteshift_ field.  Add byteshift to
15114         constructor.  Add byteshift method.
15115         * archive.h (Archive::clear_uncached_views): New function.
15116         (Archive::get_view): Add aligned parameter.  Change all callers.
15117         * object.h (Object::get_view): Add aligned parameter.  Change all
15118         callers.
15119         (Object::get_lasting_view): Likewise.
15120
15121         * fileread.cc (File_read::release): Don't call clear_views if
15122         there are multiple objects.
15123         * fileread.h (File_read::clear_uncached_views): New function.
15124         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15125         on the archive.
15126
15127 2008-03-31  Cary Coutant  <ccoutant@google.com>
15128
15129         Add thin archive support.
15130         * archive.cc (Archive::armagt): New const.
15131         (Archive::setup): Remove task parameter and calls to unlock.
15132         (Archive::unlock_nested_archives): New function.
15133         (Archive::read_header): Add nested_off parameter. Change
15134         all callers.
15135         (Archive::interpret_header): Likewise.
15136         (Archive::include_all_members): Change to handle thin
15137         archives.
15138         (Archive::include_member): Likewise.
15139         * archive.h (Archive::Archive): Add new parameters and
15140         initializers.
15141         (Archive::armagt): New const.
15142         (Archive::setup): Remove task parameter.
15143         (Archive::unlock_nested_archives): New function.
15144         (Archive::read_header): Add nested_off parameter.
15145         (Archive::interpret_header): Likewise.
15146         (Archive::Nested_archive_table): New typedef.
15147         (Archive::is_thin_archive_): New field.
15148         (Archive::nested_archives_): New field.
15149         (Archive::options_): New field.
15150         (Archive::dirpath_): New field.
15151         (Archive::task_): New field.
15152         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15153         for thin archives.  Pass additional parameters to
15154         Archive::Archive.  Unlock the archive file after calling
15155         Archive::setup.
15156
15157 2008-03-29  Ian Lance Taylor  <iant@google.com>
15158
15159         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15160         version symbol to be local.
15161         * testsuite/ver_test_4.sh: New file.
15162         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15163         (check_DATA): Add ver_test_4.syms.
15164         (ver_test_4.syms): New target.
15165         * testsuite/Makefile.in: Rebuild.
15166
15167         * output.cc
15168         (Output_section::Input_section_sort_entry::has_priority): New
15169         function.
15170         (Output_section::Input_section_sort_entry::match_file_name): New
15171         function.
15172         (Output_section::Input_section_sort_entry::match_section_name):
15173         Remove.
15174         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15175         Remove.
15176         (Output_section::Input_section_sort_entry::match_section_file):
15177         Remove.
15178         (Output_section::Input_section_sort_compare::operator()): Rewrite
15179         using new Input_section_sort_entry functions.  Sort crtbegin and
15180         crtend first.  Sort sections with no priority before sections with
15181         a priority.
15182         * testsuite/initpri1.c (d3): Check j != 4.
15183         (cd5): New constructor/destructor function.
15184         (main): Check j != 2.
15185
15186         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15187         new symbol when resolving, don't call set_is_default.
15188         * testsuite/ver_test_7.cc: New file.
15189         * testsuite/ver_test_7.sh: New file.
15190         * testsuite/Makefile.am (ver_test_7.so): New target.
15191         (ver_test_7.o): New target.
15192         (check_SCRIPTS): Add ver_test_7.sh.
15193         (check_DATA): Add ver_test_7.syms.
15194         (ver_test_7.syms): New target.
15195
15196 2008-03-28  Ian Lance Taylor  <iant@google.com>
15197
15198         * layout.cc (Layout::layout): If we see an input section with a
15199         name that needs sorting, set the must_sort flag for the output
15200         section.
15201         (Layout::make_output_section): If the name of the output section
15202         indicates that it might require sorting, set the may_sort flag.
15203         * output.h (Output_section::may_sort_attached_input_sections): New
15204         function.
15205         (Output_section::set_may_sort_attached_input_sections): New
15206         function.
15207         (Output_section::must_sort_attached_input_sections): New
15208         function.
15209         (Output_section::set_must_sort_attached_input_sections): New
15210         function.
15211         (class Output_section): Declare Input_section_sort_entry.  Define
15212         Input_section_sort_compare.  Declare
15213         sort_attached_input_sections.  Add new fields:
15214         may_sort_attached_input_sections_,
15215         must_sort_attached_input_sections_,
15216         attached_input_sections_are_sorted_.
15217         * output.cc (Output_section::Output_section): Initialize new
15218         fields.
15219         (Output_section::add_input_section): Add an entry to
15220         input_sections_ if may_sort or must_sort are true.
15221         (Output_section::set_final_data_size): Call
15222         sort_attached_input_sections if necessary.
15223         (Output_section::Input_section_sort_entry): Define new class.
15224         (Output_section::Input_section_sort_compare::operator()): New
15225         function.
15226         (Output_section::sort_attached_input_sections): New function.
15227         * configure.ac: Check whether the compiler supports constructor
15228         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15229         * testsuite/initpri1.c: New file.
15230         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15231         CONSTRUCTOR_PRIORITY.
15232         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15233         (initpri1_LDFLAGS): New variable.
15234         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15235
15236 2008-03-27  Ian Lance Taylor  <iant@google.com>
15237
15238         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15239         * testsuite/common_test_1.c: New file.
15240         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15241         (common_test_1_SOURCES): New variable.
15242         (common_test_1_DEPENDENCIES): New variable.
15243         (common_test_1_LDFLAGS): New variable.
15244
15245         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15246         and commons_ correctly when NAME/VERSION does not override
15247         NAME/NULL.
15248         * testsuite/ver_test_6.c: New file.
15249         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15250         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15251         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15252
15253 2008-03-26  Ian Lance Taylor  <iant@google.com>
15254
15255         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15256         of an undefined symbol from a version script.
15257         * testsuite/Makefile.am (ver_test_5.so): New target.
15258         (ver_test_5.o): New target.
15259         (check_SCRIPTS): Add ver_test_5.sh.
15260         (check_DATA): Add ver_test_5.syms.
15261         (ver_test_5.syms): New target.
15262         * testsuite/ver_test_5.cc: New file.
15263         * testsuite/ver_test_5.script: New file.
15264         * testsuite/ver_test_5.sh: New file.
15265         * Makefile.in, testsuite/Makefile.in: Rebuild.
15266
15267         PR gold/5986
15268         Fix problems building gold with gcc 4.3.0.
15269         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15270         (gold_error_at_location, gold_warning_at_location): Use it.
15271         * configure.ac: Check whether we can compile and use a template
15272         function with a printf attribute.
15273         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15274         when jumping over bytes.
15275         * object.cc: Instantiate Object::read_section_data.
15276         * debug.h: Include <cstring>
15277         * dwarf_reader.cc: Include <algorithm>
15278         * main.cc: Include <cstring>.
15279         * options.cc: Include <cstring>.
15280         * output.cc: Include <cstring>.
15281         * script.cc: Include <cstring>.
15282         * script.h: Include <string>.
15283         * symtab.cc: Include <cstring> and <algorithm>.
15284         * target-select.cc: Include <cstring>.
15285         * version.cc: Include <string>.
15286         * testsuite/testmain.cc: Include <cstdlib>.
15287         * configure, config.in: Rebuild.
15288
15289 2008-03-25  Ian Lance Taylor  <iant@google.com>
15290
15291         * options.cc: Include "../bfd/bfdver.h".
15292         (options::help): Print bug reporting address.
15293
15294         * version.cc (print_version): Adjust output for current value of
15295         BFD_VERSION_STRING.
15296
15297         * NEWS: New file.
15298
15299         * options.cc (options::help): Print list of supported targets.
15300         * target-select.h: Include <vector>.
15301         (class Target_selector): Make machine_, size_, and is_big_endian_
15302         fields const.  Add bfd_name_ and instantiated_target_ fields.
15303         (Target_selector::Target_selector): Add bfd_name parameter.
15304         (Target_selector::recognize): Make non-virtual, call
15305         do_recognize.
15306         (Target_selector::recognize_by_name): Make non-virtual, call
15307         do_recognize_by_name.
15308         (Target_selector::supported_names): New function.
15309         (Target_selector::bfd_name): New function.
15310         (Target_selector::do_instantiate_target): New pure virtual
15311         function.
15312         (Target_selector::do_recognize): New virtual function.
15313         (Target_selector::do_recognize_by_name): New virtual function.
15314         (Target_selector::instantiate_target): New private function.
15315         (supported_target_names): Declare.
15316         * target-select.cc (Target_selector::Target_selector): Update for
15317         new parameter and fields.
15318         (select_target_by_name): Check that the name matches before
15319         calling recognize_by_name.
15320         (supported_target_names): New function.
15321         * i386.cc (class Target_selector_i386): Update Target_selector
15322         constructor call.  Remove recognize and recognize_by_name.  Add
15323         do_instantiate_target.
15324         * x86_64.cc (class Target_selector_x86_64): Likewise.
15325         * testsuite/testfile.cc (class Target_selector_test): Update for
15326         changes to Target_selector.
15327
15328         * README: Rewrite, with some notes on unsupported features.
15329
15330 2008-03-24  Cary Coutant  <ccoutant@google.com>
15331
15332         * i386.cc (Target_i386::Got_type): New enum declaration.
15333         (Target_i386::Scan::local): Updated callers of Output_data_got
15334         member functions.
15335         (Target_i386::Scan::global): Likewise.
15336         (Target_i386::Relocate::relocate): Likewise.
15337         (Target_i386::Relocate::relocate_tls): Likewise.
15338         * object.h (Got_offset_list): New class.
15339         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15340         (Sized_relobj::local_got_offset): Likewise.
15341         (Sized_relobj::set_local_got_offset): Likewise.
15342         (Sized_relobj::local_has_tls_got_offset): Removed.
15343         (Sized_relobj::local_tls_got_offset): Removed.
15344         (Sized_relobj::set_local_tls_got_offset): Removed.
15345         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15346         * output.cc (Output_data_got::add_global): Added got_type parameter.
15347         (Output_data_got::add_global_with_rel): Likewise.
15348         (Output_data_got::add_global_with_rela): Likewise.
15349         (Output_data_got::add_global_pair_with_rel): New function.
15350         (Output_data_got::add_global_pair_with_rela): New function.
15351         (Output_data_got::add_local): Added got_type parameter.
15352         (Output_data_got::add_local_with_rel): Likewise.
15353         (Output_data_got::add_local_with_rela): Likewise.
15354         (Output_data_got::add_local_pair_with_rel): New function.
15355         (Output_data_got::add_local_pair_with_rela): New function.
15356         (Output_data_got::add_global_tls): Removed.
15357         (Output_data_got::add_global_tls_with_rel): Removed.
15358         (Output_data_got::add_global_tls_with_rela): Removed.
15359         (Output_data_got::add_local_tls): Removed.
15360         (Output_data_got::add_local_tls_with_rel): Removed.
15361         (Output_data_got::add_local_tls_with_rela): Removed.
15362         * output.h (Output_data_got::add_global): Added got_type parameter.
15363         (Output_data_got::add_global_with_rel): Likewise.
15364         (Output_data_got::add_global_with_rela): Likewise.
15365         (Output_data_got::add_global_pair_with_rel): New function.
15366         (Output_data_got::add_global_pair_with_rela): New function.
15367         (Output_data_got::add_local): Added got_type parameter.
15368         (Output_data_got::add_local_with_rel): Likewise.
15369         (Output_data_got::add_local_with_rela): Likewise.
15370         (Output_data_got::add_local_pair_with_rel): New function.
15371         (Output_data_got::add_local_pair_with_rela): New function.
15372         (Output_data_got::add_global_tls): Removed.
15373         (Output_data_got::add_global_tls_with_rel): Removed.
15374         (Output_data_got::add_global_tls_with_rela): Removed.
15375         (Output_data_got::add_local_tls): Removed.
15376         (Output_data_got::add_local_tls_with_rel): Removed.
15377         (Output_data_got::add_local_tls_with_rela): Removed.
15378         * resolve.cc (Symbol::override_base_with_special): Removed
15379         reference to has_got_offset_ field.
15380         * symtab.cc (Symbol::init_fields): Replaced initialization
15381         of got_offset_ with got_offsets_.  Removed initialization
15382         of has_got_offset_
15383         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15384         (Symbol::got_offset): Likewise.
15385         (Symbol::set_got_offset): Likewise.
15386         (Symbol::has_tls_got_offset): Removed.
15387         (Symbol::tls_got_offset): Removed.
15388         (Symbol::set_tls_got_offset): Removed.
15389         (Symbol::got_offset_): Removed.
15390         (Symbol::tls_mod_got_offset_): Removed.
15391         (Symbol::tls_pair_got_offset_): Removed.
15392         (Symbol::got_offsets_): New field.
15393         (Symbol::has_got_offset): Removed.
15394         (Symbol::has_tls_mod_got_offset): Removed.
15395         (Symbol::has_tls_pair_got_offset): Removed.
15396         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15397         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15398         member functions.
15399         (Target_x86_64::Scan::global): Likewise.
15400         (Target_x86_64::Relocate::relocate): Likewise.
15401         (Target_x86_64::Relocate::relocate_tls): Likewise.
15402
15403 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15404
15405         * yyscript.y: Fix spelling error in comment.
15406
15407 2008-03-24  Ian Lance Taylor  <iant@google.com>
15408
15409         * options.h (class General_options): Define build_id option.
15410         * layout.h (class Layout): Declare write_build_id, create_note,
15411         create_build_id.  Add build_id_note_ member.
15412         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15413         "libiberty.h", "md5.h", "sha1.h".
15414         (Layout::Layout): Initialize eh_frame_data_,
15415         eh_frame_hdr_section_, and build_id_note_.
15416         (Layout::finalize): Call create_build_id.
15417         (Layout::create_note): New function, broken out of
15418         Layout::create_gold_note.
15419         (Layout::create_gold_note): Call create_note.
15420         (Layout::create_build_id): New function.
15421         (Layout::write_build_id): New function.
15422         (Close_task_runner::run): Call write_build_id.
15423
15424         * x86_64.cc: Correct license to GPLv3.
15425
15426 2008-03-23  Ian Lance Taylor  <iant@google.com>
15427
15428         * options.cc: Include "demangle.h".
15429         (parse_optional_string): New function.
15430         (parse_long_option): Handle takes_optional_argument.
15431         (parse_short_option): Update dash_z initializer.  Handle
15432         takes_optional_argument.
15433         (General_options::General_options): Initialize do_demangle_.
15434         (General_options::finalize): Set do_demangle_.  Handle demangling
15435         style.
15436         * options.h (parse_optional_string): Declare.
15437         (struct One_option): Add optional_arg field.  Update constructor.
15438         Update call constructor calls.  Add takes_optional_argument
15439         function.
15440         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15441         (DEFINE_optional_string): Define.
15442         (General_options::demangle): Change from DEFINE_bool to
15443         DEFINE_optional_string.
15444         (General_options::no_demangle): New function.
15445         (General_options::do_demangle): New function.
15446         (General_options::set_do_demangle): New function.
15447         (General_options::execstack_status_): Move definition to end of
15448         class definition.
15449         (General_options::static_): Likewise.
15450         (General_options::do_demangle_): New field.
15451         * object.cc (big_endian>::get_symbol_location_info): Call
15452         Options::do_demangle, not Options::demangle.
15453         * symtab.cc (demangle): Likewise.
15454
15455 2008-03-22  Ian Lance Taylor  <iant@google.com>
15456
15457         * gold.h: Include <cstddef> and <sys/types.h>
15458         * options.h: Include <cstring>.
15459
15460 2008-03-21  Ian Lance Taylor  <iant@google.com>
15461
15462         * Added source code to GNU binutils.
15463 \f
15464 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15465
15466 Copying and distribution of this file, with or without modification,
15467 are permitted in any medium without royalty provided the copyright
15468 notice and this notice are preserved.
15469
15470 Local Variables:
15471 mode: change-log
15472 left-margin: 8
15473 fill-column: 74
15474 version-control: never
15475 End: