2e269463bac7a4eb9ea3c869870d39c0aa761648
[external/binutils.git] / gold / ChangeLog
1 2013-12-18  Cary Coutant  <ccoutant@google.com>
2
3         * configure.ac: Check for <unordered_set> and <unordered_map>.
4         * config.in: Regenerate.
5         * configure: Regenerate.
6         * system.h: Use <unordered_set> and <unordered_map> if available.
7
8 2013-12-10  Roland McGrath  <mcgrathr@google.com>
9
10         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
11         with $(INSTALL_PROGRAM_ENV).
12         * Makefile.in: Regenerate.
13
14 2013-11-22  Cary Coutant  <ccoutant@google.com>
15
16         * configure.ac: Add check for which library is needed for
17         dlopen.
18         * configure: Regenerate.
19
20 2013-11-22  Cary Coutant  <ccoutant@google.com>
21
22         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
23         assembler.
24         * testsuite/Makefile.in: Regenerate.
25
26 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
27
28         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
29         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
30         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
31         (Target_x86_64<size>::Scan::local): Likewise.
32         (Target_x86_64<size>::Scan::global): Likewise.
33         (Target_x86_64<size>::Relocate::relocate): Likewise.
34         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
35         Likewise.
36         (Target_x86_64<size>::Scan::check_non_pic(): Handle
37         R_X86_64_PC32_BND.
38
39         * testsuite/Makefile.am (check_PROGRAMS): Add
40         exception_x86_64_bnd_test.
41         (exception_x86_64_bnd_test_SOURCES): New macro.
42         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
43         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
44         (exception_x86_64_bnd_test_LDADD): Likewise.
45         (exception_x86_64_bnd_1.o): New rule.
46         (exception_x86_64_bnd_2.o): Likewise.
47         * testsuite/Makefile.in: Regenerated.
48
49 2013-11-15  Alan Modra  <amodra@gmail.com>
50
51         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
52         accessor.
53         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
54         Only call ppc64_local_entry_offset for 64-bit.  Restrict
55         symval_for_branch lookup to ELFv1.
56         (Stub_table::add_plt_call_entry): Use unsigned int off.
57         (Output_data_glink::Address, invalid_address): New.
58         (Output_data_glink::add_eh_frame): Move out of line.  Add
59         support for ELFv2.
60         (Output_data_glink::add_global_entry, find_global_entry,
61         global_entry_address): New functions.
62         (Output_data_glink::global_entry_stubs_, end_branch_table_,
63         ge_size): New variables.
64         (Output_data_glink::set_final_data_size): Add global entry
65         stub sizing.
66         (Output_data_glink::do_write): Write global entry stubs.
67         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
68         parameter.  Return true for ELFv2.  Adjust callers.
69         (Target_powerpc::Scan::local, global): Restrict opd lookup to
70         ELFv1.  Similarly for ifunc and dynamic relocation processing
71         specific to ELFv1.  Recognize that symbols are defined on
72         their plt entries for ELFv2.
73         (Target_powerpc::symval_for_branch): Assert if called for
74         ELFv2 or ppc32.
75         (Target_powerpc::Relocate::relocate): Use global entry plt
76         stub for symbol value if such exists on ELFv2.
77         (Target_powerpc::Relocate::relocate): Don't call
78         symval_for_branch when ELFv2.  Do adjust for local entry
79         offset when ELFv2.
80         (Target_powerpc::do_dynsym_value): Set symbols to global entry
81         plt stub for ELFv2.
82         (Target_powerpc::do_plt_address_for_global): Similarly.
83
84 2013-11-14  Cary Coutant  <ccoutant@google.com>
85
86         Revert patch -- this did not fix the problem, and there is
87         no race there.
88
89         2013-11-14  Cary Coutant  <ccoutant@google.com>
90
91             PR gold/14860
92             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
93             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
94             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
95             updating fde_offsets_.
96             (Eh_frame_hdr::lock_): New data member.
97
98 2013-11-14  Cary Coutant  <ccoutant@google.com>
99
100         * dwp.cc (Dwo_file_entry): New type.
101         (File_list): Use Dwo_file_entry.
102         (Dwo_file::verify): New function.
103         (Dwo_file::verify_dwo_list): New function.
104         (Dwo_file::sized_verify_dwo_list): New function.
105         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
106         list.
107         (Dwp_options): New enum type.
108         (dwp_options): Add --verify-only.
109         (usage): Likewise.
110         (main): Likewise.
111         * dwp.h (gold_info): Add declaration.
112
113 2013-11-14  Cary Coutant  <ccoutant@google.com>
114
115         PR gold/14860
116         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
117         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
118         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
119         updating fde_offsets_.
120         (Eh_frame_hdr::lock_): New data member.
121
122 2013-11-06  Cary Coutant  <ccoutant@google.com>
123
124         PR gold/15758
125         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
126         before reloc sections.
127
128 2013-11-04  Alan Modra  <amodra@gmail.com>
129
130         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
131         (Symbol::needs_dynamic_reloc): Test new flag.
132         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
133         (Target_powerpc::Scan::get_reference_flags): Add target param.
134         Return FUNC_DESC_ABI for 64-bit ELFv1.
135         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
136         call.
137         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
138         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
139
140 2013-10-31  Cary Coutant  <ccoutant@google.com>
141
142         Restore support for dwp v2 DWARF package file format.
143
144         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
145         tu_length parameter.  Adjust all callers.
146         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
147         * dwp.cc: Include dwarf.h.
148         (Section_bounds): New struct type.
149         (Unit_set): New struct type.
150         (Dwo_file::Dwo_file): Initialize new data member.
151         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
152         Combine and rename to...
153         (Dwo_file::read_unit_index): ...this.
154         (Dwo_file::sized_read_compunit_index)
155         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
156         (Dwo_file::sized_read_unit_index): ...this.
157         (Dwo_file::copy_section): Remove section_name, is_str_offsets
158         parameters; add section_id parameter.
159         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
160         (Dwo_file::add_unit_set): ...this.
161         (Dwo_file::shndx_map_): Remove.
162         (Dwo_file::sect_offsets_): New data member.
163         (Dwp_output_file::Dwp_output_file): Initialize new data members.
164         (Dwp_output_file::add_section): Rename to...
165         (Dwp_output_file::add_contribution): ...this.
166         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
167         (Dwp_output_file::add_tu_set): Likewise.
168         (Dwp_output_file::Contribution): New type.
169         (Dwp_output_file::Section::contributions): New data member.
170         (Dwp_output_file::Cu_or_tu_set): Remove.
171         (Dwp_output_file::Section::Section): New ctor.
172         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
173         (Dwp_output_file::Dwp_index::Section_table): New type.
174         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
175         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
176         parameter.
177         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
178         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
179         (Dwp_output_file::Dwp_index::section_table): New member function.
180         (Dwp_output_file::Dwp_index::section_table_end): New member function.
181         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
182         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
183         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
184         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
185         (Dwp_output_file::Dwp_index::section_table_): New data member.
186         (Dwp_output_file::Dwp_index::section_mask_): New data member.
187         (Dwp_output_file::add_output_section): New member function.
188         (Dwp_output_file::write_new_section): New member function.
189         (Dwp_output_file::write_contributions): New member function.
190         (Dwp_output_file::section_id_map_): New data member.
191         (class Dwo_id_info_reader): Remove.
192         (class Unit_reader): New class.
193         (get_dwarf_section_name): New function.
194         (Dwo_file::read_executable): Adjust initializations of class data.
195         (Dwo_file::read): Add support for v2 package file format.
196         (Dwo_file::read_unit_index): Likewise.
197         (Dwo_file::sized_read_unit_index): Likewise.
198         (Dwo_file::copy_section): Likewise.
199         (Dwo_file::add_unit_set): Likewise.
200         (Dwp_output_file::add_output_section): Likewise.
201         (Dwp_output_file::add_contribution): Likewise.
202         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
203         for empty slot.
204         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
205         file format.
206         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
207         slot.
208         (Dwp_output_file::initialize): Remove unused function.
209         (Dwp_output_file::finalize): Add support for v2 package file format.
210         (Dwp_output_file::write_index): Likewise.
211         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
212         function prototype.
213
214 2013-10-31  Cary Coutant  <ccoutant@google.com>
215
216         * configure.ac: Fix check for -fmerge-constants.
217         * configure.ac: Regenerate.
218
219 2013-10-30  Roland McGrath  <mcgrathr@google.com>
220
221         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
222         Correct 9-byte nop sequence to match what the assembler generates.
223
224 2013-10-30  Alan Modra  <amodra@gmail.com>
225
226         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
227         ppc64_local_entry_offset, ppc64_local_entry_offset,
228         do_read_symbols): New functions.
229         (Powerpc_relobj::e_flags_, st_other_): New vars.
230         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
231         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
232         (Powerpc_relobj::e_flags_): New var.
233         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
234         and adjust for ELFv2.
235         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
236         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
237         (Powerpc_dynobj::do_find_special_sections): Likewise.
238         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
239         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
240         to ELFv2 local entry.
241         (Target_powerpc::do_relax): No thread safe barriers needed for
242         ELFv2.
243         (Output_data_plt_powerpc::initial_plt_entry_size_,
244         plt_entry_size): Delete.  Replace all uses with
245         first_plt_entry_offset() and plt_entry_size().
246         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
247         reserved_size parm.  Update callers.
248         (Output_data_plt_powerpc::entry_count): Update.
249         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
250         and use Target_powerpc::first_plt_entry_offset().
251         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
252         rename to plt_entry_size.
253         (Output_data_plt_powerpc::add_ifunc_entry,
254         add_local_ifunc_entry): Adjust reloc for ELFv2.
255         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
256         (glink_eh_frame_fde_64v2): New.
257         (Stub_table::plt_call_size): Support ELFv2 sizing.
258         (Output_data_glink::add_eh_frame): Use the new FDE.
259         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
260         (Stub_table::do_write): Write ELFv2 stubs and glink.
261         (Target_powerpc::Relocate::relocate): Replaces nop after call
262         with ld 2,24(1) and adjust local offset destination for ELFv2.
263
264 2013-10-30  Alan Modra  <amodra@gmail.com>
265
266         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
267         (Target_powerpc::Scan::global, local): Likewise.
268         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
269         on all ppc64 @h and @ha relocs.
270
271 2013-10-14  Alan Modra  <amodra@gmail.com>
272
273         * output.h (Output_data_got::add_constant): Tidy.
274         (Output_data_got::add_constant_pair): New function.
275         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
276         methods used so as to first call reserve_ent().
277
278 2013-10-11  Roland McGrath  <mcgrathr@google.com>
279
280         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
281         add_got_entry and add_got_entry_pair.
282
283         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
284         (HAVE_PUBNAMES): Likewise.
285         * configure: Regenerate.
286
287         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
288         * testsuite/Makefile.in: Regenerate.
289
290         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
291         Remove const from declaration.
292         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
293         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
294         * output.h (Output_file_header): Remove const from member target_
295         and corresponding constructor argument.
296         * output.cc (Output_file_header::Output_file_header): Update prototype.
297         (Output_file_header::do_sized_write): Use this->target_ in place
298         of parameters()->target().
299
300         * testsuite/undef_symbol.cc (Foo::get_a): New method.
301
302         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
303         * configure: Regenerate.
304         * Makefile.in: Regenerate.
305         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
306         * testsuite/merge_string_literals_2.c: Likewise.
307         * testsuite/Makefile.am
308         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
309         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
310         literal -fmerge-constants.
311         * testsuite/Makefile.in: Regenerate.
312
313         * i386.cc (Target_i386): Remove unused member dynbss_.
314         * arm.cc (Target_arm): Likewise.
315         * powerpc.cc (Target_powerpc): Likewise.
316         * sparc.cc (Target_sparc): Likewise.
317         * tilegx.cc (Target_tilegx): Likewise.
318         * x86_64.cc (Target_x86_64): Likewise.
319         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
320         type_signature_, type_offset_.
321         * plugin.h (Plugin_hook): Remove unused member layout_.
322         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
323         mapfile_.
324         (Read_member): Remove unused members input_objects_, symtab_,
325         mapfile_, layout_.
326         (Check_library): Remove unused member symtab_.
327         * archive.h (Lib_group): Remove unused member lib_.
328         * archive.cc (Lib_group::Lib_group): Update initializer.
329         * incremental.h (Incremental_binary): Remove unused member target_.
330         (Incremental_script_entry): Removed unused member script_.
331         * layout.h (Write_symbols_task): Remove unused member input_objects_.
332         * icf.h (Icf): Remove unused member num_tracked_relocs.
333
334         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
335         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
336         its only use.
337         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
338
339         * archive.h: Use struct rather than class for forward declaration
340         of Read_symbols_data.
341
342 2013-10-07  Cary Coutant  <ccoutant@google.com>
343
344         PR gold/16010
345         * testsuite/Makefile.am (icf_test): Fix dependencies.
346         (icf_safe_test): Likewise.
347         (icf_safe_so_test): Likewise.
348         (large_symbol_alignment): Add empty _LDADD rule.
349         * testsuite/Makefile.in: Regenerate.
350
351 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
352
353         PR gold/15927
354         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
355         relocation for R_X86_64_32 on x32.
356
357 2013-08-27  Roland McGrath  <mcgrathr@google.com>
358
359         * output.cc (Output_segment::set_section_addresses): Take new
360         Target* argument.  If target->isolate_execinstr() and the segment
361         is executable and starts at a target->abi_pagesize() boundary,
362         pad its end out to a target->abi_pagesize() boundary with code fill.
363         * output.h (Output_segment::set_section_addresses): Update decl.
364         * layout.h (Layout::check_output_data_for_reset_values): Take new
365         argument RELAX_OUTPUTS.
366         (Layout): New member relax_output_list_.
367         (Layout::add_relax_output): New method.
368         * layout.cc (Layout::Layout): Update constructor.
369         (Layout::reset_relax_output): New method.
370         (Layout::clean_up_after_relaxation): Call it.
371         (Layout::prepare_for_relaxation): Update caller.
372         (Layout::set_segment_offsets): Update callers of set_section_addresses.
373         Call reset_relax_output before re-processing segments for
374         isolate_execinstr case.
375         (Layout::write_data): Handle relax_output_list_.
376         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
377         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
378
379 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
380
381         PR binutils/15834
382         * object.h: Fix typos.
383
384 2013-08-16  Roland McGrath  <mcgrathr@google.com>
385
386         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
387         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
388
389 2013-08-07  Cary Coutant  <ccoutant@google.com>
390
391         Revert support for v2 DWP files:
392
393         2013-03-01  Cary Coutant  <ccoutant@google.com>
394
395             Add dwp support for v2 DWARF package file format.
396             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
397             tu_length parameter.  Adjust all callers.
398             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
399             * dwp.cc: Include dwarf.h.
400             (Section_bounds): New struct type.
401             (Unit_set): New struct type.
402             (Dwo_file::Dwo_file): Initialize new data member.
403             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
404             Combine and rename to...
405             (Dwo_file::read_unit_index): ...this.
406             (Dwo_file::sized_read_compunit_index)
407             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
408             (Dwo_file::sized_read_unit_index): ...this.
409             (Dwo_file::copy_section): Remove section_name, is_str_offsets
410             parameters; add section_id parameter.
411             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
412             (Dwo_file::add_unit_set): ...this.
413             (Dwo_file::shndx_map_): Remove.
414             (Dwo_file::sect_offsets_): New data member.
415             (Dwp_output_file::Dwp_output_file): Initialize new data members.
416             (Dwp_output_file::add_section): Rename to...
417             (Dwp_output_file::add_contribution): ...this.
418             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
419             (Dwp_output_file::add_tu_set): Likewise.
420             (Dwp_output_file::Contribution): New type.
421             (Dwp_output_file::Section::contributions): New data member.
422             (Dwp_output_file::Cu_or_tu_set): Remove.
423             (Dwp_output_file::Section::Section): New ctor.
424             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
425             (Dwp_output_file::Dwp_index::Section_table): New type.
426             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
427             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
428             parameter.
429             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
430             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
431             (Dwp_output_file::Dwp_index::section_table): New member function.
432             (Dwp_output_file::Dwp_index::section_table_end): New member function.
433             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
434             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
435             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
436             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
437             (Dwp_output_file::Dwp_index::section_table_): New data member.
438             (Dwp_output_file::Dwp_index::section_mask_): New data member.
439             (Dwp_output_file::add_output_section): New member function.
440             (Dwp_output_file::write_new_section): New member function.
441             (Dwp_output_file::write_contributions): New member function.
442             (Dwp_output_file::section_id_map_): New data member.
443             (class Dwo_id_info_reader): Remove.
444             (class Unit_reader): New class.
445             (get_dwarf_section_name): New function.
446             (Dwo_file::read_executable): Adjust initializations of class data.
447             (Dwo_file::read): Add support for v2 package file format.
448             (Dwo_file::read_unit_index): Likewise.
449             (Dwo_file::sized_read_unit_index): Likewise.
450             (Dwo_file::copy_section): Likewise.
451             (Dwo_file::add_unit_set): Likewise.
452             (Dwp_output_file::add_output_section): Likewise.
453             (Dwp_output_file::add_contribution): Likewise.
454             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
455             for empty slot.
456             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
457             file format.
458             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
459             slot.
460             (Dwp_output_file::initialize): Remove unused function.
461             (Dwp_output_file::finalize): Add support for v2 package file format.
462             (Dwp_output_file::write_index): Likewise.
463             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
464             function prototype.
465
466 2013-07-31  Cary Coutant  <ccoutant@google.com>
467
468         * object.cc (Sized_relobj::do_output_section_address): New function.
469         (Sized_relobj): Instantiate explicitly.
470         * object.h (Object::output_section_address): New function.
471         (Object::do_output_section_address): New function.
472         (Sized_relobj::do_output_section_address): New function.
473         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
474
475 2013-07-30  Cary Coutant  <ccoutant@google.com>
476             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
477
478         * parameters.cc (Parameters::entry): Return target-specific entry
479         symbol name.
480         * target.h (Target::entry_symbol_name): New function.
481         (Target_info::entry_symbol_name): New data member.
482
483         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
484         * i386.cc (Target_i386::i386_info): Likewise.
485         (Target_i386_nacl::i386_nacl_info): Likewise.
486         * sparc.cc (Target_sparc::sparc_info): Likewise.
487         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
488         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
489         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
490         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
491
492 2013-07-22  Sterling Augustine  <saugustine@google.com>
493
494         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
495         Convert parameter shndx to local variable. Add parameters symtab
496         and symtab_size.  Scan over section names.  Find relocation
497         section corresponding to current section.  Create and initialize
498         reloc_mapper_ and reloc_type_.
499         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
500         unit_length to off_t.  Initialize member unit_length_.  Fill in field
501         cu_offset_.
502         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
503         Initialize new fields unit_length_ and cu_offset_.
504         (Dwarf_pubnames_table::read_section): Update prototype.
505         (Dwarf_pubnames_table::cu_offset): New member function.
506         (Dwarf_pubnames_table::subsection_size): Likewise.
507         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
508         New fields.
509         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
510         member functions public.
511         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
512         Update comment.  Rework logic.  Move repeated parts to...
513         (Gdb_index_info_reader::read_pubtable): ...here. New function.
514         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
515         pubtypes_table_, and stmt_list_offset.
516         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
517         Gdb_index::find_pubtype_offset,
518         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
519         (Gdb_index::pubnames_read): Update prototype and rework logic.
520         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
521         Forward declare.
522         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
523         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
524         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
525         Gdb_index::map_pubtable_to_dies):
526         Declare functions.
527         (Gdb_index::pubnames_read): Update declaration.
528         (Gdb_index::Pubname_offset_map): New type.
529         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
530         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
531         Gdb_index::stmt_list_offset): Declare.
532         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
533         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
534         Gdb_index::pubtypes_offset_): Remove.
535
536 2013-07-19  Roland McGrath  <mcgrathr@google.com>
537
538         * options.h (General_options): Add -Trodata-segment option.
539         * parameters.cc (Parameters::check_rodata_segment): New function.
540         (Parameters::set_target_once): Call it.
541         * parameters.h (Parameters): Declare it (private member function).
542         * layout.cc (load_seg_unusable_for_headers): New function, broken
543         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
544         then validate rodata segment rather than text segment.
545         (relaxation_loop_body): Call that.
546         (is_text_segment): New function.  Don't admit a non-executable
547         segment if TARGET->isolate_execinstr().
548         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
549
550 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
551
552         PR gold/15070
553         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
554         * nacl.h (Sniff_file::View::View): Request aligned view.
555
556 2013-07-11  Cary Coutant  <ccoutant@google.com>
557
558         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
559         correct BRLT entry size.
560
561 2013-07-03  Alan Modra  <amodra@gmail.com>
562
563         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
564         comment.
565
566 2013-07-01  Cary Coutant  <ccoutant@google.com>
567
568         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
569         reloc_type_.
570         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
571         (Dwarf_ranges_table::lookup_reloc): New function.
572         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
573         reloc_type_.
574         (Dwarf_ranges_table::lookup_reloc): New function.
575         (Dwarf_ranges_table::reloc_type_): New data member.
576
577 2013-06-27  Jing Yu  <jingyu@google.com>
578
579         PR gold/15662
580         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
581         function.
582         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
583         (Target_powerpc::do_relax): Call the above.
584
585 2013-06-27  Cary Coutant  <ccoutant@google.com>
586
587         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
588         on garbage collected .opd section.
589
590 2013-06-27  Alan Modra  <amodra@gmail.com>
591
592         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
593         is non-zero.
594         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
595         (Target_powerpc::do_function_location): Likewise for loc->shndx.
596
597 2013-06-14  Cary Coutant  <ccoutant@google.com>
598
599         * resolve.cc (Symbol::override_base): Don't override st_type
600         from plugin placeholder symbols.
601         (Symbol_table::resolve): Likewise.
602         (Symbol_table::should_override): Don't complain about TLS mismatch
603         if the TO symbol is a plugin placeholder.
604         * testsuite/Makefile.am (plugin_test_tls): New test.
605         * testsuite/Makefile.in: Regenerate.
606         * testsuite/plugin_test_tls.sh: New test script.
607         * testsuite/two_file_test_2_tls.cc: New test source.
608         * testsuite/two_file_test_tls.cc: New test source.
609
610 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
611
612         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
613         the maximum segment alignment is larger than the page size.
614         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
615         correctly aligns the symbols with large alignemnt.
616         * testsuite/Makefile.in: Regenerate.
617         * testsuite/large_symbol_alignment.cc: New file.
618
619 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
620             Sriraman Tallam  <tmsriram@google.com>
621
622         * options.h (sort_section): New option.
623         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
624         Rename from Input_section_sort_section_name_special_ordering_compare.
625         (Input_section_sort_section_name_compare): New struct.
626         * output.cc (Output_section::Input_section_sort_section_name_compare::
627         operator()): New function.
628         (Output_section::sort_attached_input_sections): Use new sort function
629         for .text if --sort-section=name is specified.
630         * layout.cc (Layout::make_output_section):
631         Add sorting by name when --sort-section=name is specified.
632         * testsuite/Makefile.am (text_section_grouping): Test option
633         --sort-section=name.
634         * testsuite/Makefile.in: Regenerate.
635         * testsuite/section_sorting_name.cc: New file.
636         * testsuite/section_sorting_name.sh: New file.
637
638 2013-05-21  Cary Coutant  <ccoutant@google.com>
639
640         * symtab.h (Symbol::is_cxx_vtable): New function.
641         * target-reloc.h (relocate_section): Check for vtable symbol.
642         * testsuite/Makefile.am (missing_key_func.sh): New test case.
643         * testsuite/Makefile.in: Regenerate.
644         * testsuite/missing_key_func.cc: New test source.
645         * testsuite/missing_key_func.sh: New test script.
646
647 2013-05-21  Cary Coutant  <ccoutant@google.com>
648
649         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
650         type of enclosing symbol.
651         (Relocate_info::location): Check symbol type when describing symbol.
652         * object.h (Symbol_location_info): Remove unused line_number;
653         add enclosing_symbol_type.
654         * testsuite/debug_msg.sh: Adjust expected output.
655
656 2013-05-13  Cary Coutant  <ccoutant@google.com>
657
658         * configure.ac: Export DEFAULT_TARGET.
659         * configure: Regenerate.
660         * Makefile.in: Regenerate.
661         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
662         * testsuite/Makefile.in: Regenerate.
663         * testsuite/debug_msg.sh: Delete duplicate tests.
664         Don't check undef_int error message match for powerpc where the
665         source file and line number aren't available.
666
667 2013-05-10  Roland McGrath  <mcgrathr@google.com>
668
669         * options.h (General_options): Add --rosegment-gap option.
670         * options.cc (finalize): --rosegment-gap implies --rosegment.
671         * layout.cc (set_segment_offsets): Let user option override
672         target->rosegment_gap().
673
674 2013-05-10  Roland McGrath  <mcgrathr@google.com>
675
676         * options.h (General_options): Remove leading space from help
677         messages for -nostdlib and --rosegment.
678
679 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
680
681         PR ld/15365
682         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
683
684 2013-05-03  Alan Modra  <amodra@gmail.com>
685
686         * merge.cc (Output_merge_string::do_add_input_section): Correct
687         scan for number of strings.  Rename vars to avoid shadowing.
688         Include missing terminator in input_size_.
689
690 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
691
692         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
693         Restore empty string handling.
694
695 2013-05-01  Cary Coutant  <ccoutant@google.com>
696
697         * stringpool.cc (Stringpool_template::new_key_offset): Fix
698         uninitialized warning.
699
700 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
701
702         * output.cc (Output_section::add_merge_input_section): Allow
703         to merge sections if the alignment is more than character size.
704         * merge.h (Output_merge_string::Output_merge_string): Remove
705         assert.
706         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
707         only not-null strings. Check the alignment of strings.
708         * stringpool.h
709         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
710         alignment as the argument.
711         (Stringpool_template<Stringpool_char>::addralign_): New class member.
712         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
713         Align non-zero length strings according to the addralign_.
714         (Stringpool_template<Stringpool_char>::set_string_offsets):
715         Updating offsets according to the given alignment.
716         * testsuite/Makefile.am (text_section_grouping): Test if string
717         literals are getting merged.
718         * testsuite/Makefile.in: Regenerate.
719         * testsuite/merge_string_literals_1.c: New file.
720         * testsuite/merge_string_literals_2.c: Ditto.
721         * testsuite/merge_string_literals.sh: Ditto.
722
723 2013-04-26  Ian Lance Taylor  <iant@google.com>
724
725         * target-reloc.h (relocate_section): If the reloc offset is out of
726         range, pass VIEW as NULL to relocate.relocate.
727         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
728         * i386.cc (Target_i386::Relocate::relocate): Likewise.
729         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
730         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
731         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
732         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
733
734 2013-04-26  Geoff Pike  <gpike@chromium.org>
735
736         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
737         * layout.cc (Hash_task): New class.
738         (Layout::queue_build_id_tasks): New function.
739         (Layout::write_build_id): Handle single-thread portion of build ID
740         computation.  (In some cases, all of it is single-threaded.)  Replace
741         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
742         functionality in fewer lines of code.
743         * layout.h (Layout::queue_build_id_tasks): New function declaration.
744         * options.h (General_options): make "--build-id" default to tree
745         rather than sha1.  Add two new options related to --build-id=tree:
746         --build-id-chunk-size-for-treehash and
747         --build-id-min-file-size-for-treehash.
748         * Makefile.am: add testing of --build-id=tree and related new options
749         (these tests will be invoked by "make check").
750         * Makefile.in: Regenerate.
751
752 2013-04-25  Alan Modra  <amodra@gmail.com>
753
754         * configure.tgt: Add powerpcle and powerpc64le.
755
756 2013-04-22  Alan Modra  <amodra@gmail.com>
757
758         PR gold/15355
759         * layout.cc (Layout::segment_precedes): Allow more than one
760         segment with the same type and flags.
761
762 2013-04-15  Cary Coutant  <ccoutant@google.com>
763
764         * layout.cc (Layout::set_relocatable_section_offsets): Don't
765         allocate space in file for BSS sections.
766
767 2013-04-15  Cary Coutant  <ccoutant@google.com>
768
769         * script-sections.cc (Orphan_output_section): Reset address
770         to zero after each orphaned section for relocatable links.
771
772 2013-04-15  Cary Coutant  <ccoutant@google.com>
773
774         * symtab.cc (Symbol_table::sized_write_globals): Subtract
775         section starting address for relocatable link.
776         * testsuite/Makefile.am (script_test_11): New test.
777         * testsuite/Makefile.in: Regenerate.
778         * testsuite/script_test_11.c: New source file.
779         * testsuite/script_test_11.t: New linker script.
780
781 2013-04-13  Alan Modra  <amodra@gmail.com>
782
783         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
784         owner when sections are not adjacent and exceed group size.
785         (Target_powerpc::group_sections): Handle corner case.
786         (Target_powerpc::Branch_info::make_stub): Handle case where
787         stub table doesn't exist due to branches in non-exec sections.
788         (Target_powerpc::Relocate::relocate): Likewise.
789
790 2013-04-11  Alan Modra  <amodra@gmail.com>
791
792         PR gold/15354
793         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
794         .branch_lt to match bfd ld.  Adjust comments throughout file.
795
796 2013-04-04  Ian Lance Taylor  <iant@google.com>
797
798         GCC PR c++/56840
799         * object.cc (do_layout_deferred_sections): Handle .eh_frame
800         sections before checking whether they are included in the link.
801
802 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
803
804         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
805         object before calling the plugin claim_file handler.  Pass the elf
806         object of the archive to the plugin. Delete the elf object if the
807         plugin claims the file.
808
809 2013-03-21  Alan Modra  <amodra@gmail.com>
810
811         * layout.cc (Layout::set_segment_offsets): Accept writable .text
812         segment when omagic.
813
814 2013-03-21  Alan Modra  <amodra@gmail.com>
815
816         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
817         comparison warning.
818         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
819         uninitialized" warning.
820
821 2013-03-20  Alan Modra  <amodra@gmail.com>
822
823         * symtab.h (Symbol::clear_version): New function.
824         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
825         is_needed by weak references.  Clear version for symbols defined
826         in as-needed objects that are not needed.
827
828 2013-03-15  Alan Modra  <amodra@gmail.com>
829
830         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
831         static and public.  Add report_err param.  Return false for data refs.
832         (Target_powerpc::rela_dyn_section): New overloaded function.
833         (Target_powerpc::plt_, iplt_): Elucidate.
834         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
835         (Output_data_plt_powerpc::do_write): Don't write .iplt.
836         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
837         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
838         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
839         push_branch and make_plt_entry for ifunc syms when
840         reloc_needs_plt_for_ifunc.
841         (Target_powerpc::Relocate::relocate): Don't use plt entry value
842         for ifunc unless reloc_needs_plt_for_ifunc.
843
844 2013-03-15  Alan Modra  <amodra@gmail.com>
845
846         * gc.h (gc_process_relocs): Don't look through function descriptors.
847         * icf.cc (get_section_contents): Do so here instead.
848
849 2013-03-13  Alan Modra  <amodra@gmail.com>
850
851         * powerpc.cc (is_branch_reloc): Forward declare.
852         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
853         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
854         false for 64-bit, true for 32-bit non-branch relocs.
855         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
856         * testsuite/Makefile.am (icf_test): Use linker map file instead of
857         nm output.
858         (icf_safe_test): Generate linker map file as well as nm output.
859         (icf_safe_so_test): Likewise.
860         * testsuite/Makefile.in: Regenerate.
861         * testsuite/icf_test.sh: Parse linker map file to determine
862         section folding.
863         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
864         * testsuite/icf_safe_so_test.sh: Likewise.
865         (X86_32_or_ARM_specific_safe_fold): Merge into..
866         (arch_specific_safe_fold): ..this.
867         (X86_64_specific_safe_fold): Delete unused function.
868
869 2013-03-12  Alan Modra  <amodra@gmail.com>
870
871         * gc.h (gc_process_relocs): Look through function descriptors
872         to determine shndx, symvalue and addend used by ICF.  Tidy
873         variable duplication.
874
875 2013-03-11  Alan Modra  <amodra@gmail.com>
876
877         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
878         * layout.cc (Layout_task_runner::run): ..to here.
879         * symtab.h (struct Symbol_location): Extract from..
880         (class Symbol_table): ..here.
881         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
882         * target.h (class Target): Add function_location and
883         do_function_location functions.
884         (class Sized_target): Add do_function_location.
885         * object.h (class Sized_relobj_file): Move find_shdr..
886         (class Object): ..to here.
887         * object.cc: Likewise.  Update to suit.  Instantiate.
888         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
889         * powerpc.cc (class Powerpc_dynobj): New.
890         (Target_powerpc::do_function_location): New function.
891         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
892         (Powerpc_dynobj::do_read_symbols): New function.
893         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
894
895 2013-03-08  Ian Lance Taylor  <iant@google.com>
896
897         * options.cc (General_options::string_to_object_format): Accept
898         "default".
899
900 2013-03-08  Alan Modra  <amodra@gmail.com>
901
902         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
903         pointer to Post_fde.
904         (struct Post_fde): Move definition to here..
905         * ehframe.cc (struct Post_fde): ..from here.
906         (Cie::write): Don't alloc Post_fde.
907         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
908
909 2013-03-07  Alan Modra  <amodra@gmail.com>
910
911         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
912         relocation referencing .LC0.
913         * testsuite/discard_locals_test.sh: Remove FIXMEs.
914
915 2013-03-07  Alan Modra  <amodra@gmail.com>
916
917         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
918         always_inline.  Add assembly for powerpc to avoid GOT.
919
920 2013-03-07  Alan Modra  <amodra@gmail.com>
921
922         * testsuite/script_test_10.sh: Don't test .bss section
923         header number.
924
925 2013-03-06  Alan Modra  <amodra@gmail.com>
926
927         * powerpc.cc (class Powerpc_relobj): Move some member functions.
928         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
929         all callers.  Handle folded sections.
930         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
931         to Powerpc_relobj.
932         (Global_symbol_visitor_opd::operator()): Likewise.
933
934 2013-03-04  Alan Modra  <amodra@gmail.com>
935
936         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
937         * testsuite/Makefile.in: Regenerate.
938
939 2013-03-01  Cary Coutant  <ccoutant@google.com>
940
941         Add dwp support for v2 DWARF package file format.
942         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
943         tu_length parameter.  Adjust all callers.
944         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
945         * dwp.cc: Include dwarf.h.
946         (Section_bounds): New struct type.
947         (Unit_set): New struct type.
948         (Dwo_file::Dwo_file): Initialize new data member.
949         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
950         Combine and rename to...
951         (Dwo_file::read_unit_index): ...this.
952         (Dwo_file::sized_read_compunit_index)
953         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
954         (Dwo_file::sized_read_unit_index): ...this.
955         (Dwo_file::copy_section): Remove section_name, is_str_offsets
956         parameters; add section_id parameter.
957         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
958         (Dwo_file::add_unit_set): ...this.
959         (Dwo_file::shndx_map_): Remove.
960         (Dwo_file::sect_offsets_): New data member.
961         (Dwp_output_file::Dwp_output_file): Initialize new data members.
962         (Dwp_output_file::add_section): Rename to...
963         (Dwp_output_file::add_contribution): ...this.
964         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
965         (Dwp_output_file::add_tu_set): Likewise.
966         (Dwp_output_file::Contribution): New type.
967         (Dwp_output_file::Section::contributions): New data member.
968         (Dwp_output_file::Cu_or_tu_set): Remove.
969         (Dwp_output_file::Section::Section): New ctor.
970         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
971         (Dwp_output_file::Dwp_index::Section_table): New type.
972         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
973         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
974         parameter.
975         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
976         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
977         (Dwp_output_file::Dwp_index::section_table): New member function.
978         (Dwp_output_file::Dwp_index::section_table_end): New member function.
979         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
980         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
981         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
982         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
983         (Dwp_output_file::Dwp_index::section_table_): New data member.
984         (Dwp_output_file::Dwp_index::section_mask_): New data member.
985         (Dwp_output_file::add_output_section): New member function.
986         (Dwp_output_file::write_new_section): New member function.
987         (Dwp_output_file::write_contributions): New member function.
988         (Dwp_output_file::section_id_map_): New data member.
989         (class Dwo_id_info_reader): Remove.
990         (class Unit_reader): New class.
991         (get_dwarf_section_name): New function.
992         (Dwo_file::read_executable): Adjust initializations of class data.
993         (Dwo_file::read): Add support for v2 package file format.
994         (Dwo_file::read_unit_index): Likewise.
995         (Dwo_file::sized_read_unit_index): Likewise.
996         (Dwo_file::copy_section): Likewise.
997         (Dwo_file::add_unit_set): Likewise.
998         (Dwp_output_file::add_output_section): Likewise.
999         (Dwp_output_file::add_contribution): Likewise.
1000         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1001         for empty slot.
1002         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1003         file format.
1004         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1005         slot.
1006         (Dwp_output_file::initialize): Remove unused function.
1007         (Dwp_output_file::finalize): Add support for v2 package file format.
1008         (Dwp_output_file::write_index): Likewise.
1009         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1010         function prototype.
1011
1012 2013-03-01  Cary Coutant  <ccoutant@google.com>
1013
1014         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1015         function into class definition in header file.
1016         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1017         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1018         New function.
1019         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1020
1021 2013-02-28  Alan Modra  <amodra@gmail.com>
1022
1023         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1024         * target.cc (Target::do_plt_fde_location): New function.
1025         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1026         accessor function, and constructor param.
1027         (struct Post_fde, Post_fdes): Declare.
1028         (Cie::write): Add post_fdes param.
1029         * ehframe.cc (Fde::write): Use plt_fde_location.
1030         (struct Post_fde): Define.
1031         (Cie::write): Stash FDEs added post merge mapping.
1032         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1033         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1034         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1035         other FDEs.
1036         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1037         (Target_powerpc::has_glink): New function.
1038         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1039         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1040         glink_eh_frame_fde_32, default_fde): New data.
1041         (Stub_table::eh_frame_added_): New var.
1042         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1043         Make const.
1044         (Stub_table::add_eh_frame): New function.
1045         (Output_data_glink::add_eh_frame): New function.
1046         (Target_powerpc::make_glink_section): Call add_eh_frame.
1047
1048 2013-02-15  Ian Lance Taylor  <iant@google.com>
1049
1050         * options.h (DEFINE_uint64_alias): Define.
1051         (class General_options): Add -Ttext-segment as an alias for
1052         -Ttext.
1053
1054 2013-02-15  Alan Modra  <amodra@gmail.com>
1055
1056         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1057         (Stub_table::do_write): ..here, two places.
1058         (Stub_table::plt_call_size): Use it here too.
1059
1060 2013-02-11  Ian Lance Taylor  <iant@google.com>
1061
1062         * descriptors.cc (Descriptors::close_all): New function.
1063         * descriptors.h (class Descriptors): Declare close_all.
1064         (close_all_descriptors): New inline function.
1065         * plugin.cc: Include "descriptors.h".
1066         (Plugin_manager::cleanup): Call close_all_descriptors.
1067
1068 2013-02-06  Alan Modra  <amodra@gmail.com>
1069
1070         * README: Update coding style link.
1071
1072 2013-01-28  Cary Coutant  <ccoutant@google.com>
1073
1074         * dwp.cc (File_list): New typedef.
1075         (Dwo_name_info_reader): New class.
1076         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1077         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1078         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1079         (Dwo_file::read_executable): New function.
1080         (Dwo_file::read): Move common setup code to ...
1081         (Dwo_file::make_object): ... here.
1082         (dwp_options): Add --exec/-e.
1083         (usage): Likewise.
1084         (main): Likewise.
1085
1086 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1087
1088         * layout.cc (Layout::layout): Check for option text_reorder.
1089         (Layout::make_output_section): Ditto.
1090         * options.h (text_reorder): New option.
1091         * output.cc (Input_section_sort_compare): Remove special ordering
1092         of section names.
1093         (Output_section::
1094          Input_section_sort_section_name_special_ordering_compare::
1095          operator()): New function.
1096         (Output_section::sort_attached_input_sections): Use new sort function
1097         for .text.
1098         * output.h (Input_section_sort_section_name_special_ordering_compare):
1099         New struct.
1100         * testsuite/Makefile.am (text_section_grouping): Test option
1101         --no-text-reorder
1102         * testsuite/Makefile.in: Regenerate.
1103         * testsuite/text_section_grouping.sh: Check order of functions without
1104         default text reordering.
1105
1106 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1107
1108         * options.h (General_options): Change default to true for new_dtags.
1109
1110 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1111
1112         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1113         when enable_new_dtags is false.  Only add DT_RUNPATH when
1114         enable_new_dtags is true.
1115
1116 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1117
1118         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1119         used in declaration and definition consistent.
1120         (Target_powerpc::symval_for_branch): Ditto.
1121
1122 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1123
1124         * testsuite/plugin_final_layout.cc: Fix comment.
1125
1126 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1127
1128         * layout.cc (Layout::layout): Do not do default sorting for
1129         text sections when section ordering is specified.
1130         (make_output_section): Ditto.
1131         * testsuite/plugin_final_layout.cc: Name the function sections
1132         to catch reordering issues.
1133
1134 2013-01-15  Alan Modra  <amodra@gmail.com>
1135
1136         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1137         plt-thread-safe.
1138
1139 2013-01-15  Alan Modra  <amodra@gmail.com>
1140
1141         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1142         * testsuite/Makefile.in: Regenerate.
1143
1144 2013-01-14  Alan Modra  <amodra@gmail.com>
1145
1146         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1147         * testsuite/Makefile.in: Regenerate.
1148
1149 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1150
1151         PR bfd/14430
1152         Fix mingw gold build with plugins enabled
1153         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1154         * configure.ac: Export DLOPEN_LIBS and add headers check.
1155         * plugin.cc: Handle non-dlfcn case.
1156         * Makefile.in: Regenerate.
1157         * config.in: Regenerate.
1158         * configure: Regenerate.
1159         * testsuite/Makefile.in: Regenerate.
1160
1161 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1162
1163         * output.h (sort_attached_input_sections): Change to be public.
1164         * script-sections.cc
1165         (Output_section_definition::set_section_addresses): Sort
1166         attached input sections according to section order before linker
1167         script assigns section addresses.
1168         (Orphan_output_section::set_section_addresses): Sort
1169         attached input sections according to section order before linker
1170         script assigns section addresses.
1171         * Makefile.am (final_layout.sh): Use a simple linker script to
1172         check if section ordering still works.
1173         * Makefile.in: Regenerate.
1174
1175 2013-01-09  Ben Cheng  <bccheng@google.com>
1176
1177         * arm.cc (Target_arm::attributes_accept_div): New function.
1178         (Target_arm::attributes_forbid_div): New function.
1179         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1180         attribute using the same new functions as what bfd/elf32_arm.c
1181         does.
1182
1183 2013-01-07  Cary Coutant  <ccoutant@google.com>
1184
1185         PR gold/14993
1186         * output.cc (Output_section::add_input_section): For incremental
1187         updates, don't track input sections that are allocated from patch
1188         space.
1189
1190 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1191             Ian Lance Taylor  <iant@google.com>
1192
1193         PR gold/14897
1194         * configure.ac (--enable-ld): Removed.
1195         (install_as_default): Set to yes only for --enable-gold=default
1196         or --disable-ld.
1197         * configure: Regenerated.
1198
1199 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1200
1201         * options.h (General_options): Add -fuse-ld= for GCC linker
1202         option compatibility.
1203
1204 2013-01-04  Cary Coutant  <ccoutant@google.com>
1205
1206         * configure.ac: Fix typo restoring CXXFLAGS.
1207         * configure: Regenerate.
1208
1209 2013-01-04  Cary Coutant  <ccoutant@google.com>
1210
1211         * testsuite/Makefile.am (CXXLINK_S): New macro.
1212         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1213         * testsuite/Makefile.in: Regenerate.
1214
1215 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1216
1217         * version.cc (print_version): Update copyright year to 2013.
1218
1219 2012-12-20  Ian Lance Taylor  <iant@google.com>
1220
1221         * layout.cc (Layout::special_ordering_of_input_section): New
1222         function.
1223         (Layout::layout): If input section requires special ordering, must
1224         sort input sections.
1225         (Layout::make_output_section): May sort .text input sections.
1226         (Layout::is_section_name_prefix_grouped): Remove.
1227         * layout.h (class Layout): Declare
1228         special_ordering_of_input_section.  Don't declare
1229         is_section_name_prefix_grouped.
1230         * output.cc (Output_section::add_input_section): Revert last
1231         change.
1232         (Output_section::Input_section_sort::match_file_name): Don't crash
1233         if called on output section data.
1234         (Output_section::Input_section_sort_compare): Sort based on
1235         special ordering.
1236         (Output_section::Input_section_sort_section_order_index_compare):
1237         Revert last patch.
1238         (Output_section::sort_attached_input_sections): Likewise.
1239
1240 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1241
1242         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1243         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1244         * output.cc (Output_section::add_input_section): Check if section
1245         name contains special prefix.  Keep input sections to sort such
1246         sections.
1247         (Output_section::Input_section_sort_section_order_index_compare
1248          ::operator()): Group sections according to prefixes.
1249         (Output_section::sort_attached_input_sections): Add condition to
1250         Input_section_entry constructor call.
1251         * testsuite/Makefile.am (text_section_grouping): New test.
1252         * testsuite/Makefile.in: Regenerate.
1253         * testsuite/text_section_grouping.cc: New file.
1254         * testsuite/text_section_grouping.sh: New file.
1255
1256 2012-12-17  Nick Clifton  <nickc@redhat.com>
1257
1258         * Makefile.am: Add copyright notice.
1259         * NEWS: Likewise.
1260         * README: Likewise.
1261         * configure.ac: Likewise.
1262         * ftruncate.c: Likewise.
1263         * Makefile.in: Regenerate.
1264
1265 2012-12-14  Cary Coutant  <ccoutant@google.com>
1266
1267         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1268         --no-as-needed flag.
1269         (exception_separate_shared_12_test): Likewise.
1270         (incremental_copy_test): Likewise.
1271         * testsuite/Makefile.in: Regenerate.
1272
1273 2012-12-14  Cary Coutant  <ccoutant@google.com>
1274
1275         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1276         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1277
1278 2012-12-12  Alan Modra  <amodra@gmail.com>
1279
1280         * powerpc.cc (class Track_tls): New.
1281         (class Relocate, class Scan): Inherit Track_tls.
1282         (Target_powerpc::Scan::local, global): Track tls optimization
1283         and avoid creating plt entry for __tls_get_addr if all uses
1284         are optimized away.
1285         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1286
1287 2012-12-12  Alan Modra  <amodra@gmail.com>
1288
1289         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1290         Replace no_toc_optimize with toc_optimize.
1291         * output.h (Output_section::input_sections): Provide non-const variant.
1292         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1293         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1294         accessors.
1295         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1296         (class Sort_toc_sections): New.
1297         (Target_powerpc::do_finalize_sections): Sort toc sections.
1298         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1299
1300 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1301
1302         * testsuite/binary_unittest.cc (read_all): New function.
1303         (Sized_binary_test): Use it instead of ::read.
1304         * fileread.cc (do_read): Don't assume pread always reads the whole
1305         amount in a single call.
1306
1307 2012-12-10  Alan Modra  <amodra@gmail.com>
1308
1309         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1310         Set EM_PPC64 or EM_PPC here.
1311         (Target_selector_powerpc::do_recognize): Delete.
1312
1313 2012-12-10  Alan Modra  <amodra@gmail.com>
1314
1315         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1316         stub_table_.
1317         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1318
1319 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1320
1321         * testsuite/binary_unittest.cc (Sized_binary_test):
1322         Use open_descriptor rather than ::open.
1323
1324 2012-12-07  Alan Modra  <amodra@gmail.com>
1325
1326         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1327         typedef and invalid_address constant.
1328         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1329         instantiate constants.
1330
1331 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1332
1333         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1334         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1335         * aclocal.m4: Regenerate.
1336         * configure: Regenerate.
1337         * Makefile.in: Regenerate.
1338         * testsuite/Makefile.in: Regenerate.
1339
1340 2012-12-07  Alan Modra  <amodra@gmail.com>
1341
1342         * options.h (General_options): Add no_toc_optimize.
1343         * powerpc.cc (ok_lo_toc_insn): New function.
1344         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1345
1346 2012-12-06  Alan Modra  <amodra@gmail.com>
1347
1348         * options.h (General_options): Add plt_align, plt_static_chain,
1349         plt_thread_safe.  Update stub_group_size help text.
1350         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1351         for new plt_thread_safe_ var.
1352         (use_plt_offset): Correct comments.
1353         (Target_powerpc::do_relax): Look for thread creation symbols to
1354         determine default plt_thread_safe value.  Clear plt call stubs
1355         as well as branch stubs each iteration.
1356         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1357         insn constants.
1358         (l, hi, ha, write_insn): Move earlier.
1359         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1360         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1361         plt stubs too.
1362         (Stub_table::update_size): Adjust.
1363         (Stub_table::prev_size, set_prev_size): Delete.
1364         (Stub_table::stub_align): Let --plt-align affect result.
1365         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1366         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1367         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1368         (Stub_table::do_write): Support more stub variants.
1369
1370 2012-12-04  Alan Modra  <amodra@gmail.com>
1371
1372         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1373         (Target_powerpc::do_define_standard_symbols): New function.
1374
1375 2012-12-03  Alan Modra  <amodra@gmail.com>
1376
1377         * output.h: Formatting, whitespace.
1378
1379 2012-12-03  Alan Modra  <amodra@gmail.com>
1380
1381         * layout.h (Layout::get_executable_sections): Declare.
1382         * layout.cc (Layout::get_executable_sections): New function.
1383         * arm.cc (Target_arm::group_sections): Use it.
1384         (Arm_output_section::group_sections): Delete now redundant test.
1385         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1386         param to handle relative relocs.
1387         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1388         (Output_data_reloc::add_absolute): Adjust.
1389         (Output_data_reloc::add_relative): New function.
1390         (Output_data::reset_data_size): New function.
1391         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1392         (Output_section::set_addralign): New function.
1393         (Output_section::checkpoint_set_addralign): New function.
1394         (Output_section::clear_section_offsets_need_adjustment): New function.
1395         (Output_section::input_sections): Make public.
1396         * powerpc.cc (class Output_data_brlt_powerpc): New.
1397         (class Stub_table, class Stub_control): New.
1398         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1399         stub_table_, set_stub_table, stub_table): New vectors and accessor
1400         functions.
1401         (Target_powerpc::do_may_relax, do_relax, push_branch,
1402         new_stub_table, stub_tables, brlt_section, group_sections,
1403         add_branch_lookup_table, find_branch_lookup_table,
1404         write_branch_lookup_table, make_brlt_section): New functions.
1405         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1406         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1407         branch_info_): New vars.
1408         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1409         make call stubs here.
1410         (Output_data_glink): Remove all call stub handling from this class.
1411         (Target_powerpc::Scan::local, global): Save interesting branch
1412         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1413         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1414         functions on final link.
1415         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1416         Handle long branch destinations too.
1417         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1418         do_plt_address_for_local): Adjust lookup of plt call stubs.
1419
1420 2012-11-30  Alan Modra  <amodra@gmail.com>
1421
1422         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1423         relocs against protected symbols when building 32-bit shared libs.
1424
1425 2012-11-30  Alan Modra  <amodra@gmail.com>
1426
1427         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1428         param.  Call got_section() to make .got.  Update all callers
1429         and their callers and so on.
1430
1431 2012-11-30  Alan Modra  <amodra@gmail.com>
1432
1433         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1434         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1435         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1436         value if it already exists.
1437
1438 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1439
1440         PR gold/14858
1441         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1442
1443 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1444
1445         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1446         than bfc instruction for data sandboxing.
1447
1448 2012-11-08  Alan Modra  <amodra@gmail.com>
1449
1450         * po/POTFILES.in: Regenerate.
1451
1452 2012-11-05  Alan Modra  <amodra@gmail.com>
1453
1454         * configure.ac: Apply 2012-09-10 change to config.in here.
1455         * configure: Regenerate.
1456
1457 2012-11-05  Alan Modra  <amodra@gmail.com>
1458
1459         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1460         (struct Opd_ent): Use "Address" rather than "Offset".
1461         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1462         (Target_powerpc::got_section): Make public.
1463         (Target_powerpc::scan_relocs): Move code setting symbols..
1464         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1465         Create _SDA_BASE_ only when referenced.
1466
1467 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1468
1469         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1470         from last change.
1471
1472 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1473
1474         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1475         for offset_in_output_section parameter.
1476         (Sized_target::relocate_special_relocatable): Likewise.
1477         * arm.cc (Target_arm::relocate_relocs): Likewise.
1478         (Target_arm::relocate_special_relocatable): Likewise.
1479         * i386.cc (Target_i386::relocate_relocs): Likewise.
1480         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1481         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1482         * target-reloc.h (relocate_relocs): Likewise.
1483         * testsuite/testfile.cc (Target_test): Likewise.
1484         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1485         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1486
1487         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1488         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1489
1490         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1491         parameter, which is unused in the [!F_SETFD] case.
1492
1493         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1494         SYMNDX to off_t before comparing it to this->data_size().
1495         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1496         * incremental.cc (Output_section_incremental_inputs::do_write):
1497         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1498
1499         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1500
1501 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1502
1503         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1504         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1505         in EABI_VER5.
1506
1507 2012-10-29  Cary Coutant  <ccoutant@google.com>
1508
1509         * dwp.cc (usage): Add file and exit status parameters;
1510         add --help and --version options.
1511         (print_version): New function.
1512         (main): Add --help and --version options.
1513
1514 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1515
1516         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1517         final_layout_sequence.txt.
1518         * testsuite/Makefile.in: Regenerated.
1519
1520 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1521
1522         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1523         COMPILE generated by automake.
1524         (LINK1): Likewise.
1525         (CXXCOMPILE1): Likewise.
1526         (CXXLINK1): Likewise.
1527         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1528         (LINK): Likewise.
1529         (CXXCOMPILE): Likewise.
1530         (CXXLINK): Likewise.
1531         * testsuite/Makefile.in: Regenerated.
1532
1533 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1534
1535         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1536         on bad fwrite return.
1537
1538 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1539
1540         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1541         on val.
1542
1543 2012-10-23  Cary Coutant  <ccoutant@google.com>
1544
1545         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1546         * testsuite/Makefile.in: Regenerate.
1547         * testsuite/dwp_test.h: New source file.
1548         * testsuite/dwp_test_1.cc: New source file.
1549         * testsuite/dwp_test_1.s: New source file.
1550         * testsuite/dwp_test_1.sh: New source file.
1551         * testsuite/dwp_test_1b.cc: New source file.
1552         * testsuite/dwp_test_1b.s: New source file.
1553         * testsuite/dwp_test_2.cc: New source file.
1554         * testsuite/dwp_test_2.s: New source file.
1555         * testsuite/dwp_test_2.sh: New source file.
1556         * testsuite/dwp_test_main.cc: New source file.
1557         * testsuite/dwp_test_main.s: New source file.
1558
1559 2012-10-23  Cary Coutant  <ccoutant@google.com>
1560
1561         * dwp.h: New header file.
1562         * dwp.cc: New source file.
1563         * gold.h: Move shared declarations to system.h.
1564         * system.h: New header file.
1565         * Makefile.am: Add dwp.
1566         * Makefile.in: Regenerate.
1567
1568 2012-10-23  Cary Coutant  <ccoutant@google.com>
1569
1570         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1571         Dwarf_info_reader::read_from_pointer.
1572         (Dwarf_pubnames_table::read_header): Likewise.
1573         (Dwarf_pubnames_table::next_name): Likewise.
1574         (Dwarf_die::read_attributes): Likewise.
1575         (Dwarf_die::skip_attributes): Likewise.
1576         (Dwarf_info_reader::read_from_pointer): New function template.
1577         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1578         (Dwarf_pubnames_table): Likewise.
1579         (Dwarf_info_reader::read_from_pointer): New function template.
1580         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1581         Dwarf_pubnames_table ctor.
1582
1583 2012-10-23  Cary Coutant  <ccoutant@google.com>
1584
1585         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1586         abbrev_shndx.
1587         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1588         abbrev_shndx_.
1589         (Dwarf_info_reader::set_abbrev_shndx): New method.
1590         (Dwarf_info_reader::abbrev_shndx_): New data member.
1591
1592 2012-10-23  Cary Coutant  <ccoutant@google.com>
1593
1594         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1595         from object, not parameters.
1596         (Dwarf_info_reader::parse): Likewise.
1597         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1598         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1599         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1600         methods.
1601
1602 2012-10-23  Cary Coutant  <ccoutant@google.com>
1603
1604         * fileread.cc (Input_file::Input_file): New constructor.
1605         * fileread.h (class Input_file): Add new constructor.
1606
1607 2012-10-18  Alan Modra  <amodra@gmail.com>
1608
1609         PR gold/14727
1610         * object.cc (Relobj::is_section_name_included): Also match
1611         .sdata personality section.
1612
1613 2012-10-18  Alan Modra  <amodra@gmail.com>
1614
1615         * target-reloc.h (class Default_comdat_behavior): New, package up..
1616         (get_comdat_behaviour): ..this.
1617         (relocate_section): Add Relocate_comdat_behavior template arg,
1618         adjust code to suit.
1619         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1620         (Target_arm::scan_reloc_section): Likewise.
1621         * i386.cc (Target_i386::relocate_section): Likewise.
1622         * sparc.cc (Target_sparc::relocate_section): Likewise.
1623         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1624         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1625         * powerpc.cc (class Relocate_comdat_behavior): New.
1626         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1627         gold::relocate_section with new template arg.
1628
1629 2012-10-18  Alan Modra  <amodra@gmail.com>
1630
1631         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1632         dynamic relocs for GOT_TPREL got entries, without symbol if
1633         resolving locally.
1634         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1635         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1636         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1637
1638 2012-10-17  Alan Modra  <amodra@gmail.com>
1639
1640         PR gold/14726
1641         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1642
1643 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1644
1645         * layout.cc (Layout::include_section): Keep sections marked
1646         SHF_EXCLUDE when doing relocatable links.
1647
1648 2012-10-16  Alan Modra  <amodra@gmail.com>
1649
1650         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1651         (Target_powerpc::do_finalize_sections): Call it.
1652         (Output_data_save_res): New class and supporting functions.
1653         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1654         normal symbols defined in object files.
1655
1656 2012-10-12  Alan Modra  <amodra@gmail.com>
1657
1658         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1659         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1660         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1661         section if scan_opd_relocs not yet called.
1662         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1663
1664 2012-10-12  Alan Modra  <amodra@gmail.com>
1665
1666         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1667         add_local_ifunc_entry): Revert last change.
1668         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1669
1670 2012-10-05  Alan Modra  <amodra@gmail.com>
1671
1672         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1673         do_plt_address_for_global): New functions.
1674         (Output_data_got_powerpc::do_write): Don't segfault when linking
1675         statically.
1676         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1677         add_local_ifunc_entry): Return true on adding entry..
1678         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1679         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1680         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1681         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1682         set up symbols here.
1683         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1684         syms here.  Do so even when no .iplt.  Don't segfault when linking
1685         statically.
1686         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1687         new variants without reloc param.
1688         (Glink_sym_ent::Glink_sym_ent): Likewise.
1689         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1690         reloc when refs will resolve to plt call stub.
1691         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1692         R_PPC_PLTREL24 to resolve locally.
1693         (Target_powerpc::Scan::global): Correct ifunc handling.
1694         (Target_powerpc::Relocate::relocate): Correct local sym glink
1695         lookup.  Don't destroy "value" when we have a plt call stub,
1696         and when checking plt call validity.
1697         (Target_powerpc::do_dynsym_value): Simplify.
1698
1699 2012-10-05  Alan Modra  <amodra@gmail.com>
1700
1701         * i386.cc (Output_data_plt_i386::address_for_global,
1702         address_for_local): Add plt offset to returned value.  Adjust uses.
1703         * sparc.cc (Output_data_plt_sparc::address_for_global,
1704         address_for_local): Likewise.
1705         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1706         address_for_local): Likewise.
1707         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1708         address_for_local): Likewise.
1709         * target.h (Target::plt_address_for_global, plt_address_for_local):
1710         Update comment.
1711         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1712         (Output_data_got::Got_entry::write): Nor here.
1713         * output.h: Comment fix.
1714
1715 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1716
1717         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1718         global_offset_table_ value for larget got.
1719         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1720
1721 2012-09-29  Alan Modra  <amodra@gmail.com>
1722
1723         * powerpc.cc (Target_powerpc::iplt_): New output section.
1724         (Target_powerpc::iplt_section, make_iplt_section,
1725         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1726         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1727         Target_powerpc::plt_entry_count): Count iplt entries too.
1728         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1729         reloc section in constructor.  New params.
1730         (Target_powerpc::make_plt_section): Create reloc section here instead.
1731         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1732         functions.
1733         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1734         (Output_data_glink::add_entry, find_entry): New functions to
1735         deal with local syms.
1736         (Glink_sym_ent): Add support for local syms.
1737         (Output_data_glink::do_write): Handle ifunc plt entries.
1738         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1739         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1740         (Target_powerpc::Relocate::relocate): Likewise.
1741         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1742
1743 2012-09-25  Alan Modra  <amodra@gmail.com>
1744
1745         * object.h (Sized_relobj_file::adjust_local_symbol,
1746         do_adjust_local_symbol): New functions.
1747         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1748         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1749         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1750         and irregular opd entry spacing.
1751         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1752         (Global_symbol_visitor_opd): New functor.
1753         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1754         on deleted opd entries.
1755
1756 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1757
1758         * tilegx.cc: New file.
1759         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1760         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1761         * configure.tgt: Add entries for tilegx*.
1762         * configure.ac: Likewise.
1763         * Makefile.in: Rebuild.
1764         * configure: Likewise.
1765         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1766         tilegx.
1767
1768 2012-09-13  Alan Modra  <amodra@gmail.com>
1769
1770         * target-reloc.h (scan_relocs): Call scan.local for relocs
1771         against symbols in discarded sections.  Pass is_discarded
1772         param.
1773         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1774         Add is_discarded param.
1775         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1776         is_discarded to flag opd entry as discarded.  Don't emit dyn
1777         relocs on such entries.
1778         (Target_powerpc::Scan::global): Similarly detect and handle
1779         such opd entries.
1780         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1781         opd_ent_.  Update all uses.
1782         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1783         (Target_powerpc::relocate_section): Zero out discarded opd
1784         entry relocs.
1785
1786 2012-09-12  Ian Lance Taylor  <iant@google.com>
1787
1788         PR gold/14570
1789         * output.cc: Rename Output_data_got template parameter from size
1790         to got_size for all functions.  Compile all variants of
1791         Output_data_got.
1792         (Output_data_got::Got_entry::write): Correct use of size for
1793         symbol value.  Use local_is_tls rather than casting to
1794         Sized_relobj_file.
1795         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1796         (class Sized_relobj_file): Add do_local_is_tls.
1797         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1798
1799 2012-09-11  Alan Modra  <amodra@gmail.com>
1800
1801         PR gold/14566
1802         * layout.cc (Layout::set_segment_offsets): When using
1803         common-page-size alignment, ensure we are on a new max-page-size
1804         page.
1805         * output.cc (Output_segment::set_section_addresses): Use
1806         abi_pagesize, not common_pagesize for relro boundary.
1807         (Output_segment::set_offset): Likewise.
1808
1809 2012-09-11  Alan Modra  <amodra@gmail.com>
1810
1811         * output.h (Output_data_got::add_global_tls, add_local_tls,
1812         add_local_tls_pair): New functions.
1813         (Output_data_got::add_local_pair_with_rel): Remove second
1814         reloc param.  Expand comment.
1815         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1816         use_plt_or_tls_offset_, similarly for constructor param.
1817         (Output_data_got::Got_entry::write): Add got_index param.
1818         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1819         add_local_tls_pair): New functions.
1820         (Output_data_got::Got_entry::write): Handle tls symbols
1821         with use_plt_or_tls_offset_ set specially.
1822         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1823         (Output_data_got::do_write): Replace iterator with index, pass
1824         index to entry write function.
1825         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1826         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1827         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1828         call.
1829         * i386.cc (Target_i386::Scan::local): Likewise.
1830         * sparc.cc (Target_sparc::Scan::local): Likewise.
1831         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1832         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1833         do_tls_offset_for_global): New functions.
1834         (Target_powerpc::Scan::local): Correct TLS relocations and got
1835         entry values.
1836         (Target_powerpc::Scan::global): Don't emit unnecessary
1837         dynamic relocations on TLS GOT entries.
1838
1839 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1840
1841         * config.in: Disable sanity check for kfreebsd.
1842
1843 2012-09-10  Sterling Augustine  <saugustine@google.com>
1844
1845         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1846         (Gdb_index::pubtypes_read): New parameter.
1847         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1848         to calls.
1849         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1850         pubtypes_object_.
1851
1852 2012-09-09  Alan Modra  <amodra@gmail.com>
1853
1854         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1855         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1856         * gc.h (gc_process_relocs): Call target gc_add_reference.
1857         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1858         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1859         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1860         unnecessary cast.
1861         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1862         to cater for when we don't need code offset.  Update use.
1863         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1864         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1865         set_opd_valid): New functions.
1866         (Target_powerpc::do_gc_add_reference): New function.
1867         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1868         stashed refs.
1869         (Target_powerpc::do_gc_mark_symbol): New function.
1870
1871 2012-09-06  Cary Coutant  <ccoutant@google.com>
1872
1873         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1874         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1875         (Dwarf_die::skip_attributes): Likewise.
1876         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1877         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1878         (main): Call it.
1879         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1880
1881 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1882
1883         * testsuite/script_test_3.t: Add .got.plt output section
1884         statement.
1885         * testsuite/script_test_4.t: Likewise.
1886
1887 2012-09-05  Alan Modra  <amodra@gmail.com>
1888
1889         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1890         update all uses and lose "enum" when using type.
1891
1892 2012-09-05  Alan Modra  <amodra@gmail.com>
1893
1894         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1895         * configure: Regenerate.
1896         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1897         (plugin_final_layout.stdout): Likewise.
1898         (memory_test): Set page sizes to 0x1000.
1899         * testsuite/Makefile.in: Regenerate.
1900         * testsuite/discard_locals_test.sh: Add FIXME comment.
1901         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1902         * testsuite/pr14265.t: Add .got output section statement.
1903         * testsuite/script_test_2.t: Likewise.
1904         * testsuite/script_test_3.t: Likewise.
1905         * testsuite/script_test_4.t: Likewise.
1906         * testsuite/script_test_5.t: Likewise.
1907         * testsuite/script_test_6.t: Likewise.
1908         * testsuite/script_test_7.t: Likewise.
1909         * testsuite/script_test_9.t: Likewise.
1910
1911 2012-09-05  Alan Modra  <amodra@gmail.com>
1912
1913         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1914         (Powerpc_relocate_functions::Status): New typedef.
1915         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1916         (Target_powerpc::Scan::local): Handle REL64.
1917         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1918         for REL32 and REL64.
1919         (Target_powerpc::symval_for_branch): New function, extracted from..
1920         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1921         checks.  Report overflow errors.
1922
1923 2012-09-05  Alan Modra  <amodra@gmail.com>
1924
1925         * object.h (Sized_relobj_file::emit_relocs): Delete.
1926         (Sized_relobj_file::emit_relocs_reltype): Delete.
1927         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1928         relocate_relocs for --emit-relocs.
1929         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1930         * output.h: Update comment.
1931         (Output_segment::first_section): New function.
1932         (Output_segment::first_section_load_address): Use first_section.
1933         * output.cc (Output_segment::first_section): New function extracted..
1934         (Output_segment::first_section_load_address): ..from here.  Delete.
1935         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1936         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1937         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1938         adjust call to target.h function.
1939         * i386.cc (Target_i386): Likewise.
1940         * sparc.cc (Target_sparc): Likewise.
1941         * x86_64.cc (Target_x86_64): Likewise.
1942         * powerpc.cc (Target_powerpc): Likewise.
1943         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1944         first tls section has section symbol for optimised local dynamic
1945         output relocs.
1946         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1947         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1948         optimised tls code.
1949         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1950         Rename to relocate_relocs.  Update error message.
1951
1952 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1953
1954         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1955         --just-symbols.
1956
1957 2012-08-31  Alan Modra  <amodra@gmail.com>
1958
1959         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1960         (Powerpc_relobj::toc_base_offset): New stub function.
1961         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1962         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1963         (Target_powerpc::Relocate::enum skip_tls): New.
1964         (Target_powerpc::call_tls_get_addr_): New var.
1965         (Target_powerpc::is_branch_reloc): Move to file scope.
1966         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1967         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1968         New functions.
1969         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1970         (powerpc_info): Correct common_pagesize for ppc64.
1971         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1972         (Powerpc_relocate_functions): Add overflow check enums and functions.
1973         Add non-shift version of rela, rela_ua.  Delete all rel public
1974         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1975         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1976         addr16_ha3, addr14 functions.
1977         (Output_data_got_powerpc::add_constant_pair): New function.
1978         (Output_data_got_powerpc::got_base_offset): Likewise.
1979         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1980         (instruction constants): Sort, add some more.
1981         (Output_data_glink::do_write): Add and use Address typedef.  Use
1982         object->toc_base_offset() stub for 64-bit.
1983         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1984         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1985         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1986         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1987         Always treat .opd relocs as against locally defined symbol.
1988         Correct condition for RELATIVE relocs.
1989         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1990         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1991         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1992         calculations.  Handle TLS relocs, and more.  Add overflow
1993         checking and adjust for Powerpc_relocate_functions changes.
1994         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1995         Reinstate --emit-relocs code with FIXME.
1996
1997 2012-08-30  Alan Modra  <amodra@gmail.com>
1998
1999         * layout.cc (Layout::set_segment_offsets): Set p_align to
2000         abi_pagesize, not common_pagesize.
2001         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2002         to determine whether file header can go in segment.
2003
2004 2012-08-30  Alan Modra  <amodra@gmail.com>
2005
2006         * output.h (Output_reloc::Output_reloc <output section>): Add
2007         is_relative param.  Adjust calls.
2008         (Output_reloc::add_output_section_relative): New functions.
2009         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2010         is_relative.
2011         (Output_reloc::symbol_value): Handle SECTION_CODE.
2012
2013 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2014
2015         * gold.cc (queue_middle_tasks): Call layout again when unique
2016         segments for sections is desired.
2017         * layout.cc (Layout::Layout): Initialize new members.
2018         (Layout::get_output_section_flags): New function.
2019         (Layout::choose_output_section): Call get_output_section_flags.
2020         (Layout::layout): Make output section for mapping to a unique segment.
2021         (Layout::insert_section_segment_map): New function.
2022         (Layout::attach_allocated_section_to_segment): Make unique segment for
2023         output sections marked so.
2024         (Layout::segment_precedes): Check for unique segments when sorting.
2025         * layout.h (Layout::Unique_segment_info): New struct.
2026         (Layout::Section_segment_map): New typedef.
2027         (Layout::insert_section_segment_map): New function.
2028         (Layout::get_output_section_flags): New function.
2029         (Layout::is_unique_segment_for_sections_specified): New function.
2030         (Layout::set_unique_segment_for_sections_specified): New function.
2031         (Layout::unique_segment_for_sections_specified_): New member.
2032         (Layout::section_segment_map_): New member.
2033         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2034         Rename is_gc_pass_one to is_pass_one.
2035         Rename is_gc_pass_two to is_pass_two.
2036         Rename is_gc_or_icf to is_two_pass.
2037         Check for which pass based on whether symbols data is present.
2038         Make it two pass when unique segments for sections is desired.
2039         * output.cc (Output_section::Output_section): Initialize new
2040         members.
2041         * output.h (Output_section::is_unique_segment): New function.
2042         (Output_section::set_is_unique_segment): New function.
2043         (Output_section::is_unique_segment_): New member.
2044         (Output_section::extra_segment_flags): New function.
2045         (Output_section::set_extra_segment_flags): New function.
2046         (Output_section::extra_segment_flags_): New member.
2047         (Output_section::segment_alignment): New function.
2048         (Output_section::set_segment_alignment): New function.
2049         (Output_section::segment_alignment_): New member.
2050         (Output_segment::Output_segment): Initialize is_unique_segment_.
2051         (Output_segment::is_unique_segment): New function.
2052         (Output_segment::set_is_unique_segment): New function.
2053         (Output_segment::is_unique_segment_): New member.
2054         * plugin.cc (allow_unique_segment_for_sections): New function.
2055         (unique_segment_for_sections): New function.
2056         (Plugin::load): Add new functions to transfer vector.
2057         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2058         * Makefile.in: Regenerate.
2059         * testsuite/plugin_final_layout.sh: Check if unique segment
2060         functionality works.
2061         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2062         are available.
2063         (allow_unique_segment_for_sections): New global.
2064         (unique_segment_for_sections): New global.
2065         (claim_file_hook): Call allow_unique_segment_for_sections.
2066         (all_symbols_read_hook): Call unique_segment_for_sections.
2067
2068 2012-08-22  Cary Coutant  <ccoutant@google.com>
2069
2070         * layout.cc (Layout::include_section): Don't assert on GROUP
2071         sections with --emit-relocs.
2072
2073 2012-08-21  Cary Coutant  <ccoutant@google.com>
2074
2075         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2076         if --export-dynamic-symbol names an undef symbol.
2077
2078 2012-08-18  Alan Modra  <amodra@gmail.com>
2079
2080         * powerpc.cc: Formatting and white space.
2081         (Powerpc_relobj): Rename got2_section_ to special_.
2082         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2083         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2084         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2085         (Target_powerpc): Add Address typedef and invalid_address.  Use
2086         throughout.
2087         (Target_powerpc::is_branch_reloc): New function.
2088         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2089         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2090         for dst_mask, value and addend.
2091         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2092         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2093         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2094         uint16_t for 24-bit offset.  Use get_output_section_offset and
2095         check return.
2096         (Target_powerpc::Scan::local): Handle more relocs.
2097         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2098         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2099         Plug in toc restoring insn after plt calls.  Translate branches
2100         to function descriptor symbols to corresponding entry point.
2101         (Target_powerpc::relocate_for_relocatable): Check return from
2102         get_output_section_offset.
2103         * symtab.h: Comment typo.
2104
2105 2012-08-14  Ian Lance Taylor  <iant@google.com>
2106
2107         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2108         unsupported_relocal_local to call unsupported_reloc_global.
2109
2110 2012-08-14  Nick Clifton  <nickc@redhat.com>
2111
2112         PR ld/14265
2113         * script-sections.cc (Sections_element::output_section_name): Add
2114         keep return parameter.
2115         (Output_section_element::match_name): Add keep return parameter.
2116         Return the value of the keep_ member.
2117         * script-sections.h (class Output_section): Update
2118         output_section_name prototype.
2119         * layout.cc (Layout::keep_input_section): New public member
2120         function.
2121         (Layout::choose_output_section): Pass keep parameter to
2122         output_section_name.
2123         * layout.h (class Layout): Add keep_input_section.
2124         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2125         sections.
2126         * testsuite/Makefile.am: Add a test.
2127         * testsuite/Makefile.in: Regenerate.
2128         * testsuite/pr14265.c: Source file for the test.
2129         * testsuite/pr14265.t: Linker script for the test.
2130         * testsuite/pr14265.sh: Shell script for the test.
2131
2132 2012-08-14  Alan Modra  <amodra@gmail.com>
2133
2134         * target.h (Target::output_section_name): New function.
2135         (Target::do_output_section_name): New function.
2136         * layout.cc (Layout::choose_output_section): Call the above.
2137         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2138
2139 2012-08-14  Alan Modra  <amodra@gmail.com>
2140
2141         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2142         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2143         for replace_constant call.
2144         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2145         (Output_data_glink::do_print_to_mapfile): New function.
2146         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2147         (Target_powerpc::Relocate::relocate): Likewise.
2148
2149 2012-08-14  Alan Modra  <amodra@gmail.com>
2150
2151         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2152         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2153         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2154         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2155         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2156         here.
2157         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2158         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2159         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2160         here.
2161         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2162         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2163
2164 2012-08-12  Alan Modra  <amodra@gmail.com>
2165
2166         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2167         (glink insn constants): Use uint32_t.
2168         (Output_data_glink::add_entry): Use insert, not [] operator.
2169
2170 2012-08-11  Alan Modra  <amodra@gmail.com>
2171
2172         * object.h (Sized_relobj_file::find_shdr): New function.
2173         (Sized_relobj_file::find_special_sections): New function.
2174         * object.cc (Sized_relobj_file::find_shdr): New function.
2175         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2176         (Sized_relobj_file::find_special_sections): New function, split out..
2177         (Sized_relobj_file::do_read_symbols): ..from here.
2178         * output.h (Output_data_got::replace_constant): New function.
2179         (Output_data_got::num_entries): New function.
2180         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2181         (Output_data_got::got_offset): Protected rather than private.
2182         (Output_data_got::replace_got_entry): New function.
2183         * output.cc (Output_data_got::replace_got_entry): New function.
2184         * powerpc.cc (class Powerpc_relobj): New.
2185         (class Powerpc_relocate_functions): Delete all psymval variants or
2186         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2187         Implement _ha functions using corresponding _hi function.
2188         (Powerpc_relobj::find_special_sections): New function.
2189         (Target_powerpc::do_make_elf_object): New function.
2190         (class Output_data_got_powerpc): New.
2191         (class Output_data_glink): New.
2192         (class Powerpc_scan_relocatable_reloc): New.
2193         Many more changes througout file.
2194
2195 2012-08-09  Nick Clifton  <nickc@redhat.com>
2196
2197         * po/vi.po: Updated Vietnamese translation.
2198
2199 2012-08-07  Ian Lance Taylor  <iant@google.com>
2200
2201         * layout.cc (Layout::add_target_dynamic_tags): If
2202         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2203         plt_rel.
2204
2205 2012-07-30  Nick Clifton  <nickc@redhat.com>
2206
2207         * po/gold.pot: Updated template.
2208         * po/es.po: Updated Spanish translation.
2209
2210 2012-07-18  Cary Coutant  <ccoutant@google.com>
2211
2212         PR gold/14344
2213         * configure.ac: Add check for -gpubnames support.
2214         * configure: Regenerate.
2215         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2216         support; force -gno-pubnames.
2217         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2218         support.
2219         (gdb_index_test_4): New test.
2220         * testsuite/Makefile.in: Regenerate.
2221         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2222         * testsuite/gdb_index_test_2.sh: Likewise.
2223         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2224         * testsuite/gdb_index_test_4.sh: New script.
2225         * testsuite/gdb_index_test_comm.sh: New script with common code;
2226         don't look for space after colon.
2227
2228 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2229
2230         * gold.cc (queue_middle_tasks): Update function order only after
2231         deferred objects due to plugins are processed.
2232
2233 2012-07-11  Ian Lance Taylor  <iant@google.com>
2234
2235         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2236         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2237         (Target_arm::scan_reloc_for_stub): Likewise.
2238         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2239         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2240         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2241         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2242         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2243
2244 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2245             Ian Lance Taylor  <iant@google.com>
2246
2247         PR gold/14309
2248         * configure.ac: Test whether std::tr1::hash<off_t> works.
2249         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2250         needed.
2251         * output.h (class Output_fill): Add virtual destructor.
2252         * configure, config.in: Rebuild.
2253
2254 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2255
2256         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2257
2258 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2259
2260         * plugin.cc (Plugin::load): Handle position independent executables.
2261
2262 2012-06-06  Cary Coutant  <ccoutant@google.com>
2263
2264         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2265         add .debug_macro.
2266         (lines_only_debug_sections): Likewise.
2267         (gdb_fast_lookup_sections): New static array.
2268         (is_gdb_debug_section): Rename formal parameter.
2269         (is_lines_only_debug_section): Likewise.
2270         (is_gdb_fast_lookup_section): New function.
2271         (Layout::include_section): Check for ".zdebug_" prefix; pass
2272         section name suffix to is_gdb_debug_section, et al.; check for
2273         fast-lookup sections when building .gdb_index.
2274         * options.h (--strip-debug-gdb): Update GDB version number.
2275
2276 2012-06-06  Cary Coutant  <ccoutant@google.com>
2277
2278         * configure.ac: Add check for fallocate.
2279         * configure: Regenerate.
2280         * config.in: Regenerate.
2281
2282         * options.h (class General_options): Add --mmap-output-file and
2283         --posix-fallocate options.
2284         * output.cc: (posix_fallocate): Remove; replace with...
2285         (gold_fallocate): New function.
2286         (Output_file::map_no_anonymous): Call gold_fallocate.
2287         (Output_file::map): Check --mmap-output-file option.
2288
2289 2012-06-05  Jing Yu  <jingyu@google.com>
2290
2291         * gold.h (textdomain): Add do {} to empty while(0).
2292         (bindtextdomain): Likewise.
2293
2294 2012-06-04  Cary Coutant  <ccoutant@google.com>
2295
2296         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2297         has_dynsym_index.
2298
2299 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2300
2301         * symtab.cc (Symbol_table::define_special_symbol):
2302         Initialize *poldsym to prevent uninitialized variable errors.
2303
2304 2012-05-23  Cary Coutant  <ccoutant@google.com>
2305
2306         * layout.cc (Layout::section_name_mapping): Add rules to handle
2307         exact match on .data.rel.ro.local or .data.rel.ro.
2308         (Layout::output_section_name): Check for exact matches.
2309
2310 2012-05-23  Cary Coutant  <ccoutant@google.com>
2311
2312         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2313         more carefully.
2314
2315 2012-05-22  Cary Coutant  <ccoutant@google.com>
2316
2317         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2318         object before exporting symbol.
2319
2320 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2321
2322         * testsuite/tls_test.cc: Include "config.h" first.
2323         * testsuite/tls_test_c.c: Likewise.
2324
2325 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2326             Nick Clifton  <nickc@redhat.com>
2327
2328         PR 14072
2329         * configure.in: Add check that sysdep.h has been included before
2330         any system header files.
2331         * configure: Regenerate.
2332         * config.in: Regenerate.
2333
2334 2012-05-14  Cary Coutant  <ccoutant@google.com>
2335
2336         * layout.cc (Layout::make_output_section): Mark .tdata section
2337         as RELRO.
2338         * testsuite/relro_test.cc: Add a TLS variable.
2339
2340 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2341
2342         PR gold/14091
2343         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2344         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2345         R_X86_64_64.
2346
2347 2012-05-08  Cary Coutant  <ccoutant@google.com>
2348
2349         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2350         (lines_only_debug_sections): Likewise.
2351
2352 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2353
2354         * nacl.cc: New file.
2355         * nacl.h: New file.
2356         * Makefile.am (CCFILES, HFILES): Add them.
2357         * Makefile.in: Regenerate.
2358         * i386.cc (Output_data_plt_i386_nacl): New class.
2359         (Output_data_plt_i386_nacl_exec): New class.
2360         (Output_data_plt_i386_nacl_dyn): New class.
2361         (Target_i386_nacl): New class.
2362         (Target_selector_i386_nacl): New class.
2363         (target_selector_i386): Use it instead of Target_selector_i386.
2364         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2365         (Target_x86_64_nacl): New class.
2366         (Target_selector_x86_64_nacl): New class.
2367         (target_selector_x86_64, target_selector_x32): Use it instead of
2368         Target_selector_x86_64.
2369         * arm.cc (Output_data_plt_arm_nacl): New class.
2370         (Target_arm_nacl): New class.
2371         (Target_selector_arm_nacl): New class.
2372         (target_selector_arm, target_selector_armbe): Use it instead of
2373         Target_selector_arm.
2374
2375         * target-select.cc (select_target): Take new Input_file* and off_t
2376         arguments, pass them on to recognize method of selector.
2377         * object.cc (make_elf_sized_object): Update caller.
2378         * parameters.cc (parameters_force_valid_target): Likewise.
2379         * incremental.cc (make_sized_incremental_binary): Likewise.
2380         * target-select.h: Update decl.
2381         (Target_selector::recognize): Take new Input_file* argument,
2382         pass it on to do_recognize.
2383         (Target_selector::do_recognize): Take new Input_file* argument.
2384         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2385         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2386         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2387         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2388
2389         * target.h (Target::Target_info): New members isolate_execinstr
2390         and rosegment_gap.
2391         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2392         * arm.cc (Target_arm::arm_info): Update initializer.
2393         * i386.cc (Target_i386::i386_info): Likewise.
2394         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2395         * sparc.cc (Target_sparc::sparc_info): Likewise.
2396         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2397         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2398         * layout.cc (Layout::attach_allocated_section_to_segment):
2399         Take new const Target* argument.  If target->isolate_execinstr(), act
2400         like --rosegment.
2401         (Layout::find_first_load_seg): Take new const Target* argument;
2402         if target->isolate_execinstr(), reject PF_X segments.
2403         (Layout::relaxation_loop_body): Update caller.
2404         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2405         reset file offset to zero when we hit LOAD_SEG, and then do a second
2406         loop over the segments before LOAD_SEG to reassign offsets after
2407         addresses have been determined.  Handle target->rosegment_gap().
2408         (Layout::attach_section_to_segment): Take new const Target* argument;
2409         pass it to attach_allocated_section_to_segment.
2410         (Layout::make_output_section): Update caller.
2411         (Layout::attach_sections_to_segments): Take new const Target* argument;
2412         pass it to attach_section_to_segment.
2413         * gold.cc (queue_middle_tasks): Update caller.
2414         * layout.h (Layout): Update method decls with new arguments.
2415
2416         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2417         Target_info pointer to use.
2418         (Target_arm::do_make_data_plt): New virtual method.
2419         (Target_arm::make_data_plt): New method that calls it.
2420         (Target_arm::make_plt_entry): Use it.
2421         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2422         for the section alignment.
2423         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2424         method.
2425         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2426         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2427         method.
2428         (Output_data_plt_arm::get_plt_entry_size): Call it.
2429         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2430         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2431         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2432         method.
2433         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2434         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2435         method instead of sizeof(plt_entry).
2436         (Output_data_plt_arm::add_entry): Likewise.
2437         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2438         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2439         than static method.
2440         (Target_arm::plt_entry_size): Likewise.
2441         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2442         Move to ...
2443         (Output_data_plt_arm_standard): ... here, new class.
2444         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2445         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2446         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2447
2448         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2449         Take additional argument for the PLT entry size.
2450         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2451         Use get_plt_entry_size method rather than plt_entry_size variable.
2452         (Output_data_plt_x86_64::reserve_slot): Likewise.
2453         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2454         (Output_data_plt_x86_64::add_entry): Likewise.
2455         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2456         (Output_data_plt_x86_64::address_for_global): Likewise.
2457         (Output_data_plt_x86_64::address_for_local): Likewise.
2458         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2459         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2460         Make method non-static.
2461         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2462         method.
2463         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2464         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2465         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2466         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2467         virtual method.
2468         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2469         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2470         virtual method.
2471         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2472         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2473         virtual method.
2474         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2475         (Output_data_plt_x86_64::plt_entry_size)
2476         (Output_data_plt_x86_64::first_plt_entry)
2477         (Output_data_plt_x86_64::plt_entry)
2478         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2479         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2480         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2481         (Output_data_plt_x86_64_standard): ... here, new class.
2482         (Target_x86_64::Target_x86_64): Take optional argument for the
2483         Target_info pointer to use.
2484         (Target_x86_64::do_make_data_plt): New virtual method.
2485         (Target_x86_64::make_data_plt): New method to call it.
2486         (Target_x86_64::init_got_plt_for_update): Use that.
2487         Call this->plt_->add_eh_frame method here.
2488         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2489         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2490         rather than static method.
2491         (Target_x86_64::plt_entry_size): Likewise.
2492         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2493         rather than plt_entry_size variable.  Move guts of PLT filling to...
2494         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2495         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2496         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2497
2498         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2499         additional argument for the section alignment.
2500         Don't do add_eh_frame_for_plt here.
2501         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2502         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2503         variable.
2504         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2505         method.
2506         (Output_data_plt_i386::get_plt_entry_size): Call it.
2507         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2508         (Output_data_plt_i386::add_eh_frame): New method to call it.
2509         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2510         method.
2511         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2512         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2513         method.
2514         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2515         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2516         method instead of plt_entry_size.
2517         (Output_data_plt_i386::plt_entry_size)
2518         (Output_data_plt_i386::plt_eh_frame_fde_size)
2519         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2520         (Output_data_plt_i386_standard): ... here, new class.
2521         (Output_data_plt_i386_exec): New class.
2522         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2523         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2524         (Output_data_plt_i386::exec_plt_entry): Move to ...
2525         (Output_data_plt_i386_exec::plt_entry): ... here.
2526         (Output_data_plt_i386_dyn): New class.
2527         (Output_data_plt_i386::first_plt_entry): Move to ...
2528         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2529         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2530         (Output_data_plt_i386_dyn::plt_entry): ... here.
2531         (Target_i386::Target_i386): Take optional argument for the Target_info
2532         pointer to use.
2533         (Target_i386::do_make_data_plt): New virtual method.
2534         (Target_i386::make_data_plt): New method to call it.
2535         (Target_i386::make_plt_section): Use that.
2536         Call this->plt_->add_eh_frame method here.
2537         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2538         rather than plt_entry_size variable.
2539         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2540         (Output_data_plt_i386::address_for_local): Likewise.
2541         (Output_data_plt_i386::do_write): Likewise.
2542         Move guts of PLT filling to...
2543         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2544         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2545         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2546         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2547
2548 2012-05-01  Cary Coutant  <ccoutant@google.com>
2549
2550         * dwarf_reader.cc (Dwarf_die::read_attributes)
2551         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2552         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2553         * reduced_debug_output.cc
2554         (Output_reduced_debug_info_section::get_die_end): Remove
2555         DW_FORM_GNU_ref_index.  Add default case.
2556
2557 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2558
2559         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2560         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2561         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2562         DW_AT_high_pc as offset from DW_AT_low_pc.
2563
2564         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2565         * testsuite/Makefile.in: Regenerate.
2566         * testsuite/gdb_index_test_3.c: New test source file.
2567         * testsuite/gdb_index_test_3.sh: New test source file.
2568
2569 2012-04-25  Ian Lance Taylor  <iant@google.com>
2570
2571         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2572         pointer.
2573         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2574         as a class, not a struct.
2575         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2576         (Target_arm::apply_cortex_a8_workaround): Likewise.
2577         * gc.h: Declare Reloc_types as a struct, not a class.
2578         * object.h: Declare Symbols_data as a struct.
2579         * reloc.h: Declare Read_relocs_data as a struct.
2580         * target.h: Declare Relocate_info as a struct.
2581
2582 2012-04-24  David S. Miller  <davem@davemloft.net>
2583
2584         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2585         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2586         and R_SPARC_WPLT30.
2587
2588 2012-04-24  Cary Coutant  <ccoutant@google.com>
2589
2590         * incremental-dump.cc (find_input_containing_global): Replace
2591         magic number with symbolic constant.
2592         (dump_incremental_inputs): Update version number.
2593         * incremental.cc (Output_section_incremental_inputs): Update version
2594         number; import symbolic constants from Incremental_inputs_reader.
2595         (Incremental_inputs::create_data_sections): Align relocations
2596         section correctly for 64-bit targets.
2597         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2598         constants; add padding.
2599         (Output_section_incremental_inputs::write_header): Add assert for
2600         header_size.
2601         (Output_section_incremental_inputs::write_input_files): Add assert
2602         for input_entry_size.
2603         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2604         add assert for object_info_size, input_section_entry_size,
2605         global_sym_entry_size.
2606         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2607         for data structure sizes; use them.
2608         (Incremental_input_entry_reader): Import symbolic constants from
2609         Incremental_inputs_reader; use them.
2610
2611 2012-04-23  David S. Miller  <davem@davemloft.net>
2612
2613         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2614         and elf_flags_set_.
2615         (Target_sparc::Target_sparc): Initialize new fields.
2616         (Target_sparc::do_make_elf_object): New function.
2617         (Target_sparc::do_adjust_elf_header): New function.
2618
2619 2012-04-23  Cary Coutant  <ccoutant@google.com>
2620
2621         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2622         CU range table of gdb index.
2623
2624 2012-04-20  David S. Miller  <davem@davemloft.net>
2625
2626         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2627         instead of false.
2628
2629 2012-04-16  David S. Miller  <davem@davemloft.net>
2630
2631         * sparc.cc (Target_sparc::got_address): New function.
2632         (Sparc_relocate_functions::gdop_hix22): New function.
2633         (Sparc_relocate_functions::gdop_lox10): New function.
2634         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2635         relocs.
2636         (Target_sparc::Scan::local): Likewise if the global symbol is not
2637         preemptible and is not IFUNC.
2638         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2639         transformations for local and non-preemptible non-IFUNC global
2640         symbols.
2641
2642         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2643         writing out 64-bit part of ranges.
2644
2645         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2646         -fpic and -fpie respectively.
2647         * Makefile.in: Regenerate.
2648
2649         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2650         (Target_sparc::Target_sparc): Initialize new field.
2651         (Target_sparc::do_plt_section_for_global): New function.
2652         (Target_sparc::do_plt_section_for_local): New function.
2653         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2654         (Target_sparc::make_plt_section): New function, broken out of
2655         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2656         (Target_sparc::make_plt_entry): Call make_plt_section.
2657         (Target_sparc::make_local_ifunc_plt_entry): New function.
2658         (Target_sparc::rela_ifunc_section): New function.
2659         (Target_sparc::plt_section): Remove const.
2660         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2661         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2662         and ifunc_count_ fields.
2663         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2664         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2665         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2666         (Output_data_plt_sparc::rela_ifunc): New function.
2667         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2668         (Output_data_plt_sparc::has_ifunc_section): New function.
2669         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2670         (Output_data_plt_sparc::address_for_global): New function.
2671         (Output_data_plt_sparc::address_for_local): New function.
2672         (Output_data_plt_sparc::plt_index_to_offset): New function.
2673         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2674         and entry_count.
2675         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2676         entry_count.
2677         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2678         R_SPARC_JMP_IREL to switch.
2679         (Target_sparc::Scan::check_non_pic): Likewise.
2680         (Target_sparc::Scan::local): Handle IFUNC symbols.
2681         (Target_sparc::Scan::local): Likewise.
2682         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2683         and plt_address_for_local.
2684         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2685         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2686
2687         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2688         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2689         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2690         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2691         global relocs too.
2692         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2693         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2694         calls.
2695         * sparc.cc (Target_sparc::Scan::global): Likewise.
2696         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2697
2698 2012-04-16  Cary Coutant  <ccoutant@google.com>
2699
2700         * archive.cc (Library_base::should_include_member): Check for
2701         --export-dynamic-symbol.
2702         * options.h (class General_options): Add --export-dynamic-symbol.
2703         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2704         --export-dynamic-symbol.
2705         (Symbol_table::gc_mark_undef_symbols): Likewise.
2706         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2707
2708 2012-04-12  David S. Miller  <davem@davemloft.net>
2709
2710         * sparc.cc (Reloc::wdisp10): New relocation method.
2711         (Reloc::h34): Likewise.
2712         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2713         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2714         R_SPARC_WDISP10.
2715         (Target_sparc::Scan::local): Likewise.
2716         (Target_sparc::Scan::global): Likewise.
2717         (Target_sparc::Relocate::relocate): Likewise.
2718
2719 2012-04-09  Cary Coutant  <ccoutant@google.com>
2720
2721         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2722         low_pc == 0.
2723
2724 2012-04-06  Ian Lance Taylor  <iant@google.com>
2725
2726         * timer.cc: #include <unistd.h>.
2727
2728 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2729
2730         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2731         * config.in: Regenerate.
2732         * configure: Regenerate.
2733
2734 2012-04-05  Nick Clifton  <nickc@redhat.com>
2735
2736         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2737         (AM_LC_MESSAGES): Add.
2738         * aclocal.m4: Regenerate.
2739         * config.in: Regenerate.
2740         * configure: Regenerate.
2741
2742 2012-03-21  Cary Coutant  <ccoutant@google.com>
2743
2744         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2745         * Makefile.in: Regenerate.
2746         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2747         (Sized_elf_reloc_mapper::symbol_section): New function.
2748         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2749         (make_elf_reloc_mapper): New function.
2750         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2751         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2752         (Dwarf_abbrev_table::do_get_abbrev): New function.
2753         (Dwarf_ranges_table::read_ranges_table): New function.
2754         (Dwarf_ranges_table::read_range_list): New function.
2755         (Dwarf_pubnames_table::read_section): New function.
2756         (Dwarf_pubnames_table::read_header): New function.
2757         (Dwarf_pubnames_table::next_name): New function.
2758         (Dwarf_die::Dwarf_die): New function.
2759         (Dwarf_die::read_attributes): New function.
2760         (Dwarf_die::skip_attributes): New function.
2761         (Dwarf_die::set_name): New function.
2762         (Dwarf_die::set_linkage_name): New function.
2763         (Dwarf_die::attribute): New function.
2764         (Dwarf_die::string_attribute): New function.
2765         (Dwarf_die::int_attribute): New function.
2766         (Dwarf_die::uint_attribute): New function.
2767         (Dwarf_die::ref_attribute): New function.
2768         (Dwarf_die::child_offset): New function.
2769         (Dwarf_die::sibling_offset): New function.
2770         (Dwarf_info_reader::check_buffer): New function.
2771         (Dwarf_info_reader::parse): New function.
2772         (Dwarf_info_reader::do_parse): New function.
2773         (Dwarf_info_reader::do_read_string_table): New function.
2774         (Dwarf_info_reader::lookup_reloc): New function.
2775         (Dwarf_info_reader::get_string): New function.
2776         (Dwarf_info_reader::visit_compilation_unit): New function.
2777         (Dwarf_info_reader::visit_type_unit): New function.
2778         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2779         Sized_elf_reloc_mapper.
2780         (Sized_dwarf_line_info::symbol_section): Remove function.
2781         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2782         (Sized_dwarf_line_info::read_line_mappings): Remove object
2783         parameter, adjust callers.
2784         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2785         * dwarf_reader.h: Include <sys/types.h>.
2786         (class Track_relocs): Remove forward declaration.
2787         (class Elf_reloc_mapper): New class.
2788         (class Sized_elf_reloc_mapper): New class.
2789         (class Dwarf_abbrev_table): New class.
2790         (class Dwarf_range_list): New class.
2791         (class Dwarf_ranges_table): New class.
2792         (class Dwarf_pubnames_table): New class.
2793         (class Dwarf_die): New class.
2794         (class Dwarf_info_reader): New class.
2795         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2796         (Sized_dwarf_line_info::symbol_section): Remove member function.
2797         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2798         base class.
2799         * gdb-index.cc: New source file.
2800         * gdb-index.h: New source file.
2801         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2802         and .debug_types sections, call Layout::add_to_gdb_index.
2803         (Sized_relobj_incr::do_section_name): Implement.
2804         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2805         return type; Implement.
2806         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2807         return type.
2808         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2809         parameter list and return type.
2810         (Sized_incr_dynobj::do_section_contents): Likewise.
2811         * layout.cc: Include gdb-index.h.
2812         (Layout::Layout): Initialize gdb_index_data_.
2813         (Layout::init_fixed_output_section): Check for .gdb_index section.
2814         (Layout::add_to_gdb_index): New function. Instantiate.
2815         * layout.h: Add forward declaration for class Gdb_index.
2816         (Layout::add_to_gdb_index): New member function.
2817         (Layout::gdb_index_data_): New data member.
2818         * main.cc: Include gdb-index.h.
2819         (main): Print statistics for gdb index.
2820         * object.cc (Object::section_contents): Move code into
2821         do_section_contents.
2822         (need_decompressed_section): Check for sections needed when building
2823         gdb index.
2824         (build_compressed_section_map): Likewise.
2825         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2826         gdb index.
2827         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2828         sections; call Layout::add_to_gdb_index.
2829         (Sized_relobj_file::do_decompressed_section_contents): Call
2830         do_section_contents directly.
2831         * object.h (Object::do_section_contents): Adjust parameter list and
2832         return type.
2833         (Object::do_decompressed_section_contents): Call do_section_contents
2834         directly.
2835         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2836         return type.
2837         * options.h (class General_options): Add --gdb-index option.
2838         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2839         list and return type.
2840         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2841         * reloc.h (Track_relocs::checkpoint): New function.
2842         (Track_relocs::reset): New function.
2843
2844         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2845         New test cases.
2846         * testsuite/Makefile.in: Regenerate.
2847         * testsuite/gdb_index_test.cc: New test source file.
2848         * testsuite/gdb_index_test_1.sh: New test source file.
2849         * testsuite/gdb_index_test_2.sh: New test source file.
2850
2851 2012-03-19  Doug Kwan  <dougkwan@google.com>
2852
2853         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2854         (Target_arm::do_finalize_sections): Remove code which defines
2855         __exidx_start and __exidx_end.  Make symbol table parameter
2856         anonymous as it is not used.
2857         * gold.cc (queue_middle_tasks): Call target hook to define any
2858         target-specific symbols.
2859         * target.h (Target::define_standard_symbols): New method.
2860         (Target::do_define_standard_symbols): Same.
2861         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2862         * testsuite/Makefile.in: Regenerate.
2863         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2864         and __exidx_end.
2865         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2866         relocations are generated for __exidx_start and __exidx_end.
2867
2868 2012-03-16  Doug Kwan  <dougkwan@google.com>
2869
2870         * testsuite/Makefile.am: Disable test initpri3b.
2871         * testsuite/Makefile.in: Regenerate.
2872
2873 2012-03-15  Doug Kwan  <dougkwan@google.com>
2874
2875         * arm.cc (Target_arm::got_section): Make .got section read-only
2876         if -z now is given.
2877
2878 2012-03-15  Ian Lance Taylor  <iant@google.com>
2879
2880         PR gold/13850
2881         * layout.cc (Layout::make_output_section): Correctly mark
2882         SHT_INIT_ARRAY, et. al., as relro.
2883
2884 2012-03-14  Doug Kwan  <dougkwan@google.com>
2885
2886         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2887         dynamic relocations for protected symbols in shared objects.
2888
2889 2012-03-13  Ian Lance Taylor  <iant@google.com>
2890
2891         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2892         keep the larger alignment.
2893
2894 2012-03-12  Cary Coutant  <ccoutant@google.com>
2895
2896         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2897         handling of DW_LNE_define_file.
2898
2899 2012-03-12  Cary Coutant  <ccoutant@google.com>
2900
2901         * reduced_debug_output.cc
2902         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2903         codes to switch.
2904
2905 2012-02-29  Cary Coutant  <ccoutant@google.com>
2906
2907         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2908
2909 2012-02-29  Cary Coutant  <ccoutant@google.com>
2910
2911         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2912         Call Object::decompressed_section_contents.
2913         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2914         New dtor.
2915         (Sized_dwarf_line_info::buffer_start_): New data member.
2916         * merge.cc (Output_merge_data::do_add_input_section): Call
2917         Object::decompressed_section_contents.
2918         (Output_merge_string::do_add_input_section): Likewise.
2919         * object.cc (need_decompressed_section): New function.
2920         (build_compressed_section_map): Decompress sections needed later.
2921         (Sized_relobj_file::do_decompressed_section_contents): New function.
2922         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2923         * object.h (Object::decompressed_section_contents): New function.
2924         (Object::discard_decompressed_sections): New function.
2925         (Object::do_decompressed_section_contents): New function.
2926         (Object::do_discard_decompressed_sections): New function.
2927         (Compressed_section_info): New type.
2928         (Compressed_section_map): Include decompressed section contents.
2929         (Sized_relobj_file::do_decompressed_section_contents): New function.
2930         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2931
2932 2012-02-16  Cary Coutant  <ccoutant@google.com>
2933
2934         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2935         * testsuite/Makefile.in: Regenerate.
2936
2937 2012-02-14  Cary Coutant  <ccoutant@google.com>
2938
2939         * options.cc (General_options::finalize): Disallow -pie and -static.
2940
2941 2012-02-03  Doug Kwan  <dougkwan@google.com>
2942
2943         * arm.cc (Arm_relocate_functions::abs8,
2944         Arm_relocate_functions::abs16): Use
2945         Bits::has_signed_unsigned_overflow32.
2946         (Arm_relocate_functions::thm_abs8): Correct range of
2947         overflow check.
2948         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2949         in assertions.
2950
2951 2012-02-02  Doug Kwan  <dougkwan@google.com>
2952
2953         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2954         position independent outputs, not just shared objects.
2955
2956 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2957
2958         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2959         * configure: Regenerated.
2960
2961 2012-01-27  Ian Lance Taylor  <iant@google.com>
2962
2963         * reloc.h (Bits): New class with static functions, copied from
2964         namespace utils in arm.cc.
2965         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2966         instead.
2967
2968 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2969
2970         * incremental.cc (write_info_blocks): Correct relocation offset.
2971
2972 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2973
2974         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2975         (Relocate::tls_gd_to_le): Likewise.
2976
2977 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2978
2979         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2980
2981 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2982
2983         * configure.ac: Check if -mcmodel=medium works.
2984         * configure: Regenerated.
2985
2986 2012-01-24  Cary Coutant  <ccoutant@google.com>
2987
2988         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2989         definition and ...
2990         (read_unsigned_LEB_128_x): ... this new function.
2991         (read_signed_LEB_128): Replaced with inline definition and ...
2992         (read_signed_LEB_128_x): ... this new function.
2993         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2994         (read_unsigned_LEB_128): Add inline definition.
2995         (read_signed_LEB_128_x): New function.
2996         (read_signed_LEB_128): Add inline definition.
2997         * testsuite/Makefile.am (leb128_unittest): New unit test.
2998         * testsuite/Makefile.in: Regenerate.
2999         * testsuite/leb128_unittest.cc: New unit test.
3000
3001 2012-01-23  Ian Lance Taylor  <iant@google.com>
3002
3003         PR gold/13617
3004         * i386.cc (Target_i386::do_code_fill): When using a jmp
3005         instruction, pad with nop instructions.
3006         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3007
3008 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3009
3010         * x86_64.cc (gc_process_relocs): Add typename on types used in
3011         template.
3012         (scan_relocs): Likewise.
3013         (relocate_section): Likewise.
3014         (apply_relocation): Likewise.
3015
3016 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3017
3018         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3019         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3020         under x32.
3021
3022 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3023
3024         * x86_64.cc: Initial support for x32.
3025
3026 2012-01-03  Cary Coutant  <ccoutant@google.com>
3027
3028         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3029         Use abstract base class for GOT.
3030         * gold/output.h (class Output_data_got_base): New abstract base class.
3031         (class Output_data_got): Derive from new base class, adjust ctors.
3032         (Output_data_got::reserve_slot): Make virtual; rename to
3033         do_reserve_slot; Adjust callers.
3034         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3035         pointer to abstract base class.
3036         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3037
3038 2011-12-18  Ian Lance Taylor  <iant@google.com>
3039
3040         * object.h (Relobj::local_symbol_value): New function.
3041         (Relobj::local_plt_offset): New function.
3042         (Relobj::local_has_got_offset): New function.
3043         (Relobj::local_got_offset): New function.
3044         (Relobj::set_local_got_offset): New function.
3045         (Relobj::do_local_symbol_value): New pure virtual function.
3046         (Relobj::do_local_plt_offset): Likewise.
3047         (Relobj::do_local_has_got_offset): Likewise.
3048         (Relobj::do_local_got_offset): Likewise.
3049         (Relobj::do_set_local_got_offset): Likewise.
3050         (Sized_relobj::do_local_has_got_offset): Rename from
3051         local_has_got_offset.
3052         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3053         (Sized_relobj::do_set_local_got_offset): Rename from
3054         set_local_got_offset.
3055         (Sized_relobj_file::do_local_plt_offset): Rename from
3056         local_plt_offset.
3057         (Sized_relobj_file::do_local_symbol_value): New function.
3058         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3059         local_plt_offset.
3060         * output.cc (Output_data_got::Got_entry::write): Change object to
3061         Relobj.  Use local_symbol_value.
3062         (Output_data_got::add_global_with_rel): Change rel_dyn to
3063         Output_data_reloc_generic*.  Use add_global_generic.
3064         (Output_data_got::add_global_with_rela): Remove.  Change all
3065         callers to use add_global_with_rel.
3066         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3067         Output_data_reloc_generic*.  Use add_global_generic.
3068         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3069         callers to use add_global_pair_with_rel.
3070         (Output_data_got::add_local): Change object to Relobj*.
3071         (Output_data_got::add_local_plt): Likewise.
3072         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3073         change rel_dyn to Output_data_reloc_generic*.  Use
3074         add_local_generic.
3075         (Output_data_got::add_local_with_rela): Remove.  Change all
3076         callers to use all_local_with_rel.
3077         (Output_data_got::add_local_pair_with_rel): Change object to
3078         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3079         add_output_section_generic.
3080         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3081         callers to use add_local_pair_with_rel.
3082         (Output_data_got::reserve_local): Change object to Relobj*.
3083         * output.h: (class Output_data_reloc_generic): Add pure virtual
3084         declarations for add_global_generic, add_local_generic,
3085         add_output_section_generic.
3086         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3087         functions for Output_data_reloc_generic.  Update declarations for
3088         changes listed in output.cc.
3089         (class Output_data_got): Change template parameter to got_size.
3090         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3091         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3092         function.
3093         (Sized_relobj_incr::do_local_plt_offset): New function.
3094         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3095         add_global_generic.
3096
3097 2011-12-17  Cary Coutant  <ccoutant@google.com>
3098
3099         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3100         * resolve.cc (Symbol_table::resolve): Likewise.
3101         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3102         arrays.
3103         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3104
3105 2011-12-16  Ian Lance Taylor  <iant@google.com>
3106
3107         * output.h (Output_data_reloc_generic::add): Only call
3108         add_dynamic_reloc if this is a dynamic reloc section.
3109
3110 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3111
3112         PR gold/13505
3113         * target-reloc.h (apply_relocation): Replace <64, false> with
3114         <size, big_endian>.
3115
3116 2011-11-25  Nick Clifton  <nickc@redhat.com>
3117
3118         * po/it.po: New Italian translation.
3119
3120 2011-11-17  Sterling Augustine  <saugustine@google.com>
3121
3122         * script.cc (script_include_directive): Implement.
3123         (read_script_file): New local variables name and search_path. Update
3124         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3125         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3126         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3127
3128 2011-11-11  Sterling Augustine  <saugustine@google.com>
3129
3130         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3131         (file_or_sections_cmd): Likewise.
3132
3133 2011-11-11  Doug Kwan  <dougkwan@google.com>
3134
3135         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3136         if --just-symbols is given.
3137
3138 2011-11-10  Doug Kwan  <dougkwan@google.com>
3139
3140         PR gold/13362
3141         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3142         when processing data relocs.
3143         * reloc.h (Relocate_functions::rel_unaligned): New method.
3144         (Relocate_functions::pcrel_unaligned): Ditto.
3145         (Relocate_functions::rel32_unaligned): Ditto.
3146         (Relocate_functions::pcrel32_unaligned): Ditto.
3147
3148 2011-11-09  Doug Kwan  <dougkwan@google.com>
3149
3150         PR gold/13362
3151         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3152         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3153         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3154         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3155         (Relocate_functions::rel_unaligned): New.
3156         (Relocate_functions::rel32_unaligned): New.
3157         * target-reloc.h (relocate_for_relocatable): Add code to handle
3158         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3159         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3160         arm_unaligned_reloc_r): New targets.
3161         * testsuite/Makefile.in: Regenerate.
3162         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3163         linking.
3164
3165 2011-11-02  Ian Lance Taylor  <iant@google.com>
3166
3167         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3168         NATIVE_LINKER.
3169         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3170         * options.cc (General_options::finalize): Use library search path
3171         from configure script if specified.  If not native and no sysroot,
3172         only search TOOLLIBDIR.
3173         * options.h (Search_directory::Search_directory): Change name to
3174         const std::string&.
3175         (General_options::add_to_library_path_with_sysroot): Change arg to
3176         const std::string&.
3177         * configure, Makefile.in, config.in: Rebuild.
3178
3179 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3180
3181         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3182         we are working around the ARM1176 Erratum.
3183         * options.h (General_options::fix_arm1176): Add option.
3184         * testsuite/Makefile.am: Add testcases, and keep current ones
3185         working.
3186         * testsuite/Makefile.in: Regenerate.
3187         * testsuite/arm_fix_1176.s: New file.
3188         * testsuite/arm_fix_1176.sh: Likewise.
3189
3190 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3191
3192         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3193         may_use_blx_.
3194         (Target_arm::may_use_blx): Remove method.
3195         (Target_arm::set_may_use_blx): Likewise.
3196         (Target_arm::may_use_v4t_interworking): New method.
3197         (Target_arm::may_use_v5t_interworking): Likewise.
3198         (Target_arm::may_use_blx_): Remove member variable.
3199         (Arm_relocate_functions::arm_branch_common): Check for v5T
3200         interworking.
3201         (Arm_relocate_functions::thumb_branch_common): Likewise.
3202         (Reloc_stub::stub_type_for_reloc): Likewise.
3203         (Target_arm::do_finalize_sections): Correct interworking checks.
3204         * testsuite/Makefile.am: Add new tests.
3205         * testsuite/Makefile.in: Regenerate.
3206         * testsuite/arm_farcall_arm_arm.s: New test.
3207         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3208         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3209         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3210         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3211         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3212         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3213         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3214
3215 2011-10-31  Cary Coutant  <ccoutant@google.com>
3216
3217         PR gold/13023
3218         * expression.cc (Expression::eval_with_dot): Add
3219         is_section_dot_assignment parameter.
3220         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3221         absolute and assigning to dot within a section.
3222         * script-sections.cc
3223         (Output_section_element_assignment::set_section_addresses): Pass
3224         dot_section to set_if_absolute.
3225         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3226         as is_section_dot_assignment flag to eval_with_dot.
3227         (Output_section_element_dot_assignment::set_section_addresses):
3228         Likewise.
3229         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3230         parameter.  Also set value if relative to dot_section; set the
3231         symbol's output_section.
3232         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3233         parameter.  Adjust all callers.
3234         (Expression::eval_maybe_dot): Likewise.
3235         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3236         Adjust all callers.
3237         * testsuite/script_test_2.t: Test assignment of an absolute value
3238         to dot within an output section element.
3239
3240 2011-10-31  Cary Coutant  <ccoutant@google.com>
3241
3242         * options.h (class General_options): Add --[no-]gnu-unique options.
3243         * symtab.cc (Symbol_table::sized_write_globals): Convert
3244         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3245
3246 2011-10-31  Cary Coutant  <ccoutant@google.com>
3247
3248         PR gold/13359
3249         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3250         unnecessary assertion.
3251         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3252
3253 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3254
3255         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3256         gc_mark_symbol.
3257         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3258         gc_mark_symbol.
3259         Change to just keep the section associated with symbol.
3260         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3261         they are externally visible and --export-dynamic is turned on.
3262         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3263
3264 2011-10-19  Ian Lance Taylor  <iant@google.com>
3265
3266         PR gold/13163
3267         * script-sections.cc
3268         (Output_section_element_dot_assignment::needs_output_section): New
3269         function.
3270
3271 2011-10-19  Ian Lance Taylor  <iant@google.com>
3272
3273         PR gold/13204
3274         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3275         --section-start option was seen.
3276         * options.h (General_options::any_section_start): New function.
3277
3278 2011-10-18  David S. Miller  <davem@davemloft.net>
3279
3280         PR binutils/13301
3281         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3282         member to track relocation locations that have moved during TLS
3283         reloc optimizations.
3284         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3285         (Target_sparc::Relocate::relocate): Adjust view down by 4
3286         bytes if it matches reloc_adjust_addr_.
3287         (Target_sparc::Relocate::relocate_tls): Always move the
3288         __tls_get_addr call delay slot instruction forward 4 bytes when
3289         performing relaxation.
3290
3291 2011-10-18  Cary Coutant  <ccoutant@google.com>
3292
3293         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3294         (Output_file::map_no_anonymous): Check for non-zero
3295         return code from posix_fallocate.
3296
3297 2011-10-17  Cary Coutant  <ccoutant@google.com>
3298
3299         PR gold/13245
3300         * plugin.cc (is_visible_from_outside): Check for symbols
3301         referenced from dynamic objects.
3302         * resolve.cc (Symbol_table::resolve): Don't count references
3303         from dynamic objects as references from real ELF files.
3304         * testsuite/plugin_test_2.sh: Adjust expected result.
3305
3306 2011-10-17  Cary Coutant  <ccoutant@google.com>
3307
3308         * gold.cc: Include timer.h.
3309         (queue_middle_tasks): Stamp time.
3310         (queue_final_tasks): Likewise.
3311         * main.cc (main): Store timer in parameters.  Print timers
3312         for each pass.
3313         * parameters.cc (Parameters::Parameters): Initialize timer_.
3314         (Parameters::set_timer): New function.
3315         (set_parameters_timer): New function.
3316         * parameters.h (Parameters::set_timer): New function.
3317         (Parameters::timer): New function.
3318         (Parameters::timer_): New data member.
3319         (set_parameters_timer): New function.
3320         * timer.cc (Timer::stamp): New function.
3321         (Timer::get_pass_time): New function.
3322         * timer.h (Timer::stamp): New function.
3323         (Timer::get_pass_time): New function.
3324         (Timer::pass_times_): New data member.
3325
3326 2011-10-17  Cary Coutant  <ccoutant@google.com>
3327
3328         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3329         task for members of lib groups.
3330
3331 2011-10-17  Cary Coutant  <ccoutant@google.com>
3332
3333         PR gold/13288
3334         * fileread.cc (File_read::find_view): Add assert.
3335         (File_read::make_view): Move bounds check (replace with assert)...
3336         (File_read::find_or_make_view): ... to here.
3337
3338 2011-10-12  Cary Coutant  <ccoutant@google.com>
3339
3340         * output.cc (Output_file::open_base_file): Handle case where
3341         ::read returns less than requested size.
3342
3343 2011-10-10  Cary Coutant  <ccoutant@google.com>
3344
3345         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3346         Initialize defined_count_.
3347         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3348         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3349         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3350         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3351         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3352         * incremental.h (Sized_relobj_incr::defined_count_): New data
3353         member.
3354         (Sized_incr_dynobj::defined_count_): New data member.
3355         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3356         Return zeroes instead of internal error.
3357
3358 2011-10-10  Cary Coutant  <ccoutant@google.com>
3359
3360         PR gold/13249
3361         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3362         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3363         * output.h (class Output_reloc): Add use_plt_offset flag.
3364         (Output_reloc::type_): Adjust size of bit field.
3365         (Output_reloc::use_plt_offset_): New bit field.
3366         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3367         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3368         flag.  Adjust all callers.
3369         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3370         creating RELATIVE relocations.
3371
3372 2011-10-10  Nick Clifton  <nickc@redhat.com>
3373
3374         * po/es.po: Updated Spanish translation.
3375         * po/fi.po: Updated Finnish translation.
3376
3377 2011-10-03   Diego Novillo  <dnovillo@google.com>
3378
3379         * options.cc (parse_uint): Fix dereference of RETVAL.
3380
3381 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3382
3383         * layout.h (section_order_map_): New member.
3384         (get_section_order_map): New member function.
3385         * output.cc (Output_section::add_input_section): Check for patterns
3386         only when --section-ordering-file is specified.
3387         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3388         output_sections have been formed.
3389         * layout.cc (Layout_Layout): Initialize section_order_map_.
3390         * plugin.cc (update_section_order): Store order in order_map. Do not
3391         update the order.
3392         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3393         * testsuite/Makefile.in: Regenerate.
3394         * testsuite/plugin_section_order.c: New file.
3395         * testsuite/plugin_final_layout.cc: New file.
3396         * testsuite/plugin_final_layout.sh: New file.
3397
3398 2011-09-29  Cary Coutant  <ccoutant@google.com>
3399
3400         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3401         Check for NULL.
3402         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3403         symbols during incremental update.
3404         (Symbol_table::add_from_dynobj): Likewise.
3405
3406 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3407             Ian Lance Taylor  <iant@google.com>
3408
3409         * symtab.cc (Symbol_table::define_special_symbol): Always
3410         canonicalize version string.
3411
3412 2011-09-26  Cary Coutant  <ccoutant@google.com>
3413
3414         * gold.cc (queue_initial_tasks): Move option checks ...
3415         * options.cc (General_options::finalize): ... to here. Disable
3416         some options; make others fatal.
3417
3418 2011-09-26  Cary Coutant  <ccoutant@google.com>
3419
3420         gcc PR lto/47247
3421         * plugin.cc (get_symbols_v2): New function.
3422         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3423         (is_referenced_from_outside): New function.
3424         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3425         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3426         (get_symbols): Pass version parameter.
3427         (get_symbols_v2): New function.
3428         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3429         parameter.
3430         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3431         (onload): Add LDPT_GET_SYMBOLS_V2.
3432         (all_symbols_read_hook): Use get_symbols_v2; check for
3433         LDPR_PREVAILING_DEF_IRONLY_EXP.
3434         * testsuite/plugin_test_3.sh: Update expected results.
3435
3436 2011-09-23  Simon Baldwin  <simonb@google.com>
3437
3438         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3439         configuration options.
3440         * configure: Regenerate.
3441         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3442         * Makefile.in: Regenerate.
3443         * testsuite/Makefile.in: Regenerate.
3444
3445 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3446
3447         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3448
3449 2011-09-19  Cary Coutant  <ccoutant@google.com>
3450
3451         * incremental.cc (can_incremental_update): Fix typo in comment.
3452         * incremental.h (can_incremental_update): Likewise.
3453
3454 2011-09-18  Cary Coutant  <ccoutant@google.com>
3455
3456         * incremental.cc (can_incremental_update): New function.
3457         * incremental.h (can_incremental_update): New function.
3458         * layout.cc (Layout::init_fixed_output_section): Call it.
3459         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3460         * object.cc (Sized_relobj_file::do_layout): Call
3461         can_incremental_update.
3462
3463 2011-09-13  Cary Coutant  <ccoutant@google.com>
3464
3465         * configure.ac: Check for glibc support for gnu_indirect_function
3466         support with static linking, setting automake conditional
3467         IFUNC_STATIC.
3468         * Makefile.in: Regenerate.
3469         * configure: Regenerate.
3470
3471         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3472         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3473         for IFUNC_STATIC.
3474         * testsuite/Makefile.in: Regenerate.
3475
3476 2011-09-13  Cary Coutant  <ccoutant@google.com>
3477
3478         * incremental.cc (Sized_relobj_incr::do_layout): Call
3479         report_comdat_group for kept comdat sections.
3480         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3481         * testsuite/Makefile.in: Regenerate.
3482         * testsuite/incr_comdat_test_1.cc: New source file.
3483         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3484         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3485         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3486
3487 2011-09-13  Ian Lance Taylor  <iant@google.com>
3488
3489         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3490         variable external_symbols_offset.
3491
3492 2011-09-12  Ian Lance Taylor  <iant@google.com>
3493
3494         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3495         triggered if object has no symbols.
3496
3497 2011-09-09  David S. Miller  <davem@davemloft.net>
3498
3499         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3500         (Output_fill_debug_line::do_write): Likewise.
3501
3502 2011-08-29  Cary Coutant  <ccoutant@google.com>
3503
3504         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3505         casts to match formatting specs.
3506         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3507
3508 2011-08-26  Cary Coutant  <ccoutant@google.com>
3509
3510         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3511         remaining hole size when allocating.
3512         (Layout::make_output_section): Set fill methods for debug sections.
3513         * layout.h (Free_list::Free_list_node): Move from private to
3514         public.
3515         (Free_list::set_min_hole_size): New function.
3516         (Free_list::begin, Free_list::end): New functions.
3517         (Free_list::min_hole_): New data member.
3518         * output.cc: Include dwarf.h.
3519         (Output_fill_debug_info::do_minimum_hole_size): New function.
3520         (Output_fill_debug_info::do_write): New function.
3521         (Output_fill_debug_line::do_minimum_hole_size): New function.
3522         (Output_fill_debug_line::do_write): New function.
3523         (Output_section::Output_section): Initialize new data member.
3524         (Output_section::set_final_data_size): Ensure patch space is larger
3525         than minimum hole size.
3526         (Output_section::do_write): Fill holes in debug sections.
3527         * output.h (Output_fill): New class.
3528         (Output_fill_debug_info): New class.
3529         (Output_fill_debug_line): New class.
3530         (Output_section::set_free_space_fill): New function.
3531         (Output_section::free_space_fill_): New data member.
3532         * testsuite/Makefile.am (incremental_test_3): Add
3533         --incremental-patch option.
3534         (incremental_test_4): Likewise.
3535         (incremental_test_5): Likewise.
3536         (incremental_test_6): Likewise.
3537         (incremental_copy_test): Likewise.
3538         (incremental_common_test_1): Likewise.
3539         * testsuite/Makefile.in: Regenerate.
3540
3541 2011-08-26  Nick Clifton  <nickc@redhat.com>
3542
3543         * po/es.po: Updated Spanish translation.
3544
3545 2011-08-01  Cary Coutant  <ccoutant@google.com>
3546
3547         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3548         * gold/testsuite/Makefile.in: Regenerate.
3549         * gold/testsuite/justsyms_exec.c: New source file.
3550         * gold/testsuite/justsyms_lib.c: New source file.
3551
3552 2011-08-01  Cary Coutant  <ccoutant@google.com>
3553
3554         * layout.cc (Layout::set_segment_offsets): Don't realign text
3555         segment if -Ttext was specified.
3556         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3557         file type.
3558         * object.h (Sized_relobj_file::e_type): New function.
3559         (Sized_relobj_file::e_type_): New data member.
3560         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3561         base address for ET_EXEC files.
3562         * target.cc (Target::do_make_elf_object_implementation): Allow
3563         ET_EXEC files with --just-symbols option.
3564
3565 2011-07-28  Cary Coutant  <ccoutant@google.com>
3566
3567         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3568         Add thread_number parameter.
3569         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3570         * workqueue-threads.cc
3571         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3572         current thread if its thread number is greater than desired thread
3573         count.
3574         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3575         Add thread_number parameter.
3576         (Workqueue::should_cancel_thread): Likewise.
3577         (Workqueue::find_runnable_or_wait): Pass thread_number to
3578         should_cancel_thread.
3579         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3580         parameter.
3581
3582 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3583
3584         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3585         only after checking if it cannot be forced local.
3586         * symtab.h (is_externally_visible): Check if the symbol is not forced
3587         local.
3588
3589 2011-07-15  Ian Lance Taylor  <iant@google.com>
3590
3591         * options.h (class General_options): Add --print-output-format.
3592         Move -EL next to -EB, for  better --help output.
3593         * target-select.cc: Include <cstdio>, "options.h", and
3594         "parameters.h".
3595         (Target_selector::do_target_bfd_name): New function.
3596         (print_output_format): New function.
3597         * target-select.h (class Target_selector): Update declarations.
3598         (Target_selector::target_bfd_name): New function.
3599         (print_output_format): Declare.
3600         * main.cc: Include "target-select.h".
3601         (main): Handle --print-output-format.
3602         * gold.cc: Include "target-select.h".
3603         (queue_initial_tasks): Handle --print-output-format when there are
3604         no input files.
3605         * parameters.cc (parameters_force_valid_target): Give a better
3606         error message if -EB/-EL does not match target.
3607         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3608         function.
3609
3610 2011-07-15  Ian Lance Taylor  <iant@google.com>
3611
3612         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3613         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3614         (Output_data_plt_i386::do_write): Write address of .dynamic
3615         section to first entry in .got.plt section.
3616         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3617         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3618         Initialize layout_.
3619         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3620         section to first entry in .got.plt section.
3621         * layout.h (Layout::dynamic_section): New function.
3622
3623 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3624
3625         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3626         to claim_file call.
3627         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3628         input_section_position_, and input_section_glob_.
3629         (read_layout_from_file): Call function section_ordering_specified.
3630         * layout.h (is_section_ordering_specified): New function.
3631         (section_ordering_specified): New function.
3632         (section_ordering_specified_): New boolean member.
3633         * main.cc(main): Call load_plugins after layout object is defined.
3634         * output.cc (Output_section::add_input_section): Use
3635         function section_ordering_specified to check if section ordering is
3636         needed.
3637         * output.cc (Output_section::add_relaxed_input_section): Use
3638         function section_ordering_specified to check if section ordering is
3639         needed.
3640         (Output_section::update_section_layout): New function.
3641         (Output_section::sort_attached_input_sections): Check if input section
3642         must be reordered.
3643         * output.h (Output_section::update_section_layout): New function.
3644         * plugin.cc (get_section_count): New function.
3645         (get_section_type): New function.
3646         (get_section_name): New function.
3647         (get_section_contents): New function.
3648         (update_section_order): New function.
3649         (allow_section_ordering): New function.
3650         (Plugin::load): Add the new interfaces to the transfer vector.
3651         (Plugin_manager::load_plugins): New parameter.
3652         (Plugin_manager::all_symbols_read): New parameter.
3653         (Plugin_manager::claim_file): New parameter. Save the elf object for
3654         unclaimed objects.
3655         (Plugin_manager::get_elf_object): New function.
3656         (Plugin_manager::get_view): Change to directly use the bool to check
3657         if get_view is called from claim_file_hook.
3658         * plugin.h (input_objects): New function
3659         (Plugin__manager::load_plugins): New parameter.
3660         (Plugin_manager::claim_file): New parameter.
3661         (Plugin_manager::get_elf_object): New function.
3662         (Plugin_manager::in_claim_file_handler): New function.
3663         (Plugin_manager::in_claim_file_handler_): New member.
3664         (layout): New function.
3665         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3666         handler with an extra parameter. Make the elf object before calling
3667         claim_file handler.
3668         * testsuite/plugin_test.c (get_section_count): New function pointer.
3669         (get_section_type): New function pointer.
3670         (get_section_name): New function pointer.
3671         (get_section_contents): New function pointer.
3672         (update_section_order): New function pointer.
3673         (allow_section_ordering): New function pointer.
3674         (onload): Check if the new interfaces exist.
3675
3676 2011-07-13  Ian Lance Taylor  <iant@google.com>
3677
3678         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3679         relro section.
3680         * x86_64.cc (Target_x86_64::got_section): Likewise.
3681         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3682         (relro_now_test_SOURCES): New variable.
3683         (relro_now_test_DEPENDENCIES): New variable.
3684         (relro_now_test_LDFLAGS): New variable.
3685         (relro_now_test_LDADD): New variable.
3686         (relro_now_test.so): New target.
3687         * testsuite/Makefile.in: Rebuild.
3688
3689 2011-07-12  Ian Lance Taylor  <iant@google.com>
3690
3691         PR gold/12980
3692         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3693         GLOB_DAT relocation rather than a RELATIVE relocation for a
3694         protected symbol when creating a shared library.
3695         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3696         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3697         * testsuite/protected_main_1.cc (main): Test that protected
3698         function has same address.
3699
3700 2011-07-11  Ian Lance Taylor  <iant@google.com>
3701
3702         PR gold/12979
3703         * options.h (class General_options): Add -Bgroup.
3704         * options.cc (General_options::finalize): If -Bgroup is set,
3705         default to --unresolved-symbols=report-all.
3706         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3707         * target-reloc.h (issue_undefined_symbol_error): Handle
3708         --unresolved-symbols=report-all.
3709
3710 2011-07-08  Ian Lance Taylor  <iant@google.com>
3711
3712         PR gold/11985
3713         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3714         if linker script discards key sections.
3715         (Layout::create_dynamic_symtab): Likewise.
3716         (Layout::assign_local_dynsym_offsets): Likewise.
3717         (Layout::sized_create_version_sections): Likewise.
3718         (Layout::create_interp): Likewise.
3719         (Layout::finish_dynamic_section): Likewise.
3720         (Layout::set_dynamic_symbol_size): Likewise.
3721
3722 2011-07-08  Ian Lance Taylor  <iant@google.com>
3723
3724         PR gold/12386
3725         * options.h (class General_options): Add --unresolved-symbols.
3726         * target-reloc.h (issue_undefined_symbol_error): Check
3727         --unresolved-symbols.  Add comments.
3728
3729 2011-07-08  Ian Lance Taylor  <iant@google.com>
3730
3731         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3732         expression more complex.
3733
3734 2011-07-08  Ian Lance Taylor  <iant@google.com>
3735
3736         PR gold/11317
3737         * target-reloc.h (issue_undefined_symbol_error): New inline
3738         function, broken out of relocate_section.
3739         (relocate_section): Call issue_undefined_symbol_error.
3740         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3741         there is no TLS segment if we are about to issue an undefined
3742         symbol error.
3743         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3744
3745 2011-07-08  Ian Lance Taylor  <iant@google.com>
3746
3747         PR gold/12279
3748         * resolve.cc (Symbol_table::should_override): Add fromtype
3749         parameter.  Change all callers.  Give error when linking together
3750         TLS and non-TLS symbol.
3751         (Symbol_table::should_override_with_special): Add fromtype
3752         parameter.  Change all callers.
3753         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3754         there is no TLS segment if we have reported some errors.
3755         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3756
3757 2011-07-08  Ian Lance Taylor  <iant@google.com>
3758
3759         PR gold/12372
3760         * target.h (Target::plt_address_for_global): New function.
3761         (Target::plt_address_for_local): New function.
3762         (Target::plt_section_for_global): Remove.
3763         (Target::plt_section_for_local): Remove.
3764         (Target::do_plt_address_for_global): New virtual function.
3765         (Target::do_plt_address_for_local): New virtual function.
3766         (Target::do_plt_section_for_global): Remove.
3767         (Target::do_plt_section_for_local): Remove.
3768         (Target::register_global_plt_entry): Add Symbol_table and Layout
3769         parameters.
3770         * output.cc (Output_data_got::Got_entry::write): Use
3771         plt_address_for_global and plt_address_for_local.
3772         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3773         address of output section.
3774         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3775         got_irelative_, and irelative_count_ fields.  Update
3776         declarations.
3777         (Output_data_plt_i386::has_irelative_section): New function.
3778         (Output_data_plt_i386::entry_count): Add irelative_count_.
3779         (Output_data_plt_i386::set_final_data_size): Likewise.
3780         (class Target_i386): Add got_irelative_ and rel_irelative_
3781         fields.  Update declarations.
3782         (Target_i386::Target_i386): Initialize new fields.
3783         (Target_i386::do_plt_address_for_global): New function replacing
3784         do_plt_section_for_global.
3785         (Target_i386::do_plt_address_for_local): New function replacing
3786         do_plt_section_for_local.
3787         (Target_i386::got_section): Create got_irelative_.
3788         (Target_i386::rel_irelative_section): New function.
3789         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3790         fields.  Don't define __rel_iplt_{start,end}.
3791         (Output_data_plt_i386::add_entry): Add symtab and layout
3792         parameters.  Change all callers.  Use different PLT and GOT for
3793         IFUNC symbols.
3794         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3795         layout parameters.  Change all callers.  Use different PLT and
3796         GOT.
3797         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3798         (Output_data_plt_i386::rel_irelative): New function.
3799         (Output_data_plt_i386::address_for_global): New function.
3800         (Output_data_plt_i386::address_for_local): New function.
3801         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3802         IRELATIVE GOT when changing IFUNC GOT entries.
3803         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3804         reloc.
3805         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3806         if we didn't create an IRELATIVE GOT.
3807         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3808         plt_address_for_local.
3809         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3810         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3811         got_irelative_, and irelative_count_ fields.  Update
3812         declarations.
3813         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3814         Initialize new fields.  Remove symtab parameter.  Change all
3815         callers.
3816         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3817         irelative_count_.
3818         (Output_data_plt_x86_64::has_irelative_section): New function.
3819         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3820         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3821         fields.  Update declarations.
3822         (Target_x86_64::Target_x86_64): Initialize new fields.
3823         (Target_x86_64::do_plt_address_for_global): New function replacing
3824         do_plt_section_for_global.
3825         (Target_x86_64::do_plt_address_for_local): New function replacing
3826         do_plt_section_for_local.
3827         (Target_x86_64::got_section): Create got_irelative_.
3828         (Target_x86_64::rela_irelative_section): New function.
3829         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3830         all callers.  Don't create __rel_iplt_{start,end}.
3831         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3832         parameters.  Change all callers.  Use different PLT and GOT for
3833         IFUNC symbols.
3834         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3835         layout parameters.  Change all callers.  Use different PLT and
3836         GOT.
3837         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3838         parameters.  Change all callers.  Use different PLT and GOT for
3839         IFUNC symbols.
3840         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3841         (Output_data_plt_x86_64::rela_irelative): New function.
3842         (Output_data_plt_x86_64::address_for_global): New function.
3843         (Output_data_plt_x86_64::address_for_local): New function.
3844         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3845         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3846         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3847         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3848         parameters.
3849         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3850         reloc.
3851         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3852         symbols if we didn't create an IRELATIVE GOT.
3853         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3854         plt_address_for_local.
3855         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3856         * testsuite/ifuncvar1.c: New test file.
3857         * testsuite/ifuncvar2.c: New test file.
3858         * testsuite/ifuncvar3.c: New test file.
3859         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3860         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3861         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3862         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3863         * testsuite/Makefile.in: Rebuild.
3864
3865 2011-07-07  Cary Coutant  <ccoutant@google.com>
3866
3867         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3868         (two_file_test_1_ndebug.o): Likewise.
3869         (two_file_test_1b_ndebug.o): Likewise.
3870         (two_file_test_2_ndebug.o): Likewise.
3871         (two_file_test_main_ndebug.o): Likewise.
3872         (incremental_test_2): Link with no-debug versions.
3873
3874 2011-07-06  Cary Coutant  <ccoutant@google.com>
3875
3876         * gold/incremental.cc
3877         (Output_section_incremental_inputs::write_info_blocks): Check for
3878         hidden and internal symbols.
3879
3880 2011-07-06  Cary Coutant  <ccoutant@google.com>
3881
3882         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3883         Check disposition for startup file.
3884         (Incremental_inputs::report_command_line): Ignore
3885         --incremental-startup-unchanged option.
3886         * options.cc (General_options::parse_incremental_startup_unchanged):
3887         New function.
3888         (General_options::General_options): Initialize new data member.
3889         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3890         (General_options): Add --incremental-startup-unchanged option.
3891         (General_options::incremental_startup_disposition): New function.
3892         (General_options::incremental_startup_disposition_): New data member.
3893
3894 2011-07-06  Cary Coutant  <ccoutant@google.com>
3895
3896         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3897         input file index to Script_info ctor.
3898         (Sized_incremental_binary::do_file_has_changed): Find the
3899         command-line argument for files named in scripts.
3900         * incremental.h (Script_info::Script_info): New ctor
3901         with input file index.
3902         (Script_info::input_file_index): New function.
3903         (Script_info::input_file_index_): New data member.
3904         (Incremental_binary::get_library): Add const.
3905         (Incremental_binary::get_script_info): Add const.
3906         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3907         * testsuite/Makefile.am (incremental_test_5): New test case.
3908         (incremental_test_6): New test case.
3909         * testsuite/Makefile.in: Regenerate.
3910
3911 2011-07-06  Cary Coutant  <ccoutant@google.com>
3912
3913         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3914         debug output when command lines differ.
3915
3916 2011-07-06  Cary Coutant  <ccoutant@google.com>
3917
3918         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3919         --incremental-patch option.
3920         * layout.cc (Free_list::allocate): Extend allocation beyond original
3921         end if enabled.
3922         (Layout::make_output_section): Mark sections that should get
3923         patch space.
3924         * options.cc (parse_percent): New function.
3925         * options.h (parse_percent): New function.
3926         (DEFINE_percent): New macro.
3927         (General_options): Add --incremental-patch option.
3928         * output.cc (Output_section::Output_section): Initialize new data
3929         members.
3930         (Output_section::add_input_section): Print section name when out
3931         of patch space.
3932         (Output_section::add_output_section_data): Likewise.
3933         (Output_section::set_final_data_size): Add patch space when
3934         doing --incremental-full.
3935         (Output_section::do_reset_address_and_file_offset): Remove patch
3936         space.
3937         (Output_segment::set_section_list_addresses): Print debug output
3938         only if --incremental-update.
3939         * output.h (Output_section::set_is_patch_space_allowed): New function.
3940         (Output_section::is_patch_space_allowed_): New data member.
3941         (Output_section::patch_space_): New data member.
3942         * parameters.cc (Parameters::incremental_full): New function.
3943         * parameters.h (Parameters::incremental_full): New function
3944         * testsuite/Makefile.am (incremental_test_2): Add test for
3945         --incremental-patch option.
3946         * testsuite/Makefile.in: Regenerate.
3947         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3948         (t18): Remove function body.
3949
3950 2011-07-05  Doug Kwan  <dougkwan@google.com>
3951
3952         PR gold/12771
3953         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3954         Arm_Address type for relocation result.
3955         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3956         overflow check.
3957         (Arm_relocate_functions::abs32): Use unaligned access.
3958         (Arm_relocate_functions::rel32): Ditto.
3959         (Arm_relocate_functions::prel31): Ditto.
3960         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3961         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3962         static data relocations.
3963         * testsuite/Makefile.in: Regnerate.
3964         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3965
3966 2011-07-05  Ian Lance Taylor  <iant@google.com>
3967
3968         PR gold/12392
3969         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3970         symbols if necessary.
3971         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3972
3973 2011-07-05  Ian Lance Taylor  <iant@google.com>
3974
3975         PR gold/12952
3976         * resolve.cc (Symbol::override_base_with_special): Simply override
3977         version with special symbol version, ignoring previous version.
3978
3979 2011-07-05  Ian Lance Taylor  <iant@google.com>
3980
3981         * object.cc (Sized_relobj_file::include_section_group): Add
3982         information to comment about signature location.
3983
3984 2011-07-02  Ian Lance Taylor  <iant@google.com>
3985
3986         PR gold/12957
3987         * options.h (class General_options): Add -f and -F.
3988         * options.cc (General_options::finalize): Fatal error if -f/-F
3989         are used without -shared.
3990         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3991
3992 2011-07-02  Ian Lance Taylor  <iant@google.com>
3993
3994         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3995
3996 2011-07-01  Ian Lance Taylor  <iant@google.com>
3997
3998         PR gold/12525
3999         PR gold/12952
4000         * resolve.cc (Symbol::override_base_with_special): Don't override
4001         the version if the overriding symbol has a different name.
4002         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4003         all callers.  If we give an error about an undefined version,
4004         define the base version if necessary.
4005         * dynobj.h (class Versions): Update declaration.
4006         * testsuite/weak_alias_test_5.cc: New file.
4007         * testsuite/weak_alias_test.script: New file.
4008         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4009         and versioned_alias have the right value, and call t2.
4010         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4011         weak_alias_test_5.so.
4012         (weak_alias_test_LDADD): Likewise.
4013         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4014         * testsuite/Makefile.in: Rebuild.
4015
4016 2011-07-01  Ian Lance Taylor  <iant@google.com>
4017
4018         PR gold/12525
4019         * options.h (class General_options): Support -z notext.
4020         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4021         -Wl,-z,notext.
4022         (two_file_shared_nonpic.so): Likewise.
4023         (two_file_shared_mixed.so): Likewise.
4024         (two_file_shared_mixed_1.so): Likewise.
4025         (weak_undef_lib_nonpic.so): Likewise.
4026         (alt/weak_undef_lib_nonpic.so): Likewise.
4027         (tls_test_shared_nonpic.so): Likewise.
4028         * testsuite/Makefile.in: Rebuild.
4029
4030 2011-07-01  Ian Lance Taylor  <iant@google.com>
4031
4032         PR gold/12525
4033         * configure.ac: Test whether static linking works, setting
4034         the automake conditional HAVE_STATIC.
4035         * testsuite/Makefile.am: Disable tests using -static if
4036         HAVE_STATIC is not true.
4037         * configure, testsuite/Makefile.in: Rebuild.
4038
4039 2011-07-01  Ian Lance Taylor  <iant@google.com>
4040
4041         PR gold/12525
4042         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4043         Assert if we see DW_EH_PE_indirect.
4044         * target.h (Target::ehframe_datarel_base): New function.
4045         (Target::do_ehframe_datarel_base): New target function.
4046         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4047         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4048         function.
4049
4050 2011-07-01  Ian Lance Taylor  <iant@google.com>
4051
4052         PR gold/12571
4053         * options.h (class General_options): Add
4054         --ld-generated-unwind-info.
4055         * ehframe.cc (Fde::write): Add address parameter.  Change all
4056         callers.  If associated with PLT, fill in address and size.
4057         (Cie::set_output_offset): Only add merge mapping if there is an
4058         object.
4059         (Cie::write): Add address parameter.  Change all callers.
4060         (Eh_frame::add_ehframe_for_plt): New function.
4061         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4062         input_offset_ fields into union u_, with new plt field.
4063         (Fde::Fde): Adjust for new union field.
4064         (Fde::Fde) [Output_data version]: New constructor.
4065         (Fde::add_mapping): Only add merge mapping if there is an object.
4066         (class Cie): Update declarations.
4067         (class Eh_frame): Declare add_ehframe_for_plt.
4068         * layout.cc (Layout::layout_eh_frame): Break out code into
4069         make_eh_frame_section, and call it.
4070         (Layout::make_eh_frame_section): New function.
4071         (Layout::add_eh_frame_for_plt): New function.
4072         * layout.h (class Layout): Update declarations.
4073         * merge.cc (Merge_map::add_mapping): Add assertion.
4074         * i386.cc: Include "dwarf.h".
4075         (class Output_data_plt_i386): Make first_plt_entry,
4076         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4077         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4078         and plt_eh_frame_fde.
4079         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4080         boundary.  Call add_eh_frame_for_plt if appropriate.
4081         * x86_64.cc: Include "dwarf.h".
4082         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4083         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4084         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4085         and plt_eh_frame_fde.
4086         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4087         appropriate.
4088
4089 2011-06-29  Ian Lance Taylor  <iant@google.com>
4090
4091         PR gold/12629
4092         * object.cc (Sized_relobj_file::layout_section): Change shdr
4093         parameter to be const.
4094         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4095         out of do_layout.
4096         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4097         appropriate.  Call layout_eh_frame_section.
4098         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4099         sections.
4100         * object.h (class Sized_relobj_file): Update declarations.
4101
4102 2011-06-29  Ian Lance Taylor  <iant@google.com>
4103
4104         PR gold/12652
4105         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4106         modifier.
4107         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4108
4109 2011-06-29  Ian Lance Taylor  <iant@google.com>
4110
4111         PR gold/12675
4112         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4113         SHT_X86_64_UNWIND.
4114         * layout.cc (Layout::layout_eh_frame): Likewise.
4115
4116 2011-06-29  Ian Lance Taylor  <iant@google.com>
4117
4118         PR gold/12695
4119         * layout.cc (Layout::symtab_section_shndx): New function.
4120         * layout.h (class Layout): Declare symtab_section_shndx.
4121         * output.cc (Output_section::write_header): Call it.
4122
4123 2011-06-29  Ian Lance Taylor  <iant@google.com>
4124
4125         PR gold/12818
4126         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4127         symbols which are not used in a relocation.
4128
4129 2011-06-28  Ian Lance Taylor  <iant@google.com>
4130
4131         PR gold/12898
4132         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4133         script create indistinguishable segments.
4134         (Layout::set_segment_offsets): Use stable_sort when sorting
4135         segments.  Pass this to Compare_segments constructor.
4136         * layout.h (class Layout): Make segment_precedes non-static.
4137         (class Compare_segments): Change from struct to class.  Add
4138         layout_ field.  Add constructor.
4139         * script-sections.cc
4140         (Script_sections::attach_sections_using_phdrs_clause): Rename
4141         local orphan to is_orphan.  Don't report failure to put empty
4142         section in segment.  On attachment failure, report name of
4143         section, and attach to first PT_LOAD segment.
4144
4145 2011-06-28  Ian Lance Taylor  <iant@google.com>
4146
4147         PR gold/12934
4148         * target-select.cc (Target_selector::Target_selector): Add
4149         emulation parameter.  Change all callers.
4150         (select_target_by_bfd_name): Rename from select_target_by_name.
4151         Change all callers.
4152         (select_target_by_emulation): New function.
4153         (supported_emulation_names): New function.
4154         * target-select.h (class Target_selector): Add emulation_ field.
4155         Update declarations.
4156         (Target_selector::recognize_by_bfd_name): Rename from
4157         recognize_by_name.  Change all callers.
4158         (Target_selector::supported_bfd_names): Rename from
4159         supported_names.  Change all callers.
4160         (Target_selector::recognize_by_emulation): New function.
4161         (Target_selector::supported_emulations): New function.
4162         (Target_selector::emulation): New function.
4163         (Target_selector::do_recognize_by_bfd_name): Rename from
4164         do_recognize_by_name.  Change all callers.
4165         (Target_selector::do_supported_bfd_names): Rename from
4166         do_supported_names.  Change all callers.
4167         (Target_selector::do_recognize_by_emulation): New function.
4168         (Target_selector::do_supported_emulations): New function.
4169         (select_target_by_bfd_name): Change name in declaration.
4170         (select_target_by_emulation): Declare.
4171         (supported_emulation_names): Declare.
4172         * parameters.cc (parameters_force_valid_target): Try to find
4173         target based on emulation from -m option.
4174         * options.h (class General_options): Change doc string for -m.
4175         * options.cc (help): Print emulations.
4176         (General_options::parse_V): Likewise.
4177         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4178         Add emulation parameter.  Change all callers.
4179
4180 2011-06-28  Ian Lance Taylor  <iant@google.com>
4181
4182         * target.h (class Target): Add osabi_ field.
4183         (Target::osabi): New function.
4184         (Target::set_osabi): New function.
4185         (Target::Target): Initialize osabi_.
4186         (Target::do_adjust_elf_header): Make pure virtual.
4187         (Sized_target::do_adjust_elf_header): Declare.
4188         * target.cc (Sized_target::do_adjust_elf_header): New function.
4189         (class Sized_target): Instantiate all versions.
4190         * freebsd.h (class Target_freebsd): Remove.
4191         (Target_selector_freebsd::do_recognize): Call set_osabi on
4192         Target.
4193         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4194         (Target_selector_freebsd::set_osabi): Remove.
4195         * i386.cc (class Target_i386): Inherit from Sized_target rather
4196         than Target_freebsd.
4197         * x86_64.cc (class Target_x86_64): Likewise.
4198
4199 2011-06-28  Ian Lance Taylor  <iant@google.com>
4200
4201         * target.h (Target::can_check_for_function_pointers): Rewrite.
4202         Make non-virtual.
4203         (Target::can_icf_inline_merge_sections): Likewise.
4204         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4205         (Target::Target_info): Add can_icf_inline_merge_sections field.
4206         (Target::do_can_check_for_function_pointers): New virtual
4207         function.
4208         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4209         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4210         from can_check_for_function_pointers, move in file.
4211         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4212         section_may_have_icf_unsafe_poineters, move in file.
4213         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4214         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4215         Rename from can_check_for_function_pointers, move in file.
4216         (Target_i386::can_icf_inline_merge_sections): Remove.
4217         (Target_i386::i386_info): Initialize
4218         can_icf_inline_merge_sections.
4219         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4220         Initialize can_icf_inline_merge_sections.
4221         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4222         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4223         Rename from can_check_for_function_pointers, move in file.
4224         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4225         (Target_x86_64::x86_64_info): Initialize
4226         can_icf_inline_merge_sections.
4227         * testsuite/testfile.cc (Target_test::test_target_info):
4228         Likewise.
4229         * icf.cc (get_section_contents): Correct formatting.
4230
4231 2011-06-27  Ian Lance Taylor  <iant@google.com>
4232
4233         * symtab.cc (Symbol::versioned_name): New function.
4234         (Symbol_table::add_to_final_symtab): Use versioned_name when
4235         appropriate.
4236         (Symbol_table::sized_write_symbol): Likewise.
4237         * symtab.h (class Symbol): Declare versioned_name.
4238         * stringpool.h (class Stringpool_template): Add variant of add
4239         which takes a std::basic_string.
4240         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4241         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4242         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4243         (ver_test_12.o): New target.
4244         * testsuite/Makefile.in: Rebuild.
4245
4246 2011-06-27  Doug Kwan  <dougkwan@google.com>
4247
4248         * arm.cc (Arm_relocate_functions::thm_jump8,
4249         Arm_relocate_functions::thm_jump11): Use a wider signed
4250         type to compute offset.
4251         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4252         arm_thm_jump8.
4253         * testsuite/Makefile.in: Regenerate.
4254         * testsuite/arm_branch_in_range.sh: Check test results of
4255         arm_thm_jump11 and arm_thm_jump8.
4256         * testsuite/arm_thm_jump11.s: New test source file.
4257         * testsuite/arm_thm_jump11.t: New linker script.
4258         * testsuite/arm_thm_jump8.s: New test source file.
4259         * testsuite/arm_thm_jump8.t: New linker script.
4260
4261 2011-06-24  Ian Lance Taylor  <iant@google.com>
4262
4263         * layout.cc: Include "object.h".
4264         (ctors_sections_in_init_array): New static variable.
4265         (Layout::is_ctors_in_init_array): New function.
4266         (Layout::layout): Add entry to ctors_sections_in_init_array if
4267         appropriate.
4268         * layout.h (class Layout): Declare is_ctors_in_init_array.
4269         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4270         is_ctors_reverse_view is set.
4271         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4272         all callers.  Set is_ctors_reverse_view field of View_size.
4273         (Sized_relobj_file::reverse_words): New function.
4274         * object.h (Sized_relobj_file::View_size): Add
4275         is_ctors_reverse_view field.
4276         (class Sized_relobj_file): Update declarations.
4277         * testsuite/initpri3.c: New test.
4278         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4279         initpri3b.
4280         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4281         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4282         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4283         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4284         * testsuite/Makefile.in: Rebuild.
4285
4286 2011-06-24  Cary Coutant  <ccoutant@google.com>
4287
4288         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4289         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4290         (debug_msg_cdebug.err): New targets.
4291         * testsuite/Makefile.in: Regenerate.
4292         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4293         Fix checks for link with shared library.
4294
4295 2011-06-24  Doug Kwan  <dougkwan@google.com>
4296
4297         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4298         skip empty text sections.
4299         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4300
4301 2011-06-22  Ian Lance Taylor  <iant@google.com>
4302
4303         PR gold/12910
4304         * options.h (class General_options): Add --ctors-in-init-array.
4305         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4306         friends as SHT_PROGBITS for merging sections.
4307         (Layout::layout): Remove special handling of .init_array and
4308         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4309         and .dtors if ctors_in_init_array.
4310         (Layout::make_output_section): Force correct section types for
4311         .init_array and friends.  Don't sort if doing relocatable link,
4312         Don't sort .ctors and .dtors if ctors_in_init_array.
4313         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4314         (Layout::output_section_name): Add relobj parameter.  Change all
4315         callers.  Handle .ctors. and .dtors. in code rather than table.
4316         Handle .ctors and .dtors if ctors_in_init_array.
4317         (Layout::match_file_name): New function, moved from output.cc.
4318         * layout.h (class Layout): Update declarations.
4319         * output.cc: Include "layout.h".
4320         (Input_section_sort_entry::get_priority): New function.
4321         (Input_section_sort_entry::match_file_name): Just call
4322         Layout::match_file_name.
4323         (Output_section::Input_section_sort_init_fini_compare::operator()):
4324         Handle .ctors and .dtors.  Sort by explicit priority rather than
4325         by name.
4326         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4327         * testsuite/initpri2.c: New test.
4328         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4329         (check_PROGRAMS): Add initpri2.
4330         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4331         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4332         * configure, testsuite/Makefile.in: Rebuild.
4333
4334 2011-06-19  Ian Lance Taylor  <iant@google.com>
4335
4336         PR gold/12880
4337         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4338         .interp section to a PT_INTERP segment even if we have seen a
4339         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4340         clause in a linker script.
4341         (Layout::finalize): Don't create a .interp section if we've
4342         already create a PT_INTERP segment.
4343         (Layout::create_interp): Always call choose_output_section (revert
4344         patch of 2011-06-17).  Don't create PT_INTERP segment.
4345         * script-sections.cc
4346         (Script_sections::create_note_and_tls_segments): Add a .interp
4347         section to a PT_INTERP segment even if we have seen a
4348         --dynamic-linker option.
4349
4350 2011-06-18  Ian Lance Taylor  <iant@google.com>
4351
4352         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4353         merely because a non-PT_LOAD segment has a dynamic reloc.
4354
4355 2011-06-18  Ian Lance Taylor  <iant@google.com>
4356
4357         * layout.cc (Layout::finish_dynamic_section): Don't create
4358         DT_FLAGS entry if not needed.
4359
4360 2011-06-18  Ian Lance Taylor  <iant@google.com>
4361
4362         PR gold/12745
4363         * layout.cc (Layout::layout_eh_frame): Correct handling of
4364         writable .eh_frame section.
4365
4366 2011-06-17  Ian Lance Taylor  <iant@google.com>
4367
4368         PR gold/12893
4369         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4370         symbol is redefined with the exact same object and value.
4371
4372 2011-06-17  Ian Lance Taylor  <iant@google.com>
4373
4374         PR gold/12880
4375         * layout.h (class Layout): Add interp_segment_ field.
4376         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4377         (Layout::attach_allocated_section_to_segment): If making shared
4378         library, put .interp section in PT_INTERP segment.
4379         (Layout::finalize): Also call create_interp if -dynamic-linker
4380         option was used.
4381         (Layout::create_interp): Assert that there is no PT_INTERP
4382         segment.  If not using a SECTIONS clause, use make_output_section.
4383         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4384         * script-sections.cc
4385         (Script_sections::create_note_and_tls_segments): If making shared
4386         library, put .interp section in PT_INTERP segment.
4387
4388 2011-06-17  Ian Lance Taylor  <iant@google.com>
4389
4390         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4391         when making a shared library.
4392
4393 2011-06-17  Ian Lance Taylor  <iant@google.com>
4394
4395         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4396         parameter.  Change all callers.  Don't issue warning about PC32
4397         against locally defined symbol.
4398
4399 2011-06-16  Ian Lance Taylor  <iant@google.com>
4400
4401         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4402         occurs in same object.
4403
4404 2011-06-14  Alan Modra  <amodra@gmail.com>
4405
4406         * po/POTFILES.in: Regenerate.
4407
4408 2011-06-09  Ian Lance Taylor  <iant@google.com>
4409
4410         * script-sections.cc
4411         (Orphan_output_section::set_section_addresses): For a relocatable
4412         link set address to 0.
4413
4414 2011-06-09  Cary Coutant  <ccoutant@google.com>
4415
4416         PR gold/12804
4417         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4418         used with --compress-debug-sections.
4419         * gold/object.cc (Sized_relobj_file::do_layout): Report
4420         uncompressed size of compressed input sections.
4421
4422 2011-06-08  Cary Coutant  <ccoutant@google.com>
4423
4424         PR gold/12804
4425         * testsuite/two_file_test_2_v1.cc: Change initialization of
4426         v2 to keep it in .data.
4427
4428 2011-06-07  Cary Coutant  <ccoutant@google.com>
4429
4430         * common.cc (Symbol_table::do_allocate_commons_list): Call
4431         gold_fallback.
4432         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4433         (Errors::fallback): New function.
4434         (gold_fallback): New function.
4435         * errors.h (Errors::fallback): New function.
4436         * gold.cc (gold_exit): Change status parameter to enum; adjust
4437         all callers.
4438         (queue_initial_tasks): Call gold_fallback.
4439         * gold.h: Include cstdlib.
4440         (Exit_status): New enum type.
4441         (gold_exit): Change status parameter to enum.
4442         (gold_fallback): New function.
4443         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4444         (Layout::create_symtab_sections): Likewise.
4445         (Layout::create_shdrs): Likewise.
4446         * main.cc (main): Adjust call to gold_exit.
4447         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4448         (Output_data_got::add_got_entry_pair): Likewise.
4449         (Output_section::add_input_section): Likewise.
4450         (Output_section::add_output_section_data): Likewise.
4451         (Output_segment::set_section_list_addresses): Likewise.
4452         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4453
4454 2011-06-07  Cary Coutant  <ccoutant@google.com>
4455
4456         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4457         for incremental links.
4458         * output.cc (Output_segment::set_section_list_addresses): Remove
4459         FIXME and test for TLS or BSS.
4460
4461 2011-06-07  Cary Coutant  <ccoutant@google.com>
4462
4463         * testsuite/Makefile.am: Add incremental_copy_test,
4464         incremental_common_test_1.
4465         * testsuite/Makefile.in: Regenerate.
4466         * testsuite/common_test_1_v1.c: New source file.
4467         * testsuite/common_test_1_v2.c: New source file.
4468         * testsuite/copy_test_v1.cc: New source file.
4469
4470 2011-06-07  Cary Coutant  <ccoutant@google.com>
4471
4472         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4473         update, allocate common from bss section's free list.
4474         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4475         linker-defined symbols.
4476         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4477         Skip GOT and PLT entries that are no longer referenced.
4478         (Output_section_incremental_inputs::write_info_blocks): Mark
4479         linker-defined symbols.
4480         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4481         * output.cc (Output_section::allocate): New function.
4482         * output.h (Output_section::allocate): New function.
4483         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4484         linker-defined symbols.
4485         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4486         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4487         (Symbol::init_base_output_data): Likewise.
4488         (Symbol::init_base_output_segment): Likewise.
4489         (Symbol::init_base_constant): Likewise.
4490         (Sized_symbol::init_output_data): Likewise.
4491         (Sized_symbol::init_output_segment): Likewise.
4492         (Sized_symbol::init_constant): Likewise.
4493         (Symbol_table::do_define_in_output_data): Likewise.
4494         (Symbol_table::do_define_in_output_segment): Likewise.
4495         (Symbol_table::do_define_as_constant): Likewise.
4496         * symtab.h (Symbol::is_predefined): New function.
4497         (Symbol::init_base_output_data): Add is_predefined parameter.
4498         (Symbol::init_base_output_segment): Likewise.
4499         (Symbol::init_base_constant): Likewise.
4500         (Symbol::is_predefined_): New data member.
4501         (Sized_symbol::init_output_data): Add is_predefined parameter.
4502         (Sized_symbol::init_output_segment): Likewise.
4503         (Sized_symbol::init_constant): Likewise.
4504         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4505
4506 2011-06-07  Cary Coutant  <ccoutant@google.com>
4507
4508         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4509         instead of emit_copy_reloc.
4510         (Copy_relocs::emit_copy_reloc): Refactor.
4511         (Copy_relocs::make_copy_reloc): New function.
4512         (Copy_relocs::add_copy_reloc): Remove.
4513         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4514         section.
4515         (Copy_relocs::make_copy_reloc): New function.
4516         (Copy_relocs::add_copy_reloc): Remove.
4517         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4518         unchanged input files.
4519         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4520         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4521         Reserve BSS space for COPY relocations.
4522         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4523         (Output_section_incremental_inputs::write_info_blocks): Record
4524         whether a symbol is copied from a shared object.
4525         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4526         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4527         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4528         (Incremental_input_entry_reader::get_output_symbol_index): Add
4529         is_copy parameter.
4530         (Incremental_binary::emit_copy_relocs): New function.
4531         (Incremental_binary::do_emit_copy_relocs): New function.
4532         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4533         new data member.
4534         (Sized_incremental_binary::add_copy_reloc): New function.
4535         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4536         (Sized_incremental_binary::Copy_reloc): New struct.
4537         (Sized_incremental_binary::Copy_relocs): New typedef.
4538         (Sized_incremental_binary::copy_relocs_): New data member.
4539         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4540         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4541         * target.h (Sized_target::emit_copy_reloc): New function.
4542         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4543
4544 2011-06-02  Cary Coutant  <ccoutant@google.com>
4545
4546         PR gold/12163
4547         * gold/archive.cc (Archive::Archive): Initialize new data member.
4548         (Archive::include_all_members): Return if archive has already been
4549         included.
4550         * gold/archive.h (Archive::include_all_members_): New data member.
4551
4552 2011-06-02  Nick Clifton  <nickc@redhat.com>
4553
4554         * dynobj.h: Fix spelling mistake in comment.
4555         * output.cc: Likewise.
4556
4557 2011-05-31  Doug Kwan  <dougkwan@google.com>
4558             Asier Llano
4559
4560         PR gold/12826
4561         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4562         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4563         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4564         redundant arm_exidx_test.so.
4565         * testsuite/Makefile.in: Regenerate.
4566         (check_SCRIPTS): Add pr12826.sh
4567         (check_DATA): Add pr12826.stdout
4568         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4569         * testsuite/pr12826.sh: New file.
4570         * testsuite/pr12826_1.s: Ditto.
4571         * testsuite/pr12826_1.s: Ditto.
4572
4573 2011-05-30  Ian Lance Taylor  <iant@google.com>
4574
4575         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4576         sections.
4577
4578 2011-05-29  Ian Lance Taylor  <iant@google.com>
4579
4580         PR gold/12804
4581         * testsuite/Makefile.am: Use different file name for two_file_test
4582         temporary file for each incremental test.
4583         * testsuite/Makefile.in: Rebuild.
4584
4585 2011-05-29  Ian Lance Taylor  <iant@google.com>
4586
4587         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4588         binary input file is empty.
4589
4590 2011-05-27  Ian Lance Taylor  <iant@google.com>
4591
4592         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4593         (ver_test_9.so): Likewise.
4594         * testsuite/Makefile.in: Rebuild.
4595
4596 2011-05-26 Cary Coutant  <ccoutant@google.com>
4597
4598         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4599         * incremental.cc (Incremental_inputs::report_input_section): Fix
4600         comment, indentation.
4601         (Incremental_inputs::report_comdat_group): New function.
4602         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4603         of data for incremental input file entry.
4604         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4605         group count, COMDAT group signatures.
4606         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4607         an unchanged input file.
4608         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4609         Initialize new data member.
4610         (Incremental_object_entry::add_comdat_group): New function.
4611         (Incremental_object_entry::get_comdat_group_count): New function.
4612         (Incremental_object_entry::get_comdat_signature_key): New function.
4613         (Incremental_object_entry::groups_): New data member.
4614         (Incremental_inputs::report_comdat_group): New function.
4615         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4616         data for incremental input file entry.
4617         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4618         (Incremental_input_entry_reader::get_input_section): Adjust size of
4619         data for incremental input file entry.
4620         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4621         (Incremental_input_entry_reader::get_comdat_group_signature): New
4622         function.
4623         * object.cc (Sized_relobj::include_section_group): Report kept
4624         COMDAT groups for incremental links.
4625
4626 2011-05-24  David Meyer  <pdox@google.com>
4627
4628         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4629         with name parameter.  Add found_name parameter.
4630         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4631         * dirsearch.h (class Dirsearch): Update declaration.
4632
4633 2011-05-24  Ian Lance Taylor  <iant@google.com>
4634
4635         * archive.cc (Library_base::should_include_member): Pull in object
4636         from archive if it defines the entry symbol.
4637         * parameters.cc (Parameters::entry): New function.
4638         * parameters.h (class Parameters): Declare entry.
4639         * output.h (class Output_file_header): Remove entry_ field.
4640         * output.cc (Output_file_header::Output_file_header): Remove entry
4641         parameter.  Change all callers.
4642         (Output_file_header::entry): Use parameters->entry.
4643         * gold.cc (queue_middle_tasks): Likewise.
4644         * plugin.cc (Plugin_hook::run): Likewise.
4645
4646 2011-05-24 Cary Coutant  <ccoutant@google.com>
4647
4648         * gold.cc (queue_initial_tasks): Pass incremental base filename
4649         to Output_file::open_base_file; don't print error message.
4650         * incremental-dump.cc (main): Adjust call to
4651         Output_file::open_for_modification.
4652         * incremental-dump.cc (main): Likewise.
4653         * incremental.cc (Incremental_inputs::report_command_line):
4654         Ignore --incremental-base option when comparing command lines.
4655         Ignore parameter when given as separate argument.
4656         * options.h (class General_options): Add --incremental-base.
4657         * output.cc (Output_file::Output_file):
4658         (Output_file::open_base_file): Add base_name and writable parameters;
4659         read base file into new file; print error message here.
4660         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4661         callers.
4662         * output.h (Output_file::open_for_modification): Rename to...
4663         (Output_file::open_base_file): ...this; add base_name and
4664         writable parameters; adjust all callers.
4665         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4666         callers.
4667         * testsuite/Makefile.am (incremental_test_4): Test
4668         --incremental-base.
4669         * testsuite/Makefile.in: Regenerate.
4670
4671 2011-05-24 Cary Coutant  <ccoutant@google.com>
4672
4673         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4674         incremental_test_4.
4675         * testsuite/Makefile.in: Regenerate.
4676         * testsuite/two_file_test_1_v1.cc: New test source file.
4677         * testsuite/two_file_test_1b_v1.cc: New test source file.
4678         * testsuite/two_file_test_2_v1.cc: New test source file.
4679
4680 2011-05-24 Cary Coutant  <ccoutant@google.com>
4681
4682         * dynobj.h (Dynobj::do_dynobj): New function.
4683         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4684         flag and soname for shared objects.
4685         * incremental.cc (Incremental_inputs::report_object): Make
4686         either Incremental_object_entry or Incremental_dynobj_entry; add
4687         soname to string table.
4688         (Incremental_inputs::report_input_section): Add assertion.
4689         (Output_section_incremental_inputs::set_final_data_size): Adjust
4690         type of input file entry for shared libraries; adjust size of
4691         shared library info entry.
4692         (Output_section_incremental_inputs::write_input_files): Write
4693         as_needed flag for shared libraries.
4694         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4695         of input file entry for shared libraries; write soname.
4696         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4697         soname from incremental info.
4698         * incremental.h (enum Incremental_input_flags): Add
4699         INCREMENTAL_INPUT_AS_NEEDED.
4700         (Incremental_input_entry::Incremental_input_entry): Initialize new
4701         data member.
4702         (Incremental_input_entry::set_as_needed): New function.
4703         (Incremental_input_entry::as_needed): New function.
4704         (Incremental_input_entry::do_dynobj_entry): New function.
4705         (Incremental_input_entry::as_needed_): New data member.
4706         (Incremental_object_entry::Incremental_object_entry): Don't check
4707         for shared library.
4708         (Incremental_object_entry::do_type): Likewise.
4709         (class Incremental_dynobj_entry): New class.
4710         (Incremental_input_entry_reader::as_needed): New function.
4711         (Incremental_input_entry_reader::get_soname): New function.
4712         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4713         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4714         size of shared library info entry.
4715         * layout.cc (Layout::finish_dynamic_section): Don't test for
4716         incremental link when adding DT_NEEDED entries.
4717         * object.h (Object::Object): Initialize new data member.
4718         (Object::dynobj): New function.
4719         (Object::set_as_needed): New function.
4720         (Object::as_needed): New function.
4721         (Object::do_dynobj): New function.
4722         (Object::as_needed_): New data member.
4723
4724 2011-05-24 Cary Coutant  <ccoutant@google.com>
4725
4726         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4727         info; adjust display of GOT entries.
4728         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4729         vector of input objects; remove file_status_.
4730         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4731         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4732         got_plt reader; call target hooks to reserve GOT entries.
4733         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4734         of input file info header and GOT info entry.
4735         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4736         relocation info.
4737         (Got_plt_view_info::got_descriptor): Remove.
4738         (Got_plt_view_info::sym_index): New data member.
4739         (Got_plt_view_info::input_index): New data member.
4740         (Local_got_offset_visitor::visit): Write input file index.
4741         (Global_got_offset_visitor::visit): Write 0 for input file index.
4742         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4743         with sym_index and input_index.
4744         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4745         incremental info GOT entry; replace got_descriptor with input_index.
4746         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4747         map from input file index to object.
4748         (Sized_relobj_incr::do_layout): Replace direct data member reference
4749         with accessor function.
4750         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4751         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4752         Adjust size of input file info header.
4753         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4754         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4755         (Incremental_input_entry_reader::get_input_section): Adjust size of
4756         input file info header.
4757         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4758         of incremental info GOT entry.
4759         (Incremental_got_plt_reader::get_got_desc): Remove.
4760         (Incremental_got_plt_reader::get_got_symndx): New function.
4761         (Incremental_got_plt_reader::get_got_input_index): New function.
4762         (Sized_incremental_binary::Sized_incremental_binary): Remove
4763         file_status_; add input_objects_.
4764         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4765         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4766         (Sized_incremental_binary::file_is_unchanged): Remove.
4767         (Sized_incremental_binary::set_input_object): New function.
4768         (Sized_incremental_binary::input_object): New function.
4769         (Sized_incremental_binary::file_status_): Remove.
4770         (Sized_incremental_binary::input_objects_): New data member.
4771         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4772         references.
4773         (Sized_relobj_incr::invalid_address): Move to base class.
4774         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4775         class.
4776         (Sized_relobj_incr::do_output_section_offset): Likewise.
4777         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4778         (Sized_relobj_incr::section_offsets_): Likewise.
4779         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4780         function.
4781         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4782         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4783         with accessor function.
4784         (Sized_relobj_file::do_layout): Likewise.
4785         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4786         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4787         (Sized_relobj_file::compute_final_local_value): Replace refs to
4788         section_offsets_ with accessor function.
4789         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4790         * object.h (Relobj::Relobj): Initialize new data members.
4791         (Relobj::add_dyn_reloc): New function.
4792         (Relobj::first_dyn_reloc): New function.
4793         (Relobj::dyn_reloc_count): New function.
4794         (Relobj::first_dyn_reloc_): New data member.
4795         (Relobj::dyn_reloc_count_): New data member.
4796         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4797         references.
4798         (Sized_relobj::Address): New typedef.
4799         (Sized_relobj::invalid_address): Move here from child class.
4800         (Sized_relobj::Sized_relobj): Initialize new data members.
4801         (Sized_relobj::sized_relobj): New function.
4802         (Sized_relobj::is_output_section_offset_invalid): Move here from
4803         child class.
4804         (Sized_relobj::get_output_section_offset): Likewise.
4805         (Sized_relobj::local_has_got_offset): Likewise.
4806         (Sized_relobj::local_got_offset): Likewise.
4807         (Sized_relobj::set_local_got_offset): Likewise.
4808         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4809         (Sized_relobj::clear_got_offsets): New function.
4810         (Sized_relobj::section_offsets): Move here from child class.
4811         (Sized_relobj::do_output_section_offset): Likewise.
4812         (Sized_relobj::do_set_section_offset): Likewise.
4813         (Sized_relobj::Local_got_offsets): Likewise.
4814         (Sized_relobj::local_got_offsets_): Likewise.
4815         (Sized_relobj::section_offsets_): Likewise.
4816         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4817         references.
4818         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4819         class.
4820         (Sized_relobj_file::sized_relobj): New function
4821         (Sized_relobj_file::local_has_got_offset): Move to base class.
4822         (Sized_relobj_file::local_got_offset): Likewise.
4823         (Sized_relobj_file::set_local_got_offset): Likewise.
4824         (Sized_relobj_file::get_output_section_offset): Likewise.
4825         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4826         (Sized_relobj_file::do_output_section_offset): Likewise.
4827         (Sized_relobj_file::do_set_section_offset): Likewise.
4828         (Sized_relobj_file::Local_got_offsets): Likewise.
4829         (Sized_relobj_file::local_got_offsets_): Likewise.
4830         (Sized_relobj_file::section_offsets_): Likewise.
4831         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4832         (all constructors).
4833         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4834         (Output_reloc::get_symbol_index): Likewise.
4835         (Output_reloc::local_section_offset): Likewise.
4836         (Output_reloc::get_address): Likewise.
4837         (Output_reloc::symbol_value): Likewise.
4838         (Output_data_got::reserve_slot): Move to class definition.
4839         (Output_data_got::reserve_local): New function.
4840         (Output_data_got::reserve_slot_for_global): Remove.
4841         (Output_data_got::reserve_global): New function.
4842         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4843         (all constructors, two instantiations).
4844         (Output_reloc::get_relobj): New function (two instantiations).
4845         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4846         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4847         (Output_data_reloc::add_global): Adjust type of relobj.
4848         (Output_data_reloc::add_global_relative): Likewise.
4849         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4850         (Output_data_reloc::add_local): Likewise.
4851         (Output_data_reloc::add_local_relative): Likewise.
4852         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4853         (Output_data_reloc::add_local_section): Likewise.
4854         (Output_data_reloc::add_output_section): Likewise.
4855         (Output_data_reloc::add_absolute): Likewise.
4856         (Output_data_reloc::add_target_specific): Likewise.
4857         (Output_data_got::reserve_slot): Move definition here.
4858         (Output_data_got::reserve_local): New function.
4859         (Output_data_got::reserve_global): New function.
4860         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4861         section_offsets_ with accessor function.
4862         (Sized_relobj_file::write_sections): Likewise.
4863         (Sized_relobj_file::do_relocate_sections): Likewise.
4864         * target.h (Sized_target::reserve_local_got_entry): New function.
4865         (Sized_target::reserve_global_got_entry): New function.
4866         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4867         (Target_x86_64::reserve_global_got_entry): New function.
4868         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4869
4870 2011-05-23 Cary Coutant  <ccoutant@google.com>
4871
4872         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4873         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4874         bit when checking got_type.
4875         * incremental.cc (Sized_incremental_binary::setup_readers):
4876         Store symbol table and string table locations; initialize bit vector
4877         of file status flags.
4878         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4879         unchanged files.
4880         (Sized_incremental_binary::do_process_got_plt): New function.
4881         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4882         (Output_section_incremental_inputs::set_final_data_size): Record
4883         file index for each input file.
4884         (Output_section_incremental_inputs::write_got_plt): Store file index
4885         instead of input entry offset for each GOT entry.
4886         * incremental.h
4887         (Incremental_input_entry::Incremental_input_entry): Initialize new
4888         data member.
4889         (Incremental_input_entry::set_offset): Store file index.
4890         (Incremental_input_entry::get_file_index): New function.
4891         (Incremental_input_entry::file_index_): New data member.
4892         (Incremental_binary::process_got_plt): New function.
4893         (Incremental_binary::do_process_got_plt): New function.
4894         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4895         data members.
4896         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4897         (Sized_incremental_binary::set_file_is_unchanged): New function.
4898         (Sized_incremental_binary::file_is_unchanged): New function.
4899         (Sized_incremental_binary::do_process_got_plt): New function.
4900         (Sized_incremental_binary::file_status_): New data member.
4901         (Sized_incremental_binary::main_symtab_loc_): New data member.
4902         (Sized_incremental_binary::main_strtab_loc_): New data member.
4903         * output.cc (Output_data_got::Got_entry::write): Add case
4904         RESERVED_CODE.
4905         (Output_data_got::add_global): Call add_got_entry.
4906         (Output_data_got::add_global_plt): Likewise.
4907         (Output_data_got::add_global_with_rel): Likewise.
4908         (Output_data_got::add_global_with_rela): Likewise.
4909         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4910         (Output_data_got::add_global_pair_with_rela): Likewise.
4911         (Output_data_got::add_local): Call add_got_entry.
4912         (Output_data_got::add_local_plt): Likewise.
4913         (Output_data_got::add_local_with_rel): Likewise.
4914         (Output_data_got::add_local_with_rela): Likewise.
4915         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4916         (Output_data_got::add_local_pair_with_rela): Likewise.
4917         (Output_data_got::reserve_slot): New function.
4918         (Output_data_got::reserve_slot_for_global): New function.
4919         (Output_data_got::add_got_entry): New function.
4920         (Output_data_got::add_got_entry_pair): New function.
4921         (Output_section::add_output_section_data): Edit FIXME.
4922         * output.h
4923         (Output_section_data_build::Output_section_data_build): New
4924         constructor with size parameter.
4925         (Output_data_space::Output_data_space): Likewise.
4926         (Output_data_got::Output_data_got): Initialize new data member; new
4927         constructor with size parameter.
4928         (Output_data_got::add_constant): Call add_got_entry.
4929         (Output_data_got::reserve_slot): New function.
4930         (Output_data_got::reserve_slot_for_global): New function.
4931         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4932         (Output_data_got::add_got_entry): New function.
4933         (Output_data_got::add_got_entry_pair): New function.
4934         (Output_data_got::free_list_): New data member.
4935         * target.h (Sized_target::init_got_plt_for_update): New function.
4936         (Sized_target::register_global_plt_entry): New function.
4937         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4938         Initialize new data member; call init; add constructor with PLT count.
4939         (Output_data_plt_x86_64::init): New function.
4940         (Output_data_plt_x86_64::add_relocation): New function.
4941         (Output_data_plt_x86_64::reserve_slot): New function.
4942         (Output_data_plt_x86_64::free_list_): New data member.
4943         (Target_x86_64::init_got_plt_for_update): New function.
4944         (Target_x86_64::register_global_plt_entry): New function.
4945         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4946         incremental updates.
4947         (Output_data_plt_x86_64::add_relocation): New function.
4948         * testsuite/object_unittest.cc (Object_test): Set default options.
4949
4950 2011-05-16  Ian Lance Taylor  <iant@google.com>
4951
4952         * options.h (class General_options): Make -i a synonym for -r.
4953
4954 2011-05-16  Ian Lance Taylor  <iant@google.com>
4955
4956         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4957
4958 2011-05-10 Cary Coutant  <ccoutant@google.com>
4959
4960         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4961         strip_all (-s).
4962
4963 2011-05-06  Ian Lance Taylor  <iant@google.com>
4964
4965         * layout.cc (Layout::layout): If the output section flags change,
4966         update the ordering.
4967
4968 2011-04-25 Cary Coutant  <ccoutant@google.com>
4969
4970         * incremental-dump.cc (dump_incremental_inputs): Print local
4971         symbol info for each input file.
4972         * incremental.cc
4973         (Output_section_incremental_inputs::set_final_data_size): Add local
4974         symbol info to input file entries in incremental info.
4975         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4976         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4977         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4978         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4979         implementation.
4980         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4981         (Sized_incr_relobj::do_relocate): Write the local symbols.
4982         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4983         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4984         Adjust size of input file header.
4985         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4986         (Incremental_inputs_reader::get_local_symbol_count): New function.
4987         (Incremental_inputs_reader::get_input_section): Adjust size of input
4988         file header.
4989         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4990         (Sized_incr_relobj::This): New typedef.
4991         (Sized_incr_relobj::sym_size): New const data member.
4992         (Sized_incr_relobj::Local_symbol): New struct.
4993         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4994         (Sized_incr_relobj::do_local_symbol_offset): New function.
4995         (Sized_incr_relobj::local_symbol_count_): New data member.
4996         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4997         (Sized_incr_relobj::local_symbol_index_): New data member.
4998         (Sized_incr_relobj::local_symbol_offset_): New data member.
4999         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5000         (Sized_incr_relobj::local_symbols_): New data member.
5001         * object.h (Relobj::output_local_symbol_count): New function.
5002         (Relobj::local_symbol_offset): New function.
5003         (Relobj::do_output_local_symbol_count): New function.
5004         (Relobj::do_local_symbol_offset): New function.
5005         (Sized_relobj::do_output_local_symbol_count): New function.
5006         (Sized_relobj::do_local_symbol_offset): New function.
5007
5008 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5009
5010         * descriptors.cc (set_close_on_exec): New function.
5011         (Descriptors::open): Use set_close_on_exec.
5012         * output.cc (S_ISLNK): Define if not defined.
5013
5014 2011-04-22 Cary Coutant  <ccoutant@google.com>
5015
5016         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5017         global symbol map.
5018         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5019         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5020         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5021         relocations.
5022         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5023         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5024         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5025         * incremental.h
5026         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5027         function.
5028         (Incremental_binary::apply_incremental_relocs): New function.
5029         (Incremental_binary::do_apply_incremental_relocs): New function.
5030         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5031         data member.
5032         (Sized_incremental_binary::add_global_symbol): New function.
5033         (Sized_incremental_binary::global_symbol): New function.
5034         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5035         (Sized_incremental_binary::symbol_map_): New data member.
5036         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5037         * target.h (Sized_target::apply_relocation): New function.
5038         * target-reloc.h (apply_relocation): New function.
5039         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5040
5041 2011-04-22  Doug Kwan  <dougkwan@google.com>
5042
5043         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5044         flag of a SHT_ARM_EXIDX section.
5045         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5046         * testsuite/Makefile.in: Regenerate.
5047         * testsuite/arm_exidx_test.s: New file.
5048         * testsuite/arm_exidx_test.sh: Same.
5049
5050 2011-04-20 Cary Coutant  <ccoutant@google.com>
5051
5052         PR gold/12689
5053         * archive.h (Incremental_archive_entry::Archive_member):
5054         Initialize arg_serial_ (second constructor).
5055
5056 2011-04-17  Ian Lance Taylor  <iant@google.com>
5057
5058         * object.cc (Relocate_info::location): Simplify location string.
5059         * errors.cc (Errors::error_at_location): Don't print program
5060         name.
5061         (Errors::warning_at_location): Likewise.
5062         (Errors::undefined_symbol): Likewise.
5063         * testsuite/debug_msg.sh: Update accordingly.
5064
5065 2011-04-14 Cary Coutant  <ccoutant@google.com>
5066
5067         * gold/layout.cc (Layout::symtab_section_offset): New function.
5068         * gold/layout.h (Layout::symtab_section_offset): New function.
5069         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5070
5071 2011-04-12  Ian Lance Taylor  <iant@google.com>
5072
5073         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5074         with MREMAP_MAYMOVE.
5075         * output.h (class Output_file): Add map_is_allocated_ field.
5076         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5077         not available, provide stubs.  If mremap is not available, #define
5078         it to gold_mremap.
5079         (MREMAP_MAYMOVE): Define if not defined.
5080         (Output_file::Output_file): Initialize map_is_allocated_.
5081         (Output_file::resize): Check map_is_allocated_.
5082         (Output_file::map_anonymous): If mmap fails, use malloc.
5083         (Output_file::unmap): Don't do anything for an anonymous map.
5084         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5085         is not available, provide stubs.
5086         (File_read::View::~View): Use free rather than delete[].
5087         (File_read::make_view): Use malloc rather than new[].  If mmap
5088         fails, use malloc.
5089         (File_read::find_or_make_view): Use malloc rather than new[].
5090         * gold.h: Remove HAVE_REMAP code.
5091         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5092         exists.  Rename mremap to gold_mremap.  If mmap is not available
5093         don't do anything.
5094         * configure, config.in: Rebuild.
5095
5096 2011-04-11  Ian Lance Taylor  <iant@google.com>
5097
5098         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5099         initialize local variable v.
5100
5101 2011-04-11  Cary Coutant  <ccoutant@google.com>
5102
5103         * archive.cc (Archive::include_member): Adjust call to
5104         report_object.
5105         (Add_archive_symbols::run): Track argument serial numbers.
5106         (Lib_group::include_member): Likewise.
5107         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5108         * archive.h (Incremental_archive_entry::Archive_member):
5109         Initialize arg_serial_.
5110         (Archive_member::arg_serial_): New data member.
5111         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5112         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5113         incremental link.
5114         (Sized_dynobj::do_for_all_local_got_entries): New function.
5115         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5116         function.
5117         * fileread.cc (get_mtime): New function.
5118         * fileread.h (get_mtime): New function.
5119         * gold.cc (queue_initial_tasks): Check for incremental update.
5120         (process_incremental_input): New function.
5121         (queue_middle_tasks): Don't force valid target for incremental
5122         update.
5123         * incremental-dump.cc (find_input_containing_global): Adjust
5124         size of symbol info entry.
5125         (dump_incremental_inputs): Dump argument serial number and
5126         in_system_directory flag; bias shndx by 1; print symbol names
5127         when dumping per-file symbol lists; use new symbol info readers.
5128         * incremental.cc
5129         (Output_section_incremental_inputs:update_data_size): New function.
5130         (Sized_incremental_binary::setup_readers): Setup input readers
5131         for each input file; build maps for files added from libraries
5132         and scripts.
5133         (Sized_incremental_binary::check_input_args): New function.
5134         (Sized_incremental_binary::do_check_inputs): Build map of argument
5135         serial numbers to input arguments.
5136         (Sized_incremental_binary::do_file_has_changed): Rename
5137         do_file_is_unchanged to this; compare file modification times.
5138         (Sized_incremental_binary::do_init_layout): New function.
5139         (Sized_incremental_binary::do_reserve_layout): New function.
5140         (Sized_incremental_binary::do_get_input_reader): Remove.
5141         (Sized_incremental_binary::get_symtab_view): New function.
5142         (Incremental_checker::can_incrementally_link_output_file): Remove.
5143         (Incremental_inputs::report_command_line): Exclude --debug options.
5144         (Incremental_inputs::report_archive_begin): Add parameter; track
5145         argument serial numbers; don't put input file entry for archive
5146         before archive members.
5147         (Incremental_inputs::report_archive_end): Put input file entry
5148         for archive after archive members.
5149         (Incremental_inputs::report_object): Add parameter; track argument
5150         serial numbers and in_system_directory flag.
5151         (Incremental_inputs::report_script): Add parameter; track argument
5152         serial numbers.
5153         (Output_section_incremental_inputs::set_final_data_size): Adjust
5154         size of symbol info entry; check for forwarding symbols.
5155         (Output_section_incremental_inputs::write_input_files): Write
5156         in_system_directory flag and argument serial number.
5157         (Output_section_incremental_inputs::write_info_blocks): Map section
5158         indices between incremental info and original input file; store
5159         input section index for each symbol.
5160         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5161         change operator() to visit().
5162         (class Global_got_offset_visitor): Likewise.
5163         (class Global_symbol_visitor_got_plt):
5164         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5165         classes.
5166         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5167         (Sized_incr_relobj::do_read_symbols): New function.
5168         (Sized_incr_relobj::do_layout): New function.
5169         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5170         (Sized_incr_relobj::do_add_symbols): New function.
5171         (Sized_incr_relobj::do_should_include_member): New function.
5172         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5173         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5174         (Sized_incr_relobj::do_section_size): New function.
5175         (Sized_incr_relobj::do_section_name): New function.
5176         (Sized_incr_relobj::do_section_contents): New function.
5177         (Sized_incr_relobj::do_section_flags): New function.
5178         (Sized_incr_relobj::do_section_entsize): New function.
5179         (Sized_incr_relobj::do_section_address): New function.
5180         (Sized_incr_relobj::do_section_type): New function.
5181         (Sized_incr_relobj::do_section_link): New function.
5182         (Sized_incr_relobj::do_section_info): New function.
5183         (Sized_incr_relobj::do_section_addralign): New function.
5184         (Sized_incr_relobj::do_initialize_xindex): New function.
5185         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5186         (Sized_incr_relobj::do_read_relocs): New function.
5187         (Sized_incr_relobj::do_gc_process_relocs): New function.
5188         (Sized_incr_relobj::do_scan_relocs): New function.
5189         (Sized_incr_relobj::do_count_local_symbols): New function.
5190         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5191         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5192         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5193         (Sized_incr_relobj::do_relocate): New function.
5194         (Sized_incr_relobj::do_set_section_offset): New function.
5195         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5196         (Sized_incr_dynobj::do_read_symbols): New function.
5197         (Sized_incr_dynobj::do_layout): New function.
5198         (Sized_incr_dynobj::do_add_symbols): New function.
5199         (Sized_incr_dynobj::do_should_include_member): New function.
5200         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5201         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5202         (Sized_incr_dynobj::do_section_size): New function.
5203         (Sized_incr_dynobj::do_section_name): New function.
5204         (Sized_incr_dynobj::do_section_contents): New function.
5205         (Sized_incr_dynobj::do_section_flags): New function.
5206         (Sized_incr_dynobj::do_section_entsize): New function.
5207         (Sized_incr_dynobj::do_section_address): New function.
5208         (Sized_incr_dynobj::do_section_type): New function.
5209         (Sized_incr_dynobj::do_section_link): New function.
5210         (Sized_incr_dynobj::do_section_info): New function.
5211         (Sized_incr_dynobj::do_section_addralign): New function.
5212         (Sized_incr_dynobj::do_initialize_xindex): New function.
5213         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5214         (make_sized_incremental_object): New function.
5215         (Incremental_library::copy_unused_symbols): New function.
5216         (Incremental_library::do_for_all_unused_symbols): New function.
5217         * incremental.h (enum Incremental_input_flags): New type.
5218         (class Incremental_checker): Remove.
5219         (Incremental_input_entry::Incremental_input_entry): Add argument
5220         serial number.
5221         (Incremental_input_entry::arg_serial): New function.
5222         (Incremental_input_entry::set_is_in_system_directory): New function.
5223         (Incremental_input_entry::is_in_system_directory): New function.
5224         (Incremental_input_entry::arg_serial_): New data member.
5225         (Incremental_input_entry::is_in_system_directory_): New data member.
5226         (class Script_info): Move here from script.h.
5227         (Script_info::Script_info): Add filename parameter.
5228         (Script_info::filename): New function.
5229         (Script_info::filename_): New data member.
5230         (Incremental_script_entry::Incremental_script_entry): Add argument
5231         serial number.
5232         (Incremental_object_entry::Incremental_object_entry): Likewise.
5233         (Incremental_object_entry::add_input_section): Build list of input
5234         sections with map to original shndx.
5235         (Incremental_object_entry::get_input_section_index): New function.
5236         (Incremental_object_entry::shndx_): New data member.
5237         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5238         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5239         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5240         serial number.
5241         (Incremental_inputs::report_archive_begin): Likewise.
5242         (Incremental_inputs::report_object): Likewise.
5243         (Incremental_inputs::report_script): Likewise.
5244         (class Incremental_global_symbol_reader): New class.
5245         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5246         and store flags and input file type.
5247         (Incremental_input_entry_reader::arg_serial): New function.
5248         (Incremental_input_entry_reader::type): Extract type from flags.
5249         (Incremental_input_entry_reader::is_in_system_directory): New function.
5250         (Incremental_input_entry_reader::get_input_section_count): Call
5251         accessor function for type.
5252         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5253         function for type; adjust size of global symbol entry.
5254         (Incremental_input_entry_reader::get_global_symbol_count): Call
5255         accessor function for type.
5256         (Incremental_input_entry_reader::get_object_count): Likewise.
5257         (Incremental_input_entry_reader::get_object_offset): Likewise.
5258         (Incremental_input_entry_reader::get_member_count): Likewise.
5259         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5260         (Incremental_input_entry_reader::get_member_offset): Likewise.
5261         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5262         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5263         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5264         (Incremental_input_entry_reader::get_global_symbol_reader): New
5265         function.
5266         (Incremental_input_entry_reader::get_output_symbol_index): New
5267         function.
5268         (Incremental_input_entry_reader::type_): Remove.
5269         (Incremental_input_entry_reader::flags_): New data member.
5270         (Incremental_inputs_reader::input_file_offset): New function.
5271         (Incremental_inputs_reader::input_file_index): New function.
5272         (Incremental_inputs_reader::input_file): Call input_file_offset.
5273         (Incremental_inputs_reader::input_file_at_offset): New function.
5274         (Incremental_relocs_reader::get_r_type): Reformat.
5275         (Incremental_relocs_reader::get_r_shndx): Reformat.
5276         (Incremental_relocs_reader::get_r_offset): Reformat.
5277         (Incremental_relocs_reader::data): New function.
5278         (Incremental_binary::Incremental_binary): Initialize new data members.
5279         (Incremental_binary::check_inputs): Add cmdline parameter.
5280         (Incremental_binary::file_is_unchanged): Remove.
5281         (Input_reader::arg_serial): New function.
5282         (Input_reader::get_unused_symbol_count): New function.
5283         (Input_reader::get_unused_symbol): New function.
5284         (Input_reader::do_arg_serial): New function.
5285         (Input_reader::do_get_unused_symbol_count): New function.
5286         (Input_reader::do_get_unused_symbol): New function.
5287         (Incremental_binary::input_file_count): New function.
5288         (Incremental_binary::get_input_reader): Change signature to use
5289         index instead of filename.
5290         (Incremental_binary::file_has_changed): New function.
5291         (Incremental_binary::get_input_argument): New function.
5292         (Incremental_binary::get_library): New function.
5293         (Incremental_binary::get_script_info): New function.
5294         (Incremental_binary::init_layout): New function.
5295         (Incremental_binary::reserve_layout): New function.
5296         (Incremental_binary::output_file): New function.
5297         (Incremental_binary::do_check_inputs): New function.
5298         (Incremental_binary::do_file_is_unchanged): Remove.
5299         (Incremental_binary::do_file_has_changed): New function.
5300         (Incremental_binary::do_init_layout): New function.
5301         (Incremental_binary::do_reserve_layout): New function.
5302         (Incremental_binary::do_input_file_count): New function.
5303         (Incremental_binary::do_get_input_reader): Change signature.
5304         (Incremental_binary::input_args_map_): New data member.
5305         (Incremental_binary::library_map_): New data member.
5306         (Incremental_binary::script_map_): New data member.
5307         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5308         new data members.
5309         (Sized_incremental_binary::output_section): New function.
5310         (Sized_incremental_binary::inputs_reader): Add const.
5311         (Sized_incremental_binary::symtab_reader): Add const.
5312         (Sized_incremental_binary::relocs_reader): Add const.
5313         (Sized_incremental_binary::got_plt_reader): Add const.
5314         (Sized_incremental_binary::get_symtab_view): New function.
5315         (Sized_incremental_binary::Inputs_reader): New typedef.
5316         (Sized_incremental_binary::Input_entry_reader): New typedef.
5317         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5318         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5319         (Sized_incremental_binary::do_file_has_changed): New function.
5320         (Sized_incremental_binary::do_init_layout): New function.
5321         (Sized_incremental_binary::do_reserve_layout): New function.
5322         (Sized_input_reader::Inputs_reader): Remove.
5323         (Sized_input_reader::Input_entry_reader): Remove.
5324         (Sized_input_reader::do_arg_serial): New function.
5325         (Sized_input_reader::do_get_unused_symbol_count): New function.
5326         (Sized_input_reader::do_get_unused_symbol): New function.
5327         (Sized_incremental_binary::do_input_file_count): New function.
5328         (Sized_incremental_binary::do_get_input_reader): Change signature;
5329         use index instead of filename.
5330         (Sized_incremental_binary::section_map_): New data member.
5331         (Sized_incremental_binary::input_entry_readers_): New data member.
5332         (class Sized_incr_relobj): New class.
5333         (class Sized_incr_dynobj): New class.
5334         (make_sized_incremental_object): New function.
5335         (class Incremental_library): New class.
5336         * layout.cc (Free_list::num_lists): New static data member.
5337         (Free_list::num_nodes): New static data member.
5338         (Free_list::num_removes): New static data member.
5339         (Free_list::num_remove_visits): New static data member.
5340         (Free_list::num_allocates): New static data member.
5341         (Free_list::num_allocate_visits): New static data member.
5342         (Free_list::init): New function.
5343         (Free_list::remove): New function.
5344         (Free_list::allocate): New function.
5345         (Free_list::dump): New function.
5346         (Free_list::print_stats): New function.
5347         (Layout_task_runner::run): Resize output file for incremental updates.
5348         (Layout::Layout): Initialize new data members.
5349         (Layout::set_incremental_base): New function.
5350         (Layout::init_fixed_output_section): New function.
5351         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5352         incremental updates.
5353         (Layout::create_gold_note): Do not create gold note section for
5354         incremental updates.
5355         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5356         for incremental updates.
5357         (Layout::set_section_offsets): For incremental updates, allocate space
5358         from free list.
5359         (Layout::create_symtab_sections): Layout with offsets relative to
5360         start of section; for incremental updates, allocate space from free
5361         list.
5362         (Layout::create_shdrs): For incremental updates, allocate space from
5363         free list.
5364         (Layout::finish_dynamic_section): For incremental updates, do not
5365         check --as-needed (fixed in subsequent patch).
5366         * layout.h (class Free_list): New class.
5367         (Layout::set_incremental_base): New function.
5368         (Layout::incremental_base): New function.
5369         (Layout::init_fixed_output_section): New function.
5370         (Layout::allocate): New function.
5371         (Layout::incremental_base_): New data member.
5372         (Layout::free_list_): New data member.
5373         * main.cc (main): Print Free_list statistics.
5374         * object.cc (Relobj::finalize_incremental_relocs): Add
5375         clear_counts parameter; clear counts only when clear_counts is set.
5376         (Sized_relobj::Sized_relobj): Initialize new base class.
5377         (Sized_relobj::do_layout): Don't report special sections.
5378         (Sized_relobj::do_for_all_local_got_entries): New function.
5379         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5380         symtab_off to all symbol table offsets.
5381         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5382         * object.h (class Got_offset_list): Move to top of file.
5383         (Object::Object): Allow case where input_file == NULL.
5384         (Object::~Object): Likewise.
5385         (Object::input_file): Assert that input_file != NULL.
5386         (Object::lock): Allow case where input_file == NULL.
5387         (Object::unlock): Likewise.
5388         (Object::is_locked): Likewise.
5389         (Object::token): Likewise.
5390         (Object::release): Likewise.
5391         (Object::is_incremental): New function.
5392         (Object::get_mtime): New function.
5393         (Object::for_all_local_got_entries): New function.
5394         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5395         (Object::set_is_in_system_directory): New function.
5396         (Object::is_in_system_directory): New function.
5397         (Object::do_is_incremental): New function.
5398         (Object::do_get_mtime): New function.
5399         (Object::do_for_all_local_got_entries): New function.
5400         (Object::is_in_system_directory_): New data member.
5401         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5402         (class Sized_relobj_base): New class.
5403         (class Sized_relobj): Derive from Sized_relobj_base.
5404         (class Sized_relobj::Symbols): Redeclare from base class.
5405         (class Sized_relobj::local_got_offset_list): Remove.
5406         (class Sized_relobj::Output_sections): Redeclare from base class.
5407         (class Sized_relobj::do_for_all_local_got_entries): New function.
5408         (class Sized_relobj::write_local_symbols): Add offset parameter.
5409         (class Sized_relobj::local_symbol_offset_): Update comment.
5410         (class Sized_relobj::local_dynsym_offset_): Update comment.
5411         * options.cc (Input_arguments::add_file): Remove const.
5412         * options.h (Input_file_argument::Input_file_argument):
5413         Initialize arg_serial_ (all constructors).
5414         (Input_file_argument::set_arg_serial): New function.
5415         (Input_file_argument::arg_serial): New function.
5416         (Input_file_argument::arg_serial_): New data member.
5417         (Input_arguments::Input_arguments): Initialize file_count_.
5418         (Input_arguments::add_file): Remove const.
5419         (Input_arguments::number_of_input_files): New function.
5420         (Input_arguments::file_count_): New data member.
5421         (Command_line::number_of_input_files): Call
5422         Input_arguments::number_of_input_files.
5423         * output.cc (Output_segment_headers::Output_segment_headers):
5424         Set current size.
5425         (Output_section::Input_section::current_data_size): New function.
5426         (Output_section::Output_section): Initialize new data members.
5427         (Output_section::add_input_section): Don't do merge sections for
5428         an incremental link; allocate space from free list for an
5429         incremental update.
5430         (Output_section::add_output_section_data): Allocate space from
5431         free list for an incremental update.
5432         (Output_section::update_data_size): New function.
5433         (Output_section::set_fixed_layout): New function.
5434         (Output_section::reserve): New function.
5435         (Output_segment::set_section_addresses): Remove const.
5436         (Output_segment::set_section_list_addresses): Remove const; allocate
5437         space from free list for an incremental update.
5438         (Output_segment::set_offset): Adjust size of RELRO segment for an
5439         incremental update.
5440         * output.h (Output_data::current_data_size): Move here from
5441         child classes.
5442         (Output_data::pre_finalize_data_size): New function.
5443         (Output_data::update_data_size): New function.
5444         (Output_section_headers::update_data_size): new function.
5445         (Output_section_data_build::current_data_size): Move to Output_data.
5446         (Output_data_strtab::update_data_size): New function.
5447         (Output_section::current_data_size): Move to Output_data.
5448         (Output_section::set_fixed_layout): New function.
5449         (Output_section::has_fixed_layout): New function.
5450         (Output_section::reserve): New function.
5451         (Output_section::update_data_size): New function.
5452         (Output_section::has_fixed_layout_): New data member.
5453         (Output_section::free_list_): New data member.
5454         (Output_segment::set_section_addresses): Remove const.
5455         (Output_segment::set_section_list_addresses): Remove const.
5456         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5457         New function.
5458         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5459         New function.
5460         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5461         parameter when calling Add_symbols constructor; store argument
5462         serial number for members of a lib group.
5463         (Add_symbols::locks): Allow case where token == NULL.
5464         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5465         (Read_member::~Read_member): New function.
5466         (Read_member::is_runnable): New function.
5467         (Read_member::locks): New function.
5468         (Read_member::run): New function.
5469         (Check_script::~Check_script): New function.
5470         (Check_script::is_runnable): New function.
5471         (Check_script::locks): New function.
5472         (Check_script::run): New function.
5473         (Check_library::~Check_library): New function.
5474         (Check_library::is_runnable): New function.
5475         (Check_library::locks): New function.
5476         (Check_library::run): New function.
5477         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5478         (Add_symbols::library_): New data member.
5479         (class Read_member): New class.
5480         (class Check_script): New class.
5481         (class Check_library): New class.
5482         * reloc.cc (Read_relocs::is_runnable): Allow case where
5483         token == NULL.
5484         (Read_relocs::locks): Likewise.
5485         (Scan_relocs::locks): Likewise.
5486         (Relocate_task::locks): Likewise.
5487         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5488         to clear counters.
5489         (Sized_relobj::incremental_relocs_scan): Fix comment.
5490         (Sized_relobj::do_relocate): Pass output file offset to
5491         write_local_symbols.
5492         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5493         from class declaration.
5494         * script.cc (read_input_script): Allocate Script_info; pass
5495         argument serial number to report_script.
5496         * script.h (class Script_info): Move to incremental.h.
5497         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5498         * symtab.h (Symbol_table::add_from_incrobj): New function.
5499         (Symbol_table::set_file_offset): New function.
5500
5501 2011-04-05  Cary Coutant  <ccoutant@google.com>
5502
5503         * incremental-dump.cc (dump_incremental_inputs): Change signature
5504         to take a Sized_incremental_binary; change caller.  Use readers
5505         in Sized_incremental_binary.
5506         * incremental.cc
5507         (Sized_incremental_binary::find_incremental_inputs_sections):
5508         Rename do_find_incremental_inputs_sections to this.
5509         (Sized_incremental_binary::setup_readers): New function.
5510         (Sized_incremental_binary::do_check_inputs): Check
5511         has_incremental_info_ flag; move setup code to setup_readers;
5512         use input readers.
5513         (Sized_incremental_binary::do_file_is_unchanged): New function.
5514         (Sized_incremental_binary::do_get_input_reader): New function.
5515         * incremental.h (class Incremental_binary): Move to end of file.
5516         (Incremental_binary::file_is_unchanged): New function.
5517         (Incremental_binary::do_file_is_unchanged): New function.
5518         (Incremental_binary::Input_reader): New class.
5519         (Incremental_binary::get_input_reader): New function.
5520         (class Sized_incremental_binary): Move to end of file.
5521         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5522         input section reader classes.
5523         (Sized_incremental_binary::has_incremental_info): New function.
5524         (Sized_incremental_binary::inputs_reader): New function.
5525         (Sized_incremental_binary::symtab_reader): New function.
5526         (Sized_incremental_binary::relocs_reader): New function.
5527         (Sized_incremental_binary::got_plt_reader): New function.
5528         (Sized_incremental_binary::do_file_is_unchanged): New function.
5529         (Sized_incremental_binary::Sized_input_reader): New class.
5530         (Sized_incremental_binary::get_input_reader): New function.
5531         (Sized_incremental_binary::find_incremental_inputs_sections):
5532         Rename do_find_incremental_inputs_sections to this.
5533         (Sized_incremental_binary::setup_readers): New function.
5534         (Sized_incremental_binary::has_incremental_info_): New data member.
5535         (Sized_incremental_binary::inputs_reader_): New data member.
5536         (Sized_incremental_binary::symtab_reader_): New data member.
5537         (Sized_incremental_binary::relocs_reader_): New data member.
5538         (Sized_incremental_binary::got_plt_reader_): New data member.
5539         (Sized_incremental_binary::current_input_file_): New data member.
5540
5541 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5542
5543         PR gold/12640
5544         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5545         violation.
5546
5547 2011-03-30  Cary Coutant  <ccoutant@google.com>
5548
5549         * archive.cc (Archive::include_member): Adjust call to report_object.
5550         (Add_archive_symbols::run): Add script_info to call to
5551         report_archive_begin.
5552         (Lib_group::include_member): Adjust call to report_object.
5553         (Add_lib_group_symbols::run): Adjust call to report_object.
5554         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5555         blocks.  Add object count for script input files.
5556         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5557         script_info parameter; change all callers.
5558         (Incremental_inputs::report_object): Add script_info parameter;
5559         change all callers.
5560         (Incremental_inputs::report_script): Store backpointer to
5561         incremental info entry.
5562         (Output_section_incremental_inputs::set_final_data_size): Record
5563         additional information for scripts.
5564         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5565         * incremental.h (Incremental_script_entry::add_object): New function.
5566         (Incremental_script_entry::get_object_count): New function.
5567         (Incremental_script_entry::get_object): New function.
5568         (Incremental_script_entry::objects_): New data member; adjust
5569         constructor.
5570         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5571         (Incremental_inputs::report_object): Add script_info parameter.
5572         (Incremental_inputs_reader::get_object_count): New function.
5573         (Incremental_inputs_reader::get_object_offset): New function.
5574         * options.cc (Input_arguments::add_file): Return reference to
5575         new input argument.
5576         * options.h (Input_argument::set_script_info): New function.
5577         (Input_argument::script_info): New function.
5578         (Input_argument::script_info_): New data member; adjust all
5579         constructors.
5580         (Input_file_group::add_file): Return reference to new input argument.
5581         (Input_file_lib::add_file): Likewise.
5582         (Input_arguments::add_file): Likewise.
5583         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5584         * script.cc (Parser_closure::Parser_closure): Add script_info
5585         parameter; adjust all callers.
5586         (Parser_closure::script_info): New function.
5587         (Parser_closure::script_info_): New data member.
5588         (read_input_script): Report scripts earlier to incremental info.
5589         (script_add_file): Set script_info in Input_argument.
5590         (script_add_library): Likewise.
5591         * script.h (Script_options::Script_info): Rewrite class.
5592
5593 2011-03-29  Cary Coutant  <ccoutant@google.com>
5594
5595         * archive.cc (Library_base::should_include_member): Move
5596         method here from class Archive.
5597         (Archive::Archive): Initialize base class.
5598         (Archive::should_include_member): Move to base class.
5599         (Archive::do_for_all_unused_symbols): New function.
5600         (Add_archive_symbols::run): Remove redundant access to
5601         incremental_inputs.
5602         (Lib_group::Lib_group): Initialize base class.
5603         (Lib_group::do_filename): New function.
5604         (Lib_group::include_member): Pass pointer to Lib_group to
5605         report_object.
5606         (Lib_group::do_for_all_unused_symbols): New function.
5607         (Add_lib_group_symbols::run): Report archive information for
5608         incremental links.
5609         * archive.h (class Library_base): New base class.
5610         (class Archive): Derive from Library_base.
5611         (Archive::filename): Move to base class.
5612         (Archive::set_incremental_info): Likewise.
5613         (Archive::incremental_info): Likewise.
5614         (Archive::Should_include): Likewise.
5615         (Archive::should_include_member): Likewise.
5616         (Archive::Armap_entry): Remove.
5617         (Archive::Unused_symbol_iterator): Remove.
5618         (Archive::unused_symbols_begin): Remove.
5619         (Archive::unused_symbols_end): Remove.
5620         (Archive::do_filename): New function.
5621         (Archive::do_get_mtime): New function.
5622         (Archive::do_for_all_unused_symbols): New function.
5623         (Archive::task_): Move to base class.
5624         (Archive::incremental_info_): Likewise.
5625         (class Lib_group): Derive from Library_base.
5626         (Lib_group::do_filename): New function.
5627         (Lib_group::do_get_mtime): New function.
5628         (Lib_group::do_for_all_unused_symbols): New function.
5629         (Lib_group::task_): Move to base class.
5630         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5631         function.
5632         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5633         function.
5634         * incremental.cc (Incremental_inputs::report_archive_begin):
5635         Use Library_base; call library's get_mtime; add incremental inputs
5636         entry before members.
5637         (class Unused_symbol_visitor): New class.
5638         (Incremental_inputs::report_archive_end): Use Library_base; use
5639         visitor class to record unused symbols; don't add incremental inputs
5640         entry after members.
5641         (Incremental_inputs::report_object): Use Library_base.
5642         * incremental.h
5643         (Incremental_archive_entry::Incremental_archive_entry): Remove
5644         unused Archive parameter.
5645         (Incremental_inputs::report_archive_begin): Use Library_base.
5646         (Incremental_inputs::report_archive_end): Likewise.
5647         (Incremental_inputs::report_object): Likewise.
5648         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5649         function.
5650         * object.h (Object::for_all_global_symbols): New function.
5651         (Object::do_for_all_global_symbols): New function.
5652         (Sized_relobj::do_for_all_global_symbols): New function.
5653         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5654         function.
5655         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5656         function.
5657
5658 2011-03-27  Ian Lance Taylor  <iant@google.com>
5659
5660         * archive.cc (Archive::interpret_header): Return -1 if something
5661         goes wrong.  Change callers accordingly.
5662
5663 2011-03-25  Cary Coutant  <ccoutant@google.com>
5664
5665         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5666         * testsuite/Makefile.in: Regenerate.
5667
5668 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5669
5670         * plugin.cc (get_view): New.
5671         (Plugin::load): Pass get_view to the plugin.
5672         (Plugin_manager::get_view): New.
5673
5674 2011-03-21  Ian Lance Taylor  <iant@google.com>
5675
5676         * testsuite/final_layout.sh: Rewrite to not use dc.
5677         * testsuite/relro_test.sh: Fail if dc is not present.
5678
5679 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5680
5681         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5682         Change == to -eq.
5683         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5684         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5685         Change == to -eq.
5686         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5687         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5688
5689 2011-03-14  Ian Lance Taylor  <iant@google.com>
5690
5691         * script-sections.cc (Sort_output_sections::script_compare):
5692         Rename from is_before, change return type.
5693         (Sort_output_sections::operator()): Adjust accordingly.
5694
5695 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5696
5697         PR gold/12572
5698         * testsuite/odr_violation2.cc: Add comment to make all error line
5699         numbers double digits.
5700         * testsuite/debug_msg.sh: Adjust expected errors.
5701
5702 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5703
5704         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5705         but mark earlier ones as non-canonical
5706         (offset_to_iterator): Update search target and example
5707         (do_addr2line): Return extra lines in a vector*
5708         (format_file_lineno): Extract from do_addr2line
5709         (one_addr2line): Add vector* out-param
5710         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5711         when a lineno entry appeared last for its instruction
5712         (Dwarf_line_info): Add vector* out-param
5713         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5714         * symtab.cc (Odr_violation_compare): Include the lineno in the
5715         comparison again.
5716         (linenos_from_loc): New. Combine the canonical line for an
5717         address with its other lines.
5718         (True_if_intersect): New. Helper functor to make
5719         std::set_intersection a query.
5720         (detect_odr_violations): Compare sets of lines instead of just
5721         one line for each function. This became less deterministic, but
5722         has fewer false positives.
5723         * symtab.h: Declarations.
5724         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5725         mix an optimized and non-optimized object in the same binary
5726         (odr_violation2.so): Same.
5727         * testsuite/Makefile.in: Regenerate from Makefile.am.
5728         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5729         * testsuite/debug_msg.sh: Update line numbers and add
5730         assertions.
5731         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5732         non-optimized context.
5733         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5734         isn't inlined, and use OdrDerived in an optimized context.
5735         * testsuite/odr_header1.h: Defines OdrDerived, where
5736         optimization will change the
5737         first-instruction-in-the-destructor's file and line number.
5738         * testsuite/odr_header2.h: Defines OdrBase.
5739
5740 2011-03-09  Ian Lance Taylor  <iant@google.com>
5741
5742         * fileread.cc (File_read::clear_views): Don't delete the whole
5743         file view.
5744
5745 2011-03-08  Ian Lance Taylor  <iant@google.com>
5746
5747         PR gold/12525
5748         * fileread.cc: #include <climits>.
5749         (GOLD_IOV_MAX): Define.
5750         (File_read::read_multiple): Limit number of entries by iov_max.
5751         * fileread.h (class File_read): Always set max_readv_entries to
5752         128.
5753
5754 2011-03-07  Ian Lance Taylor  <iant@google.com>
5755
5756         PR gold/12525
5757         * options.h (class General_options): Add -dy and -dn.
5758
5759 2011-03-02  Cary Coutant  <ccoutant@google.com>
5760
5761         * testsuite/script_test_9.t: Add TLS segment.
5762
5763 2011-03-02  Simon Baldwin  <simonb@google.com>
5764
5765         * configure.ac: Add check for gnu_indirect_function support in
5766         the toolchain building binutils.
5767         * configure: Rebuild.
5768
5769 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5770
5771         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5772         plugin only symbols.
5773         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5774         in plugin files as not needed in the symbol table.
5775
5776 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5777
5778         * output.cc (Output_section::add_input_section): Delay fill
5779         generation for section ordering.
5780
5781 2011-02-09  Ian Lance Taylor  <iant@google.com>
5782
5783         PR gold/12316
5784         * object.h (class Sized_relobj): Remove clear_local_symbols.
5785         * reloc.cc (Sized_relobj::do_relocate): Don't call
5786         clear_local_symbols.
5787
5788 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5789
5790         * plugin.cc (is_visible_from_outside): Return true for symbols
5791         in the -u option.
5792
5793 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5794
5795         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5796         filename.
5797
5798 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5799
5800         * icf.h (is_section_foldable_candidate): Change type of parameter
5801         to std::string.
5802         * icf.cc (Icf::find_identical_sections): Change type of local variable
5803         section_name to be std::string.
5804         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5805
5806 2011-01-25  Ian Lance Taylor  <iant@google.com>
5807
5808         * script.cc (script_add_extern): Rewrite to use
5809         add_symbol_reference.
5810
5811 2011-01-25  Doug Kwan  <dougkwan@google.com>
5812
5813         * icf.cc (get_section_contents): Always lock section's object.
5814
5815 2011-01-24  Ian Lance Taylor  <iant@google.com>
5816
5817         * options.h (class General_options): Accept
5818         --no-detect-odr-violations.
5819
5820 2011-01-24  Ian Lance Taylor  <iant@google.com>
5821
5822         * version.cc (version_string): Bump to 1.11.
5823
5824 2011-01-24  Ian Lance Taylor  <iant@google.com>
5825
5826         * plugin.cc (class Plugin_rescan): Define new class.
5827         (Plugin_manager::claim_file): Set any_claimed_.
5828         (Plugin_manager::save_archive): New function.
5829         (Plugin_manager::save_input_group): New function.
5830         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5831         necessary.
5832         (Plugin_manager::new_undefined_symbol): New function.
5833         (Plugin_manager::rescan): New function.
5834         (Plugin_manager::rescannable_defines): New function.
5835         (Plugin_manager::add_input_file): Set any_added_.
5836         * plugin.h (class Plugin_manager): define new fields rescannable_,
5837         undefined_symbols_, any_claimed_, and any_added_.  Declare
5838         Plugin_rescan as friend.  Declare new functions.
5839         (Plugin_manager::Rescannable): Define type.
5840         (Plugin_manager::Rescannable_list): Define type.
5841         (Plugin_manager::Undefined_symbol_list): Define type.
5842         (Plugin_manager::Plugin_manager): Initialize new fields.
5843         * archive.cc (Archive::defines_symbol): New function.
5844         (Add_archive_symbols::run): Pass archive to plugins if any.
5845         * archive.h (class Archive): Declare defines_symbol.
5846         * readsyms.cc (Input_group::~Input_group): New function.
5847         (Finish_group::run): Pass input_group to plugins if any.
5848         * readsyms.h (class Input_group): Declare destructor.
5849         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5850         any.
5851
5852 2011-01-10  Ian Lance Taylor  <iant@google.com>
5853
5854         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5855         section as relro.
5856         (Layout::set_segment_offsets): Reset increase_relro before calling
5857         set_section_addresses a second time.
5858
5859 2011-01-04  Cary Coutant  <ccoutant@google.com>
5860
5861         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5862         sections before NOBITS sections.
5863
5864 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5865
5866         * version.cc (print_version): Update copyright to 2011.
5867
5868 2010-12-23  Cary Coutant  <ccoutant@google.com>
5869
5870         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5871         of OS to this->add.  Add OD parameter to second form of the function.
5872
5873 2010-12-20  Ian Lance Taylor  <iant@google.com>
5874
5875         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5876         second of two consecutive entries with same offset.
5877
5878 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5879
5880         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5881         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5882         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5883         to avoid unneeded links against $(LDADD).
5884         * testsuite/Makefile.in: Regenerate.
5885
5886 2010-12-15  Ian Lance Taylor  <iant@google.com>
5887
5888         PR gold/12324
5889         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5890         for R_X86_64_32 and R_X86_64_PC32.
5891         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5892         ver_matching_def_pic.o.
5893         (ver_matching_def_pic.o): New target.
5894
5895 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5896
5897         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5898         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5899         Move definition before File_read::View member definitions.
5900         (File_read::View::~View): Initialize and hold lock before
5901         updating current_mapped_bytes.
5902
5903 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5904
5905         * dwarf_reader.cc: Remove outdated comment.
5906         * gold-threads.cc: Fix typo in error message.
5907         * archive.cc: Fix typos in comments.
5908         * archive.h: Likewise.
5909         * arm-reloc-property.cc: Likewise.
5910         * arm-reloc-property.h: Likewise.
5911         * arm-reloc.def: Likewise.
5912         * arm.cc: Likewise.
5913         * attributes.h: Likewise.
5914         * cref.cc: Likewise.
5915         * ehframe.cc: Likewise.
5916         * fileread.h: Likewise.
5917         * gold.h: Likewise.
5918         * i386.cc: Likewise.
5919         * icf.cc: Likewise.
5920         * incremental.h: Likewise.
5921         * int_encoding.cc: Likewise.
5922         * layout.h: Likewise.
5923         * main.cc: Likewise.
5924         * merge.h: Likewise.
5925         * object.cc: Likewise.
5926         * object.h: Likewise.
5927         * options.cc: Likewise.
5928         * readsyms.cc: Likewise.
5929         * reduced_debug_output.cc: Likewise.
5930         * reloc.cc: Likewise.
5931         * script-sections.cc: Likewise.
5932         * sparc.cc: Likewise.
5933         * symtab.h: Likewise.
5934         * target-reloc.h: Likewise.
5935         * target.cc: Likewise.
5936         * target.h: Likewise.
5937         * timer.cc: Likewise.
5938         * timer.h: Likewise.
5939         * x86_64.cc: Likewise.
5940
5941 2010-12-09  Cary Coutant  <ccoutant@google.com>
5942
5943         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5944         stack.
5945         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5946         parameter; change all callers.
5947         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5948         * options.h (warn_execstack): New option.
5949
5950 2010-12-07  Doug Kwan  <dougkwan@google.com>
5951
5952         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5953         like function call relocations.
5954
5955 2010-12-07  Ian Lance Taylor  <iant@google.com>
5956
5957         * archive.cc (Archive::get_elf_object_for_member): Permit
5958         punconfigured to be NULL.
5959         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5960         (Archive::include_member): Pass NULL to get_elf_object_for_member
5961         if we searched for the archive and this is the first included
5962         object.
5963
5964 2010-12-01  Ian Lance Taylor  <iant@google.com>
5965
5966         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5967         track_relocs_type_ field.
5968         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5969         Set track_relocs_type_.
5970         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5971         contents when using RELA relocs.
5972         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5973         reloc_map_.
5974         * reloc.cc (Track_relocs::next_addend): New function.
5975         * reloc.h (class Track_relocs): Declare next_addend.
5976
5977 2010-12-01  Ian Lance Taylor  <iant@google.com>
5978
5979         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5980         virtual destructor.
5981
5982 2010-12-01  Ian Lance Taylor  <iant@google.com>
5983
5984         * README: Update compilers known to work and fail.
5985
5986 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5987
5988         * configure.in: For --enable-gold, handle value `default' instead of
5989         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5990         not the default.
5991         * configure: Regenerate.
5992
5993 2010-11-18  Doug Kwan  <dougkwan@google.com>
5994
5995         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5996         and right_alignment to be zero.  Store result alignment only if it is
5997         greater than existing alignment.
5998
5999 2010-11-16  Cary Coutant  <ccoutant@google.com>
6000
6001         PR gold/12220
6002         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6003         Check for ".zdebug_line".
6004
6005 2010-11-16  Doug Kwan  <dougkwan@google.com>
6006             Cary Coutant  <ccoutant@google.com>
6007
6008         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6009         by reference; adjust all callers.
6010         * output.cc (Output_segment::set_section_addresses): Adjust references
6011         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6012         list is empty.
6013         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6014         end at page boundary.
6015
6016 2010-11-16  Cary Coutant  <ccoutant@google.com>
6017
6018         PR gold/12220
6019         * layout.cc (Layout::choose_output_section): Transform names of
6020         compressed sections even when using a script with a SECTIONS clause.
6021         (Layout::output_section_name): Remove code to transform
6022         compressed debug section names.
6023         * output.cc (Output_section::add_input_section): Use uncompressed
6024         section size when tracking input sections.
6025
6026 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6027
6028         * symtab.h (Symbol::NON_PIC_REF): Remove.
6029         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6030         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6031         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6032         (Symbol::use_plt_offset): Take a flags argument and pass it
6033         directly to needs_dynamic_reloc.  Restrict check for undefined
6034         weak symbols to function calls.
6035         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6036         (Target_arm::Scan::global): Use it.
6037         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6038         (Target_arm::Relocate::relocate): Likewise.
6039         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6040         parameter with an r_type parameter.  Use get_reference_flags
6041         to get the flags.
6042         (Target_arm::Relocate::relocate): Update accordingly.
6043         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6044         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6045         (Target_i386::Scan::global): Likewise.
6046         (Target_i386::Relocate::relocate): Likewise.
6047         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6048         parameter with an r_type parameter.  Use get_reference_flags
6049         to get the flags.
6050         (Target_i386::Relocate::relocate): Update accordingly.
6051         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6052         (Target_powerpc::Scan::global): Use it.
6053         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6054         (Target_powerpc::Relocate::relocate): Likewise.
6055         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6056         (Target_sparc::Scan::global): Use it.
6057         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6058         (Target_sparc::Relocate::relocate): Likewise.
6059         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6060         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6061         (Target_x86_64::Scan::global): Likewise.
6062         (Target_x86_64::Relocate::relocate): Likewise.
6063
6064 2010-11-08  Doug Kwan  <dougkwan@google.com>
6065             Cary Coutant  <ccoutant@google.com>
6066
6067         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6068         (Arm_exidx_merge_section::section_contents_): New data member.
6069         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6070         (Arm_input_section::~Arm_input_section): De-allocate memory.
6071         (Arm_input_section::original_contents_): New data member.
6072         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6073         in parameters instead of calling Object::section_contents without
6074         locking.
6075         (Arm_output_section::group_section): New parameter TASK.  Pass it
6076         to callees that need locking objects.
6077         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6078         to lock EXIDX input sections.  Fix a formatting issue.  Call
6079         Arm_exidx_merged_section::build_contents to create merged section
6080         contents.
6081         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6082         to lock object of stub table owner.
6083         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6084         TEXT_SIZE to initialize data member TEXT_SIZE_.
6085         (Arm_exidx_input_section::addralign): Fix typo in comment.
6086         (Arm_exidx_input_section::text_size): New method.
6087         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6088         that require locking objects.  Lock objects before scanning for stubs
6089         and updating local symbols.
6090         (Arm_input_section<big_endian>::init): Copy contents of original
6091         input section.
6092         (Arm_input_section<big_endian>::do_write): Use saved contents of
6093         original input section instead of calling Object::section_contents
6094         without locking.
6095         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6096         size without calling Object::section_size().
6097         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6098         for size.  Allocate a buffer for merged EXIDX entries.
6099         (Arm_exidx_merged_section::build_contents): New method.
6100         (Arm_exidx_merged_section::do_write): Move merge section contents
6101         building code to Arm_exidx_merged_section::build_contetns.  Write
6102         out contetns in buffer instead of building it on the fly.
6103         (Arm_relobj::make_exidx_input_section): Also pass text section size
6104         to Arm_exidx_input_section constructor.
6105         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6106         (Arm_dynobj::do_read_symbols): Fix memory leak.
6107         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6108         * target.h: (class Task): Add forward declaration.
6109         (Target::relax): Add new parameter TASK and pass it to
6110         Target::do_relax().
6111         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6112
6113 2010-11-05  Cary Coutant  <ccoutant@google.com>
6114
6115         PR gold/10708
6116         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6117         object when reading from the file.
6118         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6119         second layout pass.
6120         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6121         when reading section contents.
6122         (get_section_contents): Likewise.
6123         (icf::find_identical_sections): Likewise.
6124         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6125         object when reading from the file.
6126         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6127         the object when doing deferred section layout.
6128
6129 2010-11-03  Nick Clifton  <nickc@redhat.com>
6130
6131         PR gold/12001
6132         * script.h (class Symbol_assignment: name): New member.  Returns
6133         the name of the symbol.
6134         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6135         Returns true if the given symbol name is on the list of
6136         assignments wating to be processed.
6137         * archive.cc (should_incldue_member): If the symbol is undefined,
6138         check to see if it is on the list of symbols pending assignment.
6139
6140 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6141
6142         * script-sections.cc (Script_sections::find_memory_region): Check
6143         for a NULL output section pointer.
6144
6145 2010-10-29  Doug Kwan  <dougkwan@google.com>
6146
6147         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6148         Output_section::add_relaxed_input_section.
6149         * output.cc (Output_section::add_relaxed_input_section): Add new
6150         arguments LAYOUT and NAME.  Set section order index.
6151         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6152         Copy section order index.
6153         * output.h (Output_section::add_relaxed_input_section): Add new
6154         arguments LAYOUT and NAME.
6155
6156 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6157
6158         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6159         NATIVE_OR_CROSS_LINKER.
6160         * testsuite/Makefile.in: Regenerate.
6161
6162 2010-10-20  Doug Kwan  <dougkwan@google.com>
6163
6164         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6165         without SHF_LINK_ORDER flags.
6166         * layout.cc (Layout::choose_output_section): Do not filter
6167         SHF_LINK_ORDER flag in a relocatable link.
6168
6169 2010-10-17  Cary Coutant  <ccoutant@google.com>
6170
6171         * output.h (Output_segment::set_section_addresses): Change function
6172         signature.  Update all callers.
6173         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6174         sections.
6175         (Output_segment::set_section_addresses): Align after last TLS
6176         section.  Add padding before last relro section instead of after.
6177
6178 2010-10-17  Doug Kwan  <dougkwan@google.com>
6179
6180         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6181         GOT output section to be writable.
6182
6183 2010-10-14  Cary Coutant  <ccoutant@google.com>
6184
6185         * debug.h (DEBUG_INCREMENTAL): New flag.
6186         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6187         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6188         mode.
6189         * incremental.cc (report_command_line): Ignore all forms of
6190         --incremental.
6191         * layout.cc (Layout::Layout): Check parameters for incremental link
6192         mode.
6193         * options.cc (General_options::parse_incremental): New function.
6194         (General_options::parse_no_incremental): New function.
6195         (General_options::parse_incremental_full): New function.
6196         (General_options::parse_incremental_update): New function.
6197         (General_options::incremental_mode_): New data member.
6198         (General_options::finalize): Check incremental_mode_.
6199         * options.h (General_options): Update help text for --incremental.
6200         Add --no-incremental, --incremental-full, --incremental-update.
6201         (General_options::Incremental_mode): New enum type.
6202         (General_options::incremental_mode): New function.
6203         (General_options::incremental_mode_): New data member.
6204         * parameters.cc (Parameters::incremental_mode_): New data member.
6205         (Parameters::set_options): Set incremental_mode_.
6206         (Parameters::set_incremental_full): New function.
6207         (Parameters::incremental): New function.
6208         (Parameters::incremental_update): New function.
6209         (set_parameters_incremental_full): New function.
6210         * parameters.h (Parameters::set_incremental_full): New function.
6211         (Parameters::incremental): New function.
6212         (Parameters::incremental_update): New function.
6213         (Parameters::incremental_mode_): New data member.
6214         (set_parameters_incremental_full): New function.
6215         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6216         incremental link mode.
6217         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6218         (Sized_relobj::do_relocate_sections): Likewise.
6219         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6220         option.
6221         * testsuite/Makefile.in: Regenerate.
6222         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6223
6224 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6225
6226         * script-sections.h (class Script_sections): Make
6227         Sections_elements typedef public.
6228         * script-sections.cc (class Sort_output_sections): Add elements_
6229         field.  Add constructor which sets it; change all callers.
6230         (Sort_output_sections::is_before): New function.
6231         (Sort_output_sections::operator()): Call is_before.
6232         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6233         conditional.
6234         * testsuite/script_test_10.sh: New test. Test script section
6235         order.
6236         * testsuite/script_test_10.t: Likewise.
6237         * testsuite/script_test_10.s: Likewise.
6238         * testsuite/Makefile.am: Wrap the cross linker tests and the
6239         common tests into NATIVE_OR_CROSS_LINKER.
6240         (check_SCRIPTS): Add script_test_10.sh.
6241         (check_DATA): Add script_test_10.stdout.
6242         (script_test_10.o, script_test_10): New targets.
6243         (script_test_10.stdout): New target.
6244         * configure, testsuite/Makefile.in: Regenerate.
6245
6246 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6247
6248         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6249         error for the deprecated relocations.
6250         (Target_arm::Scan::global): Likewise.
6251         (Target_arm::Relocate::relocate): Likewise.
6252
6253 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6254
6255         * fileread.cc (Input_file::find_file): Initialize *found_name
6256         and *namep when using the fallback search for case 4.
6257
6258 2010-10-11  Cary Coutant  <ccoutant@google.com>
6259
6260         * options.h (class General_options): Redefine -z lazy as an alias for
6261         the negation of -z now.
6262
6263 2010-10-11  Ian Lance Taylor  <iant@google.com>
6264
6265         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6266         binding.
6267
6268 2010-10-06  Nick Clifton  <nickc@redhat.com>
6269
6270         * script-sections.cc(class Memory_region): Remove
6271         current_lma_offset_ field.  Rename current_vma_offset_ to
6272         current_offset_.  Add last_section_ field.
6273         (Memory_region::get_current_vma_address): Rename to
6274         get_current_address.
6275         (Memory_region::get_current_lma_address): Delete.
6276         (Memory_region::increment_vma_offset): Rename to
6277         increment_offset.
6278         (Memory_region::increment_lma_offset): Delete.
6279         (Memory_region::attributes_compatible): New method.  Returns
6280         true if the provided section is compatible with the region.
6281         (Memory_region::get_last_section): New method.  Returns the last
6282         section to use the region.
6283         (Memory_region::set_last_section): New method.  Stores the last
6284         section to use the region.
6285         (Script_sections::block_in_region): New method.  Returns true if
6286         a block of memory is contained within a region.
6287         (Script_sections::find_memory_region): New method.  Locates a
6288         memory region to be used to set a VMA or LMA address.
6289         (Output_section_definition::set_section_addresses): Add code to
6290         check for addresses set by memory regions.
6291         (Output_segment::set_section_addresses): Remove memory region
6292         walking code.
6293         (Script_sections::create_segment): Add a warning if a header
6294         segment is created outside of any region.
6295         * script-sections.h (class Script_sections): Add prototypes for
6296         find_memory_region and block_in_region methods.
6297         * testsuite/memory_test.s: Use .long instead of .word.
6298         * testsuite/memory_test.t: Add some more output sections.
6299         * testsuite/memory_test.sh: Update expected output.
6300
6301 2010-10-02  Doug Kwan  <dougkwan@google.com>
6302
6303         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6304         defintion to symtab.h
6305         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6306         declaration to defintion.
6307
6308 2010-10-01  Nick Clifton  <nickc@redhat.com>
6309
6310         * expression.cc (eval): Replace dummy argument with NULL.
6311         (eval_maybe_dot): Check for a NULL result section pointer.
6312         (Symbol_expression::value): Likewise.
6313         (Dot_expression::value): Likewise.
6314         (BINARY_EXPRESSION): Likewise.
6315         (Max_expression::value): Likewise.
6316         (Min_expression::value): Likewise.
6317         (Absolute_expression::value): Likewise.
6318         (Addr_expression::value_from_output_section): Likewise.
6319         (Loaddddr_expression::value_from_output_section): Likewise.
6320         (Segment_start_expression::value): Likewise.
6321         * script-sections.cc
6322         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6323         argument with NULL.
6324         (Sections_elememt_dot_assignment::set_section_addresses):
6325         Likewise.
6326         (Output_data_expression::do_write_to_buffer): Likewise.
6327         (Output_section_definition::finalize_symbols): Likewise.
6328         (Output_section_definition::set_section_addresses): Likewise.
6329
6330 2010-09-30  Doug Kwan  <dougkwan@google.com>
6331
6332         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6333
6334 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6335
6336         * target.h (Target::can_icf_inline_merge_sections): New virtual
6337         function.
6338         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6339         virtual function.
6340         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6341         virtual function.
6342         * icf.cc (get_section_contents): Inline merge sections only when
6343         target allows it.
6344
6345 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6346
6347         * configure: Regenerate.
6348
6349 2010-09-17  Ian Lance Taylor  <iant@google.com>
6350
6351         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6352         * testsuite/Makefile.am (memory_test.o): New target.
6353         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6354         memory_test.t.
6355         * testsuite/Makefile.in: Rebuild.
6356
6357 2010-09-17  Doug Kwan  <dougkwan@google.com>
6358
6359         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6360         defintion if relocation uses GOT entries of the symbol.
6361         * testsuite/icf_safe_test.sh: Fix test.
6362         * testsuite/icf_safe_so_test.sh: Fix test.
6363
6364 2010-09-16  Cary Coutant  <ccoutant@google.com>
6365
6366         * script_sections.cc (class Memory_region): Remove "NULL" from
6367         vector initializations.
6368
6369 2010-09-15  Cary Coutant  <ccoutant@google.com>
6370
6371         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6372         Resolve forwarding symbols.
6373
6374 2010-09-15  Doug Kwan  <dougkwan@google.com>
6375
6376         * gold/testsuite/script_test_3.t: Add ARM special sections.
6377         * gold/testsuite/script_test_4.t: Same.
6378         * gold/testsuite/script_test_5.t: Same.
6379         * gold/testsuite/script_test_6.t: Same.
6380         * gold/testsuite/script_test_7.t: Same.
6381         * gold/testsuite/script_test_7.t: Same.
6382         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6383
6384 2010-09-14  Cary Coutant  <ccoutant@google.com>
6385
6386         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6387         (Target_x86_64::Relocate::relocate_tls): Replace check for
6388         saw_tls_block_reloc_ with test for executable section.
6389
6390 2010-09-12  Cary Coutant  <ccoutant@google.com>
6391
6392         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6393         position-independent executables to shared libraries need dynamic
6394         relocations.
6395         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6396         position-independent executables.
6397         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6398         * testsuite/Makefile.in: Regenerate.
6399
6400 2010-09-10  Nick Clifton  <nickc@redhat.com>
6401
6402         PR gold/11997
6403         * testsuite/memory_test.t: Discard any sections that are not
6404         needed.
6405
6406 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6407
6408         PR gold/11996
6409         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6410         "This::" to work around a bug in gcc 4.2.
6411
6412         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6413
6414 2010-09-09  Rafael Espindola  <espindola@google.com>
6415
6416         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6417         sections with different PF_X flags in the same segment.
6418         (Layout::find_first_load_seg): Search all segments to find the first
6419         one.
6420         * options.h (rosegment): New.
6421
6422 2010-09-08  Rafael Espindola  <espindola@google.com>
6423
6424         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6425
6426 2010-09-08  Doug Kwan  <dougkwan@google.com>
6427
6428         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6429         (Arm_relobj::do_relocate_sections): Add new parameter for output
6430         file to match the parent.
6431         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6432         of local symbols instead of input values.  Update code to track
6433         changes in gold::relocate_section.
6434         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6435         (Sized_relobj::compute_final_local_value_internal): New methods.
6436         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6437         body into private version of Sized_relobj::compute_final_local_value.
6438         Call the inline method.
6439         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6440         merged symbol value if there is one.
6441         (Symbol_value::has_output_value): New method defintiion.
6442         (Sized_relobj::Compute_final_local_value_status): New enum type.
6443         (Sized_relobj::compute_final_local_value): New methods.
6444         (Sized_relobj::compute_final_local_value_internal): New methods.
6445         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6446         and arm_cortex_a8.sh.
6447         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6448         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6449         New tests.
6450         * Makefile.in: Regenerate.
6451         * testsuite/arm_bl_out_of_range.s: Update test.
6452         * testsuite/thumb_bl_out_of_range.s: Ditto.
6453         * testsuite/thumb_blx_out_of_range.s: Ditto.
6454         * testsuite/arm_branch_out_of_range.sh: New file.
6455         * testsuite/arm_cortex_a8.sh: Ditto.
6456         * testsuite/arm_cortex_a8_b.s: Ditto.
6457         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6458         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6459         * testsuite/arm_cortex_a8_bl.s: Ditto.
6460         * testsuite/arm_cortex_a8_blx.s: Ditto.
6461         * testsuite/arm_cortex_a8_local.s: Ditto.
6462         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6463         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6464
6465 2010-09-08  Rafael Espindola  <espindola@google.com>
6466
6467         * Makefile.am (memory_test.stdout): Run readelf with -W.
6468         * Makefile.in: Regenerate.
6469         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6470         64 bit output.
6471
6472 2010-09-08  Rafael Espindola  <espindola@google.com>
6473
6474         * script-sections.cc (Script_sections::add_memory_region): Convert
6475         field precision to int.
6476         * script.cc (script_set_section_region, script_set_section_region):
6477         Convert field precision to int.
6478
6479 2010-09-08  Rafael Espindola  <espindola@google.com>
6480
6481         * arm.cc (do_finalize_sections): Create the __exidx_start and
6482         __exdix_end symbols even when the section is missing.
6483
6484 2010-09-08  Nick Clifton  <nickc@redhat.com>
6485
6486         * README: Remove claim that MEMORY is not supported.
6487         * expression.cc (script_exp_function_origin)
6488         (script_exp_function_length): Move from here to ...
6489         * script.cc: ... here.
6490         (script_set_section_region, script_add_memory)
6491         (script_parse_memory_attr, script_include_directive): New
6492         functions.
6493         * script-sections.cc
6494         (class Memory_region): New class.
6495         (class Output_section_definition): Add set_memory_region,
6496         set_section_vma, set_section_lma and get_section_name methods.
6497         (class Script_Sections): Add add_memory_region,
6498         find_memory_region, find_memory_region_origin,
6499         find_memory_region_length and set_memory_region methods.
6500         Have set_section_addresses method walk the list of set memory
6501         regions.
6502         Extend the print methos to display memory regions.
6503         * script-sections.h: Add prototypes for new methods.
6504         Add enum for MEMORY region attributes.
6505         * yyscript.y: Add support for parsing MEMORY regions.
6506         * script-c.h: Add prototypes for new functions.
6507         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6508         * testsuite/Makefile.in: Regenerate.
6509         * testsuite/memory_test.sh: New script.
6510         * testsuite/memory_test.s: New assembler source file.
6511         * testsuite/memory_test.t: New linker script.
6512
6513 2010-08-27  Doug Kwan  <dougkwan@google.com>
6514
6515         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6516         reference override an existing dynamic weak reference.
6517         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6518         * testsuite/Makefile.in: Regenerate.
6519         * testsuite/dyn_weak_ref.sh: New file.
6520         * testsuite/dyn_weak_ref_1.c: Ditto.
6521         * testsuite/dyn_weak_ref_2.c: Ditto.
6522
6523 2010-08-27  Ian Lance Taylor  <iant@google.com>
6524
6525         * incremental.h (class Incremental_input_entry): Add virtual
6526         destructor.
6527
6528 2010-08-27  Ian Lance Taylor  <iant@google.com>
6529
6530         * testsuite/start_lib_test_3.c: Mark t3 as used.
6531
6532 2010-08-27  Nick Clifton  <nickc@redhat.com>
6533
6534         * options.cc (version_script): Fix small typo in previous
6535         whitespace tidyup.
6536
6537 2010-08-25  Nick Clifton  <nickc@redhat.com>
6538
6539         * archive.cc: Formatting fixes: Remove whitespace between
6540         typename and following asterisk.  Remove whitespace between
6541         function name and opening parenthesis.
6542         * archive.h: Likewise.
6543         * arm.cc: Likewise.
6544         * attributes.cc: Likewise.
6545         * attributes.h: Likewise.
6546         * common.cc: Likewise.
6547         * copy-relocs.cc: Likewise.
6548         * dirsearch.h: Likewise.
6549         * dynobj.cc: Likewise.
6550         * ehframe.cc: Likewise.
6551         * ehframe.h: Likewise.
6552         * expression.cc: Likewise.
6553         * fileread.cc: Likewise.
6554         * fileread.h: Likewise.
6555         * gc.h: Likewise.
6556         * gold-threads.cc: Likewise.
6557         * gold.cc: Likewise.
6558         * i386.cc: Likewise.
6559         * icf.h: Likewise.
6560         * incremental-dump.cc: Likewise.
6561         * incremental.cc: Likewise.
6562         * layout.cc: Likewise.
6563         * layout.h: Likewise.
6564         * main.cc: Likewise.
6565         * merge.cc: Likewise.
6566         * merge.h: Likewise.
6567         * object.cc: Likewise.
6568         * object.h: Likewise.
6569         * options.cc: Likewise.
6570         * options.h: Likewise.
6571         * output.cc: Likewise.
6572         * output.h: Likewise.
6573         * plugin.cc: Likewise.
6574         * plugin.h: Likewise.
6575         * powerpc.cc: Likewise.
6576         * reloc.cc: Likewise.
6577         * script-c.h: Likewise.
6578         * script-sections.cc: Likewise.
6579         * script.cc: Likewise.
6580         * stringpool.cc: Likewise.
6581         * symtab.cc: Likewise.
6582         * symtab.h: Likewise.
6583         * target.cc: Likewise.
6584         * timer.cc: Likewise.
6585         * timer.h: Likewise.
6586         * version.cc: Likewise.
6587         * x86_64.cc: Likewise.
6588
6589 2010-08-24  Nick Clifton  <nickc@redhat.com>
6590
6591         PR 11899
6592         * layout.cc (segment_precedes): Sort segments by their physical
6593         addresses, if they have been set.
6594
6595 2010-08-23  Cary Coutant  <ccoutant@google.com>
6596
6597         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6598         symbols data.
6599         (Lib_group::include_member): Unlock object after deleting its
6600         symbols data.
6601         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6602         the bug fixed here.
6603
6604 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6605             Cary Coutant  <ccoutant@google.com>
6606
6607         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6608         constructor, and set_blocker.
6609         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6610         readsyms_blocker_.
6611         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6612         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6613         * testsuite/Makefile.am (start_lib_test): New test case.
6614         * testsuite/Makefile.in: Regenerate.
6615         * testsuite/start_lib_test_main.c: New file.
6616         * testsuite/start_lib_test_1.c: New file.
6617         * testsuite/start_lib_test_2.c: New file.
6618         * testsuite/start_lib_test_3.c: New file.
6619
6620 2010-08-19  Ian Lance Taylor  <iant@google.com>
6621
6622         * Makefile.in: Rebuild with automake 1.11.1.
6623         * aclocal.m4: Likewise.
6624         * testsuite/Makefile.in: Likewise.
6625
6626 2010-08-19  Ian Lance Taylor  <iant@google.com>
6627
6628         PR 10893
6629         * i386.cc (class Output_data_plt_i386): Update declarations.
6630         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6631         local_ifuncs_ fields.
6632         (Target_i386::do_plt_section_for_global): New function.
6633         (Target_i386::do_plt_section_for_local): New function.
6634         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6635         parameter; change all callers.  Initialize global_ifuncs_ and
6636         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6637         __rel_iplt_end.
6638         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6639         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6640         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6641         symbols.
6642         (Target_i386::make_plt_section): New function, broken out of
6643         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6644         (Target_i386::make_plt_entry): Call make_plt_section.
6645         (Target_i386::make_local_ifunc_plt_entry): New function.
6646         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6647         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6648         R_386_IRELATIVE to switch.
6649         (Target_i386::Scan::global): Likewise.
6650         (Target_i386::Relocate::relocate): Likewise.
6651         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6652         switch.
6653         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6654         (Target_x86_64::do_plt_section_for_global): New function.
6655         (Target_x86_64::do_plt_section_for_local): New function.
6656         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6657         parameter; change all callers.  If doing a static link define
6658         __rela_iplt_start and __rela_iplt_end.
6659         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6660         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6661         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6662         to point to .plt.
6663         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6664         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6665         switch.
6666         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6667         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6668         R_X86_64_IRELATIVE to switch.
6669         (Target_x86_64::Scan::global): Likewise.
6670         (Target_x86_64::Relocate::relocate): Likewise.
6671         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6672         switch.
6673         * target.h (class Target): Add plt_section_for_global and
6674         plt_section_for_local functions.  Add do_plt_section_for_global
6675         and do_plt_section_for_local virtual functions.
6676         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6677         clarifying comments.
6678         (Symbol::use_plt_offset): Handle IFUNC symbol.
6679         * object.cc (Sized_relobj::Sized_relobj): Initialize
6680         local_plt_offsets_.
6681         (Sized_relobj::local_has_plt_offset): New function.
6682         (Sized_relobj::local_plt_offset): New function.
6683         (Sized_relobj::set_local_plt_offset): New function.
6684         (Sized_relobj::do_count): Handle IFUNC symbol.
6685         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6686         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6687         is_ifunc_symbol functions.
6688         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6689         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6690         local_plt_offsets_ field.
6691         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6692         * output.h (class Output_section_data): Add non-const
6693         output_section function.
6694         (class Output_data_got): Update declarations.
6695         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6696         Add use_plt_offset parameter to global and local constructors.
6697         Change all callers.  Change local_sym_index_ field to 31 bits.
6698         Change GSYM_CODE and CONSTANT_CODE accordingly.
6699         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6700         doing a static link don't set sh_link field.
6701         (Output_data_got::Got_entry::write): Use PLT offset if
6702         appropriate.
6703         (Output_data_got::add_global_plt): New function.
6704         (Output_data_got::add_local_plt): New function.
6705         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6706         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6707         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6708         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6709         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6710         IFUNC conditional.
6711         * testsuite/ifunc-sel.h: New file.
6712         * testsuite/ifuncmain1.c: New file.
6713         * testsuite/ifuncmain1vis.c: New file.
6714         * testsuite/ifuncmod1.c: New file.
6715         * testsuite/ifuncdep2.c: New file.
6716         * testsuite/ifuncmain2.c: New file.
6717         * testsuite/ifuncmain3.c: New file.
6718         * testsuite/ifuncmod3.c: New file.
6719         * testsuite/ifuncmain4.c: New file.
6720         * testsuite/ifuncmain5.c: New file.
6721         * testsuite/ifuncmod5.c: New file.
6722         * testsuite/ifuncmain6pie.c: New file.
6723         * testsuite/ifuncmod6.c: New file.
6724         * testsuite/ifuncmain7.c: New file.
6725         * configure, testsuite/Makefile.in: Rebuild.
6726
6727 2010-08-18  Ian Lance Taylor  <iant@google.com>
6728
6729         * incremental.cc
6730         (Output_section_incremental_inputs::write_input_files): Add cast
6731         to avoid signed/unsigned comparison warning.
6732         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6733
6734 2010-08-12  Cary Coutant  <ccoutant@google.com>
6735
6736         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6737
6738 2010-08-13  Ian Lance Taylor  <iant@google.com>
6739
6740         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6741
6742 2010-08-12  Cary Coutant  <ccoutant@google.com>
6743             Doug Kwan  <dougkwan@google.com>
6744
6745         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6746         defintion overrides non-weak undef, remember that the original undef
6747         is not weak.
6748         * symtab.cc (Symbol_table::sized_write_global): For undef without
6749         an original weak binding, set binding to global in output.
6750         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6751         * testsuite/Makefile.in: Regenerate.
6752         * testsuite/strong_ref_weak_def.sh: New file.
6753         * testsuite/strong_ref_weak_def_1.c: Ditto.
6754         * testsuite/strong_ref_weak_def_2.c: Ditto.
6755
6756 2010-08-12  Cary Coutant  <ccoutant@google.com>
6757
6758         * testsuite/incremental_test.sh: Rewrite.
6759         * testsuite/incremental_test_1.c: Rewrite.
6760         * testsuite/incremental_test_2.c: Rewrite.
6761
6762 2010-08-12  Cary Coutant  <ccoutant@google.com>
6763
6764         * arm.cc (Target_arm::got_size): Add const.
6765         (Target_arm::got_entry_count): New function.
6766         (Target_arm::plt_entry_count): New function.
6767         (Target_arm::first_plt_entry_offset): New function.
6768         (Target_arm::plt_entry_size): New function.
6769         (Output_data_plt_arm::entry_count): New function.
6770         (Output_data_plt_arm::first_plt_entry_offset): New function.
6771         (Output_data_plt_arm::get_plt_entry_size): New function.
6772         * i386.cc (Target_i386::got_size): Add const.
6773         (Target_i386::got_entry_count): New function.
6774         (Target_i386::plt_entry_count): New function.
6775         (Target_i386::first_plt_entry_offset): New function.
6776         (Target_i386::plt_entry_size): New function.
6777         (Output_data_plt_i386::entry_count): New function.
6778         (Output_data_plt_i386::first_plt_entry_offset): New function.
6779         (Output_data_plt_i386::get_plt_entry_size): New function.
6780         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6781         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6782         * incremental.cc: Include target.h.
6783         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6784         parameter.  Adjust all callers.  Find incremental_got_plt section.
6785         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6786         section.
6787         (Output_section_incremental_inputs::set_final_data_size): Calculate
6788         size of incremental_got_plt section.
6789         (Output_section_incremental_inputs::do_write): Write the
6790         incremental_got_plt section.
6791         (Got_plt_view_info): New struct.
6792         (Local_got_offset_visitor): New class.
6793         (Global_got_offset_visitor): New class.
6794         (Global_symbol_visitor_got_plt): New class.
6795         (Output_section_incremental_inputs::write_got_plt): New function.
6796         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6797         Add parameter.  Adjust all callers.
6798         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6799         (Incremental_inputs::got_plt_section): New function.
6800         (Incremental_inputs::got_plt_section_): New data member.
6801         (Incremental_got_plt_reader): New class.
6802         * layout.cc (Layout::create_incremental_info_sections): Add the
6803         incremental_got_plt section.
6804         * object.h (Got_offset_list::get_list): New function.
6805         (Got offset_list::for_all_got_offsets): New function.
6806         (Sized_relobj::local_got_offset_list): New function.
6807         * powerpc.cc (Target_powerpc::got_size): Add const.
6808         (Target_powerpc::got_entry_count): New function.
6809         (Target_powerpc::plt_entry_count): New function.
6810         (Target_powerpc::first_plt_entry_offset): New function.
6811         (Target_powerpc::plt_entry_size): New function.
6812         (Output_data_plt_powerpc::entry_count): New function.
6813         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6814         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6815         * sparc.cc (Target_sparc::got_size): Add const.
6816         (Target_sparc::got_entry_count): New function.
6817         (Target_sparc::plt_entry_count): New function.
6818         (Target_sparc::first_plt_entry_offset): New function.
6819         (Target_sparc::plt_entry_size): New function.
6820         (Output_data_plt_sparc::entry_count): New function.
6821         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6822         (Output_data_plt_sparc::get_plt_entry_size): New function.
6823         * symtab.h (Symbol::got_offset_list): New function.
6824         (Symbol_table::for_all_symbols): New function.
6825         * target.h (Sized_target::got_entry_count): New function.
6826         (Sized_target::plt_entry_count): New function.
6827         (Sized_target::plt_entry_size): New function.
6828         * x86_64.cc (Target_x86_64::got_size): Add const.
6829         (Target_x86_64::got_entry_count): New function.
6830         (Target_x86_64::plt_entry_count): New function.
6831         (Target_x86_64::first_plt_entry_offset): New function.
6832         (Target_x86_64::plt_entry_size): New function.
6833         (Output_data_plt_x86_64::entry_count): New function.
6834         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6835         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6836
6837 2010-08-12  Cary Coutant  <ccoutant@google.com>
6838
6839         * archive.cc: Include incremental.h.
6840         (Archive::Archive): Initialize incremental_info_.
6841         (Archive::include_member): Record archive members in incremental info.
6842         (Add_archive_symbols::run): Record begin and end of an archive in
6843         incremental info.
6844         (Lib_group::include_member): Record objects in incremental info.
6845         * archive.h (Incremental_archive_entry): Forward declaration.
6846         (Archive::set_incremental_info): New member function.
6847         (Archive::incremental_info): New member function.
6848         (Archive::Unused_symbol_iterator): New class.
6849         (Archive::unused_symbols_begin): New member function.
6850         (Archive::unused_symbols_end): New member function.
6851         (Archive::incremental_info_): New data member.
6852         * incremental-dump.cc (find_input_containing_global): New function.
6853         (dump_incremental_inputs): Dump new incremental info sections.
6854         * incremental.cc: Include symtab.h.
6855         (Output_section_incremental_inputs): New class.
6856         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6857         new incremental info sections.
6858         (Sized_incremental_binary::do_check_inputs): Likewise.
6859         (Incremental_inputs::report_archive): Remove.
6860         (Incremental_inputs::report_archive_begin): New function.
6861         (Incremental_inputs::report_archive_end): New function.
6862         (Incremental_inputs::report_object): New function.
6863         (Incremental_inputs::finalize_inputs): Remove.
6864         (Incremental_inputs::report_input_section): New function.
6865         (Incremental_inputs::report_script): Rewrite.
6866         (Incremental_inputs::finalize): Do nothing but finalize string table.
6867         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6868         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6869         (Incremental_inputs::create_data_sections): New function.
6870         (Incremental_inputs::relocs_entsize): New function.
6871         (Output_section_incremental_inputs::set_final_data_size): New function.
6872         (Output_section_incremental_inputs::do_write): New function.
6873         (Output_section_incremental_inputs::write_header): New function.
6874         (Output_section_incremental_inputs::write_input_files): New function.
6875         (Output_section_incremental_inputs::write_info_blocks): New function.
6876         (Output_section_incremental_inputs::write_symtab): New function.
6877         * incremental.h (Incremental_script_entry): Forward declaration.
6878         (Incremental_object_entry): Forward declaration.
6879         (Incremental_archive_entry): Forward declaration.
6880         (Incremental_inputs): Forward declaration.
6881         (Incremental_inputs_header_data): Remove.
6882         (Incremental_inputs_header): Remove.
6883         (Incremental_inputs_header_write): Remove.
6884         (Incremental_inputs_entry_data): Remove.
6885         (Incremental_inputs_entry): Remove.
6886         (Incremental_inputs_entry_write): Remove.
6887         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6888         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6889         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6890         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6891         Likewise.
6892         (Incremental_input_entry): New class.
6893         (Incremental_script_entry): New class.
6894         (Incremental_object_entry): New class.
6895         (Incremental_archive_entry): New class.
6896         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6897         (Incremental_inputs::report_inputs): Remove.
6898         (Incremental_inputs::report_archive): Remove.
6899         (Incremental_inputs::report_archive_begin): New function.
6900         (Incremental_inputs::report_archive_end): New function.
6901         (Incremental_inputs::report_object): Change prototype.
6902         (Incremental_inputs::report_input_section): New function.
6903         (Incremental_inputs::report_script): Change prototype.
6904         (Incremental_inputs::get_reloc_count): New function.
6905         (Incremental_inputs::set_reloc_count): New function.
6906         (Incremental_inputs::create_data_sections): New function.
6907         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6908         (Incremental_inputs::inputs_section): New function.
6909         (Incremental_inputs::symtab_section): New function.
6910         (Incremental_inputs::relocs_section): New function.
6911         (Incremental_inputs::get_stringpool): Add const.
6912         (Incremental_inputs::command_line): Add const.
6913         (Incremental_inputs::inputs): Remove.
6914         (Incremental_inputs::command_line_key): New function.
6915         (Incremental_inputs::input_file_count): New function.
6916         (Incremental_inputs::input_files): New function.
6917         (Incremental_inputs::relocs_entsize): New function.
6918         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6919         (Incremental_inputs::finalize_inputs): Remove.
6920         (Incremental_inputs::Input_info): Remove.
6921         (Incremental_inputs::lock_): Remove.
6922         (Incremental_inputs::inputs_): Change type.
6923         (Incremental_inputs::inputs_map_): Remove.
6924         (Incremental_inputs::current_object_entry_): New data member.
6925         (Incremental_inputs::inputs_section_): New data member.
6926         (Incremental_inputs::symtab_section_): New data member.
6927         (Incremental_inputs::relocs_section_): New data member.
6928         (Incremental_inputs::reloc_count_): New data member.
6929         (Incremental_inputs_reader): New class.
6930         (Incremental_symtab_reader): New class.
6931         (Incremental_relocs_reader): New class.
6932         * layout.cc (Layout::finalize): Move finalization of incremental info
6933         and creation of incremental info sections to follow finalization of
6934         symbol table.  Set offsets for postprocessing sections.
6935         (Layout::create_incremental_info_sections): Call
6936         Incremental_inputs::create_data_sections.  Add incremental symtab
6937         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6938         sections to layout after input sections.
6939         * layout.h (struct Timespec): Forward declaration.
6940         (Layout::incremental_inputs): Add const.
6941         (Layout::create_incremental_info_sections): Add parameter.
6942         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6943         * object.cc: Include incremental.h.
6944         (Relobj::finalize_incremental_relocs): New function.
6945         (Sized_relobj::do_layout): Record input sections in incremental info.
6946         * object.h (Object::output_section): New function.
6947         (Object::output_section_offset): Moved from Relobj.
6948         (Object::get_incremental_reloc_base): New function.
6949         (Object::get_incremental_reloc_count): New function.
6950         (Object::do_output_section): New function.
6951         (Object::do_output_section_offset): Moved from Relobj.
6952         (Object::do_get_incremental_reloc_base): New function.
6953         (Object::do_get_incremental_reloc_count): New function.
6954         (Object::Object): Initialize new data members.
6955         (Relobj::output_section): Renamed do_output_section and moved to
6956         protected.
6957         (Relobj::output_section_offset): Moved to Object.
6958         (Relobj::do_get_incremental_reloc_base): New function.
6959         (Relobj::do_get_incremental_reloc_count): New function.
6960         (Relobj::allocate_incremental_reloc_counts): New function.
6961         (Relobj::count_incremental_reloc): New function.
6962         (Relobj::finalize_incremental_relocs): New function.
6963         (Relobj::next_incremental_reloc_index): New function.
6964         (Relobj::reloc_counts_): New data member.
6965         (Relobj::reloc_bases_): New data member.
6966         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6967         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6968         (Sized_relobj::incremental_relocs_scan): New function.
6969         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6970         (Sized_relobj::incremental_relocs_write): New function.
6971         (Sized_relobj::incremental_relocs_write_reltype): New function.
6972         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6973         incremental link.
6974         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6975         archives and object files elsewhere.
6976         (Add_symbols::run): Report object files here.
6977         (Finish_group::run): Report end of archive at end of group.
6978         * reloc.cc: Include layout.h, incremental.h.
6979         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6980         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6981         (Sized_relobj::incremental_relocs_scan): New function.
6982         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6983         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6984         (Sized_relobj::incremental_relocs_write): New function.
6985         (Sized_relobj::incremental_relocs_write_reltype): New function.
6986         * script.cc (read_input_script): Rewrite test for incremental link.
6987         Change call to Incremental_inputs::report_script.
6988         * symtab.h (Symbol_table::first_global_index): New function.
6989         (Symbol_table::output_count): New function.
6990
6991 2010-08-12  Doug Kwan  <dougkwan@google.com>
6992
6993         * arm.cc (Target_arm::merge_object_attributes): Check command line
6994         options --no-wchar-size-warning and --no-enum-size-warning.
6995         * options.h (General_options): Add ld-compatible options
6996         --no-enum-size-warning and --no-wchar-size-warning.
6997
6998 2010-08-04  Ian Lance Taylor  <iant@google.com>
6999
7000         * x86_64.cc (Target_x86_64::Scan::local): Use
7001         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7002         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7003         (Target_x86_64::Scan::global): Likewise.
7004         (Target_x86_64::Relocate::relocate): Likewise.
7005         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7006         Likewise.
7007
7008 2010-08-03  Cary Coutant  <ccoutant@google.com>
7009
7010         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7011         to reserve space in merged_strings vector. Keep total input size
7012         for stats.
7013         (Output_merge_string::do_print_merge_stats): Print total input size.
7014         * merge.h (Output_merge_string): Add input_size_ field.
7015         * stringpool.cc (Stringpool_template::string_length): Move
7016         implementations out of Stringpool_template class and place in
7017         stringpool.h.
7018         * stringpool.h (string_length): Move out of Stringpool_template.
7019
7020 2010-08-03  Ian Lance Taylor  <iant@google.com>
7021
7022         PR 11712
7023         * layout.cc (relaxation_loop_body): If address of load segment is
7024         set, adjust address to include headers if possible.
7025
7026 2010-08-03  Ian Lance Taylor  <iant@google.com>
7027
7028         * version.cc (version_string): Bump to 1.10.
7029
7030 2010-08-03  Ian Lance Taylor  <iant@google.com>
7031
7032         PR 11805
7033         * layout.h (enum Output_section_order): Define.
7034         (class Layout): Update declarations.
7035         * layout.cc (Layout::get_output_section): Add order parameter.
7036         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7037         is_first_non_relro parameters.  Change all callers.
7038         (Layout::choose_output_section): Likewise.
7039         (Layout::add_output_section_data): Likewise.
7040         (Layout::make_output_section): Likewise.  Set order.
7041         (Layout::default_section_order): New function.
7042         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7043         * output.cc (Output_section::Output_section): Initialize order_.
7044         Don't initialize deleted fields.
7045         (Output_segment::Output_segment): Don't initialize deleted
7046         fields.
7047         (Output_segment::add_output_section_to_load): New function
7048         replacing add_output_section.  Change all callers to call this or
7049         add_output_section_to_nonload.
7050         (Output_segment::add_output_section_to_nonload): New function.
7051         (Output_segment::remove_output_section): Rewrite.
7052         (Output_segment::add_initial_output_data): Likewise.
7053         (Output_segment::has_any_data_sections): Likewise.
7054         (Output_segment::is_first_section_relro): Likewise.
7055         (Output_segment::maximum_alignment): Likewise.
7056         (Output_segment::has_dynamic_reloc): New function replacing
7057         dynamic_reloc_count.  Change all callers.
7058         (Output_segment::has_dynamic_reloc_list): New function replacing
7059         dynamic_reloc_count_list.  Change all callers.
7060         (Output_segment::set_section_addresses): Rewrite.
7061         (Output_segment::set_offset): Rewrite.
7062         (Output_segment::find_first_and_last_list): Remove.
7063         (Output_segment::set_tls_offsets): Rewrite.
7064         (Output_segment::first_section_load_address): Likewise.
7065         (Output_segment::output_section_count): Likewise.
7066         (Output_segment::section_with_lowest_load_address): Likewise.
7067         (Output_segment::write_section_headers): Likewise.
7068         (Output_segment::print_sections_to_map): Likewise.
7069         * output.h (class Output_data): Remove dynamic_reloc_count_
7070         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7071         (Output_data::add_dynamic_reloc): Rewrite.
7072         (Output_data::has_dynamic_reloc): New function.
7073         (Output_data::dynamic_reloc_count): Remove.
7074         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7075         is_last_relro_, is_first_non_relro_, is_interp_,
7076         is_dynamic_linker_section_ fields.  Add order and set_order
7077         functions.  Remove is_relro_local, set_is_relro_local,
7078         is_last_relro, set_is_last_relro, is_first_non_relro,
7079         set_is_first_non_relro functions, is_interp, set_is_interp,
7080         is_dynamic_linker_section, and set_is_dynamic_linker_section
7081         functions.
7082         (class Output_segment): Change Output_data_list from std::list to
7083         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7084         output_bss_ fields.  Update declarations.
7085
7086 2010-08-02  Ian Lance Taylor  <iant@google.com>
7087
7088         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7089         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7090         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7091
7092 2010-08-02  Ian Lance Taylor  <iant@google.com>
7093
7094         PR 11855
7095         * script.cc (Script_options::Script_options): Initialize
7096         symbol_definitions_ and symbol_references_.
7097         (Script_options::add_symbol_assignment): Update
7098         symbol_definitions_ and symbol_references_.
7099         (Script_options::add_symbol_reference): New function.
7100         (script_symbol): New function.
7101         * script.h (class Script_options): Add symbol_definitions_ and
7102         symbol_references_ fields.
7103         (Script_options::referenced_const_iterator): New type.
7104         (Script_options::referenced_begin): New function.
7105         (Script_options::referenced_end): New function.
7106         (Script_options::is_referenced): New function.
7107         (Script_options::any_unreferenced): New function.
7108         * script-c.h (script_symbol): Declare.
7109         * yyscript.y (exp): Call script_symbol.
7110         * symtab.cc: Include "script.h".
7111         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7112         Change all callers.  Check symbols referenced by scripts.
7113         (Symbol_table::add_undefined_symbols_from_command_line): Add
7114         layout parameter.  Change all callers.
7115         (Symbol_table::do_add_undefined_symbols_from_command_line):
7116         Likewise.  Break out loop body.  Check symbols referenced by
7117         scripts.
7118         (Symbol_table::add_undefined_symbol_from_command_line): New
7119         function broken out of
7120         do_add_undefined_symbols_from_command_line.
7121         * symtab.h (class Symbol_table): Update declarations.
7122         * archive.cc: Include "layout.h".
7123         (Archive::should_include_member): Add layout parameter.  Change
7124         all callers.  Check for symbol mentioned in expression.
7125         * archive.h (class Archive): Update declaration.
7126         * object.cc (Sized_relobj::do_should_include_member): Add layout
7127         parameter.
7128         * object.h (Object::should_include_member): Add layout parameter.
7129         Change all callers.
7130         (Object::do_should_include_member): Add layout parameter.
7131         (class Sized_relobj): Update declaration.
7132         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7133         parameter.
7134         * dynobj.h (class Sized_dynobj): Update declaration.
7135         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7136         layout parameter.
7137         * plugin.h (class Sized_pluginobj): Update declaration.
7138
7139 2010-08-02  Ian Lance Taylor  <iant@google.com>
7140
7141         PR 11866
7142         * output.cc (Output_segment::set_offset): Search for the first and
7143         last sections rather than assuming that the list is in order.
7144         (Output_segment::find_first_and_last_list): New function.
7145         * output.h (class Output_segment): Update declarations.
7146         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7147         (relro_strip_test_SOURCES): New variable.
7148         (relro_strip_test_DEPENDENCIES): New variable.
7149         (relro_strip_test_LDFLAGS): New variable.
7150         (relro_strip_test_LDADD): New variable.
7151         (relro_strip_test.so): New target.
7152
7153 2010-08-02  Ian Lance Taylor  <iant@google.com>
7154
7155         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7156         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7157         (Target_i386::got_tlsdesc_section): New function.
7158         (Target_i386::got_section): Create space for GOT entries for
7159         TLSDESC relocations.
7160         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7161         R_386_TLS_GOTDESC.
7162         (Target_i386::Scan::global): Likewise.
7163         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7164         using TLSDESC GOT.
7165         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7166         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7167         (Target_x86_64::got_tlsdesc_section): New function.
7168         (Target_x86_64::got_section): Create space for GOT entries for
7169         TLSDESC relocations.
7170         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7171         R_386_TLS_GOTDESC.
7172         (Target_x86_64::Scan::global): Likewise.
7173         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7174         using TLSDESC GOT.
7175
7176 2010-08-02  Ian Lance Taylor  <iant@google.com>
7177
7178         * testsuite/final_layout.sh: Use dc to convert from hex to
7179         decimal.
7180
7181 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7182
7183         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7184         paramter to the call to gold::gc_process_relocs.
7185         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7186         paramter to the call to gold::gc_process_relocs.
7187         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7188         parameter to the call to gold::gc_process_relocs.
7189         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7190         template parameter to the call to gold::gc_process_relocs.
7191         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7192         paramter to the call to gold::gc_process_relocs.
7193         * gc.h (get_embedded_addend_size): New function.
7194         (gc_process_relocs): Save the size of the reloc for use by ICF.
7195         * icf.cc (get_section_contents): Get the addend from the text section
7196         for SHT_REL relocation sections.
7197         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7198         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7199         * int_encoding.h (read_from_pointer): New overloaded function.
7200         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7201         * testsuite/icf_sht_rel_addend_test.sh: New file.
7202         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7203         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7204
7205 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7206
7207         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7208         * Makefile.in: Regenerate.
7209         * testsuite/Makefile.in: Regenerate.
7210
7211 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7212
7213         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7214         * gold/testsuite/debug_msg.cc: Likewise.
7215         * gold/testsuite/odr_violation1.cc
7216         * gold/testsuite/odr_violation2.cc
7217
7218 2010-07-21  Cary Coutant  <ccoutant@google.com>
7219
7220         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7221         string, and length fields.
7222         (Output_merge_string::Merged_strings_list): New type.
7223         (Output_merge_string::Merged_strings_lists): New typedef.
7224         (Output_merge_string): Replace merged_strings_ with
7225         merged_strings_lists_.
7226         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7227         Merged_strings_list per input object and section.  Don't store pointer
7228         to the string.  Don't store length with each merged string entry.
7229         (Output_merge_string::finalize_merged_data): Loop over list of merged
7230         strings lists.  Recompute length of each merged string.
7231
7232 2010-07-15  Cary Coutant  <ccoutant@google.com>
7233
7234         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7235         here.
7236
7237 2010-07-14  Ian Lance Taylor  <iant@google.com>
7238
7239         * descriptors.cc (Descriptors::open): Report correct name in error
7240         message.
7241
7242 2010-07-13  Doug Kwan  <dougkwan@google.com>
7243
7244         * arm.cc (Arm_input_section::Arm_input_section): For a
7245         SHT_ARM_EXIDX section, always keeps the input sections.
7246         (Arm_input_section::set_exidx_section_link): New method.
7247         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7248         has_errors_ to false.
7249         (Arm_exidx_input_section::has_errors,
7250         Arm_exidx_input_section::set_has_errors): New methods.
7251         (Arm_exidx_input_section::has_errors_): New data member.
7252         (Arm_relobj::get_exidx_shndx_list): New method.
7253         (Arm_output_section::append_text_sections_to_list): Do not skip
7254         section without SHF_EXECINSTR.
7255         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7256         errors.
7257         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7258         section header.  Make error messages more verbose.  Check for
7259         a non-executable section linked to an EXIDX section.
7260         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7261         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7262         check that there is no deferred EXIDX section if we exit early.
7263         Instead of not making an EXIDX section in case of an error, make one
7264         and set the has_errors flag of it.
7265         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7266         in a relocatable link.
7267         (Target_arm::do_relax): Look for the EXIDX output section instead of
7268         assuming that it is called .ARM.exidx.
7269         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7270         section list.  Do not check for SHF_EXECINSTR section flags but
7271         skip any input section with errors.
7272         * output.cc (Output_section::Output_section): Initialize
7273         always_keeps_input_sections_ to false.
7274         (Output_section::add_input_section): Check for
7275         always_keeps_input_sections_.
7276         *  output.h (Output_section::always_keeps_input_sections,
7277         Output_section::set_always_keeps_input_sections): New methods.
7278         (Output_section::always_keeps_input_sections): New data member.
7279
7280 2010-07-13  Rafael Espindola  <espindola@google.com>
7281
7282         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7283         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7284
7285 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7286             Ian Lance Taylor  <iant@google.com>
7287
7288         * output.h (Output_section_lookup_maps::add_merge_section):
7289         Correct check of whether value was inserted.
7290         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7291         (Output_section_lookup_maps::add_relaxed_input_section):
7292         Likewise.
7293         * arm.cc (Target_arm::got_section): Remove used local os.
7294         * i386.cc (Target_i386::got_section): Likewise.
7295         * x86_64.cc (Target_x86_64::got_section): Likewise.
7296         * sparc.cc (Target_sparc::got_section): Likewise.
7297         (Target_sparc::relocate): Remove unused local have_got_offset.
7298         * powerpc.cc (Target_powerpc::relocate): Likewise.
7299
7300 2010-07-13  Ian Lance Taylor  <iant@google.com>
7301
7302         * compressed_output.cc (zlib_decompress): Fix signature in
7303         !HAVE_ZLIB_H case.
7304
7305         * archive.cc (Archive::include_member): Unlock an external member
7306         of a thin archive.  Don't bother to delete an object we know is
7307         NULL.
7308
7309 2010-07-12  Cary Coutant  <ccoutant@google.com>
7310
7311         * compressed_output.cc (zlib_decompress): New function.
7312         (get_uncompressed_size): New function.
7313         (decompress_input_section): New function.
7314         * compressed_output.h (get_uncompressed_size): New function.
7315         (decompress_input_section): New function.
7316         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7317         Handle compressed debug sections.
7318         * layout.cc (is_compressed_debug_section): New function.
7319         (Layout::output_section_name): Map compressed section names to
7320         canonical names.
7321         * layout.h (is_compressed_debug_section): New function.
7322         (is_debug_info_section): Recognize compressed debug sections.
7323         * merge.cc: Include compressed_output.h.
7324         (Output_merge_data::do_add_input_section): Handle compressed
7325         debug sections.
7326         (Output_merge_string::do_add_input_section): Handle compressed
7327         debug sections.
7328         * object.cc: Include compressed_output.h.
7329         (Sized_relobj::Sized_relobj): Initialize new data members.
7330         (build_compressed_section_map): New function.
7331         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7332         * object.h (Object::section_is_compressed): New method.
7333         (Object::do_section_is_compressed): New method.
7334         (Sized_relobj::Compressed_section_map): New type.
7335         (Sized_relobj::do_section_is_compressed): New method.
7336         (Sized_relobj::compressed_sections_): New data member.
7337         * output.cc (Output_section::add_input_section): Handle compressed
7338         debug sections.
7339         * reloc.cc: Include compressed_output.h.
7340         (Sized_relobj::write_sections): Handle compressed debug sections.
7341
7342 2010-07-08  Cary Coutant  <ccoutant@google.com>
7343
7344         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7345         weak when resolving to a dynamic def.
7346         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7347         for weak undef/dynamic def cases. Adjust callers.
7348         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7349         undef_binding_weak_.
7350         (Symbol_table::sized_write_globals): Adjust symbol binding.
7351         (Symbol_table::sized_write_symbol): Add binding parameter.
7352         * symtab.h (Symbol::set_undef_binding): New method.
7353         (Symbol::is_undef_binding_weak): New method.
7354         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7355         (Symbol_table::should_override): Add new parameter.
7356         (Symbol_table::sized_write_symbol): Add new parameter.
7357
7358         * testsuite/weak_undef_file1.cc: Add new test case.
7359         * testsuite/weak_undef_file2.cc: Fix header comment.
7360         * testsuite/weak_undef_test.cc: Add new test case.
7361
7362 2010-06-29  Doug Kwan  <dougkwan@google.com>
7363
7364         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7365         Initialize USE_SYMBOL_.
7366         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7367         definition.
7368         (Arm_reloc_property::uses_symbol_): New data member declaration.
7369         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7370         uses symbol value and symbol is undefined but not weakly undefined.
7371
7372 2010-06-28  Rafael Espindola  <espindola@google.com>
7373
7374         * plugin.cc (Plugin::load): Use dlerror.
7375
7376 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7377
7378         * symtab.cc (detect_odr_violations): When reporting an ODR
7379         violation, report an object where the symbol is defined.
7380
7381 2010-06-25  Doug Kwan  <dougkwan@google.com>
7382
7383         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7384         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7385         definition.
7386         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7387         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7388         target hook to detect function points.
7389         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7390         * icf.h (Icf::check_section_for_function_pointers): Change type of
7391         parameter SECTION_NAME to const reference to std::string.  Use
7392         target hook to determine if section may have unsafe pointers.
7393         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7394         method definition.
7395
7396 2010-06-21  Rafael Espindola  <espindola@google.com>
7397
7398         * fileread.cc (Input_file::find_fie): New
7399         (Input_file::open): Use Input_file::find_fie.
7400         * fileread.h (Input_file::find_fie): New
7401         * plugin.cc (set_extra_library_path): New.
7402         (Plugin::load): Add set_extra_library_path to the transfer vector.
7403         (Plugin_manager::set_extra_library_path): New.
7404         (Plugin_manager::add_input_file): Use the extra search path if set.
7405         (set_extra_library_path(): New.
7406         * plugin.h (Plugin_manager): Add set_extra_library_path and
7407         extra_search_path_.
7408
7409 2010-06-19  Cary Coutant  <ccoutant@google.com>
7410
7411         * layout.cc (gdb_sections): Add .debug_types.
7412         (lines_only_debug_sections): Likewise.
7413
7414 2010-06-18  Rafael Espindola  <espindola@google.com>
7415
7416         * plugin.cc (add_input_file,add_input_library)
7417         (Plugin_manager::add_input_file): Make filename arguments const.
7418         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7419         const.
7420
7421 2010-06-16  Doug Kwan  <dougkwan@google.com>
7422
7423         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7424         .ARM.attributes section if we have not merged any input
7425         attributes sections.
7426
7427 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7428
7429         * arm.cc: Allow combining objects with no EABI version
7430         information.
7431
7432 2010-06-15  Rafael Espindola  <espindola@google.com>
7433
7434         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7435
7436 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7437
7438         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7439         (struct iovec): Correct !HAVE_READV definition.
7440
7441 2010-06-10  Cary Coutant  <ccoutant@google.com>
7442
7443         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7444         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7445         reloc sections.
7446         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7447
7448         PR 11683
7449         * symtab.h (Symbol::is_placeholder): New member function.
7450         * target-reloc.h (relocate_section): Check for placeholder symbols.
7451
7452         * testsuite/Makefile.am (plugin_test_8): New test.
7453         (plugin_test_9): New test.
7454         * testsuite/Makefile.in: Regenerate.
7455
7456 2010-06-09  Nick Clifton  <nickc@redhat.com>
7457
7458         * yyscript.y (input_list_element): Allow strings prefixed with
7459         the '-' character.  Treat these as libraries.
7460         * script.cc (script_add_library): New function.  Adds a library
7461         specified by "-l<name>" found in an input script.
7462         * script-c.h: Add prototype for script_add_library.
7463
7464 2010-06-07  Doug Kwan  <dougkwan@google.com>
7465
7466         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7467         Restrict stub-group size to be within long conditional branch
7468         range when working around cortex-A8 erratum.
7469
7470 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7471
7472         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7473         #ifdef typo.
7474
7475 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7476
7477         PR gold/11658
7478         * output.cc
7479         (Output_section::Input_section_sort_entry::compare_section_ordering):
7480         Change to return non-zero correctly.
7481         (Output_section::Input_section_sort_section_order_index_compare
7482         ::operator()): Change to fix ambiguity in comparisons.
7483
7484 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7485
7486         * gold.h (is_wildcard_string): New function.
7487         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7488         (Layout::layout_eh_frame): Ditto.
7489         (Layout::find_section_order_index): New method.
7490         (Layout::read_layout_from_file): New method.
7491         * layout.h (Layout::find_section_order_index): New method.
7492         (Layout::read_layout_from_file): New method.
7493         (Layout::input_section_position_): New private member.
7494         (Layout::input_section_glob_): New private member.
7495         * main.cc (main): Call read_layout_from_file here.
7496         * options.h (--section-ordering-file): New option.
7497         * output.cc (Output_section::input_section_order_specified_): New
7498         member.
7499         (Output_section::Output_section): Initialize new member.
7500         (Output_section::add_input_section): Add new parameter.
7501         Keep input sections when --section-ordering-file is used.
7502         (Output_section::set_final_data_size): Sort input sections when
7503         section ordering file is specified.
7504         (Output_section::Input_section_sort_entry): Add new parameter.
7505         Check sorting type.
7506         (Output_section::Input_section_sort_entry::compare_section_ordering):
7507         New method.
7508         (Output_section::Input_section_sort_compare::operator()): Change to
7509         consider section_order_index.
7510         (Output_section::Input_section_sort_init_fini_compare::operator()):
7511         Change to consider section_order_index.
7512         (Output_section::Input_section_sort_section_order_index_compare
7513         ::operator()): New method.
7514         (Output_section::sort_attached_input_sections): Change to sort
7515         according to section order when specified.
7516         (Output_section::add_input_section<32, true>): Add new parameter.
7517         (Output_section::add_input_section<64, true>): Add new parameter.
7518         (Output_section::add_input_section<32, false>): Add new parameter.
7519         (Output_section::add_input_section<64, false>): Add new parameter.
7520         * output.h (Output_section::add_input_section): Add new parameter.
7521         (Output_section::input_section_order_specified): New
7522         method.
7523         (Output_section::set_input_section_order_specified): New method.
7524         (Input_section::Input_section): Initialize section_order_index_.
7525         (Input_section::section_order_index): New method.
7526         (Input_section::set_section_order_index): New method.
7527         (Input_section::section_order_index_): New member.
7528         (Input_section::Input_section_sort_section_order_index_compare): New
7529         struct.
7530         (Output_section::input_section_order_specified_): New member.
7531         * script-sections.cc (is_wildcard_string): Delete and move modified
7532         method to gold.h.
7533         (Output_section_element_input::Output_section_element_input): Modify
7534         call to is_wildcard_string.
7535         (Output_section_element_input::Input_section_pattern
7536         ::Input_section_pattern): Ditto.
7537         (Output_section_element_input::Output_section_element_input): Ditto.
7538         * testsuite/Makefile.am (final_layout): New test case.
7539         * testsuite/Makefile.in: Regenerate.
7540         * testsuite/final_layout.cc: New file.
7541         * testsuite/final_layout.sh: New file.
7542
7543 2010-06-01  Rafael Espindola  <espindola@google.com>
7544
7545         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7546
7547 2010-06-01  Rafael Espindola  <espindola@google.com>
7548
7549         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7550         visibility of symbols.
7551
7552 2010-05-27  Doug Kwan  <dougkwan@google.com>
7553
7554         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7555         from start of output section instead of address for a local symbol
7556         in a merged or relaxed section when doing a relocatable link.
7557
7558 2010-05-26  Rafael Espindola  <espindola@google.com>
7559
7560         PR 11604
7561         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7562         adding sections the garbage collector removed.
7563         * gold/testsuite/Makefile.am: Add test.
7564         * gold/testsuite/Makefile.in: Regenerate.
7565         * gold/testsuite/plugin_test_7.sh: New.
7566         * gold/testsuite/plugin_test_7_1.c: New.
7567         * gold/testsuite/plugin_test_7_2.c: New.
7568
7569 2010-05-26  Rafael Espindola  <espindola@google.com>
7570
7571         * script-sections.cc (Output_section_definition::set_section_addresses):
7572         Check for --section-start.
7573
7574 2010-05-26  Doug Kwan  <dougkwan@google.com>
7575
7576         * arm.cc (Arm_scan_relocatable_relocs): New class.
7577         (Target_arm::relocate_special_relocatable): New method.
7578         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7579         (Arm_relocate_functions::thumb_branch_common): Same.
7580         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7581         instead of Default_scan_relocatable_relocs.
7582         * target-reloc.h (relocate_for_relocatable): Let target handle
7583         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7584         * target.h (Sized_target::relocate_special_relocatable): New method.
7585
7586 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7587
7588         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7589
7590 2010-05-23  Doug Kwan  <dougkwan@google.com>
7591
7592         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7593         instead of a cast.
7594         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7595         with a direct branch, not a conditional branch, to a stub.
7596         * merge.cc (Output_merge_base::record_input_section): New method
7597         defintion.
7598         (Output_merge_data::do_add_input_section): Record input section if
7599         keeps-input-sections flag is set.
7600         (Output_merge_string::do_add_input_section): Ditto.
7601         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7602         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7603         INPUT_SECTIONS_.
7604         (Output_merge_base::keeps_input_sections,
7605         Output_merge_base::set_keeps_input_sections,
7606         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7607         method definitions.
7608         (Output_merge_base::Input_sections): New type declaration.
7609         (Output_merge_base::input_sections_begin,
7610         Output_merge_base::input_sections_end,
7611         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7612         (Output_merge_base::bool keeps_input_sections_,
7613         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7614         Output_merge_base::input_sections_): New data members.
7615         (Output_merge_data::do_set_keeps_input_sections): New method
7616         defintion.
7617         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7618         * output.cc (Output_section::Input_section::relobj): Move method
7619         defintion from class declaration to here and handle merge sections.
7620         (Output_section::Input_section::shndx): Ditto.
7621         (Output_section::Output_section): Remove initializations of removed
7622         data members and initialize new data member LOOKUP_MAPS_.
7623         (Output_section::add_input_section): Set keeps-input-sections flag
7624         for a newly created merge output section as appropriate.  Adjust code
7625         to use Output_section_lookup_maps class.
7626         (Output_section::add_relaxed_input_section): Adjst code for lookup
7627         maps code refactoring.
7628         (Output_section::add_merge_input_section): Add a new parameter
7629         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7630         class.  If adding input section to a newly created merge output
7631         section fails, remove the new merge section.
7632         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7633         Adjust code for use of the Output_section_lookup_maps class.
7634         (Output_section::find_merge_section): Ditto.
7635         (Output_section::build_lookup_maps): New method defintion.
7636         (Output_section::find_relaxed_input_section): Adjust code to use
7637         Output_section_lookup_maps class.
7638         (Output_section::get_input_sections): Export merge sections.  Adjust
7639         code to use Output_section_lookup_maps class.
7640         (Output_section:::add_script_input_section): Adjust code to use
7641         Output_section_lookup_maps class.  Update lookup maps for merge
7642         sections also.
7643         (Output_section::discard_states): Use Output_section_lookup_maps.
7644         (Output_section::restore_states): Same.
7645         * output.h (Merge_section_properties): Move class defintion out of
7646         Output_section.
7647         (Output_section_lookup_maps): New class.
7648         (Output_section::Input_section::is_merge_section): New method
7649         defintion.
7650         (Output_section::Input_section::relobj): Move defintion out of class
7651         defintion.  Declare method only.
7652         (Output_section::Input_section::shndx): Ditto.
7653         (Output_section::Input_section::output_merge_base): New method defintion.
7654         (Output_section::Input_section::u2_.pomb): New union field.
7655         (Output_section::Merge_section_by_properties_map,
7656         Output_section::Output_section_data_by_input_section_map,
7657         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7658         Remove types.
7659         (Output_section::add_merge_input_section): Add new parameter
7660         KEEPS_INPUT_SECTIONS.
7661         (Output_section::build_lookup_maps): New method declaration.
7662         (Output_section::merge_section_map_,
7663         Output_section::merge_section_by_properties_map_,
7664         Output_section::relaxed_input_section_map_,
7665         Output_section::is_relaxed_input_section_map_valid_): Remove data
7666         members.
7667         (Output_section::lookup_maps_): New data member.
7668
7669 2010-05-21  Doug Kwan  <dougkwan@google.com>
7670
7671         PR gold/11619
7672         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7673         avoid a compilation error.
7674
7675 2010-05-19  Rafael Espindola  <espindola@google.com>
7676
7677         * script-sections.cc (Output_section_definition::allocate_to_segment):
7678         Update the phdrs_list even when the output section is NULL.
7679         * testsuite/Makefile.am: Add test.
7680         * testsuite/Makefile.in: Regenerate.
7681         * testsuite/script_test_9.cc: New.
7682         * testsuite/script_test_9.sh: New.
7683         * testsuite/script_test_9.t: New.
7684
7685 2010-05-19  Doug Kwan  <dougkwan@google.com>
7686
7687         * arm.cc (Arm_input_section::original_size): New method.
7688         (Arm_input_section::do_addralign): Add a cast.
7689         (Arm_input_section::do_output_offset): Remove static cast.
7690         (Arm_input_section::original_addralign,
7691          Arm_input_section::original_size_): Change type to uint32_t.
7692         (Arm_input_section::init): Add safe casts for section alignment
7693         and size.
7694         (Arm_input_section::set_final_data_size): Do not set address and
7695         offset of stub table.
7696         (Arm_output_section::fix_exidx_coverage): Change use of of
7697         Output_section::Simple_input_section to that of
7698         Output_section::Input_section.
7699         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7700         except for the first pass.
7701         * output.cc (Output_section::get_input_sections): Change type of
7702         input_sections to std::list<Input_section>.
7703         (Output_section::add_script_input_section): Rename from
7704         Output_section::add_simple_input_section.  Change type of SIS
7705         parameter from Simple_input_section to Input_section.
7706         * output.h (Output_section::Simple_input_section): Remove class.
7707         (Output_section::Input_section): Change class visibility to public.
7708         (Output_section::Input_section::addralign): Use stored alignments
7709         for special input sections if set.
7710         (Output_section::Input_section::set_addralign): New method.
7711         (Output_section::get_input_sections): Change parameter type from
7712         list of Simple_input_section to list of Input_section.
7713         (Output_section::add_script_input_section): Rename from
7714         Output_section::add_simple_input_section. Change first parameter's
7715         type from Simple_input_section to Input_section and remove the
7716         second and third parameters.
7717         * script-sections.cc (Input_section::Input_section_list): Change
7718         type to list of Output_section::Input_section/
7719         (Input_section_info::Input_section_info): Change parameter type of
7720         INPUT_SECTION to Output_section::Input_section.
7721         (Input_section_info::input_section): Change return type.
7722         (Input_section_info::input_section_): Change type to
7723         Output_section::Input_section.
7724         (Output_section_element_input::set_section_addresses): Adjust code
7725         to use Output_section::Input_section instead of
7726         Output_section::Simple_input_section.  Adjust code for renaming
7727         of Output_section::add_simple_input_section.
7728         (Orphan_output_section::set_section_addresses): Ditto.
7729
7730 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7731
7732         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7733         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7734
7735 2010-05-18  Rafael Espindola  <espindola@google.com>
7736
7737         * options.cc (General_options::finalize): Handle -nostdlib.
7738         * options.h (nostdlib): New option.
7739         * script.cc (script_add_search_dir): Handle -nostdlib.
7740
7741 2010-05-12  Doug Kwan  <dougkwan@google.com>
7742
7743         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7744         attributes section only if there no attributes section after merging.
7745         (Target_arm::merge_object_attributes): Move value of
7746         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7747         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7748         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7749         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7750         and arm_attr_merge_7.stdout.
7751         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7752         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7753         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7754         arm_attr_merge_7b.o): New rules.
7755         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7756         arm_attr_merge_7
7757         * testsuite/Makefile.in: Regenerate.
7758         * testsuite/arm_attr_merge.sh: New file.
7759         * testsuite/arm_attr_merge_[67][ab].s: Same.
7760
7761 2010-05-05  Nick Clifton  <nickc@redhat.com>
7762
7763         * po/es.po: Updated Spanish translation.
7764
7765 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7766
7767         * Makefile.am (install-exec-local): Properly install gold as
7768         default cross linker.
7769         * Makefile.in: Regenerated.
7770
7771 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7772             Nick Clifton  <nickc@redhat.com>
7773
7774         * configure.ac (install_as_default): Define and set to false
7775         unless --enable-gold or --enable-gold=both/gold has been
7776         specified.
7777         * configure: Regenerate.
7778
7779         * Makefile.am (install-exec-local): Install the executable as
7780         'ld.gold'.  If install_as_default is true then also install it as
7781         'ld'.
7782         * Makefile.in: Regenerated.
7783
7784 2010-04-24  Ian Lance Taylor  <iant@google.com>
7785
7786         * layout.cc (Layout::layout_reloc): In relocatable link don't
7787         combine reloc sections for grouped sections.
7788
7789 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7790
7791         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7792         sections that are not ordinary to icf.
7793         * icf.cc (get_section_contents): Handle relocation pointing to section
7794         with no object or shndx information.
7795         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7796         * testsuite/Makefile.in: Regenerate.
7797         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7798         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7799
7800 2010-04-22  Ian Lance Taylor  <iant@google.com>
7801
7802         * expression.cc (Expression::Expression_eval_info): Add
7803         result_alignment_pointer field.
7804         (Expression::eval_with_dot): Add result_alignment_pointer
7805         parameter.  Change all callers.
7806         (Expression::eval_maybe_dot): Likewise.
7807         (class Binary_expression): Add alignment_pointer parameter to
7808         left_value and right_value.  Change all callers.
7809         (BINARY_EXPRESSION): Set result alignment.
7810         (class Trinary_expression): Add alignment_pointer parameter to
7811         arg2_value and arg3_value.  Change all callers.
7812         (Trinary_cond::value): Set result alignment.
7813         (Max_expression::value, Min_expression::value): Likewise.
7814         (Align_expression::value): Likewise.
7815         * script-sections.cc (class Sections_element): Add dot_alignment
7816         parameter to set_section_addresses virtual function.  Update
7817         instantiations.
7818         (class Output_section_element): Likewise.
7819         (Script_sections::create_segments): Add dot_alignment parameter.
7820         Change all callers.
7821         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7822         (Script_sections::set_phdrs_clause_addresses): Likewise.
7823         * script-sections.h: Update declarations.
7824         * script.h: Update declarations.
7825         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7826         min_p_align.
7827         * testsuite/script_test_3.t: Set large alignment.
7828         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7829         segment has expected alignment.
7830
7831 2010-04-22  Nick Clifton  <nickc@redhat.com>
7832
7833         * po/gold.pot: Updated by the Translation project.
7834         * po/vi.po: Updated Vietnamese translation.
7835
7836 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7837
7838         * testsuite/Makefile.am (check_PROGRAMS): Add
7839         icf_virtual_function_folding_test.
7840         * testsuite/Makefile.in: Regenerated.
7841
7842 2010-04-15  Andrew Haley  <aph@redhat.com>
7843
7844         * options.h (merge_exidx_entries): New option.
7845         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7846         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7847         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7848         (Target_arm::merge_exidx_entries): New function.
7849         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7850         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7851         to Arm_exidx_fixup constructor.
7852         Add new arg, merge_exidx_entries.
7853         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7854         Arm_output_section::fix_exidx_coverage.
7855
7856 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7857
7858         * icf.cc (get_section_contents): Check for preemptible functions.
7859         Ignore addend when appropriate.
7860         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7861         section folded.
7862         (add_from_relobj): Check for section folded.
7863         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7864         * symtab.h (should_add_dynsym_entry): Add new parameter.
7865         * target-reloc.h (scan_relocs): Check for section folded.
7866         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7867         Check reloc types for function pointers in shared objects.
7868         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7869         case.
7870         (icf_preemptible_functions_test): New test case.
7871         (icf_string_merge_test): New test case.
7872         * testsuite.Makefile.in: Regenerate.
7873         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7874         bar_glob.  Refactor code.
7875         * testsuite/icf_preemptible_functions_test.cc: New file.
7876         * testsuite/icf_preemptible_functions_test.sh: New file.
7877         * testsuite/icf_string_merge_test.cc: New file.
7878         * testsuite/icf_string_merge_test.sh: New file.
7879         * testsuite/icf_virtual_function_folding_test.cc: New file.
7880         * testsuite/icf_virtual_function_folding_test.sh: New file.
7881
7882 2010-04-14  Doug Kwan  <dougkwan@google.com>
7883
7884         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7885         for local symbol recounting if we remove a section due to ICF.
7886         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7887         there are no regular objects in input.
7888
7889 2010-04-13  Doug Kwan  <dougkwan@google.com>
7890
7891         * arm.cc (Arm_input_section::set_final_data_size): Compute
7892         accurate final data size instead of using current data size.
7893
7894 2010-04-09  Doug Kwan  <dougkwan@google.com>
7895
7896         * layout.cc (Layout::choose_output_section): Handle script section
7897         types.
7898         (Layout::make_output_section_for_script): Add section type parameter.
7899         Handle script section types.
7900         * layout.h (Layout::make_output_section_for_script): Add section
7901         type parameter.
7902         * output.cc (Output_section::Output_section): Initialize data member
7903         is_noload_.
7904         (Output_section::do_reset_address_and_file_offset): Do not set address
7905         to 0 if section is a NOLOAD section.
7906         * output.h (Output_section::is_noload): New method.
7907         (Output_section::set_is_noload): Ditto.
7908         (Output_section::is_noload_): New data member.
7909         * script-c.h (Script_section_type): New enum type.
7910         (struct Parser_output_section_header): Add new file section_type.
7911         * script-sections.cc (Sections_element::output_section_name): Add
7912         parameter for returning script section type.
7913         (Output_section_definition::output_section_name): Ditto.
7914         (Output_section_definition::section_type)P; New method.
7915         (Output_section_definiton::script_section_type_name): Ditto.
7916         (Output_section_definition::script_section_type_): New data member.
7917         (Output_section_definition::Output_section_definition): Initialize
7918         data member Output_section_definition::script_section_type_.
7919         (Output_section_definition::create_sections): Pass script section type
7920         to Layout::make_output_section_for_script.
7921         (Output_section_definition::output_section_name): Return script
7922         section type to caller.
7923         (Output_section_definition::set_section_address): Do not advance
7924         dot value and load address if section type is NOLOAD.  Set address
7925         of NOLOAD sections regardless of section flags.
7926         (Output_section_definition::print): Print section type if it is
7927         not SCRIPT_SECTION_TYPE_NONE.
7928         (Output_section_definition::section_type): New method.
7929         (Output_section_definition::script_section_type_name): Ditto.
7930         (Script_sections::output_section_name): Add new parameter
7931         PSECTION_TYPE for returning script section type.  Pass it to
7932         section elements.  Handle discard sections.
7933         (Sort_output_sections::operator()): Handle NOLOAD sections.
7934         * script-sections.h (Script_sections::Section_type): New enum type.
7935         (Script_sections::output_section_name): Add a new parameter for
7936         returning script section type.
7937         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7938         INFO and NOLOAD.
7939         * yyscript.y (union): Add new field SECTION_TYPE.
7940         (COPY, DSECT, INFO, NOLOAD): New tokens.
7941         (opt_address_and_section_type): Change type to output_section_header.
7942         (section_type): New non-terminal
7943         (section_header): Handle section type.
7944         (opt_address_and_section_type): Return section type value.
7945
7946 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7947
7948         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7949         * testsuite/plugin_common_test_2.c (foo): Likewise.
7950
7951 2010-04-08  Doug Kwan  <dougkwan@google.com>
7952
7953         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7954         Output_merge_data.
7955         * output.cc (Output_section::add_merge_input_section): Simplify
7956         code and return status of Output_merge_base::add_input_section.
7957         Update merge section map only if Output_merge_base::add_input_section
7958         returns true.
7959
7960 2010-04-07  Doug Kwan  <dougkwan@google.com>
7961
7962         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7963         if section is marked as containing instructions but has no mapping
7964         symbols.
7965         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7966         correct section index.
7967         (Arm_relobj::find_linked_text_section): Ditto.
7968
7969 2010-04-07  Cary Coutant  <ccoutant@google.com>
7970
7971         * archive.cc (include_member): Destroy Read_symbols_data object before
7972         releasing file.
7973         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7974         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7975         (Read_symbols_data::~Read_symbols_data) New destructor.
7976         (Section_relocs::Section_relocs) New constructor.
7977         (Section_relocs::~Section_relocs) New destructor.
7978         (Read_relocs_data::Read_relocs_data) New constructor.
7979         (Read_relocs_data::~Read_relocs_data) New destructor.
7980         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7981         pointers to NULL after deleting.
7982
7983 2010-04-07  Doug Kwan  <dougkwan@google.com>
7984
7985         * arm.cc: Replace "endianity" with "endianness" in comments.
7986         (Arm_exidx_cantunwind): Ditto.
7987         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7988         (Arm_relobj::merge_flags_and_attributes): New method.
7989         (Arm_relobj::merge_flags_and_attributes_): New data member.
7990         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7991         (Arm_relobj::scan_sections_for_stubs): Ditto.
7992         (Arm_relobj::do_read_symbols): Check to see if we really want to
7993         merge processor-specific flags and attributes.  Exit early if
7994         an object is empty except for section names and the undefined symbol.
7995         (Target_arm::do_finalize_sections): Move check for ELF format to
7996         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7997         attributes from a regular object only when we have determined that
7998         it is aapropriate.  Do not create an .ARM.attributes section in
7999         output if there is no regular input object.
8000         (Target_arm::merge_processor_specific_flags): Check
8001         --warn-mismatch before printing any error.
8002         (Target_arm::merge_object_attributes): Ditto.
8003         * gold.cc (queue_middle_tasks): Handle the case in which there is
8004         no regular object in input.
8005         * options.cc (General_options::parse_EB): New method.
8006         (General_options::parse_EL): Same.
8007         (General_options::General_options): Initialize endianness_.
8008         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8009         New options.
8010         (General_options::Endianness): New enum.
8011         (General_options::endianness): New method.
8012         (General_options::endianness_): New data member.
8013         * parameters.cc (Parameters::set_options): Check target endianness.
8014         (Parameters::set_target_once): Ditto.
8015         (Parameters::check_target_endianness): New method.
8016         (parameters_force_valid_target): If either -EL or -EB is specified,
8017         use it to define endianness of default target.
8018         * parameters.h (Parameters::check_target_endianness): New method
8019         declaration.
8020         * target.h (class Target): Change "endianity" to "endianness"
8021         in comments.
8022
8023 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8024
8025         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8026         * configure: Regenerate.
8027         * Makefile.in: Regenerate.
8028         * testsuite/Makefile.in: Regenerate.
8029
8030 2010-04-06  Cary Coutant  <ccoutant@google.com>
8031
8032         gcc PR lto/42757
8033         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8034         prevailing definitions of common symbols.
8035         * testsuite/plugin_test_6.sh: New test case.
8036         * testsuite/plugin_common_test_1.c: New test case.
8037         * testsuite/plugin_common_test_2.c: New test case.
8038         * testsuite/Makefile.am (plugin_test_6): New test case.
8039         * testsuite/Makefile.in: Regenerate.
8040
8041 2010-04-06  Nick Clifton  <nickc@redhat.com>
8042
8043         * po/vi.po: New Vietnamese translation.
8044
8045 2010-03-30  Doug Kwan  <dougkwan@google.com>
8046
8047         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8048
8049 2010-03-25  Doug Kwan  <dougkwan@google.com>
8050
8051         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8052         to avoid a conversion warning on a 32-bit host.
8053
8054 2010-03-24  Ian Lance Taylor  <iant@google.com>
8055
8056         * testsuite/script_test_3.t: Add a TLS segment.
8057         * testsuite/Makefile.am (check_PROGRAMS): Add
8058         tls_phdrs_script_test.
8059         (tls_phdrs_script_test_SOURCES): Define.
8060         (tls_phdrs_script_test_DEPENDENCIES): Define.
8061         (tls_phdrs_script_test_LDFLAGS): Define.
8062         (tls_phdrs_script_test_LDADD): Define.
8063         * testsuite/Makefile.in: Rebuild.
8064
8065 2010-03-23  Cary Coutant  <ccoutant@google.com>
8066
8067         * fileread.cc (find_or_make_view): Fix comment.
8068
8069 2010-03-23  Ian Lance Taylor  <iant@google.com>
8070
8071         * script-sections.cc (class Orphan_section_placement): Define
8072         PLACE_TLS and PLACE_TLS_BSS.
8073         (Orphan_section_placement::Orphan_section_placement): Initialize
8074         new places.
8075         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8076         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8077         (tls_script_test_SOURCES): Define.
8078         (tls_script_test_DEPENDENCIES): Define.
8079         (tls_script_test_LDFLAGS): Define.
8080         (tls_script_test_LDADD): Define.
8081         * testsuite/Makefile.in: Rebuild.
8082
8083 2010-03-22  Doug Kwan  <dougkwan@google.com>
8084
8085         * arm.cc (Arm_relocate_functions::abs8,
8086         Arm_relocate_functions::abs16): Use correct check for overflow
8087         specified in the ARM ELF specs.
8088         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8089         target of a BLX instruction specially.
8090         (Reloc_stub::stub_type_for_reloc): Ditto.
8091         (Relocate::relocate): Use symbolic names instead of numeric relocation
8092         codes to report error.
8093         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8094         workaround.
8095         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8096         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8097         thumb2_blx_out_of_range.stdout
8098         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8099         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8100         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8101         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8102         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8103         thumb2_blx_in_range, thumb2_blx_in_range.o,
8104         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8105         thumb2_blx_out_of_range.o): New rules.
8106         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8107         thumb2_blx_in_range and thumb2_blx_out_of_range.
8108         * testsuite/Makefile.in: Regenerate.
8109         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8110         * testsuite/thumb_blx_in_range.s: New file.
8111         * testsuite/thumb_blx_out_of_range.s: New file.
8112
8113 2010-03-22  Rafael Espindola  <espindola@google.com>
8114
8115         * archive.cc (Should_include): Move to archive.h.
8116         (should_include_member): Make it a member of Archive.
8117         (Lib_group): New.
8118         (Add_lib_group_symbols): New.
8119         * archive.h: Include options.h.
8120         (Archive_member): Moved from Archive.
8121         (Should_include): Moved from archive.cc.
8122         (Lib_group): New.
8123         (Add_lib_group_symbols): New.
8124         * dynobj.cc (do_should_include_member): New.
8125         * dynobj.h (do_should_include_member): New.
8126         * gold.cc (queue_initial_tasks): Update call to queue.
8127         * main.cc (main): Print lib group stats.
8128         * object.cc (do_should_include_member): New.
8129         * object.h: Include archive.h.
8130         (Object::should_include_member): New.
8131         (Object::do_should_include_member): New.
8132         (Sized_relobj::do_should_include_member): New.
8133         * options.cc (General_options::parse_start_lib): New.
8134         (General_options::parse_end_lib): New.
8135         (Input_arguments::add_file): Handle lib groups.
8136         (Input_arguments::start_group): Check we are not in a lib.
8137         (Input_arguments::start_lib): New.
8138         (Input_arguments::end_lib): New.
8139         * options.h (General_options): Add start_lib and end_lib.
8140         (Input_argument::lib_): New.
8141         (Input_argument::lib): New.
8142         (Input_argument::is_lib): New.
8143         (Input_file_lib): New.
8144         (Input_arguments::in_lib_): New.
8145         (Input_arguments::in_lib): New.
8146         (Input_arguments::start_lib): New.
8147         (Input_arguments::end_lib_): New.
8148         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8149         in unused members as preempted.
8150         (Sized_pluginobj::do_should_include_member): New.
8151         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8152         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8153         return the blocker.
8154         (Read_symbols::do_whole_lib_group): New.
8155         (Read_symbols::do_lib_group): New.
8156         (Read_symbols::do_read_symbols): Handle lib groups.
8157         (Read_symbols::get_name): Handle lib groups.
8158         * readsyms.h (Read_symbols): Add an archive member pointer.
8159         (Read_symbols::do_whole_lib_group): New.
8160         (Read_symbols::do_lib_group): New.
8161         (Read_symbols::member_): New.
8162         * script.cc (read_input_script): Update call to queue_soon.
8163
8164 2010-03-19  Doug Kwan  <dougkwan@google.com>
8165
8166         * arm.cc (Stub_table::Stub_table): Initialize new data members
8167         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8168         (Stub_table::add_reloc_stub): Assign stub offset and update
8169         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8170         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8171         New data members.
8172         (Stub_table::update_data_size_and_addralign): Use
8173         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8174         instead of going over all reloc stubs.
8175         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8176         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8177         Stringpool_template::offset_ to size of Stringpool_char.
8178         (Stringpool_template::new_key_offset): Remove code to initialize
8179         Stringpool_template::offset_.
8180         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8181         Stringpool_template::offset_ to zero.
8182
8183 2010-03-15  Doug Kwan  <dougkwan@google.com>
8184
8185         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8186         offset_.
8187         (Stringpool_template::new_key_offset): New method.
8188         (Stringpool_template::add_string): Assign offsets when adding new
8189         strings.
8190         (Stringpool_template::set_string_offsets): Do not set string offsets
8191         when not optimizing.
8192         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8193         member size_.
8194         (Chunked_vector::clear): Clear size_.
8195         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8196         (Chunked_vector::size): Return size_.
8197         (Chunked_vector::push_back): Use size_ to find insert position.
8198         (Chunked_vector::size_): New data member.
8199         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8200         (Stringpool_template::new_key_offset): New method declaration.
8201         (Stringpool_template::offset_): New data member.
8202
8203 2010-03-15   Rafael Espindola  <espindola@google.com>
8204
8205         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8206         Add_symbols' constructor.
8207         * readsyms.h (Add_symbols): Remove the input_group member.
8208
8209 2010-03-10  Ian Lance Taylor  <iant@google.com>
8210
8211         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8212         target to ask whether a reference to a symbol requires a stack
8213         split.
8214         * target.h (Target::is_call_to_non_split): New function.
8215         (Target::do_is_call_to_non_split): Declare virtual function.
8216         * target.cc: Include "symtab.h".
8217         (Target::do_is_call_to_non_split): New function.
8218         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8219
8220 2010-03-10  Cary Coutant  <ccoutant@google.com>
8221
8222         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8223         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8224         (File_read::open[2]): Add whole_file_view_ to list of views.
8225         (File_read::make_view): Remove test of whole_file_view_.
8226         (File_read::find_or_make_view): Create whole_file_view_ if
8227         necessary.
8228         (File_read::clear_views): Replace bool parameter with enum;
8229         adjust all callers.  Don't delete views with permanent data;
8230         do delete cached views and views from archives if
8231         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8232         if clearing the corresponding view.
8233         * fileread.h (File_read::Clear_views_mode): New enum.
8234         (File_read::View::is_permanent_view): New method.
8235         (File_read::clear_views): Replace bool parameter
8236         with enum; adjust all callers.
8237         * options.h (General_options): Change keep_files_mapped option;
8238         add map_whole_files.
8239         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8240         releasing the file.
8241         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8242         the file.
8243
8244 2010-03-10  David S. Miller  <davem@davemloft.net>
8245
8246         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8247
8248 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8249
8250         * icf.cc (get_section_contents): Add '@' marker after processing the
8251         merge reloc.
8252
8253 2010-03-08  Doug Kwan  <dougkwan@google.com>
8254
8255         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8256         due to a conversion warning.
8257         (Arm_relobj::update_output_local_symbol_count): Check for local
8258         symbol with unset output index.
8259
8260 2010-03-05  Ian Lance Taylor  <iant@google.com>
8261
8262         * options.h (class General_options): Add --spare-dynamic-tags.
8263         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8264         --spare-dynamic-tags.
8265
8266 2010-03-05  Ian Lance Taylor  <iant@google.com>
8267
8268         * incremental.cc: Include "libiberty.h".
8269
8270 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8271
8272         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8273         function, is_info_ member.
8274         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8275         (Versions::Versions): Update caller.
8276         (Versions::define_base_version): Likewise.
8277         (Versions::add_def): Likewise.
8278
8279 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8280
8281         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8282         (Scan::possible_function_pointer_reloc): New function.
8283         (Scan::local_reloc_may_be_function_pointer): Change to call
8284         possible_function_pointer_reloc.
8285         (Scan::global_reloc_may_be_function_pointer): Ditto.
8286         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8287         relocations in ".data.rel.ro._ZTV" section.
8288         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8289         * testsuite/icf_safe_so_test.cc: Ditto.
8290         * testsuite/icf_safe_test.cc: Ditto.
8291         * testsuite/icf_safe_test.sh: Ditto.
8292
8293 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8294             Ian Lance Taylor  <iant@google.com>
8295
8296         * target-reloc.h (relocate_section): Check the symbol table index
8297         for -1U before setting the local symbol index.
8298         (scan_relocatable_relocs): If copying the relocation, record that
8299         the local symbol is required.
8300         * object.h (Symbol_value::is_output_symtab_index_set): New
8301         function.
8302         (Symbol_value::may_be_discarded_from_output_symtab): New
8303         function.
8304         (Symbol_value::has_output_symtab_entry): New function.
8305         (Symbol_value::needs_output_symtab_entry): Remove.
8306         (Symbol_value::output_symtab_index): Make sure the symbol index is
8307         set.
8308         (Symbol_value::set_output_symtab_index): Make sure the symbol
8309         index is not set.  Make sure the new index is valid.
8310         (Symbol_value::set_must_have_output_symtab_entry): New function.
8311         (Symbol_value::has_output_dynsym_entry): New function.
8312         (Symbol_value::set_output_dynsym_index): Make sure the new index
8313         is valid.
8314         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8315         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8316         local symbol if permitted.
8317         (Sized_relobj::do_finalize_local_symbols): Call
8318         is_output_symtab_index_set rather than needs_output_symtab_entry.
8319         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8320         rather than needs_output_symtab_entry.  Call
8321         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8322         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8323         is_output_symtab_index_set rather than needs_output_symtab_entry.
8324         * testsuite/discard_locals_relocatable_test.c: New file.
8325         * testsuite/discard_locals_test.sh: Test -r.
8326         * testsuite/Makefile.am (check_DATA): Add
8327         discard_locals_relocatable_test1.syms,
8328         discard_local_relocatable_test2.syms.
8329         (MOSTLYCLEANFILES): Likewise.  Also add
8330         discard_locals_relocatable_test1.lout and
8331         discard_locals_relocatable_test2.out.
8332         (discard_locals_relocatable_test1.syms): New target.
8333         (discard_locals_relocatable_test.o): New target.
8334         (discard_locals_relocatable_test1.out): New target.
8335         (discard_locals_relocatable_test2.syms): New target.
8336         (discard_locals_relocatable_test2.out): New target.
8337         (various): Add missing ../ld-new dependencies.
8338         * testsuite/Makefile.in: Rebuild.
8339
8340 2010-03-03  Nick Clifton  <nickc@redhat.com>
8341
8342         * po/fi.po: New Finnish translation.
8343
8344 2010-03-01  Doug Kwan  <dougkwan@google.com>
8345
8346         * layout.cc (Layout::Layout): Force section types of .init_array*,
8347         .preinit_array* and .fini_array* sections.
8348         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8349         Fix check of return value of std::string::find.().
8350         (Output_section::Input_section_sort_compare::operator()): Remove
8351         comment about .init_array.
8352         (Output_section::Input_section_sort_init_fini_compare::operator()):
8353         New method.
8354         (Output_section::sort_attached_input_sections): Handle .init_array
8355         and .fini_array specially.
8356         * output.h (Output_section::Inut_section_sort_compare): Update
8357         comment.
8358         (Output_section::Input_section_sort_init_fini_compare): New struct.
8359
8360 2010-02-26  Doug Kwan  <dougkwan@google.com>
8361
8362         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8363         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8364         * testsuite/debug_msg.sh: Avoid matching source line number for
8365         use of global variable undef_int.
8366
8367 2010-02-26  Doug Kwan  <dougkwan@google.com>
8368
8369         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8370         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8371         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8372         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8373         * options.cc (General_options::General_options): Initialize member
8374         fix_v4bx_.
8375         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8376         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8377         and rm_no_fix_v4bx.stdout
8378         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8379         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8380         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8381         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8382         and arm_no_fix_v4bx.
8383         * Makefile.in: Regenerate.
8384         * testsuite/arm_fix_v4bx.s: New file.
8385         * testsuite/arm_fix_v4bx.sh: Ditto.
8386
8387 2010-02-24  Doug Kwan  <dougkwan@google.com>
8388
8389         * arm.cc (Target_arm::got_section): Make the .got section the first
8390         non RELRO section in the data segment.
8391         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8392         suffixes of section names.
8393
8394 2010-02-24  Doug Kwan  <dougkwan@google.com>
8395
8396         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8397         flags and attributes merging if an input file is a binary file.
8398         * fileread.cc (Input_file::open): Record format of original file.
8399         * fileread.h (Input_file::Format): New enum type.
8400         (Input_file::Input_file): Initialize data member format_.
8401         (Input_file::format): New method definition.
8402         (Input_file::format_):: New data member.
8403
8404 2010-02-24  Doug Kwan  <dougkwan@google.com>
8405
8406         * arm.cc (Arm_output_data_got): New class.
8407         (ARM_TCB_SIZE): New constant
8408         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8409         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8410         If user uses a script with a SECTIONS clause, issue only a warning
8411         for a misplaced EXIDX input section.  Otherwise, issue an error.
8412         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8413         garbage collection.
8414         (Target_arm::got_mode_index_entry): Handle static linking.
8415         (Target_arm::Scan::local): Ditto.
8416         (Target_arm::Scan::global): Ditto.
8417         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8418         all incorrectly implemented relocations.
8419         (Target_arm::fix_exidx_coverage): Pass layout to
8420         Arm_output_section::fix_exidx_coverage.
8421         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8422         from ".ARM.exidx." and ".ARM.extab.".
8423
8424 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8425
8426         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8427         section if it does not already exist.
8428         * attributes.cc (Attributes_section_data::Attributes_section_data):
8429         Don't crash if size is zero.
8430
8431 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8432             Ian Lance Taylor  <iant@google.com>
8433
8434         * gold.cc (queue_middle_tasks): If no input files were opened,
8435         exit.
8436         * workqueue.h (Task_function::Task_function): Assert that there is
8437         a blocker.
8438
8439 2010-02-22  Doug Kwan  <dougkwan@google.com>
8440
8441         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8442         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8443         types to avoid warnings due to different uint64_t implementations
8444         on different hosts.
8445
8446 2010-02-21  Doug Kwan  <dougkwan@google.com>
8447
8448         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8449         handling of the maximum backward branch offset.
8450         (Arm_relocate_functions::thumb_branch_common): Ditto.
8451         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8452         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8453         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8454         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8455         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8456         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8457         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8458         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8459         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8460         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8461         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8462         thumb2_bl_out_of_range.o): New rules.
8463         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8464         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8465         thumb2_bl_out_of_range
8466         * testsuite/Makefile.in: Regenerate.
8467         * testsuite/arm_bl_in_range.s: New file.
8468         * testsuite/arm_bl_out_of_range.s: Ditto.
8469         * testsuite/arm_branch_in_range.sh: Ditto.
8470         * testsuite/arm_branch_range.t: Ditto.
8471         * testsuite/thumb2_branch_range.t: Ditto.
8472         * testsuite/thumb_bl_in_range.s: Ditto.
8473         * testsuite/thumb_bl_out_of_range.s: Ditto.
8474         * testsuite/thumb_branch_range.t: Ditto.
8475
8476 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8477
8478         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8479         Add reloc offset information.
8480         * icf.cc (get_section_contents): Change iterators to point to the new
8481         vectors. Add reloc offset information to the contents.
8482         * icf.h (Icf::Sections_reachable_info): New typedef.
8483         (Icf::Sections_reachable_list): New typedef.
8484         (Icf::Offset_info): New typedef.
8485         (Icf::Reloc_info): New struct typedef.
8486         (Icf::Reloc_info_list): New typedef.
8487         (Icf::symbol_reloc_list): Delete method.
8488         (Icf::addend_reloc_list): Delete method.
8489         (Icf::section_reloc_list): Delete method.
8490         (Icf::reloc_info_list): New method.
8491         (Icf::reloc_info_list_): New member.
8492
8493 2010-02-19  Doug Kwan  <dougkwan@google.com>
8494
8495         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8496         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8497         * arm.cc (Arm_relocation_functions): New forward declaration.
8498         (Target_arm::Target_arm): Initialize new data members
8499         got_mod_index_offset_ and tls_base_symbol_defined_.
8500         (Target_arm::Relocate::relocate_tls): New method.
8501         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8502          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8503         New methods.
8504         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8505         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8506         (Target_arm::got_mod_index_offset_,
8507         Target_arm::tls_base_symbol_defined_): New data members.
8508         (Target_arm::Scan::local, Target::Scan::global,
8509         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8510         relocations.
8511
8512 2010-02-18  Doug Kwan  <dougkwan@google.com>
8513
8514         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8515         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8516         text section as a parameter becuase some broken tools may not set
8517         the link in section header.
8518         (Target_arm::has_got_section): New method.
8519         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8520         without any mapping symbol as data only.  Remove warning.
8521         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8522         link in its section header, try to discover the link by inspecting the
8523         REL31 relocation at the beginning of the section.
8524         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8525         in error message.
8526         (Target_arm::Scan::global): Treat any reference to the symbol
8527         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8528
8529 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8530
8531         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8532         (Scan::global_reloc_may_be_function_pointer): New function.
8533         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8534         (Scan::global_reloc_may_be_function_pointer): New function.
8535         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8536         (Scan::global_reloc_may_be_function_pointer): New function.
8537         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8538         (Scan::global_reloc_may_be_function_pointer): New function.
8539         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8540         (Scan::global_reloc_may_be_function_pointer): New function.
8541         (Scan::possible_function_pointer_reloc): New function.
8542         (Target_x86_64::can_check_for_function_pointers): New function.
8543         * gc.h (gc_process_relocs): Scan relocation types to determine if
8544         function pointers were taken for targets that support it.
8545         * icf.cc (Icf::find_identical_sections): Include functions for
8546         folding in safe ICF whose pointer is not taken.
8547         * icf.h (Secn_fptr_taken_set): New typedef.
8548         (fptr_section_id_): New member.
8549         (section_has_function_pointers): New function.
8550         (set_section_has_function_pointers): New function.
8551         (check_section_for_function_pointers): New function.
8552         * options.h: Fix comment for safe ICF option.
8553         * target.h (can_check_for_function_pointers): New function.
8554         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8555         Modify icf_safe_test for X86-64.
8556         * testsuite/Makefile.in: Regenerate.
8557         * testsuite/icf_safe_so_test.cc: New file.
8558         * testsuite/icf_safe_so_test.sh: New file.
8559         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8560         (main): Change to take pointer to function kept_func_3.
8561         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8562         folding is done correctly for X86-64.
8563
8564 2010-02-12  David S. Miller  <davem@davemloft.net>
8565
8566         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8567         is_symbolless parameter.
8568         (Output_reloc<SHT_REL>::is_symbolless): New.
8569         (Output_reloc<SHT_REL>::is_symbolless_): New.
8570         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8571         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8572         (Output_reloc<SHT_RELA>::is_symbolless): New.
8573         (Output_data_reloc::add_global): Handle is_symbolless.
8574         (Output_data_reloc::add_global_relative): Likewise.
8575         (Output_data_reloc::add_local): Likewise.
8576         (Output_data_reloc::add_local_relative): Likewise.
8577         (Output_data_reloc::add_symbolless_global_addend): New.
8578         (Output_data_reloc::add_symbolless_local_addend): New.
8579         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8580         is_symbolless.
8581         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8582         instead of ->is_relative_
8583         (Output_reloc::write): Likewise.
8584         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8585         (Output_reloc::write_rel): Simplify.
8586
8587         * sparc.cc (Target_sparc::Scan::local): Use
8588         ->add_symbolless_local_addend as needed.
8589         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8590         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8591         based upon relocation offset.
8592
8593 2010-02-11  Doug Kwan  <dougkwan@google.com>
8594
8595         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8596         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8597         beginning of function.
8598         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8599         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8600         parameter is_32bit in calls to should_apply_static_reloc.
8601         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8602         (check_DATA): Add arm_abs_global.stdout.
8603         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8604         arm_abs_global.stdout): New rules.
8605         (MOSTLLYCLEANFILES): Add arm_abs_global
8606         * Makefile.in: Regenerate.
8607         * testsuite/arm_abs_global.s: New file.
8608         * testsuite/arm_abs_global.sh: Ditto.
8609         * testsuite/arm_abs_lib.s: Ditto.
8610
8611 2010-02-11  Ian Lance Taylor  <iant@google.com>
8612
8613         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8614         Read_relocs task.
8615         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8616         Allocate_commons_task first.
8617         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8618         task, rather than symtab_lock_.
8619         (Gc_process_relocs::~Gc_process_relocs): New function.
8620         (Gc_process_relocs::is_runnable): Check this_blocker_.
8621         (Gc_process_relocs::locks): Use next_blocker_ rather than
8622         blocker_.
8623         (Scan_relocs::~Scan_relocs): New function.
8624         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8625         symtab_lock_.
8626         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8627         next_blocker_.
8628         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8629         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8630         constructor accordingly.
8631         (class Gc_process_relocs): Likewise.
8632         (class Scan_relocs): Likewise.
8633         * common.h (class Allocate_commons_task): Remove symtab_lock_
8634         field, and corresponding constructor parameter.
8635         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8636         symtab_lock_.
8637         (Allocate_commons_task::locks): Likewise.
8638
8639 2010-02-11  Ian Lance Taylor  <iant@google.com>
8640
8641         * gold-threads.h (class Once): Define.
8642         (class Initialize_lock): Rewrite as child of Once.
8643         * gold-threads.cc (class Once_initialize): Define.
8644         (once_pointer_control): New static variable.
8645         (once_pointer, once_arg): New static variables.
8646         (c_run_once): New static function.
8647         (Once::Once, Once::run_once, Once::internal_run): New functions.
8648         (class Initialize_lock_once): Remove.
8649         (initialize_lock_control): Remove.
8650         (initialize_lock_pointer): Remove.
8651         (initialize_lock_once): Remove.
8652         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8653         (Initialize_lock::initialize): Rewrite.
8654         (Initialize_lock::do_run_once): New function.
8655         * archive.cc (Archive::interpret_header): Only clear name if it is
8656         not already empty.
8657         * fileread.cc: Include "gold-threads.h"
8658         (file_counts_lock): New static variable.
8659         (file_counts_initialize_lock): Likewise.
8660         (File_read::release): Only increment counts when using --stats.
8661         Use a lock around the increment.
8662         * parameters.cc (class Set_parameters_target_once): Define.
8663         (set_parameters_target_once): New static variable.
8664         (Parameters::Parameters): Move here from parameters.h.
8665         (Parameters::set_target): Rewrite.
8666         (Parameters::set_target_once): New function.
8667         (Parameters::clear_target): Move here and rewrite.
8668         * parameters.h (class Parameters): Update declarations.  Add
8669         set_parameters_target_once_ field.
8670         (Parameters::Parameters): Move to parameters.cc.
8671         (Parameters::clear_target): Likewise.
8672         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8673         task.
8674         (Start_group::~Start_group): New function.
8675         (Start_group::is_runnable): New function.
8676         (Start_group::locks, Start_group::run): New functions.
8677         (Finish_group::run): Change saw_undefined to size_t.
8678         * readsyms.h (class Start_group): Define.
8679         (class Finish_group): Change saw_undefined_ field to size_t.
8680         (Finish_group::Finish_group): Remove saw_undefined and
8681         this_blocker parameters.  Change all callers.
8682         (Finish_group::set_saw_undefined): New function.
8683         (Finish_group::set_blocker): New function.
8684         * symtab.h (class Symbol_table): Change saw_undefined to return
8685         size_t.  Change saw_undefined_ field to size_t.
8686         * target-select.cc (Set_target_once::do_run_once): New function.
8687         (Target_selector::Target_selector): Initialize set_target_once_
8688         field.  Don't initialize lock_ and initialize_lock_ fields.
8689         (Target_selector::instantiate_target): Rewrite.
8690         (Target_selector::set_target): New function.
8691         * target-select.h (class Set_target_once): Define.
8692         (class Target_selector): Update declarations.  Make
8693         Set_target_once a friend.  Remove lock_ and initialize_lock_
8694         fields.  Add set_target_once_ field.
8695
8696 2010-02-10  Ian Lance Taylor  <iant@google.com>
8697
8698         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8699         queueing any tasks.
8700         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8701         (queue_middle_tasks): Add all blockers before queueing any tasks.
8702         (queue_final_tasks): Likewise.
8703         * token.h (Task_token::add_blockers): New function.
8704         * object.h (Input_objects::number_of_relobjs): New function.
8705
8706 2010-02-10  Ian Lance Taylor  <iant@google.com>
8707
8708         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8709         shared, not if not position independent.
8710         * x86_64.cc (Relocate::relocate_tls): Likewise.
8711         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8712         (tls_pie_pic_test): New target.
8713         * testsuite/Makefile.in: Rebuild.
8714
8715         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8716         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8717         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8718         * testsuite/Makefile.in: Rebuild.
8719
8720 2010-02-09  David S. Miller  <davem@davemloft.net>
8721
8722         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8723         R_SPARC_RELATIVE using ->add_local_relative().
8724         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8725
8726         * output.h (Output_data_dynamic::add_section_size): New method
8727         that takes two Output_data objects.
8728         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8729         entry param.  Handle it in initializers.
8730         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8731         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8732         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8733         arg.
8734         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8735         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8736         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8737         for dynrel_includes_plt.
8738         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8739         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8740         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8741         before .rela.plt
8742         (Target_sparc::do_finalize_sections): Update to pass true for
8743         dynrel_includes_plt.
8744         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8745         output before .rela.plt
8746         (Target_powerpc::do_finalize_sections): Update to pass true for
8747         dynrel_includes_plt when 32-bit.
8748
8749 2010-02-08  Doug Kwan  <dougkwan@google.com>
8750
8751         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8752         method.
8753         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8754         Arm_relobj::scan_section_for_cortex_a8_stubs,
8755         Arm_relobj::do_relocation_section): Instead of calling
8756         Output_section::output_address, use faster
8757         Arm_relobj::simple_input_section_output_address.
8758
8759 2010-02-08  David S. Miller  <davem@davemloft.net>
8760
8761         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8762         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8763         relocation helper function.
8764
8765         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8766         just like R_SPARC_GOT{10,13,22}.
8767         (Target_sparc::Scan::local): Likewise.
8768         (Target_sparc::Relocate:relocate): Likewise.
8769
8770 2010-02-06  Ian Lance Taylor  <iant@google.com>
8771
8772         * configure.ac: Rewrite targetobjs duplicate removal code to use
8773         only shell constructs.
8774         * configure: Rebuild.
8775
8776 2010-02-05  Doug Kwan  <dougkwan@google.com>
8777
8778         PR 11247
8779         * arm.cc (Arm_relobj::section_is_scannable): New method.
8780         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8781         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8782
8783 2010-02-04  Doug Kwan  <dougkwan@google.com>
8784
8785         PR 11247
8786         * arm-reloc-property.cc (cstdio): Include.
8787         * configure.ac (targetobjs): Remove duplicates.
8788         * configure: Regenerate.
8789         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8790         big and little endian version for a given address size.
8791
8792 2010-02-03  Doug Kwan  <dougkwan@google.com>
8793
8794         * arm-reloc-property.cc
8795         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8796         definition.
8797         * arm-reloc-property.h
8798         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8799         New method definition.
8800         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8801         declaration.
8802         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8803         overflow to N.
8804         (GOT_PREL): Change implemented to Y.
8805         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8806         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8807         (Arm_relocate_functions::movw_abs_nc): Remove method.
8808         (Arm_relocate_functions::movt_abs): Ditto.
8809         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8810         (Arm_relocate_functions::thm_movt_abs): Ditto.
8811         (Arm_relocate_functions::movw_rel_nc): Ditto.
8812         (Arm_relocate_functions::movw_rel): Ditto.
8813         (Arm_relocate_functions::movt_rel): Ditto.
8814         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8815         (Arm_relocate_functions:thm_movw_rel): Ditto.
8816         (Arm_relocate_functions:thm_movt_rel): Ditto.
8817         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8818         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8819         New method definitions.
8820         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8821         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8822         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8823         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8824         (Target_arm::Relocate::relocate): Check for non-static or
8825         unimplemented relocation code and exit early.  Change calls to
8826         Target_arm::reloc_uses_thumb_bit and
8827         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8828         instead.  Refactor code to handle similar relocations to increase
8829         code sharing.  Remove check for unsupported relocation code in switch
8830         statement.
8831         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8832         relocation property table to find out size.  Change error message to
8833         print out the name of a relocation code instead of the numeric value.
8834         (Target_arm::scan_reloc_for_stub): Use relocation property table
8835         instead of calling Target_arm::reloc_uses_thumb_bit().
8836
8837 2010-02-02  Doug Kwan  <dougkwan@google.com>
8838
8839         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8840         types of relaxed input section.
8841
8842 2010-02-02  Doug Kwan  <dougkwan@google.com>
8843
8844         * Makefile.am (HFILES): Add arm-reloc-property.h.
8845         (DEFFILES): New.
8846         (TARGETSOURCES): Add arm-reloc-property.cc
8847         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8848         (libgold_a_SOURCES): $(DEFFILES)
8849         * Makefile.in: Regenerate.
8850         * arm-reloc-property.cc: New file.
8851         * arm-reloc-property.h: New file.
8852         * arm-reloc.def: New file.
8853         * arm.cc: Update comments.
8854         (arm-reloc-property.h): New included header.
8855         (arm_reloc_property_table): New global variable.
8856         (Target_arm::do_select_as_default_target): New method definition.
8857         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8858         arm-reloc-property to targ_extra_obj.
8859         * parameters.cc (set_parameters_target): Call
8860         Target::select_as_default_target().
8861         * target.h (Target::select_as_default_target): New method definition.
8862         (Target::do_select_as_default_target): Same.
8863
8864 2010-02-01  Doug Kwan  <dougkwan@google.com>
8865
8866         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8867         first_output_text_section_.
8868         (Arm_exidx_fixup::first_output_text_section): New method definition.
8869         (Arm_exidx_fixup::first_output_text_section_): New data member.
8870         (Arm_exidx_fixup::process_exidx_section): Record the first text
8871         output section seen.
8872         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8873         and entsize in output section header.
8874
8875 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8876
8877         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8878         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8879         (Arm_relocate_functions::thm_alu11): New Method.
8880         (Arm_relocate_functions::thm_pc8): New Method.
8881         (Arm_relocate_functions::thm_pc12): New Method.
8882         (Target_arm::Scan::local): Handle the relocations.
8883         (Target_arm::Scan::global): Likewise.
8884         (Target_arm::Relocate::relocate): Likewise.
8885         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8886
8887 2010-01-29  Doug Kwan  <dougkwan@google.com>
8888
8889         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8890         of relocation types as ld.
8891
8892 2010-01-29  Doug Kwan  <dougkwan@google.com>
8893
8894         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8895         to public.
8896         (Arm_relocate_functions::thumb_branch_common): Ditto.
8897         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8898         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8899         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8900         Arm_relocate_functions::jump24): Remove.
8901         (Target_arm::Relocate::relocate): Adjust code to call
8902         Arm_relocation_functions::arm_branch_common and
8903         Arm_relocation_functions::thumb_branch_common instead of their removed
8904         wrappers.  Merge switch-cases together to reduce source code size.
8905
8906 2010-01-29  Doug Kwan  <dougkwan@google.com>
8907
8908         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8909         output_local_symbol_count_needs_update_.
8910         (Arm_relobj::output_local_symbol_count_needs_update,
8911          Arm_relobj::set_output_local_symbol_count_needs_update,
8912          Arm_relobj::update_output_local_symbol_count): New methods.
8913         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8914         member.
8915         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8916         of pointed function as in a R_ARM_PREL31 relocation.
8917         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8918         for output local symbol count updating.
8919         (Target_arm::do_relax): Update output local symbol counts in objects
8920         if necessary.
8921         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8922
8923 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8924
8925         * arm.cc: Added support for the ARM relocations:
8926         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8927         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8928         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8929         movw_prel_nc).
8930         (Arm_relocate_functions::movw_rel): New method.
8931         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8932         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8933         thm_movw_prel_nc).
8934         (Arm_relocate_functions::thm_movw_rel): New method.
8935         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8936         thm_movt_prel).
8937         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8938         relocations.
8939         (Target_arm::Scan::global): Likewise.
8940         (Target_arm::Relocate::relocate): Likewise.
8941         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8942         Likewise.
8943
8944 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8945
8946         * arm.cc: Added support for ARM group relocations.
8947         (Target_arm::reloc_needs_sym_origin): New method.
8948         (Arm_relocate_functions::calc_grp_kn): New method.
8949         (Arm_relocate_functions::calc_grp_residual): New method.
8950         (Arm_relocate_functions::calc_grp_gn): New method.
8951         (Arm_relocate_functions::arm_grp_alu): New Method.
8952         (Arm_relocate_functions::arm_grp_ldr): New Method.
8953         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8954         (Arm_relocate_functions::arm_grp_ldc): New Method.
8955         (Target_arm::Scan::local): Handle the ARM group relocations.
8956         (Target_arm::Scan::global): Likewise.
8957         (Target_arm::Relocate::relocate): Likewise.
8958         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8959         Likewise.
8960
8961 2010-01-26  Doug Kwan  <dougkwan@google.com>
8962
8963         * arm.cc (set): Include.
8964         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8965         pointer type.
8966         (Arm_output_section::Text_section_list): New type.
8967         (Arm_output_section::append_text_sections_to_list): New method.
8968         (Arm_output_section::fix_exidx_coverage): Ditto.
8969         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8970         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8971         Relobj::set_section_offset() instead of
8972         Sized_relobj::invalidate_section_offset().
8973         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8974         parameter for section headers. Ignore relocation sections for
8975         unallocated sections and EXIDX sections.
8976         (Target_arm::fix_exidx_coverage): New method.
8977         (Target_arm::output_section_address_less_than): New type.
8978         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8979         linked text section instead of the EXIDX section.
8980         (Arm_output_section::create_stub_group): Add an assertion to check
8981         that this is not an EXIDX output section.
8982         (Arm_output_section::append_text_sections_to_list): New method.
8983         (Arm_output_section::fix_exidx_coverage): Ditto.
8984         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8985         Arm_relobj::section_needs_reloc_stub_scanning.
8986         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8987         first pass.
8988         (Target_arm::fix_exidx_coverage): New method.
8989         * object.h (Relobj::set_output_section): New method.
8990         (Sized_relobj::invalidate_section_offset): Remove method.
8991         (Sized_relobj::do_invalidate_section_offset): Remove method.
8992         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8993
8994 2010-01-25  Doug Kwan  <dougkwan@google.com>
8995
8996         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8997         Fix warning due to signed and unsigned comparison on a 32-bit host.
8998
8999 2010-01-22  Doug Kwan  <dougkwan@google.com>
9000
9001         * arm.cc (Target_arm::do_relax): Record an output section for section
9002         offset adjustment it contains any stub table that has changed.
9003         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9004         offsets in an output section if necessary.
9005         * output.cc (Output_section::Output_section): Initialize
9006         section_offsets_need_adjustments_.
9007         (Output_section::add_input_section_for_script): Renamed to
9008         Output_section::add_simple_input_section.
9009         (Output_section::save_states): Add a comment.
9010         (Output_section::discard_states): New method defintion.
9011         (Output_section::adjust_section_offsets): Same.
9012         * output.h (Output_section::add_input_section_for_script): Renamed to
9013         Output_section::add_simple_input_section.
9014         (Output_section::discard_states): New method declaration.
9015         (Output_section::adjust_section_offsets): Same.
9016         (Output_section::section_offsets_need_adjustment,
9017         Output_section::set_section_offsets_need_adjustment): New method
9018         definitions.
9019         (Output_section::section_offsets_need_adjustment_): New data member.
9020         * script-sections.cc
9021         (Output_section_element_input::set_section_address): Adjust code for
9022         renaming of Output_section::add_input_section_for_script.
9023         (Orphan_output_section::set_section_address): Same.
9024
9025 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9026
9027         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9028         Fix_v4bx enum values .
9029         * gold/options.h (General_options): New option definitions.
9030         (General_options::fix_v4bx): New method.
9031         (General_options::Fix_v4bx): New enum.
9032         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9033         (General_options::parse_fix_v4bx_interworking): New method.
9034
9035 2010-01-22  Doug Kwan  <dougkwan@google.com>
9036
9037         * arm.cc (Arm_exidx_fixup): New class.
9038
9039 2010-01-21  Doug Kwan  <dougkwan@google.com>
9040
9041         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9042         classes.
9043         (Arm_exidx_section_offset_map): New type.
9044
9045 2010-01-21  Doug Kwan  <dougkwan@google.com>
9046
9047         * arm.cc (Arm_exidx_input_section): New class.
9048         (Arm_relobj::exidx_input_section_by_link,
9049         Arm_relobj::exidx_input_section_by_shndx,
9050         Arm_relobj::make_exidx_input_section): New methods.
9051         (read_arm_attributes_section): Remove.
9052         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9053         information about them.
9054         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9055         to here.
9056
9057 2010-01-20  Doug Kwan  <dougkwan@google.com>
9058
9059         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9060         Input_section_specifier to Section_id.
9061         (Target_arm::new_arm_input_section: Adjust code for change of key
9062         type.
9063         (Target_arm::find_arm_input_section): Ditto.
9064         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9065         (Section_id): Remove.
9066         (Garbage_collection::Section_id_hash): Remove.
9067         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9068         (Section_id): Remove.
9069         (Icf::Section_id_hash): Remove.
9070         * object.h (Section_id, Const_section_id, Section_id_hash,
9071         Const_section_id_hash): New type definitions.
9072         * output.cc (Output_section::add_relaxed_input_section): Change to
9073         use Const_section_id instead of Input_section_specifier as key type.
9074         (Output_section::add_merge_input_section): Ditto.
9075         (Output_section::build_relaxation_map): Change to use Section_id
9076         instead of Input_section_specifier as key type.
9077         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9078         Ditto.
9079         (Output_section::convert_input_sections_to_relaxed_sections): Change
9080         to use Const_section_id instead of Input_section_specifier as key type.
9081         (Output_section::find_merge_section): Ditto.
9082         (Output_section::find_relaxed_input_section): Ditto.
9083         * output.h (Input_section_specifier): Remove class.
9084         (Output_section::Output_section_data_by_input_section_map): Change
9085         key type to Const_section_id.
9086         (Output_section::Output_relaxed_input_section_by_input_section_map):
9087         Ditto.
9088         (Output_section::Relaxation_map): Change key type to Section_id.
9089
9090 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9091
9092         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9093         (class Arm_v4bx_stub): New class.
9094         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9095         (Stub_factory::make_arm_v4bx_stub): New method.
9096         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9097         (Stub_table::empty): Handle v4bx stubs.
9098         (Stub_table::add_arm_v4bx_stub): New method.
9099         (Stub_table::find_arm_v4bx_stub): New method.
9100         (Arm_relocate_functions::v4bx): New method.
9101         (Target_arm::fix_v4bx): New method.
9102         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9103         (Stub_table::relocate_stubs): Likewise.
9104         (Stub_table::do_write): Likewise.
9105         (Stub_table::update_data_size_and_addralign): Likewise.
9106         (Stub_table::finalize_stubs):  Likewise.
9107         (Target_arm::Scan::local): Likewise.
9108         (Target_arm::Scan::global): Likewise.
9109         (Target_arm::do_finalize_sections): Likewise.
9110         (Target_arm::Relocate::relocate): Likewise.
9111         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9112         Likewise.
9113         (Target_arm::scan_reloc_for_stub): Likewise.
9114         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9115
9116 2010-01-19  Ian Lance Taylor  <iant@google.com>
9117
9118         * output.cc (Output_section_headers::do_sized_write): Write large
9119         segment count to sh_info field.
9120         (Output_file_header::do_sized_write): For large segment count,
9121         write PN_XNUM to e_phnum field.
9122
9123 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9124
9125         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9126         (Arm_relocate_functions::thm_jump8): New function.
9127         (Arm_relocate_functions::thm_jump11): New function.
9128         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9129         R_ARM_THM_JUMP11.
9130         (Target_arm::Scan::global): Likewise.
9131         (Target_arm::Relocate::relocate): Likewise.
9132         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9133         Likewise.
9134
9135 2010-01-14  Doug Kwan  <dougkwan@google.com>
9136
9137         * arm.cc (map, utility): Include headers.
9138         (Target_arm::apply_cortex_a8_workaround): New method.
9139         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9140         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9141         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9142         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9143         the --[no-]fix-cortex-a8 command line options.
9144         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9145         (Target_arm::relocate_stub): Use addend in instruction template.
9146         * options.h (DEFINE_bool): Set the user-set flag.
9147         (General_options): Add --[no-]-fix-cortex options.
9148         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9149         : Update fast look-up map after conversion.
9150
9151 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9152
9153         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9154         in the first pass of do_layout.
9155
9156 2010-01-13  Doug Kwan  <dougkwan@google.com>
9157
9158         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9159         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9160         apparent compiler problem of not folding static constant integral
9161         data members of elfcpp::Elf_sizes<32>.
9162
9163 2010-01-13  Doug Kwan  <dougkwan@google.com>
9164
9165         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9166         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9167         Arm_relobj::scan_section_for_cortex_a8_erratum,
9168         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9169         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9170         sections to scan for relocation stubs into a new method
9171         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9172         relocation and Cortex-A8 stub scanning.
9173         (Target_arm::do_relax): Force stubs to be after stubbed sections
9174         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9175         the beginning of a new relaxation pass.  Update a comment.
9176         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9177
9178 2010-01-12  Ian Lance Taylor  <iant@google.com>
9179
9180         * target-reloc.h (visibility_error): New inline function.
9181         (relocate_section): Call visibility_error.
9182         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9183         (MOSTLYCLEANFILES): Likewise.
9184         (protected_4_pic.o, protected_3.err): New targets.
9185         * testsuite/protected_4.cc: New file.
9186
9187 2010-01-12  Doug Kwan  <dougkwan@google.com>
9188
9189         * arm.cc (Cortex_a8_reloc): New class.
9190         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9191         and cortex_a8_relocs_info_.
9192         (Target_arm::fix_cortex_a8): New method definition.
9193         (Target_arm::Cortex_a8_relocs_info): New type.
9194         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9195         New data member declarations.
9196         (Target_arm::scan_reloc_for_stub): Record information about
9197         relocations for THUMB branches that might be exempted from the
9198         Cortex-A8 workaround.
9199         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9200         at the beginning of a relaxation pass.
9201
9202 2010-01-12  Doug Kwan  <dougkwan@google.com>
9203
9204         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9205         (Arm_relobj::Mapping_symbol_position,
9206          Arm_reloj::Mapping_symbol_position_less,
9207          Arm_relobj::Mapping_symbols_info): New types.
9208         (Target_arm::is_mapping_symbol_name): New method definition.
9209         (Arm_relobj::do_count_local_symbols): Save information about mapping
9210         symbols.
9211
9212 2010-01-11  Doug Kwan  <dougkwan@google.com>
9213
9214         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9215         Arm_relocate_functions::thumb32_branch_upper,
9216         Arm_relocate_functions::thumb32_branch_lower,
9217         Arm_relocate_functions::thumb32_cond_branch_offset,
9218         Arm_relocate_functions::thumb32_cond_branch_upper,
9219         Arm_relocate_functions::thumb32_cond_branch_lower,
9220         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9221         branch offset encoding.
9222         (Arm_relocate_functions::thumb_branch_common): Use new branch
9223         offset encoding methods to avoid code duplication.
9224         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9225         (Stub_addend_reader::operator()): Use new branch encoding method
9226         to avoid code duplication.
9227
9228 2010-01-11  Doug Kwan  <dougkwan@google.com>
9229
9230         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9231         (Target_arm::do_finalize_sections): Define special EXIDX section
9232         symbols only if referenced.
9233         * gc.h (Garbage_collection::add_reference): New method.
9234         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9235         code duplication.
9236
9237 2010-01-11  Ian Lance Taylor  <iant@google.com>
9238
9239         * script.cc (Version_script_info::build_expression_list_lookup):
9240         Change complaing about duplicate wildcard match from error to
9241         warning.
9242
9243         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9244         of 2009-12-30.
9245         (Version_script_info::Version_script_info): Initialize globs_,
9246         default_version_, default_is_global_, and exact_.  Don't
9247         initialize globals_ or locals_.
9248         (Version_script_info::build_lookup_tables): Build local symbols
9249         first.
9250         (Version_script_info::unquote): New function.
9251         (Version_script_info::add_exact_match): New function.
9252         (Version_script_info::build_expression_list_lookup): Remove lookup
9253         parameter.  Add is_global parameter.  Change all callers.  Handle
9254         wildcard pattern specially.  Unquote pattern.  Call
9255         add_exact_match.
9256         (Version_script_info::get_name_to_match): New function.
9257         (Version_script_info::get_symbol_version): New function.
9258         (Version_script_info::get_symbol_version_helper): Remove.
9259         (Version_script_info::check_unmatched_names): Call unquote.
9260         * script.h (class Version_script_info): Change get_symbol_version
9261         to be non-inline and add is_global parameter; change all callers.
9262         Rewrite symbol_is_local.  Update declarations.  Define struct
9263         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9264         Remove globals_ and locals_ members.  Add exact_, globs_,
9265         default_version_, is_global_.
9266         (Version_script_info::Glob): Remove pattern, add expression and
9267         is_global.  Update constructor.  Change all callers.
9268         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9269         default version.
9270         (Versions::symbol_section_contents): If a symbol is undefined, or
9271         defined in a dynamic object, set the version index to
9272         VER_NDX_LOCAL.
9273         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9274         symbol_is_local.
9275         (Symbol_table::add_from_pluginobj): Likewise.
9276         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9277
9278 2010-01-11  Doug Kwan  <dougkwan@google.com>
9279
9280         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9281         (incremental_dump_LDADD): Add linking option for libintl.
9282         * Makefile.in: Regenerate.
9283
9284 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9285
9286         PR gold/11144
9287         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9288         instead of -Ds.
9289         * testsuite/Makefile.in: Regenerated.
9290
9291 2010-01-10  Doug Kwan  <dougkwan@google.com>
9292
9293         * options.h (DEFINE_var): Use parentheses around argument varname__
9294         in macro body to avoid any unintended subsequent substitutions.
9295
9296 2010-01-10  Ian Lance Taylor  <iant@google.com>
9297
9298         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9299         candidates before doing symbol resolution.
9300
9301         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9302         ODR candidates if only one is weak.
9303
9304 2010-01-08  Ian Lance Taylor  <iant@google.com>
9305
9306         * script.cc (Version_script_info::build_expression_list_lookup):
9307         Don't warn about ambiguous version, just record the ambiguity.
9308         (Version_script_info::get_symbol_version_helper): Give error if
9309         version is ambiguous.
9310
9311 2010-01-08  Doug Kwan  <dougkwan@google.com>
9312
9313         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9314         prev_data_size_ and prev_addralign_.  Remove initializer for
9315         deleted data member has_been_changed_.
9316         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9317         to determine if the table is empty.
9318         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9319         Remove.
9320         (Stub_table::add_reloc_stub): Define method in class definition
9321         instead of just declaring it there.
9322         (Stub_table::add_cortex_a8_stub): New method definition.
9323         (Stub_table::update_data_size_and_addralign): Ditto.
9324         (Stub_table::finalize_stubs): Ditto.
9325         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9326         (Stub_table::do_addralign_): Return address alignment in the
9327         (Stub_table::do_reset_address_and_file_offset): Define method in
9328         class definition instead of declaring it there.  Set current data
9329         size to be the data size of the previous pass.
9330         (Stub_table::set_final_data_size): Use current data size as the
9331         final data size.
9332         (Stub_table::relocate_stub): Change parameter type of stub from
9333         Reloc_stub pointer to Stub pointer.
9334         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9335         (Stub_table::Cortex_a8_stub_list): New typedef.
9336         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9337          Stub_table::prev_addralign_): New data member.
9338         (Arm_relobj::Arm_relobj): Initialize data member
9339         section_has_cortex_a8_workaround_.
9340         (Arm_relobj::section_has_cortex_a8_workaround,
9341          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9342          definitions.
9343         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9344         declarations.
9345         (Target_arm::relocate_stub): Change parameter type of stub from
9346         Reloc_stub pointer to Stub pointer.
9347         (Insn_template::size, Insn_template::alignment): Handle
9348         THUMB16_SPECIAL_TYPE.
9349         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9350          Stub_table::update_data_size_and_addralign,
9351          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9352         definitions.
9353         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9354         (Stub_table::do_write): Ditto.
9355         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9356
9357 2010-01-08  Ian Lance Taylor  <iant@google.com>
9358
9359         PR 11108
9360         * symtab.h (class Symbol): Remove fields is_target_special_ and
9361         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9362         (Symbol::is_defined_in_discarded_section): New function.
9363         (Symbol::set_is_defined_in_discarded_section): New function.
9364         (Symbol::has_plt_offset): Rewrite.
9365         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9366         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9367         Don't initialize is_target_special_ or has_plt_offset_.
9368         Initialize is_defined_in_discarded_section_.
9369         (Symbol_table::add_from_relobj): If appropriate, set
9370         is_defined_in_discarded_section.
9371         * resolve.cc (Symbol::override_base_with_special): Don't test
9372         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9373         * target-reloc.h (relocate_section): Do special handling for
9374         symbols defined in discarded sections for global symbols as well
9375         as local symbols.
9376
9377 2010-01-08  Ian Lance Taylor  <iant@google.com>
9378
9379         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9380         the SHT_SYMTAB case.
9381
9382 2010-01-08  Ian Lance Taylor  <iant@google.com>
9383
9384         * object.cc (Sized_relobj::do_layout): Don't get confused if
9385         layout_eh_frame returns NULL.
9386
9387 2010-01-08  Ian Lance Taylor  <iant@google.com>
9388
9389         PR 11084
9390         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9391         dynamic symbol table, use the normal symbol table.
9392         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9393         symbol table.
9394
9395 2010-01-08  Ian Lance Taylor  <iant@google.com>
9396
9397         PR 11072
9398         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9399         sections.
9400
9401 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9402
9403         * version.cc (print_version): Change to "Copyright 2010".
9404
9405 2010-01-08  Ian Lance Taylor  <iant@google.com>
9406
9407         PR 10287
9408         PR 11063
9409         * i386.cc (class Target_i386): Change return type of plt_section
9410         to be non-const.
9411         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9412         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9413         tls_desc_rel_ field.
9414         (Output_data_plt_i386::rel_tls_desc): New function.
9415         (Target_i386::rel_tls_desc_section): New function.
9416         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9417         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9418         R_386_TLS_DESC reloc in rel_tls_desc_section.
9419         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9420         Define struct Tlsdesc_info.
9421         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9422         (Target_x86_64::do_reloc_symbol_index): New function.
9423         (Target_x86_64::add_tlsdesc_info): New function.
9424         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9425         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9426         tlsdesc_rel_ field.
9427         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9428         all callers.
9429         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9430         (Target_x86_64::rela_tlsdesc_section): New function.
9431         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9432         handling.
9433         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9434         (Target_x86_64::do_reloc_addend): New function.
9435         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9436         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9437         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9438         (Output_reloc::type): New function.
9439         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9440         (Output_reloc::is_target_specific): New function.
9441         (Output_reloc::target_arg): New function.
9442         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9443         absolute relocs and target specific relocs.
9444         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9445         add_target_specific.
9446         (class Output_data_reloc) [SHT_RELA]: Likewise.
9447         * output.cc (Output_reloc::Output_reloc): Add four new versions
9448         for absolute relocs and target specific relocs.
9449         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9450         (Output_reloc::get_symbol_index): Likewise.
9451         (Output_reloc::local_section_offset): Check that local_sym_index_
9452         is not TARGET_CODE or 0.
9453         (Output_reloc::symbol_value): Likewise.
9454         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9455         reloc.
9456         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9457         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9458         functions.
9459         * layout.cc (add_target_dynamic_tags): Use output section for
9460         DT_PLTRELSZ and DT_JMPREL.
9461
9462 2010-01-07  Ian Lance Taylor  <iant@google.com>
9463
9464         PR 11061
9465         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9466         function.
9467         (class Output_data_reloc_generic): Define.
9468         (class Output_data_reloc_base): Change base class to
9469         Output_data_reloc_generic.  Change add() method to call
9470         bump_relative_reloc_count for a relative reloc.  Remove
9471         sort_relocs_ field.
9472         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9473         to sort_relocs().
9474         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9475         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9476         appropriate.
9477         * layout.h (class Layout): Update declaration.
9478
9479 2010-01-07  Ian Lance Taylor  <iant@google.com>
9480
9481         * output.h (class Output_data): Add const version of
9482         output_section and do_output_section.
9483         (class Output_section_data): Add const version of
9484         do_output_section.
9485         (class Output_section): Likewise.
9486         * layout.cc (Layout::add_target_dynamic_tags): New function.
9487         * layout.h (class Layout): Update declarations.
9488         * arm.cc (Target_arm::do_finalize_sections): Use
9489         add_target_dynamic_tags.
9490         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9491         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9492         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9493         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9494
9495 2010-01-07  Ian Lance Taylor  <iant@google.com>
9496
9497         PR 11042
9498         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9499         object as needed.
9500
9501 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9502             Ian Lance Taylor  <iant@google.com>
9503
9504         PR 11019
9505         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9506         Xindex::read_symtab_xindex.
9507
9508 2010-01-07  Doug Kwan  <dougkwan@google.com>
9509
9510         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9511         (Insn_template::thumb16_bcond_insn): New method declaration.
9512         (Insn_template): Fix spelling.
9513         (Stub::thumb16_special): New method declaration.
9514         (Stub::do_write): Define virtual method which was previously pure
9515         virtual.
9516         (Stub::do_thumb16_special): New method declaration.
9517         (Stub::do_fixed_endian_write): New template member.
9518         (Reloc_stub::do_write): Remove.
9519         (Reloc_stub::do_fixed_endian_write): Remove.
9520         (Cortex_a8_stub): New class definition.
9521         (Stub_factory::make_cortex_a8_stub): New method definition.
9522         (Stub_factory::Stub_factory): Add missing static storage class
9523         qualifier for elf32_arm_stub_a8_veneer_blx.
9524
9525 2010-01-07  Ian Lance Taylor  <iant@google.com>
9526
9527         PR 10980
9528         * options.h (class General_options): Add --warn-unresolved-symbols
9529         and --error-unresolved-symbols.
9530         * errors.cc (Errors::undefined_symbol): Implement
9531         --warn-unresolved-symbols.
9532
9533         * options.h (class General_options): Add -z text and -z textoff.
9534         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9535
9536 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9537
9538         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9539         (Garbage_collection::cident_sections): New function.
9540         (Garbage_collection::add_cident_section): New function.
9541         (Garbage_collection::cident_sections_): New member.
9542         (gc_process_relocs): Add references to sections whose names are C
9543         identifiers.
9544         * gold.h (cident_section_start_prefix): New constant.
9545         (cident_section_stop_prefix): New constant.
9546         (is_cident): New function.
9547         * layout.cc (Layout::define_section_symbols): Replace string constants
9548         with the newly defined constants.
9549         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9550         C identifiers.
9551         * testsuite/Makefile.am: Add gc_orphan_section_test.
9552         * testsuite/Makefile.in: Regenerate.
9553         * testsuite/gc_orphan_section_test.cc: New file.
9554         * testsuite/gc_orphan_section_test.sh: New file.
9555
9556 2010-01-06  Ian Lance Taylor  <iant@google.com>
9557
9558         PR 10980
9559         * options.h (class General_options): Add --warn-shared-textrel.
9560         * layout.cc (Layout::finish_dynamic_section): Implement
9561         --warn-shared-textrel.
9562
9563         PR 10980
9564         * options.h (class General_options): Add --warn-multiple-gp.
9565
9566 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9567
9568         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9569         $(THREADSLIB) and $(LIBDL).
9570         * Makefile.in: Rebuild.
9571
9572 2010-01-06  Ian Lance Taylor  <iant@google.com>
9573
9574         PR 10980
9575         * options.cc (General_options::parse_section_start): New function.
9576         (General_options::section_start): New function.
9577         (General_options::General_options): Initialize all members.
9578         * options.h: Include <map>
9579         (class General_options): Add --section-start.  Add section_starts_
9580         member.
9581         * layout.cc (Layout::attach_allocated_section_to_segment): If
9582         --section-start was used, set the address of the segment.  Remove
9583         local sort_sections.
9584         (Layout::relaxation_loop_body): If the address of the load segment
9585         has been set by --section-start, don't use it.
9586         * output.h (Output_segment::update_flags_for_output_section): New
9587         function.
9588         * output.cc (Output_segment::add_output_section): Call
9589         update_flags_for_output_section.
9590
9591 2010-01-05  Ian Lance Taylor  <iant@google.com>
9592
9593         PR 10980
9594         * options.h (class General_options): Add --undefined-version.
9595         * script.cc (struct Version_expression): Add was_matched_by_symbol
9596         field.
9597         (Version_script_info::matched_symbol): New function.
9598         (Version_script_info::get_symbol_version_helper): Call
9599         matched_symbol.
9600         (Version_script_info::check_unmatched_names): New function.
9601         * script.h (class Version_script_info): Update declarations.
9602         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9603
9604         * options.h (class General_options): Use DEFINE_bool_alias for
9605         allow_multiple_definition.
9606         * resolve.cc (Symbol_table::should_override): Don't test
9607         allow_multiple_definition.
9608
9609         PR 10980
9610         * options.h (class General_options): Add --cref.
9611         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9612         until after printing cref table.
9613         * cref.cc: Include "symtab.h".
9614         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9615         (Cref_table_compare::operator()): New function.
9616         (Cref_inputs::gather_cref): New function.
9617         (filecol): New static const.
9618         (Cref_inputs::print_cref): New function.
9619         (Cref::print_cref): New function.
9620         * cref.h: Include <cstdio>.
9621         (class Cref): Update declarations.
9622         * mapfile.h (Mapfile::file): New function.
9623         * object.h (class Object): Define Symbols.  Declare virtual
9624         do_get_global_symbols.
9625         (Object::get_global_symbols): New function.
9626         * object.cc (Input_objects::add_object): Pass object to cref_ if
9627         --cref.
9628         (Input_objects::archive_start): Likewise.
9629         (Input_objects::archive_stop): Likewise.
9630         (Input_objects::print_cref): New function.
9631         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9632         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9633         --cref.
9634         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9635         function.
9636         * plugin.h (class Sized_pluginobj): Update declarations.
9637
9638 2010-01-05  Ian Lance Taylor  <iant@google.com>
9639
9640         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9641         to is_default_version.  Rename insdef to insdefault.
9642         (Symbol_table::add_from_relobj): Rename def to is_default_version
9643         and local to is_forced_local.
9644         (Symbol_table::add_from_pluginobj): Likewise.
9645         (Symbol_table::add_from_dynobj): Likewise.
9646         (Symbol_table::define_special_symbol): Rename insdef to
9647         insdefault.
9648
9649 2010-01-04  Ian Lance Taylor  <iant@google.com>
9650
9651         PR 10980
9652         * options.h (class General_options): Add
9653         --allow-multiple-definition and -z muldefs.
9654         * resolve.cc (Symbol_table::should_override): Don't warn about a
9655         multiple symbol definition if --allow-multiple-definition or -z
9656         muldefs.
9657
9658         PR 10980
9659         * options.h (class General_options): Add --add-needed and
9660         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9661         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9662         error if --copy-dt-needed-entries aka --add-needed is used and
9663         would cause a change in behaviour.
9664
9665         PR 10980
9666         * options.h (class General_options): Add -G as a short version of
9667         --shared.  Add no-op options -assert, -g, and -i.
9668
9669 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9670
9671         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9672         check for .text or .gnu.linkonce.t sections.
9673         * icf.cc (Icf::find_identical_sections): Ditto.
9674         Change the detection for mangled function name within the section
9675         name.
9676         * icf.h (is_section_foldable_candidate): New function.
9677
9678 2009-12-30  Ian Lance Taylor  <iant@google.com>
9679
9680         PR 10980
9681         * options.h (class General_options): Permit two dashes with
9682         --retain-symbols-file.
9683
9684 2009-12-30  Ian Lance Taylor  <iant@google.com>
9685
9686         PR 10979
9687         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9688         don't put the file header and segment headers in the text
9689         segment.
9690
9691         PR 10979
9692         * common.cc (Sort_commons::operator()): Stabilize sort when both
9693         entries are NULL.
9694         (Symbol_table::do_allocate_commons_list): When allocating common
9695         symbols, skip a symbol which is no longer common.
9696         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9697         an object before checking its type.
9698         * testsuite/common_test_2.c: New file.
9699         * testsuite/common_test_3.c: New file.
9700         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9701         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9702         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9703         (common_test_2_pic.o, common_test_2.so): New targets.
9704         (common_test_3_pic.o, common_test_3.so): New targets.
9705         * testsuite/Makefile.in: Rebuild.
9706
9707         PR 10979
9708         * script.cc (read_input_script): If we see a new SECTIONS clause,
9709         and we have added an input section, give an error.
9710         * layout.h (class Layout): Add have_added_input_section function.
9711         Add have_added_input_section_ field.
9712         * layout.cc (Layout::Layout): Initialize
9713         have_added_input_section_.
9714         (Layout::layout): Set have_added_input_section_.
9715         (Layout::layout_eh_frame): Likewise.
9716
9717 2009-12-30  Ian Lance Taylor  <iant@google.com>
9718
9719         PR 10931
9720         * options.h (class General_options): Add --sort-common option.
9721         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9722         * common.cc (Sort_common): Add sort_order parameter to
9723         constructor.  Add sort_order_ field.
9724         (Sort_commons::operator): Check sort_order_.
9725         (Symbol_table::allocate_commons): Determine the sort order.
9726         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9727         Change all callers.
9728         (Symbol_table::do_allocate_commons_list): Likewise.
9729
9730 2009-12-30  Ian Lance Taylor  <iant@google.com>
9731
9732         PR 10916
9733         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9734         symbols from this object, don't change the visibility of an
9735         undefined symbol.
9736         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9737
9738 2009-12-30  Ian Lance Taylor  <iant@google.com>
9739
9740         PR 10861
9741         * script.h (class Version_script_info): Define Language enum.
9742         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9743         new fields globals_, locals_, and is_finalized_.
9744         * script.cc: Various formatting fixes.
9745         (class Parser_closure): Change language_stack_ from a vector of
9746         std::string to one of Version_script_info::Language.  Adjust all
9747         uses accordingly.
9748         (class Lazy_demangler): Remove.
9749         (struct Version_expression): Change language from std::string to
9750         Version_script_info::Language.
9751         (Version_script_info::Version_script_info): New function.
9752         (Version_script_info::~Version_script_info): Don't call clear.
9753         (Version_script_info::finalize): New function.
9754         (Version_script_info::build_lookup_tables): New function.
9755         (Version_script_info::build_expression_list_lookup): New
9756         function.
9757         (Version_script_info::get_symbol_version_helper): Rewrite to use
9758         lookup tables.
9759         (Version_script_info::print_expression_list): Adjust to use
9760         Version_script_info::Language.
9761         (script_push_lex_into_version_mode): Check that the version script
9762         has not been finalized.
9763         (version_script_push_lang): Change language string to
9764         Version_script_info::Language.
9765         * options.cc (Command_line::version_script): New function.
9766         * options.h (class General_options): Add finalize_dynamic_list
9767         function.  Change version_script from declaration to definition.
9768         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9769         * testsuite/version_script.map: Remove duplicate def of foo.
9770         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9771         version_script.map.
9772         * testsuite/Makefile.in: Rebuild.
9773
9774 2009-12-30  Ian Lance Taylor  <iant@google.com>
9775
9776         PR 10843
9777         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9778         if the input symbol index is 0, make the output symbol index 0.
9779
9780 2009-12-30  Ian Lance Taylor  <iant@google.com>
9781
9782         PR 10670
9783         * options.h (class General_options): Add -x/--discard-all.
9784         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9785         --discard-all.  If the local symbol needs a dynamic entry, check
9786         that before handling --discard-locals.
9787
9788 2009-12-30  Ian Lance Taylor  <iant@google.com>
9789
9790         PR 10450
9791         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9792         flags to PF_R.
9793         (Output_segment::add_output_section): Don't change the flags if
9794         the type is PT_TLS.
9795
9796         PR 10450
9797         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9798         GNU hash table if they need a dynamic value.  Otherwise, don't add
9799         them if they are defined in a dynamic object or are forced local.
9800
9801 2009-12-29  Ian Lance Taylor  <iant@google.com>
9802
9803         PR 10450
9804         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9805         .gnu.hash table for a 32-bit target.
9806
9807         PR 10450
9808         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9809         regular and a dynamic object only needs a dynamic symbol table
9810         entry if it is externally visible.
9811
9812         PR 10450
9813         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9814         constructor.  Add global_offset_table_ field.
9815         (Target_i386::got_section): Set global_offset_table_.
9816         (Target_i386::do_finalize_sections): Set global_offset_table_
9817         size.
9818         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9819         in constructor.  Add global_offset_table_ field.
9820         (Target_x86_64::got_section): Set global_offset_table_.
9821         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9822         size.
9823
9824         * layout.cc (Layout::Layout): Initialize increase_relro_.
9825         (Layout::get_output_section): Add is_relro, is_last_relro, and
9826         is_first_non_relro parameters.  Change all callers.
9827         (Layout::choose_output_section): Likewise.
9828         (Layout::add_output_section_data): Likewise.
9829         (Layout::make_output_section): Likewise.
9830         (Layout::set_segment_offsets): Clear increase_relro when using a
9831         linker script.
9832         * layout.h (class Layout): Add increase_relro method.  Add
9833         increase_relro_ field.  Update declarations.
9834         * output.cc (Output_section::Output_section): Initialize
9835         is_last_relro_ and is_first_non_relro_.
9836         (Output_segment::add_output_section): Group relro sections is
9837         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9838         (Output_segment::maximum_alignment): Remove relro handling.
9839         (Output_segment::set_section_addresses): Add increase_relro
9840         parameter.  Change all callers.  Add initial alignment to align
9841         relro sections on separate page.  Remove old relro handling.
9842         (Output_segment::set_section_list_addresses): Remove in_relro
9843         parameter.  Change all callers.
9844         (Output_segment::set_offset): Add increase parameter.  Change all
9845         callers.  Remove old relro handling.
9846         * output.h (class Output_section): Add new methods: is_last_relro,
9847         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9848         Add is_last_relro_ and is_first_non_relro_ fields.
9849         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9850         Create separate .got.plt section.  Call increase_relro.
9851         * x86_64.cc (Target_x86_64::got_section): Likewise.
9852         * testsuite/relro_script_test.t: Add .got.plt.
9853
9854         PR 10450
9855         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9856         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9857         (Layout::finalize): Call set_dynamic_symbol_size.
9858         (Layout::set_dynamic_symbol_size): New function.
9859         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9860         set_dynamic_symbol_size.
9861
9862         PR 10450
9863         * output.h (class Output_section): Add is_entsize_zero_ field.
9864         * output.cc (Output_section::Output_section): Initialize
9865         is_entsize_zero_.
9866         (Output_section::set_entsize): If two different entsizes are
9867         requested, force it to zero.
9868         (Output_section::add_input_section): Set flags for .debug_str
9869         before updating section flags.  Set entsize.
9870         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9871         and SHF_STRING if all input sections have those flags.
9872
9873 2009-12-29   Rafael Espindola  <espindola@google.com>
9874
9875         * main.cc (main): Fix the sys time reporting.
9876         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9877         reporting.
9878
9879 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9880
9881         * options.cc (General_options::parse_version): Allow -v to exit
9882         without an error if there is nothing to link.
9883
9884 2009-12-29  Ian Lance Taylor  <iant@google.com>
9885
9886         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9887         using a version of gcc before 4.1.
9888         * configure: Rebuild.
9889
9890 2009-12-28  Chris Demetriou  <cgd@google.com>
9891
9892         * attributes.cc (Output_attributes_section_data::do_write): Use
9893         std::vector::front rather than std::vector::data.
9894
9895 2009-12-28  Ian Lance Taylor  <iant@google.com>
9896
9897         * symtab.h (class Symbol_table): Add enum Defined.
9898         * resolve.cc (Symbol_table::should_override): Add defined
9899         parameter.  Change all callers.  Test whether object is NULL
9900         before calling a method on it.
9901         (Symbol_table::report_resolve_problem): Add defined parameter.
9902         Change all callers.
9903         (Symbol_table::should_override_with_special): Likewise.
9904         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9905         parameter.  Change all callers.
9906         (Symbol_table::do_define_in_output_data): Likewise.
9907         (Symbol_table::define_in_output_segment): Likewise.
9908         (Symbol_table::do_define_in_output_segment): Likewise.
9909         (Symbol_table::define_as_constant): Likewise.
9910         (Symbol_table::do_define_as_constant): Likewise.
9911         * script.h (class Symbol_assignment): Add is_defsym parameter to
9912         constructor; change all callers.
9913         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9914         parameter.  Change all callers.  Add is_defsym_ field.
9915         (class Parser_closure): Add parsing_defsym parameter to
9916         constructor; change all callers.  Add parsing_defsym accessor
9917         function.  Add parsing_defsym_ field.
9918
9919 2009-12-28  Ian Lance Taylor  <iant@google.com>
9920
9921         * gold.cc (queue_middle_tasks): Fix formatting.
9922         * object.cc (Relobj::is_section_name_included): Likewise.
9923
9924 2009-12-23  Ian Lance Taylor  <iant@google.com>
9925
9926         * i386.cc (Target_i386::do_calls_non_split): Recognize
9927         -fsplit-stack prologue for a function with a static chain.
9928         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9929         -fsplit-stack prologue when using %r11.
9930
9931 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9932
9933         * options.cc (General_options::parse_version): Make -v continue and do
9934         the link like GNU ld does.
9935
9936 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9937
9938         * Makefile.am (CCFILES): Add timer.cc.
9939         (HFILES): Add timer.h.
9940         * configure.ac: Check for sysconf and times.
9941         * main.cc: include timer.h.
9942         (main): Use Timer instead of get_run_time.
9943         * timer.cc: New.
9944         * timer.h: New.
9945         * workqueue.cc: include timer.h.
9946         (Workqueue::find_and_run_task):
9947         Report user, sys and wall time.
9948         * Makefile.in: Regenerate.
9949         * config.in: Regenerate.
9950         * configure: Regenerate.
9951
9952 2009-12-16  Doug Kwan  <dougkwan@google.com>
9953
9954         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9955         sections.
9956         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9957         relaxed input sections.
9958         * output.cc (Output_section::find_relaxed_input_section): Change
9959         return type to Output_relaxed_input_section pointer.  Adjust code
9960         for new type of relaxed_input_section_map_.
9961         * output.h (Output_section::find_relaxed_input_section): Change
9962         return type to Output_relaxed_input_section pointer.
9963         (Output_section::Output_relaxed_input_section_by_input_section_map):
9964         New type.
9965         (Output_section::relaxed_input_section_map_): Change type to
9966         Output_section::Output_relaxed_input_section_by_input_section_map.
9967         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9968         input section.
9969
9970 2009-12-15  Ian Lance Taylor  <iant@google.com>
9971
9972         * layout.cc (Layout::create_shstrtab): Only write out after input
9973         sections if we are compressing debug sections.
9974
9975 2009-12-15  Ian Lance Taylor  <iant@google.com>
9976
9977         * archive.cc (Archive::add_symbols): Only look up a symbol without
9978         a version if there is, in fact, a version.
9979
9980 2009-12-14  Ian Lance Taylor  <iant@google.com>
9981
9982         Revert -Wshadow changes, all changes from:
9983         2009-12-11  Doug Kwan  <dougkwan@google.com>
9984         2009-12-11  Nick Clifton  <nickc@redhat.com>
9985         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9986
9987 2009-12-11  Doug Kwan  <dougkwan@google.com>
9988
9989         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9990         due to -Wshadow.
9991         * attributes.cc (Object_attribute::size): Ditto.
9992         (Attributes_section_data::size): Ditto.
9993         (Attributes_section_data::Attributes_section_data): Ditto.
9994         (Output_attributes_section_data::do_write): Ditto.
9995         * attributes.h (Object_attribute::set_type): Ditto.
9996         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9997
9998 2009-12-11  Nick Clifton  <nickc@redhat.com>
9999
10000         * archive.cc: Fix shadowed variable warnings.
10001         * arm.cc: Likewise.
10002         * compressed_output.cc: Likewise.
10003         * compressed_output.h: Likewise.
10004         * configure: Likewise.
10005         * dwarf_reader.cc: Likewise.
10006         * dynobj.cc: Likewise.
10007         * dynobj.h: Likewise.
10008         * ehframe.cc: Likewise.
10009         * ehframe.h: Likewise.
10010         * errors.cc: Likewise.
10011         * expression.cc: Likewise.
10012         * fileread.cc: Likewise.
10013         * fileread.h: Likewise.
10014         * freebsd.h: Likewise.
10015         * i386.cc: Likewise.
10016         * icf.cc: Likewise.
10017         * incremental.h: Likewise.
10018         * layout.cc: Likewise.
10019         * layout.h: Likewise.
10020         * mapfile.cc: Likewise.
10021         * merge.cc: Likewise.
10022         * merge.h: Likewise.
10023         * object.cc: Likewise.
10024         * object.h: Likewise.
10025         * options.h: Likewise.
10026         * output.cc: Likewise.
10027         * output.h: Likewise.
10028         * parameters.cc: Likewise.
10029         * plugin.cc: Likewise.
10030         * powerpc.cc: Likewise.
10031         * reduced_debug_output.cc: Likewise.
10032         * reduced_debug_output.h: Likewise.
10033         * reloc.cc: Likewise.
10034         * reloc.h: Likewise.
10035         * resolve.cc: Likewise.
10036         * script-sections.cc: Likewise.
10037         * script.cc: Likewise.
10038         * script.h: Likewise.
10039         * sparc.cc: Likewise.
10040         * symtab.cc: Likewise.
10041         * symtab.h: Likewise.
10042         * target-select.cc: Likewise.
10043         * target-select.h: Likewise.
10044         * token.h: Likewise.
10045         * workqueue.cc: Likewise.
10046         * workqueue.h: Likewise.
10047         * x86_64.cc: Likewise.
10048
10049 2009-12-10  Doug Kwan  <dougkwan@google.com>
10050
10051         * arm.cc (attributes.h): New include.
10052         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10053         (Arm_relobj::~Arm_relobj): Delete object pointed by
10054         attributes_section_data_.
10055         (Arm_relobj::attributes_section_data): New method definition.
10056         (Arm_relobj::attributes_section_data_): New data member declaration.
10057         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10058         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10059         attributes_section_data_.
10060         (Arm_dynobj::attributes_section_data): New method definition.
10061         (Arm_dynobj::attributes_section_data_): New data member declaration.
10062         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10063         initialization value of may_use_blx_ to false.
10064         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10065         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10066         object attributes to compute results instead of hard-coding.
10067         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10068         Target_arm::get_secondary_compatible_arch,
10069         Target_arm::set_secondary_compatible_arch
10070         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10071         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10072         New method declarations.
10073         (Target_arm::get_aeabi_object_attribute): New method definition.
10074         (Target_arm::attributes_section_data_): New data member declaration.
10075         (read_arm_attributes_section): New template definition.
10076         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10077         (Arm_dynobj::do_read_symbols): Ditto.
10078         (Target_arm::do_finalize_sections): Merge attributes sections from
10079         input.  Check for BLX use after attributes section merging.
10080         Fix __exidx_start and __exidx_end visibility.  Create an
10081         .ARM.attributes section if necessary.
10082         (Target_arm::get_secondary_compatible_arch,
10083         Target_arm::set_secondary_compatible_arch,
10084         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10085         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10086         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10087         New method definitions.
10088
10089 2009-12-09  Ian Lance Taylor  <iant@google.com>
10090
10091         * plugin.cc (Plugin::load): Don't cast from void* to a function
10092         pointer.
10093
10094 2009-12-09  Ian Lance Taylor  <iant@google.com>
10095
10096         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10097         information fields.
10098
10099 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10100
10101         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10102         Replace two_file_shared_1.so with two_file_shared_2.so.
10103         * testsuite/Makefile.in: Regenerated.
10104
10105 2009-12-08  Doug Kwan  <dougkwan@google.com>
10106
10107         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10108         (HFILES): Add attributes.h and int_encoding.h.
10109         * Makefile.in: Regenerate.
10110         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10111         function definitions to int_encoding.cc
10112         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10113         prototypes to int_encoding.h
10114         * reduced_debug_output.cc (int_encoding.h): New include.
10115         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10116         function definitions to int_encoding.cc
10117         (insert_into_vector, read_from_pointer): Move template definitions to
10118         int_encoding.h
10119         * attributes.cc: New file.
10120         * attributes.h: New file.
10121         * int_encoding.cc: New file.
10122         * int_encoding.h: New file.
10123
10124 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10125
10126         PR gold/11055
10127         * incremental-dump.cc (dump_incremental_inputs): New.
10128         (main): Use dump_incremental_inputs.
10129
10130 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10131
10132         PR gold/10893
10133         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10134         checking elfcpp::STT_FUNC.
10135         (Target_i386::Relocate::relocate): Likewise.
10136         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10137
10138         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10139         symbols from shared libraries into normal FUNC symbols.
10140
10141         * symtab.h (Symbol): Add is_func and use it.
10142
10143 2009-12-05  Doug Kwan  <dougkwan@google.com>
10144
10145         * arm.cc (Target_arm::arm_info): Initialize new fields
10146         attributes_section and attributes_vendor.
10147         * i386.cc (Target_i386::i386_info): Same.
10148         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10149         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10150         fields attributes_section and attributes_vendor.
10151         * sparc.cc (Target_sparc::sparc_info): Same.
10152         * target.h (Target::attributes_section, Target::attributes_vendor,
10153         Target::is_attributes_section, Target::attribute_arg_type,
10154         Target::attributes_order): New method definitions.
10155         (Target::Target_info::attributes_section,
10156         Target::Target_info::attributes_vendor): New fields.
10157         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10158         virtual method definitions.
10159         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10160         attributes_section and attributes_vendor.
10161         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10162
10163 2009-12-05  Doug Kwan  <dougkwan@google.com>
10164
10165         * arm.cc: Update comments about interworking and stub generation.
10166         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10167         considered as non-PIC.
10168         (Arm_relocate_functions::base_abs): Fix formatting.
10169         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10170         of function to use GOT entry address instead of offset.
10171         (Target_arm::Scan::global): Issue an error if a symbol would need a
10172         PLT does not get one because it is untyped.  Remove code to create
10173         dynamic symbols for relative branches.
10174         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10175         takes unsigned integer instead of boolean.
10176
10177 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10178
10179         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10180         (two_file_test_LDADD): Likewise.
10181         (common_test_1_LDADD): Likewise.
10182         (exception_test_LDADD) Likewise.
10183         (weak_test_LDADD): Likewise.
10184         (many_sections_test_LDADD): Likewise.
10185         (initpri1_LDADD): Likewise.
10186         (script_test_1_LDADD): Likewise.
10187         (script_test_2_LDADD): Likewise.
10188         (justsyms_LDADD): Likewise.
10189         (binary_test_LDADD): Likewise.
10190         (large_LDADD): Likewise.
10191         * testsuite/Makefile.in: Regenerated.
10192
10193 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10194
10195         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10196         (Symbol_table::override_with_special): Likewise.
10197         (Symbol_table::add_from_object): Likewise.
10198
10199 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10200
10201         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10202         Don't set the data_offset twice.
10203
10204 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10205
10206         * testsuite/Makefile.in: Regenerate.
10207
10208 2009-12-03  Doug Kwan  <dougkwan@google.com>
10209
10210         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10211         (Target_arm::do_finalize_sections): Add parameter for symbol table
10212         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10213         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10214         parameter for symbol table pointer.
10215         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10216         an additional parameter for a pointer to symbol table.
10217         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10218         parameter for a symbol table pointer.
10219         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10220         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10221         Ditto.
10222         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10223         parameter for a symbol table pointer.
10224
10225 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10226
10227         * incremental.cc (Incremental_inputs_header)
10228         (Incremental_inputs_header_write, Incremental_inputs_entry)
10229         (Incremental_inputs_entry_write): Move ...
10230         * incremental.h (Incremental_inputs_header)
10231         (Incremental_inputs_header_write, Incremental_inputs_entry)
10232         (Incremental_inputs_entry_write): here.
10233
10234 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10235
10236         * incremental.cc (make_sized_incremental_binary): Set the target.
10237         Error if it is incompatible.
10238         * output.h (Output_file): Add filename method.
10239
10240 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10241
10242         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10243         from the get_* methods.
10244
10245 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10246
10247         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10248         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10249         Write 0 for the data_offset of scripts.
10250
10251 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10252
10253         * testsuite/Makefile.am: Add the incremental_test.sh test.
10254         * testsuite/incremental_test.sh: New.
10255         * testsuite/incremental_test_1.c: New.
10256         * testsuite/incremental_test_2.c: New.
10257
10258 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10259
10260         * incremental-dump.cc (main): Fix typos.
10261
10262 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10263
10264         PR gold/11025
10265         * incremental-dump.cc (main): Use llu to print 64 bit values.
10266
10267 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10268             H.J. Lu  <hongjiu.lu@intel.com>
10269
10270         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10271         $(LIBDL).
10272         (incremental_dump_LDADD): Likewise.
10273         * Makefile.in: Regenerated.
10274
10275 2009-11-25  Doug Kwan  <dougkwan@google.com>
10276
10277         Revert:
10278
10279         2009-11-25  Doug Kwan  <dougkwan@google.com>
10280
10281                 * arm.cc (Target_arm::Target_arm): Move method definition
10282                 outside of class definition.  Add code to handle
10283                 --target1-rel, --target1-abs and --target2= options.
10284                 (Target_arm::get_reloc_reloc_type): Change method to be
10285                 non-static and const.
10286                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10287                 New data member declaration.
10288                 (Target_arm::Scan::local, Target_arm::Scan::global,
10289                 Target_arm::Relocate::relocate,
10290                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10291                 Adjust call to Target_arm::get_real_reloc_type.
10292                 (Target_arm::get_real_reloc_type): Use command line options
10293                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10294                 * options.h (--target1-rel, --target1-abs, --target2): New
10295                 ARM-only options.
10296
10297 2009-11-25  Doug Kwan  <dougkwan@google.com>
10298
10299         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10300         class definition.  Add code to handle --target1-rel, --target1-abs
10301         and --target2= options.
10302         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10303         and const.
10304         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10305         member declaration.
10306         (Target_arm::Scan::local, Target_arm::Scan::global,
10307         Target_arm::Relocate::relocate,
10308         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10309         call to Target_arm::get_real_reloc_type.
10310         (Target_arm::get_real_reloc_type): Use command line options to
10311         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10312         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10313         options.
10314
10315 2009-11-25  Doug Kwan  <dougkwan@google.com>
10316
10317         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10318         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10319         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10320         formatting.
10321         (Arm_relocate_functions::thm_call): Replace body with a call to
10322         Arm_relocate_functions::thumb_branch_common.
10323         (Arm_relocate_functions::thm_jump24,
10324         Arm_relocate_functions::thm_xpc22): New method definitions.
10325         (Arm_relocate_functions::thumb_branch_common): New method definition.
10326         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10327         operator.
10328         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10329         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10330
10331 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10332
10333         * Makefile.am: Build incremental-dump
10334         * Makefile.in: Regenerate.
10335         * incremental-dump.cc: New.
10336         * incremental.cc (Incremental_inputs_header_data,
10337         Incremental_inputs_entry_data): Move to incremental.h
10338         * incremental.h: (Incremental_inputs_header_data,
10339         Incremental_inputs_entry_data): Move from incremental.cc
10340
10341 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10342
10343         * incremental.cc (Incremental_inputs_header,
10344         Incremental_inputs_header_write, Incremental_inputs_entry,
10345         Incremental_inputs_entry_write): Add a typedef with the data type.
10346
10347 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10348
10349         * incremental.cc (Incremental_inputs_header,
10350         Incremental_inputs_header_write, Incremental_inputs_entry,
10351         Incremental_inputs_entry_write): Update comment about which
10352         type has the filed descriptions.
10353
10354 2009-11-15  Doug Kwan  <dougkwan@google.com>
10355
10356         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10357         (Arm_relocate_functions::arm_branch_common): Change method defintion
10358         in class definition to a method declaration and update list of formal
10359         parameters.
10360         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10361         Arm_relocation_functions::jump24): Adjust call to
10362         Arm_relocate_functions::arm_branch_common.  Update list of formal
10363         parameters.
10364         (Arm_relocate_functions::xpc25): New method definition.
10365         (Arm_relocate_functions::arm_branch_common): Move method defintion
10366         out from class definition.  Use stubs for mode-switching and extending
10367         branch ranges.
10368         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10369         specially.  Change code to enable use of stubs in ARM branches.
10370
10371 2009-11-10  Doug Kwan  <dougkwan@google.com>
10372
10373         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10374         in method declaration.
10375         (Target_arm::relocate_stub): New method declaration.
10376         (Target_arm::default_target): Change to return a pointer instead of
10377         a const reference.
10378         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10379         Target_arm::default_target.
10380         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10381         method definition.
10382         (Target_arm::relocate_section): Adjust view.
10383         (Target_arm::relocate_stub): New method definition.
10384
10385 2009-11-10  Doug Kwan  <dougkwan@google.com>
10386
10387         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10388         a format warning.
10389         * incremental.cc (open_incremental_binary): Initialized local
10390         variables to avoid warnings.
10391         * object.cc (make_elf_object): Ditto.
10392         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10393         a format warning.
10394
10395 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10396
10397         PR gold/10930
10398         * testsuite/plugin_test.c: Include "config.h".
10399
10400 2009-11-09  Doug Kwan  <dougkwan@google.com>
10401
10402         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10403         (arm_symbol_value): Remove.
10404         (Arm_relocate_functions::arm_branch_common,
10405         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10406         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10407         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10408         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10409         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10410         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10411         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10412         Arm_relocate_functions::thm_mobw_abs_nc,
10413         Arm_relocate_functions::thm_mov_abs,
10414         Arm_relocate_functions::movw_prel_nc,
10415         Arm_relocate_functions::thm_movt_abs,
10416         Arm_relocate_functions::movt_prel,
10417         Arm_relocate_functions::thm_movw_prel_nc,
10418         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10419         (Target_arm::Relocate::relocate): Only decompose address into two
10420         parts if relocation type uses the thumb-bit and pass the actual
10421         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10422         calls to methods in Arm_relocate_functions for this change.
10423
10424 2009-11-08  Ian Lance Taylor  <iant@google.com>
10425
10426         PR 10925
10427         * reloc.cc: Instantiate
10428         Sized_relobj::initialize_input_to_output_maps and
10429         Sized_relobj:free_input_to_output_maps.
10430
10431 2009-11-06  Ian Lance Taylor  <iant@google.com>
10432
10433         PR 10876
10434         * defstd.cc (in_segment): Set only_if_ref true for "end".
10435
10436 2009-11-06  Doug Kwan  <dougkwan@google.com>
10437
10438         * arm.cc (class Reloc_stub): Correct a comment.
10439         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10440         (Target_arm::scan_section_for_stubs): New method declaration.
10441         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10442         Change methods from private to protected.
10443         (Target_arm::do_may_relax): New method definition.
10444         (Target_arm::do_relax, Target_arm::group_sections,
10445         Target_arm::scan_reloc_for_stub,
10446         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10447         (Target_arm::arm_input_section_map_): New data member declaration.
10448         (Target_arm::scan_reloc_for_stub,
10449         Target_arm::scan_reloc_section_for_stubs,
10450         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10451         Target_arm::do_relax): New method definitions.
10452
10453 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10454
10455         * configure.ac: Check for (struct stat)::st_mtim
10456         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10457         * config.in: Regenerate.
10458         * configure: Regenerate.
10459
10460 2009-11-05  Ian Lance Taylor  <iant@google.com>
10461
10462         PR 10910
10463         * output.cc (Output_segment::add_output_section): Add missing
10464         return statement.
10465
10466 2009-11-04  Ian Lance Taylor  <iant@google.com>
10467
10468         PR 10880
10469         * object.h (class Object): Add is_needed and set_is_needed
10470         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10471         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10472         defined in a dynamic object and referenced by a regular object,
10473         set is_needed for the dynamic object.
10474         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10475         if the file is marked with as_needed and it is not needed.
10476
10477 2009-11-04  Ian Lance Taylor  <iant@google.com>
10478
10479         PR 10887
10480         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10481         tags if data is discarded by linker script.
10482         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10483         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10484         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10485         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10486
10487 2009-11-04  Ian Lance Taylor  <iant@google.com>
10488
10489         * layout.cc (Layout::get_output_section): Add is_interp and
10490         is_dynamic_linker_section parameters.  Change all callers.
10491         (Layout::choose_output_section): Likewise.
10492         (Layout::make_output_section): Likewise.
10493         (Layout::add_output_section_data): Add is_dynamic_linker_section
10494         parameter.  Change all callers.
10495         * layout.h (class Layout): Update declarations.
10496         * output.h (class Output_section): Add is_interp, set_is_interp,
10497         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10498         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10499         generate_code_fills_at_write_ to a bitfield.
10500         * output.cc (Output_section::Output_sections): Initialize new
10501         fields.
10502         (Output_segment::add_output_section): Add do_sort parameter.
10503         Change all callers.
10504
10505 2009-11-03  Ian Lance Taylor  <iant@google.com>
10506
10507         PR 10860
10508         * options.h (class General_options): Add --warn-common.
10509         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10510         merging two common symbols.
10511         (Symbol_table::should_override): Handle --warn-common when merging
10512         a common symbol with a defined symbol.  Use report_resolve_problem
10513         for multiple definitions.
10514         (Symbol_table::report_resolve_problem): New function.
10515         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10516
10517 2009-11-03  Doug Kwan  <dougkwan@google.com>
10518
10519         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10520         stub_factory_.
10521         (Target_arm::stub_factory): New method definition.
10522         (Target_arm::new_arm_input_section,
10523         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10524         Target_arm::reloc_uses_thumb_bit): New method declarations.
10525         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10526         New type definitions.
10527         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10528         member declarations.
10529         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10530         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10531         New method definitions.
10532
10533 2009-11-03  Ian Lance Taylor  <iant@google.com>
10534
10535         * options.h (class General_options): Add --warn_constructors.
10536
10537 2009-11-03  Ian Lance Taylor  <iant@google.com>
10538
10539         PR 10893
10540         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10541         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10542
10543 2009-11-03  Ian Lance Taylor  <iant@google.com>
10544
10545         PR 10895
10546         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10547         --msgid-bugs-address.
10548         (install-pdf): New target.
10549         (install-data_yes): Look up one directory to find mkinstalldirs.
10550
10551 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10552
10553         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10554         tree.
10555
10556 2009-10-30  Doug Kwan  <dougkwan@google.com>
10557
10558         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10559
10560 2009-10-30  Doug Kwan  <dougkwan@google.com>
10561
10562         * arm.cc (Stub_addend_reader): New struct template definition
10563         and partial specializations.
10564         (Stub_addend_reader::operator()): New method definition for a
10565         partially specialized template.
10566
10567 2009-10-30  Doug Kwan  <dougkwan@google.com>
10568
10569         * arm.cc (Arm_relobj::processor_specific_flags): New method
10570         definition.
10571         (Arm_relobj::do_read_symbols): New method declaration.
10572         (Arm_relobj::processor_specific_flags_): New data member declaration.
10573         (Arm_dynobj): New class definition.
10574         (Target_arm::do_finalize_sections): Add input_objects parameter.
10575         (Target_arm::do_adjust_elf_header): New method declaration.
10576         (Target_arm::are_eabi_versions_compatible,
10577         (Target_arm::merge_processor_specific_flags): New method declaration.
10578         (Target_arm::do_make_elf_object): New overloaded method definitions
10579         and declaration.
10580         (Arm_relobj::do_read_symbols): New method definition.
10581         (Arm_dynobj::do_read_symbols): Ditto.
10582         (Target_arm::do_finalize_sections): Add input_objects parameters.
10583         Merge processor-specific flags from all input objects.
10584         (Target_arm::are_eabi_versions_compatible,
10585         Target_arm::merge_processor_specific_flags,
10586         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10587         New method definitions.
10588         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10589         Input_objects pointer type parameter.
10590         * layout.cc (Layout::finalize): Pass input objects to target's.
10591         finalize_sections function.
10592         * output.cc (Output_file_header::do_sized_write): Set ELF file
10593         header's processor-specific flags.
10594         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10595         Input_objects pointer type parameter.
10596         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10597         * target.h (Input_objects): New forward class declaration.
10598         (Target::processor_specific_flags,
10599         Target::are_processor_specific_flags_sect): New method definitions.
10600         (Target::finalize_sections): Add input_objects parameter.
10601         (Target::Target): Initialize processor_specific_flags_ and
10602         are_processor_specific_flags_set_.
10603         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10604         parameter.
10605         (Target::set_processor_specific_flags): New method definition.
10606         (Target::processor_specific_flags_,
10607         Target::are_processor_specific_flags_set_): New data member
10608         declarations.
10609         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10610         Input_objects pointer type parameter.
10611
10612 2009-10-30  Doug Kwan  <dougkwan@google.com>
10613
10614         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10615
10616 2009-10-28  Ian Lance Taylor  <iant@google.com>
10617
10618         * object.h (class Relobj): Drop options parameter from
10619         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10620         do_scan_relocs, do_relocate.  Change all callers.
10621         (class Sized_relobj): Drop options parameters from
10622         do_gc_process_relocs, do_scan_relocs, do_relocate,
10623         do_relocate_sections, relocate_sections, emit_relocs_scan,
10624         emit_relocs_scan_reltype.  Change all callers.
10625         (struct Relocate_info): Remove options field and all references to
10626         it.
10627         * reloc.h (class Read_relocs): Remove options constructor
10628         parameter and options_ field.  Change all callers.
10629         (class Gc_process_relocs, class Scan_relocs): Likewise.
10630         (class Relocate_task): Likewise.
10631         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10632         all callers.
10633         (scan_relocatable_relocs): Likewise.
10634         * target.h (class Sized_target): Remove options parameter from
10635         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10636         all callers.
10637         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10638         callers.
10639         * arm.cc: Update functions to remove options parameters.
10640         * i386.cc: Likewise.
10641         * powerpc.cc: Likewise.
10642         * sparc.cc: Likewise.
10643         * x86_64.cc: Likewise.
10644         * testsuite/testfile.cc: Likewise.
10645
10646 2009-10-28  Doug Kwan  <dougkwan@google.com>
10647
10648         * arm.cc (Arm_relobj): New class definition.
10649         (Arm_relobj::scan_sections_for_stubs,
10650         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10651         New method definitions.
10652
10653 2009-10-28  Cary Coutant  <ccoutant@google.com>
10654
10655         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10656         (Plugin::cleanup_done_): New member.
10657         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10658         (Plugin_manager::cleanup_done_): Remove.
10659         (Plugin_manager::add_input_file): Edit error message.
10660         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10661         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10662
10663 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10664
10665         * fileread.cc: (File_read::View::~View): Use the new
10666         data_ownership_ filed.
10667         (File_read::~File_read): Dispose the new whole_file_view_.
10668         (File_read::open): Mmap the whole file if needed.
10669         (File_read::open): Use whole_file_view_ instead of contents_.
10670         (File_read::find_view): Use whole_file_view_ if applicable.
10671         (File_read::do_read): Use whole_file_view_ instead of contents_.
10672         (File_read::make_view): Use whole_file_view_ instead of contents_,
10673         update File_read::View::View call.
10674         (File_read::find_or_make_view): Update File_read::View::View
10675         call.
10676         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10677         remove contents_
10678         (File_read::View::Data_ownership): New enum.
10679         (File_read::View::View): Replace bool mapped_ with Data_ownership
10680         argument.
10681         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10682         (File_read::View::data_ownership_): New field.
10683         (File_read::contents_): Remove (replaced by whole_file_view_).
10684         (File_read::whole_file_view_): New field.
10685         * options.h (class General_options): Add --keep-files-mapped.
10686
10687 2009-10-27  Cary Coutant  <ccoutant@google.com>
10688
10689         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10690         * testsuite/Makefile.am (plugin_test_5): New test case.
10691         * testsuite/Makefile.in: Regenerate.
10692
10693 2009-10-25  Doug Kwan  <dougkwan@google.com>
10694
10695         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10696         from private to protected to allow access by child class.
10697         (Sized_relobj::do_relocate_sections): New method declaration.
10698         (Sized_relobj::relocate_sections): Virtualize.
10699         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10700         Sized_relobj::relocate_sections.  Instantiate template explicitly
10701         for different target sizes and endianity.
10702
10703 2009-10-24  Doug Kwan  <dougkwan@google.com>
10704
10705         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10706         (Arm_input_section::as_arm_input_section): New method.
10707         (Arm_output_section): New class definition.
10708         (Arm_output_section::create_stub_group,
10709         Arm_output_section::group_sections): New method definitions.
10710
10711 2009-10-22  Doug Kwan  <dougkwan@google.com>
10712
10713         * arm.cc (Arm_input_section): New class definition.
10714         (Arm_input_section::init, Arm_input_section:do_write,
10715         Arm_input_section::set_final_data_size,
10716         Arm_input_section::do_reset_address_and_file_offset): New method
10717         definitions.
10718
10719 2009-10-21  Doug Kwan  <dougkwan@google.com>
10720
10721         * arm.cc (Stub_table, Arm_input_section): New forward class
10722         declarations.
10723         (Stub_table): New class defintion.
10724         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10725         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10726         New method definition.
10727
10728 2009-10-21  Doug Kwan  <dougkwan@google.com>
10729
10730         * arm.cc: Update copyright comments.
10731         (Target_arm): New forward class template declaration.
10732         (Arm_address): New type.
10733         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10734         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10735         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10736         constants.
10737         (Insn_template): Same.
10738         (DEF_STUBS): New macro.
10739         (Stub_type): New enum type.
10740         (Stub_template): New class definition.
10741         (Stub): Same.
10742         (Reloc_stub): Same.
10743         (Stub_factory): Same.
10744         (Target_arm::Target_arm): Initialize may_use_blx_ and
10745         should_force_pic_veneer_.
10746         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10747         Target_arm::should_force_pic_veneer,
10748         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10749         Target_arm::using_thumb_only, Target_arm:;default_target): New
10750         method defintions.
10751         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10752         New data member declarations.
10753         (Insn_template::size, Insn_template::alignment): New method defintions.
10754         (Stub_template::Stub_template): New method definition.
10755         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10756         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10757         (Stub_factory::Stub_factory): New method definition.
10758         * gold.h (string_hash): New template.
10759         * output.h (Input_section_specifier::hash_value): Use
10760         gold::string_hash.
10761         (Input_section_specifier::string_hash): Remove.
10762         * stringpool.cc (Stringpool_template::string_hash): Use
10763         gold::string_hash.
10764
10765 2009-10-20  Doug Kwan  <dougkwan@google.com>
10766
10767         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10768         symbols of relaxed input sections.
10769         * output.h (Output_section::find_relaxed_input_section): Make
10770         method public.
10771
10772 2009-10-16  Doug Kwan  <dougkwan@google.com>
10773
10774         * dynobj.cc (Versions::Versions): Initialize version_script_.
10775         Only insert base version symbol definition for a shared object
10776         if version script defines any version versions.
10777         (Versions::define_base_version): New method definition.
10778         (Versions::add_def): Check that base version is not needed.
10779         (Versions::add_need): Define base version lazily.
10780         * dynobj.h (Versions::define_base_version): New method declaration.
10781         (Versions::needs_base_version_): New data member declaration.
10782         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10783         (check_DATA): Add no_version_test.stdout.
10784         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10785         New make rules.
10786         * testsuite/Makefile.in: Regenerate.
10787         * testsuite/no_version_test.c: New file.
10788         * testsuite/no_version_test.sh: Ditto.
10789
10790 2009-10-16  Doug Kwan  <dougkwan@google.com>
10791
10792         * expression.cc (class Segment_start_expression): New class definition.
10793         (Segment_start_expression::value): New method definition.
10794         (script_exp_function_segment_start): Return a new
10795         Segment_start_expression.
10796         * gold/script-c.h (script_saw_segment_start_expression): New function
10797         prototype.
10798         * script-sections.cc (Script_sections::Script_sections): Initialize
10799         SAW_SEGMENT_START_EXPRESSION_ to false.
10800         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10801         and -Tbbs options to specify section addresses if given in
10802         command line and no SEGMENT_START expression is seen in a script.
10803         * script-sections.h (Script_sections::saw_segment_start_expression,
10804         Script_sections::set_saw_segment_start_expression): New method
10805         definition.
10806         (Script_sections::saw_segment_start_expression_): New data member
10807         declaration.
10808         * script.cc (script_saw_segment_start_expression): New function.
10809         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10810         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10811         script_test_7.sh and script_test_8.sh.
10812         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10813         script_test_8.stdout.
10814         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10815         (script_test_6, script_test_6.stdout, script_test_7,
10816         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10817         * Makefile.in: Regenerate.
10818         * testsuite/script_test_6.sh: New file.
10819         * testsuite/script_test_6.t: Same.
10820         * testsuite/script_test_7.sh: Same.
10821         * testsuite/script_test_7.t: Same.
10822         * testsuite/script_test_8.sh: Same.
10823
10824 2009-10-16  Doug Kwan  <dougkwan@google.com>
10825
10826         * output.cc (Output_segment::set_section_list_address): Cast
10827         expressions to unsigned long long type to avoid format warnings.
10828
10829 2009-10-15  Ian Lance Taylor  <iant@google.com>
10830
10831         * script.cc (Script_options::add_symbol_assignment): Always add a
10832         dot assignment to script_sections_.
10833         * script-sections.cc (Script_sections::add_dot_assignment):
10834         Initialize if necessary.
10835
10836         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10837         program headers with no load segment if there is a linker script.
10838
10839         * layout.cc (Layout::set_segment_offsets): Align the file offset
10840         to the segment aligment for -N or -n with no load segment.
10841         * output.cc (Output_segment::add_output_section): Don't crash if
10842         the first section is a TLS section.
10843         (Output_segment::set_section_list_addresses): Print an error
10844         message if the address moves backward in a linker script.
10845         * script-sections.cc
10846         (Output_section_element_input::set_section_addresses): Don't
10847         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10848         (Orphan_output_section::set_section_addresses): Likewise.
10849
10850 2009-10-15  Doug Kwan  <dougkwan@google.com>
10851
10852         * layout.cc (Layout::finish_dynamic_section): Generate tags
10853         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10854         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10855         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10856
10857 2009-10-14  Ian Lance Taylor  <iant@google.com>
10858
10859         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10860         fields.
10861         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10862         data_shdr fields of relinfo.
10863         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10864         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10865         R_386_TLS_LDO_32, adjust based on section flags.
10866         (Target_i386::Relocate::fix_up_ldo): Remove.
10867
10868 2009-10-13  Ian Lance Taylor  <iant@google.com>
10869
10870         Add support for -pie.
10871         * options.h (class General_options): Add -pie and
10872         --pic-executable.
10873         (General_options::output_is_position_independent): Test -pie.
10874         (General_options::output_is_executable): Return true if not shared
10875         and not relocatable.
10876         (General_options::output_is_pie): Remove.
10877         * options.cc (General_options::finalize): Reject incompatible uses
10878         of -pie.
10879         * gold.cc (queue_middle_tasks): A -pie link is not static.
10880         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10881         * symtab.cc (Symbol::final_value_is_known): Return false if
10882         output_is_position_independent.
10883         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10884         output_is_position_independent.
10885         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10886         output_is_position_independent.
10887         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10888         output_is_position_independent.
10889         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10890         two_file_pie_test.
10891         (basic_pie_test.o, basic_pie_test): New targets.
10892         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10893         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10894         (two_file_pie_test): New target.
10895         * testsuite/Makefile.in: Rebuild.
10896         * README: Remove note saying that -pie is not supported.
10897
10898 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10899
10900         * options.h (class General_options): Add -init and -fini.
10901         * layout.cc (Layout::finish_dynamic_section): Emit
10902         given init and fini functions.
10903
10904 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10905
10906         * gc.h (gc_process_relocs): Check if icf is enabled using new
10907         function.
10908         * gold.cc (queue_initial_tasks): Likewise.
10909         (queue_middle_tasks): Likewise.
10910         * object.cc (do_layout): Likewise.
10911         * symtab.cc (is_section_folded): Likewise.
10912         * main.cc (main): Likewise.
10913         * reloc.cc (Read_relocs::run): Likewise.
10914         (Sized_relobj::do_scan_relocs): Likewise.
10915         * icf.cc (is_function_ctor_or_dtor): New function.
10916         (Icf::find_identical_sections): Check if function is ctor or dtor when
10917         safe icf is chosen.
10918         * options.h (General_options::icf): Change option to be an enum.
10919         (Icf_status): New enum.
10920         (icf_enabled): New method.
10921         (icf_safe_folding): New method.
10922         (set_icf_status): New method.
10923         (icf_status_): New variable.
10924         * (options.cc) (General_options::finalize): Set icf_status_.
10925         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10926         icf_test and icf_keep_unique_test to use the --icf enum flag.
10927         * testsuite/icf_safe_test.sh: New file.
10928         * testsuite/icf_safe_test.cc: New file.
10929
10930 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10931
10932         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10933         includes to gc.h and icf.h.
10934         * arm.cc: Include gc.h.
10935         * gold.cc: Likewise.
10936         * i386.cc: Likewise.
10937         * powerpc.cc: Likewise.
10938         * sparc.cc: Likewise.
10939         * x86_64.cc: Likewise.
10940         * gc.h: Include icf.h.
10941
10942 2009-10-11  Ian Lance Taylor  <iant@google.com>
10943
10944         * plugin.cc: Include "gold.h" before other header files.
10945
10946 2009-10-10  Chris Demetriou  <cgd@google.com>
10947
10948         * options.h (Input_file_argument::Input_file_type): New enum.
10949         (Input_file_argument::is_lib_): Replace with...
10950         (Input_file_argument::type_): New member.
10951         (Input_file_argument::Input_file_argument): Take Input_file_type
10952         'type' rather than boolean 'is_lib' as second argument.
10953         (Input_file_argument::is_lib): Use type_.
10954         (Input_file_argument::is_searched_file): New function.
10955         (Input_file_argument::may_need_search): Handle is_searched_file.
10956         * options.cc (General_options::parse_library): Support -l:filename.
10957         (General_options::parse_just_symbols): Update for Input_file_argument
10958         changes.
10959         (Command_line::process): Likewise.
10960         * archive.cc (Archive::get_file_and_offset): Likewise.
10961         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10962         * script.cc (read_script_file, script_add_file): Likewise.
10963         * fileread.cc (Input_file::Input_file): Likewise.
10964         (Input_file::will_search_for): Handle is_searched_file.
10965         (Input_file::open): Likewise.
10966         * readsyms.cc (Read_symbols::get_name): Likewise.
10967         * testsuite/Makefile.am (searched_file_test): New test.
10968         * testsuite/Makefile.in: Regenerate.
10969         * testsuite/searched_file_test.cc: New file.
10970         * testsuite/searched_file_test_lib.cc: New file.
10971
10972 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10973             Ian Lance Taylor  <iant@google.com>
10974
10975         * descriptor.cc: Include <cstdio> and "binary-io.h".
10976         (Descriptors::open): Open the files in binary mode always.
10977         * script.cc (Lex::get_token): Treat \r as whitespace.
10978
10979 2009-10-09  Ian Lance Taylor  <iant@google.com>
10980
10981         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10982
10983 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10984             Ian Lance Taylor  <iant@google.com>
10985
10986         * configure.ac: Check for readv function also.
10987         * fileread.cc (readv): Define if not HAVE_READV.
10988         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10989         does not exist.
10990         * config.in: Regenerate.
10991         * configure: Regenerate.
10992
10993 2009-10-09  Doug Kwan  <dougkwan@google.com>
10994
10995         * layout.cc (Layout::make_output_section): Call target hook to make
10996         ordinary output section.
10997         (Layout::finalize): Adjust parameter list of call the
10998         Target::may_relax().
10999         * layout.h (class Layout::section_list): New method.
11000         * merge.h (Output_merge_base::entsize): Change visibility to public.
11001         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11002         New methods.
11003         (Output_merge_string::do_is_string): New method.
11004         * object.cc (Sized_relobj::do_setup): renamed from
11005         Sized_relobj::set_up.
11006         * object.h (Sized_relobj::adjust_shndx,
11007         Sized_relobj::initializ_input_to_output_maps,
11008         Sized_relobj::free_input_to_output_maps): Change visibilities to
11009         protected.
11010         (Sized_relobj::setup): Virtualize.
11011         (Sized_relobj::do_setup): New method declaration.
11012         (Sized_relobj::invalidate_section_offset,
11013         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11014         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11015         * options.cc (parse_int): New function.
11016         * options.h (parse_int): New declaration.
11017         (DEFINE_int): New macro.
11018         (stub_group_size): New option.
11019         * output.cc (Output_section::Output_section): Initialize memebers
11020         merge_section_map_, merge_section_by_properties_map_,
11021         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11022         (Output_section::add_input_section): Handled deferred code-fill
11023         generation and remove an old comment.
11024         (Output_section::add_relaxed_input_section): New method definition.
11025         (Output_section::add_merge_input_section): Use merge section by
11026         properties map to speed to search.  Update merge section maps
11027         as appropriate.
11028         (Output_section::build_relaxation_map): New method definition.
11029         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11030         Same.
11031         (Output_section::relax_input_section): Renamed to
11032         Output_section::convert_input_sections_to_relaxed_sections and change
11033         interface to take a vector of pointers to relaxed sections.
11034         (Output_section::find_merge_section,
11035         Output_section::find_relaxed_input_section): New method definitions.
11036         (Output_section::is_input_address_mapped,
11037         Output_section::output_offset, Output_section::output_address):
11038         Use output section data maps to speed up searching.
11039         (Output_section::find_starting_output_address): Add comments.
11040         (Output_section::do_write,
11041         Output_section::write_to_postprocessing_buffer): Do code-fill
11042         generation as appropriate.
11043         (Output_section::get_input_sections): Invalidate relaxed input section
11044         map.
11045         (Output_section::restore_states): Adjust type of checkpoint .
11046         Invalidate relaxed input section map.
11047         * output.h (Output_merge_base): New class declaration.
11048         (Input_section_specifier): New class defintion.
11049         (class Output_relaxed_input_section) Change base class to
11050         Output_section_data_build.
11051         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11052         base class initializer.
11053         (Output_section::add_relaxed_input_section): New method declaration.
11054         (Output_section::Input_section): Change visibility to protected.
11055         (Output_section::Input_section::relobj,
11056         Output_section::Input_section::shndx): Handle relaxed input sections.
11057         Output_section::input_sections) Change visibility to protected.  Also
11058         define overload to return a non-const pointer.
11059         (Output_section::Merge_section_properties): New class defintion.
11060         (Output_section::Merge_section_by_properties_map,
11061         Output_section::Output_section_data_by_input_section_map,
11062         Output_section::Relaxation_map): New types.
11063         (Output_section::relax_input_section): Rename method to
11064         Output_section::convert_input_sections_to_relaxed_sections and change
11065         interface to take a vector of relaxed section pointers.
11066         (Output_section::find_merge_section,
11067         Output_section::find_relaxed_input_section,
11068         Output_section::build_relaxation_map,
11069         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11070         New method declarations.
11071         (Output_section::merge_section_map_
11072         Output_section::merge_section_by_properties_map_,
11073         Output_section::relaxed_input_section_map_,
11074         Output_section::is_relaxed_input_section_map_valid_,
11075         Output_section::generate_code_fills_at_write_): New data members.
11076         * script-sections.cc
11077         (Output_section_element_input::set_section_addresses): Call
11078         current_data_size and addralign methods of relaxed input sections.
11079         (Orphan_output_section::set_section_addresses): Call current_data_size
11080         and addralign methods of relaxed input sections.
11081         * symtab.cc (Symbol_table::compute_final_value): Extract template
11082         from the body of Symbol_table::sized_finalize_symbol.
11083         (Symbol_table::sized_finalized_symbol): Call
11084         Symbol_table::compute_final_value.
11085         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11086         (Symbol_table::compute_final_value): New templated method declaration.
11087         * target.cc (Target::do_make_output_section): New method defintion.
11088         * target.h (Target::make_output_section): New method declaration.
11089         (Target::relax): Add more parameters for input objects, symbol table
11090         and layout.  Adjust call to do_relax.
11091         (Target::do_make_output_section): New method declaration.
11092         (Target::do_relax): Add parameters for input objects, symbol table
11093         and layout.
11094
11095 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11096
11097         * pread.c: Include stdio.h.
11098
11099 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11100
11101         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11102         defined.
11103
11104 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11105
11106         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11107         Change read_shndx type to unsigned int.
11108         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11109         int.
11110         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11111         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11112         Change read_shndx type to unsigned int.
11113         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11114         int.
11115         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11116         * layout.cc (Layout::create_symtab_sections): Cast the result of
11117         local_symcount * symsize to off_t in the gold_assert.
11118
11119 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11120
11121         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11122         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11123         R_ARM_BASE_ABS.
11124         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11125         (Arm_relocate_functions::thm_abs5): New function.
11126         (Arm_relocate_functions::abs12): New function.
11127         (Arm_relocate_functions::abs16): New function.
11128         (Arm_relocate_functions::base_abs): New function.
11129         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11130         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11131         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11132         R_ARM_BASE_ABS.
11133         (Scan::global): Likewise.
11134         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11135         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11136         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11137         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11138         R_ARM_BASE_ABS.
11139
11140 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11141
11142         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11143         (Arm_relocate_functions::movt_prel): New function.
11144         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11145         (Arm_relocate_functions::thm_movt_prel): New function.
11146         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11147         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11148         (Scan::global, Relocate::relocate): Likewise.
11149         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11150
11151 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11152
11153         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11154         Incremental_checker.
11155         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11156         unsigned int.
11157         (class Incremental_inputs_header): New class.
11158         (Incremental_inputs_header_writer): Edit comment.
11159         (Incremental_inputs_entry): New class.
11160         (Incremental_inputs_entry_writer): Edit comment.
11161         (Sized_incremental_binary::do_find_incremental_inputs_section):
11162         Add *strtab_shndx parameter, fill it.
11163         (Sized_incremental_binary::do_check_inputs): New method.
11164         (Incremental_checker::can_incrementally_link_output_file): Use
11165         Sized_incremental_binary::check_inputs.
11166         (Incremental_inputs::report_command_line): Save command line in
11167         command_line_.
11168         * incremental.h:
11169         (Incremental_binary::find_incremental_inputs_section): New
11170         method.
11171         (Incremental_binary::do_find_incremental_inputs_section): Add
11172         strtab_shndx parameter.
11173         (Incremental_binary::do_check_inputs): New pure virtual method.
11174         (Sized_incremental_binary::do_check_inputs): Declare.
11175         (Incremental_checker::Incremental_checker): Add incremental_inputs
11176         parameter, use it to initialize incremental_inputs_.
11177         (Incremental_checker::incremental_inputs_): New field.
11178         (Incremental_checker::command_line): New method.
11179         (Incremental_checker::inputs): New method.
11180         (Incremental_checker::command_line_): New field.
11181
11182 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11183
11184         * incremental.cc: Include <cstdarg> and "target-select.h".
11185         (vexplain_no_incremental): New function.
11186         (explain_no_incremental): New function.
11187         (Incremental_binary::error): New method.
11188         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11189         method.
11190         (make_sized_incremental_binary): New function.
11191         (open_incremental_binary): New function.
11192         (can_incrementally_link_file): Add checks if output is ELF and has
11193         inputs section.
11194         * incremental.h: Include "elfcpp_file.h" and "output.h".
11195         (Incremental_binary): New class.
11196         (Sized_incremental_binary): New class.
11197         (open_incremental_binary): Declare.
11198         * object.cc (is_elf_object): Use
11199         elfcpp::Elf_recognizer::is_elf_file.
11200         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11201         * output.h (Output_file::filesize): New method.
11202
11203 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11204
11205         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11206         New function.
11207         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11208         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11209         function.
11210         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11211         function.
11212         (Arm_relocate_functions::movw_abs_nc): New function.
11213         (Arm_relocate_functions::movt_abs): New function.
11214         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11215         (Arm_relocate_functions::thm_movt_abs): New function.
11216         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11217         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11218         (Scan::global): Likewise.
11219         (Relocate::relocate): Likewise.
11220         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11221
11222 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11223
11224         * arm.cc (Arm_relocate_functions::got_prel) New function.
11225         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11226         (Relocate::relocate): Likewise.
11227         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11228
11229 2009-10-06  Ian Lance Taylor  <iant@google.com>
11230
11231         * options.h (class General_options): Define
11232         split_stack_adjust_size parameter.
11233         * object.h (class Object): Add uses_split_stack_ and
11234         has_no_split_stack_ fields.  Add uses_split_stack and
11235         has_no_split_stack accessor functions.  Declare
11236         handle_split_stack_section.
11237         (class Reloc_symbol_changes): Define.
11238         (class Sized_relobj): Define Function_offsets.  Declare
11239         split_stack_adjust, split_stack_adjust_reltype, and
11240         find_functions.
11241         * object.cc (Object::handle_split_stack_section): New function.
11242         (Sized_relobj::do_layout): Call handle_split_stack_section.
11243         * dynobj.cc (Sized_dynobj::do_layout): Call
11244         handle_split_stack_section.
11245         * reloc.cc (Sized_relobj::relocate_sections): Call
11246         split_stack_adjust for executable sections in split_stack
11247         objects.  Pass reloc_map to relocate_section.
11248         (Sized_relobj::split_stack_adjust): New function.
11249         (Sized_relobj::split_stack_adjust_reltype): New function.
11250         (Sized_relobj::find_functions): New function.
11251         * target-reloc.h: Include "object.h".
11252         (relocate_section): Add reloc_symbol_changes parameter.  Change
11253         all callers.
11254         * target.h (class Target): Add calls_non_split method.  Declare
11255         do_calls_non_split virtual method.  Declare match_view and
11256         set_view_to_nop.
11257         * target.cc: Include "elfcpp.h".
11258         (Target::do_calls_non_split): New function.
11259         (Target::match_view): New function.
11260         (Target::set_view_to_nop): New function.
11261         * gold.cc (queue_middle_tasks): Give an error if mixing
11262         split-stack and non-split-stack objects with -r.
11263         * i386.cc (Target_i386::relocate_section): Add
11264         reloc_symbol_changes parameter.
11265         (Target_i386::do_calls_non_split): New function.
11266         * x86_64.cc (Target_x86_64::relocate_section): Add
11267         reloc_symbol_changes parameter.
11268         (Target_x86_64::do_calls_non_split): New function.
11269         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11270         parameter.
11271         * powerpc.cc (Target_powerpc::relocate_section): Add
11272         reloc_symbol_changes parameter.
11273         * sparc.cc (Target_sparc::relocate_section): Add
11274         reloc_symbol_changes parameter.
11275         * configure.ac: Call AM_CONDITIONAL for the default target.
11276         * configure: Rebuild.
11277         * testsuite/Makefile.am (TEST_AS): New variable.
11278         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11279         (check_DATA): Add split_i386 and split_x86_64 files.
11280         (SPLIT_DEFSYMS): Define.
11281         (split_i386_[1234n].o): New targets.
11282         (split_i386_[124]): New targets.
11283         (split_i386_[1234r].stdout): New targets.
11284         (split_x86_64_[1234n].o): New targets.
11285         (split_x86_64_[124]): New targets.
11286         (split_x86_64_[1234r].stdout): New targets.
11287         (MOSTLYCLEANFILES): Add new executables.
11288         * testsuite/split_i386.sh: New file.
11289         * testsuite/split_x86_64.sh: New file.
11290         * testsuite/split_i386_1.s: New file.
11291         * testsuite/split_i386_2.s: New file.
11292         * testsuite/split_i386_3.s: New file.
11293         * testsuite/split_i386_4.s: New file.
11294         * testsuite/split_i386_n.s: New file.
11295         * testsuite/split_x86_64_1.s: New file.
11296         * testsuite/split_x86_64_2.s: New file.
11297         * testsuite/split_x86_64_3.s: New file.
11298         * testsuite/split_x86_64_4.s: New file.
11299         * testsuite/split_x86_64_n.s: New file.
11300         * testsuite/testfile.cc (Target_test): Update relocation_section
11301         function.
11302         * testsuite/Makefile.in: Rebuild.
11303
11304 2009-10-06  Ian Lance Taylor  <iant@google.com>
11305
11306         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11307         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11308         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11309         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11310         the address on ldo_addrs_.
11311         (Target_i386::Relocate::fix_up_ldo): New function.
11312
11313 2009-10-06   Rafael Espindola  <espindola@google.com>
11314
11315         * plugin.cc (add_input_library): New.
11316         (Plugin::load): Add add_input_library to tv.
11317         (Plugin_manager::add_input_file): Add the is_lib argument.
11318         (add_input_file): Update call to Plugin_manager::add_input_file.
11319         (add_input_library): New.
11320         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11321
11322 2009-09-30  Doug Kwan  <dougkwan@google.com>
11323
11324         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11325         symbol and call Symbol::may_need_copy_reloc to determine if
11326         a copy reloc is needed.
11327         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11328         nocopyreloc is given in command line.
11329         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11330         given in command line.
11331         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11332         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11333         of the removed Target_i386::may_need_copy_reloc.
11334         * options.h (copyreloc): New option with default value false.
11335         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11336         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11337         instead of the removed Target_powerpc::may_need_copy_reloc.
11338         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11339         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11340         instead of the removed Target_sparc::may_need_copy_reloc.
11341         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11342         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11343         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11344         instead of the removed Target_x86_64::may_need_copy_reloc.
11345
11346 2009-09-30  Ian Lance Taylor  <iant@google.com>
11347
11348         * object.h (class Object): Remove target_ field, and target,
11349         sized_target, and set_target methods.
11350         (Object::sized_target): Remove.
11351         (class Sized_relobj): Update declarations.  Remove sized_target.
11352         * object.cc (Sized_relobj::setup): Remove target parameter.
11353         Change all callers.
11354         (Input_objects::add_object): Don't do anything with the target.
11355         (make_elf_sized_object): Add punconfigured parameter.  Change all
11356         callers.  Set or test parameter target.
11357         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11358         Change all callers.
11359         * parameters.cc (Parameters::set_target): Change parameter type to
11360         be non-const.
11361         (Parameters::default_target): Remove.
11362         (set_parameters_target): Change parameter type to be non-const.
11363         (parameters_force_valid_target): New function.
11364         (parameters_clear_target): New function.
11365         * parameters.h (class Parameters): Update declarations.  Remove
11366         default_target method.  Add sized_target and clear_target
11367         methods.  Change target_ to be non-const.
11368         (set_parameters_target): Update declaration.
11369         (parameters_force_valid_target): Declare.
11370         (parameters_clear_target): Declare.
11371         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11372         as NULL if we aren't searching.
11373         (Add_symbols::run): Don't check for compatible target.
11374         * fileread.cc (Input_file::open_binary): Call
11375         parameters_force_valid_target.
11376         * gold.cc (queue_middle_tasks): Likewise.
11377         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11378         set_target on object.
11379         * dynobj.h (class Sized_dynobj): Update declarations.
11380         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11381         make_elf_object returns NULL.
11382         (Archive::include_member): Don't check whether object target is
11383         compatible.
11384         * output.cc (Output_section::add_input_section): Get target from
11385         parameters.
11386         (Output_section::relax_input_section): Likewise.
11387         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11388         parameters.
11389         (Sized_relobj::do_scan_relocs): Likewise.
11390         (Sized_relobj::relocate_sections): Likewise.
11391         * resolve.cc (Symbol_table::resolve): Likewise.
11392         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11393         parameter.  Change all callers.
11394         (Symbol_table::add_from_object): Get target from parameters.
11395         (Symbol_table::add_from_relobj): Don't check object target.
11396         (Symbol_table::add_from_dynobj): Likewise.
11397         (Symbol_table::define_special_symbol): Get target from
11398         parameters.
11399         * symtab.h (class Symbol_table): Update declaration.
11400         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11401         parameter.  Change all callers.  Clear parameter target.
11402         (Binary_test): Test target here.
11403         * testsuite/object_unittest.cc (gold_testsuite): Remove
11404         target_test_pointer parameter.  Change all callers.
11405         (Object_test): Test target here.
11406
11407 2009-09-26  Ian Lance Taylor  <iant@google.com>
11408
11409         * testsuite/initpri1.c: Don't try to use constructor priorities if
11410         compiling with gcc before 4.3.
11411
11412 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11413
11414         * testsuite/retain_symbols_file_test.sh (check_present): Change
11415         output file name to retain_symbols_file_test.stdout.
11416         (check_absent): Likewise.
11417
11418 2009-09-18  Craig Silverstein  <csilvers@google.com>
11419
11420         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11421         * options.cc: Include <cerrno> and <fstream>.
11422         (General_options::finalize): Parse -retain-symbols-file tag.
11423         * options.h: New flag.
11424         (General_options): New method should_retain_symbol, new
11425         variable symbols_to_retain.
11426         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11427         should_retain_symbol map.
11428         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11429         * testsuite/Makefile.in: Regenerate.
11430         * testsuite/retain_symbols_file_test.sh: New file.
11431
11432 2009-09-18  Nick Clifton  <nickc@redhat.com>
11433
11434         * po/es.po: Updated Spanish translation.
11435
11436 2009-09-17  Doug Kwan  <dougkwan@google.com>
11437
11438         * debug.h (DEBUG_RELAXATION): New constant.
11439         (DEBUG_ALL): Add DEBUG_RELAXATION.
11440         (debug_string_to_enum): Add relaxation debug option.
11441         * layout.cc
11442         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11443         Layout::Relaxation_debug_check::read_sections,
11444         Layout::Relaxation_debug_check::read_sections): New method definitions.
11445         (Layout::Layout): Initialize data members
11446         record_output_section_data_from_scrips_,
11447         script_output_section_data_list_ and relaxation_debug_check_.
11448         (Layout::save_segments, Layout::restore_segments,
11449         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11450         Layout::relaxation_loop_body): New method definitions.
11451         (Layout::finalize): Support relaxation.  Move section layout code to
11452         Layout::relaxation_loop_body.
11453         (Layout::set_asection_address_from_script): Move code for orphan
11454         section placement out.
11455         (Layout::place_orphan_sections_in_script): New method definition.
11456         * layout.h (Output_segment_headers, Output_file_header):
11457         New forward class declarations.
11458         (Layout::~Layout): Define.
11459         (Layout::new_output_section_data_from_script): New method definition.
11460         (Layout::place_orphan_sections_in_script): New method declaration.
11461         (Layout::Segment_states): New type declaration.
11462         (Layout::save_segments, Layout::restore_segments,
11463         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11464         Layout::relaxation_loop_body): New method declarations.
11465         (Layout::Output_section_data_list): New type declaration.
11466         (Layout::Relaxation_debug_check): New class definition.
11467         (Layout::record_output_section_data_from_script_,
11468         Layout::script_output_section_data_list_, Layout::segment_states_,
11469         Layout::relaxation_debug_check_): New data members.
11470         * output.cc: (Output_section_headers::do_size): New method definition.
11471         (Output_section_headers::Output_section_headers): Move size
11472         computation to Output_section_headers::do_size.
11473         (Output_segment_headers::do_size): New method definition.
11474         (Output_file_header::Output_file_header): Move size computation to
11475         Output_file_header::do_size and call it.
11476         (Output_file_header::do_size): New method definition.
11477         (Output_data_group::Output_data_group): Adjust call to
11478         Output_section_data.
11479         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11480         (Output_symtab_xindex::do_write): Add array bound check.
11481         (Output_section::Input_section::print_to_mapfile): Handle
11482         RELAXED_INPUT_SECTION_CODE.
11483         (Output_section::Output_section): Initialize data member checkpoint_.
11484         (Output_section::~Output_section): Delete checkpoint object pointed
11485         by checkpoint_.
11486         (Output_section::add_input_section): Always add an Input_section if
11487         relaxing.
11488         (Output_section::add_merge_input_section): Add assert.
11489         (Output_section::relax_input_section): New method definition.
11490         (Output_section::set_final_data_size): Set load address to zero for
11491         an unallocated section.
11492         (Output_section::do_address_and_file_offset_have_reset_values):
11493         New method definition.
11494         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11495         Handle relaxed input section.
11496         (Output_section::sort_attached_input_sections): Checkpoint input
11497         section list lazily.
11498         (Output_section::get_input_sections): Change type of input_sections to
11499         list of Simple_input_section pointers.  Checkpoint input section list
11500         lazily.  Also handle relaxed input sections.
11501         (Output_section::add_input_section_for_script): Take a reference to
11502         a Simple_input_section object instead of Relobj pointer and section
11503         index as parameter.  Handle relaxed input sections.
11504         (Output_section::save_states, Output_section::restore_states): New
11505         method definitions.
11506         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11507         (Output_data::is_data_size_fixed): New method definition.
11508         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11509         if it is fixed.
11510         (Output_data::address_and_file_offset_have_reset_values): New method
11511         definition.
11512         (Output_data::do_address_and_file_offset_have_reset_values): New method
11513         definition.
11514         (Output_data::set_data_size): Check that data size is not fixed.
11515         (Output_data::fix_data_size): New method definition.
11516         (Output_data::is_data_size_fixed_): New data member.
11517         (Output_section_headers::set_final_data_size): New method definition.
11518         (Output_section_headers::do_size): New method declaration.
11519         (Output_segment_headers::set_final_data_size): New method definition.
11520         (Output_segment_headers::do_size): New method declaration.
11521         (Output_file_header::set_final_data_size)::New method definition.
11522         (Output_file_header::do_size)::New method declaration.
11523         (Output_section_data::Output_section_data): Add new parameter
11524         is_data_size_fixed and use it to fix data size.
11525         (Output_data_const::Output_data_const): Adjust call to base class
11526         constructor and fix data size.
11527         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11528         base class constructor and fix data size.
11529         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11530         base class constructor and fix data size.
11531         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11532         class constructor and fix data size.
11533         (Output_data_group::set_final_data_size): New method definition.
11534         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11535         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11536         class constructor and fix data size.
11537         (Output_relaxed_input_section): New class definition.
11538         (Output_section::Simple_input_section): New class definition.
11539         (Output_section::get_input_sections): Adjust parameter list.
11540         (Output_section::add_input_section_for_script): Same.
11541         (Output_section::save_states, Output_section::restore_states,
11542         Output_section::do_address_and_file_offset_have_reset_values,
11543         (Output_section::Input_section::Input_section): Handle
11544         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11545         Output_relaxed_input_section.
11546         (Output_section::Input_section::is_input_section,
11547         Output_section::Input_section::set_output_section): Handle relaxed
11548         input section.
11549         (Output_section::Input_section::is_relaxed_input_section,
11550         Output_section::Input_section::output_section_data,
11551         Output_section::Input_section::relaxed_input_section): New method
11552         definitions.
11553         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11554         value.
11555         (Output_section::Input_section::u1_): Update comments.
11556         (Output_section::Input_section::u2_): Add new union member poris.
11557         (Output_section::Checkpoint_output_section): New classs definition.
11558         (Output_section::relax_input_section): New method declaration.
11559         (Output_section::checkpoint_): New data member.
11560         (Output_segment): Update comments.
11561         (Output_segment::Output_segment): Un-privatize copy constructor.
11562         (Output_segment::operator=): Un-privatize.
11563         * script-sections.cc (Output_section_element::Input_section_list):
11564         Change element type to Output_section::Simple_input_section.
11565         (Output_section_element_dot_assignment::set_section_addresses):
11566         Register output section data for relaxation clean up.
11567         (Output_data_exression::Output_data_expression): Adjust call to base
11568         constructor to fix data size.
11569         (Output_section_element_data::set_section_addresses): Register
11570         Output_data_expression object for relaxation clean up.
11571         (struct Input_section_info): Replace Relobj pointer and section index
11572         pair with Output_section::Simple_input_section and Convert struct to a
11573         class.
11574         (Input_section_sorter::operator()): Adjust access to
11575         Input_section_info data member to use accessors.
11576         (Output_section_element_input::set_section_addresses): Use layout
11577         parameter.  Adjust code to use Output_section::Simple_input_section
11578         and Input_secction_info classes.  Register filler for relaxation
11579         clean up.
11580         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11581         and section index pair with Output_section::Simple_input_section
11582         class.  Adjust code accordingly.
11583         (Phdrs_element::release_segment): New method definition.
11584         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11585         segment list.
11586         (Script_sections::release_segments): New method definition.
11587         * gold/script-sections.h (Script_sections::release_segments): New
11588         method declaration.
11589         * gold/target.h (Target::may_relax, Target::relax,
11590         Target::do_may_relax, Target::do_relax): New method definitions.
11591
11592 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11593
11594         * arm.cc (has_signed_unsigned_overflow): New function.
11595         (Arm_relocate_functions::abs8): New function.
11596         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11597         (Target_arm::Scan::global): Likewise.
11598         (Target_arm::relocate::relocate): Likewise.
11599         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11600         Likewise.
11601
11602 2009-09-16  Cary Coutant  <ccoutant@google.com>
11603
11604         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11605         * testsuite/Makefile.in: Regenerate.
11606
11607 2009-09-11  Nick Clifton  <nickc@redhat.com>
11608
11609         * po/gold.pot: Updated by the Translation project.
11610
11611 2009-09-08  Cary Coutant  <ccoutant@google.com>
11612
11613         * output.cc (Output_file::open): Add execute permission to empty file.
11614         * testsuite/Makefile.am (permission_test): New test.
11615         * testsuite/Makefile.in: Regenerate.
11616
11617 2009-09-02  Ian Lance Taylor  <iant@google.com>
11618
11619         * output.cc (Output_file::resize): Call map_no_anonymous rather
11620         than map.
11621
11622 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11623
11624         * gold.cc: Include "incremental.h".
11625         (queue_initial_tasks): Call Incremental_checker methods.
11626         * incremental.cc: Include "output.h".
11627         (Incremental_checker::can_incrementally_link_output_file): New
11628         method.
11629         * incremental.h (Incremental_checker): New class.
11630
11631         * output.cc (Output_file::open_for_modification): New method.
11632         (Output_file::map_anonymous): Changed return type to bool.  Record
11633         map in base_ field.
11634         (Output_file::map_no_anonymous): New method, broken out of map.
11635         (Output_file::map): Use map_no_anonymous and map_anonymous.
11636         * output.h (class Output_file): Update declarations.
11637
11638 2009-08-24  Cary Coutant  <ccoutant@google.com>
11639
11640         * options.h (Command_line::Pre_options): New class.
11641         (Command_line::pre_options): New member.
11642         * options.cc (gold::options::ready_to_register): New variable.
11643         (One_option::register_option): Do nothing if not registering options.
11644         Assert if same short option registered twice.
11645         (General_options::General_options): Turn off option registration when
11646         done constructing.
11647         (Command_line::Pre_options::Pre_options): New constructor.
11648
11649 2009-08-24  Cary Coutant  <ccoutant@google.com>
11650
11651         * options.h (General_options::no_keep_memory): Remove incorrect
11652         short option.
11653
11654 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11655
11656         * Makefile.am (am__skiplex, am__skipyacc): New.
11657         * Makefile.in: Regenerate.
11658
11659 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11660
11661         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11662         (INCLUDES): ... this.
11663         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11664         (AM_CPPFLAGS): Renamed from ...
11665         (INCLUDE): ... this.
11666         * Makefile.in, testsuite/Makefile.in: Regenerate.
11667
11668         * Makefile.in: Regenerate.
11669         * aclocal.m4: Likewise.
11670         * config.in: Likewise.
11671         * configure: Likewise.
11672         * testsuite/Makefile.in: Likewise.
11673
11674         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11675         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11676         * Makefile.in: Regenerate.
11677         * testsuite/Makefile.in: Regenerate.
11678
11679 2009-08-19  Cary Coutant  <ccoutant@google.com>
11680
11681         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11682         symbols in shared libraries overridden by hidden or internal symbols
11683         in the main program.
11684
11685 2009-08-19  Chris Demetriou  <cgd@google.com>
11686
11687         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11688         checking source file names in error messages.
11689
11690 2009-08-18  Doug Kwan  <dougkwan@google.com>
11691
11692         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11693         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11694         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11695         an elfcpp::Ehdr as parameter.
11696         * object.cc (Object::set_target): Remove the version that looks up
11697         a target and sets it.
11698         (Sized_relobj::setup): Take a Target object instead of
11699         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11700         (make_elf_sized_object): Find target and ask target to
11701         make an ELF object.
11702         * object.h: (Object::set_target): Remove the version that looks up
11703         a target and sets it.
11704         (Sized_relobj::setup): Take a Target object instead of
11705         an elfcpp:Ehdr as parameter.
11706         * target.cc: Include dynobj.h.
11707         (Target::do_make_elf_object_implementation): New.
11708         (Target::do_make_elf_object): New.
11709         * target.h (Target::make_elf_object): New template declaration.
11710         (Target::do_make_elf_object): New method declarations.
11711         (Target::do_make_elf_object_implementation): New template declaration.
11712
11713 2009-08-14  Ian Lance Taylor  <iant@google.com>
11714
11715         * gold.h (FUNCTION_NAME): Define.
11716         (gold_unreachable): Use FUNCTION_NAME.
11717
11718 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11719
11720         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11721         symbol in the --keep-unique list is not found.
11722
11723 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11724
11725         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11726         been maked as --keep-unique.
11727         (Icf::unfold_section): New function.
11728         * icf.h (Icf::unfold_section): New function.
11729         * options.h (General_options::keep_unique): New option.
11730         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11731         * testsuite/Makefile.in: Regenerate.
11732         * testsuite/icf_keep_unique_test.sh: New file.
11733         * testsuite/icf_keep_unique_test.cc: New file.
11734
11735 2009-08-12  Cary Coutant  <ccoutant@google.com>
11736
11737         PR 10471
11738         * resolve.cc (Symbol_table::resolve): Check for references from
11739         dynamic objects to hidden and internal symbols.
11740         * testsuite/Makefile.am (hidden_test.sh): New test.
11741         * testsuite/Makefile.in: Regenerate.
11742         * testsuite/hidden_test.sh: New script.
11743         * testsuite/hidden_test_1.c: New test source.
11744         * testsuite/hidden_test_main.c: New test source.
11745
11746 2009-08-11  Doug Kwan  <dougkwan@google.com>
11747
11748         * arm.cc: Update comments.
11749         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11750         segment to locate the .ARM.exidx section if present.
11751
11752 2009-08-09  Doug Kwan  <dougkwan@google.com>
11753
11754         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11755         patch.
11756
11757 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11758         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11759         compiler warnings.
11760
11761 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11762
11763         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11764         valid tls_segment only for non-debug-section relocations.
11765         * testsuite/Makefile.am: Add gc_tls_test.
11766         * testsuite/Makefile.in: Regenerate.
11767         * testsuite/gc_tls_test.cc: New file.
11768         * testsuite/gc_tls_test.sh: New file.
11769
11770 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11771
11772         * icf.cc: New file.
11773         * icf.h: New file.
11774         * Makefile.am (CCFILES): Add icf.cc.
11775         (HFILES): Add icf.h
11776         * Makefile.in: Regenerate.
11777         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11778         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11779         section, symbol and addend information for the relocs.
11780         * gold.cc (queue_middle_tasks): Call identical code folding.
11781         * gold.h: Add defines for multimap.
11782         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11783         to the call of finalize_local_symbols.
11784         * main.cc (main): Create object of class Icf.
11785         * object.cc (Sized_relobj::do_layout): Allow this function to be
11786         called twice during icf.
11787         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11788         to sections marked as identical by icf.
11789         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11790         when available.
11791         (Sized_relobj::do_section_entsize): New function.
11792         * object.h (Object::section_entsize): New function.
11793         (Object::do_section_entsize): New pure virtual function.
11794         (Relobj::finalize_local_symbols): Add new parameter.
11795         (Relobj::do_section_entsize): New function.
11796         * options.h (General_options::icf): New option.
11797         (General_options::icf_iterations): New option.
11798         (General_options::print_icf_sections): New option.
11799         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11800         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11801         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11802         icf.
11803         * symtab.cc (Symbol_table::is_section_folded): New function.
11804         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11805         to sections marked as identical by icf.
11806         * symtab.h (Symbol_table::set_icf): New function.
11807         (Symbol_table::icf): New function.
11808         (Symbol_table::is_section_folded): New function.
11809         (Symbol_table::icf_): New data member.
11810         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11811         * testsuite/Makefile.am: Add commands to build icf_test.
11812         * testsuite/Makefile.in: Regenerate.
11813         * testsuite/icf_test.sh: New file.
11814         * testsuite/icf_test.cc: New file.
11815
11816 2009-07-24  Chris Demetriou  <cgd@google.com>
11817
11818         * layout.cc (is_compressible_debug_section): Fix incorrect
11819         comment about compressed section names.
11820
11821 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11822
11823         PR 10419
11824         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11825
11826 2009-07-16  Ian Lance Taylor  <iant@google.com>
11827
11828         PR 10400
11829         * layout.h: #include <map>.
11830         (class Kept_section): Change from struct to class.  Add accessors
11831         and setters.  Add section size to Comdat_group mapping.  Change
11832         Comdat_group to std::map.  Add is_comdat_ field.  Add
11833         linkonce_size field in union.
11834         (class Layout): Update declaration of find_or_add_kept_section.
11835         Don't declare find_kept_object.
11836         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11837         parameter.  Add object, shndx, is_comdat, and is_group_name
11838         parameters.  Change all callers.  Adjust for new Kept_section.
11839         (Layout::find_kept_object): Remove.
11840         * object.cc (Sized_relobj::include_section_group): Update use of
11841         Kept_section.  Rename secnum to shndx.  Only record
11842         Kept_comdat_section if sections are the same size.
11843         (Sized_relobj::include_linkonce_section): Update use of
11844         Kept_section.  Only record Kept_comdat_section if sections are the
11845         same size.  Set size of linkonce section.
11846         (Sized_relobj::map_to_kept_section): Update call to
11847         get_kept_comdat_section.
11848         * object.h (class Sized_relobj): Rename fields in
11849         Kept_comdat_section to drop trailing underscores; change object
11850         field to Relobj*.  Change Kept_comdat_section_table to store
11851         struct rather than pointer.
11852         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11853         Add kept_object and kept_shndx parameters.  Change all callers.
11854         (Sized_relobj::get_kept_comdat_section): Change return type to
11855         bool.  Add kept_object and kept_shndx parameters.  Change all
11856         callers.
11857         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11858         Layout::find_or_add_kept_section.
11859
11860 2009-07-09  Ian Lance Taylor  <iant@google.com>
11861
11862         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11863         Reserve space in the hash table.
11864
11865 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11866
11867         * fileread.cc (File_read::get_mtime): New method.
11868         * fileread.h (Timespec): New structure.
11869         (File_read::get_mtime): New method.
11870         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11871         Renamed from timestamp_nsec.
11872         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11873         Elf_Xword.
11874         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11875         timestamp_nsec.
11876         (Incremental_inputs::report_archive): Save mtime; style fix.
11877         (Incremental_inputs::report_obejct): Save mtime; style fix.
11878         (Incremental_inputs::report_script): Save mtime; style fix.
11879         (Incremental_inputs::finalize_inputs): Style fix.
11880         (Incremental_inputs::finalize): Style fix.
11881         (Incremental_inputs::create_input_section_data): Store inputs
11882         mtime.
11883         * incremental.h (Incremental_inputs::report_script): Add mtime
11884         argument.
11885         (Incremental_inputs::Input_info::Input_info): Intialize only one
11886         union member.
11887         (Incremental_inputs::Input_info::archive): Move to nameless
11888         union.
11889         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11890         (Incremental_inputs::Input_info::script): Move to nameless union.
11891         (Incremental_inputs::mtime): New field.
11892         * script.cc (read_input_script): Pass file mtime to
11893         Incremental_input.
11894         * script.h (Script_info::inputs): Style fix.
11895
11896 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11897
11898         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11899         instead of 32.
11900
11901 2009-06-24  Ian Lance Taylor  <iant@google.com>
11902
11903         PR 10156
11904         * layout.cc (Layout::choose_output_section): If we find an
11905         existing section, update the flags.
11906         (Layout::create_notes): New function, broken out of
11907         Layout::finalize.
11908         (Layout::finalize): Don't create note sections.
11909         (Layout::create_note): Don't crash if linker script discards
11910         section.
11911         (Layout::create_gold_note): Likewise.
11912         (Layout::create_build_id): Likewise.  Don't set
11913         after_input_sections on the section.
11914         (Layout::create_executable_stack_info): Remove target parameter.
11915         Change caller.
11916         * layout.h (class Layout): Declare create_notes.  Update
11917         declaration of create_executable_stack_info.
11918         * gold.cc (queue_middle_tasks): Call create_notes.
11919         * output.cc (Output_section::update_flags_for_input_section): Move
11920         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11921         invalid.
11922         * output.h (Output_data::mark_address_invalid): New function.
11923         (class Output_section): Only declare, not define,
11924         update_flags_for_input_section.  Remove set_flags.
11925
11926 2009-06-24  Ian Lance Taylor  <iant@google.com>
11927
11928         * script-sections.cc (Output_section_definition::
11929         set_section_addresses): Rename shadowing local load_address to
11930         laddr.
11931
11932 2009-06-24  Ian Lance Taylor  <iant@google.com>
11933
11934         PR 10244
11935         * reloc.cc (relocate_sections): Skip empty relocation sections.
11936
11937 2009-06-23  Ian Lance Taylor  <iant@google.com>
11938
11939         PR 10156
11940         * layout.cc (Layout::create_note): Use choose_output_section
11941         rather than make_output_section.
11942
11943 2009-06-23  Ian Lance Taylor  <iant@google.com>
11944
11945         PR 10237
11946         * options.cc (General_options::parse_V): Set printed_version_.
11947         (General_options::General_options): Initialize printed_version_.
11948         * options.h (class General_options): Add printed_version_ field.
11949         * gold.cc (queue_initial_tasks): If there are no input files,
11950         don't give a fatal error if we printed the version information.
11951         (queue_middle_tasks): If using -r with a shared object, give a
11952         fatal error rather than an ordinary error.
11953
11954 2009-06-23  Ian Lance Taylor  <iant@google.com>
11955
11956         PR 10219
11957         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11958         (Layout::make_output_section): Set have_stabstr_section_ if we see
11959         a .stab*str section.
11960         (Layout::finalize): Call link_stabs_sections.
11961         (Layout::link_stabs_sections): New file.
11962         * layout.h (class Layout): Add have_stabstr_section_ field.
11963         Declare link_stabs_sections.
11964
11965 2009-06-23  Doug Kwan  <dougkwan@google.com>
11966
11967         * Makefile.am (libgold_a_LIBADD): New.
11968         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11969         * Makefile.in: Regenerate.
11970         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11971         * configure: Regenerate.
11972         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11973         * fileread.cc: Include sys/state.h
11974         * gold.h: Declare memmem and strndup if found missing.
11975         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11976
11977 2009-06-23  Ian Lance Taylor  <iant@google.com>
11978
11979         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11980         * configure: Rebuild.
11981
11982 2009-06-23  Ian Lance Taylor  <iant@google.com>
11983
11984         PR 10147
11985         * object.cc (Object::section_contents): Don't try to get a view if
11986         the section has length zero.
11987         (Object::handle_gnu_warning_section): If the section is empty, use
11988         the name of the section as the warning.
11989
11990 2009-06-23  Ian Lance Taylor  <iant@google.com>
11991
11992         PR 10133
11993         * stringpool.h (class Stringpool_template): Add optimize_ field.
11994         (Stringpool_template::set_optimize): New function.
11995         * stringpool.cc (Stringpool_template::Stringpool_template):
11996         Initialize optimize_ field.
11997         (Stringpool_template::set_string_offsets): Test local optimize
11998         fild rather than parameter.
11999         * layout.cc (Layout::Layout): Call set_optimize on the section
12000         name stringpool.
12001
12002 2009-06-22  Ian Lance Taylor  <iant@google.com>
12003
12004         PR 10030
12005         * yyscript.y: Parse TARGET.
12006         * script.cc (script_set_target): New function.
12007         * script-c.h (script_set_target): Declare.
12008         * options.cc (General_options::string_to_object_format): Rename
12009         from string_to_object_format in anonymous namespace.  Change
12010         callers.
12011         * options.h (class General_options): Declare
12012         string_to_object_format.
12013
12014 2009-06-22  Ian Lance Taylor  <iant@google.com>
12015
12016         * script-sections.cc (Script_sections::create_segments): Don't put
12017         program headers in a PT_LOAD segment if -n or -N.
12018
12019 2009-06-22  Ian Lance Taylor  <iant@google.com>
12020
12021         PR 10141
12022         * options.h (class General_options): Add -z lazy and -z now.  Sort
12023         -z options into alphabetical order.
12024         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12025
12026 2009-06-21  Ian Lance Taylor  <iant@google.com>
12027
12028         * layout.cc (Layout::make_output_section): Call
12029         Target::new_output_section.
12030         (Layout::attach_allocated_section_to_segment): Put large section
12031         sections in a separate load segment with the large segment flag
12032         set.
12033         (Layout::segment_precedes): Sort large data segments after other
12034         load segments.
12035         (align_file_offset): New static function.
12036         (Layout::set_segment_offsets): Use align_file_offset.
12037         * output.h (class Output_section): Add is_small_section_ and
12038         is_large_section_ fields.
12039         (Output_section::is_small_section): New function.
12040         (Output_section::set_is_small_section):  New function.
12041         (Output_section::is_large_section): New function.
12042         (Output_section::set_is_large_section): New function.
12043         (Output_section::is_large_data_section): New function.
12044         (class Output_segment): Add is_large_data_segment_ field.
12045         (Output_segment::is_large_data_segment): New function.
12046         (Output_segment::set_is_large_data_segment): New function.
12047         * output.cc (Output_section::Output_section): Initialize new
12048         fields.
12049         (Output_segment::Output_segment): Likewise.
12050         (Output_segment::add_output_section): Add assertion that large
12051         data sections always go in large data segments.  Force small data
12052         sections to the end of the list of data sections.  Force small BSS
12053         sections to the start of the list of BSS sections.  For large BSS
12054         sections to the end of the list of BSS sections.
12055         * symtab.h (class Symbol): Declare is_common_shndx.
12056         (Symbol::is_defined): Check Symbol::is_common_shndx.
12057         (Symbol::is_common): Likewise.
12058         (class Symbol_table): Define enum Commons_section_type.  Update
12059         declarations.  Add small_commons_ and large_commons_ fields.
12060         * symtab.cc (Symbol::is_common_shndx): New function.
12061         (Symbol_table::Symbol_table): Initialize new fields.
12062         (Symbol_table::add_from_object): Put small and large common
12063         symbols in the right list.
12064         (Symbol_table::sized_finalized_symbol): Check
12065         Symbol::is_common_shndx.
12066         (Symbol_table::sized_write_globals): Likewise.
12067         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12068         common symbol lists.  Don't call do_allocate_commons_list if the
12069         list is empty.
12070         (Symbol_table::do_allocate_commons_list): Remove is_tls
12071         parameter.  Add comons_section_type parameter.  Change all
12072         callers.  Handle small and large common symbols.
12073         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12074         Symbol::is_common_shndx.
12075         * resolve.cc (symbol_to_bits): Likewise.
12076         * target.h (Target::small_common_shndx): New function.
12077         (Target::small_common_section_flags): New function.
12078         (Target::large_common_shndx): New function.
12079         (Target::large_common_section_flags): New function.
12080         (Target::new_output_section): New function.
12081         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12082         small_common_section_flags, and large_common_section_flags
12083         fields.
12084         (Target::do_new_output_section): New virtual function.
12085         * arm.cc (Target_arm::arm_info): Initialize new fields.
12086         * i386.cc (Target_i386::i386_info): Likewise.
12087         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12088         Likewise.
12089         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12090         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12091         (Target_x86_64::do_new_output_section): New function.
12092         * configure.ac: Define conditional MCMODEL_MEDIUM.
12093         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12094         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12095         (large_LDFLAGS): Define.
12096         * testsuite/large.c: New file.
12097         * testsuite/testfile.cc (Target_test::test_target_info):
12098         Initialize new fields.
12099         * configure, testsuite/Makefile.in: Rebuild.
12100
12101 2009-06-05  Doug Kwan  <dougkwan@google.com>
12102
12103         * Makefile.am (CCFILES): Add target.cc.
12104         * Makefile.in: Regenerate.
12105         * i386.cc (class Target_i386): Define new virtual method to
12106         override do_is_local_label_name in parent.
12107         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12108         local symbols if --discard-locals or -X is given.
12109         * options.h (class General_options): Declare new options
12110         '--discard-locals' and '-X' for discarding locals.
12111         * target.h (class Target): Define new methods is_local_label_name.
12112         Declare new virtual method do_is_local_label_name.
12113         * target.cc: New file.
12114         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12115         (check_SCRIPTS): Add discard_locals_test.sh.
12116         (check_DATA): Add discard_local_tests.syms.
12117         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12118         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12119         * testsuite/Makefile.in: Regenerate.
12120         * testsuite/discard_locals_test.c: New file.
12121         * testsuite/discard_locals_test.sh: Same.
12122
12123 2009-06-05  Doug Kwan  <dougkwan@google.com>
12124
12125         * object.cc (Sized_relobj::Sized_relobj): Initialize
12126         discarded_eh_frame_shndx_ to -1U.
12127         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12128         section.
12129         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12130         a discarded .eh_frame section.
12131         (Sized_relobj::do_finalize_local_symbols): Ditto.
12132         * object.h (class Sized_relobj): Declare new member
12133         discarded_eh_frame_shndx_.
12134         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12135         (local_labels_test.o, local_labels_test): New rules.
12136         * testsuite/Makefile.in: Regenerate.
12137
12138 2009-06-04  Doug Kwan  <dougkwan@google.com>
12139
12140         * layout.cc (Layout::section_name_mapping): Add mapping for
12141         special ARM sections.
12142
12143 2009-06-03  Doug Kwan  <dougkwan@google.com>
12144
12145         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12146         (utils::has_overflow): Same.
12147
12148 2009-06-03  Ian Lance Taylor  <iant@google.com>
12149
12150         * layout.cc (Layout::section_name_mapping): New array, replacing
12151         Layout::linkonce_mapping.
12152         (Layout::section_name_mapping_count): New variable, replacing
12153         Layout::linkonce_mapping_count.
12154         (Layout::linkonce_output_name): Remove.
12155         (Layout::output_section_name): Rewrite.
12156         * layout.h (class Layout): Rename Linkonce_mapping to
12157         Section_name_mapping, linkonce_mapping to section_name_mapping,
12158         linkonce_mapping_count to section_name_mapping_count.  Don't
12159         declare linkonce_output_name.
12160
12161 2009-06-03  Doug Kwan  <dougkwan@google.com>
12162
12163         * gold/arm.cc (namespace utils): New.
12164         (Target_arm::reloc_is_non_pic): Define new method.
12165         (class Arm_relocate_functions): New.
12166         (Target_arm::Relocate::relocate): Handle relocation types used by
12167         Android.
12168
12169 2009-06-03  Ian Lance Taylor  <iant@google.com>
12170
12171         * arm.cc (Target_arm::scan::global): Use || instead of |.
12172
12173 2009-06-02  Doug Kwan  <dougkwan@google.com>
12174
12175         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12176         issued_non_pic_error_.
12177         (class Target_arm::Scan): Declare new method check_non_pic.
12178         Define new method symbol_needs_plt_entry.
12179         Declare new data member issued_non_pic_error_.
12180         (class Target_arm::Relocate): Declare new method
12181         should_apply_static_reloc.
12182         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12183         (Target_arm::Scan::check_non_pic): Define new method.
12184         (Target_arm::Scan::local): Handle a small subset of reloc types used
12185         by Android.
12186         (Target_arm::Scan::local): Same.
12187         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12188
12189 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12190
12191         * incremental.cc (Incremental_inputs::report_command_line): Filter
12192         out --incremental-* options.
12193
12194 2009-05-29  Doug Kwan  <dougkwan@google.com>
12195
12196         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12197         template class.
12198         (class Target_arm): Update comment.
12199         (Target_arm::Target_arm): Initialize new data members GOT_,
12200         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12201         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12202         and Target_arm::rel_dyn_section.
12203         Declare new_enum Target_arm::Got_type.
12204         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12205         and DYNBSS_.
12206         Update commments for member do_dynsym_value.
12207         (Target_arm::got_size, Target_arm::plt_section,
12208         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12209         new methods inside class defintion.
12210         (Target_arm::got_section): Define new method.
12211         (Target_arm::rel_dyn_section): Same.
12212         (Output_data_plt_arm): New template class.
12213         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12214         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12215         (Output_data_plt_arm::add_entry): Same.
12216         (Output_data_plt_arm::first_plt_entry): Define new
12217         static data member for PLT instruction template.
12218         (Output_data_plt_arm::plt_entry): Same.
12219         (Output_data_plt_arm::do_write): Define new method.
12220         (Target_arm::make_plt_entry): Same.
12221         (Target_arm::do_finalize_sections): Same.
12222         (Target_arm::do_dynsym_value): Same.
12223
12224 2009-05-28  Doug Kwan  <dougkwan@google.com>
12225
12226         * Makefile.am (TARGETSOURCES): Add arm.cc.
12227         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12228         * Makefile.in: Regenerate.
12229         * arm.cc: New file.
12230         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12231
12232 2009-05-26  Doug Kwan  <dougkwan@google.com>
12233
12234         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12235         (General_options::check_excluded_libs): Strip off directories in
12236         archive name before matching like GNU ld does.
12237         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12238         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12239         (exclude_libs_test_LDFLAGS): Add linker option
12240         -Wl,--exclude-libs,libexclude_libs_test_3
12241         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12242         an explicit archive without using -l.
12243         (alt/libexclude_libs_test_3.a): New make rule.
12244         * testsuite/Makefile.in: Regenerate.
12245         * testsuite/exclude_libs_test.c : Declare lib3_default().
12246         (main): Call it.
12247         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12248         * exclude_libs_test_3.c: New file.
12249
12250 2009-05-26  Nick Clifton  <nickc@redhat.com>
12251
12252         * po/id.po: New Indonesian translation.
12253         * po/gold.pot: Updated template file.
12254
12255 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12256
12257         * testsuite/Makefile.am: Add -ffunction-sections to compile
12258         gc_comdat_test files.  Add -Wl,--gc-sections to build
12259         gc_comdat_test.
12260         * testsuite/Makefile.in: Regenerate.
12261         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12262
12263 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12264
12265         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12266         kept comdat section was garbage collected.
12267         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12268         * testsuite/Makefile.in: Regenerate.
12269         * testsuite/gc_comdat_test.sh: New file.
12270         * testsuite/gc_comdat_test_1.cc: New file.
12271         * testsuite/gc_comdat_test_2.cc: New file.
12272
12273 2009-05-19  Doug Kwan  <dougkwan@google.com>
12274
12275         * archive.cc (Archive::Archive): Move constructor from archive.h
12276         to here.  Initialize no_export_.
12277         (Archive::get_elf_object_for_member): Set no_export flag of object.
12278         * archive.h (Archive::Archive): Move constructor body to
12279         archive.cc.
12280         (Archive::no_export): New method.
12281         (Archive::no_export_): New field.
12282         * object.h (Object::Object): Initialize no_export_ to false.
12283         (Object::no_export, Object::set_no_export): New methods.
12284         (Object::no_export_): New field.
12285         * options.cc (General_options::parse_exclude_libs): New method.
12286         (General_options::check_excluded_libs) Same.
12287         * options.h (exclude_libs): New option.
12288         (General_options::check_excluded_libs): New method declaration.
12289         (General_options::excluded_libs_): New field.
12290         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12291         default or protected visibility if an object has no-export flag set.
12292         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12293         (check_SCRIPTS): Add exclude_libs_test.sh.
12294         (check_DATA): Add exclude_libs_test.syms.
12295         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12296         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12297         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12298         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12299         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12300         libexclude_libs_test_2.a): New rules.
12301         * testsuite/Makefile.in: Regenerate.
12302         * testsuite/exclude_libs_test.c: New file.
12303         * testsuite/exclude_libs_test.sh: Ditto.
12304         * testsuite/exclude_libs_test_1.c: Ditto.
12305         * testsuite/exclude_libs_test_2.c: Ditto.
12306
12307 2009-05-15  Ian Lance Taylor  <iant@google.com>
12308
12309         * configure.ac: Check for declarations for cases where libiberty.h
12310         checks HAVE_DECL_xxx.
12311         * configure, config.in: Rebuild.
12312
12313 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12314
12315         * gold.h (Incremental_argument_list): Remove (invalid) forward
12316         declaration.
12317         * incremental.cc (Incremental_inputs::report_achive): New method.
12318         (Incremental_inputs::report_object): New method.
12319         (Incremental_inputs::report_script): New method.
12320         (Incremental_inputs::finalize_inputs): New method.
12321         (Incremental_inputs::finalize): Call finalize_inputs().
12322         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12323         Create inputs entries.
12324         * incremental.h (Incremental_input_type): New enum.
12325         (Incremental_inputs::Incremental_input): Initialize new fields.
12326         (Incremental_inputs::report_inputs): New method.
12327         (Incremental_inputs::report_achive): New method.
12328         (Incremental_inputs::report_object): New method.
12329         (Incremental_inputs::report_script): New method.
12330         (Incremental_inputs::finalize_inputs): New method.
12331         (Incremental_inputs::Input_info): New struct.
12332         (Incremental_inputs::Input_info_map): New typedef.
12333         (Incremental_inputs::lock_): New field.
12334         (Incremental_inputs::Inputs_): New field.
12335         (Incremental_inputs::Inputs_map): New field.
12336         * main.cc (main): Call Incremental_input::report_inputs.
12337         * options.h (Input_argument_list): Typedef moved from
12338         Input_arguments.
12339         (Input_file_group::Files): Remove, use ::Input_argument_list.
12340         (Input_file_group::Input_argument_list): Remove, use
12341         ::Input_argument_list.
12342         * plugin.cc (Plugin_manager::add_input_file): Add error in
12343         incremental build.
12344         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12345         functions.
12346         * script.cc (read_input_script): Call
12347         Incremental_input::report_script.
12348         * script.h (Script_info): New class.
12349
12350 2009-04-27  Ian Lance Taylor  <iant@google.com>
12351
12352         * x86_64.cc (do_adjust_output_section): Set entsize to
12353         plt_entry_size.
12354
12355 2009-04-23  Elliott Hughes  <enh@google.com>
12356
12357         * output.cc (Output_file::close): After short writes, continue
12358         writing from the correct offset in the buffer being written.
12359
12360 2009-04-23  Chris Demetriou  <cgd@google.com>
12361
12362         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12363         * configure: Regenerate.
12364         * config.in: Regenerate.
12365         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12366         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12367
12368 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12369
12370         * incremental.cc (Incremental_inputs_header_data): Renamed from
12371         Incremental_input_header_data.
12372         (Incremental_inputs_header_data::data_size): New field.
12373         (Incremental_inputs_header_data::put_input_file_count): Renamed
12374         from input_file_count.
12375         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12376         from command_line_offset.
12377         (Incremental_inputs_header_data::put_reserved): Renamed from
12378         put_reserved.
12379         (Incremental_inputs_entry_data): Renamed from
12380         Incremental_input_entry_data.
12381         (Incremental_inputs_entry_data::data_size): New field.
12382         (Incremental_inputs::report_command_line): New method.
12383         (Incremental_inputs::finalize): New method.
12384         (Incremental_inputs::create_incremental_inputs_data): New method.
12385         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12386         * incremental.h: New file.
12387         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12388         (Layout::finalize): Create incremental inputs section in
12389         incremental builds.
12390         (Layout::create_incremental_info_sections): New method.
12391         * layout.h (Layout::incremental_inputs): New method.
12392         (Layout::create_incremental_info_sections): New method.
12393         (Layout::incremental_inputs_): New field.
12394         * main.cc (main): Notify Incremental_input of the command line.
12395
12396 2009-04-01  Ian Lance Taylor  <iant@google.com>
12397             Mikolaj Zalewski  <mikolajz@google.com>
12398
12399         * gold.h (reserve_unordered_map): Define, three versions, one for
12400         each version of Unordered_map.
12401         * layout.cc (Layout::Layout): Remove options parameter.  Add
12402         number_of_input_files parameter.  Don't initialize options_.
12403         Initialize number_of_input_files_ and resized_signatures_.  Move
12404         sections_are_attached_.
12405         (Layout::layout_group): Reserve space for group_signatures_.
12406         (Layout::find_or_add_kept_section): Change name parameter to be a
12407         reference.  Resize signatures_ map when it gets large enough.
12408         (Layout::layout_eh_frame): Use parameters->options() instead of
12409         this->options_.
12410         (Layout::make_output_section): Likewise.
12411         (Layout::attach_allocated_section_to_segment): Likewise.
12412         (Layout::finalize, Layout::create_executable_stack): Likewise.
12413         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12414         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12415         * layout.h (class Layout): Update declarations.  Remove options_
12416         field.  Add number_of_input_files_ and resized_signatures_
12417         fields.  Move sections_are_attached_ field.
12418         * main.cc (main): Pass number of input files to Layout
12419         constructor.  Don't pass options.
12420
12421 2009-03-30  Ian Lance Taylor  <iant@google.com>
12422
12423         * ffsll.c (ffsll): Correct implementation.
12424
12425 2009-03-27  Ian Lance Taylor  <iant@google.com>
12426
12427         * ffsll.c: New file.
12428         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12429         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12430         * ftruncate.c (ftruncate): Declare before definition.
12431         * mremap.c (mremap): Likewise.
12432         * pread.c (pread): Likewise.
12433         * configure, Makefile.in, config.in: Rebuild.
12434
12435         * mremap.c: New file.
12436         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12437         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12438         (mremap): Declare if HAVE_MREMAP is not defined.
12439         * configure, Makefile.in, config.in: Rebuild.
12440
12441 2009-03-27  Cary Coutant  <ccoutant@google.com>
12442
12443         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12444         position independent.
12445         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12446         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12447
12448 2009-03-24  Cary Coutant  <ccoutant@google.com>
12449
12450         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12451         an executable.
12452         (needs_dynamic_reloc): Likewise.
12453
12454 2009-03-24  Ian Lance Taylor  <iant@google.com>
12455
12456         * yyscript.y (file_cmd): Recognize EXTERN.
12457         (extern_name_list, extern_name_list_body): New nonterminals.
12458         * script.cc (script_add_extern): Define.
12459         * script-c.h (script_add_extern): Declare.
12460
12461 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12462
12463         * object.cc (is_elf_object): Define.
12464         * object.h (is_elf_object): Declare.
12465         * archive.cc (Archive::get_elf_object_for_member): Call
12466         is_elf_object.
12467         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12468
12469 2009-03-24  Elliott Hughes  <enh@google.com>
12470
12471         * output.cc (Output_file::map_anonymous): Define.
12472         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12473         try an anonymous one.  Report the size if the mmap fails.
12474         * output.h (class Output_file): Declare map_anonymous.
12475
12476 2009-03-24  Ian Lance Taylor  <iant@google.com>
12477
12478         * target-select.cc (instantiate_target): Don't acquire the lock if
12479         the instantiated_target_ field has already been set.
12480
12481 2009-03-23  Ian Lance Taylor  <iant@google.com>
12482
12483         * gold-threads.h (class Initialize_lock): Define.
12484         * gold-threads.cc (class Initialize_lock_once): Define.
12485         (initialize_lock_control): New static variable.
12486         (initialize_lock_pointer): New static variable.
12487         (initialize_lock_once): New static function.
12488         (Initialize_lock::Initialize_lock): Define.
12489         (Initialize_lock::initialize): Define.
12490         * target-select.h: Include "gold-threads.h".
12491         (class Target_selector): Add lock_ and initialize_lock_ fields.
12492         Don't define instantiate_target, just declare it.
12493         * target-select.cc (Target_selector::Target_selector): Initialize
12494         new fields.
12495         (Target_selector::instantiate_target): Define.
12496         * descriptors.h: Include "gold-threads.h".
12497         (class Descriptors): Add initialize_lock_ field.
12498         * descriptors.cc (Descriptors::Descriptors): Initialize new
12499         field.
12500         (Descriptors::open): Use initialize_lock_ field
12501         * errors.h (class Errors): Add initialize_lock_ field.
12502         * errors.cc (Errors::Errors): Initialize new field.
12503         (Errors::initialize_lock): Use initialize_lock_ field.
12504         * powerpc.cc (class Target_selector_powerpc): Remove
12505         instantiated_target_ field.  In do_recognize call
12506         instantiate_target rather than do_instantiate_target.  In
12507         do_instantiate_target just allocate a new target.
12508         * sparc.cc (class Target_selector_sparc): Likewise.
12509
12510         * freebsd.h: New file.
12511         * i386.cc: Include "freebsd.h".
12512         (Target_i386): Derive from Target_freebsd rather than
12513         Sized_target.
12514         (Target_selector_i386): Derive from Target_selector_freebsd rather
12515         than Target_selector.
12516         * x86_64.cc: Include "freebsd.h".
12517         (Target_x86_64): Derive from Target_freebsd rather than
12518         Sized_target.
12519         (Target_selector_x86_64): Derive from Target_selector_freebsd
12520         rather than Target_selector.
12521         * target.h (class Target): Add adjust_elf_header and
12522         do_adjust_elf_header.
12523         * output.cc (Output_file_header:: do_sized_write): Call target
12524         adjust_elf_header routine.
12525         * configure.tgt: Set targ_osabi.
12526         * configure.ac: Define GOLD_DEFAULT_OSABI.
12527         * parameters.cc (Parameters::default_target): Pass
12528         GOLD_DEFAULT_OSABI to select_target.
12529         * target-select.h (class Target_selector): Make instantiate_target
12530         protected rather than private.
12531         * Makefile.am (HFILES): Add freebsd.h.
12532         * configure, Makefile.in, config.in: Rebuild.
12533
12534         * merge.cc (do_add_input_section): Correct pend value.  Change
12535         message about last entry not being null terminated from error to
12536         warning.
12537
12538 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12539
12540         * incremental.cc: New file.
12541         * Makefile.am (CCFILES): Add incremental.cc.
12542         * Makefile.in: Rebuild.
12543
12544 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12545
12546         * layout.cc (Layout::output_section_name): Preserve names
12547         of '.note.' sections.
12548
12549 2009-03-19  Ian Lance Taylor  <iant@google.com>
12550
12551         * descriptors.cc (Descriptors::open): Check that the options are
12552         valid before using them.
12553
12554 2009-03-18  Ian Lance Taylor  <iant@google.com>
12555
12556         * script-sections.h: Include <list>.
12557         (class Script_sections): Change Sections_elements from std::vector
12558         to std::list.  Typedef public Elements_iterator.  Add
12559         orphan_section_placement_, data_segment_align_start_, and
12560         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12561         field.
12562         * script-sections.cc (class Orphan_section_placement): New class.
12563         (class Sections_element): Add virtual functions is_relro and
12564         orphan_section_init.  Remove virtual function place_orphan_here.
12565         (class Output_section_definition): Add is_relro and
12566         orphan_section_init.  Remove place_orphan_here.
12567         (class Orphan_output_section): Likewise.
12568         (Script_sections::Script_sections): Update for field changes.
12569         (Script_sections::data_segment_align): Set saw_data_segment_align_
12570         and data_segment_align_start_, not data_segment_align_index.
12571         (Script_sections::data_segment_relro_end): Check
12572         saw_data_segment_align_.  Use data_segment_align_start_ rather
12573         than data_segment_align_index_.
12574         (Script_sections::place_orphan): Rewrite to use
12575         Orphan_section_placement.
12576
12577 2009-03-17  Ian Lance Taylor  <iant@google.com>
12578
12579         * archive.cc (Archive::add_symbols): Check for a version attached
12580         to the symbol name in the archive map.
12581         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12582         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12583         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12584         (ver_test_11.a): New target.
12585         * testsuite/Makefile.in: Rebuild.
12586
12587         * configure.ac: Check for chsize and posix_fallocate.  Replace
12588         ftruncate.
12589         * ftruncate.c: New file, from gnulib.
12590         * output.cc (posix_fallocate): Define dummy version if not
12591         HAVE_POSIX_FALLOCATE.
12592         (Output_file::map): Call posix_fallocate rather than lseek and
12593         write.
12594         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12595         * configure, Makefile.in, config.in: Rebuild.
12596
12597 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12598
12599         * layout.h (Layout::create_note): Add section_name parameter.
12600         * layout.cc (Layout::create_note): Likewise.
12601         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12602
12603 2009-03-17  Ian Lance Taylor  <iant@google.com>
12604
12605         * descriptors.cc: Include "options.h".
12606         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12607         (Descriptors::open): Always use O_CLOEXEC when opening a new
12608         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12609         then set FD_CLOEXEC.
12610
12611         * sparc.cc (class Target_sparc): Add has_got_section.
12612         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12613         make sure we have a GOT section.
12614
12615         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12616         (Target_sparc::Scan::local): Likewise.
12617         (Target_sparc::Scan::global): Likewise.
12618         (Target_sparc::Relocate::relocate): Likewise.
12619         (Target_sparc::Relocate::relocate_tls): Likewise.
12620
12621         * symtab.cc (Symbol_table::define_default_version): New function,
12622         broken out of add_from_object.
12623         (Symbol_table::add_from_object): Call define_default_version.
12624         (Symbol_table::define_special_symbol): Add resolve_oldsym
12625         parameter.  Change all callers.  If the version for a symbol comes
12626         from a version script, resolve it with the symbol with the same
12627         name with no version.  Also add the symbol without a version if
12628         appropriate.
12629         (do_define_in_output_data): If resolving with oldsym, don't delete
12630         sym.
12631         (do_define_in_output_segment): Likewise.
12632         (do_define_as_constant): Likewise.
12633         * symtab.h (class Symbol_table): Update declarations.
12634
12635 2009-03-13  Ian Lance Taylor  <iant@google.com>
12636
12637         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12638         (Read_symbols::requeue): New function.
12639         (Read_symbols::do_read_symbols): If make_elf_object fails because
12640         the target type is not configured, and the file was searched for,
12641         issue a warning and retry with the next directory.
12642         (Add_symbols::run): If the file has an incompatible format, and
12643         it was searched for, requeue the Read_symbols task.  On error,
12644         release the object.
12645         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12646         dirindex parameter to constructor.  Change all callers.  Declare
12647         incompatible_warning and requeue.
12648         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12649         input_argument_ and input_group_ fields.  Add them to
12650         constructor.  Change all callers.
12651         (class Read_script): Add dirindex_ field.  Add it to constructor.
12652         Change all callers.
12653         * archive.cc (Archive::setup): Remove input_objects parameter.
12654         Change all callers.
12655         (Archive::get_file_and_offset): Likewise.
12656         (Archive::read_all_symbols): Likewise.
12657         (Archive::read_symbols): Likewise.
12658         (Archive::get_elf_object_for_member): Remove input_objects
12659         parameter.  Add punconfigured parameter.  Change all callers.
12660         (Archive::add_symbols): Change return type to bool.  Check return
12661         value of include_member.
12662         (Archive::include_all_members): Likewise.
12663         (Archive::include_member): Change return type to bool.  Return
12664         false if first included object has incompatible target.  Set
12665         included_member_ field.
12666         (Add_archive_symbols::run): If add_symbols returns false, requeue
12667         Read_symbols task.
12668         * archive.h (class Archive): Add included_member_ field.
12669         Initialize it in constructor.  Add input_file and searched_for
12670         methods.  Update declarations.
12671         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12672         input_argument_ fields.  Add them to constructor.  Change all
12673         callers.
12674         * script.cc: Include "target-select.h".
12675         (class Parser_closure): Add skip_on_incompatible_target_ and
12676         found_incompatible_target_ fields.  Add
12677         skip_on_incompatible_target parameter to constructor.  Change all
12678         callers.  Add methods skip_on_incompatible_target,
12679         clear_skip_on_incompatible_target, found_incompatible_target, and
12680         set_found_incompatible_target.
12681         (read_input_script): Add dirindex parameter.  Change all callers.
12682         If parser finds an incompatible target, requeue Read_symbols
12683         task.
12684         (script_set_symbol): Clear skip_on_incompatible_target in
12685         closure.
12686         (script_add_assertion, script_parse_option): Likewise.
12687         (script_start_sections, script_add_phdr): Likewise.
12688         (script_check_output_format): New function.
12689         * script.h (read_input_script): Update declaration.
12690         * script-c.h (script_check_output_format): Declare.
12691         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12692         (ignore_cmd): Remove OUTPUT_FORMAT.
12693         * fileread.cc (Input_file::Input_file): Add explicit this.
12694         (Input_file::will_search_for): New function.
12695         (Input_file::open): Add pindex parameter.  Change all callers.
12696         * fileread.h (class Input_file): Add input_file_argument method.
12697         Declare will_search_for.  Update declarations.
12698         * object.cc (make_elf_object): Add punconfigured parameter.
12699         Change all callers.
12700         * object.h (class Object): Make input_file public.  Add
12701         searched_for method.
12702         (make_elf_object): Update declaration.
12703         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12704         restart search.
12705         * dirsearch.h (class Dirsearch): Update declaration.
12706         * options.h (class General_options): Add --warn-search-mismatch.
12707         * parameters.cc (Parameters::is_compatible_target): New function.
12708         * parameters.h (class Parameters): Declare is_compatible_target.
12709         * workqueue.cc (Workqueue::add_blocker): New function.
12710         * workqueue.h (class Workqueue): Declare add_blocker.
12711
12712         * fileread.cc (Input_file::open): Remove options parameter.
12713         Change all callers.
12714         (Input_file::open_binary): Likewise.
12715         * script.cc (read_input_script): Likewise.
12716         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12717         options parameter from constructor.  Change all callers.
12718         (class Read_script): Likewise.
12719         * fileread.h (class Input_file): Update declarations.
12720         * script.h (read_input_script): Update declaration.
12721
12722 2009-03-10  Nick Clifton  <nickc@redhat.com>
12723
12724         * po/es.po: New Spanish translation.
12725
12726 2009-03-06  Cary Coutant  <ccoutant@google.com>
12727
12728         * options.cc (parse_short_option): Keep dash_z from registering itself.
12729
12730 2009-03-03  Ian Lance Taylor  <iant@google.com>
12731
12732         PR 9918
12733         * target-reloc.h (relocate_section): Pass output_section to
12734         relocate.
12735         * i386.cc (Target_i386::should_apply_static_reloc): Add
12736         output_section parameter.  Change all callers.
12737         (Target_i386::Relocate::relocate): Add output_section parameter.
12738         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12739         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12740         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12741         * testsuite/two_file_shared.sh: New script.
12742         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12743         (check_DATA): Add two_file_shared.dbg.
12744         (two_file_shared.dbg): New target.
12745         * testsuite/Makefile.in: Rebuild.
12746
12747 2009-03-01  Ian Lance Taylor  <iant@google.com>
12748
12749         * configure.ac: Check for byteswap.h.
12750         * configure: Rebuild.
12751         * config.in: Rebuild.
12752
12753 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12754
12755         * layout.cc (Layout::find_or_add_kept_section): New function.
12756         (Layout::add_comdat): Removed.
12757         * layout.h (struct Kept_section): Move out of class Layout.
12758         Remove trailing underscores from field names.  Add group_sections
12759         field.  Rename group_ field to is_group.  Change all uses.
12760         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12761         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12762         comdat_groups_ field.
12763         (Sized_relobj::include_section_group): Use
12764         find_or_add_kept_section and Kept_section::group_sections.
12765         (Sized_relobj::include_linkonce_section): Likewise.
12766         * object.cc (class Sized_relobj): Don't define Comdat_group or
12767         Comdat_group_table.  Remove find_comdat_group and
12768         add_comdat_group.  Remove comdat_groups_ field.
12769         * plugin.cc (include_comdat_group): Use
12770         Layout::find_or_add_kept_section.
12771
12772 2009-02-28  Ian Lance Taylor  <iant@google.com>
12773
12774         * README: --gc-sections and map files are now supported.  Document
12775         some build requirements.
12776
12777         PR 6992
12778         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12779         relocatable link set the value of the section symbol to zero.
12780         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12781         relocatable link don't include the section address in the local
12782         symbol value.
12783
12784 2009-02-27  Ian Lance Taylor  <iant@google.com>
12785
12786         PR 6811
12787         * options.h (class Search_directory): Add is_system_directory.
12788         (class General_options): Declare is_in_system_directory.
12789         * options.cc (get_relative_sysroot): Make static.
12790         (get_default_sysroot): Make static.
12791         (General_optoins::is_in_system_directory): New function.
12792         * fileread.cc (Input_file::is_in_system_directory): New function.
12793         * fileread.h (class Input_file): Declare is_in_system_directory.
12794         * object.h (class Object): Add is_in_system_directory.
12795         (class Input_objects): Remove system_library_directory_ field.
12796         * object.cc (Input_objects::add_object): Don't set
12797         system_library_directory_.
12798         (input_objects::found_in_system_library_directory): Remove.
12799         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12800         parameter.  Change all callers.
12801         (Symbol_table::sized_write_globals): Likewise.
12802         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12803         Call Object::is_in_system_directory.
12804         * symtab.h (class Symbol_table): Update declarations.
12805
12806         PR 5990
12807         * descriptors.h (Open_descriptor): Add is_on_stack field.
12808         * descriptors.cc (Descriptors::open): If the descriptor is on the
12809         top of the stack, remove it.  Initialize is_on_stack field.
12810         (Descriptors::release): Only add pod to stack if it is not on the
12811         stack already.
12812         (Descriptors::close_some_descriptor): Clear stack_next and
12813         is_on_stack fields.
12814
12815         PR 7091
12816         * output.cc (Output_section::find_starting_output_address): Rename
12817         from starting_output_address; add PADDR parameter; change return
12818         type.
12819         * output.h (class Output_section): Declare
12820         find_starting_output_address instead of starting_output_address.
12821         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12822         section symbol for which we can't find a merge section.
12823
12824         PR 9836
12825         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12826         hidden or internal, force the symbol to be local.
12827         * resolve.cc (Symbol::override_visibility): Define.
12828         (Symbol::override_base): Use override_visibility.
12829         (Symbol_table::resolve): Likewise.
12830         (Symbol::override_base_with_special): Likewise.
12831         (Symbol_table::override_with_special): If the visibility is hidden
12832         or internal, force the symbol to be local.
12833         * symtab.h (class Symbol): Add set_visibility and
12834         override_visibility.
12835         * testsuite/ver_test_1.sh: New file.
12836         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12837         (check_DATA): Add ver_test_1.syms.
12838         (ver_test_1.syms): New target.
12839         * testsuite/Makefile.in: Rebuild.
12840
12841 2009-02-25  Cary Coutant  <ccoutant@google.com>
12842
12843         * layout.cc (Layout::choose_output_section): Don't rename sections
12844         when using a linker script that has a SECTIONS clause.
12845         * Makefile.in: Regenerate.
12846
12847         * testsuite/Makefile.am (script_test_5.sh): New test case.
12848         * testsuite/Makefile.in: Regenerate.
12849         * testsuite/script_test_5.cc: New file.
12850         * testsuite/script_test_5.sh: New file.
12851         * testsuite/script_test_5.t: New file.
12852
12853 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12854
12855         * archive.cc (Archive::include_member): Update calls to add_symbols.
12856         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12857         the Layout argument.
12858         * dynobj.h (do_add_symbols): Add the Layout argument.
12859         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12860         Layout argument.
12861         * object.h (Object::add_symbols): Add the Layout argument.
12862         (Object::do_add_symbols): Add the Layout argument.
12863         (Sized_relobj::do_add_symbols): Add the Layout argument.
12864         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12865         Unify the two versions.
12866         (Add_plugin_symbols): Remove.
12867         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12868         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12869         (Add_plugin_symbols): Remove.
12870         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12871         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12872         (Add_symbols::run): Make it work with Pulginobj.
12873
12874 2009-02-06  Ian Lance Taylor  <iant@google.com>
12875
12876         * object.cc (Sized_relobj::do_layout): Make info message start
12877         with lower case letter.
12878
12879 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12880
12881         * binary.cc: Fix file comment.
12882
12883         * options.h (enum Incremental_disposition): Define.
12884         (class General_options): Add new options: --incremental,
12885         --incremental_changed, --incremental_unchanged,
12886         --incremental_unknown.  Add incremental_disposition_ and
12887         implicit_incremental_ fields.
12888         (General_options::incremental_disposition): New function.
12889         (class Position_dependent_options): Add incremental_disposition
12890         option.
12891         (Position_dependent_options::copy_from_options): Set incremental
12892         dispositions.
12893         * options.cc (General_options::parse_incremental_changed): New
12894         function.
12895         (General_options::parse_incremental_unchanged): New function.
12896         (General_options::parse_incremental_unknown): New function.
12897         (General_options::General_options): Initialize new fields
12898         incremental_disposition_ and implicit_incremental_.
12899         (General_options::finalize): Check for uasge of --incremental-*
12900         without --incremental.
12901
12902 2009-02-06  Chris Demetriou  <cgd@google.com>
12903
12904         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12905         pointer and to report location as the file name associated with
12906         the symbol.
12907         (gold_undefined_symbol_at_location): New function to replace the
12908         old gold_undefined_symbol functionality.
12909         * target-reloc.h (relocate_section): Update to use
12910         gold_undefined_symbol_at_location.
12911         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12912         Call gold_undefined_symbol function rather than gold_error.
12913         * errors.h (Errors::undefined_symbol): Take location as a
12914         string, rather than calculating it from a relocation.
12915         * errors.cc (Errors::fatal): Print "fatal error:" before the
12916         formatted message.
12917         (Errors::error, Errors::error_at_location): Print "error: "
12918         before the formatted message.
12919         (Errors::undefined_symbol): Take location as a string, rather
12920         than calculating it from a relocation.
12921         (gold_undefined_symbol_at_location): New function akin to
12922         old gold_undefined_symbol, calculates location from relocation.
12923         (gold_undefined_symbol): Change to take only a Symbol pointer
12924         and to report location as the file name associated with the symbol.
12925         * testsuite/debug_msg.sh: Update for changed error messages.
12926         * testsuite/undef_symbol.sh: Likewise.
12927
12928 2009-02-04  Duncan Sands  <baldrick@free.fr>
12929
12930         PR 9812
12931         * reduced_debug_output.h
12932         (Output_reduced_debug_abbrev_section::failed): Use format for
12933         gold_warning.
12934         (Output_reduced_debug_info_section::faild): Likewise.
12935
12936 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12937
12938         * script.cc (Lazy_demangler): New class.
12939         (Version_script_info::get_symbol_version_helper): Demangle a
12940         symbol only once.
12941
12942 2009-01-29  Cary Coutant  <ccoutant@google.com>
12943
12944         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12945         to __tls_get_addr.
12946         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12947
12948 2009-01-28  Ian Lance Taylor  <iant@google.com>
12949
12950         * version.cc (version_string): Bump to 1.9.
12951
12952         * gold.h: Include <cstring> and <stdint.h>.
12953         * version.cc: Include <cstdio>.
12954         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12955         warning.
12956         * reduced_debug_output.cc (insert_into_vector): Rename from
12957         Insert_into_vector; change all callers.  Use Swap_unaligned to
12958         avoid aliasing issue; remove union since it is unnecessary.
12959
12960 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12961
12962         * Makefile.am (CCFILES): Add gc.cc.
12963         (HFILES): Add gc.h.
12964         * Makefile.in: Regenerate.
12965         * gold.cc (Gc_runner): New class.
12966         (queue_initial_tasks): Call garbage collection related tasks
12967         when corresponding options are invoked.
12968         (queue_middle_gc_tasks): New function.
12969         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12970         processed early before laying out sections during garbage collection.
12971         * gold.h (queue_middle_gc_tasks): New function.
12972         (is_prefix_of): Move from "layout.cc".
12973         * i386.cc (Target_i386::gc_process_relocs): New function.
12974         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12975         * main.cc (main): Create object of class "Garbage_collection".
12976         * object.cc (Relobj::copy_symbols_data): New function.
12977         (Relobj::is_section_name_included): New function.
12978         (Sized_relobj::do_layout): Allow this function to be called twice
12979         during garbage collection and defer layout of section during the
12980         first call.
12981         * object.h (Relobj::get_symbols_data): New function.
12982         (Relobj::is_section_name_included): New function.
12983         (Relobj::copy_symbols_data): New function.
12984         (Relobj::set_symbols_data): New function.
12985         (Relobj::get_relocs_data): New function.
12986         (Relobj::set_relocs_data): New function.
12987         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12988         (Relobj::gc_process_relocs): New function.
12989         (Relobj::do_gc_process_relocs): New pure virtual function.
12990         (Relobj::sd_): New data member.
12991         (Sized_relobj::is_output_section_offset_invalid): New function.
12992         (Sized_relobj::do_gc_process_relocs): New function.
12993         * options.h (General_options::gc_sections): Modify to not be a no-op.
12994         (General_options::print_gc_sections): New option.
12995         * plugin.cc (Plugin_finish::run): Remove function call to
12996         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12997         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12998         * reloc.cc (Read_relocs::run): Add task to process relocs and
12999         determine unreferenced sections when doing garbage collection.
13000         (Gc_process_relocs): New class.
13001         (Sized_relobj::do_gc_process_relocs): New function.
13002         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13003         sections that are garbage collected.
13004         * reloc.h (Gc_process_relocs): New class.
13005         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13006         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13007         symbols whose corresponding sections are garbage collected.
13008         (Symbol_table::Symbol_table): Add new parameter for the garbage
13009         collection object.
13010         (Symbol_table::gc_mark_undef_symbols): New function.
13011         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13012         (Symbol_table::gc_mark_dyn_syms): New function.
13013         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13014         as garbage.
13015         (Symbol_table::add_from_object): Likewise.
13016         (Symbol_table::add_from_relobj): When building shared objects, do not
13017         treat externally visible symbols as garbage.
13018         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13019         table information for static and relocatable links.
13020         * symtab.h (Symbol_table::set_gc): New function.
13021         (Symbol_table::gc): New function.
13022         (Symbol_table::gc_mark_undef_symbols): New function.
13023         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13024         (Symbol_table::gc_mark_dyn_syms): New function.
13025         (Symbol_table::gc_): New data member.
13026         * target.h (Sized_target::gc_process_relocs): New pure virtual
13027         function.
13028         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13029         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13030
13031 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13032
13033         * options.h (General_options::gc_sections): Define as a no-op for now.
13034         (General_options::no_keep_memory): Ditto.
13035         (General_options::Bshareable): Define.
13036         * options.cc (General_options::finalize): Honor -Bshareable.
13037
13038 2009-01-20  Andreas Schwab  <schwab@suse.de>
13039
13040         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13041         read the value in the contents, since we don't use it.  Use the
13042         template endianness when writing.
13043         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13044
13045 2009-01-19  Andreas Schwab  <schwab@suse.de>
13046
13047         * configure.tgt (powerpc64-*): Fix targ_obj.
13048
13049 2009-01-15  Ian Lance Taylor  <iant@google.com>
13050
13051         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13052         local symbols when stripping all symbols.
13053
13054 2009-01-14  Cary Coutant  <ccoutant@google.com>
13055
13056         * output.cc (Output_reloc): Add explicit instantiations.
13057
13058 2009-01-14  Cary Coutant  <ccoutant@google.com>
13059
13060         * archive.cc (Archive::get_elf_object_for_member): Remove call
13061         to File_read::claim_for_plugin.
13062         * descriptors.cc (Descriptors::open): Remove reference to
13063         is_claimed.
13064         (Descriptors::claim_for_plugin): Remove.
13065         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13066         (Descriptors::is_claimed): Remove.
13067         (claim_descriptor_for_plugin): Remove.
13068         * fileread.cc (File_read::claim_for_plugin): Remove.
13069         * fileread.h (File_read::claim_for_plugin): Remove.
13070         (File_read::descriptor): Reopen descriptor if necessary.
13071         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13072         (Plugin_manager::all_symbols_read): Add task parameter. Change
13073         all callers.
13074         (Plugin_manager::get_input_file): New function.
13075         (Plugin_manager::release_input_file): New function.
13076         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13077         corresponding data member.
13078         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13079         and pass to base constructor. Change all callers.
13080         (get_input_file, release_input_file): New functions.
13081         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13082         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13083         (Plugin_manager::all_symbols_read): Add task parameter.
13084         (Plugin_manager::get_input_file): New function.
13085         (Plugin_manager::release_input_file): New function.
13086         (Plugin_manager::task_): New data member.
13087         (Pluginobj::Pluginobj): Add filesize parameter.
13088         (Pluginobj::filename): New function.
13089         (Pluginobj::descriptor): New function.
13090         (Pluginobj::filesize): New function.
13091         (Pluginobj::filesize_): New data member.
13092         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13093         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13094         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13095
13096         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13097         with archive libraries.
13098         * testsuite/Makefile.in: Regenerate.
13099         * testsuite/plugin_test.c (struct sym_info): New type.
13100         (get_input_file, release_input_file): New static variables.
13101         (onload): Capture new transfer vector entries.
13102         (claim_file_hook): Stop reading at end of file according to filesize.
13103         Factor out parsing of readelf output into separate function.
13104         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13105         APIs and get the source file name from the symbol table.  Convert
13106         source file name to corresponding object file name.  Print info
13107         message when adding new input files.
13108         (parse_readelf_line): New function.
13109         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13110         * testsuite/plugin_test_2.sh: Likewise.
13111         * testsuite/plugin_test_3.sh: Likewise.
13112         * testsuite/plugin_test_4.sh: New test case.
13113
13114 2009-01-07  Ian Lance Taylor  <iant@google.com>
13115
13116         * version.cc (version_string): Bump to 1.8.
13117
13118 2008-12-23  Cary Coutant  <ccoutant@google.com>
13119
13120         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13121         * plugin.cc (Plugin_manager::finish): Rename as
13122         layout_deferred_objects.  Move cleanup to separate function.
13123         (Plugin_manager::cleanup): New function.
13124         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13125         separately.
13126         * plugin.h (Plugin_manager::finish): Rename as
13127         layout_deferred_objects.
13128         (Plugin_manager::cleanup): New function.
13129         (Plugin_manager::cleanup_done): New field.
13130
13131 2008-12-23  Cary Coutant  <ccoutant@google.com>
13132
13133         * plugin.cc (is_visible_from_outside): New function.
13134         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13135         so we don't return "IR only" status for exported symbols or -r links.
13136
13137         * testsuite/Makefile.am (plugin_test_3): New test case.
13138         * testsuite/Makefile.in: Regenerate.
13139         * testsuite/plugin_test_3.sh: New file.
13140
13141 2008-12-22  Cary Coutant  <ccoutant@google.com>
13142
13143         * object.cc (Sized_relobj::layout_section): New function.
13144         (Sized_relobj::do_layout): Defer layout of input sections until after
13145         plugin has provided replacement files.
13146         (Sized_relobj::do_layout_deferred_sections): New function.
13147         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13148         (Relobj::layout_deferred_sections): New function.
13149         (Relobj::do_layout_deferred_sections): New function.
13150         (Sized_relobj::do_layout_deferred_sections): New function.
13151         (Sized_relobj::layout_section): New function.
13152         (Sized_relobj::Deferred_layout): New structure.
13153         (Sized_relobj::deferred_layout_): New field.
13154         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13155         Change all callers.  Layout deferred sections.
13156         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13157         references.
13158         (Plugin_hook::run): Move code from do_plugin_hook inline.
13159         (Plugin_hook::do_plugin_hook): Remove.
13160         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13161         (Plugin_manager::finish): Renamed, was cleanup.
13162         (Plugin_manager::should_defer_layout): New function.
13163         (Plugin_manager::add_deferred_layout_object): New function.
13164         (Plugin_manager::Deferred_layout_list): New type.
13165         (Plugin_manager::deferred_layout_objects_): New field.
13166         (Plugin_hook::do_plugin_hook): Remove.
13167
13168 2008-12-17  Ian Lance Taylor  <iant@google.com>
13169
13170         * options.h (class General_options): Add --no case for
13171         --export-dynamic.
13172
13173 2008-12-16  Cary Coutant  <ccoutant@google.com>
13174
13175         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13176         vector.
13177         (Plugin_manager::claim_file): Create plugin object even if
13178         plugin did not call the add_symbols callback.
13179         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13180         asking for more symbols than were added.
13181         * testsuite/Makefile.am (plugin_test_1): Add test case with
13182         no global symbols.
13183         (empty.syms): New target.
13184         * testsuite/Makefile.in: Regenerate.
13185         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13186         message. Don't call add_symbols if no globals.
13187         (all_symbols_read_hook): Don't provide replacement for empty
13188         claimed file.
13189
13190 2008-12-12  Ian Lance Taylor  <iant@google.com>
13191
13192         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13193         r_type == 0 for a local symbol with r_sym == 0.
13194         (scan_relocatable_relocs): Pass r_sym to
13195         local_non_section_strategy.
13196         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13197         r_sym parameter.
13198
13199         * configure.ac: Update test for TLS descriptors: they are
13200         supported as of glibc 2.9.
13201         * configure: Rebuild.
13202
13203 2008-12-11  Ian Lance Taylor  <iant@google.com>
13204
13205         PR 7091
13206         * target-reloc.h (Default_scan_relocatable_relocs): For each
13207         function, map r_type == 0 to RELOC_DISCARD.
13208
13209 2008-12-10  Cary Coutant  <ccoutant@google.com>
13210
13211         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13212         object to override a kept COMDAT group from a plugin object.
13213
13214 2008-12-09  Ian Lance Taylor  <iant@google.com>
13215
13216         PR 7088
13217         * yyscript.y (file_cmd): Handle INPUT.
13218
13219         * testsuite/initpri1.c: Change all declarations to be full
13220         prototypes by adding void, to avoid compiler warnings.
13221
13222 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13223
13224         * options.cc (General_options::parse_plugin_opt): New.
13225         (General_options::add_plugin): The argument now is just the filename.
13226         (General_options::add_plugin_option): New.
13227         * options.h (plugin_opt): New.
13228         (add_plugin): Change argument name.
13229         (add_plugin_option): New.
13230         * plugin.cc (Plugin::load): Don't parse the plugin option.
13231         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13232         (Plugin::add_option): New.
13233         (Plugin::args_): Change type.
13234         (Plugin::filename_): New.
13235         (Plugin_manager::add_plugin_option): New.
13236         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13237         * testsuite/Makefile.in: Regenerate.
13238
13239 2008-12-05  Cary Coutant  <ccoutant@google.com>
13240
13241         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13242         Handle --strip-lto-sections option.
13243         * options.h (strip_lto_sections): New option.
13244
13245 2008-12-01  Cary Coutant  <ccoutant@google.com>
13246
13247         * plugin.cc (ld_plugin_message): Change format parameter to const.
13248         Fix mismatch between new[] and delete.
13249
13250 2008-11-14  Cary Coutant  <ccoutant@google.com>
13251
13252         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13253         instead of -1U.
13254
13255 2008-11-05  Craig Silverstein  <csilvers@google.com>
13256
13257         * options.cc (General_options::parse_dynamic_list): New function.
13258         * options.h (General_options): New flags dynamic_list,
13259         dynamic_list_data, dynamic_list_cpp_new, and
13260         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13261         (General_options::in_dynamic_list): New function.
13262         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13263         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13264         (Lex::can_continue_name): Likewise.
13265         (yylex): Likewise.
13266         (read_script_file): New parameter script_options.
13267         (read_dynamic_list): New function.
13268         (Script_options::define_dynamic_list): New function.
13269         (dynamic_list_keyword_parsecodes): New variable.
13270         (dynamic_list_keywords): New variable.
13271         * script.h (Script_options::define_dynamic_list): New function
13272         prototype.
13273         (read_dynamic_list): New function prototype.
13274         * symtab.cc (strprefix): New macro.
13275         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13276         dynamic_list_data, dynamic_list_cpp_new, and
13277         dynamic_list_cpp_typeinfo.
13278         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13279         (dynamic_list_expr): New rule.
13280         (dynamic_list_nodes): Likewise.
13281         (dynamic_list_node): Likewise.
13282         * testsuite/Makefile.am (dynamic_list): New test.
13283         * testsuite/Makefile.in: Regenerated.
13284         * testsuite/dynamic_list.t: New file.
13285         * testsuite/dynamic_list.sh: New file.
13286
13287 2008-11-05  Craig Silverstein  <csilvers@google.com>
13288
13289         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13290         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13291         (t11_last): Likewise.
13292         * testsuite/ver_test_6.c (main): Likewise.
13293
13294 2008-10-07  Cary Coutant  <ccoutant@google.com>
13295
13296         * options.c (General_options::finalize): Add check for -static and
13297         -shared.
13298         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13299         is not empty.
13300
13301 2008-10-02  Cary Coutant  <ccoutant@google.com>
13302
13303         * plugin.cc (make_sized_plugin_object): Fix conditional
13304         compilation to work when not all targets are enabled.
13305
13306 2008-09-29  Cary Coutant  <ccoutant@google.com>
13307
13308         * archive.cc (Archive::get_file_and_offset): Use filename instead
13309         of name to get library path.
13310         (Archive::include_member): Unlock external member of a thin archive.
13311
13312         * testsuite/Makefile.am (TEST_AR): New variable.
13313         (thin_archive_test_1): New test.
13314         (thin_archive_test_2): New test.
13315         * testsuite/Makefile.in: Regenerate.
13316         * testsuite/thin_archive_main.cc: New file.
13317         * testsuite/thin_archive_test_1.cc: New file.
13318         * testsuite/thin_archive_test_2.cc: New file.
13319         * testsuite/thin_archive_test_3.cc: New file.
13320         * testsuite/thin_archive_test_4.cc: New file.
13321
13322 2008-09-29  Cary Coutant  <ccoutant@google.com>
13323
13324         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13325         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13326         instead of -1U.
13327         (Sized_relobj::do_finalize_local_symbols): Likewise.
13328         (Sized_relobj::map_to_kept_section): Likewise.
13329         * object.h (Sized_relobj::invalid_address): New constant.
13330         (Sized_relobj::do_output_section_offset): Check for invalid_address
13331         and return -1ULL.
13332         * output.cc (Output_reloc::local_section_offset): Use constant
13333         invalid_address instead of -1U.
13334         (Output_reloc::get_address): Likewise.
13335         (Output_section::output_address): Change -1U to -1ULL.
13336         * output.h (Output_reloc::invalid_address): New constant.
13337         * reloc.cc (Sized_relobj::write_sections): Use constant
13338         invalid_address instead of -1U.
13339         (Sized_relobj::relocate_sections): Likewise.
13340         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13341         values for merge sections.
13342         * target-reloc.h (relocate_for_relocatable): Use constant
13343         invalid_address instead of -1U.
13344
13345 2008-09-19  Cary Coutant  <ccoutant@google.com>
13346
13347         Add plugin functionality for link-time optimization (LTO).
13348         * configure.ac (plugins): Add --enable-plugins option.
13349         * configure: Regenerate.
13350         * config.in: Regenerate.
13351         * Makefile.am (LIBDL): New variable.
13352         (CCFILES): Add plugin.cc.
13353         (HFILES): Add plugin.h.
13354         (ldadd_var): Add LIBDL.
13355         * Makefile.in: Regenerate.
13356
13357         * archive.cc: Include "plugin.h".
13358         (Archive::setup): Don't preread archive symbols when using a plugin.
13359         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13360         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13361         files.
13362         (Archive::include_member): Add symbols from plugin objects.
13363         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13364         * descriptors.cc (Descriptors::open): Check for file descriptors
13365         abandoned by plugins.
13366         (Descriptors::claim_for_plugin): New function.
13367         * descriptors.h (Descriptors::claim_for_plugin): New function.
13368         (Open_descriptor::is_claimed): New field.
13369         (claim_descriptor_for_plugin): New function.
13370         * fileread.cc (File_read::claim_for_plugin): New function.
13371         * fileread.h (File_read::claim_for_plugin): New function.
13372         (File_read::descriptor): New function.
13373         * gold.cc: Include "plugin.h".
13374         (queue_initial_tasks): Add task to call plugin hooks for generating
13375         new object files.
13376         * main.cc: Include "plugin.h".
13377         (main): Load plugin libraries.
13378         * object.h (Pluginobj): Declare.
13379         (Object::pluginobj): New function.
13380         (Object::do_pluginobj): New function.
13381         (Object::set_target): New function.
13382         * options.cc: Include "plugin.h".
13383         (General_options::parse_plugin): New function.
13384         (General_options::General_options): Initialize plugins_ field.
13385         (General_options::add_plugin): New function.
13386         * options.h (Plugin_manager): Declare.
13387         (General_options): Add --plugin option.
13388         (General_options::has_plugins): New function.
13389         (General_options::plugins): New function.
13390         (General_options::add_plugin): New function.
13391         (General_options::plugins_): New field.
13392         * plugin.cc: New file.
13393         * plugin.h: New file.
13394         * readsyms.cc: Include "plugin.h".
13395         (Read_symbols::do_read_symbols): Check for archive before checking
13396         for ELF file.  Call plugin hooks to claim files.
13397         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13398         from a real object file; force override when processing replacement
13399         files.
13400         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13401         (Symbol::init_base_object): Likewise.
13402         (Symbol::init_base_output_data): Likewise.
13403         (Symbol::init_base_output_segment): Likewise.
13404         (Symbol::init_base_constant): Likewise.
13405         (Symbol::init_base_undefined): Likewise.
13406         (Symbol::output_section): Assert that object is not a plugin.
13407         (Symbol_table::add_from_pluginobj): New function.
13408         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13409         undefined.
13410         (Symbol_table::sized_write_globals): Likewise.
13411         (Symbol_table::add_from_pluginobj): Instantiate template.
13412         * symtab.h (Sized_pluginobj): Declare.
13413         (Symbol::in_real_elf): New function.
13414         (Symbol::set_in_real_elf): New function.
13415         (Symbol::in_real_elf_): New field.
13416         (Symbol_table::add_from_pluginobj): New function.
13417
13418         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13419         (LIBDL): New variable.
13420         (LDADD): Add LIBDL.
13421         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13422         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13423         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13424         (MOSTLYCLEANFILES): Likewise.
13425         * testsuite/Makefile.in: Regenerate.
13426         * testsuite/plugin_test.c: New file.
13427         * testsuite/plugin_test_1.sh: New file.
13428         * testsuite/plugin_test_2.sh: New file.
13429
13430 2008-09-16  Ian Lance Taylor  <iant@google.com>
13431
13432         * target-reloc.h (relocate_section): Check whether a symbol is
13433         defined by the ABI before reporting an undefined symbol error.
13434         * target.h (Target::is_defined_by_abi): Make parameter const.
13435         (Target::do_is_defined_by_abi): Likewise.
13436         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13437         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13438         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13439         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13440         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13441         * testsuite/Makefile.in: Rebuild.
13442
13443         * fileread.cc (make_view): Add casts to avoid warning.
13444
13445 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13446
13447         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13448         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13449
13450 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13451
13452         * options.h (General_options::output_is_executable): New.
13453         (General_options::output_is_pie): New.
13454         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13455         for shared libraries.
13456         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13457
13458 2008-09-11  Chris Demetriou  <cgd@google.com>
13459
13460         * options.h (origin): New -z option.
13461         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13462         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13463         in DT_FLAGS_1.
13464
13465 2008-09-05  Cary Coutant  <ccoutant@google.com>
13466
13467         * fileread.cc (File_read::make_view): Add check for attempt to map
13468         beyond end of file.
13469
13470 2008-09-05  Cary Coutant  <ccoutant@google.com>
13471
13472         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13473         explicit instantiations.
13474
13475 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13476
13477         PR gold/6858
13478         * options.cc (General_options::finalize): Allow undefined symbols
13479         in shlibs if linking -shared.
13480
13481         PR gold/6859
13482         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13483         symbols as not needing a dynsym entry.
13484
13485 2008-08-20  Craig Silverstein  <csilvers@google.com>
13486
13487         * fileread.cc (File_read::open): Do not lock the file unless it
13488         was successfully opened.
13489
13490 2008-08-14  Cary Coutant  <ccoutant@google.com>
13491
13492         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13493         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13494         * testsuite/tls_test.cc (struct int128): 128-bit struct
13495         for testing TLS relocs with non-zero addend.
13496         (v12): New TLS variable.
13497         (t12): New test.
13498         (t_last): Add check for v12.
13499         * testsuite/tls_test.h (t12): New function.
13500         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13501
13502 2008-08-13  Ian Lance Taylor  <iant@google.com>
13503
13504         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13505         set tls_segment_ or relro_segment_.
13506         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13507         when appropriate.
13508         * output.h (Output_section::clear_is_relro): New function.
13509         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13510         sections specially even when output_data_ is empty.
13511         (Output_segment::maximum_alignment): When first section is relro,
13512         only force alignment for PT_LOAD segments.
13513         * script.cc (script_data_segment_align): New function.
13514         (script_data_segment_relro_end): New function.
13515         * script-c.h (script_data_segment_align): Declare.
13516         (script_data_segment_relro_end): Declare.
13517         * script-sections.h (class Script_sections): Declare
13518         data_segment_align and data_segment_relro_end.  Add fields
13519         segment_align_index_ and saw_relro_end_.
13520         * script-sections.cc (class Sections_element): Add set_is_relro
13521         virtual function.  Add new bool* parameter to place_orphan_here.
13522         Add get_output_section virtual function.
13523         (class Output_section_definition): Add set_is_relro.  Add new
13524         bool* parameter to place_orphan_here.  Add get_output_section.
13525         Add is_relro_ field.
13526         (Output_section_definition::Output_section_definition): Initialize
13527         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13528         and is_relro_ fields.
13529         (Output_section_definition::place_orphan_here): Add is_relro
13530         parameter.
13531         (Output_section_definition::set_section_addresses): Set relro for
13532         output section.
13533         (Output_section_definition::alternate_constraint): Likewise.
13534         (class Orphan_output_section): Add new bool* parameter to
13535         place_orphan_here.  Add get_output_section.
13536         (Orphan_output_section::place_orphan_here): Add is_relro
13537         parameter.
13538         (Script_sections::Script_sections): Initialize
13539         data_segment_align_index_ and saw_relro_end_.
13540         (Script_sections::data_segment_align): New function.
13541         (Script_sections::data_segment_relro_end): New function.
13542         (Script_sections::place_orphan): Set or clear is_relro.
13543         (Script_sections::set_section_addresses): Force alignment of first
13544         TLS section.
13545         * yyscript.y (exp): Call script_data_segment_align and
13546         script_data_segment_relro_end.
13547         * testsuite/relro_script_test.t: New file.
13548         * testsuite/relro_test.cc (using_script): Declare.
13549         (t1, t2): Test using_script.
13550         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13551         (relro_script_test_SOURCES): Define.
13552         (relro_script_test_DEPENDENCIES): Define.
13553         (relro_script_test_LDFLAGS): Define.
13554         (relro_script_test_LDADD): Define.
13555         (relro_script_test.so): New target.
13556         * testsuite/Makefile.in: Rebuild.
13557
13558 2008-08-06  Cary Coutant <ccoutant@google.com>
13559
13560         * archive.cc (Archive::total_archives, Archive::total_members)
13561         (Archive::total_members_loaded): New variables.
13562         (Archive::setup): Add parameter.  Add option to preread
13563         archive symbols.
13564         (Archive::read_armap): Add counter.
13565         (Archive::get_file_and_offset): New function.
13566         (Archive::get_elf_object_for_member): New function.
13567         (Archive::read_all_symbols): New function.
13568         (Archive::read_symbols): New function.
13569         (Archive::add_symbols): Add counters.
13570         (Archive::include_all_members): Use armap to find members if it's
13571         already built.
13572         (Archive::include_member): Skip reading symbols if already read.
13573         Factored code into Archive::get_file_and_offset and
13574         Archive::get_elf_object_for_member.  Changed call to
13575         Mapfile::report_include_archive_member.
13576         (Archive::print_stats): New function.
13577         * archive.h: Declare Object and Read_symbols_data classes.
13578         (Archive::Archive): Add initializers for new members.
13579         (Archive::setup): Add parameter.
13580         (Archive::print_stats): New function.
13581         (Archive::total_archives, Archive::total_members)
13582         (Archive::total_members_loaded): New variables.
13583         (Archive::get_file_and_offset): New function.
13584         (Archive::get_elf_object_for_member): New function.
13585         (Archive::read_all_symbols): New function.
13586         (Archive::read_symbols): New function.
13587         (Archive::Archive_member): New class.
13588         (Archive::members_): New member.
13589         (Archive::num_members_): New member.
13590         * main.cc: Include archive.h.
13591         (main): Call Archive::print_stats.
13592         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13593         archive parameter; member_name is now the fully-decorated name.
13594         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13595         * options.h: (General_options): Add --preread-archive-symbols option.
13596         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13597         Archive::setup.
13598
13599 2008-08-04  Ian Lance Taylor  <iant@google.com>
13600
13601         * symtab.h (Symbol::use_plt_offset): New function.
13602         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13603         * powerpc.cc (Relocate::relocate): Likewise.
13604         * sparc.cc (Relocate::relocate): Likewise.
13605         * x86_64.cc (Relocate::relocate): Likewise.
13606         * testsuite/weak_plt.sh: New test.
13607         * testsuite/weak_plt_main.cc: New test.
13608         * testsuite/weak_plt_shared.cc: New test.
13609         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13610         (check_PROGRAMS): Add weak_plt.
13611         (check_DATA): Add weak_plt_shared.so.
13612         (weak_plt_main_pic.o, weak_plt): New targets.
13613         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13614         * testsuite/Makefile.in: Rebuild.
13615
13616         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13617         gcctestdir/ld.
13618         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13619         * testsuite/Makefile.in: Rebuild.
13620
13621 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13622
13623         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13624         * Makefile.in: Regenerate.
13625         * po/POTFILES.in: Regenerate.
13626
13627 2008-07-29  Ian Lance Taylor  <iant@google.com>
13628
13629         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13630         symbols before other symbols.
13631         * testsuite/script_test_2.cc (test_addr): Declare.
13632         (test_addr_alias): Declare.
13633         (main): Check that test_addr and test_addr_alias have the right
13634         values.
13635         * testsuite/script_test_2.t: Define test_addr_alias and
13636         test_addr.
13637
13638 2008-07-24  Ian Lance Taylor  <iant@google.com>
13639
13640         PR 5990
13641         * descriptors.cc: New file.
13642         * descriptors.h: New file.
13643         * gold-threads.h (class Hold_optional_lock): New class.
13644         * fileread.cc: Include "descriptors.h".
13645         (File_read::~File_read): Release descriptor rather than closing
13646         it.
13647         (File_read::open) [file]: Call open_descriptor rather than open.
13648         Set is_descriptor_opened_.
13649         (File_read::open) [memory]: Assert that descriptor is not open.
13650         (File_read::reopen_descriptor): New function.
13651         (File_read::release): Release descriptor.
13652         (File_read::do_read): Make non-const.  Reopen descriptor.
13653         (File_read::read): Make non-const.
13654         (File_read::make_view): Reopen descriptor.
13655         (File_read::do_readv): Likewise.
13656         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13657         Update declarations.
13658         * layout.cc: Include "descriptors.h".
13659         (Layout::create_build_id): Use open_descriptor rather than open.
13660         * output.cc: Include "descriptors.h".
13661         (Output_file::open): Use open_descriptor rather than open.
13662         * archive.cc (Archive::const_iterator): Change Archive to be
13663         non-const.
13664         (Archive::begin, Archive::end): Make non-const.
13665         (Archive::count_members): Likewise.
13666         * archive.h (class Archive): Update declarations.
13667         * object.h (Object::read): Make non-const.
13668         * Makefile.am (CCFILES): Add descriptors.cc.
13669         (HFILES): Add descriptors.h.
13670         * Makefile.in: Rebuild.
13671
13672         PR 6716
13673         * gold.h: Always include <clocale>.  Add Solaris workarounds
13674         following code in binutils/sysdep.h.
13675
13676         PR 6048
13677         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13678         this->eh_frame_hdr_ is NULL before using it.
13679
13680         * dynobj.cc (Versions::Versions): Update comment.
13681
13682         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13683         the base version name.
13684
13685         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13686         array size plus one.
13687         (Stringpool_template::set_string_offsets): Subtract one from key
13688         before using it as an array index.
13689         (Stringpool_template::get_offset_with_length): Likewise.
13690         (Stringpool_template::write_to_buffer): Likewise.
13691         * stringpool.h (Stringpool_template::get_offset_from_key):
13692         Likewise.
13693
13694 2008-07-23  Ian Lance Taylor  <iant@google.com>
13695
13696         PR 6658
13697         * object.h (Merged_symbol_value::value): Do our best to handle a
13698         negative addend.
13699
13700         PR 6647
13701         * script.cc (Version_script_info::get_versions): Don't add empty
13702         version tag to return value.
13703         (Version_script_info::get_symbol_version_helper): Change return
13704         type to bool.  Add pversion parameter.  Change all callers.
13705         (script_register_vers_node): Don't require a non-NULL tag.
13706         * script.h (class Version_script_info): Update declarations.
13707         (Version_script_info::get_symbol_version): Change return type to
13708         bool.  Add version parameter.  Change all callers.
13709         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13710         handling.  Handle an empty version from a version script.
13711         (Symbol_table::define_special_symbol): Likewise.
13712         * testsuite/ver_test_10.script: New file.
13713         * testsuite/ver_test_10.sh: New file.
13714         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13715         (check_DATA): Add ver_test_10.syms.
13716         (ver_test_10.syms, ver_test_10.so): New target.
13717         * testsuite/Makefile.in: Rebuild.
13718
13719 2008-07-23  Simon Baldwin  <simonb@google.com>
13720
13721         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13722         to zero for undefined symbols from dynamic libraries.
13723
13724 2008-07-23  Ian Lance Taylor  <iant@google.com>
13725
13726         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13727         Change all callers.
13728         * symtab.h (class Symbol_table): Update declaration.
13729         * testsuite/ver_test_9.cc: New file.
13730         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13731         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13732         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13733         (ver_test_9.so, ver_test_9.o): New targets.
13734         * testsuite/Makefile.in: Rebuild.
13735
13736 2008-07-22  Ian Lance Taylor  <iant@google.com>
13737
13738         * options.h (class General_options): Define --check-sections.
13739         * layout.cc (Layout::set_segment_offsets): Handle
13740         --check-sections.
13741
13742         * options.h (class General_options): Define -n/--nmagic and
13743         -N/--omagic.
13744         * options.cc (General_options::finalize): For -n/--nmagic or
13745         -N/--omagic, set -static.
13746         * layout.cc (Layout::attach_allocated_section_to_segment): If
13747         -N/--omagic, don't put read-only and read-write sections in
13748         different segments.
13749         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13750         finding a read-only segment.
13751         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13752         don't set the minimum segment alignment to the common page size,
13753         and don't set the file offset to the address modulo the page size.
13754         * script-sections.cc (Script_sections::create_segments): If
13755         -n/--omagic, don't put read-only and read-write sections in
13756         different segments.
13757
13758         * cref.cc: New file.
13759         * cref.h: New file.
13760         * options.h (class General_options): Add --print-symbol-counts.
13761         * main.cc (main): Issue defined symbol report if requested.
13762         * archive.cc (Archive::interpret_header): Make into a const member
13763         function.
13764         (Archive::add_symbols): Call Input_objects::archive_start and
13765         archive_stop.
13766         (Archive::const_iterator): Define new class.
13767         (Archive::begin, Archive::end): New functions.
13768         (Archive::include_all_members): Rewrite to use iterator.
13769         (Archive::count_members): New function.
13770         * archive.h (class Archive): Update declarations.
13771         (Archive::filename): New function.
13772         * object.cc: Include "cref.h".
13773         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13774         (Sized_relobj::do_get_global_symbol_counts): New function.
13775         (Input_objects::add_object): Add object to cross-referencer.
13776         (Input_objects::archive_start): New function.
13777         (Input_objects::archive_stop): New function.
13778         (Input_objects::print_symbol_counts): New function.
13779         * object.h: Declare Cref and Archive.
13780         (Object::get_global_symbol_counts): New function.
13781         (Object::do_get_global_symbol_counts): New pure virtual function.
13782         (class Sized_relobj): Add defined_count_ field.  Update
13783         declarations.
13784         (class Input_objects): Add cref_ field.  Update constructor.
13785         Update declarations.
13786         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13787         defined_count_.
13788         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13789         symbol counts.
13790         (Sized_dynobj::do_get_global_symbol_counts): New function.
13791         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13792         defined_count_.  Update declarations.  Define Symbols typedef.
13793         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13794         parameter.  Change all callers.
13795         (Symbol_table::add_from_dynobj): Add sympointers and defined
13796         parameters.  Change all callers.
13797         * symtab.h (class Symbol_table): Update declarations.
13798         * Makefile.am (CCFILES): Add cref.cc.
13799         (HFILES): Add cref.h.
13800         * Makefile.in: Rebuild.
13801
13802 2008-07-22  Simon Baldwin  <simonb@google.com>
13803
13804         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13805         to zero when writing undefined symbols.
13806
13807 2008-07-22  Ian Lance Taylor  <iant@google.com>
13808
13809         * output.cc (Output_section::add_input_section): Don't try to
13810         merge empty merge sections.
13811
13812 2008-07-21  Craig Silverstein  <csilvers@google.com>
13813
13814         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13815         Include symbol version in error message.
13816
13817 2008-07-20  Chris Demetriou  <cgd@google.com>
13818
13819         * configure.ac (gold_cv_c_random_seed): New configured variable.
13820         (RANDOM_SEED_CFLAGS): New substituted variable.
13821         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13822         * configure: Rebuild.
13823         * Makefile.in: Likewise.
13824         * testsuite/Makefile.in: Likewise.
13825
13826 2008-07-18  Ian Lance Taylor  <iant@google.com>
13827
13828         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13829         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13830         * testsuite/ver_test_main.cc (main): Call t4.
13831         (t4, t4_2a): Define.
13832         * testsuite/ver_test_2.cc (t4_2): Define.
13833         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13834         * testsuite/ver_test_4.cc (t4_2a): Define.
13835         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13836         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13837
13838 2008-07-17  Ian Lance Taylor  <iant@google.com>
13839
13840         * dynobj.cc (Versions::add_def): If we give an error about a
13841         missing version, go ahead and create the version anyhow.
13842
13843 2008-07-10  Ian Lance Taylor  <iant@google.com>
13844
13845         Handle output sections with more than 0x7fffffff bytes.
13846         * object.h (class Relobj): Change map_to_output_ to
13847         output_sections_, and just keep a section pointer.  Change all
13848         uses.  Move comdat group support to Sized_relobj.
13849         (Relobj::is_section_specially_mapped): Remove.
13850         (Relobj::output_section): Remove poff parameter.  Change all
13851         callers.
13852         (Relobj::output_section_offset): New function.
13853         (Relobj::set_section_offset): Rewrite.
13854         (Relobj::map_to_output): Remove.
13855         (Relobj::output_sections): New function.
13856         (Relobj::do_output_section_offset): New pure virtual function.
13857         (Relobj::do_set_section_offset): Likewise.
13858         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13859         group support from Relobj.  Update declarations.
13860         (Sized_relobj::get_output_section_offset): New function.
13861         (Sized_relobj::do_output_section_offset): New function.
13862         (Sized_relobj::do_set_section_offset): New function.
13863         * object.cc (Relobj::output_section_address): Remove.
13864         (Sized_relobj::Sized_relobj): Initialize new fields.
13865         (Sized_relobj::include_section_group): Cast find_kept_object to
13866         Sized_relobj.
13867         (Sized_relobj::include_linkonce_section): Likewise.
13868         (Sized_relobj::do_layout): Use separate arrays for output section
13869         and output offset.
13870         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13871         output_sections.
13872         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13873         output_sections and section_offsets.
13874         (Sized_relobj::write_local_symbols): Likewise.
13875         (map_to_kept_section): Compute output address directly.
13876         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13877         output_sections and section_offsets.
13878         (Sized_relobj::write_sections): Likewise.
13879         (Sized_relobj::relocate_sections): Likewise.
13880         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13881         * output.h (class Output_reloc): Update declarations.  Change
13882         u2_.relobj to Sized_relobj*.
13883         (class Output_data_reloc): Change add functions to use
13884         Sized_relobj*.
13885         * output.cc (Output_reloc::Output_reloc): Change relobj to
13886         Sized_relobj*.
13887         (Output_reloc::local_section_offset): Change return type to
13888         Elf_Addr.  Use get_output_section_offset.
13889         (Output_reloc::get_address): Likewise.
13890         (Output_section::is_input_address_mapped): Don't call
13891         is_section_specially_mapped.
13892         (Output_section::output_offset): Likewise.
13893         (Output_section::output_address): Likewise.
13894         (Output_section::starting_output_address): Likewise.
13895         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13896         parameter to Sized_relobj*.
13897         (Copy_relocs::need_copy_reloc): Likewise.
13898         (Copy_relocs::save): Likewise.
13899         * copy-relocs.h (class Copy_relocs): Update declarations.
13900         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13901         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13902         * target-reloc.h (relocate_for_relocatable): Change
13903         offset_in_output_section type to Elf_Addr.  Change code that uses
13904         it as well.
13905         * layout.cc (Layout::layout): Always set *off.
13906         * mapfile.cc (Mapfile::print_input_section): Use
13907         output_section_offset.
13908         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13909         Sized_relobj*.
13910         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13911         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13912         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13913
13914 2008-07-03  Ian Lance Taylor  <iant@google.com>
13915
13916         * layout.cc (Layout::include_section): Do not discard unrecognized
13917         SHT_STRTAB sections.
13918
13919 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13920
13921         * script.cc (Lex::can_continue_name): Make '?' allowable in
13922         version-script names.
13923         * testsuite/version_script.map: Change glob pattern to use '?'
13924
13925 2008-06-30  Manish Singh  <yosh@gimp.org>
13926
13927         PR 6585
13928         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13929         Correct typo.
13930
13931 2008-06-30  Ian Lance Taylor  <iant@google.com>
13932
13933         PR 6660
13934         PR 6682
13935         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13936         versions]: Don't try to read the value in the contents, since we
13937         don't use it.  Use the template endianness when writing.
13938
13939 2008-06-25  Cary Coutant  <ccoutant@google.com>
13940
13941         * fileread.cc (File_read::make_view): Assert on zero-length view.
13942         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13943         symbol table when there are no symbols to read.
13944
13945 2008-06-23  Craig Silverstein  <csilvers@google.com>
13946
13947         * version.cc (version_string): Bump to 1.7
13948
13949 2008-06-18  Craig Silverstein  <csilvers@google.com>
13950
13951         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13952         constant 0xFFFF to type Valtype.
13953         (Powerpc_relocate_functions::rel16_ha): Likewise.
13954
13955 2008-06-17  Ian Lance Taylor  <iant@google.com>
13956
13957         * output.h (Output_section::Input_section): Initialize p2align_ to
13958         zero for Output_section_data constructors.
13959         (Output_section::Input_section::addralign): If not an input
13960         section, return the alignment of the Output_section_data.
13961         * testsuite/copy_test.cc: New file.
13962         * testsuite/copy_test_1.cc: New file.
13963         * testsuite/copy_test_2.cc: New file.
13964         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13965         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13966         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13967         (copy_test_1_pic.o, copy_test_1.so): New targets.
13968         (copy_test_2_pic.o, copy_test_2.so): New targets.
13969         * testsuite/Makefile.in: Rebuild.
13970
13971         * script-sections.cc (Script_sections::place_orphan): Initialize
13972         local variable exact.
13973
13974 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13975
13976         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13977
13978 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13979             David S. Miller  <davem@davemloft.net>
13980
13981         * powerpc.cc: New file.
13982         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13983         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13984         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13985         * Makefile.in: Rebuild.
13986
13987 2008-06-09  Ian Lance Taylor  <iant@google.com>
13988
13989         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13990         <exception>.
13991         (throwing, orig_terminate): New static variables.
13992         (terminate_handler): New static function.
13993         (t2): Set terminate handler.
13994
13995 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13996
13997         PR 6584
13998         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13999         alignment.
14000
14001 2008-05-30  Cary Coutant  <ccoutant@google.com>
14002
14003         * archive.cc (Archive::include_all_members) Correct to step
14004         over symbol table and extended name table in thin archives.
14005
14006 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14007
14008         PR 6407
14009         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14010         calculation.
14011
14012 2008-05-28  Caleb Howe  <cshowe@google.com>
14013
14014         * reduced_debug_output.cc: New file.
14015         * reduced_debug_output.h: New file.
14016         * options.h (class General_options): Add --strip-debug-non-line.
14017         * options.cc (General_options::finalize): Add strip_debug_non_line
14018         to the strip heirarchy.
14019         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14020         fields.
14021         * layout.cc: Include "reduced_debug_output.h".
14022         (Layout::Layout): Initialize new fields.
14023         (line_only_debug_sections): New static array.
14024         (is_lines_only_debug_sections): New static inline function.
14025         (Layout::include_section): Handle --strip-debug-non-line.
14026         (Layout::make_output_section): If --strip-debug-non-line, build
14027         new output sections for .debug_abbrev and .debug_info.
14028         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14029         gold.  Warn about possible overflow.
14030         (read_signed_LEB_128): Likewise.
14031         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14032         (read_signed_LEB_128): Declare.
14033         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14034         (HFILES): Add reduced_debug_output.h.
14035         * Makefile.in: Rebuild.
14036
14037 2008-05-21  Ian Lance Taylor  <iant@google.com>
14038
14039         * mapfile.cc: New file.
14040         * mapfile.h: New file.
14041         * options.h (class General_options): Add -M/--print-map and -Map.
14042         * options.cc (General_options::finalize): Make -M equivalent to
14043         -Map -.
14044         * main.cc: Include <cstdio> and "mapfile.h".
14045         (main): Open mapfile if requested.
14046         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14047         constructor.  Change caller.
14048         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14049         (queue_middle_tasks): Likewise.
14050         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14051         declarations.
14052         * archive.cc: Include "mapfile.h".
14053         (Archive::add_symbols): Add mapfile parameter.  Change all
14054         callers.  Pass mapfile, symbol, and reason to include_member.
14055         (Archive::include_all_members): Add mapfile parameter.  Change all
14056         callers.
14057         (Archive::include_member): Add mapfile, sym, and why parameters.
14058         Change all callers.  Report inclusion to map file.
14059         * archive.h: Include "fileread.h".
14060         (class Archive): Update declarations.
14061         (Archive::file): New const method.
14062         (class Add_archive_symbols): Add mapfile_ field.  Update
14063         constructor.  Change all callers.
14064         * readsyms.h (class Read_symbols): Likewise.
14065         (class Finish_group): Likewise.
14066         (class Read_script): Likewise.
14067         * common.cc: Include "mapfile.h".
14068         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14069         all callers.
14070         (Symbol_table::do_allocate_commons): Likewise.
14071         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14072         symbol allocation to mapfile.
14073         * common.h (class Allocate_commons_task): Add mapfile_ field.
14074         Update constructor.  Change all callers.
14075         * symtab.h (class Symbol_table): Update declarations.
14076         * layout.cc: Include "mapfile.h".
14077         (Layout_task_runner::run): Print information to mapfile.
14078         (Layout::create_gold_note): Change Output_data_fixed_space to
14079         Output_data_zero_fill.
14080         (Layout::create_build_id): Likewise.
14081         (Layout::print_to_mapfile): New function.
14082         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14083         constructor.  Change caller.
14084         (class Layout): Declare print_to_mapfile.
14085         * output.cc (Output_section::Input_section::print_to_mapfile): New
14086         function.
14087         (Output_section::add_input_section): If producing a map, always
14088         add to input_sections_ list.
14089         (Output_section::do_print_to_mapfile): New function.
14090         (Output_segment::print_sections_to_mapfile): New function.
14091         (Output_segment::print_section_list_to_mapfile): New function.
14092         * output.h: Include "mapfile.h".
14093         (Output_data::print_to_mapfile): New function.
14094         (Output_data::do_print_to_mapfile): New virtual function.
14095         (Output_segment_headers::do_print_to_mapfile): New function.
14096         (Output_file_header::do_print_to_mapfile): New function.
14097         (Output_data_const::do_print_to_mapfile): New function.
14098         (class Output_data_const_buffer): Add map_name_ field.  Update
14099         constructor.  Change all callers.  Add do_print_to_mapfile
14100         function.
14101         (class Output_data_fixed_space): Likewise.
14102         (class Output_data_space): Likewise.
14103         (class Output_data_zero_fill): New class.
14104         (Output_data_strtab::do_print_to_mapfile): New function.
14105         (Output_data_reloc_base::do_print_to_mapfile): New function.
14106         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14107         (Output_data_group::do_print_to_mapfile): New function.
14108         (Output_data_got::do_print_to_mapfile): New function.
14109         (Output_data_dynamic::do_print_to_mapfile): New function.
14110         (Output_symtab_xindex::do_print_to_mapfile): New function.
14111         (class Output_section): Declare do_print_to_mapflie.  Declare
14112         print_to_mapfile in Input_section.
14113         (class Output_segment): Declare new functions.
14114         * object.h (Sized_relobj::symbol_count): New function.
14115         * script-sections.cc
14116         (Output_section_element_dot_assignment::set_section_addresses):
14117         Change Output_data_fixed_space to Output_data_zero_fill.
14118         (Output_data_expression::do_print_to_mapfile): New function.
14119         * script.cc (read_input_script): Add mapfile parameter.  Change
14120         all callers.
14121         * script.h (read_input_script): Update declaration.
14122         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14123         (Eh_frame::do_print_to_mapfile): New function.
14124         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14125         (Output_merge_string::do_print_to_mapfile): New function.
14126         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14127         function.
14128         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14129         function.
14130         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14131         function.
14132         * Makefile.am (CCFILES): Add mapfile.cc.
14133         (HFILES): Add mapfile.h.
14134         * Makefile.in: Rebuild.
14135
14136 2008-05-19  Ian Lance Taylor  <iant@google.com>
14137
14138         * options.h (class General_options): Add -z relro.
14139         * layout.cc (Layout::Layout): Initialize relro_segment_.
14140         (Layout::add_output_section_data): Return the output section.
14141         (Layout::make_output_section): Rcognize relro sections and mark
14142         them appropriately.
14143         (Layout::attach_allocated_section_to_segment): Put relro sections
14144         in a PT_GNU_RELRO segment.
14145         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14146         section as relro.
14147         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14148         PT_TLS segments.
14149         (Layout::linkonce_mapping): Map d.rel.ro.local to
14150         .data.rel.ro.local.
14151         (Layout::output_section_name): Us .data.rel.ro.local for any
14152         section which begins with that.
14153         * layout.h (class Layout): Update add_output_section_data
14154         declaration.  Add relro_segment_ field.
14155         * output.cc (Output_section::Output_section): Initialize is_relro_
14156         and is_relro_local_ fields.
14157         (Output_segment::add_output_section): Group relro sections.
14158         (Output_segment::is_first_section_relro): New function.
14159         (Output_segment::maximum_alignment): If there is a relro section,
14160         align the segment to the common page size.
14161         (Output_segment::set_section_addresses): Track whether we are
14162         looking at relro sections.  If the last section is a relro
14163         section, align to the common page size.
14164         (Output_segment::set_section_list_addresses): Add in_relro
14165         parameter.  Change all callers.  Align to the page size when
14166         moving from relro to non-relro section.
14167         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14168         segment.
14169         * output.h (class Output_section): Add is_relro_ and
14170         is_relro_local_ fields.
14171         (Output_section::is_relro): New function.
14172         (Output_section::set_is_relro): New function.
14173         (Output_section::is_relro_local): New function.
14174         (Output_section::set_is_relro_local): New function.
14175         (class Output_segment): Update declarations.
14176         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14177         * sparc.cc (Target_sparc::got_section): Likewise.
14178         * x86_64.cc (Target_x86_64::got_section): Likewise.
14179         * testsuite/relro_test_main.cc: New file.
14180         * testsuite/relro_test.cc: New file.
14181         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14182         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14183         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14184         (relro_test.so, relro_test_pic.o): New targets.
14185         * testsuite/Makefile.in: Rebuild.
14186
14187 2008-05-16  Ian Lance Taylor  <iant@google.com>
14188
14189         * output.cc (Output_segment::add_output_section): Remove front
14190         parameter.
14191         * output.h (class Output_segment): Remove
14192         add_initial_output_section and overloaded add_output_section.
14193         Update declaration of remaining add_output_section.
14194         * layout.cc (Layout::create_interp): Call add_output_section
14195         rather than add_initial_output_section.
14196         (Layout::finish_dynamic_section): Likewise.
14197
14198         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14199         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14200         know the dynamic type.
14201         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14202         field.  Initialize it in constructor.
14203         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14204         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14205         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14206         reloc.
14207
14208         * output.cc (Output_reloc::get_address): Change return type to
14209         Elf_Addr.
14210         * output.h (class Output_reloc): Update get_address declaration.
14211         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14212         for section addresses.
14213
14214 2008-05-09  Ian Lance Taylor  <iant@google.com>
14215
14216         PR 6493
14217         * gold.cc (gold_nomem): Use return value of write.
14218
14219 2008-05-08  Ian Lance Taylor  <iant@google.com>
14220
14221         * symtab.c (Symbol::init_base_output_data): Add version
14222         parameter.  Change all callers.
14223         (Symbol::init_base_output_segment): Likewise.
14224         (Symbol::init_base_constant): Likewise.
14225         (Symbol::init_base_undefined): Likewise.
14226         (Sized_symbol::init_output_data): Likewise.
14227         (Sized_symbol::init_output_segment): Likewise.
14228         (Sized_symbol::init_constant): Likewise.
14229         (Sized_symbol::init_undefined): Likewise.
14230         (Symbol_table::do_define_in_output_data): If the new symbol has a
14231         version, mark it as the default.
14232         (Symbol_table::do_define_in_output_segment): Likewise.
14233         (Symbol_table::do_define_as_constant): Likewise.
14234         * symtab.h (class Symbol): Update declarations.
14235         (class Sized_symbol): Likewise.
14236         * resolve.cc (Symbol::override_version): New function.
14237         (Symbol::override_base): Call override_version.
14238         (Symbol::override_base_with_special): Likewise.
14239         * testsuite/ver_script_8.script: New file.
14240         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14241         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14242         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14243         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14244
14245 2008-05-06  Ian Lance Taylor  <iant@google.com>
14246
14247         PR 6049
14248         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14249         functions.
14250         (class General_options): Remove existing --undefined, and add
14251         --no-undefined instead.  Add new --undefined as synonym for -u.
14252         * archive.cc (Archive::add_symbols): Check whether symbol was
14253         named with -u.
14254         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14255         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14256         all uses.  Add IS_UNDEFINED.  Update declarations to split
14257         different versions of init_base.  Declare init_base_undefined.
14258         (Symbol::is_defined): Handle IS_UNDEFINED.
14259         (Symbol::is_undefined): Likewise.
14260         (Symbol::is_weak_undefined): Call is_undefined.
14261         (Symbol::is_absolute): Handle IS_CONSTANT.
14262         (class Sized_symbol): Update declarations to split different
14263         versions of init.  Declare init_undefined.
14264         (class Symbol_table): Declare new functions.
14265         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14266         Change all callers.
14267         (Symbol::init_base_output_data): Likewise.
14268         (Symbol::init_base_output_segment): Likewise.
14269         (Symbol::init_base_constant): Likewise.
14270         (Symbol::init_base_undefined): New function.
14271         (Sized_symbol::init_object): Rename from init.  Change all
14272         callers.
14273         (Sized_symbol::init_output_data): Likewise.
14274         (Sized_symbol::init_output_segment): Likewise.
14275         (Sized_symbol::init_constant): Likewise.
14276         (Sized_symbol::init_undefined): New function.
14277         (Symbol_table::add_undefined_symbols_from_command_line): New
14278         function.
14279         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14280         function.
14281         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14282         (Symbol::output_section): Likewise.
14283         (Symbol::set_output_section): Likewise.
14284         (Symbol_table::sized_finalize_symbol): Likewise.
14285         (Symbol_table::sized_write_globals): Likewise.
14286         * resolve.cc (Symbol_table::should_override): Likewise.
14287         (Symbol::override_base_with_special): Likewise.
14288
14289         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14290         symbol, change it to have default visibility.
14291         * testsuite/protected_1.cc: New file.
14292         * testsuite/protected_2.cc: New file.
14293         * testsuite/protected_3.cc: New file.
14294         * testsuite/protected_main_1.cc: New file.
14295         * testsuite/protected_main_2.cc: New file.
14296         * testsuite/protected_main_3.cc: New file.
14297         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14298         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14299         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14300         (protected_1.so): New target.
14301         (protected_1_pic.o, protected_2_pic.o): New targets.
14302         (protected_3_pic.o): New target.
14303         (check_PROGRAMS): Add protected_2.
14304         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14305         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14306         * testsuite/Makefile.in: Rebuild.
14307
14308         * options.h (DEFINE_var): Add set_user_set_##varname__.
14309         (DEFINE_bool_alias): New macro.
14310         (class General_options): Define -Bstatic using DEFINE_bool_alias
14311         rather than DEFINE_special.  Add --undefined as an alias for -z
14312         defs.
14313         * options.cc (General_options::parse_Bstatic): Remove.
14314
14315         * options.h (class General_options): Add --fatal-warnings.
14316         * main.cc (main): Implement --fatal-warnings.
14317         * errors.h (Errors::warning_count): New function.
14318
14319         * options.h (class General_options): Add -Bsymbolic-functions.
14320         * symtab.h (Symbol::is_preemptible): Check for
14321         -Bsymbolic-functions.
14322
14323 2008-05-05  Ian Lance Taylor  <iant@google.com>
14324
14325         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14326         as noVARNAME rather than no-VARNAME.
14327         (class General_options): Add option -z combreloc.
14328         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14329         get_address.
14330         (Output_reloc::sort_before) [SHT_REL]: New function.
14331         (Output_reloc::sort_before) [SHT_RELA]: New function.
14332         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14333         Sort_relocs_comparison.
14334         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14335         parameter.  Change all callers.
14336         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14337         sort_relocs parameter.  Change all callers.
14338         * output.cc (Output_reloc::get_address): New function, broken out
14339         of write_rel.
14340         (Output_reloc::write_rel): Call it.
14341         (Output_reloc::compare): New function.
14342         (Output_data_reloc_base::do_write): Optionally sort relocs.
14343
14344         * configure.ac: If targ_extra_obj is set, link it in.
14345         * configure.tgt: Initialize all variables.
14346         (x86_64*): Set targ_extra_obj and targ_extra_size.
14347         * configure: Rebuild.
14348
14349         * object.cc (Sized_relobj::include_section_group): Adjust section
14350         indexes read from group data.  Build vector to pass to
14351         layout_group.
14352         * layout.cc (Layout::layout_group): Add flags and shndxes
14353         parameters.  Remove contents parameter.  Change caller.  Update
14354         explicit instantiations.
14355         * layout.h (class Layout): Update layout_group declaration.
14356         * output.cc (Output_data_group::Output_data_group): Add flags and
14357         input_shndxes parameters.  Remove contents parameter.  Change
14358         caller.
14359         (Output_data_group::do_write): Change input_sections_ to
14360         input_shndxes_.
14361         * output.h (class Output_data_group): Update constructor
14362         declaration.  Rename input_sections_ to input_shndxes_.
14363         * testsuite/many_sections_test.cc: Add template.
14364
14365 2008-04-30  Cary Coutant  <ccoutant@google.com>
14366
14367         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14368
14369         * layout.cc (Layout::include_section): Refactored check for debug
14370         info section.
14371         (Layout::add_comdat): Add new parameters.  Change type
14372         of signature parameter.  Add object and shndx to signatures table.
14373         (Layout::find_kept_object): New function.
14374         * layout.h: Include <cstring>.
14375         (Layout::is_debug_info_section): New function.
14376         (Layout::add_comdat): Add new parameters.
14377         (Layout::find_kept_object): New function.
14378         (Layout::Kept_section): New struct.
14379         (Layout::Signatures): Change type of map range.
14380         * object.cc (Relobj::output_section_address): New function.
14381         (Sized_relobj::include_section_group): Add new parameters.  Change
14382         calls to Layout::add_comdat.  Change to build table of kept comdat
14383         groups and table mapping discarded sections to kept sections.
14384         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14385         (Sized_relobj::do_layout): Change calls to include_section_group and
14386         include_linkonce_section.
14387         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14388         value to zero when section is discarded.
14389         (Sized_relobj::map_to_kept_section): New function.
14390         * object.h (Relobj::output_section_address): New function.
14391         (Relobj::Comdat_group): New type.
14392         (Relobj::find_comdat_group): New function.
14393         (Relobj::Comdat_group_table): New type.
14394         (Relobj::Kept_comdat_section): New type.
14395         (Relobj::Kept_comdat_section_table): New type.
14396         (Relobj::add_comdat_group): New function.
14397         (Relobj::set_kept_comdat_section): New function.
14398         (Relobj::get_kept_comdat_section): New function.
14399         (Relobj::comdat_groups_): New field.
14400         (Relobj::kept_comdat_sections_): New field.
14401         (Symbol_value::input_value): Update comment.
14402         (Sized_relobj::map_to_kept_section) New function.
14403         (Sized_relobj::include_linkonce_section): Add new parameter.
14404         * target-reloc.h (Comdat_behavior): New type.
14405         (get_comdat_behavior): New function.
14406         (relocate_section): Add code to map a discarded section to the
14407         corresponding kept section when applying a relocation.
14408
14409 2008-04-30  Craig Silverstein  <csilvers@google.com>
14410
14411         * dwarf_reader.cc (next_generation_count): New static var.
14412         (Addr2line_cache_entry): New struct.
14413         (addr2line_cache): New static var.
14414         (Dwarf_line_info::one_addr2line): Added caching.
14415         (Dwarf_line_info::clear_addr2line_cache): New function.
14416         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14417         cache-size parameter.
14418         (Dwarf_line_info::one_addr2line_cache): New function.
14419         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14420         new cache-size argument to one_addr2line(), and clear cache.
14421
14422 2008-04-28  Cary Coutant  <ccoutant@google.com>
14423
14424         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14425         R_386_PC8 relocations.
14426
14427 2008-04-23  Ian Lance Taylor  <iant@google.com>
14428
14429         * object.cc (Sized_relobj::include_section_group): Check for
14430         invalid section group.
14431
14432         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14433         header size.
14434
14435         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14436         than read for file header.
14437         * archive.cc (Archive::include_member): Likewise.
14438
14439 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14440
14441         * aclocal.m4: Regenerate.
14442         * configure: Regenerate.
14443
14444 2008-04-19  Ian Lance Taylor  <iant@google.com>
14445
14446         * version.cc (version_string): Bump to 1.6.
14447
14448         * testsuite/Makefile.am (many_sections_r_test): New target.
14449         (many_sections_r_test_SOURCES): Remove.
14450         (many_sections_r_test_DEPENDENCIES): Remove.
14451         (many_sections_r_test_LDFLAGS): Remove.
14452         (many_sections_r_test_LDADD): Remove.
14453
14454         * object.cc (Sized_relobj::do_add_symbols): Always pass
14455         local_symbol_count_ to add_from_relobj.
14456
14457         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14458         every thousand variables.
14459         * testsuite/Makefile.in: Rebuild.
14460
14461         * object.cc (Xindex::initialize_symtab_xindex): New function.
14462         (Xindex::read_symtab_xindex): New function.
14463         (Xindex::sym_xindex_to_shndx): New function.
14464         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14465         available.
14466         (Sized_relobj::do_initialize_xindex): New function.
14467         (Sized_relobj::do_read_symbols): Adjust section links.
14468         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14469         parameter.  Change all callers.
14470         (Sized_relobj::include_section_group): Adjust section links and
14471         symbol section indexes.
14472         (Sized_relobj::do_layout): Adjust section links.
14473         (Sized_relobj::do_count_local_symbols): Adjust section links and
14474         symbol section indexes.
14475         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14476         ordinary and special symbols.
14477         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14478         dynsym_xindex parameters.  Change all callers.  Adjust section
14479         links.  Use SHN_XINDEX when needed.
14480         (Sized_relobj::get_symbol_location_info): Adjust section links.
14481         Don't get fooled by special symbols.
14482         * object.h (class Xindex): Define.
14483         (class Object): Add xindex_ parameter.  Declare virtual functoin
14484         do_initialize_xindex.
14485         (Object::adjust_sym_shndx): New function.
14486         (Object::set_xindex): New protected function.
14487         (class Symbol_value): Add is_ordinary_shndx_ field.
14488         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14489         (Symbol_value::value): Assert ordinary section.
14490         (Symbol_value::initialize_input_to_output_map): Likewise.
14491         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14492         Change all callers.
14493         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14494         all callers.
14495         (class Sized_relobj): Update declarations.
14496         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14497         parameter.  Change all callers.
14498         (Sized_relobj::adjust_shndx): New function.
14499         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14500         field.
14501         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14502         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14503         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14504         (Sized_dynobj::read_dynsym_section): Adjust section links.
14505         (Sized_dynobj::read_dynamic): Likewise.
14506         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14507         section links.
14508         (Sized_dynobj::do_initialize_xindex): New function.
14509         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14510         do_initialize_xindex.
14511         (Sized_dynobj::adjust_shndx): New function.
14512         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14513         dynsym_xindex_ fields.
14514         (Layout::finalize): Add a call to set_section_indexes before
14515         creating the symtab sections.
14516         (Layout::set_section_indexes): Don't do anything if the section
14517         already has a section index.
14518         (Layout::create_symtab_sections): Add shnum parameter.  Change
14519         caller.  Create .symtab_shndx section if needed.
14520         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14521         caller.
14522         (Layout::allocated_output_section_count): New function.
14523         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14524         needed.
14525         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14526         fields.  Update declarations.
14527         (Layout::symtab_xindex): New function.
14528         (Layout::dynsym_xindex): New function.
14529         (class Write_symbols_task): Add layout_ field.
14530         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14531         Change caller.
14532         * output.cc (Output_section_headers::Output_section_headers): Add
14533         shstrtab_section parameter.  Change all callers.
14534         (Output_section_headers::do_sized_write): Store overflow values
14535         for section count and section string table section index in
14536         section header zero.
14537         (Output_file_header::do_sized_write): Check for overflow of
14538         section count and section string table section index.
14539         (Output_symtab_xindex::do_write): New function.
14540         (Output_symtab_xindex::endian_do_write): New function.
14541         * output.h (class Output_section_headers): Add shstrtab_section_.
14542         Update declarations.
14543         (class Output_symtab_xindex): Define.
14544         (Output_section::has_out_shndx): New function.
14545         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14546         field.
14547         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14548         Change all callers.
14549         (Sized_symbol::init): Likewise.
14550         (Symbol::output_section): Check for ordinary symbol.
14551         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14552         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14553         callers.
14554         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14555         Change all callers.  Simplify handling of symbols from sections
14556         not included in the link.
14557         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14558         distinction.
14559         (Weak_alias_sorter::operator()): Assert that symbols are
14560         ordinary.
14561         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14562         distinction.
14563         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14564         parameters.  Change all callers.
14565         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14566         symbol distinction.  Use SHN_XINDEX when needed.
14567         (Symbol_table::write_section_symbol): Add symtab_xindex
14568         parameter.  Change all callers.
14569         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14570         SHN_XINDEX when needed.
14571         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14572         declarations.
14573         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14574         (Symbol::is_defined): Check is_ordinary.
14575         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14576         (Symbol::is_absolute, Symbol::is_common): Likewise.
14577         (class Sized_symbol): Update declarations.
14578         (class Symbol_table): Update declarations.
14579         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14580         parameters.  Change all callers.
14581         (Sized_symbol::override): Likewise.
14582         (Symbol_table::override): Likewise.
14583         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14584         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14585         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14586         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14587         to be in an ordinary section.
14588         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14589         object and is_ordinary parameters.  Change all callers.
14590         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14591         Change all callers.  Don't add undefined or non-ordinary symbols
14592         to reloc_map_.
14593         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14594         Change all callers.
14595         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14596         declarations.
14597         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14598         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14599         (Sized_relobj::relocate_sections): Likewise.
14600         * target-reloc.h (scan_relocs): Adjust section symbol index.
14601         (scan_relocatable_relocs): Likewise.
14602         * i386.cc (Scan::local): Check for ordinary symbols.
14603         * sparc.cc (Scan::local): Likewise.
14604         * x86_64.cc (Scan::local): Likewise.
14605         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14606         to symbol_section_and_value.
14607         * testsuite/many_sections_test.cc: New file.
14608         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14609         (check_PROGRAMS): Add many_sections_test.
14610         (many_sections_test_SOURCES): Define.
14611         (many_sections_test_DEPENDENCIES): Define.
14612         (many_sections_test_LDFLAGS): Define.
14613         (BUILT_SOURCES): Add many_sections_define.h.
14614         (many_sections_define.h): New target.
14615         (BUILT_SOURCES): Add many_sections_check.h.
14616         (many_sections_check.h): New target.
14617         (check_PROGRAMS): Add many_sections_r_test.
14618         (many_sections_r_test_SOURCES): Define.
14619         (many_sections_r_test_DEPENDENCIES): Define.
14620         (many_sections_r_test_LDFLAGS): Define.
14621         (many_sections_r_test_LDADD): Define.
14622         (many_sections_r_test.o): New target.
14623         * testsuite/Makefile.in: Rebuild.
14624
14625 2008-04-17  Cary Coutant  <ccoutant@google.com>
14626
14627         * errors.cc (Errors::info): New function.
14628         (gold_info): New function.
14629         * errors.h (Errors::info): New function.
14630         * gold.h (gold_info): New function.
14631         * object.cc (Input_objects::add_object): Print trace output.
14632         * options.cc (options::parse_set): New function.
14633         (General_options::parse_wrap): Deleted.
14634         (General_options::General_options): Deleted initializer.
14635         * options.h (options::String_set): New typedef.
14636         (options::parse_set): New function.
14637         (DEFINE_set): New macro.
14638         (General_options::wrap): Changed to use DEFINE_set. Changed
14639         callers of any_wrap_symbols and is_wrap_symbol.
14640         (General_options::trace, General_options::trace_symbol):
14641         New options.
14642         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14643         (General_options::wrap_symbols_): Deleted.
14644         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14645
14646 2008-04-17  David S. Miller  <davem@davemloft.net>
14647
14648         * options.cc (General_options::parse_V): New function.
14649         * options.h: Add entries for -V and -Qy.
14650
14651 2008-04-17  Ian Lance Taylor  <iant@google.com>
14652
14653         * common.cc (Symbol_table::allocate_commons): Remove options
14654         parameter.  Change caller.
14655         (Symbol_table::do_allocate_commons): Remove options parameter.
14656         Change caller.  Just call do_allocate_commons_list twice.
14657         (Symbol_table::do_allocate_commons_list): New function, broken out
14658         of do_allocate_commons.
14659         * common.h (class Allocate_commons_task): Remove options_ field.
14660         Update constructor.
14661         * symtab.cc (Symbol_table::Symbol_table): Initialize
14662         tls_commons_.
14663         (Symbol_table::add_from_object): Put TLS common symbols on
14664         tls_commons_ list.
14665         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14666         which are IN_OUTPUT_DATA.
14667         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14668         allocate_commons and do_allocate_commons declarations.  Declare
14669         do_allocate_commons_list.
14670         * gold.cc (queue_middle_tasks): Update creation of
14671         Allocate_commons_task to not pass options.
14672         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14673         (TLS_TEST_C_FLAGS): New variable.
14674         (tls_test_c_pic.o): New target.
14675         (tls_test_shared.so): Link in tls_test_c_pic.o.
14676         (tls_test_c_pic_ie.o): New target.
14677         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14678         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14679         (tls_test_c.o): New target.
14680         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14681         (tls_pic_test_LDADD): Likewise.
14682         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14683         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14684         (tls_test_c_gnu2.o): New target.
14685         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14686         tls_test_c_gnu2.o.
14687         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14688         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14689         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14690         * testsuite/tls_test.cc: Include "config.h".
14691         (t_last): Call t11_last.
14692         * testsuite/tls_test.h (t11, t11_last): Declare.
14693         * testsuite/tls_test_c.c: New file.
14694         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14695         * configure.ac: Check for OpenMP support.
14696         * configure, config.in, Makefile.in: Rebuild.
14697         * testsuite/Makefile.in: Rebuild.
14698
14699 2008-04-16  Cary Coutant  <ccoutant@google.com>
14700
14701         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14702         (Target_i386::tls_base_symbol_defined_): New field.
14703         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14704         (Target_i386::Scan::global): Likewise.
14705         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14706         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14707         (Target_x86_64::tls_base_symbol_defined_): New field.
14708         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14709         (Target_x86_64::Scan::global): Likewise.
14710
14711 2008-04-16  Cary Coutant  <ccoutant@google.com>
14712
14713         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14714         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14715         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14716         building shared libraries.
14717         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14718         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14719         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14720         * testsuite/Makefile.in: Rebuild.
14721         * testsuite/weak_undef.h: New file.
14722         * testsuite/weak_undef_file1.cc: Add extra test cases.
14723         * testsuite/weak_undef_file2.cc: Likewise.
14724         * testsuite/weak_undef_test.cc: Likewise.
14725
14726 2008-04-16  David S. Miller  <davem@davemloft.net>
14727
14728         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14729         Add issued_non_pic_error_ field.  Declare check_non_pic.
14730         (Target_sparc::Scan::check_non_pic): New function.
14731         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14732         (Target_sparc::Scan::global): Likewise.
14733
14734         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14735         * configure: Rebuild.
14736
14737         * options.h (DEFINE_enable): New macro.
14738         (new_dtags): New enable option.
14739         (initfirst, interpose, loadfltr, nodefaultlib,
14740         nodelete, nodlopen, nodump): New -z options.
14741         * layout.cc (Layout:finish_dynamic_section): If new
14742         dtags enabled, emit DT_RUNPATH.  Also, emit a
14743         DT_FLAGS_1 containing any specified -z flags.
14744
14745 2008-04-16  Ian Lance Taylor  <iant@google.com>
14746
14747         * copy-relocs.cc: New file.
14748         * copy-relocs.h: New file.
14749         * reloc.cc: Remove Copy_relocs code.
14750         * reloc.h: Likewise.
14751         * reloc-types.h (struct Reloc_types) [both versions]: Add
14752         get_reloc_addend_noerror.
14753         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14754         variants of add_global which take an addend which must be zero.
14755         * i386.cc: Include "copy-relocs.h".
14756         (class Target_i386): Change type of copy_relocs_ to variable,
14757         update initializer.
14758         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14759         Change all callers.
14760         (Target_i386::do_finalize_sections): Change handling of
14761         copy_relocs_.
14762         * sparc.cc: Include "copy-relocs.h".
14763         (class Target_sparc): Change type of copy_relocs_ to variable,
14764         update initializer.
14765         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14766         Change all callers.
14767         (Target_sparc::do_finalize_sections): Change handling of
14768         copy_relocs_.
14769         * x86_64.cc: Include "copy-relocs.h".
14770         (class Target_x86_64): Change type of copy_relocs_ to variable,
14771         update initializer.
14772         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14773         class.  Change all callers.
14774         (Target_x86_64::do_finalize_sections): Change handling of
14775         copy_relocs_.
14776         * Makefile.am (CCFILES): Add copy-relocs.cc.
14777         (HFILES): Add copy-relocs.h.
14778
14779         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14780
14781         * testsuite/script_test_4.sh: Permit leading zeroes.
14782
14783 2008-04-15  Ian Lance Taylor  <iant@google.com>
14784
14785         * script-sections.cc (Script_sections::create_segments): Use
14786         header_size_adjustment even when there is enough room for the
14787         headers.
14788         * testsuite/script_test_4.sh: New file.
14789         * testsuite/script_test_4.t: New file.
14790         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14791         (check_DATA): Add script_test_4.stdout.
14792         (MOSTLYCLEANFILES): Likewise.
14793         (script_test_4): New target.
14794         (script_test_4.stdout): New target.
14795         * testsuite/Makefile.in: Rebuild.
14796
14797         * sparc.cc: Add definitions for Output_data_plt_sparc class
14798         constants.
14799
14800 2008-04-14  David S. Miller  <davem@davemloft.net>
14801
14802         * sparc.cc: New file.
14803         * Makefile.am (TARGETSOURCES): Add sparc.cc
14804         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14805         * configure.tgt: Document targ_extra_size and
14806         targ_extra_big_endian.  Add entries for sparc-* and
14807         sparc64-*.
14808         * configure.ac: Handle targ_extra_size and
14809         targ_extra_big_endian.
14810         * Makefile.in: Rebuild.
14811         * configure: Likewise.
14812         * po/POTFILES.in: Likewise.
14813         * po/gold.pot: Likewise.
14814
14815 2008-04-14  Ian Lance Taylor  <iant@google.com>
14816
14817         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14818         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14819         in the name/type/flags to section mapping.  Don't call
14820         allocate_output_section.
14821         (Layout::choose_output_section): Change parameter from adjust_name
14822         to is_input_section.  Don't permit input sections after sections
14823         are attached to segments.  Don't call allocate_output_section.
14824         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14825         not write_enable_output_section.
14826         (Layout::make_output_section): Don't push to
14827         unattached_section_list_ nor call attach_to_segment.  Call
14828         attach_section_to_segment if sections are attached.
14829         (Layout::attach_sections_to_segments): New function.
14830         (Layout::attach_section_to_segment): New function.
14831         (Layout::attach_allocated_section_to_segment): Rename from
14832         attach_to_segment.  Remove flags parameter.
14833         (Layout::allocate_output_section): Remove function.
14834         (Layout::write_enable_output_section): Remove function.
14835         * layout.h (class Layout): Update for above changes.  Add new
14836         field sections_are_attached_.
14837         * output.h (Output_section::update_flags_for_input_section): New
14838         function.
14839         * output.cc (Output_section::add_input_section): Call
14840         update_flags_for_input_section.
14841         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14842
14843 2008-04-11  Cary Coutant  <ccoutant@google.com>
14844
14845         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14846         thought unnecessary.
14847         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14848
14849 2008-04-11  Ian Lance Taylor  <iant@google.com>
14850
14851         * output.h (class Output_section_data): Remove inline definition
14852         of set_addralign.
14853         * output.cc (Output_section_data::set_addralign): New function.
14854
14855 2008-04-11  Cary Coutant  <ccoutant@google.com>
14856
14857         Add support for TLS descriptors for i386 and x86_64.
14858         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14859         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14860         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14861         GOT_TYPE_TLS_DESC.
14862         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14863         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14864         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14865         relocations.
14866         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14867         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14868         Fix problem with initial-exec relocations.
14869         (Target_i386::Relocate::relocate_tls): Likewise.
14870         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14871         relaxation.
14872         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14873         support for section-plus-offset dynamic table entries.
14874         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14875         (Output_data_dynamic::Dynamic_entry): Add support for
14876         section-plus-offset dynamic table entries.
14877         (Output_data_dynamic::Classification): Likewise.
14878         (Output_data_dynamic::classification_): Renamed offset_.
14879         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14880         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14881         (Target_x86_64::make_plt_section): New function.
14882         (Target_x86_64::reserve_tlsdesc_entries): New function.
14883         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14884         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14885         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14886         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14887         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14888         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14889         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14890         add extra PLT entry for TLS descriptors.
14891         (Output_data_plt_x86_64::got_): New field.
14892         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14893         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14894         fields.
14895         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14896         descriptors.
14897         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14898         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14899         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14900         R_386_TLS_DESC_CALL relocations.
14901         (Target_x86_64::Scan::global): Likewise.
14902         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14903         for TLS descriptors.
14904         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14905         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14906         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14907         GD-to-IE relaxation.
14908         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14909         and TLS_DESCRIPTORS.
14910         * Makefile.in: Rebuild.
14911         * configure: Rebuild.
14912         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14913         (tls_test_shared2.so): New target.
14914         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14915         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14916         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14917         (tls_shared_gd_to_ie_test_LDADD): New variable.
14918         (tls_shared_gnu2_gd_to_ie_test): New target.
14919         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14920         New targets.
14921         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14922         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14923         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14924         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14925         (tls_shared_gnu2_test): New target.
14926         (tls_test_gnu2_shared.so): New target.
14927         (tls_shared_gnu2_test_SOURCES): New variable.
14928         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14929         (tls_shared_gnu2_test_LDFLAGS): New variable.
14930         (tls_shared_gnu2_test_LDADD): New variable.
14931         * testsuite/Makefile.in: Rebuild.
14932         * testsuite/Makefile.
14933
14934 2008-04-11  Ian Lance Taylor  <iant@google.com>
14935
14936         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14937         justsyms.t.
14938         * testsuite/Makefile.in: Rebuild.
14939
14940         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14941         long.
14942         * testsuite/script_test_2.cc (main): Adjust test.
14943
14944 2008-04-11  David S. Miller  <davem@davemloft.net>
14945             Ian Lance Taylor  <iant@google.com>
14946
14947         * options.h (General_options): Add entries for '-Y' and
14948         '-relax'.
14949         * options.cc (General_options:finalize): If -Y was used, add those
14950         entries to the library path instead of the default "/lib" and
14951         "/usr/lib".
14952
14953 2008-04-11  David S. Miller  <davem@davemloft.net>
14954
14955         * testsuite/justsyms.t: Start at 0x100.
14956         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14957         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14958         long.
14959         * testsuite/script_test_2.cc: Adjust string and section length
14960         checks.
14961
14962 2008-04-09  Ian Lance Taylor  <iant@google.com>
14963
14964         PR gold/5996
14965         * script-sections.cc (Sections_element::allocate_to_segment): Add
14966         orphan parameter.
14967         (Output_section_definition::allocate_to_segment): Likewise.
14968         (Orphan_output_section::allocate_to_segment): Likewise.
14969         (Script_sections::attach_sections_using_phdrs_clause): Don't
14970         propagate non-PT_LOAD segments to orphan sections.
14971         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14972         readelf rather than objdump.
14973         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14974         .interp section and PT_INTERP segment are the same size.
14975         * testsuite/Makefile.in: Rebuild.
14976
14977         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14978         aliases for symbols defined in the same object.
14979         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14980         (weak_alias_test_SOURCES): New variable.
14981         (weak_alias_test_DEPENDENCIES): New variable.
14982         (weak_alias_test_LDFLAGS): New variable.
14983         (weak_alias_test_LDADD): New variable.
14984         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14985         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14986         (weak_alias_test_3.o): New target.
14987         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14988         * testsuite/weak_alias_test_main.cc: New file.
14989         * testsuite/weak_alias_test_1.cc: New file.
14990         * testsuite/weak_alias_test_2.cc: New file.
14991         * testsuite/weak_alias_test_3.cc: New file.
14992
14993 2008-04-08  Ian Lance Taylor  <iant@google.com>
14994
14995         * options.h (class General_options): Add --noinhibit-exec option.
14996         * main.cc (main): Check --noinhibit-exec.
14997
14998         * options.h (class General_options): Define --wrap as a special
14999         option.  Add wrap_symbols_ field.
15000         (General_options::any_wrap_symbols): New function.
15001         (General_options::is_wrap_symbol): New function.
15002         * options.cc (General_options::parse_wrap): New function.
15003         (General_options::General_options): Initialize wrap_symbols_.
15004         * symtab.cc (Symbol_table::wrap_symbol): New function.
15005         (Symbol_table::add_from_object): Handle --wrap.
15006         * symtab.h (class Symbol_table): Declare wrap_symbol.
15007         * target.h (Target::wrap_char): New function.
15008         (Target::Target_info): Add wrap_char field.
15009         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15010         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15011         * testsuite/testfile.cc (Target_test::test_target_info):
15012         Likewise.
15013
15014         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15015         there is one.
15016
15017         * layout.h (class Layout): Add added_eh_frame_data_ field.
15018         * layout.cc (Layout::Layout): Initialize new field.
15019         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15020         output section until we find a section we merged successfully.
15021         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15022         that the size be non-zero.
15023
15024         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15025         qualifier.
15026
15027 2008-04-08  Craig Silverstein  <csilvers@google.com>
15028
15029         * configure.ac: Export new conditional variable HAVE_ZLIB.
15030         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15031         on HAVE_ZLIB.
15032         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15033         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15034
15035 2008-04-07  Ian Lance Taylor  <iant@google.com>
15036
15037         * version.cc (version_string): Set to "1.5".
15038
15039         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15040         Add issued_non_pic_error_ field.  Declare check_non_pic.
15041         (Target_x86_64::Scan::check_non_pic): New function.
15042         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15043         (Target_x86_64::Scan::global): Likewise.
15044
15045         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15046         addend parameter.  Change caller.  Handle merge sections.
15047         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15048         Address to Addend.  Don't add in the result of
15049         local_section_offset, pass down the addend and use the returned
15050         value.
15051         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15052         Update declarations of local_section_offset and symbol_value.
15053         * testsuite/two_file_test_1.cc (t18): New function.
15054         * testsuite/two_file_test_2.cc (f18): New function.
15055         * testsuite/two_file_test_main.cc (main): Call t18.
15056         * testsuite/two_file_test.h (t18, f18): Declare.
15057
15058         * configure.ac: Don't test for objdump, c++filt, or readelf.
15059         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15060         conditionals.
15061         (TEST_READELF): New variable.
15062         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15063         (check_PROGRAMS): Add two_file_strip_test.
15064         (two_file_strip_test): New target.
15065         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15066         (two_file_same_shared_strip_test_SOURCES): New variable.
15067         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15068         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15069         (two_file_same_shared_strip_test_LDADD): New variable.
15070         (two_file_shared_strip.so): New target.
15071         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15072         (ver_test_5.syms, ver_test_7.syms): Likewise.
15073         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15074         (strip_test_3.stdout): Use TEST_OBJDUMP.
15075         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15076
15077 2008-04-04  Cary Coutant  <ccoutant@google.com>
15078
15079         * symtab.h (Symbol::is_weak_undefined): New function.
15080         (Symbol::is_strong_undefined): New function.
15081         (Symbol::is_absolute): New function.
15082         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15083         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15084         absolute symbols.
15085         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15086         (weak_undef_test): New target.
15087         * testsuite/Makefile.in: Rebuild.
15088         * testsuite/weak_undef_file1.cc: New file.
15089         * testsuite/weak_undef_file2.cc: New file.
15090         * testsuite/weak_undef_test.cc: New file.
15091
15092 2008-04-03  Craig Silverstein  <csilvers@google.com>
15093
15094         * compressed_output.h (class Output_compressed_section): Use
15095         unsigned buffer.
15096         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15097         add zlib header.
15098         (zlib_compressed_suffix): Removed.
15099         (Output_compressed_section::set_final_data_size): Use unsigned
15100         buffers.
15101         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15102         Fix linker invocation.
15103         (flagstest_o_specialfile_and_compress_debug_sections):
15104         Likewise.
15105         * testsuite/Makefile.in: Regenerated.
15106
15107 2008-04-02  David S. Miller  <davem@davemloft.net>
15108
15109         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15110         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15111
15112 2008-04-02  Craig Silverstein  <csilvers@google.com>
15113
15114         * TODO: New file.
15115
15116 2008-04-02  Ian Lance Taylor  <iant@google.com>
15117
15118         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15119         parameters.  Update for new key type to views_.  Change all
15120         callers.
15121         (File_read::read): Adjust for byteshift in returned view.
15122         (File_read::add_view): New function, broken out of
15123         find_and_make_view.
15124         (File_read::make_view): New function, broken out of
15125         find_and_make_view.
15126         (File_read::find_or_make_view): Add offset and aligned
15127         parameters.  Rewrite accordingly.  Change all callers.
15128         (File_read::get_view): Add offset and aligned parameters.  Adjust
15129         for byteshift in return value.
15130         (File_read::get_lasting_view): Likewise.
15131         * fileread.h (class File_read): Update declarations.
15132         (class File_read::View): Add byteshift_ field.  Add byteshift to
15133         constructor.  Add byteshift method.
15134         * archive.h (Archive::clear_uncached_views): New function.
15135         (Archive::get_view): Add aligned parameter.  Change all callers.
15136         * object.h (Object::get_view): Add aligned parameter.  Change all
15137         callers.
15138         (Object::get_lasting_view): Likewise.
15139
15140         * fileread.cc (File_read::release): Don't call clear_views if
15141         there are multiple objects.
15142         * fileread.h (File_read::clear_uncached_views): New function.
15143         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15144         on the archive.
15145
15146 2008-03-31  Cary Coutant  <ccoutant@google.com>
15147
15148         Add thin archive support.
15149         * archive.cc (Archive::armagt): New const.
15150         (Archive::setup): Remove task parameter and calls to unlock.
15151         (Archive::unlock_nested_archives): New function.
15152         (Archive::read_header): Add nested_off parameter. Change
15153         all callers.
15154         (Archive::interpret_header): Likewise.
15155         (Archive::include_all_members): Change to handle thin
15156         archives.
15157         (Archive::include_member): Likewise.
15158         * archive.h (Archive::Archive): Add new parameters and
15159         initializers.
15160         (Archive::armagt): New const.
15161         (Archive::setup): Remove task parameter.
15162         (Archive::unlock_nested_archives): New function.
15163         (Archive::read_header): Add nested_off parameter.
15164         (Archive::interpret_header): Likewise.
15165         (Archive::Nested_archive_table): New typedef.
15166         (Archive::is_thin_archive_): New field.
15167         (Archive::nested_archives_): New field.
15168         (Archive::options_): New field.
15169         (Archive::dirpath_): New field.
15170         (Archive::task_): New field.
15171         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15172         for thin archives.  Pass additional parameters to
15173         Archive::Archive.  Unlock the archive file after calling
15174         Archive::setup.
15175
15176 2008-03-29  Ian Lance Taylor  <iant@google.com>
15177
15178         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15179         version symbol to be local.
15180         * testsuite/ver_test_4.sh: New file.
15181         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15182         (check_DATA): Add ver_test_4.syms.
15183         (ver_test_4.syms): New target.
15184         * testsuite/Makefile.in: Rebuild.
15185
15186         * output.cc
15187         (Output_section::Input_section_sort_entry::has_priority): New
15188         function.
15189         (Output_section::Input_section_sort_entry::match_file_name): New
15190         function.
15191         (Output_section::Input_section_sort_entry::match_section_name):
15192         Remove.
15193         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15194         Remove.
15195         (Output_section::Input_section_sort_entry::match_section_file):
15196         Remove.
15197         (Output_section::Input_section_sort_compare::operator()): Rewrite
15198         using new Input_section_sort_entry functions.  Sort crtbegin and
15199         crtend first.  Sort sections with no priority before sections with
15200         a priority.
15201         * testsuite/initpri1.c (d3): Check j != 4.
15202         (cd5): New constructor/destructor function.
15203         (main): Check j != 2.
15204
15205         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15206         new symbol when resolving, don't call set_is_default.
15207         * testsuite/ver_test_7.cc: New file.
15208         * testsuite/ver_test_7.sh: New file.
15209         * testsuite/Makefile.am (ver_test_7.so): New target.
15210         (ver_test_7.o): New target.
15211         (check_SCRIPTS): Add ver_test_7.sh.
15212         (check_DATA): Add ver_test_7.syms.
15213         (ver_test_7.syms): New target.
15214
15215 2008-03-28  Ian Lance Taylor  <iant@google.com>
15216
15217         * layout.cc (Layout::layout): If we see an input section with a
15218         name that needs sorting, set the must_sort flag for the output
15219         section.
15220         (Layout::make_output_section): If the name of the output section
15221         indicates that it might require sorting, set the may_sort flag.
15222         * output.h (Output_section::may_sort_attached_input_sections): New
15223         function.
15224         (Output_section::set_may_sort_attached_input_sections): New
15225         function.
15226         (Output_section::must_sort_attached_input_sections): New
15227         function.
15228         (Output_section::set_must_sort_attached_input_sections): New
15229         function.
15230         (class Output_section): Declare Input_section_sort_entry.  Define
15231         Input_section_sort_compare.  Declare
15232         sort_attached_input_sections.  Add new fields:
15233         may_sort_attached_input_sections_,
15234         must_sort_attached_input_sections_,
15235         attached_input_sections_are_sorted_.
15236         * output.cc (Output_section::Output_section): Initialize new
15237         fields.
15238         (Output_section::add_input_section): Add an entry to
15239         input_sections_ if may_sort or must_sort are true.
15240         (Output_section::set_final_data_size): Call
15241         sort_attached_input_sections if necessary.
15242         (Output_section::Input_section_sort_entry): Define new class.
15243         (Output_section::Input_section_sort_compare::operator()): New
15244         function.
15245         (Output_section::sort_attached_input_sections): New function.
15246         * configure.ac: Check whether the compiler supports constructor
15247         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15248         * testsuite/initpri1.c: New file.
15249         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15250         CONSTRUCTOR_PRIORITY.
15251         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15252         (initpri1_LDFLAGS): New variable.
15253         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15254
15255 2008-03-27  Ian Lance Taylor  <iant@google.com>
15256
15257         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15258         * testsuite/common_test_1.c: New file.
15259         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15260         (common_test_1_SOURCES): New variable.
15261         (common_test_1_DEPENDENCIES): New variable.
15262         (common_test_1_LDFLAGS): New variable.
15263
15264         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15265         and commons_ correctly when NAME/VERSION does not override
15266         NAME/NULL.
15267         * testsuite/ver_test_6.c: New file.
15268         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15269         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15270         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15271
15272 2008-03-26  Ian Lance Taylor  <iant@google.com>
15273
15274         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15275         of an undefined symbol from a version script.
15276         * testsuite/Makefile.am (ver_test_5.so): New target.
15277         (ver_test_5.o): New target.
15278         (check_SCRIPTS): Add ver_test_5.sh.
15279         (check_DATA): Add ver_test_5.syms.
15280         (ver_test_5.syms): New target.
15281         * testsuite/ver_test_5.cc: New file.
15282         * testsuite/ver_test_5.script: New file.
15283         * testsuite/ver_test_5.sh: New file.
15284         * Makefile.in, testsuite/Makefile.in: Rebuild.
15285
15286         PR gold/5986
15287         Fix problems building gold with gcc 4.3.0.
15288         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15289         (gold_error_at_location, gold_warning_at_location): Use it.
15290         * configure.ac: Check whether we can compile and use a template
15291         function with a printf attribute.
15292         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15293         when jumping over bytes.
15294         * object.cc: Instantiate Object::read_section_data.
15295         * debug.h: Include <cstring>
15296         * dwarf_reader.cc: Include <algorithm>
15297         * main.cc: Include <cstring>.
15298         * options.cc: Include <cstring>.
15299         * output.cc: Include <cstring>.
15300         * script.cc: Include <cstring>.
15301         * script.h: Include <string>.
15302         * symtab.cc: Include <cstring> and <algorithm>.
15303         * target-select.cc: Include <cstring>.
15304         * version.cc: Include <string>.
15305         * testsuite/testmain.cc: Include <cstdlib>.
15306         * configure, config.in: Rebuild.
15307
15308 2008-03-25  Ian Lance Taylor  <iant@google.com>
15309
15310         * options.cc: Include "../bfd/bfdver.h".
15311         (options::help): Print bug reporting address.
15312
15313         * version.cc (print_version): Adjust output for current value of
15314         BFD_VERSION_STRING.
15315
15316         * NEWS: New file.
15317
15318         * options.cc (options::help): Print list of supported targets.
15319         * target-select.h: Include <vector>.
15320         (class Target_selector): Make machine_, size_, and is_big_endian_
15321         fields const.  Add bfd_name_ and instantiated_target_ fields.
15322         (Target_selector::Target_selector): Add bfd_name parameter.
15323         (Target_selector::recognize): Make non-virtual, call
15324         do_recognize.
15325         (Target_selector::recognize_by_name): Make non-virtual, call
15326         do_recognize_by_name.
15327         (Target_selector::supported_names): New function.
15328         (Target_selector::bfd_name): New function.
15329         (Target_selector::do_instantiate_target): New pure virtual
15330         function.
15331         (Target_selector::do_recognize): New virtual function.
15332         (Target_selector::do_recognize_by_name): New virtual function.
15333         (Target_selector::instantiate_target): New private function.
15334         (supported_target_names): Declare.
15335         * target-select.cc (Target_selector::Target_selector): Update for
15336         new parameter and fields.
15337         (select_target_by_name): Check that the name matches before
15338         calling recognize_by_name.
15339         (supported_target_names): New function.
15340         * i386.cc (class Target_selector_i386): Update Target_selector
15341         constructor call.  Remove recognize and recognize_by_name.  Add
15342         do_instantiate_target.
15343         * x86_64.cc (class Target_selector_x86_64): Likewise.
15344         * testsuite/testfile.cc (class Target_selector_test): Update for
15345         changes to Target_selector.
15346
15347         * README: Rewrite, with some notes on unsupported features.
15348
15349 2008-03-24  Cary Coutant  <ccoutant@google.com>
15350
15351         * i386.cc (Target_i386::Got_type): New enum declaration.
15352         (Target_i386::Scan::local): Updated callers of Output_data_got
15353         member functions.
15354         (Target_i386::Scan::global): Likewise.
15355         (Target_i386::Relocate::relocate): Likewise.
15356         (Target_i386::Relocate::relocate_tls): Likewise.
15357         * object.h (Got_offset_list): New class.
15358         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15359         (Sized_relobj::local_got_offset): Likewise.
15360         (Sized_relobj::set_local_got_offset): Likewise.
15361         (Sized_relobj::local_has_tls_got_offset): Removed.
15362         (Sized_relobj::local_tls_got_offset): Removed.
15363         (Sized_relobj::set_local_tls_got_offset): Removed.
15364         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15365         * output.cc (Output_data_got::add_global): Added got_type parameter.
15366         (Output_data_got::add_global_with_rel): Likewise.
15367         (Output_data_got::add_global_with_rela): Likewise.
15368         (Output_data_got::add_global_pair_with_rel): New function.
15369         (Output_data_got::add_global_pair_with_rela): New function.
15370         (Output_data_got::add_local): Added got_type parameter.
15371         (Output_data_got::add_local_with_rel): Likewise.
15372         (Output_data_got::add_local_with_rela): Likewise.
15373         (Output_data_got::add_local_pair_with_rel): New function.
15374         (Output_data_got::add_local_pair_with_rela): New function.
15375         (Output_data_got::add_global_tls): Removed.
15376         (Output_data_got::add_global_tls_with_rel): Removed.
15377         (Output_data_got::add_global_tls_with_rela): Removed.
15378         (Output_data_got::add_local_tls): Removed.
15379         (Output_data_got::add_local_tls_with_rel): Removed.
15380         (Output_data_got::add_local_tls_with_rela): Removed.
15381         * output.h (Output_data_got::add_global): Added got_type parameter.
15382         (Output_data_got::add_global_with_rel): Likewise.
15383         (Output_data_got::add_global_with_rela): Likewise.
15384         (Output_data_got::add_global_pair_with_rel): New function.
15385         (Output_data_got::add_global_pair_with_rela): New function.
15386         (Output_data_got::add_local): Added got_type parameter.
15387         (Output_data_got::add_local_with_rel): Likewise.
15388         (Output_data_got::add_local_with_rela): Likewise.
15389         (Output_data_got::add_local_pair_with_rel): New function.
15390         (Output_data_got::add_local_pair_with_rela): New function.
15391         (Output_data_got::add_global_tls): Removed.
15392         (Output_data_got::add_global_tls_with_rel): Removed.
15393         (Output_data_got::add_global_tls_with_rela): Removed.
15394         (Output_data_got::add_local_tls): Removed.
15395         (Output_data_got::add_local_tls_with_rel): Removed.
15396         (Output_data_got::add_local_tls_with_rela): Removed.
15397         * resolve.cc (Symbol::override_base_with_special): Removed
15398         reference to has_got_offset_ field.
15399         * symtab.cc (Symbol::init_fields): Replaced initialization
15400         of got_offset_ with got_offsets_.  Removed initialization
15401         of has_got_offset_
15402         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15403         (Symbol::got_offset): Likewise.
15404         (Symbol::set_got_offset): Likewise.
15405         (Symbol::has_tls_got_offset): Removed.
15406         (Symbol::tls_got_offset): Removed.
15407         (Symbol::set_tls_got_offset): Removed.
15408         (Symbol::got_offset_): Removed.
15409         (Symbol::tls_mod_got_offset_): Removed.
15410         (Symbol::tls_pair_got_offset_): Removed.
15411         (Symbol::got_offsets_): New field.
15412         (Symbol::has_got_offset): Removed.
15413         (Symbol::has_tls_mod_got_offset): Removed.
15414         (Symbol::has_tls_pair_got_offset): Removed.
15415         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15416         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15417         member functions.
15418         (Target_x86_64::Scan::global): Likewise.
15419         (Target_x86_64::Relocate::relocate): Likewise.
15420         (Target_x86_64::Relocate::relocate_tls): Likewise.
15421
15422 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15423
15424         * yyscript.y: Fix spelling error in comment.
15425
15426 2008-03-24  Ian Lance Taylor  <iant@google.com>
15427
15428         * options.h (class General_options): Define build_id option.
15429         * layout.h (class Layout): Declare write_build_id, create_note,
15430         create_build_id.  Add build_id_note_ member.
15431         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15432         "libiberty.h", "md5.h", "sha1.h".
15433         (Layout::Layout): Initialize eh_frame_data_,
15434         eh_frame_hdr_section_, and build_id_note_.
15435         (Layout::finalize): Call create_build_id.
15436         (Layout::create_note): New function, broken out of
15437         Layout::create_gold_note.
15438         (Layout::create_gold_note): Call create_note.
15439         (Layout::create_build_id): New function.
15440         (Layout::write_build_id): New function.
15441         (Close_task_runner::run): Call write_build_id.
15442
15443         * x86_64.cc: Correct license to GPLv3.
15444
15445 2008-03-23  Ian Lance Taylor  <iant@google.com>
15446
15447         * options.cc: Include "demangle.h".
15448         (parse_optional_string): New function.
15449         (parse_long_option): Handle takes_optional_argument.
15450         (parse_short_option): Update dash_z initializer.  Handle
15451         takes_optional_argument.
15452         (General_options::General_options): Initialize do_demangle_.
15453         (General_options::finalize): Set do_demangle_.  Handle demangling
15454         style.
15455         * options.h (parse_optional_string): Declare.
15456         (struct One_option): Add optional_arg field.  Update constructor.
15457         Update call constructor calls.  Add takes_optional_argument
15458         function.
15459         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15460         (DEFINE_optional_string): Define.
15461         (General_options::demangle): Change from DEFINE_bool to
15462         DEFINE_optional_string.
15463         (General_options::no_demangle): New function.
15464         (General_options::do_demangle): New function.
15465         (General_options::set_do_demangle): New function.
15466         (General_options::execstack_status_): Move definition to end of
15467         class definition.
15468         (General_options::static_): Likewise.
15469         (General_options::do_demangle_): New field.
15470         * object.cc (big_endian>::get_symbol_location_info): Call
15471         Options::do_demangle, not Options::demangle.
15472         * symtab.cc (demangle): Likewise.
15473
15474 2008-03-22  Ian Lance Taylor  <iant@google.com>
15475
15476         * gold.h: Include <cstddef> and <sys/types.h>
15477         * options.h: Include <cstring>.
15478
15479 2008-03-21  Ian Lance Taylor  <iant@google.com>
15480
15481         * Added source code to GNU binutils.
15482 \f
15483 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15484
15485 Copying and distribution of this file, with or without modification,
15486 are permitted in any medium without royalty provided the copyright
15487 notice and this notice are preserved.
15488
15489 Local Variables:
15490 mode: change-log
15491 left-margin: 8
15492 fill-column: 74
15493 version-control: never
15494 End: