ea67ee959f4e5548685866751298d9a5524cac50
[external/binutils.git] / gold / ChangeLog
1 2013-12-10  Roland McGrath  <mcgrathr@google.com>
2
3         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
4         with $(INSTALL_PROGRAM_ENV).
5         * Makefile.in: Regenerate.
6
7 2013-11-22  Cary Coutant  <ccoutant@google.com>
8
9         * configure.ac: Add check for which library is needed for
10         dlopen.
11         * configure: Regenerate.
12
13 2013-11-22  Cary Coutant  <ccoutant@google.com>
14
15         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
16         assembler.
17         * testsuite/Makefile.in: Regenerate.
18
19 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
20
21         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
22         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
23         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
24         (Target_x86_64<size>::Scan::local): Likewise.
25         (Target_x86_64<size>::Scan::global): Likewise.
26         (Target_x86_64<size>::Relocate::relocate): Likewise.
27         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
28         Likewise.
29         (Target_x86_64<size>::Scan::check_non_pic(): Handle
30         R_X86_64_PC32_BND.
31
32         * testsuite/Makefile.am (check_PROGRAMS): Add
33         exception_x86_64_bnd_test.
34         (exception_x86_64_bnd_test_SOURCES): New macro.
35         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
36         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
37         (exception_x86_64_bnd_test_LDADD): Likewise.
38         (exception_x86_64_bnd_1.o): New rule.
39         (exception_x86_64_bnd_2.o): Likewise.
40         * testsuite/Makefile.in: Regenerated.
41
42 2013-11-15  Alan Modra  <amodra@gmail.com>
43
44         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
45         accessor.
46         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
47         Only call ppc64_local_entry_offset for 64-bit.  Restrict
48         symval_for_branch lookup to ELFv1.
49         (Stub_table::add_plt_call_entry): Use unsigned int off.
50         (Output_data_glink::Address, invalid_address): New.
51         (Output_data_glink::add_eh_frame): Move out of line.  Add
52         support for ELFv2.
53         (Output_data_glink::add_global_entry, find_global_entry,
54         global_entry_address): New functions.
55         (Output_data_glink::global_entry_stubs_, end_branch_table_,
56         ge_size): New variables.
57         (Output_data_glink::set_final_data_size): Add global entry
58         stub sizing.
59         (Output_data_glink::do_write): Write global entry stubs.
60         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
61         parameter.  Return true for ELFv2.  Adjust callers.
62         (Target_powerpc::Scan::local, global): Restrict opd lookup to
63         ELFv1.  Similarly for ifunc and dynamic relocation processing
64         specific to ELFv1.  Recognize that symbols are defined on
65         their plt entries for ELFv2.
66         (Target_powerpc::symval_for_branch): Assert if called for
67         ELFv2 or ppc32.
68         (Target_powerpc::Relocate::relocate): Use global entry plt
69         stub for symbol value if such exists on ELFv2.
70         (Target_powerpc::Relocate::relocate): Don't call
71         symval_for_branch when ELFv2.  Do adjust for local entry
72         offset when ELFv2.
73         (Target_powerpc::do_dynsym_value): Set symbols to global entry
74         plt stub for ELFv2.
75         (Target_powerpc::do_plt_address_for_global): Similarly.
76
77 2013-11-14  Cary Coutant  <ccoutant@google.com>
78
79         Revert patch -- this did not fix the problem, and there is
80         no race there.
81
82         2013-11-14  Cary Coutant  <ccoutant@google.com>
83
84             PR gold/14860
85             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
86             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
87             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
88             updating fde_offsets_.
89             (Eh_frame_hdr::lock_): New data member.
90
91 2013-11-14  Cary Coutant  <ccoutant@google.com>
92
93         * dwp.cc (Dwo_file_entry): New type.
94         (File_list): Use Dwo_file_entry.
95         (Dwo_file::verify): New function.
96         (Dwo_file::verify_dwo_list): New function.
97         (Dwo_file::sized_verify_dwo_list): New function.
98         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
99         list.
100         (Dwp_options): New enum type.
101         (dwp_options): Add --verify-only.
102         (usage): Likewise.
103         (main): Likewise.
104         * dwp.h (gold_info): Add declaration.
105
106 2013-11-14  Cary Coutant  <ccoutant@google.com>
107
108         PR gold/14860
109         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
110         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
111         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
112         updating fde_offsets_.
113         (Eh_frame_hdr::lock_): New data member.
114
115 2013-11-06  Cary Coutant  <ccoutant@google.com>
116
117         PR gold/15758
118         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
119         before reloc sections.
120
121 2013-11-04  Alan Modra  <amodra@gmail.com>
122
123         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
124         (Symbol::needs_dynamic_reloc): Test new flag.
125         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
126         (Target_powerpc::Scan::get_reference_flags): Add target param.
127         Return FUNC_DESC_ABI for 64-bit ELFv1.
128         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
129         call.
130         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
131         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
132
133 2013-10-31  Cary Coutant  <ccoutant@google.com>
134
135         Restore support for dwp v2 DWARF package file format.
136
137         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
138         tu_length parameter.  Adjust all callers.
139         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
140         * dwp.cc: Include dwarf.h.
141         (Section_bounds): New struct type.
142         (Unit_set): New struct type.
143         (Dwo_file::Dwo_file): Initialize new data member.
144         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
145         Combine and rename to...
146         (Dwo_file::read_unit_index): ...this.
147         (Dwo_file::sized_read_compunit_index)
148         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
149         (Dwo_file::sized_read_unit_index): ...this.
150         (Dwo_file::copy_section): Remove section_name, is_str_offsets
151         parameters; add section_id parameter.
152         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
153         (Dwo_file::add_unit_set): ...this.
154         (Dwo_file::shndx_map_): Remove.
155         (Dwo_file::sect_offsets_): New data member.
156         (Dwp_output_file::Dwp_output_file): Initialize new data members.
157         (Dwp_output_file::add_section): Rename to...
158         (Dwp_output_file::add_contribution): ...this.
159         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
160         (Dwp_output_file::add_tu_set): Likewise.
161         (Dwp_output_file::Contribution): New type.
162         (Dwp_output_file::Section::contributions): New data member.
163         (Dwp_output_file::Cu_or_tu_set): Remove.
164         (Dwp_output_file::Section::Section): New ctor.
165         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
166         (Dwp_output_file::Dwp_index::Section_table): New type.
167         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
168         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
169         parameter.
170         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
171         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
172         (Dwp_output_file::Dwp_index::section_table): New member function.
173         (Dwp_output_file::Dwp_index::section_table_end): New member function.
174         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
175         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
176         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
177         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
178         (Dwp_output_file::Dwp_index::section_table_): New data member.
179         (Dwp_output_file::Dwp_index::section_mask_): New data member.
180         (Dwp_output_file::add_output_section): New member function.
181         (Dwp_output_file::write_new_section): New member function.
182         (Dwp_output_file::write_contributions): New member function.
183         (Dwp_output_file::section_id_map_): New data member.
184         (class Dwo_id_info_reader): Remove.
185         (class Unit_reader): New class.
186         (get_dwarf_section_name): New function.
187         (Dwo_file::read_executable): Adjust initializations of class data.
188         (Dwo_file::read): Add support for v2 package file format.
189         (Dwo_file::read_unit_index): Likewise.
190         (Dwo_file::sized_read_unit_index): Likewise.
191         (Dwo_file::copy_section): Likewise.
192         (Dwo_file::add_unit_set): Likewise.
193         (Dwp_output_file::add_output_section): Likewise.
194         (Dwp_output_file::add_contribution): Likewise.
195         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
196         for empty slot.
197         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
198         file format.
199         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
200         slot.
201         (Dwp_output_file::initialize): Remove unused function.
202         (Dwp_output_file::finalize): Add support for v2 package file format.
203         (Dwp_output_file::write_index): Likewise.
204         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
205         function prototype.
206
207 2013-10-31  Cary Coutant  <ccoutant@google.com>
208
209         * configure.ac: Fix check for -fmerge-constants.
210         * configure.ac: Regenerate.
211
212 2013-10-30  Roland McGrath  <mcgrathr@google.com>
213
214         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
215         Correct 9-byte nop sequence to match what the assembler generates.
216
217 2013-10-30  Alan Modra  <amodra@gmail.com>
218
219         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
220         ppc64_local_entry_offset, ppc64_local_entry_offset,
221         do_read_symbols): New functions.
222         (Powerpc_relobj::e_flags_, st_other_): New vars.
223         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
224         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
225         (Powerpc_relobj::e_flags_): New var.
226         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
227         and adjust for ELFv2.
228         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
229         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
230         (Powerpc_dynobj::do_find_special_sections): Likewise.
231         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
232         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
233         to ELFv2 local entry.
234         (Target_powerpc::do_relax): No thread safe barriers needed for
235         ELFv2.
236         (Output_data_plt_powerpc::initial_plt_entry_size_,
237         plt_entry_size): Delete.  Replace all uses with
238         first_plt_entry_offset() and plt_entry_size().
239         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
240         reserved_size parm.  Update callers.
241         (Output_data_plt_powerpc::entry_count): Update.
242         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
243         and use Target_powerpc::first_plt_entry_offset().
244         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
245         rename to plt_entry_size.
246         (Output_data_plt_powerpc::add_ifunc_entry,
247         add_local_ifunc_entry): Adjust reloc for ELFv2.
248         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
249         (glink_eh_frame_fde_64v2): New.
250         (Stub_table::plt_call_size): Support ELFv2 sizing.
251         (Output_data_glink::add_eh_frame): Use the new FDE.
252         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
253         (Stub_table::do_write): Write ELFv2 stubs and glink.
254         (Target_powerpc::Relocate::relocate): Replaces nop after call
255         with ld 2,24(1) and adjust local offset destination for ELFv2.
256
257 2013-10-30  Alan Modra  <amodra@gmail.com>
258
259         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
260         (Target_powerpc::Scan::global, local): Likewise.
261         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
262         on all ppc64 @h and @ha relocs.
263
264 2013-10-14  Alan Modra  <amodra@gmail.com>
265
266         * output.h (Output_data_got::add_constant): Tidy.
267         (Output_data_got::add_constant_pair): New function.
268         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
269         methods used so as to first call reserve_ent().
270
271 2013-10-11  Roland McGrath  <mcgrathr@google.com>
272
273         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
274         add_got_entry and add_got_entry_pair.
275
276         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
277         (HAVE_PUBNAMES): Likewise.
278         * configure: Regenerate.
279
280         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
281         * testsuite/Makefile.in: Regenerate.
282
283         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
284         Remove const from declaration.
285         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
286         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
287         * output.h (Output_file_header): Remove const from member target_
288         and corresponding constructor argument.
289         * output.cc (Output_file_header::Output_file_header): Update prototype.
290         (Output_file_header::do_sized_write): Use this->target_ in place
291         of parameters()->target().
292
293         * testsuite/undef_symbol.cc (Foo::get_a): New method.
294
295         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
296         * configure: Regenerate.
297         * Makefile.in: Regenerate.
298         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
299         * testsuite/merge_string_literals_2.c: Likewise.
300         * testsuite/Makefile.am
301         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
302         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
303         literal -fmerge-constants.
304         * testsuite/Makefile.in: Regenerate.
305
306         * i386.cc (Target_i386): Remove unused member dynbss_.
307         * arm.cc (Target_arm): Likewise.
308         * powerpc.cc (Target_powerpc): Likewise.
309         * sparc.cc (Target_sparc): Likewise.
310         * tilegx.cc (Target_tilegx): Likewise.
311         * x86_64.cc (Target_x86_64): Likewise.
312         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
313         type_signature_, type_offset_.
314         * plugin.h (Plugin_hook): Remove unused member layout_.
315         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
316         mapfile_.
317         (Read_member): Remove unused members input_objects_, symtab_,
318         mapfile_, layout_.
319         (Check_library): Remove unused member symtab_.
320         * archive.h (Lib_group): Remove unused member lib_.
321         * archive.cc (Lib_group::Lib_group): Update initializer.
322         * incremental.h (Incremental_binary): Remove unused member target_.
323         (Incremental_script_entry): Removed unused member script_.
324         * layout.h (Write_symbols_task): Remove unused member input_objects_.
325         * icf.h (Icf): Remove unused member num_tracked_relocs.
326
327         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
328         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
329         its only use.
330         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
331
332         * archive.h: Use struct rather than class for forward declaration
333         of Read_symbols_data.
334
335 2013-10-07  Cary Coutant  <ccoutant@google.com>
336
337         PR gold/16010
338         * testsuite/Makefile.am (icf_test): Fix dependencies.
339         (icf_safe_test): Likewise.
340         (icf_safe_so_test): Likewise.
341         (large_symbol_alignment): Add empty _LDADD rule.
342         * testsuite/Makefile.in: Regenerate.
343
344 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
345
346         PR gold/15927
347         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
348         relocation for R_X86_64_32 on x32.
349
350 2013-08-27  Roland McGrath  <mcgrathr@google.com>
351
352         * output.cc (Output_segment::set_section_addresses): Take new
353         Target* argument.  If target->isolate_execinstr() and the segment
354         is executable and starts at a target->abi_pagesize() boundary,
355         pad its end out to a target->abi_pagesize() boundary with code fill.
356         * output.h (Output_segment::set_section_addresses): Update decl.
357         * layout.h (Layout::check_output_data_for_reset_values): Take new
358         argument RELAX_OUTPUTS.
359         (Layout): New member relax_output_list_.
360         (Layout::add_relax_output): New method.
361         * layout.cc (Layout::Layout): Update constructor.
362         (Layout::reset_relax_output): New method.
363         (Layout::clean_up_after_relaxation): Call it.
364         (Layout::prepare_for_relaxation): Update caller.
365         (Layout::set_segment_offsets): Update callers of set_section_addresses.
366         Call reset_relax_output before re-processing segments for
367         isolate_execinstr case.
368         (Layout::write_data): Handle relax_output_list_.
369         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
370         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
371
372 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
373
374         PR binutils/15834
375         * object.h: Fix typos.
376
377 2013-08-16  Roland McGrath  <mcgrathr@google.com>
378
379         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
380         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
381
382 2013-08-07  Cary Coutant  <ccoutant@google.com>
383
384         Revert support for v2 DWP files:
385
386         2013-03-01  Cary Coutant  <ccoutant@google.com>
387
388             Add dwp support for v2 DWARF package file format.
389             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
390             tu_length parameter.  Adjust all callers.
391             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
392             * dwp.cc: Include dwarf.h.
393             (Section_bounds): New struct type.
394             (Unit_set): New struct type.
395             (Dwo_file::Dwo_file): Initialize new data member.
396             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
397             Combine and rename to...
398             (Dwo_file::read_unit_index): ...this.
399             (Dwo_file::sized_read_compunit_index)
400             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
401             (Dwo_file::sized_read_unit_index): ...this.
402             (Dwo_file::copy_section): Remove section_name, is_str_offsets
403             parameters; add section_id parameter.
404             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
405             (Dwo_file::add_unit_set): ...this.
406             (Dwo_file::shndx_map_): Remove.
407             (Dwo_file::sect_offsets_): New data member.
408             (Dwp_output_file::Dwp_output_file): Initialize new data members.
409             (Dwp_output_file::add_section): Rename to...
410             (Dwp_output_file::add_contribution): ...this.
411             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
412             (Dwp_output_file::add_tu_set): Likewise.
413             (Dwp_output_file::Contribution): New type.
414             (Dwp_output_file::Section::contributions): New data member.
415             (Dwp_output_file::Cu_or_tu_set): Remove.
416             (Dwp_output_file::Section::Section): New ctor.
417             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
418             (Dwp_output_file::Dwp_index::Section_table): New type.
419             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
420             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
421             parameter.
422             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
423             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
424             (Dwp_output_file::Dwp_index::section_table): New member function.
425             (Dwp_output_file::Dwp_index::section_table_end): New member function.
426             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
427             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
428             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
429             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
430             (Dwp_output_file::Dwp_index::section_table_): New data member.
431             (Dwp_output_file::Dwp_index::section_mask_): New data member.
432             (Dwp_output_file::add_output_section): New member function.
433             (Dwp_output_file::write_new_section): New member function.
434             (Dwp_output_file::write_contributions): New member function.
435             (Dwp_output_file::section_id_map_): New data member.
436             (class Dwo_id_info_reader): Remove.
437             (class Unit_reader): New class.
438             (get_dwarf_section_name): New function.
439             (Dwo_file::read_executable): Adjust initializations of class data.
440             (Dwo_file::read): Add support for v2 package file format.
441             (Dwo_file::read_unit_index): Likewise.
442             (Dwo_file::sized_read_unit_index): Likewise.
443             (Dwo_file::copy_section): Likewise.
444             (Dwo_file::add_unit_set): Likewise.
445             (Dwp_output_file::add_output_section): Likewise.
446             (Dwp_output_file::add_contribution): Likewise.
447             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
448             for empty slot.
449             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
450             file format.
451             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
452             slot.
453             (Dwp_output_file::initialize): Remove unused function.
454             (Dwp_output_file::finalize): Add support for v2 package file format.
455             (Dwp_output_file::write_index): Likewise.
456             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
457             function prototype.
458
459 2013-07-31  Cary Coutant  <ccoutant@google.com>
460
461         * object.cc (Sized_relobj::do_output_section_address): New function.
462         (Sized_relobj): Instantiate explicitly.
463         * object.h (Object::output_section_address): New function.
464         (Object::do_output_section_address): New function.
465         (Sized_relobj::do_output_section_address): New function.
466         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
467
468 2013-07-30  Cary Coutant  <ccoutant@google.com>
469             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
470
471         * parameters.cc (Parameters::entry): Return target-specific entry
472         symbol name.
473         * target.h (Target::entry_symbol_name): New function.
474         (Target_info::entry_symbol_name): New data member.
475
476         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
477         * i386.cc (Target_i386::i386_info): Likewise.
478         (Target_i386_nacl::i386_nacl_info): Likewise.
479         * sparc.cc (Target_sparc::sparc_info): Likewise.
480         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
481         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
482         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
483         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
484
485 2013-07-22  Sterling Augustine  <saugustine@google.com>
486
487         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
488         Convert parameter shndx to local variable. Add parameters symtab
489         and symtab_size.  Scan over section names.  Find relocation
490         section corresponding to current section.  Create and initialize
491         reloc_mapper_ and reloc_type_.
492         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
493         unit_length to off_t.  Initialize member unit_length_.  Fill in field
494         cu_offset_.
495         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
496         Initialize new fields unit_length_ and cu_offset_.
497         (Dwarf_pubnames_table::read_section): Update prototype.
498         (Dwarf_pubnames_table::cu_offset): New member function.
499         (Dwarf_pubnames_table::subsection_size): Likewise.
500         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
501         New fields.
502         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
503         member functions public.
504         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
505         Update comment.  Rework logic.  Move repeated parts to...
506         (Gdb_index_info_reader::read_pubtable): ...here. New function.
507         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
508         pubtypes_table_, and stmt_list_offset.
509         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
510         Gdb_index::find_pubtype_offset,
511         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
512         (Gdb_index::pubnames_read): Update prototype and rework logic.
513         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
514         Forward declare.
515         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
516         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
517         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
518         Gdb_index::map_pubtable_to_dies):
519         Declare functions.
520         (Gdb_index::pubnames_read): Update declaration.
521         (Gdb_index::Pubname_offset_map): New type.
522         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
523         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
524         Gdb_index::stmt_list_offset): Declare.
525         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
526         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
527         Gdb_index::pubtypes_offset_): Remove.
528
529 2013-07-19  Roland McGrath  <mcgrathr@google.com>
530
531         * options.h (General_options): Add -Trodata-segment option.
532         * parameters.cc (Parameters::check_rodata_segment): New function.
533         (Parameters::set_target_once): Call it.
534         * parameters.h (Parameters): Declare it (private member function).
535         * layout.cc (load_seg_unusable_for_headers): New function, broken
536         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
537         then validate rodata segment rather than text segment.
538         (relaxation_loop_body): Call that.
539         (is_text_segment): New function.  Don't admit a non-executable
540         segment if TARGET->isolate_execinstr().
541         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
542
543 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
544
545         PR gold/15070
546         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
547         * nacl.h (Sniff_file::View::View): Request aligned view.
548
549 2013-07-11  Cary Coutant  <ccoutant@google.com>
550
551         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
552         correct BRLT entry size.
553
554 2013-07-03  Alan Modra  <amodra@gmail.com>
555
556         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
557         comment.
558
559 2013-07-01  Cary Coutant  <ccoutant@google.com>
560
561         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
562         reloc_type_.
563         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
564         (Dwarf_ranges_table::lookup_reloc): New function.
565         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
566         reloc_type_.
567         (Dwarf_ranges_table::lookup_reloc): New function.
568         (Dwarf_ranges_table::reloc_type_): New data member.
569
570 2013-06-27  Jing Yu  <jingyu@google.com>
571
572         PR gold/15662
573         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
574         function.
575         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
576         (Target_powerpc::do_relax): Call the above.
577
578 2013-06-27  Cary Coutant  <ccoutant@google.com>
579
580         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
581         on garbage collected .opd section.
582
583 2013-06-27  Alan Modra  <amodra@gmail.com>
584
585         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
586         is non-zero.
587         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
588         (Target_powerpc::do_function_location): Likewise for loc->shndx.
589
590 2013-06-14  Cary Coutant  <ccoutant@google.com>
591
592         * resolve.cc (Symbol::override_base): Don't override st_type
593         from plugin placeholder symbols.
594         (Symbol_table::resolve): Likewise.
595         (Symbol_table::should_override): Don't complain about TLS mismatch
596         if the TO symbol is a plugin placeholder.
597         * testsuite/Makefile.am (plugin_test_tls): New test.
598         * testsuite/Makefile.in: Regenerate.
599         * testsuite/plugin_test_tls.sh: New test script.
600         * testsuite/two_file_test_2_tls.cc: New test source.
601         * testsuite/two_file_test_tls.cc: New test source.
602
603 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
604
605         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
606         the maximum segment alignment is larger than the page size.
607         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
608         correctly aligns the symbols with large alignemnt.
609         * testsuite/Makefile.in: Regenerate.
610         * testsuite/large_symbol_alignment.cc: New file.
611
612 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
613             Sriraman Tallam  <tmsriram@google.com>
614
615         * options.h (sort_section): New option.
616         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
617         Rename from Input_section_sort_section_name_special_ordering_compare.
618         (Input_section_sort_section_name_compare): New struct.
619         * output.cc (Output_section::Input_section_sort_section_name_compare::
620         operator()): New function.
621         (Output_section::sort_attached_input_sections): Use new sort function
622         for .text if --sort-section=name is specified.
623         * layout.cc (Layout::make_output_section):
624         Add sorting by name when --sort-section=name is specified.
625         * testsuite/Makefile.am (text_section_grouping): Test option
626         --sort-section=name.
627         * testsuite/Makefile.in: Regenerate.
628         * testsuite/section_sorting_name.cc: New file.
629         * testsuite/section_sorting_name.sh: New file.
630
631 2013-05-21  Cary Coutant  <ccoutant@google.com>
632
633         * symtab.h (Symbol::is_cxx_vtable): New function.
634         * target-reloc.h (relocate_section): Check for vtable symbol.
635         * testsuite/Makefile.am (missing_key_func.sh): New test case.
636         * testsuite/Makefile.in: Regenerate.
637         * testsuite/missing_key_func.cc: New test source.
638         * testsuite/missing_key_func.sh: New test script.
639
640 2013-05-21  Cary Coutant  <ccoutant@google.com>
641
642         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
643         type of enclosing symbol.
644         (Relocate_info::location): Check symbol type when describing symbol.
645         * object.h (Symbol_location_info): Remove unused line_number;
646         add enclosing_symbol_type.
647         * testsuite/debug_msg.sh: Adjust expected output.
648
649 2013-05-13  Cary Coutant  <ccoutant@google.com>
650
651         * configure.ac: Export DEFAULT_TARGET.
652         * configure: Regenerate.
653         * Makefile.in: Regenerate.
654         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
655         * testsuite/Makefile.in: Regenerate.
656         * testsuite/debug_msg.sh: Delete duplicate tests.
657         Don't check undef_int error message match for powerpc where the
658         source file and line number aren't available.
659
660 2013-05-10  Roland McGrath  <mcgrathr@google.com>
661
662         * options.h (General_options): Add --rosegment-gap option.
663         * options.cc (finalize): --rosegment-gap implies --rosegment.
664         * layout.cc (set_segment_offsets): Let user option override
665         target->rosegment_gap().
666
667 2013-05-10  Roland McGrath  <mcgrathr@google.com>
668
669         * options.h (General_options): Remove leading space from help
670         messages for -nostdlib and --rosegment.
671
672 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
673
674         PR ld/15365
675         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
676
677 2013-05-03  Alan Modra  <amodra@gmail.com>
678
679         * merge.cc (Output_merge_string::do_add_input_section): Correct
680         scan for number of strings.  Rename vars to avoid shadowing.
681         Include missing terminator in input_size_.
682
683 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
684
685         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
686         Restore empty string handling.
687
688 2013-05-01  Cary Coutant  <ccoutant@google.com>
689
690         * stringpool.cc (Stringpool_template::new_key_offset): Fix
691         uninitialized warning.
692
693 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
694
695         * output.cc (Output_section::add_merge_input_section): Allow
696         to merge sections if the alignment is more than character size.
697         * merge.h (Output_merge_string::Output_merge_string): Remove
698         assert.
699         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
700         only not-null strings. Check the alignment of strings.
701         * stringpool.h
702         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
703         alignment as the argument.
704         (Stringpool_template<Stringpool_char>::addralign_): New class member.
705         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
706         Align non-zero length strings according to the addralign_.
707         (Stringpool_template<Stringpool_char>::set_string_offsets):
708         Updating offsets according to the given alignment.
709         * testsuite/Makefile.am (text_section_grouping): Test if string
710         literals are getting merged.
711         * testsuite/Makefile.in: Regenerate.
712         * testsuite/merge_string_literals_1.c: New file.
713         * testsuite/merge_string_literals_2.c: Ditto.
714         * testsuite/merge_string_literals.sh: Ditto.
715
716 2013-04-26  Ian Lance Taylor  <iant@google.com>
717
718         * target-reloc.h (relocate_section): If the reloc offset is out of
719         range, pass VIEW as NULL to relocate.relocate.
720         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
721         * i386.cc (Target_i386::Relocate::relocate): Likewise.
722         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
723         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
724         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
725         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
726
727 2013-04-26  Geoff Pike  <gpike@chromium.org>
728
729         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
730         * layout.cc (Hash_task): New class.
731         (Layout::queue_build_id_tasks): New function.
732         (Layout::write_build_id): Handle single-thread portion of build ID
733         computation.  (In some cases, all of it is single-threaded.)  Replace
734         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
735         functionality in fewer lines of code.
736         * layout.h (Layout::queue_build_id_tasks): New function declaration.
737         * options.h (General_options): make "--build-id" default to tree
738         rather than sha1.  Add two new options related to --build-id=tree:
739         --build-id-chunk-size-for-treehash and
740         --build-id-min-file-size-for-treehash.
741         * Makefile.am: add testing of --build-id=tree and related new options
742         (these tests will be invoked by "make check").
743         * Makefile.in: Regenerate.
744
745 2013-04-25  Alan Modra  <amodra@gmail.com>
746
747         * configure.tgt: Add powerpcle and powerpc64le.
748
749 2013-04-22  Alan Modra  <amodra@gmail.com>
750
751         PR gold/15355
752         * layout.cc (Layout::segment_precedes): Allow more than one
753         segment with the same type and flags.
754
755 2013-04-15  Cary Coutant  <ccoutant@google.com>
756
757         * layout.cc (Layout::set_relocatable_section_offsets): Don't
758         allocate space in file for BSS sections.
759
760 2013-04-15  Cary Coutant  <ccoutant@google.com>
761
762         * script-sections.cc (Orphan_output_section): Reset address
763         to zero after each orphaned section for relocatable links.
764
765 2013-04-15  Cary Coutant  <ccoutant@google.com>
766
767         * symtab.cc (Symbol_table::sized_write_globals): Subtract
768         section starting address for relocatable link.
769         * testsuite/Makefile.am (script_test_11): New test.
770         * testsuite/Makefile.in: Regenerate.
771         * testsuite/script_test_11.c: New source file.
772         * testsuite/script_test_11.t: New linker script.
773
774 2013-04-13  Alan Modra  <amodra@gmail.com>
775
776         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
777         owner when sections are not adjacent and exceed group size.
778         (Target_powerpc::group_sections): Handle corner case.
779         (Target_powerpc::Branch_info::make_stub): Handle case where
780         stub table doesn't exist due to branches in non-exec sections.
781         (Target_powerpc::Relocate::relocate): Likewise.
782
783 2013-04-11  Alan Modra  <amodra@gmail.com>
784
785         PR gold/15354
786         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
787         .branch_lt to match bfd ld.  Adjust comments throughout file.
788
789 2013-04-04  Ian Lance Taylor  <iant@google.com>
790
791         GCC PR c++/56840
792         * object.cc (do_layout_deferred_sections): Handle .eh_frame
793         sections before checking whether they are included in the link.
794
795 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
796
797         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
798         object before calling the plugin claim_file handler.  Pass the elf
799         object of the archive to the plugin. Delete the elf object if the
800         plugin claims the file.
801
802 2013-03-21  Alan Modra  <amodra@gmail.com>
803
804         * layout.cc (Layout::set_segment_offsets): Accept writable .text
805         segment when omagic.
806
807 2013-03-21  Alan Modra  <amodra@gmail.com>
808
809         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
810         comparison warning.
811         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
812         uninitialized" warning.
813
814 2013-03-20  Alan Modra  <amodra@gmail.com>
815
816         * symtab.h (Symbol::clear_version): New function.
817         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
818         is_needed by weak references.  Clear version for symbols defined
819         in as-needed objects that are not needed.
820
821 2013-03-15  Alan Modra  <amodra@gmail.com>
822
823         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
824         static and public.  Add report_err param.  Return false for data refs.
825         (Target_powerpc::rela_dyn_section): New overloaded function.
826         (Target_powerpc::plt_, iplt_): Elucidate.
827         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
828         (Output_data_plt_powerpc::do_write): Don't write .iplt.
829         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
830         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
831         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
832         push_branch and make_plt_entry for ifunc syms when
833         reloc_needs_plt_for_ifunc.
834         (Target_powerpc::Relocate::relocate): Don't use plt entry value
835         for ifunc unless reloc_needs_plt_for_ifunc.
836
837 2013-03-15  Alan Modra  <amodra@gmail.com>
838
839         * gc.h (gc_process_relocs): Don't look through function descriptors.
840         * icf.cc (get_section_contents): Do so here instead.
841
842 2013-03-13  Alan Modra  <amodra@gmail.com>
843
844         * powerpc.cc (is_branch_reloc): Forward declare.
845         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
846         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
847         false for 64-bit, true for 32-bit non-branch relocs.
848         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
849         * testsuite/Makefile.am (icf_test): Use linker map file instead of
850         nm output.
851         (icf_safe_test): Generate linker map file as well as nm output.
852         (icf_safe_so_test): Likewise.
853         * testsuite/Makefile.in: Regenerate.
854         * testsuite/icf_test.sh: Parse linker map file to determine
855         section folding.
856         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
857         * testsuite/icf_safe_so_test.sh: Likewise.
858         (X86_32_or_ARM_specific_safe_fold): Merge into..
859         (arch_specific_safe_fold): ..this.
860         (X86_64_specific_safe_fold): Delete unused function.
861
862 2013-03-12  Alan Modra  <amodra@gmail.com>
863
864         * gc.h (gc_process_relocs): Look through function descriptors
865         to determine shndx, symvalue and addend used by ICF.  Tidy
866         variable duplication.
867
868 2013-03-11  Alan Modra  <amodra@gmail.com>
869
870         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
871         * layout.cc (Layout_task_runner::run): ..to here.
872         * symtab.h (struct Symbol_location): Extract from..
873         (class Symbol_table): ..here.
874         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
875         * target.h (class Target): Add function_location and
876         do_function_location functions.
877         (class Sized_target): Add do_function_location.
878         * object.h (class Sized_relobj_file): Move find_shdr..
879         (class Object): ..to here.
880         * object.cc: Likewise.  Update to suit.  Instantiate.
881         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
882         * powerpc.cc (class Powerpc_dynobj): New.
883         (Target_powerpc::do_function_location): New function.
884         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
885         (Powerpc_dynobj::do_read_symbols): New function.
886         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
887
888 2013-03-08  Ian Lance Taylor  <iant@google.com>
889
890         * options.cc (General_options::string_to_object_format): Accept
891         "default".
892
893 2013-03-08  Alan Modra  <amodra@gmail.com>
894
895         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
896         pointer to Post_fde.
897         (struct Post_fde): Move definition to here..
898         * ehframe.cc (struct Post_fde): ..from here.
899         (Cie::write): Don't alloc Post_fde.
900         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
901
902 2013-03-07  Alan Modra  <amodra@gmail.com>
903
904         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
905         relocation referencing .LC0.
906         * testsuite/discard_locals_test.sh: Remove FIXMEs.
907
908 2013-03-07  Alan Modra  <amodra@gmail.com>
909
910         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
911         always_inline.  Add assembly for powerpc to avoid GOT.
912
913 2013-03-07  Alan Modra  <amodra@gmail.com>
914
915         * testsuite/script_test_10.sh: Don't test .bss section
916         header number.
917
918 2013-03-06  Alan Modra  <amodra@gmail.com>
919
920         * powerpc.cc (class Powerpc_relobj): Move some member functions.
921         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
922         all callers.  Handle folded sections.
923         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
924         to Powerpc_relobj.
925         (Global_symbol_visitor_opd::operator()): Likewise.
926
927 2013-03-04  Alan Modra  <amodra@gmail.com>
928
929         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
930         * testsuite/Makefile.in: Regenerate.
931
932 2013-03-01  Cary Coutant  <ccoutant@google.com>
933
934         Add dwp support for v2 DWARF package file format.
935         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
936         tu_length parameter.  Adjust all callers.
937         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
938         * dwp.cc: Include dwarf.h.
939         (Section_bounds): New struct type.
940         (Unit_set): New struct type.
941         (Dwo_file::Dwo_file): Initialize new data member.
942         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
943         Combine and rename to...
944         (Dwo_file::read_unit_index): ...this.
945         (Dwo_file::sized_read_compunit_index)
946         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
947         (Dwo_file::sized_read_unit_index): ...this.
948         (Dwo_file::copy_section): Remove section_name, is_str_offsets
949         parameters; add section_id parameter.
950         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
951         (Dwo_file::add_unit_set): ...this.
952         (Dwo_file::shndx_map_): Remove.
953         (Dwo_file::sect_offsets_): New data member.
954         (Dwp_output_file::Dwp_output_file): Initialize new data members.
955         (Dwp_output_file::add_section): Rename to...
956         (Dwp_output_file::add_contribution): ...this.
957         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
958         (Dwp_output_file::add_tu_set): Likewise.
959         (Dwp_output_file::Contribution): New type.
960         (Dwp_output_file::Section::contributions): New data member.
961         (Dwp_output_file::Cu_or_tu_set): Remove.
962         (Dwp_output_file::Section::Section): New ctor.
963         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
964         (Dwp_output_file::Dwp_index::Section_table): New type.
965         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
966         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
967         parameter.
968         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
969         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
970         (Dwp_output_file::Dwp_index::section_table): New member function.
971         (Dwp_output_file::Dwp_index::section_table_end): New member function.
972         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
973         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
974         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
975         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
976         (Dwp_output_file::Dwp_index::section_table_): New data member.
977         (Dwp_output_file::Dwp_index::section_mask_): New data member.
978         (Dwp_output_file::add_output_section): New member function.
979         (Dwp_output_file::write_new_section): New member function.
980         (Dwp_output_file::write_contributions): New member function.
981         (Dwp_output_file::section_id_map_): New data member.
982         (class Dwo_id_info_reader): Remove.
983         (class Unit_reader): New class.
984         (get_dwarf_section_name): New function.
985         (Dwo_file::read_executable): Adjust initializations of class data.
986         (Dwo_file::read): Add support for v2 package file format.
987         (Dwo_file::read_unit_index): Likewise.
988         (Dwo_file::sized_read_unit_index): Likewise.
989         (Dwo_file::copy_section): Likewise.
990         (Dwo_file::add_unit_set): Likewise.
991         (Dwp_output_file::add_output_section): Likewise.
992         (Dwp_output_file::add_contribution): Likewise.
993         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
994         for empty slot.
995         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
996         file format.
997         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
998         slot.
999         (Dwp_output_file::initialize): Remove unused function.
1000         (Dwp_output_file::finalize): Add support for v2 package file format.
1001         (Dwp_output_file::write_index): Likewise.
1002         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1003         function prototype.
1004
1005 2013-03-01  Cary Coutant  <ccoutant@google.com>
1006
1007         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1008         function into class definition in header file.
1009         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1010         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1011         New function.
1012         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1013
1014 2013-02-28  Alan Modra  <amodra@gmail.com>
1015
1016         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1017         * target.cc (Target::do_plt_fde_location): New function.
1018         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1019         accessor function, and constructor param.
1020         (struct Post_fde, Post_fdes): Declare.
1021         (Cie::write): Add post_fdes param.
1022         * ehframe.cc (Fde::write): Use plt_fde_location.
1023         (struct Post_fde): Define.
1024         (Cie::write): Stash FDEs added post merge mapping.
1025         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1026         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1027         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1028         other FDEs.
1029         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1030         (Target_powerpc::has_glink): New function.
1031         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1032         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1033         glink_eh_frame_fde_32, default_fde): New data.
1034         (Stub_table::eh_frame_added_): New var.
1035         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1036         Make const.
1037         (Stub_table::add_eh_frame): New function.
1038         (Output_data_glink::add_eh_frame): New function.
1039         (Target_powerpc::make_glink_section): Call add_eh_frame.
1040
1041 2013-02-15  Ian Lance Taylor  <iant@google.com>
1042
1043         * options.h (DEFINE_uint64_alias): Define.
1044         (class General_options): Add -Ttext-segment as an alias for
1045         -Ttext.
1046
1047 2013-02-15  Alan Modra  <amodra@gmail.com>
1048
1049         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1050         (Stub_table::do_write): ..here, two places.
1051         (Stub_table::plt_call_size): Use it here too.
1052
1053 2013-02-11  Ian Lance Taylor  <iant@google.com>
1054
1055         * descriptors.cc (Descriptors::close_all): New function.
1056         * descriptors.h (class Descriptors): Declare close_all.
1057         (close_all_descriptors): New inline function.
1058         * plugin.cc: Include "descriptors.h".
1059         (Plugin_manager::cleanup): Call close_all_descriptors.
1060
1061 2013-02-06  Alan Modra  <amodra@gmail.com>
1062
1063         * README: Update coding style link.
1064
1065 2013-01-28  Cary Coutant  <ccoutant@google.com>
1066
1067         * dwp.cc (File_list): New typedef.
1068         (Dwo_name_info_reader): New class.
1069         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1070         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1071         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1072         (Dwo_file::read_executable): New function.
1073         (Dwo_file::read): Move common setup code to ...
1074         (Dwo_file::make_object): ... here.
1075         (dwp_options): Add --exec/-e.
1076         (usage): Likewise.
1077         (main): Likewise.
1078
1079 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1080
1081         * layout.cc (Layout::layout): Check for option text_reorder.
1082         (Layout::make_output_section): Ditto.
1083         * options.h (text_reorder): New option.
1084         * output.cc (Input_section_sort_compare): Remove special ordering
1085         of section names.
1086         (Output_section::
1087          Input_section_sort_section_name_special_ordering_compare::
1088          operator()): New function.
1089         (Output_section::sort_attached_input_sections): Use new sort function
1090         for .text.
1091         * output.h (Input_section_sort_section_name_special_ordering_compare):
1092         New struct.
1093         * testsuite/Makefile.am (text_section_grouping): Test option
1094         --no-text-reorder
1095         * testsuite/Makefile.in: Regenerate.
1096         * testsuite/text_section_grouping.sh: Check order of functions without
1097         default text reordering.
1098
1099 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1100
1101         * options.h (General_options): Change default to true for new_dtags.
1102
1103 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1104
1105         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1106         when enable_new_dtags is false.  Only add DT_RUNPATH when
1107         enable_new_dtags is true.
1108
1109 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1110
1111         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1112         used in declaration and definition consistent.
1113         (Target_powerpc::symval_for_branch): Ditto.
1114
1115 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1116
1117         * testsuite/plugin_final_layout.cc: Fix comment.
1118
1119 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1120
1121         * layout.cc (Layout::layout): Do not do default sorting for
1122         text sections when section ordering is specified.
1123         (make_output_section): Ditto.
1124         * testsuite/plugin_final_layout.cc: Name the function sections
1125         to catch reordering issues.
1126
1127 2013-01-15  Alan Modra  <amodra@gmail.com>
1128
1129         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1130         plt-thread-safe.
1131
1132 2013-01-15  Alan Modra  <amodra@gmail.com>
1133
1134         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1135         * testsuite/Makefile.in: Regenerate.
1136
1137 2013-01-14  Alan Modra  <amodra@gmail.com>
1138
1139         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1140         * testsuite/Makefile.in: Regenerate.
1141
1142 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1143
1144         PR bfd/14430
1145         Fix mingw gold build with plugins enabled
1146         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1147         * configure.ac: Export DLOPEN_LIBS and add headers check.
1148         * plugin.cc: Handle non-dlfcn case.
1149         * Makefile.in: Regenerate.
1150         * config.in: Regenerate.
1151         * configure: Regenerate.
1152         * testsuite/Makefile.in: Regenerate.
1153
1154 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1155
1156         * output.h (sort_attached_input_sections): Change to be public.
1157         * script-sections.cc
1158         (Output_section_definition::set_section_addresses): Sort
1159         attached input sections according to section order before linker
1160         script assigns section addresses.
1161         (Orphan_output_section::set_section_addresses): Sort
1162         attached input sections according to section order before linker
1163         script assigns section addresses.
1164         * Makefile.am (final_layout.sh): Use a simple linker script to
1165         check if section ordering still works.
1166         * Makefile.in: Regenerate.
1167
1168 2013-01-09  Ben Cheng  <bccheng@google.com>
1169
1170         * arm.cc (Target_arm::attributes_accept_div): New function.
1171         (Target_arm::attributes_forbid_div): New function.
1172         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1173         attribute using the same new functions as what bfd/elf32_arm.c
1174         does.
1175
1176 2013-01-07  Cary Coutant  <ccoutant@google.com>
1177
1178         PR gold/14993
1179         * output.cc (Output_section::add_input_section): For incremental
1180         updates, don't track input sections that are allocated from patch
1181         space.
1182
1183 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1184             Ian Lance Taylor  <iant@google.com>
1185
1186         PR gold/14897
1187         * configure.ac (--enable-ld): Removed.
1188         (install_as_default): Set to yes only for --enable-gold=default
1189         or --disable-ld.
1190         * configure: Regenerated.
1191
1192 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1193
1194         * options.h (General_options): Add -fuse-ld= for GCC linker
1195         option compatibility.
1196
1197 2013-01-04  Cary Coutant  <ccoutant@google.com>
1198
1199         * configure.ac: Fix typo restoring CXXFLAGS.
1200         * configure: Regenerate.
1201
1202 2013-01-04  Cary Coutant  <ccoutant@google.com>
1203
1204         * testsuite/Makefile.am (CXXLINK_S): New macro.
1205         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1206         * testsuite/Makefile.in: Regenerate.
1207
1208 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1209
1210         * version.cc (print_version): Update copyright year to 2013.
1211
1212 2012-12-20  Ian Lance Taylor  <iant@google.com>
1213
1214         * layout.cc (Layout::special_ordering_of_input_section): New
1215         function.
1216         (Layout::layout): If input section requires special ordering, must
1217         sort input sections.
1218         (Layout::make_output_section): May sort .text input sections.
1219         (Layout::is_section_name_prefix_grouped): Remove.
1220         * layout.h (class Layout): Declare
1221         special_ordering_of_input_section.  Don't declare
1222         is_section_name_prefix_grouped.
1223         * output.cc (Output_section::add_input_section): Revert last
1224         change.
1225         (Output_section::Input_section_sort::match_file_name): Don't crash
1226         if called on output section data.
1227         (Output_section::Input_section_sort_compare): Sort based on
1228         special ordering.
1229         (Output_section::Input_section_sort_section_order_index_compare):
1230         Revert last patch.
1231         (Output_section::sort_attached_input_sections): Likewise.
1232
1233 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1234
1235         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1236         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1237         * output.cc (Output_section::add_input_section): Check if section
1238         name contains special prefix.  Keep input sections to sort such
1239         sections.
1240         (Output_section::Input_section_sort_section_order_index_compare
1241          ::operator()): Group sections according to prefixes.
1242         (Output_section::sort_attached_input_sections): Add condition to
1243         Input_section_entry constructor call.
1244         * testsuite/Makefile.am (text_section_grouping): New test.
1245         * testsuite/Makefile.in: Regenerate.
1246         * testsuite/text_section_grouping.cc: New file.
1247         * testsuite/text_section_grouping.sh: New file.
1248
1249 2012-12-17  Nick Clifton  <nickc@redhat.com>
1250
1251         * Makefile.am: Add copyright notice.
1252         * NEWS: Likewise.
1253         * README: Likewise.
1254         * configure.ac: Likewise.
1255         * ftruncate.c: Likewise.
1256         * Makefile.in: Regenerate.
1257
1258 2012-12-14  Cary Coutant  <ccoutant@google.com>
1259
1260         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1261         --no-as-needed flag.
1262         (exception_separate_shared_12_test): Likewise.
1263         (incremental_copy_test): Likewise.
1264         * testsuite/Makefile.in: Regenerate.
1265
1266 2012-12-14  Cary Coutant  <ccoutant@google.com>
1267
1268         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1269         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1270
1271 2012-12-12  Alan Modra  <amodra@gmail.com>
1272
1273         * powerpc.cc (class Track_tls): New.
1274         (class Relocate, class Scan): Inherit Track_tls.
1275         (Target_powerpc::Scan::local, global): Track tls optimization
1276         and avoid creating plt entry for __tls_get_addr if all uses
1277         are optimized away.
1278         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1279
1280 2012-12-12  Alan Modra  <amodra@gmail.com>
1281
1282         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1283         Replace no_toc_optimize with toc_optimize.
1284         * output.h (Output_section::input_sections): Provide non-const variant.
1285         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1286         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1287         accessors.
1288         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1289         (class Sort_toc_sections): New.
1290         (Target_powerpc::do_finalize_sections): Sort toc sections.
1291         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1292
1293 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1294
1295         * testsuite/binary_unittest.cc (read_all): New function.
1296         (Sized_binary_test): Use it instead of ::read.
1297         * fileread.cc (do_read): Don't assume pread always reads the whole
1298         amount in a single call.
1299
1300 2012-12-10  Alan Modra  <amodra@gmail.com>
1301
1302         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1303         Set EM_PPC64 or EM_PPC here.
1304         (Target_selector_powerpc::do_recognize): Delete.
1305
1306 2012-12-10  Alan Modra  <amodra@gmail.com>
1307
1308         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1309         stub_table_.
1310         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1311
1312 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1313
1314         * testsuite/binary_unittest.cc (Sized_binary_test):
1315         Use open_descriptor rather than ::open.
1316
1317 2012-12-07  Alan Modra  <amodra@gmail.com>
1318
1319         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1320         typedef and invalid_address constant.
1321         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1322         instantiate constants.
1323
1324 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1325
1326         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1327         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1328         * aclocal.m4: Regenerate.
1329         * configure: Regenerate.
1330         * Makefile.in: Regenerate.
1331         * testsuite/Makefile.in: Regenerate.
1332
1333 2012-12-07  Alan Modra  <amodra@gmail.com>
1334
1335         * options.h (General_options): Add no_toc_optimize.
1336         * powerpc.cc (ok_lo_toc_insn): New function.
1337         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1338
1339 2012-12-06  Alan Modra  <amodra@gmail.com>
1340
1341         * options.h (General_options): Add plt_align, plt_static_chain,
1342         plt_thread_safe.  Update stub_group_size help text.
1343         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1344         for new plt_thread_safe_ var.
1345         (use_plt_offset): Correct comments.
1346         (Target_powerpc::do_relax): Look for thread creation symbols to
1347         determine default plt_thread_safe value.  Clear plt call stubs
1348         as well as branch stubs each iteration.
1349         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1350         insn constants.
1351         (l, hi, ha, write_insn): Move earlier.
1352         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1353         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1354         plt stubs too.
1355         (Stub_table::update_size): Adjust.
1356         (Stub_table::prev_size, set_prev_size): Delete.
1357         (Stub_table::stub_align): Let --plt-align affect result.
1358         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1359         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1360         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1361         (Stub_table::do_write): Support more stub variants.
1362
1363 2012-12-04  Alan Modra  <amodra@gmail.com>
1364
1365         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1366         (Target_powerpc::do_define_standard_symbols): New function.
1367
1368 2012-12-03  Alan Modra  <amodra@gmail.com>
1369
1370         * output.h: Formatting, whitespace.
1371
1372 2012-12-03  Alan Modra  <amodra@gmail.com>
1373
1374         * layout.h (Layout::get_executable_sections): Declare.
1375         * layout.cc (Layout::get_executable_sections): New function.
1376         * arm.cc (Target_arm::group_sections): Use it.
1377         (Arm_output_section::group_sections): Delete now redundant test.
1378         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1379         param to handle relative relocs.
1380         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1381         (Output_data_reloc::add_absolute): Adjust.
1382         (Output_data_reloc::add_relative): New function.
1383         (Output_data::reset_data_size): New function.
1384         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1385         (Output_section::set_addralign): New function.
1386         (Output_section::checkpoint_set_addralign): New function.
1387         (Output_section::clear_section_offsets_need_adjustment): New function.
1388         (Output_section::input_sections): Make public.
1389         * powerpc.cc (class Output_data_brlt_powerpc): New.
1390         (class Stub_table, class Stub_control): New.
1391         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1392         stub_table_, set_stub_table, stub_table): New vectors and accessor
1393         functions.
1394         (Target_powerpc::do_may_relax, do_relax, push_branch,
1395         new_stub_table, stub_tables, brlt_section, group_sections,
1396         add_branch_lookup_table, find_branch_lookup_table,
1397         write_branch_lookup_table, make_brlt_section): New functions.
1398         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1399         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1400         branch_info_): New vars.
1401         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1402         make call stubs here.
1403         (Output_data_glink): Remove all call stub handling from this class.
1404         (Target_powerpc::Scan::local, global): Save interesting branch
1405         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1406         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1407         functions on final link.
1408         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1409         Handle long branch destinations too.
1410         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1411         do_plt_address_for_local): Adjust lookup of plt call stubs.
1412
1413 2012-11-30  Alan Modra  <amodra@gmail.com>
1414
1415         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1416         relocs against protected symbols when building 32-bit shared libs.
1417
1418 2012-11-30  Alan Modra  <amodra@gmail.com>
1419
1420         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1421         param.  Call got_section() to make .got.  Update all callers
1422         and their callers and so on.
1423
1424 2012-11-30  Alan Modra  <amodra@gmail.com>
1425
1426         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1427         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1428         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1429         value if it already exists.
1430
1431 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1432
1433         PR gold/14858
1434         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1435
1436 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1437
1438         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1439         than bfc instruction for data sandboxing.
1440
1441 2012-11-08  Alan Modra  <amodra@gmail.com>
1442
1443         * po/POTFILES.in: Regenerate.
1444
1445 2012-11-05  Alan Modra  <amodra@gmail.com>
1446
1447         * configure.ac: Apply 2012-09-10 change to config.in here.
1448         * configure: Regenerate.
1449
1450 2012-11-05  Alan Modra  <amodra@gmail.com>
1451
1452         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1453         (struct Opd_ent): Use "Address" rather than "Offset".
1454         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1455         (Target_powerpc::got_section): Make public.
1456         (Target_powerpc::scan_relocs): Move code setting symbols..
1457         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1458         Create _SDA_BASE_ only when referenced.
1459
1460 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1461
1462         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1463         from last change.
1464
1465 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1466
1467         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1468         for offset_in_output_section parameter.
1469         (Sized_target::relocate_special_relocatable): Likewise.
1470         * arm.cc (Target_arm::relocate_relocs): Likewise.
1471         (Target_arm::relocate_special_relocatable): Likewise.
1472         * i386.cc (Target_i386::relocate_relocs): Likewise.
1473         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1474         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1475         * target-reloc.h (relocate_relocs): Likewise.
1476         * testsuite/testfile.cc (Target_test): Likewise.
1477         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1478         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1479
1480         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1481         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1482
1483         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1484         parameter, which is unused in the [!F_SETFD] case.
1485
1486         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1487         SYMNDX to off_t before comparing it to this->data_size().
1488         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1489         * incremental.cc (Output_section_incremental_inputs::do_write):
1490         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1491
1492         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1493
1494 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1495
1496         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1497         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1498         in EABI_VER5.
1499
1500 2012-10-29  Cary Coutant  <ccoutant@google.com>
1501
1502         * dwp.cc (usage): Add file and exit status parameters;
1503         add --help and --version options.
1504         (print_version): New function.
1505         (main): Add --help and --version options.
1506
1507 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1508
1509         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1510         final_layout_sequence.txt.
1511         * testsuite/Makefile.in: Regenerated.
1512
1513 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1514
1515         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1516         COMPILE generated by automake.
1517         (LINK1): Likewise.
1518         (CXXCOMPILE1): Likewise.
1519         (CXXLINK1): Likewise.
1520         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1521         (LINK): Likewise.
1522         (CXXCOMPILE): Likewise.
1523         (CXXLINK): Likewise.
1524         * testsuite/Makefile.in: Regenerated.
1525
1526 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1527
1528         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1529         on bad fwrite return.
1530
1531 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1532
1533         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1534         on val.
1535
1536 2012-10-23  Cary Coutant  <ccoutant@google.com>
1537
1538         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1539         * testsuite/Makefile.in: Regenerate.
1540         * testsuite/dwp_test.h: New source file.
1541         * testsuite/dwp_test_1.cc: New source file.
1542         * testsuite/dwp_test_1.s: New source file.
1543         * testsuite/dwp_test_1.sh: New source file.
1544         * testsuite/dwp_test_1b.cc: New source file.
1545         * testsuite/dwp_test_1b.s: New source file.
1546         * testsuite/dwp_test_2.cc: New source file.
1547         * testsuite/dwp_test_2.s: New source file.
1548         * testsuite/dwp_test_2.sh: New source file.
1549         * testsuite/dwp_test_main.cc: New source file.
1550         * testsuite/dwp_test_main.s: New source file.
1551
1552 2012-10-23  Cary Coutant  <ccoutant@google.com>
1553
1554         * dwp.h: New header file.
1555         * dwp.cc: New source file.
1556         * gold.h: Move shared declarations to system.h.
1557         * system.h: New header file.
1558         * Makefile.am: Add dwp.
1559         * Makefile.in: Regenerate.
1560
1561 2012-10-23  Cary Coutant  <ccoutant@google.com>
1562
1563         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1564         Dwarf_info_reader::read_from_pointer.
1565         (Dwarf_pubnames_table::read_header): Likewise.
1566         (Dwarf_pubnames_table::next_name): Likewise.
1567         (Dwarf_die::read_attributes): Likewise.
1568         (Dwarf_die::skip_attributes): Likewise.
1569         (Dwarf_info_reader::read_from_pointer): New function template.
1570         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1571         (Dwarf_pubnames_table): Likewise.
1572         (Dwarf_info_reader::read_from_pointer): New function template.
1573         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1574         Dwarf_pubnames_table ctor.
1575
1576 2012-10-23  Cary Coutant  <ccoutant@google.com>
1577
1578         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1579         abbrev_shndx.
1580         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1581         abbrev_shndx_.
1582         (Dwarf_info_reader::set_abbrev_shndx): New method.
1583         (Dwarf_info_reader::abbrev_shndx_): New data member.
1584
1585 2012-10-23  Cary Coutant  <ccoutant@google.com>
1586
1587         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1588         from object, not parameters.
1589         (Dwarf_info_reader::parse): Likewise.
1590         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1591         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1592         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1593         methods.
1594
1595 2012-10-23  Cary Coutant  <ccoutant@google.com>
1596
1597         * fileread.cc (Input_file::Input_file): New constructor.
1598         * fileread.h (class Input_file): Add new constructor.
1599
1600 2012-10-18  Alan Modra  <amodra@gmail.com>
1601
1602         PR gold/14727
1603         * object.cc (Relobj::is_section_name_included): Also match
1604         .sdata personality section.
1605
1606 2012-10-18  Alan Modra  <amodra@gmail.com>
1607
1608         * target-reloc.h (class Default_comdat_behavior): New, package up..
1609         (get_comdat_behaviour): ..this.
1610         (relocate_section): Add Relocate_comdat_behavior template arg,
1611         adjust code to suit.
1612         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1613         (Target_arm::scan_reloc_section): Likewise.
1614         * i386.cc (Target_i386::relocate_section): Likewise.
1615         * sparc.cc (Target_sparc::relocate_section): Likewise.
1616         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1617         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1618         * powerpc.cc (class Relocate_comdat_behavior): New.
1619         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1620         gold::relocate_section with new template arg.
1621
1622 2012-10-18  Alan Modra  <amodra@gmail.com>
1623
1624         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1625         dynamic relocs for GOT_TPREL got entries, without symbol if
1626         resolving locally.
1627         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1628         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1629         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1630
1631 2012-10-17  Alan Modra  <amodra@gmail.com>
1632
1633         PR gold/14726
1634         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1635
1636 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1637
1638         * layout.cc (Layout::include_section): Keep sections marked
1639         SHF_EXCLUDE when doing relocatable links.
1640
1641 2012-10-16  Alan Modra  <amodra@gmail.com>
1642
1643         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1644         (Target_powerpc::do_finalize_sections): Call it.
1645         (Output_data_save_res): New class and supporting functions.
1646         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1647         normal symbols defined in object files.
1648
1649 2012-10-12  Alan Modra  <amodra@gmail.com>
1650
1651         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1652         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1653         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1654         section if scan_opd_relocs not yet called.
1655         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1656
1657 2012-10-12  Alan Modra  <amodra@gmail.com>
1658
1659         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1660         add_local_ifunc_entry): Revert last change.
1661         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1662
1663 2012-10-05  Alan Modra  <amodra@gmail.com>
1664
1665         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1666         do_plt_address_for_global): New functions.
1667         (Output_data_got_powerpc::do_write): Don't segfault when linking
1668         statically.
1669         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1670         add_local_ifunc_entry): Return true on adding entry..
1671         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1672         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1673         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1674         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1675         set up symbols here.
1676         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1677         syms here.  Do so even when no .iplt.  Don't segfault when linking
1678         statically.
1679         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1680         new variants without reloc param.
1681         (Glink_sym_ent::Glink_sym_ent): Likewise.
1682         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1683         reloc when refs will resolve to plt call stub.
1684         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1685         R_PPC_PLTREL24 to resolve locally.
1686         (Target_powerpc::Scan::global): Correct ifunc handling.
1687         (Target_powerpc::Relocate::relocate): Correct local sym glink
1688         lookup.  Don't destroy "value" when we have a plt call stub,
1689         and when checking plt call validity.
1690         (Target_powerpc::do_dynsym_value): Simplify.
1691
1692 2012-10-05  Alan Modra  <amodra@gmail.com>
1693
1694         * i386.cc (Output_data_plt_i386::address_for_global,
1695         address_for_local): Add plt offset to returned value.  Adjust uses.
1696         * sparc.cc (Output_data_plt_sparc::address_for_global,
1697         address_for_local): Likewise.
1698         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1699         address_for_local): Likewise.
1700         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1701         address_for_local): Likewise.
1702         * target.h (Target::plt_address_for_global, plt_address_for_local):
1703         Update comment.
1704         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1705         (Output_data_got::Got_entry::write): Nor here.
1706         * output.h: Comment fix.
1707
1708 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1709
1710         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1711         global_offset_table_ value for larget got.
1712         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1713
1714 2012-09-29  Alan Modra  <amodra@gmail.com>
1715
1716         * powerpc.cc (Target_powerpc::iplt_): New output section.
1717         (Target_powerpc::iplt_section, make_iplt_section,
1718         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1719         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1720         Target_powerpc::plt_entry_count): Count iplt entries too.
1721         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1722         reloc section in constructor.  New params.
1723         (Target_powerpc::make_plt_section): Create reloc section here instead.
1724         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1725         functions.
1726         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1727         (Output_data_glink::add_entry, find_entry): New functions to
1728         deal with local syms.
1729         (Glink_sym_ent): Add support for local syms.
1730         (Output_data_glink::do_write): Handle ifunc plt entries.
1731         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1732         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1733         (Target_powerpc::Relocate::relocate): Likewise.
1734         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1735
1736 2012-09-25  Alan Modra  <amodra@gmail.com>
1737
1738         * object.h (Sized_relobj_file::adjust_local_symbol,
1739         do_adjust_local_symbol): New functions.
1740         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1741         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1742         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1743         and irregular opd entry spacing.
1744         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1745         (Global_symbol_visitor_opd): New functor.
1746         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1747         on deleted opd entries.
1748
1749 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1750
1751         * tilegx.cc: New file.
1752         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1753         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1754         * configure.tgt: Add entries for tilegx*.
1755         * configure.ac: Likewise.
1756         * Makefile.in: Rebuild.
1757         * configure: Likewise.
1758         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1759         tilegx.
1760
1761 2012-09-13  Alan Modra  <amodra@gmail.com>
1762
1763         * target-reloc.h (scan_relocs): Call scan.local for relocs
1764         against symbols in discarded sections.  Pass is_discarded
1765         param.
1766         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1767         Add is_discarded param.
1768         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1769         is_discarded to flag opd entry as discarded.  Don't emit dyn
1770         relocs on such entries.
1771         (Target_powerpc::Scan::global): Similarly detect and handle
1772         such opd entries.
1773         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1774         opd_ent_.  Update all uses.
1775         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1776         (Target_powerpc::relocate_section): Zero out discarded opd
1777         entry relocs.
1778
1779 2012-09-12  Ian Lance Taylor  <iant@google.com>
1780
1781         PR gold/14570
1782         * output.cc: Rename Output_data_got template parameter from size
1783         to got_size for all functions.  Compile all variants of
1784         Output_data_got.
1785         (Output_data_got::Got_entry::write): Correct use of size for
1786         symbol value.  Use local_is_tls rather than casting to
1787         Sized_relobj_file.
1788         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1789         (class Sized_relobj_file): Add do_local_is_tls.
1790         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1791
1792 2012-09-11  Alan Modra  <amodra@gmail.com>
1793
1794         PR gold/14566
1795         * layout.cc (Layout::set_segment_offsets): When using
1796         common-page-size alignment, ensure we are on a new max-page-size
1797         page.
1798         * output.cc (Output_segment::set_section_addresses): Use
1799         abi_pagesize, not common_pagesize for relro boundary.
1800         (Output_segment::set_offset): Likewise.
1801
1802 2012-09-11  Alan Modra  <amodra@gmail.com>
1803
1804         * output.h (Output_data_got::add_global_tls, add_local_tls,
1805         add_local_tls_pair): New functions.
1806         (Output_data_got::add_local_pair_with_rel): Remove second
1807         reloc param.  Expand comment.
1808         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1809         use_plt_or_tls_offset_, similarly for constructor param.
1810         (Output_data_got::Got_entry::write): Add got_index param.
1811         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1812         add_local_tls_pair): New functions.
1813         (Output_data_got::Got_entry::write): Handle tls symbols
1814         with use_plt_or_tls_offset_ set specially.
1815         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1816         (Output_data_got::do_write): Replace iterator with index, pass
1817         index to entry write function.
1818         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1819         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1820         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1821         call.
1822         * i386.cc (Target_i386::Scan::local): Likewise.
1823         * sparc.cc (Target_sparc::Scan::local): Likewise.
1824         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1825         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1826         do_tls_offset_for_global): New functions.
1827         (Target_powerpc::Scan::local): Correct TLS relocations and got
1828         entry values.
1829         (Target_powerpc::Scan::global): Don't emit unnecessary
1830         dynamic relocations on TLS GOT entries.
1831
1832 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1833
1834         * config.in: Disable sanity check for kfreebsd.
1835
1836 2012-09-10  Sterling Augustine  <saugustine@google.com>
1837
1838         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1839         (Gdb_index::pubtypes_read): New parameter.
1840         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1841         to calls.
1842         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1843         pubtypes_object_.
1844
1845 2012-09-09  Alan Modra  <amodra@gmail.com>
1846
1847         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1848         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1849         * gc.h (gc_process_relocs): Call target gc_add_reference.
1850         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1851         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1852         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1853         unnecessary cast.
1854         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1855         to cater for when we don't need code offset.  Update use.
1856         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1857         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1858         set_opd_valid): New functions.
1859         (Target_powerpc::do_gc_add_reference): New function.
1860         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1861         stashed refs.
1862         (Target_powerpc::do_gc_mark_symbol): New function.
1863
1864 2012-09-06  Cary Coutant  <ccoutant@google.com>
1865
1866         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1867         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1868         (Dwarf_die::skip_attributes): Likewise.
1869         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1870         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1871         (main): Call it.
1872         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1873
1874 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1875
1876         * testsuite/script_test_3.t: Add .got.plt output section
1877         statement.
1878         * testsuite/script_test_4.t: Likewise.
1879
1880 2012-09-05  Alan Modra  <amodra@gmail.com>
1881
1882         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1883         update all uses and lose "enum" when using type.
1884
1885 2012-09-05  Alan Modra  <amodra@gmail.com>
1886
1887         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1888         * configure: Regenerate.
1889         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1890         (plugin_final_layout.stdout): Likewise.
1891         (memory_test): Set page sizes to 0x1000.
1892         * testsuite/Makefile.in: Regenerate.
1893         * testsuite/discard_locals_test.sh: Add FIXME comment.
1894         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1895         * testsuite/pr14265.t: Add .got output section statement.
1896         * testsuite/script_test_2.t: Likewise.
1897         * testsuite/script_test_3.t: Likewise.
1898         * testsuite/script_test_4.t: Likewise.
1899         * testsuite/script_test_5.t: Likewise.
1900         * testsuite/script_test_6.t: Likewise.
1901         * testsuite/script_test_7.t: Likewise.
1902         * testsuite/script_test_9.t: Likewise.
1903
1904 2012-09-05  Alan Modra  <amodra@gmail.com>
1905
1906         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1907         (Powerpc_relocate_functions::Status): New typedef.
1908         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1909         (Target_powerpc::Scan::local): Handle REL64.
1910         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1911         for REL32 and REL64.
1912         (Target_powerpc::symval_for_branch): New function, extracted from..
1913         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1914         checks.  Report overflow errors.
1915
1916 2012-09-05  Alan Modra  <amodra@gmail.com>
1917
1918         * object.h (Sized_relobj_file::emit_relocs): Delete.
1919         (Sized_relobj_file::emit_relocs_reltype): Delete.
1920         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1921         relocate_relocs for --emit-relocs.
1922         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1923         * output.h: Update comment.
1924         (Output_segment::first_section): New function.
1925         (Output_segment::first_section_load_address): Use first_section.
1926         * output.cc (Output_segment::first_section): New function extracted..
1927         (Output_segment::first_section_load_address): ..from here.  Delete.
1928         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1929         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1930         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1931         adjust call to target.h function.
1932         * i386.cc (Target_i386): Likewise.
1933         * sparc.cc (Target_sparc): Likewise.
1934         * x86_64.cc (Target_x86_64): Likewise.
1935         * powerpc.cc (Target_powerpc): Likewise.
1936         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1937         first tls section has section symbol for optimised local dynamic
1938         output relocs.
1939         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1940         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1941         optimised tls code.
1942         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1943         Rename to relocate_relocs.  Update error message.
1944
1945 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1946
1947         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1948         --just-symbols.
1949
1950 2012-08-31  Alan Modra  <amodra@gmail.com>
1951
1952         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1953         (Powerpc_relobj::toc_base_offset): New stub function.
1954         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1955         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1956         (Target_powerpc::Relocate::enum skip_tls): New.
1957         (Target_powerpc::call_tls_get_addr_): New var.
1958         (Target_powerpc::is_branch_reloc): Move to file scope.
1959         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1960         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1961         New functions.
1962         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1963         (powerpc_info): Correct common_pagesize for ppc64.
1964         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1965         (Powerpc_relocate_functions): Add overflow check enums and functions.
1966         Add non-shift version of rela, rela_ua.  Delete all rel public
1967         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1968         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1969         addr16_ha3, addr14 functions.
1970         (Output_data_got_powerpc::add_constant_pair): New function.
1971         (Output_data_got_powerpc::got_base_offset): Likewise.
1972         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1973         (instruction constants): Sort, add some more.
1974         (Output_data_glink::do_write): Add and use Address typedef.  Use
1975         object->toc_base_offset() stub for 64-bit.
1976         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1977         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1978         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1979         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1980         Always treat .opd relocs as against locally defined symbol.
1981         Correct condition for RELATIVE relocs.
1982         (Target_powerpc::do_finalize_sections): Test for NULL sections.
1983         (Target_powerpc::Relocate::relocate): Use plt call stub as value
1984         for 32-bit syms with a plt entry.  Correct ppc64 toc base
1985         calculations.  Handle TLS relocs, and more.  Add overflow
1986         checking and adjust for Powerpc_relocate_functions changes.
1987         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
1988         Reinstate --emit-relocs code with FIXME.
1989
1990 2012-08-30  Alan Modra  <amodra@gmail.com>
1991
1992         * layout.cc (Layout::set_segment_offsets): Set p_align to
1993         abi_pagesize, not common_pagesize.
1994         (Layout::relaxation_loop_body): Similarly use abi_pagesize
1995         to determine whether file header can go in segment.
1996
1997 2012-08-30  Alan Modra  <amodra@gmail.com>
1998
1999         * output.h (Output_reloc::Output_reloc <output section>): Add
2000         is_relative param.  Adjust calls.
2001         (Output_reloc::add_output_section_relative): New functions.
2002         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2003         is_relative.
2004         (Output_reloc::symbol_value): Handle SECTION_CODE.
2005
2006 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2007
2008         * gold.cc (queue_middle_tasks): Call layout again when unique
2009         segments for sections is desired.
2010         * layout.cc (Layout::Layout): Initialize new members.
2011         (Layout::get_output_section_flags): New function.
2012         (Layout::choose_output_section): Call get_output_section_flags.
2013         (Layout::layout): Make output section for mapping to a unique segment.
2014         (Layout::insert_section_segment_map): New function.
2015         (Layout::attach_allocated_section_to_segment): Make unique segment for
2016         output sections marked so.
2017         (Layout::segment_precedes): Check for unique segments when sorting.
2018         * layout.h (Layout::Unique_segment_info): New struct.
2019         (Layout::Section_segment_map): New typedef.
2020         (Layout::insert_section_segment_map): New function.
2021         (Layout::get_output_section_flags): New function.
2022         (Layout::is_unique_segment_for_sections_specified): New function.
2023         (Layout::set_unique_segment_for_sections_specified): New function.
2024         (Layout::unique_segment_for_sections_specified_): New member.
2025         (Layout::section_segment_map_): New member.
2026         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2027         Rename is_gc_pass_one to is_pass_one.
2028         Rename is_gc_pass_two to is_pass_two.
2029         Rename is_gc_or_icf to is_two_pass.
2030         Check for which pass based on whether symbols data is present.
2031         Make it two pass when unique segments for sections is desired.
2032         * output.cc (Output_section::Output_section): Initialize new
2033         members.
2034         * output.h (Output_section::is_unique_segment): New function.
2035         (Output_section::set_is_unique_segment): New function.
2036         (Output_section::is_unique_segment_): New member.
2037         (Output_section::extra_segment_flags): New function.
2038         (Output_section::set_extra_segment_flags): New function.
2039         (Output_section::extra_segment_flags_): New member.
2040         (Output_section::segment_alignment): New function.
2041         (Output_section::set_segment_alignment): New function.
2042         (Output_section::segment_alignment_): New member.
2043         (Output_segment::Output_segment): Initialize is_unique_segment_.
2044         (Output_segment::is_unique_segment): New function.
2045         (Output_segment::set_is_unique_segment): New function.
2046         (Output_segment::is_unique_segment_): New member.
2047         * plugin.cc (allow_unique_segment_for_sections): New function.
2048         (unique_segment_for_sections): New function.
2049         (Plugin::load): Add new functions to transfer vector.
2050         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2051         * Makefile.in: Regenerate.
2052         * testsuite/plugin_final_layout.sh: Check if unique segment
2053         functionality works.
2054         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2055         are available.
2056         (allow_unique_segment_for_sections): New global.
2057         (unique_segment_for_sections): New global.
2058         (claim_file_hook): Call allow_unique_segment_for_sections.
2059         (all_symbols_read_hook): Call unique_segment_for_sections.
2060
2061 2012-08-22  Cary Coutant  <ccoutant@google.com>
2062
2063         * layout.cc (Layout::include_section): Don't assert on GROUP
2064         sections with --emit-relocs.
2065
2066 2012-08-21  Cary Coutant  <ccoutant@google.com>
2067
2068         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2069         if --export-dynamic-symbol names an undef symbol.
2070
2071 2012-08-18  Alan Modra  <amodra@gmail.com>
2072
2073         * powerpc.cc: Formatting and white space.
2074         (Powerpc_relobj): Rename got2_section_ to special_.
2075         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2076         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2077         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2078         (Target_powerpc): Add Address typedef and invalid_address.  Use
2079         throughout.
2080         (Target_powerpc::is_branch_reloc): New function.
2081         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2082         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2083         for dst_mask, value and addend.
2084         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2085         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2086         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2087         uint16_t for 24-bit offset.  Use get_output_section_offset and
2088         check return.
2089         (Target_powerpc::Scan::local): Handle more relocs.
2090         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2091         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2092         Plug in toc restoring insn after plt calls.  Translate branches
2093         to function descriptor symbols to corresponding entry point.
2094         (Target_powerpc::relocate_for_relocatable): Check return from
2095         get_output_section_offset.
2096         * symtab.h: Comment typo.
2097
2098 2012-08-14  Ian Lance Taylor  <iant@google.com>
2099
2100         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2101         unsupported_relocal_local to call unsupported_reloc_global.
2102
2103 2012-08-14  Nick Clifton  <nickc@redhat.com>
2104
2105         PR ld/14265
2106         * script-sections.cc (Sections_element::output_section_name): Add
2107         keep return parameter.
2108         (Output_section_element::match_name): Add keep return parameter.
2109         Return the value of the keep_ member.
2110         * script-sections.h (class Output_section): Update
2111         output_section_name prototype.
2112         * layout.cc (Layout::keep_input_section): New public member
2113         function.
2114         (Layout::choose_output_section): Pass keep parameter to
2115         output_section_name.
2116         * layout.h (class Layout): Add keep_input_section.
2117         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2118         sections.
2119         * testsuite/Makefile.am: Add a test.
2120         * testsuite/Makefile.in: Regenerate.
2121         * testsuite/pr14265.c: Source file for the test.
2122         * testsuite/pr14265.t: Linker script for the test.
2123         * testsuite/pr14265.sh: Shell script for the test.
2124
2125 2012-08-14  Alan Modra  <amodra@gmail.com>
2126
2127         * target.h (Target::output_section_name): New function.
2128         (Target::do_output_section_name): New function.
2129         * layout.cc (Layout::choose_output_section): Call the above.
2130         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2131
2132 2012-08-14  Alan Modra  <amodra@gmail.com>
2133
2134         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2135         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2136         for replace_constant call.
2137         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2138         (Output_data_glink::do_print_to_mapfile): New function.
2139         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2140         (Target_powerpc::Relocate::relocate): Likewise.
2141
2142 2012-08-14  Alan Modra  <amodra@gmail.com>
2143
2144         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2145         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2146         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2147         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2148         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2149         here.
2150         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2151         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2152         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2153         here.
2154         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2155         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2156
2157 2012-08-12  Alan Modra  <amodra@gmail.com>
2158
2159         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2160         (glink insn constants): Use uint32_t.
2161         (Output_data_glink::add_entry): Use insert, not [] operator.
2162
2163 2012-08-11  Alan Modra  <amodra@gmail.com>
2164
2165         * object.h (Sized_relobj_file::find_shdr): New function.
2166         (Sized_relobj_file::find_special_sections): New function.
2167         * object.cc (Sized_relobj_file::find_shdr): New function.
2168         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2169         (Sized_relobj_file::find_special_sections): New function, split out..
2170         (Sized_relobj_file::do_read_symbols): ..from here.
2171         * output.h (Output_data_got::replace_constant): New function.
2172         (Output_data_got::num_entries): New function.
2173         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2174         (Output_data_got::got_offset): Protected rather than private.
2175         (Output_data_got::replace_got_entry): New function.
2176         * output.cc (Output_data_got::replace_got_entry): New function.
2177         * powerpc.cc (class Powerpc_relobj): New.
2178         (class Powerpc_relocate_functions): Delete all psymval variants or
2179         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2180         Implement _ha functions using corresponding _hi function.
2181         (Powerpc_relobj::find_special_sections): New function.
2182         (Target_powerpc::do_make_elf_object): New function.
2183         (class Output_data_got_powerpc): New.
2184         (class Output_data_glink): New.
2185         (class Powerpc_scan_relocatable_reloc): New.
2186         Many more changes througout file.
2187
2188 2012-08-09  Nick Clifton  <nickc@redhat.com>
2189
2190         * po/vi.po: Updated Vietnamese translation.
2191
2192 2012-08-07  Ian Lance Taylor  <iant@google.com>
2193
2194         * layout.cc (Layout::add_target_dynamic_tags): If
2195         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2196         plt_rel.
2197
2198 2012-07-30  Nick Clifton  <nickc@redhat.com>
2199
2200         * po/gold.pot: Updated template.
2201         * po/es.po: Updated Spanish translation.
2202
2203 2012-07-18  Cary Coutant  <ccoutant@google.com>
2204
2205         PR gold/14344
2206         * configure.ac: Add check for -gpubnames support.
2207         * configure: Regenerate.
2208         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2209         support; force -gno-pubnames.
2210         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2211         support.
2212         (gdb_index_test_4): New test.
2213         * testsuite/Makefile.in: Regenerate.
2214         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2215         * testsuite/gdb_index_test_2.sh: Likewise.
2216         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2217         * testsuite/gdb_index_test_4.sh: New script.
2218         * testsuite/gdb_index_test_comm.sh: New script with common code;
2219         don't look for space after colon.
2220
2221 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2222
2223         * gold.cc (queue_middle_tasks): Update function order only after
2224         deferred objects due to plugins are processed.
2225
2226 2012-07-11  Ian Lance Taylor  <iant@google.com>
2227
2228         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2229         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2230         (Target_arm::scan_reloc_for_stub): Likewise.
2231         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2232         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2233         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2234         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2235         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2236
2237 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2238             Ian Lance Taylor  <iant@google.com>
2239
2240         PR gold/14309
2241         * configure.ac: Test whether std::tr1::hash<off_t> works.
2242         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2243         needed.
2244         * output.h (class Output_fill): Add virtual destructor.
2245         * configure, config.in: Rebuild.
2246
2247 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2248
2249         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2250
2251 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2252
2253         * plugin.cc (Plugin::load): Handle position independent executables.
2254
2255 2012-06-06  Cary Coutant  <ccoutant@google.com>
2256
2257         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2258         add .debug_macro.
2259         (lines_only_debug_sections): Likewise.
2260         (gdb_fast_lookup_sections): New static array.
2261         (is_gdb_debug_section): Rename formal parameter.
2262         (is_lines_only_debug_section): Likewise.
2263         (is_gdb_fast_lookup_section): New function.
2264         (Layout::include_section): Check for ".zdebug_" prefix; pass
2265         section name suffix to is_gdb_debug_section, et al.; check for
2266         fast-lookup sections when building .gdb_index.
2267         * options.h (--strip-debug-gdb): Update GDB version number.
2268
2269 2012-06-06  Cary Coutant  <ccoutant@google.com>
2270
2271         * configure.ac: Add check for fallocate.
2272         * configure: Regenerate.
2273         * config.in: Regenerate.
2274
2275         * options.h (class General_options): Add --mmap-output-file and
2276         --posix-fallocate options.
2277         * output.cc: (posix_fallocate): Remove; replace with...
2278         (gold_fallocate): New function.
2279         (Output_file::map_no_anonymous): Call gold_fallocate.
2280         (Output_file::map): Check --mmap-output-file option.
2281
2282 2012-06-05  Jing Yu  <jingyu@google.com>
2283
2284         * gold.h (textdomain): Add do {} to empty while(0).
2285         (bindtextdomain): Likewise.
2286
2287 2012-06-04  Cary Coutant  <ccoutant@google.com>
2288
2289         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2290         has_dynsym_index.
2291
2292 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2293
2294         * symtab.cc (Symbol_table::define_special_symbol):
2295         Initialize *poldsym to prevent uninitialized variable errors.
2296
2297 2012-05-23  Cary Coutant  <ccoutant@google.com>
2298
2299         * layout.cc (Layout::section_name_mapping): Add rules to handle
2300         exact match on .data.rel.ro.local or .data.rel.ro.
2301         (Layout::output_section_name): Check for exact matches.
2302
2303 2012-05-23  Cary Coutant  <ccoutant@google.com>
2304
2305         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2306         more carefully.
2307
2308 2012-05-22  Cary Coutant  <ccoutant@google.com>
2309
2310         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2311         object before exporting symbol.
2312
2313 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2314
2315         * testsuite/tls_test.cc: Include "config.h" first.
2316         * testsuite/tls_test_c.c: Likewise.
2317
2318 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2319             Nick Clifton  <nickc@redhat.com>
2320
2321         PR 14072
2322         * configure.in: Add check that sysdep.h has been included before
2323         any system header files.
2324         * configure: Regenerate.
2325         * config.in: Regenerate.
2326
2327 2012-05-14  Cary Coutant  <ccoutant@google.com>
2328
2329         * layout.cc (Layout::make_output_section): Mark .tdata section
2330         as RELRO.
2331         * testsuite/relro_test.cc: Add a TLS variable.
2332
2333 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2334
2335         PR gold/14091
2336         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2337         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2338         R_X86_64_64.
2339
2340 2012-05-08  Cary Coutant  <ccoutant@google.com>
2341
2342         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2343         (lines_only_debug_sections): Likewise.
2344
2345 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2346
2347         * nacl.cc: New file.
2348         * nacl.h: New file.
2349         * Makefile.am (CCFILES, HFILES): Add them.
2350         * Makefile.in: Regenerate.
2351         * i386.cc (Output_data_plt_i386_nacl): New class.
2352         (Output_data_plt_i386_nacl_exec): New class.
2353         (Output_data_plt_i386_nacl_dyn): New class.
2354         (Target_i386_nacl): New class.
2355         (Target_selector_i386_nacl): New class.
2356         (target_selector_i386): Use it instead of Target_selector_i386.
2357         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2358         (Target_x86_64_nacl): New class.
2359         (Target_selector_x86_64_nacl): New class.
2360         (target_selector_x86_64, target_selector_x32): Use it instead of
2361         Target_selector_x86_64.
2362         * arm.cc (Output_data_plt_arm_nacl): New class.
2363         (Target_arm_nacl): New class.
2364         (Target_selector_arm_nacl): New class.
2365         (target_selector_arm, target_selector_armbe): Use it instead of
2366         Target_selector_arm.
2367
2368         * target-select.cc (select_target): Take new Input_file* and off_t
2369         arguments, pass them on to recognize method of selector.
2370         * object.cc (make_elf_sized_object): Update caller.
2371         * parameters.cc (parameters_force_valid_target): Likewise.
2372         * incremental.cc (make_sized_incremental_binary): Likewise.
2373         * target-select.h: Update decl.
2374         (Target_selector::recognize): Take new Input_file* argument,
2375         pass it on to do_recognize.
2376         (Target_selector::do_recognize): Take new Input_file* argument.
2377         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2378         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2379         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2380         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2381
2382         * target.h (Target::Target_info): New members isolate_execinstr
2383         and rosegment_gap.
2384         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2385         * arm.cc (Target_arm::arm_info): Update initializer.
2386         * i386.cc (Target_i386::i386_info): Likewise.
2387         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2388         * sparc.cc (Target_sparc::sparc_info): Likewise.
2389         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2390         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2391         * layout.cc (Layout::attach_allocated_section_to_segment):
2392         Take new const Target* argument.  If target->isolate_execinstr(), act
2393         like --rosegment.
2394         (Layout::find_first_load_seg): Take new const Target* argument;
2395         if target->isolate_execinstr(), reject PF_X segments.
2396         (Layout::relaxation_loop_body): Update caller.
2397         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2398         reset file offset to zero when we hit LOAD_SEG, and then do a second
2399         loop over the segments before LOAD_SEG to reassign offsets after
2400         addresses have been determined.  Handle target->rosegment_gap().
2401         (Layout::attach_section_to_segment): Take new const Target* argument;
2402         pass it to attach_allocated_section_to_segment.
2403         (Layout::make_output_section): Update caller.
2404         (Layout::attach_sections_to_segments): Take new const Target* argument;
2405         pass it to attach_section_to_segment.
2406         * gold.cc (queue_middle_tasks): Update caller.
2407         * layout.h (Layout): Update method decls with new arguments.
2408
2409         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2410         Target_info pointer to use.
2411         (Target_arm::do_make_data_plt): New virtual method.
2412         (Target_arm::make_data_plt): New method that calls it.
2413         (Target_arm::make_plt_entry): Use it.
2414         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2415         for the section alignment.
2416         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2417         method.
2418         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2419         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2420         method.
2421         (Output_data_plt_arm::get_plt_entry_size): Call it.
2422         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2423         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2424         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2425         method.
2426         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2427         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2428         method instead of sizeof(plt_entry).
2429         (Output_data_plt_arm::add_entry): Likewise.
2430         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2431         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2432         than static method.
2433         (Target_arm::plt_entry_size): Likewise.
2434         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2435         Move to ...
2436         (Output_data_plt_arm_standard): ... here, new class.
2437         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2438         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2439         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2440
2441         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2442         Take additional argument for the PLT entry size.
2443         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2444         Use get_plt_entry_size method rather than plt_entry_size variable.
2445         (Output_data_plt_x86_64::reserve_slot): Likewise.
2446         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2447         (Output_data_plt_x86_64::add_entry): Likewise.
2448         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2449         (Output_data_plt_x86_64::address_for_global): Likewise.
2450         (Output_data_plt_x86_64::address_for_local): Likewise.
2451         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2452         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2453         Make method non-static.
2454         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2455         method.
2456         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2457         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2458         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2459         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2460         virtual method.
2461         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2462         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2463         virtual method.
2464         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2465         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2466         virtual method.
2467         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2468         (Output_data_plt_x86_64::plt_entry_size)
2469         (Output_data_plt_x86_64::first_plt_entry)
2470         (Output_data_plt_x86_64::plt_entry)
2471         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2472         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2473         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2474         (Output_data_plt_x86_64_standard): ... here, new class.
2475         (Target_x86_64::Target_x86_64): Take optional argument for the
2476         Target_info pointer to use.
2477         (Target_x86_64::do_make_data_plt): New virtual method.
2478         (Target_x86_64::make_data_plt): New method to call it.
2479         (Target_x86_64::init_got_plt_for_update): Use that.
2480         Call this->plt_->add_eh_frame method here.
2481         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2482         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2483         rather than static method.
2484         (Target_x86_64::plt_entry_size): Likewise.
2485         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2486         rather than plt_entry_size variable.  Move guts of PLT filling to...
2487         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2488         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2489         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2490
2491         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2492         additional argument for the section alignment.
2493         Don't do add_eh_frame_for_plt here.
2494         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2495         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2496         variable.
2497         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2498         method.
2499         (Output_data_plt_i386::get_plt_entry_size): Call it.
2500         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2501         (Output_data_plt_i386::add_eh_frame): New method to call it.
2502         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2503         method.
2504         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2505         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2506         method.
2507         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2508         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2509         method instead of plt_entry_size.
2510         (Output_data_plt_i386::plt_entry_size)
2511         (Output_data_plt_i386::plt_eh_frame_fde_size)
2512         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2513         (Output_data_plt_i386_standard): ... here, new class.
2514         (Output_data_plt_i386_exec): New class.
2515         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2516         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2517         (Output_data_plt_i386::exec_plt_entry): Move to ...
2518         (Output_data_plt_i386_exec::plt_entry): ... here.
2519         (Output_data_plt_i386_dyn): New class.
2520         (Output_data_plt_i386::first_plt_entry): Move to ...
2521         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2522         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2523         (Output_data_plt_i386_dyn::plt_entry): ... here.
2524         (Target_i386::Target_i386): Take optional argument for the Target_info
2525         pointer to use.
2526         (Target_i386::do_make_data_plt): New virtual method.
2527         (Target_i386::make_data_plt): New method to call it.
2528         (Target_i386::make_plt_section): Use that.
2529         Call this->plt_->add_eh_frame method here.
2530         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2531         rather than plt_entry_size variable.
2532         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2533         (Output_data_plt_i386::address_for_local): Likewise.
2534         (Output_data_plt_i386::do_write): Likewise.
2535         Move guts of PLT filling to...
2536         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2537         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2538         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2539         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2540
2541 2012-05-01  Cary Coutant  <ccoutant@google.com>
2542
2543         * dwarf_reader.cc (Dwarf_die::read_attributes)
2544         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2545         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2546         * reduced_debug_output.cc
2547         (Output_reduced_debug_info_section::get_die_end): Remove
2548         DW_FORM_GNU_ref_index.  Add default case.
2549
2550 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2551
2552         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2553         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2554         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2555         DW_AT_high_pc as offset from DW_AT_low_pc.
2556
2557         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2558         * testsuite/Makefile.in: Regenerate.
2559         * testsuite/gdb_index_test_3.c: New test source file.
2560         * testsuite/gdb_index_test_3.sh: New test source file.
2561
2562 2012-04-25  Ian Lance Taylor  <iant@google.com>
2563
2564         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2565         pointer.
2566         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2567         as a class, not a struct.
2568         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2569         (Target_arm::apply_cortex_a8_workaround): Likewise.
2570         * gc.h: Declare Reloc_types as a struct, not a class.
2571         * object.h: Declare Symbols_data as a struct.
2572         * reloc.h: Declare Read_relocs_data as a struct.
2573         * target.h: Declare Relocate_info as a struct.
2574
2575 2012-04-24  David S. Miller  <davem@davemloft.net>
2576
2577         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2578         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2579         and R_SPARC_WPLT30.
2580
2581 2012-04-24  Cary Coutant  <ccoutant@google.com>
2582
2583         * incremental-dump.cc (find_input_containing_global): Replace
2584         magic number with symbolic constant.
2585         (dump_incremental_inputs): Update version number.
2586         * incremental.cc (Output_section_incremental_inputs): Update version
2587         number; import symbolic constants from Incremental_inputs_reader.
2588         (Incremental_inputs::create_data_sections): Align relocations
2589         section correctly for 64-bit targets.
2590         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2591         constants; add padding.
2592         (Output_section_incremental_inputs::write_header): Add assert for
2593         header_size.
2594         (Output_section_incremental_inputs::write_input_files): Add assert
2595         for input_entry_size.
2596         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2597         add assert for object_info_size, input_section_entry_size,
2598         global_sym_entry_size.
2599         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2600         for data structure sizes; use them.
2601         (Incremental_input_entry_reader): Import symbolic constants from
2602         Incremental_inputs_reader; use them.
2603
2604 2012-04-23  David S. Miller  <davem@davemloft.net>
2605
2606         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2607         and elf_flags_set_.
2608         (Target_sparc::Target_sparc): Initialize new fields.
2609         (Target_sparc::do_make_elf_object): New function.
2610         (Target_sparc::do_adjust_elf_header): New function.
2611
2612 2012-04-23  Cary Coutant  <ccoutant@google.com>
2613
2614         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2615         CU range table of gdb index.
2616
2617 2012-04-20  David S. Miller  <davem@davemloft.net>
2618
2619         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2620         instead of false.
2621
2622 2012-04-16  David S. Miller  <davem@davemloft.net>
2623
2624         * sparc.cc (Target_sparc::got_address): New function.
2625         (Sparc_relocate_functions::gdop_hix22): New function.
2626         (Sparc_relocate_functions::gdop_lox10): New function.
2627         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2628         relocs.
2629         (Target_sparc::Scan::local): Likewise if the global symbol is not
2630         preemptible and is not IFUNC.
2631         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2632         transformations for local and non-preemptible non-IFUNC global
2633         symbols.
2634
2635         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2636         writing out 64-bit part of ranges.
2637
2638         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2639         -fpic and -fpie respectively.
2640         * Makefile.in: Regenerate.
2641
2642         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2643         (Target_sparc::Target_sparc): Initialize new field.
2644         (Target_sparc::do_plt_section_for_global): New function.
2645         (Target_sparc::do_plt_section_for_local): New function.
2646         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2647         (Target_sparc::make_plt_section): New function, broken out of
2648         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2649         (Target_sparc::make_plt_entry): Call make_plt_section.
2650         (Target_sparc::make_local_ifunc_plt_entry): New function.
2651         (Target_sparc::rela_ifunc_section): New function.
2652         (Target_sparc::plt_section): Remove const.
2653         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2654         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2655         and ifunc_count_ fields.
2656         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2657         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2658         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2659         (Output_data_plt_sparc::rela_ifunc): New function.
2660         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2661         (Output_data_plt_sparc::has_ifunc_section): New function.
2662         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2663         (Output_data_plt_sparc::address_for_global): New function.
2664         (Output_data_plt_sparc::address_for_local): New function.
2665         (Output_data_plt_sparc::plt_index_to_offset): New function.
2666         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2667         and entry_count.
2668         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2669         entry_count.
2670         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2671         R_SPARC_JMP_IREL to switch.
2672         (Target_sparc::Scan::check_non_pic): Likewise.
2673         (Target_sparc::Scan::local): Handle IFUNC symbols.
2674         (Target_sparc::Scan::local): Likewise.
2675         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2676         and plt_address_for_local.
2677         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2678         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2679
2680         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2681         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2682         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2683         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2684         global relocs too.
2685         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2686         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2687         calls.
2688         * sparc.cc (Target_sparc::Scan::global): Likewise.
2689         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2690
2691 2012-04-16  Cary Coutant  <ccoutant@google.com>
2692
2693         * archive.cc (Library_base::should_include_member): Check for
2694         --export-dynamic-symbol.
2695         * options.h (class General_options): Add --export-dynamic-symbol.
2696         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2697         --export-dynamic-symbol.
2698         (Symbol_table::gc_mark_undef_symbols): Likewise.
2699         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2700
2701 2012-04-12  David S. Miller  <davem@davemloft.net>
2702
2703         * sparc.cc (Reloc::wdisp10): New relocation method.
2704         (Reloc::h34): Likewise.
2705         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2706         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2707         R_SPARC_WDISP10.
2708         (Target_sparc::Scan::local): Likewise.
2709         (Target_sparc::Scan::global): Likewise.
2710         (Target_sparc::Relocate::relocate): Likewise.
2711
2712 2012-04-09  Cary Coutant  <ccoutant@google.com>
2713
2714         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2715         low_pc == 0.
2716
2717 2012-04-06  Ian Lance Taylor  <iant@google.com>
2718
2719         * timer.cc: #include <unistd.h>.
2720
2721 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2722
2723         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2724         * config.in: Regenerate.
2725         * configure: Regenerate.
2726
2727 2012-04-05  Nick Clifton  <nickc@redhat.com>
2728
2729         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2730         (AM_LC_MESSAGES): Add.
2731         * aclocal.m4: Regenerate.
2732         * config.in: Regenerate.
2733         * configure: Regenerate.
2734
2735 2012-03-21  Cary Coutant  <ccoutant@google.com>
2736
2737         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2738         * Makefile.in: Regenerate.
2739         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2740         (Sized_elf_reloc_mapper::symbol_section): New function.
2741         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2742         (make_elf_reloc_mapper): New function.
2743         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2744         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2745         (Dwarf_abbrev_table::do_get_abbrev): New function.
2746         (Dwarf_ranges_table::read_ranges_table): New function.
2747         (Dwarf_ranges_table::read_range_list): New function.
2748         (Dwarf_pubnames_table::read_section): New function.
2749         (Dwarf_pubnames_table::read_header): New function.
2750         (Dwarf_pubnames_table::next_name): New function.
2751         (Dwarf_die::Dwarf_die): New function.
2752         (Dwarf_die::read_attributes): New function.
2753         (Dwarf_die::skip_attributes): New function.
2754         (Dwarf_die::set_name): New function.
2755         (Dwarf_die::set_linkage_name): New function.
2756         (Dwarf_die::attribute): New function.
2757         (Dwarf_die::string_attribute): New function.
2758         (Dwarf_die::int_attribute): New function.
2759         (Dwarf_die::uint_attribute): New function.
2760         (Dwarf_die::ref_attribute): New function.
2761         (Dwarf_die::child_offset): New function.
2762         (Dwarf_die::sibling_offset): New function.
2763         (Dwarf_info_reader::check_buffer): New function.
2764         (Dwarf_info_reader::parse): New function.
2765         (Dwarf_info_reader::do_parse): New function.
2766         (Dwarf_info_reader::do_read_string_table): New function.
2767         (Dwarf_info_reader::lookup_reloc): New function.
2768         (Dwarf_info_reader::get_string): New function.
2769         (Dwarf_info_reader::visit_compilation_unit): New function.
2770         (Dwarf_info_reader::visit_type_unit): New function.
2771         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2772         Sized_elf_reloc_mapper.
2773         (Sized_dwarf_line_info::symbol_section): Remove function.
2774         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2775         (Sized_dwarf_line_info::read_line_mappings): Remove object
2776         parameter, adjust callers.
2777         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2778         * dwarf_reader.h: Include <sys/types.h>.
2779         (class Track_relocs): Remove forward declaration.
2780         (class Elf_reloc_mapper): New class.
2781         (class Sized_elf_reloc_mapper): New class.
2782         (class Dwarf_abbrev_table): New class.
2783         (class Dwarf_range_list): New class.
2784         (class Dwarf_ranges_table): New class.
2785         (class Dwarf_pubnames_table): New class.
2786         (class Dwarf_die): New class.
2787         (class Dwarf_info_reader): New class.
2788         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2789         (Sized_dwarf_line_info::symbol_section): Remove member function.
2790         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2791         base class.
2792         * gdb-index.cc: New source file.
2793         * gdb-index.h: New source file.
2794         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2795         and .debug_types sections, call Layout::add_to_gdb_index.
2796         (Sized_relobj_incr::do_section_name): Implement.
2797         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2798         return type; Implement.
2799         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2800         return type.
2801         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2802         parameter list and return type.
2803         (Sized_incr_dynobj::do_section_contents): Likewise.
2804         * layout.cc: Include gdb-index.h.
2805         (Layout::Layout): Initialize gdb_index_data_.
2806         (Layout::init_fixed_output_section): Check for .gdb_index section.
2807         (Layout::add_to_gdb_index): New function. Instantiate.
2808         * layout.h: Add forward declaration for class Gdb_index.
2809         (Layout::add_to_gdb_index): New member function.
2810         (Layout::gdb_index_data_): New data member.
2811         * main.cc: Include gdb-index.h.
2812         (main): Print statistics for gdb index.
2813         * object.cc (Object::section_contents): Move code into
2814         do_section_contents.
2815         (need_decompressed_section): Check for sections needed when building
2816         gdb index.
2817         (build_compressed_section_map): Likewise.
2818         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2819         gdb index.
2820         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2821         sections; call Layout::add_to_gdb_index.
2822         (Sized_relobj_file::do_decompressed_section_contents): Call
2823         do_section_contents directly.
2824         * object.h (Object::do_section_contents): Adjust parameter list and
2825         return type.
2826         (Object::do_decompressed_section_contents): Call do_section_contents
2827         directly.
2828         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2829         return type.
2830         * options.h (class General_options): Add --gdb-index option.
2831         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2832         list and return type.
2833         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2834         * reloc.h (Track_relocs::checkpoint): New function.
2835         (Track_relocs::reset): New function.
2836
2837         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2838         New test cases.
2839         * testsuite/Makefile.in: Regenerate.
2840         * testsuite/gdb_index_test.cc: New test source file.
2841         * testsuite/gdb_index_test_1.sh: New test source file.
2842         * testsuite/gdb_index_test_2.sh: New test source file.
2843
2844 2012-03-19  Doug Kwan  <dougkwan@google.com>
2845
2846         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2847         (Target_arm::do_finalize_sections): Remove code which defines
2848         __exidx_start and __exidx_end.  Make symbol table parameter
2849         anonymous as it is not used.
2850         * gold.cc (queue_middle_tasks): Call target hook to define any
2851         target-specific symbols.
2852         * target.h (Target::define_standard_symbols): New method.
2853         (Target::do_define_standard_symbols): Same.
2854         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2855         * testsuite/Makefile.in: Regenerate.
2856         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2857         and __exidx_end.
2858         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2859         relocations are generated for __exidx_start and __exidx_end.
2860
2861 2012-03-16  Doug Kwan  <dougkwan@google.com>
2862
2863         * testsuite/Makefile.am: Disable test initpri3b.
2864         * testsuite/Makefile.in: Regenerate.
2865
2866 2012-03-15  Doug Kwan  <dougkwan@google.com>
2867
2868         * arm.cc (Target_arm::got_section): Make .got section read-only
2869         if -z now is given.
2870
2871 2012-03-15  Ian Lance Taylor  <iant@google.com>
2872
2873         PR gold/13850
2874         * layout.cc (Layout::make_output_section): Correctly mark
2875         SHT_INIT_ARRAY, et. al., as relro.
2876
2877 2012-03-14  Doug Kwan  <dougkwan@google.com>
2878
2879         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2880         dynamic relocations for protected symbols in shared objects.
2881
2882 2012-03-13  Ian Lance Taylor  <iant@google.com>
2883
2884         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2885         keep the larger alignment.
2886
2887 2012-03-12  Cary Coutant  <ccoutant@google.com>
2888
2889         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2890         handling of DW_LNE_define_file.
2891
2892 2012-03-12  Cary Coutant  <ccoutant@google.com>
2893
2894         * reduced_debug_output.cc
2895         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2896         codes to switch.
2897
2898 2012-02-29  Cary Coutant  <ccoutant@google.com>
2899
2900         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2901
2902 2012-02-29  Cary Coutant  <ccoutant@google.com>
2903
2904         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2905         Call Object::decompressed_section_contents.
2906         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2907         New dtor.
2908         (Sized_dwarf_line_info::buffer_start_): New data member.
2909         * merge.cc (Output_merge_data::do_add_input_section): Call
2910         Object::decompressed_section_contents.
2911         (Output_merge_string::do_add_input_section): Likewise.
2912         * object.cc (need_decompressed_section): New function.
2913         (build_compressed_section_map): Decompress sections needed later.
2914         (Sized_relobj_file::do_decompressed_section_contents): New function.
2915         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2916         * object.h (Object::decompressed_section_contents): New function.
2917         (Object::discard_decompressed_sections): New function.
2918         (Object::do_decompressed_section_contents): New function.
2919         (Object::do_discard_decompressed_sections): New function.
2920         (Compressed_section_info): New type.
2921         (Compressed_section_map): Include decompressed section contents.
2922         (Sized_relobj_file::do_decompressed_section_contents): New function.
2923         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2924
2925 2012-02-16  Cary Coutant  <ccoutant@google.com>
2926
2927         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2928         * testsuite/Makefile.in: Regenerate.
2929
2930 2012-02-14  Cary Coutant  <ccoutant@google.com>
2931
2932         * options.cc (General_options::finalize): Disallow -pie and -static.
2933
2934 2012-02-03  Doug Kwan  <dougkwan@google.com>
2935
2936         * arm.cc (Arm_relocate_functions::abs8,
2937         Arm_relocate_functions::abs16): Use
2938         Bits::has_signed_unsigned_overflow32.
2939         (Arm_relocate_functions::thm_abs8): Correct range of
2940         overflow check.
2941         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2942         in assertions.
2943
2944 2012-02-02  Doug Kwan  <dougkwan@google.com>
2945
2946         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2947         position independent outputs, not just shared objects.
2948
2949 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2950
2951         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2952         * configure: Regenerated.
2953
2954 2012-01-27  Ian Lance Taylor  <iant@google.com>
2955
2956         * reloc.h (Bits): New class with static functions, copied from
2957         namespace utils in arm.cc.
2958         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2959         instead.
2960
2961 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2962
2963         * incremental.cc (write_info_blocks): Correct relocation offset.
2964
2965 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2966
2967         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2968         (Relocate::tls_gd_to_le): Likewise.
2969
2970 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2971
2972         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2973
2974 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2975
2976         * configure.ac: Check if -mcmodel=medium works.
2977         * configure: Regenerated.
2978
2979 2012-01-24  Cary Coutant  <ccoutant@google.com>
2980
2981         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2982         definition and ...
2983         (read_unsigned_LEB_128_x): ... this new function.
2984         (read_signed_LEB_128): Replaced with inline definition and ...
2985         (read_signed_LEB_128_x): ... this new function.
2986         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
2987         (read_unsigned_LEB_128): Add inline definition.
2988         (read_signed_LEB_128_x): New function.
2989         (read_signed_LEB_128): Add inline definition.
2990         * testsuite/Makefile.am (leb128_unittest): New unit test.
2991         * testsuite/Makefile.in: Regenerate.
2992         * testsuite/leb128_unittest.cc: New unit test.
2993
2994 2012-01-23  Ian Lance Taylor  <iant@google.com>
2995
2996         PR gold/13617
2997         * i386.cc (Target_i386::do_code_fill): When using a jmp
2998         instruction, pad with nop instructions.
2999         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3000
3001 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3002
3003         * x86_64.cc (gc_process_relocs): Add typename on types used in
3004         template.
3005         (scan_relocs): Likewise.
3006         (relocate_section): Likewise.
3007         (apply_relocation): Likewise.
3008
3009 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3010
3011         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3012         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3013         under x32.
3014
3015 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3016
3017         * x86_64.cc: Initial support for x32.
3018
3019 2012-01-03  Cary Coutant  <ccoutant@google.com>
3020
3021         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3022         Use abstract base class for GOT.
3023         * gold/output.h (class Output_data_got_base): New abstract base class.
3024         (class Output_data_got): Derive from new base class, adjust ctors.
3025         (Output_data_got::reserve_slot): Make virtual; rename to
3026         do_reserve_slot; Adjust callers.
3027         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3028         pointer to abstract base class.
3029         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3030
3031 2011-12-18  Ian Lance Taylor  <iant@google.com>
3032
3033         * object.h (Relobj::local_symbol_value): New function.
3034         (Relobj::local_plt_offset): New function.
3035         (Relobj::local_has_got_offset): New function.
3036         (Relobj::local_got_offset): New function.
3037         (Relobj::set_local_got_offset): New function.
3038         (Relobj::do_local_symbol_value): New pure virtual function.
3039         (Relobj::do_local_plt_offset): Likewise.
3040         (Relobj::do_local_has_got_offset): Likewise.
3041         (Relobj::do_local_got_offset): Likewise.
3042         (Relobj::do_set_local_got_offset): Likewise.
3043         (Sized_relobj::do_local_has_got_offset): Rename from
3044         local_has_got_offset.
3045         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3046         (Sized_relobj::do_set_local_got_offset): Rename from
3047         set_local_got_offset.
3048         (Sized_relobj_file::do_local_plt_offset): Rename from
3049         local_plt_offset.
3050         (Sized_relobj_file::do_local_symbol_value): New function.
3051         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3052         local_plt_offset.
3053         * output.cc (Output_data_got::Got_entry::write): Change object to
3054         Relobj.  Use local_symbol_value.
3055         (Output_data_got::add_global_with_rel): Change rel_dyn to
3056         Output_data_reloc_generic*.  Use add_global_generic.
3057         (Output_data_got::add_global_with_rela): Remove.  Change all
3058         callers to use add_global_with_rel.
3059         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3060         Output_data_reloc_generic*.  Use add_global_generic.
3061         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3062         callers to use add_global_pair_with_rel.
3063         (Output_data_got::add_local): Change object to Relobj*.
3064         (Output_data_got::add_local_plt): Likewise.
3065         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3066         change rel_dyn to Output_data_reloc_generic*.  Use
3067         add_local_generic.
3068         (Output_data_got::add_local_with_rela): Remove.  Change all
3069         callers to use all_local_with_rel.
3070         (Output_data_got::add_local_pair_with_rel): Change object to
3071         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3072         add_output_section_generic.
3073         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3074         callers to use add_local_pair_with_rel.
3075         (Output_data_got::reserve_local): Change object to Relobj*.
3076         * output.h: (class Output_data_reloc_generic): Add pure virtual
3077         declarations for add_global_generic, add_local_generic,
3078         add_output_section_generic.
3079         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3080         functions for Output_data_reloc_generic.  Update declarations for
3081         changes listed in output.cc.
3082         (class Output_data_got): Change template parameter to got_size.
3083         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3084         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3085         function.
3086         (Sized_relobj_incr::do_local_plt_offset): New function.
3087         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3088         add_global_generic.
3089
3090 2011-12-17  Cary Coutant  <ccoutant@google.com>
3091
3092         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3093         * resolve.cc (Symbol_table::resolve): Likewise.
3094         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3095         arrays.
3096         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3097
3098 2011-12-16  Ian Lance Taylor  <iant@google.com>
3099
3100         * output.h (Output_data_reloc_generic::add): Only call
3101         add_dynamic_reloc if this is a dynamic reloc section.
3102
3103 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3104
3105         PR gold/13505
3106         * target-reloc.h (apply_relocation): Replace <64, false> with
3107         <size, big_endian>.
3108
3109 2011-11-25  Nick Clifton  <nickc@redhat.com>
3110
3111         * po/it.po: New Italian translation.
3112
3113 2011-11-17  Sterling Augustine  <saugustine@google.com>
3114
3115         * script.cc (script_include_directive): Implement.
3116         (read_script_file): New local variables name and search_path. Update
3117         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3118         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3119         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3120
3121 2011-11-11  Sterling Augustine  <saugustine@google.com>
3122
3123         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3124         (file_or_sections_cmd): Likewise.
3125
3126 2011-11-11  Doug Kwan  <dougkwan@google.com>
3127
3128         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3129         if --just-symbols is given.
3130
3131 2011-11-10  Doug Kwan  <dougkwan@google.com>
3132
3133         PR gold/13362
3134         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3135         when processing data relocs.
3136         * reloc.h (Relocate_functions::rel_unaligned): New method.
3137         (Relocate_functions::pcrel_unaligned): Ditto.
3138         (Relocate_functions::rel32_unaligned): Ditto.
3139         (Relocate_functions::pcrel32_unaligned): Ditto.
3140
3141 2011-11-09  Doug Kwan  <dougkwan@google.com>
3142
3143         PR gold/13362
3144         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3145         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3146         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3147         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3148         (Relocate_functions::rel_unaligned): New.
3149         (Relocate_functions::rel32_unaligned): New.
3150         * target-reloc.h (relocate_for_relocatable): Add code to handle
3151         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3152         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3153         arm_unaligned_reloc_r): New targets.
3154         * testsuite/Makefile.in: Regenerate.
3155         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3156         linking.
3157
3158 2011-11-02  Ian Lance Taylor  <iant@google.com>
3159
3160         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3161         NATIVE_LINKER.
3162         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3163         * options.cc (General_options::finalize): Use library search path
3164         from configure script if specified.  If not native and no sysroot,
3165         only search TOOLLIBDIR.
3166         * options.h (Search_directory::Search_directory): Change name to
3167         const std::string&.
3168         (General_options::add_to_library_path_with_sysroot): Change arg to
3169         const std::string&.
3170         * configure, Makefile.in, config.in: Rebuild.
3171
3172 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3173
3174         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3175         we are working around the ARM1176 Erratum.
3176         * options.h (General_options::fix_arm1176): Add option.
3177         * testsuite/Makefile.am: Add testcases, and keep current ones
3178         working.
3179         * testsuite/Makefile.in: Regenerate.
3180         * testsuite/arm_fix_1176.s: New file.
3181         * testsuite/arm_fix_1176.sh: Likewise.
3182
3183 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3184
3185         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3186         may_use_blx_.
3187         (Target_arm::may_use_blx): Remove method.
3188         (Target_arm::set_may_use_blx): Likewise.
3189         (Target_arm::may_use_v4t_interworking): New method.
3190         (Target_arm::may_use_v5t_interworking): Likewise.
3191         (Target_arm::may_use_blx_): Remove member variable.
3192         (Arm_relocate_functions::arm_branch_common): Check for v5T
3193         interworking.
3194         (Arm_relocate_functions::thumb_branch_common): Likewise.
3195         (Reloc_stub::stub_type_for_reloc): Likewise.
3196         (Target_arm::do_finalize_sections): Correct interworking checks.
3197         * testsuite/Makefile.am: Add new tests.
3198         * testsuite/Makefile.in: Regenerate.
3199         * testsuite/arm_farcall_arm_arm.s: New test.
3200         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3201         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3202         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3203         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3204         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3205         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3206         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3207
3208 2011-10-31  Cary Coutant  <ccoutant@google.com>
3209
3210         PR gold/13023
3211         * expression.cc (Expression::eval_with_dot): Add
3212         is_section_dot_assignment parameter.
3213         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3214         absolute and assigning to dot within a section.
3215         * script-sections.cc
3216         (Output_section_element_assignment::set_section_addresses): Pass
3217         dot_section to set_if_absolute.
3218         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3219         as is_section_dot_assignment flag to eval_with_dot.
3220         (Output_section_element_dot_assignment::set_section_addresses):
3221         Likewise.
3222         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3223         parameter.  Also set value if relative to dot_section; set the
3224         symbol's output_section.
3225         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3226         parameter.  Adjust all callers.
3227         (Expression::eval_maybe_dot): Likewise.
3228         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3229         Adjust all callers.
3230         * testsuite/script_test_2.t: Test assignment of an absolute value
3231         to dot within an output section element.
3232
3233 2011-10-31  Cary Coutant  <ccoutant@google.com>
3234
3235         * options.h (class General_options): Add --[no-]gnu-unique options.
3236         * symtab.cc (Symbol_table::sized_write_globals): Convert
3237         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3238
3239 2011-10-31  Cary Coutant  <ccoutant@google.com>
3240
3241         PR gold/13359
3242         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3243         unnecessary assertion.
3244         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3245
3246 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3247
3248         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3249         gc_mark_symbol.
3250         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3251         gc_mark_symbol.
3252         Change to just keep the section associated with symbol.
3253         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3254         they are externally visible and --export-dynamic is turned on.
3255         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3256
3257 2011-10-19  Ian Lance Taylor  <iant@google.com>
3258
3259         PR gold/13163
3260         * script-sections.cc
3261         (Output_section_element_dot_assignment::needs_output_section): New
3262         function.
3263
3264 2011-10-19  Ian Lance Taylor  <iant@google.com>
3265
3266         PR gold/13204
3267         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3268         --section-start option was seen.
3269         * options.h (General_options::any_section_start): New function.
3270
3271 2011-10-18  David S. Miller  <davem@davemloft.net>
3272
3273         PR binutils/13301
3274         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3275         member to track relocation locations that have moved during TLS
3276         reloc optimizations.
3277         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3278         (Target_sparc::Relocate::relocate): Adjust view down by 4
3279         bytes if it matches reloc_adjust_addr_.
3280         (Target_sparc::Relocate::relocate_tls): Always move the
3281         __tls_get_addr call delay slot instruction forward 4 bytes when
3282         performing relaxation.
3283
3284 2011-10-18  Cary Coutant  <ccoutant@google.com>
3285
3286         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3287         (Output_file::map_no_anonymous): Check for non-zero
3288         return code from posix_fallocate.
3289
3290 2011-10-17  Cary Coutant  <ccoutant@google.com>
3291
3292         PR gold/13245
3293         * plugin.cc (is_visible_from_outside): Check for symbols
3294         referenced from dynamic objects.
3295         * resolve.cc (Symbol_table::resolve): Don't count references
3296         from dynamic objects as references from real ELF files.
3297         * testsuite/plugin_test_2.sh: Adjust expected result.
3298
3299 2011-10-17  Cary Coutant  <ccoutant@google.com>
3300
3301         * gold.cc: Include timer.h.
3302         (queue_middle_tasks): Stamp time.
3303         (queue_final_tasks): Likewise.
3304         * main.cc (main): Store timer in parameters.  Print timers
3305         for each pass.
3306         * parameters.cc (Parameters::Parameters): Initialize timer_.
3307         (Parameters::set_timer): New function.
3308         (set_parameters_timer): New function.
3309         * parameters.h (Parameters::set_timer): New function.
3310         (Parameters::timer): New function.
3311         (Parameters::timer_): New data member.
3312         (set_parameters_timer): New function.
3313         * timer.cc (Timer::stamp): New function.
3314         (Timer::get_pass_time): New function.
3315         * timer.h (Timer::stamp): New function.
3316         (Timer::get_pass_time): New function.
3317         (Timer::pass_times_): New data member.
3318
3319 2011-10-17  Cary Coutant  <ccoutant@google.com>
3320
3321         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3322         task for members of lib groups.
3323
3324 2011-10-17  Cary Coutant  <ccoutant@google.com>
3325
3326         PR gold/13288
3327         * fileread.cc (File_read::find_view): Add assert.
3328         (File_read::make_view): Move bounds check (replace with assert)...
3329         (File_read::find_or_make_view): ... to here.
3330
3331 2011-10-12  Cary Coutant  <ccoutant@google.com>
3332
3333         * output.cc (Output_file::open_base_file): Handle case where
3334         ::read returns less than requested size.
3335
3336 2011-10-10  Cary Coutant  <ccoutant@google.com>
3337
3338         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3339         Initialize defined_count_.
3340         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3341         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3342         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3343         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3344         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3345         * incremental.h (Sized_relobj_incr::defined_count_): New data
3346         member.
3347         (Sized_incr_dynobj::defined_count_): New data member.
3348         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3349         Return zeroes instead of internal error.
3350
3351 2011-10-10  Cary Coutant  <ccoutant@google.com>
3352
3353         PR gold/13249
3354         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3355         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3356         * output.h (class Output_reloc): Add use_plt_offset flag.
3357         (Output_reloc::type_): Adjust size of bit field.
3358         (Output_reloc::use_plt_offset_): New bit field.
3359         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3360         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3361         flag.  Adjust all callers.
3362         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3363         creating RELATIVE relocations.
3364
3365 2011-10-10  Nick Clifton  <nickc@redhat.com>
3366
3367         * po/es.po: Updated Spanish translation.
3368         * po/fi.po: Updated Finnish translation.
3369
3370 2011-10-03   Diego Novillo  <dnovillo@google.com>
3371
3372         * options.cc (parse_uint): Fix dereference of RETVAL.
3373
3374 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3375
3376         * layout.h (section_order_map_): New member.
3377         (get_section_order_map): New member function.
3378         * output.cc (Output_section::add_input_section): Check for patterns
3379         only when --section-ordering-file is specified.
3380         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3381         output_sections have been formed.
3382         * layout.cc (Layout_Layout): Initialize section_order_map_.
3383         * plugin.cc (update_section_order): Store order in order_map. Do not
3384         update the order.
3385         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3386         * testsuite/Makefile.in: Regenerate.
3387         * testsuite/plugin_section_order.c: New file.
3388         * testsuite/plugin_final_layout.cc: New file.
3389         * testsuite/plugin_final_layout.sh: New file.
3390
3391 2011-09-29  Cary Coutant  <ccoutant@google.com>
3392
3393         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3394         Check for NULL.
3395         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3396         symbols during incremental update.
3397         (Symbol_table::add_from_dynobj): Likewise.
3398
3399 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3400             Ian Lance Taylor  <iant@google.com>
3401
3402         * symtab.cc (Symbol_table::define_special_symbol): Always
3403         canonicalize version string.
3404
3405 2011-09-26  Cary Coutant  <ccoutant@google.com>
3406
3407         * gold.cc (queue_initial_tasks): Move option checks ...
3408         * options.cc (General_options::finalize): ... to here. Disable
3409         some options; make others fatal.
3410
3411 2011-09-26  Cary Coutant  <ccoutant@google.com>
3412
3413         gcc PR lto/47247
3414         * plugin.cc (get_symbols_v2): New function.
3415         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3416         (is_referenced_from_outside): New function.
3417         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3418         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3419         (get_symbols): Pass version parameter.
3420         (get_symbols_v2): New function.
3421         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3422         parameter.
3423         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3424         (onload): Add LDPT_GET_SYMBOLS_V2.
3425         (all_symbols_read_hook): Use get_symbols_v2; check for
3426         LDPR_PREVAILING_DEF_IRONLY_EXP.
3427         * testsuite/plugin_test_3.sh: Update expected results.
3428
3429 2011-09-23  Simon Baldwin  <simonb@google.com>
3430
3431         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3432         configuration options.
3433         * configure: Regenerate.
3434         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3435         * Makefile.in: Regenerate.
3436         * testsuite/Makefile.in: Regenerate.
3437
3438 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3439
3440         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3441
3442 2011-09-19  Cary Coutant  <ccoutant@google.com>
3443
3444         * incremental.cc (can_incremental_update): Fix typo in comment.
3445         * incremental.h (can_incremental_update): Likewise.
3446
3447 2011-09-18  Cary Coutant  <ccoutant@google.com>
3448
3449         * incremental.cc (can_incremental_update): New function.
3450         * incremental.h (can_incremental_update): New function.
3451         * layout.cc (Layout::init_fixed_output_section): Call it.
3452         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3453         * object.cc (Sized_relobj_file::do_layout): Call
3454         can_incremental_update.
3455
3456 2011-09-13  Cary Coutant  <ccoutant@google.com>
3457
3458         * configure.ac: Check for glibc support for gnu_indirect_function
3459         support with static linking, setting automake conditional
3460         IFUNC_STATIC.
3461         * Makefile.in: Regenerate.
3462         * configure: Regenerate.
3463
3464         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3465         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3466         for IFUNC_STATIC.
3467         * testsuite/Makefile.in: Regenerate.
3468
3469 2011-09-13  Cary Coutant  <ccoutant@google.com>
3470
3471         * incremental.cc (Sized_relobj_incr::do_layout): Call
3472         report_comdat_group for kept comdat sections.
3473         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3474         * testsuite/Makefile.in: Regenerate.
3475         * testsuite/incr_comdat_test_1.cc: New source file.
3476         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3477         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3478         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3479
3480 2011-09-13  Ian Lance Taylor  <iant@google.com>
3481
3482         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3483         variable external_symbols_offset.
3484
3485 2011-09-12  Ian Lance Taylor  <iant@google.com>
3486
3487         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3488         triggered if object has no symbols.
3489
3490 2011-09-09  David S. Miller  <davem@davemloft.net>
3491
3492         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3493         (Output_fill_debug_line::do_write): Likewise.
3494
3495 2011-08-29  Cary Coutant  <ccoutant@google.com>
3496
3497         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3498         casts to match formatting specs.
3499         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3500
3501 2011-08-26  Cary Coutant  <ccoutant@google.com>
3502
3503         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3504         remaining hole size when allocating.
3505         (Layout::make_output_section): Set fill methods for debug sections.
3506         * layout.h (Free_list::Free_list_node): Move from private to
3507         public.
3508         (Free_list::set_min_hole_size): New function.
3509         (Free_list::begin, Free_list::end): New functions.
3510         (Free_list::min_hole_): New data member.
3511         * output.cc: Include dwarf.h.
3512         (Output_fill_debug_info::do_minimum_hole_size): New function.
3513         (Output_fill_debug_info::do_write): New function.
3514         (Output_fill_debug_line::do_minimum_hole_size): New function.
3515         (Output_fill_debug_line::do_write): New function.
3516         (Output_section::Output_section): Initialize new data member.
3517         (Output_section::set_final_data_size): Ensure patch space is larger
3518         than minimum hole size.
3519         (Output_section::do_write): Fill holes in debug sections.
3520         * output.h (Output_fill): New class.
3521         (Output_fill_debug_info): New class.
3522         (Output_fill_debug_line): New class.
3523         (Output_section::set_free_space_fill): New function.
3524         (Output_section::free_space_fill_): New data member.
3525         * testsuite/Makefile.am (incremental_test_3): Add
3526         --incremental-patch option.
3527         (incremental_test_4): Likewise.
3528         (incremental_test_5): Likewise.
3529         (incremental_test_6): Likewise.
3530         (incremental_copy_test): Likewise.
3531         (incremental_common_test_1): Likewise.
3532         * testsuite/Makefile.in: Regenerate.
3533
3534 2011-08-26  Nick Clifton  <nickc@redhat.com>
3535
3536         * po/es.po: Updated Spanish translation.
3537
3538 2011-08-01  Cary Coutant  <ccoutant@google.com>
3539
3540         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3541         * gold/testsuite/Makefile.in: Regenerate.
3542         * gold/testsuite/justsyms_exec.c: New source file.
3543         * gold/testsuite/justsyms_lib.c: New source file.
3544
3545 2011-08-01  Cary Coutant  <ccoutant@google.com>
3546
3547         * layout.cc (Layout::set_segment_offsets): Don't realign text
3548         segment if -Ttext was specified.
3549         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3550         file type.
3551         * object.h (Sized_relobj_file::e_type): New function.
3552         (Sized_relobj_file::e_type_): New data member.
3553         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3554         base address for ET_EXEC files.
3555         * target.cc (Target::do_make_elf_object_implementation): Allow
3556         ET_EXEC files with --just-symbols option.
3557
3558 2011-07-28  Cary Coutant  <ccoutant@google.com>
3559
3560         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3561         Add thread_number parameter.
3562         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3563         * workqueue-threads.cc
3564         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3565         current thread if its thread number is greater than desired thread
3566         count.
3567         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3568         Add thread_number parameter.
3569         (Workqueue::should_cancel_thread): Likewise.
3570         (Workqueue::find_runnable_or_wait): Pass thread_number to
3571         should_cancel_thread.
3572         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3573         parameter.
3574
3575 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3576
3577         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3578         only after checking if it cannot be forced local.
3579         * symtab.h (is_externally_visible): Check if the symbol is not forced
3580         local.
3581
3582 2011-07-15  Ian Lance Taylor  <iant@google.com>
3583
3584         * options.h (class General_options): Add --print-output-format.
3585         Move -EL next to -EB, for  better --help output.
3586         * target-select.cc: Include <cstdio>, "options.h", and
3587         "parameters.h".
3588         (Target_selector::do_target_bfd_name): New function.
3589         (print_output_format): New function.
3590         * target-select.h (class Target_selector): Update declarations.
3591         (Target_selector::target_bfd_name): New function.
3592         (print_output_format): Declare.
3593         * main.cc: Include "target-select.h".
3594         (main): Handle --print-output-format.
3595         * gold.cc: Include "target-select.h".
3596         (queue_initial_tasks): Handle --print-output-format when there are
3597         no input files.
3598         * parameters.cc (parameters_force_valid_target): Give a better
3599         error message if -EB/-EL does not match target.
3600         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3601         function.
3602
3603 2011-07-15  Ian Lance Taylor  <iant@google.com>
3604
3605         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3606         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3607         (Output_data_plt_i386::do_write): Write address of .dynamic
3608         section to first entry in .got.plt section.
3609         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3610         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3611         Initialize layout_.
3612         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3613         section to first entry in .got.plt section.
3614         * layout.h (Layout::dynamic_section): New function.
3615
3616 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3617
3618         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3619         to claim_file call.
3620         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3621         input_section_position_, and input_section_glob_.
3622         (read_layout_from_file): Call function section_ordering_specified.
3623         * layout.h (is_section_ordering_specified): New function.
3624         (section_ordering_specified): New function.
3625         (section_ordering_specified_): New boolean member.
3626         * main.cc(main): Call load_plugins after layout object is defined.
3627         * output.cc (Output_section::add_input_section): Use
3628         function section_ordering_specified to check if section ordering is
3629         needed.
3630         * output.cc (Output_section::add_relaxed_input_section): Use
3631         function section_ordering_specified to check if section ordering is
3632         needed.
3633         (Output_section::update_section_layout): New function.
3634         (Output_section::sort_attached_input_sections): Check if input section
3635         must be reordered.
3636         * output.h (Output_section::update_section_layout): New function.
3637         * plugin.cc (get_section_count): New function.
3638         (get_section_type): New function.
3639         (get_section_name): New function.
3640         (get_section_contents): New function.
3641         (update_section_order): New function.
3642         (allow_section_ordering): New function.
3643         (Plugin::load): Add the new interfaces to the transfer vector.
3644         (Plugin_manager::load_plugins): New parameter.
3645         (Plugin_manager::all_symbols_read): New parameter.
3646         (Plugin_manager::claim_file): New parameter. Save the elf object for
3647         unclaimed objects.
3648         (Plugin_manager::get_elf_object): New function.
3649         (Plugin_manager::get_view): Change to directly use the bool to check
3650         if get_view is called from claim_file_hook.
3651         * plugin.h (input_objects): New function
3652         (Plugin__manager::load_plugins): New parameter.
3653         (Plugin_manager::claim_file): New parameter.
3654         (Plugin_manager::get_elf_object): New function.
3655         (Plugin_manager::in_claim_file_handler): New function.
3656         (Plugin_manager::in_claim_file_handler_): New member.
3657         (layout): New function.
3658         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3659         handler with an extra parameter. Make the elf object before calling
3660         claim_file handler.
3661         * testsuite/plugin_test.c (get_section_count): New function pointer.
3662         (get_section_type): New function pointer.
3663         (get_section_name): New function pointer.
3664         (get_section_contents): New function pointer.
3665         (update_section_order): New function pointer.
3666         (allow_section_ordering): New function pointer.
3667         (onload): Check if the new interfaces exist.
3668
3669 2011-07-13  Ian Lance Taylor  <iant@google.com>
3670
3671         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3672         relro section.
3673         * x86_64.cc (Target_x86_64::got_section): Likewise.
3674         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3675         (relro_now_test_SOURCES): New variable.
3676         (relro_now_test_DEPENDENCIES): New variable.
3677         (relro_now_test_LDFLAGS): New variable.
3678         (relro_now_test_LDADD): New variable.
3679         (relro_now_test.so): New target.
3680         * testsuite/Makefile.in: Rebuild.
3681
3682 2011-07-12  Ian Lance Taylor  <iant@google.com>
3683
3684         PR gold/12980
3685         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3686         GLOB_DAT relocation rather than a RELATIVE relocation for a
3687         protected symbol when creating a shared library.
3688         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3689         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3690         * testsuite/protected_main_1.cc (main): Test that protected
3691         function has same address.
3692
3693 2011-07-11  Ian Lance Taylor  <iant@google.com>
3694
3695         PR gold/12979
3696         * options.h (class General_options): Add -Bgroup.
3697         * options.cc (General_options::finalize): If -Bgroup is set,
3698         default to --unresolved-symbols=report-all.
3699         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3700         * target-reloc.h (issue_undefined_symbol_error): Handle
3701         --unresolved-symbols=report-all.
3702
3703 2011-07-08  Ian Lance Taylor  <iant@google.com>
3704
3705         PR gold/11985
3706         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3707         if linker script discards key sections.
3708         (Layout::create_dynamic_symtab): Likewise.
3709         (Layout::assign_local_dynsym_offsets): Likewise.
3710         (Layout::sized_create_version_sections): Likewise.
3711         (Layout::create_interp): Likewise.
3712         (Layout::finish_dynamic_section): Likewise.
3713         (Layout::set_dynamic_symbol_size): Likewise.
3714
3715 2011-07-08  Ian Lance Taylor  <iant@google.com>
3716
3717         PR gold/12386
3718         * options.h (class General_options): Add --unresolved-symbols.
3719         * target-reloc.h (issue_undefined_symbol_error): Check
3720         --unresolved-symbols.  Add comments.
3721
3722 2011-07-08  Ian Lance Taylor  <iant@google.com>
3723
3724         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3725         expression more complex.
3726
3727 2011-07-08  Ian Lance Taylor  <iant@google.com>
3728
3729         PR gold/11317
3730         * target-reloc.h (issue_undefined_symbol_error): New inline
3731         function, broken out of relocate_section.
3732         (relocate_section): Call issue_undefined_symbol_error.
3733         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3734         there is no TLS segment if we are about to issue an undefined
3735         symbol error.
3736         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3737
3738 2011-07-08  Ian Lance Taylor  <iant@google.com>
3739
3740         PR gold/12279
3741         * resolve.cc (Symbol_table::should_override): Add fromtype
3742         parameter.  Change all callers.  Give error when linking together
3743         TLS and non-TLS symbol.
3744         (Symbol_table::should_override_with_special): Add fromtype
3745         parameter.  Change all callers.
3746         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3747         there is no TLS segment if we have reported some errors.
3748         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3749
3750 2011-07-08  Ian Lance Taylor  <iant@google.com>
3751
3752         PR gold/12372
3753         * target.h (Target::plt_address_for_global): New function.
3754         (Target::plt_address_for_local): New function.
3755         (Target::plt_section_for_global): Remove.
3756         (Target::plt_section_for_local): Remove.
3757         (Target::do_plt_address_for_global): New virtual function.
3758         (Target::do_plt_address_for_local): New virtual function.
3759         (Target::do_plt_section_for_global): Remove.
3760         (Target::do_plt_section_for_local): Remove.
3761         (Target::register_global_plt_entry): Add Symbol_table and Layout
3762         parameters.
3763         * output.cc (Output_data_got::Got_entry::write): Use
3764         plt_address_for_global and plt_address_for_local.
3765         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3766         address of output section.
3767         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3768         got_irelative_, and irelative_count_ fields.  Update
3769         declarations.
3770         (Output_data_plt_i386::has_irelative_section): New function.
3771         (Output_data_plt_i386::entry_count): Add irelative_count_.
3772         (Output_data_plt_i386::set_final_data_size): Likewise.
3773         (class Target_i386): Add got_irelative_ and rel_irelative_
3774         fields.  Update declarations.
3775         (Target_i386::Target_i386): Initialize new fields.
3776         (Target_i386::do_plt_address_for_global): New function replacing
3777         do_plt_section_for_global.
3778         (Target_i386::do_plt_address_for_local): New function replacing
3779         do_plt_section_for_local.
3780         (Target_i386::got_section): Create got_irelative_.
3781         (Target_i386::rel_irelative_section): New function.
3782         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3783         fields.  Don't define __rel_iplt_{start,end}.
3784         (Output_data_plt_i386::add_entry): Add symtab and layout
3785         parameters.  Change all callers.  Use different PLT and GOT for
3786         IFUNC symbols.
3787         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3788         layout parameters.  Change all callers.  Use different PLT and
3789         GOT.
3790         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3791         (Output_data_plt_i386::rel_irelative): New function.
3792         (Output_data_plt_i386::address_for_global): New function.
3793         (Output_data_plt_i386::address_for_local): New function.
3794         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3795         IRELATIVE GOT when changing IFUNC GOT entries.
3796         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3797         reloc.
3798         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3799         if we didn't create an IRELATIVE GOT.
3800         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3801         plt_address_for_local.
3802         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3803         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3804         got_irelative_, and irelative_count_ fields.  Update
3805         declarations.
3806         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3807         Initialize new fields.  Remove symtab parameter.  Change all
3808         callers.
3809         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3810         irelative_count_.
3811         (Output_data_plt_x86_64::has_irelative_section): New function.
3812         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3813         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3814         fields.  Update declarations.
3815         (Target_x86_64::Target_x86_64): Initialize new fields.
3816         (Target_x86_64::do_plt_address_for_global): New function replacing
3817         do_plt_section_for_global.
3818         (Target_x86_64::do_plt_address_for_local): New function replacing
3819         do_plt_section_for_local.
3820         (Target_x86_64::got_section): Create got_irelative_.
3821         (Target_x86_64::rela_irelative_section): New function.
3822         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3823         all callers.  Don't create __rel_iplt_{start,end}.
3824         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3825         parameters.  Change all callers.  Use different PLT and GOT for
3826         IFUNC symbols.
3827         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3828         layout parameters.  Change all callers.  Use different PLT and
3829         GOT.
3830         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3831         parameters.  Change all callers.  Use different PLT and GOT for
3832         IFUNC symbols.
3833         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3834         (Output_data_plt_x86_64::rela_irelative): New function.
3835         (Output_data_plt_x86_64::address_for_global): New function.
3836         (Output_data_plt_x86_64::address_for_local): New function.
3837         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3838         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3839         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3840         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3841         parameters.
3842         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3843         reloc.
3844         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3845         symbols if we didn't create an IRELATIVE GOT.
3846         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3847         plt_address_for_local.
3848         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3849         * testsuite/ifuncvar1.c: New test file.
3850         * testsuite/ifuncvar2.c: New test file.
3851         * testsuite/ifuncvar3.c: New test file.
3852         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3853         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3854         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3855         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3856         * testsuite/Makefile.in: Rebuild.
3857
3858 2011-07-07  Cary Coutant  <ccoutant@google.com>
3859
3860         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3861         (two_file_test_1_ndebug.o): Likewise.
3862         (two_file_test_1b_ndebug.o): Likewise.
3863         (two_file_test_2_ndebug.o): Likewise.
3864         (two_file_test_main_ndebug.o): Likewise.
3865         (incremental_test_2): Link with no-debug versions.
3866
3867 2011-07-06  Cary Coutant  <ccoutant@google.com>
3868
3869         * gold/incremental.cc
3870         (Output_section_incremental_inputs::write_info_blocks): Check for
3871         hidden and internal symbols.
3872
3873 2011-07-06  Cary Coutant  <ccoutant@google.com>
3874
3875         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3876         Check disposition for startup file.
3877         (Incremental_inputs::report_command_line): Ignore
3878         --incremental-startup-unchanged option.
3879         * options.cc (General_options::parse_incremental_startup_unchanged):
3880         New function.
3881         (General_options::General_options): Initialize new data member.
3882         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3883         (General_options): Add --incremental-startup-unchanged option.
3884         (General_options::incremental_startup_disposition): New function.
3885         (General_options::incremental_startup_disposition_): New data member.
3886
3887 2011-07-06  Cary Coutant  <ccoutant@google.com>
3888
3889         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3890         input file index to Script_info ctor.
3891         (Sized_incremental_binary::do_file_has_changed): Find the
3892         command-line argument for files named in scripts.
3893         * incremental.h (Script_info::Script_info): New ctor
3894         with input file index.
3895         (Script_info::input_file_index): New function.
3896         (Script_info::input_file_index_): New data member.
3897         (Incremental_binary::get_library): Add const.
3898         (Incremental_binary::get_script_info): Add const.
3899         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3900         * testsuite/Makefile.am (incremental_test_5): New test case.
3901         (incremental_test_6): New test case.
3902         * testsuite/Makefile.in: Regenerate.
3903
3904 2011-07-06  Cary Coutant  <ccoutant@google.com>
3905
3906         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3907         debug output when command lines differ.
3908
3909 2011-07-06  Cary Coutant  <ccoutant@google.com>
3910
3911         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3912         --incremental-patch option.
3913         * layout.cc (Free_list::allocate): Extend allocation beyond original
3914         end if enabled.
3915         (Layout::make_output_section): Mark sections that should get
3916         patch space.
3917         * options.cc (parse_percent): New function.
3918         * options.h (parse_percent): New function.
3919         (DEFINE_percent): New macro.
3920         (General_options): Add --incremental-patch option.
3921         * output.cc (Output_section::Output_section): Initialize new data
3922         members.
3923         (Output_section::add_input_section): Print section name when out
3924         of patch space.
3925         (Output_section::add_output_section_data): Likewise.
3926         (Output_section::set_final_data_size): Add patch space when
3927         doing --incremental-full.
3928         (Output_section::do_reset_address_and_file_offset): Remove patch
3929         space.
3930         (Output_segment::set_section_list_addresses): Print debug output
3931         only if --incremental-update.
3932         * output.h (Output_section::set_is_patch_space_allowed): New function.
3933         (Output_section::is_patch_space_allowed_): New data member.
3934         (Output_section::patch_space_): New data member.
3935         * parameters.cc (Parameters::incremental_full): New function.
3936         * parameters.h (Parameters::incremental_full): New function
3937         * testsuite/Makefile.am (incremental_test_2): Add test for
3938         --incremental-patch option.
3939         * testsuite/Makefile.in: Regenerate.
3940         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3941         (t18): Remove function body.
3942
3943 2011-07-05  Doug Kwan  <dougkwan@google.com>
3944
3945         PR gold/12771
3946         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3947         Arm_Address type for relocation result.
3948         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3949         overflow check.
3950         (Arm_relocate_functions::abs32): Use unaligned access.
3951         (Arm_relocate_functions::rel32): Ditto.
3952         (Arm_relocate_functions::prel31): Ditto.
3953         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3954         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3955         static data relocations.
3956         * testsuite/Makefile.in: Regnerate.
3957         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3958
3959 2011-07-05  Ian Lance Taylor  <iant@google.com>
3960
3961         PR gold/12392
3962         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3963         symbols if necessary.
3964         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3965
3966 2011-07-05  Ian Lance Taylor  <iant@google.com>
3967
3968         PR gold/12952
3969         * resolve.cc (Symbol::override_base_with_special): Simply override
3970         version with special symbol version, ignoring previous version.
3971
3972 2011-07-05  Ian Lance Taylor  <iant@google.com>
3973
3974         * object.cc (Sized_relobj_file::include_section_group): Add
3975         information to comment about signature location.
3976
3977 2011-07-02  Ian Lance Taylor  <iant@google.com>
3978
3979         PR gold/12957
3980         * options.h (class General_options): Add -f and -F.
3981         * options.cc (General_options::finalize): Fatal error if -f/-F
3982         are used without -shared.
3983         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
3984
3985 2011-07-02  Ian Lance Taylor  <iant@google.com>
3986
3987         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
3988
3989 2011-07-01  Ian Lance Taylor  <iant@google.com>
3990
3991         PR gold/12525
3992         PR gold/12952
3993         * resolve.cc (Symbol::override_base_with_special): Don't override
3994         the version if the overriding symbol has a different name.
3995         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
3996         all callers.  If we give an error about an undefined version,
3997         define the base version if necessary.
3998         * dynobj.h (class Versions): Update declaration.
3999         * testsuite/weak_alias_test_5.cc: New file.
4000         * testsuite/weak_alias_test.script: New file.
4001         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4002         and versioned_alias have the right value, and call t2.
4003         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4004         weak_alias_test_5.so.
4005         (weak_alias_test_LDADD): Likewise.
4006         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4007         * testsuite/Makefile.in: Rebuild.
4008
4009 2011-07-01  Ian Lance Taylor  <iant@google.com>
4010
4011         PR gold/12525
4012         * options.h (class General_options): Support -z notext.
4013         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4014         -Wl,-z,notext.
4015         (two_file_shared_nonpic.so): Likewise.
4016         (two_file_shared_mixed.so): Likewise.
4017         (two_file_shared_mixed_1.so): Likewise.
4018         (weak_undef_lib_nonpic.so): Likewise.
4019         (alt/weak_undef_lib_nonpic.so): Likewise.
4020         (tls_test_shared_nonpic.so): Likewise.
4021         * testsuite/Makefile.in: Rebuild.
4022
4023 2011-07-01  Ian Lance Taylor  <iant@google.com>
4024
4025         PR gold/12525
4026         * configure.ac: Test whether static linking works, setting
4027         the automake conditional HAVE_STATIC.
4028         * testsuite/Makefile.am: Disable tests using -static if
4029         HAVE_STATIC is not true.
4030         * configure, testsuite/Makefile.in: Rebuild.
4031
4032 2011-07-01  Ian Lance Taylor  <iant@google.com>
4033
4034         PR gold/12525
4035         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4036         Assert if we see DW_EH_PE_indirect.
4037         * target.h (Target::ehframe_datarel_base): New function.
4038         (Target::do_ehframe_datarel_base): New target function.
4039         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4040         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4041         function.
4042
4043 2011-07-01  Ian Lance Taylor  <iant@google.com>
4044
4045         PR gold/12571
4046         * options.h (class General_options): Add
4047         --ld-generated-unwind-info.
4048         * ehframe.cc (Fde::write): Add address parameter.  Change all
4049         callers.  If associated with PLT, fill in address and size.
4050         (Cie::set_output_offset): Only add merge mapping if there is an
4051         object.
4052         (Cie::write): Add address parameter.  Change all callers.
4053         (Eh_frame::add_ehframe_for_plt): New function.
4054         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4055         input_offset_ fields into union u_, with new plt field.
4056         (Fde::Fde): Adjust for new union field.
4057         (Fde::Fde) [Output_data version]: New constructor.
4058         (Fde::add_mapping): Only add merge mapping if there is an object.
4059         (class Cie): Update declarations.
4060         (class Eh_frame): Declare add_ehframe_for_plt.
4061         * layout.cc (Layout::layout_eh_frame): Break out code into
4062         make_eh_frame_section, and call it.
4063         (Layout::make_eh_frame_section): New function.
4064         (Layout::add_eh_frame_for_plt): New function.
4065         * layout.h (class Layout): Update declarations.
4066         * merge.cc (Merge_map::add_mapping): Add assertion.
4067         * i386.cc: Include "dwarf.h".
4068         (class Output_data_plt_i386): Make first_plt_entry,
4069         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4070         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4071         and plt_eh_frame_fde.
4072         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4073         boundary.  Call add_eh_frame_for_plt if appropriate.
4074         * x86_64.cc: Include "dwarf.h".
4075         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4076         first_plt_entry, plt_entry and tlsdesc_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_x86_64::init): Call add_eh_frame_for_plt if
4080         appropriate.
4081
4082 2011-06-29  Ian Lance Taylor  <iant@google.com>
4083
4084         PR gold/12629
4085         * object.cc (Sized_relobj_file::layout_section): Change shdr
4086         parameter to be const.
4087         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4088         out of do_layout.
4089         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4090         appropriate.  Call layout_eh_frame_section.
4091         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4092         sections.
4093         * object.h (class Sized_relobj_file): Update declarations.
4094
4095 2011-06-29  Ian Lance Taylor  <iant@google.com>
4096
4097         PR gold/12652
4098         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4099         modifier.
4100         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4101
4102 2011-06-29  Ian Lance Taylor  <iant@google.com>
4103
4104         PR gold/12675
4105         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4106         SHT_X86_64_UNWIND.
4107         * layout.cc (Layout::layout_eh_frame): Likewise.
4108
4109 2011-06-29  Ian Lance Taylor  <iant@google.com>
4110
4111         PR gold/12695
4112         * layout.cc (Layout::symtab_section_shndx): New function.
4113         * layout.h (class Layout): Declare symtab_section_shndx.
4114         * output.cc (Output_section::write_header): Call it.
4115
4116 2011-06-29  Ian Lance Taylor  <iant@google.com>
4117
4118         PR gold/12818
4119         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4120         symbols which are not used in a relocation.
4121
4122 2011-06-28  Ian Lance Taylor  <iant@google.com>
4123
4124         PR gold/12898
4125         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4126         script create indistinguishable segments.
4127         (Layout::set_segment_offsets): Use stable_sort when sorting
4128         segments.  Pass this to Compare_segments constructor.
4129         * layout.h (class Layout): Make segment_precedes non-static.
4130         (class Compare_segments): Change from struct to class.  Add
4131         layout_ field.  Add constructor.
4132         * script-sections.cc
4133         (Script_sections::attach_sections_using_phdrs_clause): Rename
4134         local orphan to is_orphan.  Don't report failure to put empty
4135         section in segment.  On attachment failure, report name of
4136         section, and attach to first PT_LOAD segment.
4137
4138 2011-06-28  Ian Lance Taylor  <iant@google.com>
4139
4140         PR gold/12934
4141         * target-select.cc (Target_selector::Target_selector): Add
4142         emulation parameter.  Change all callers.
4143         (select_target_by_bfd_name): Rename from select_target_by_name.
4144         Change all callers.
4145         (select_target_by_emulation): New function.
4146         (supported_emulation_names): New function.
4147         * target-select.h (class Target_selector): Add emulation_ field.
4148         Update declarations.
4149         (Target_selector::recognize_by_bfd_name): Rename from
4150         recognize_by_name.  Change all callers.
4151         (Target_selector::supported_bfd_names): Rename from
4152         supported_names.  Change all callers.
4153         (Target_selector::recognize_by_emulation): New function.
4154         (Target_selector::supported_emulations): New function.
4155         (Target_selector::emulation): New function.
4156         (Target_selector::do_recognize_by_bfd_name): Rename from
4157         do_recognize_by_name.  Change all callers.
4158         (Target_selector::do_supported_bfd_names): Rename from
4159         do_supported_names.  Change all callers.
4160         (Target_selector::do_recognize_by_emulation): New function.
4161         (Target_selector::do_supported_emulations): New function.
4162         (select_target_by_bfd_name): Change name in declaration.
4163         (select_target_by_emulation): Declare.
4164         (supported_emulation_names): Declare.
4165         * parameters.cc (parameters_force_valid_target): Try to find
4166         target based on emulation from -m option.
4167         * options.h (class General_options): Change doc string for -m.
4168         * options.cc (help): Print emulations.
4169         (General_options::parse_V): Likewise.
4170         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4171         Add emulation parameter.  Change all callers.
4172
4173 2011-06-28  Ian Lance Taylor  <iant@google.com>
4174
4175         * target.h (class Target): Add osabi_ field.
4176         (Target::osabi): New function.
4177         (Target::set_osabi): New function.
4178         (Target::Target): Initialize osabi_.
4179         (Target::do_adjust_elf_header): Make pure virtual.
4180         (Sized_target::do_adjust_elf_header): Declare.
4181         * target.cc (Sized_target::do_adjust_elf_header): New function.
4182         (class Sized_target): Instantiate all versions.
4183         * freebsd.h (class Target_freebsd): Remove.
4184         (Target_selector_freebsd::do_recognize): Call set_osabi on
4185         Target.
4186         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4187         (Target_selector_freebsd::set_osabi): Remove.
4188         * i386.cc (class Target_i386): Inherit from Sized_target rather
4189         than Target_freebsd.
4190         * x86_64.cc (class Target_x86_64): Likewise.
4191
4192 2011-06-28  Ian Lance Taylor  <iant@google.com>
4193
4194         * target.h (Target::can_check_for_function_pointers): Rewrite.
4195         Make non-virtual.
4196         (Target::can_icf_inline_merge_sections): Likewise.
4197         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4198         (Target::Target_info): Add can_icf_inline_merge_sections field.
4199         (Target::do_can_check_for_function_pointers): New virtual
4200         function.
4201         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4202         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4203         from can_check_for_function_pointers, move in file.
4204         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4205         section_may_have_icf_unsafe_poineters, move in file.
4206         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4207         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4208         Rename from can_check_for_function_pointers, move in file.
4209         (Target_i386::can_icf_inline_merge_sections): Remove.
4210         (Target_i386::i386_info): Initialize
4211         can_icf_inline_merge_sections.
4212         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4213         Initialize can_icf_inline_merge_sections.
4214         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4215         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4216         Rename from can_check_for_function_pointers, move in file.
4217         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4218         (Target_x86_64::x86_64_info): Initialize
4219         can_icf_inline_merge_sections.
4220         * testsuite/testfile.cc (Target_test::test_target_info):
4221         Likewise.
4222         * icf.cc (get_section_contents): Correct formatting.
4223
4224 2011-06-27  Ian Lance Taylor  <iant@google.com>
4225
4226         * symtab.cc (Symbol::versioned_name): New function.
4227         (Symbol_table::add_to_final_symtab): Use versioned_name when
4228         appropriate.
4229         (Symbol_table::sized_write_symbol): Likewise.
4230         * symtab.h (class Symbol): Declare versioned_name.
4231         * stringpool.h (class Stringpool_template): Add variant of add
4232         which takes a std::basic_string.
4233         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4234         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4235         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4236         (ver_test_12.o): New target.
4237         * testsuite/Makefile.in: Rebuild.
4238
4239 2011-06-27  Doug Kwan  <dougkwan@google.com>
4240
4241         * arm.cc (Arm_relocate_functions::thm_jump8,
4242         Arm_relocate_functions::thm_jump11): Use a wider signed
4243         type to compute offset.
4244         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4245         arm_thm_jump8.
4246         * testsuite/Makefile.in: Regenerate.
4247         * testsuite/arm_branch_in_range.sh: Check test results of
4248         arm_thm_jump11 and arm_thm_jump8.
4249         * testsuite/arm_thm_jump11.s: New test source file.
4250         * testsuite/arm_thm_jump11.t: New linker script.
4251         * testsuite/arm_thm_jump8.s: New test source file.
4252         * testsuite/arm_thm_jump8.t: New linker script.
4253
4254 2011-06-24  Ian Lance Taylor  <iant@google.com>
4255
4256         * layout.cc: Include "object.h".
4257         (ctors_sections_in_init_array): New static variable.
4258         (Layout::is_ctors_in_init_array): New function.
4259         (Layout::layout): Add entry to ctors_sections_in_init_array if
4260         appropriate.
4261         * layout.h (class Layout): Declare is_ctors_in_init_array.
4262         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4263         is_ctors_reverse_view is set.
4264         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4265         all callers.  Set is_ctors_reverse_view field of View_size.
4266         (Sized_relobj_file::reverse_words): New function.
4267         * object.h (Sized_relobj_file::View_size): Add
4268         is_ctors_reverse_view field.
4269         (class Sized_relobj_file): Update declarations.
4270         * testsuite/initpri3.c: New test.
4271         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4272         initpri3b.
4273         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4274         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4275         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4276         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4277         * testsuite/Makefile.in: Rebuild.
4278
4279 2011-06-24  Cary Coutant  <ccoutant@google.com>
4280
4281         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4282         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4283         (debug_msg_cdebug.err): New targets.
4284         * testsuite/Makefile.in: Regenerate.
4285         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4286         Fix checks for link with shared library.
4287
4288 2011-06-24  Doug Kwan  <dougkwan@google.com>
4289
4290         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4291         skip empty text sections.
4292         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4293
4294 2011-06-22  Ian Lance Taylor  <iant@google.com>
4295
4296         PR gold/12910
4297         * options.h (class General_options): Add --ctors-in-init-array.
4298         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4299         friends as SHT_PROGBITS for merging sections.
4300         (Layout::layout): Remove special handling of .init_array and
4301         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4302         and .dtors if ctors_in_init_array.
4303         (Layout::make_output_section): Force correct section types for
4304         .init_array and friends.  Don't sort if doing relocatable link,
4305         Don't sort .ctors and .dtors if ctors_in_init_array.
4306         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4307         (Layout::output_section_name): Add relobj parameter.  Change all
4308         callers.  Handle .ctors. and .dtors. in code rather than table.
4309         Handle .ctors and .dtors if ctors_in_init_array.
4310         (Layout::match_file_name): New function, moved from output.cc.
4311         * layout.h (class Layout): Update declarations.
4312         * output.cc: Include "layout.h".
4313         (Input_section_sort_entry::get_priority): New function.
4314         (Input_section_sort_entry::match_file_name): Just call
4315         Layout::match_file_name.
4316         (Output_section::Input_section_sort_init_fini_compare::operator()):
4317         Handle .ctors and .dtors.  Sort by explicit priority rather than
4318         by name.
4319         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4320         * testsuite/initpri2.c: New test.
4321         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4322         (check_PROGRAMS): Add initpri2.
4323         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4324         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4325         * configure, testsuite/Makefile.in: Rebuild.
4326
4327 2011-06-19  Ian Lance Taylor  <iant@google.com>
4328
4329         PR gold/12880
4330         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4331         .interp section to a PT_INTERP segment even if we have seen a
4332         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4333         clause in a linker script.
4334         (Layout::finalize): Don't create a .interp section if we've
4335         already create a PT_INTERP segment.
4336         (Layout::create_interp): Always call choose_output_section (revert
4337         patch of 2011-06-17).  Don't create PT_INTERP segment.
4338         * script-sections.cc
4339         (Script_sections::create_note_and_tls_segments): Add a .interp
4340         section to a PT_INTERP segment even if we have seen a
4341         --dynamic-linker option.
4342
4343 2011-06-18  Ian Lance Taylor  <iant@google.com>
4344
4345         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4346         merely because a non-PT_LOAD segment has a dynamic reloc.
4347
4348 2011-06-18  Ian Lance Taylor  <iant@google.com>
4349
4350         * layout.cc (Layout::finish_dynamic_section): Don't create
4351         DT_FLAGS entry if not needed.
4352
4353 2011-06-18  Ian Lance Taylor  <iant@google.com>
4354
4355         PR gold/12745
4356         * layout.cc (Layout::layout_eh_frame): Correct handling of
4357         writable .eh_frame section.
4358
4359 2011-06-17  Ian Lance Taylor  <iant@google.com>
4360
4361         PR gold/12893
4362         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4363         symbol is redefined with the exact same object and value.
4364
4365 2011-06-17  Ian Lance Taylor  <iant@google.com>
4366
4367         PR gold/12880
4368         * layout.h (class Layout): Add interp_segment_ field.
4369         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4370         (Layout::attach_allocated_section_to_segment): If making shared
4371         library, put .interp section in PT_INTERP segment.
4372         (Layout::finalize): Also call create_interp if -dynamic-linker
4373         option was used.
4374         (Layout::create_interp): Assert that there is no PT_INTERP
4375         segment.  If not using a SECTIONS clause, use make_output_section.
4376         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4377         * script-sections.cc
4378         (Script_sections::create_note_and_tls_segments): If making shared
4379         library, put .interp section in PT_INTERP segment.
4380
4381 2011-06-17  Ian Lance Taylor  <iant@google.com>
4382
4383         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4384         when making a shared library.
4385
4386 2011-06-17  Ian Lance Taylor  <iant@google.com>
4387
4388         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4389         parameter.  Change all callers.  Don't issue warning about PC32
4390         against locally defined symbol.
4391
4392 2011-06-16  Ian Lance Taylor  <iant@google.com>
4393
4394         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4395         occurs in same object.
4396
4397 2011-06-14  Alan Modra  <amodra@gmail.com>
4398
4399         * po/POTFILES.in: Regenerate.
4400
4401 2011-06-09  Ian Lance Taylor  <iant@google.com>
4402
4403         * script-sections.cc
4404         (Orphan_output_section::set_section_addresses): For a relocatable
4405         link set address to 0.
4406
4407 2011-06-09  Cary Coutant  <ccoutant@google.com>
4408
4409         PR gold/12804
4410         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4411         used with --compress-debug-sections.
4412         * gold/object.cc (Sized_relobj_file::do_layout): Report
4413         uncompressed size of compressed input sections.
4414
4415 2011-06-08  Cary Coutant  <ccoutant@google.com>
4416
4417         PR gold/12804
4418         * testsuite/two_file_test_2_v1.cc: Change initialization of
4419         v2 to keep it in .data.
4420
4421 2011-06-07  Cary Coutant  <ccoutant@google.com>
4422
4423         * common.cc (Symbol_table::do_allocate_commons_list): Call
4424         gold_fallback.
4425         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4426         (Errors::fallback): New function.
4427         (gold_fallback): New function.
4428         * errors.h (Errors::fallback): New function.
4429         * gold.cc (gold_exit): Change status parameter to enum; adjust
4430         all callers.
4431         (queue_initial_tasks): Call gold_fallback.
4432         * gold.h: Include cstdlib.
4433         (Exit_status): New enum type.
4434         (gold_exit): Change status parameter to enum.
4435         (gold_fallback): New function.
4436         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4437         (Layout::create_symtab_sections): Likewise.
4438         (Layout::create_shdrs): Likewise.
4439         * main.cc (main): Adjust call to gold_exit.
4440         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4441         (Output_data_got::add_got_entry_pair): Likewise.
4442         (Output_section::add_input_section): Likewise.
4443         (Output_section::add_output_section_data): Likewise.
4444         (Output_segment::set_section_list_addresses): Likewise.
4445         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4446
4447 2011-06-07  Cary Coutant  <ccoutant@google.com>
4448
4449         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4450         for incremental links.
4451         * output.cc (Output_segment::set_section_list_addresses): Remove
4452         FIXME and test for TLS or BSS.
4453
4454 2011-06-07  Cary Coutant  <ccoutant@google.com>
4455
4456         * testsuite/Makefile.am: Add incremental_copy_test,
4457         incremental_common_test_1.
4458         * testsuite/Makefile.in: Regenerate.
4459         * testsuite/common_test_1_v1.c: New source file.
4460         * testsuite/common_test_1_v2.c: New source file.
4461         * testsuite/copy_test_v1.cc: New source file.
4462
4463 2011-06-07  Cary Coutant  <ccoutant@google.com>
4464
4465         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4466         update, allocate common from bss section's free list.
4467         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4468         linker-defined symbols.
4469         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4470         Skip GOT and PLT entries that are no longer referenced.
4471         (Output_section_incremental_inputs::write_info_blocks): Mark
4472         linker-defined symbols.
4473         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4474         * output.cc (Output_section::allocate): New function.
4475         * output.h (Output_section::allocate): New function.
4476         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4477         linker-defined symbols.
4478         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4479         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4480         (Symbol::init_base_output_data): Likewise.
4481         (Symbol::init_base_output_segment): Likewise.
4482         (Symbol::init_base_constant): Likewise.
4483         (Sized_symbol::init_output_data): Likewise.
4484         (Sized_symbol::init_output_segment): Likewise.
4485         (Sized_symbol::init_constant): Likewise.
4486         (Symbol_table::do_define_in_output_data): Likewise.
4487         (Symbol_table::do_define_in_output_segment): Likewise.
4488         (Symbol_table::do_define_as_constant): Likewise.
4489         * symtab.h (Symbol::is_predefined): New function.
4490         (Symbol::init_base_output_data): Add is_predefined parameter.
4491         (Symbol::init_base_output_segment): Likewise.
4492         (Symbol::init_base_constant): Likewise.
4493         (Symbol::is_predefined_): New data member.
4494         (Sized_symbol::init_output_data): Add is_predefined parameter.
4495         (Sized_symbol::init_output_segment): Likewise.
4496         (Sized_symbol::init_constant): Likewise.
4497         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4498
4499 2011-06-07  Cary Coutant  <ccoutant@google.com>
4500
4501         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4502         instead of emit_copy_reloc.
4503         (Copy_relocs::emit_copy_reloc): Refactor.
4504         (Copy_relocs::make_copy_reloc): New function.
4505         (Copy_relocs::add_copy_reloc): Remove.
4506         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4507         section.
4508         (Copy_relocs::make_copy_reloc): New function.
4509         (Copy_relocs::add_copy_reloc): Remove.
4510         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4511         unchanged input files.
4512         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4513         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4514         Reserve BSS space for COPY relocations.
4515         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4516         (Output_section_incremental_inputs::write_info_blocks): Record
4517         whether a symbol is copied from a shared object.
4518         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4519         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4520         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4521         (Incremental_input_entry_reader::get_output_symbol_index): Add
4522         is_copy parameter.
4523         (Incremental_binary::emit_copy_relocs): New function.
4524         (Incremental_binary::do_emit_copy_relocs): New function.
4525         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4526         new data member.
4527         (Sized_incremental_binary::add_copy_reloc): New function.
4528         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4529         (Sized_incremental_binary::Copy_reloc): New struct.
4530         (Sized_incremental_binary::Copy_relocs): New typedef.
4531         (Sized_incremental_binary::copy_relocs_): New data member.
4532         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4533         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4534         * target.h (Sized_target::emit_copy_reloc): New function.
4535         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4536
4537 2011-06-02  Cary Coutant  <ccoutant@google.com>
4538
4539         PR gold/12163
4540         * gold/archive.cc (Archive::Archive): Initialize new data member.
4541         (Archive::include_all_members): Return if archive has already been
4542         included.
4543         * gold/archive.h (Archive::include_all_members_): New data member.
4544
4545 2011-06-02  Nick Clifton  <nickc@redhat.com>
4546
4547         * dynobj.h: Fix spelling mistake in comment.
4548         * output.cc: Likewise.
4549
4550 2011-05-31  Doug Kwan  <dougkwan@google.com>
4551             Asier Llano
4552
4553         PR gold/12826
4554         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4555         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4556         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4557         redundant arm_exidx_test.so.
4558         * testsuite/Makefile.in: Regenerate.
4559         (check_SCRIPTS): Add pr12826.sh
4560         (check_DATA): Add pr12826.stdout
4561         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4562         * testsuite/pr12826.sh: New file.
4563         * testsuite/pr12826_1.s: Ditto.
4564         * testsuite/pr12826_1.s: Ditto.
4565
4566 2011-05-30  Ian Lance Taylor  <iant@google.com>
4567
4568         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4569         sections.
4570
4571 2011-05-29  Ian Lance Taylor  <iant@google.com>
4572
4573         PR gold/12804
4574         * testsuite/Makefile.am: Use different file name for two_file_test
4575         temporary file for each incremental test.
4576         * testsuite/Makefile.in: Rebuild.
4577
4578 2011-05-29  Ian Lance Taylor  <iant@google.com>
4579
4580         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4581         binary input file is empty.
4582
4583 2011-05-27  Ian Lance Taylor  <iant@google.com>
4584
4585         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4586         (ver_test_9.so): Likewise.
4587         * testsuite/Makefile.in: Rebuild.
4588
4589 2011-05-26 Cary Coutant  <ccoutant@google.com>
4590
4591         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4592         * incremental.cc (Incremental_inputs::report_input_section): Fix
4593         comment, indentation.
4594         (Incremental_inputs::report_comdat_group): New function.
4595         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4596         of data for incremental input file entry.
4597         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4598         group count, COMDAT group signatures.
4599         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4600         an unchanged input file.
4601         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4602         Initialize new data member.
4603         (Incremental_object_entry::add_comdat_group): New function.
4604         (Incremental_object_entry::get_comdat_group_count): New function.
4605         (Incremental_object_entry::get_comdat_signature_key): New function.
4606         (Incremental_object_entry::groups_): New data member.
4607         (Incremental_inputs::report_comdat_group): New function.
4608         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4609         data for incremental input file entry.
4610         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4611         (Incremental_input_entry_reader::get_input_section): Adjust size of
4612         data for incremental input file entry.
4613         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4614         (Incremental_input_entry_reader::get_comdat_group_signature): New
4615         function.
4616         * object.cc (Sized_relobj::include_section_group): Report kept
4617         COMDAT groups for incremental links.
4618
4619 2011-05-24  David Meyer  <pdox@google.com>
4620
4621         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4622         with name parameter.  Add found_name parameter.
4623         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4624         * dirsearch.h (class Dirsearch): Update declaration.
4625
4626 2011-05-24  Ian Lance Taylor  <iant@google.com>
4627
4628         * archive.cc (Library_base::should_include_member): Pull in object
4629         from archive if it defines the entry symbol.
4630         * parameters.cc (Parameters::entry): New function.
4631         * parameters.h (class Parameters): Declare entry.
4632         * output.h (class Output_file_header): Remove entry_ field.
4633         * output.cc (Output_file_header::Output_file_header): Remove entry
4634         parameter.  Change all callers.
4635         (Output_file_header::entry): Use parameters->entry.
4636         * gold.cc (queue_middle_tasks): Likewise.
4637         * plugin.cc (Plugin_hook::run): Likewise.
4638
4639 2011-05-24 Cary Coutant  <ccoutant@google.com>
4640
4641         * gold.cc (queue_initial_tasks): Pass incremental base filename
4642         to Output_file::open_base_file; don't print error message.
4643         * incremental-dump.cc (main): Adjust call to
4644         Output_file::open_for_modification.
4645         * incremental-dump.cc (main): Likewise.
4646         * incremental.cc (Incremental_inputs::report_command_line):
4647         Ignore --incremental-base option when comparing command lines.
4648         Ignore parameter when given as separate argument.
4649         * options.h (class General_options): Add --incremental-base.
4650         * output.cc (Output_file::Output_file):
4651         (Output_file::open_base_file): Add base_name and writable parameters;
4652         read base file into new file; print error message here.
4653         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4654         callers.
4655         * output.h (Output_file::open_for_modification): Rename to...
4656         (Output_file::open_base_file): ...this; add base_name and
4657         writable parameters; adjust all callers.
4658         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4659         callers.
4660         * testsuite/Makefile.am (incremental_test_4): Test
4661         --incremental-base.
4662         * testsuite/Makefile.in: Regenerate.
4663
4664 2011-05-24 Cary Coutant  <ccoutant@google.com>
4665
4666         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4667         incremental_test_4.
4668         * testsuite/Makefile.in: Regenerate.
4669         * testsuite/two_file_test_1_v1.cc: New test source file.
4670         * testsuite/two_file_test_1b_v1.cc: New test source file.
4671         * testsuite/two_file_test_2_v1.cc: New test source file.
4672
4673 2011-05-24 Cary Coutant  <ccoutant@google.com>
4674
4675         * dynobj.h (Dynobj::do_dynobj): New function.
4676         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4677         flag and soname for shared objects.
4678         * incremental.cc (Incremental_inputs::report_object): Make
4679         either Incremental_object_entry or Incremental_dynobj_entry; add
4680         soname to string table.
4681         (Incremental_inputs::report_input_section): Add assertion.
4682         (Output_section_incremental_inputs::set_final_data_size): Adjust
4683         type of input file entry for shared libraries; adjust size of
4684         shared library info entry.
4685         (Output_section_incremental_inputs::write_input_files): Write
4686         as_needed flag for shared libraries.
4687         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4688         of input file entry for shared libraries; write soname.
4689         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4690         soname from incremental info.
4691         * incremental.h (enum Incremental_input_flags): Add
4692         INCREMENTAL_INPUT_AS_NEEDED.
4693         (Incremental_input_entry::Incremental_input_entry): Initialize new
4694         data member.
4695         (Incremental_input_entry::set_as_needed): New function.
4696         (Incremental_input_entry::as_needed): New function.
4697         (Incremental_input_entry::do_dynobj_entry): New function.
4698         (Incremental_input_entry::as_needed_): New data member.
4699         (Incremental_object_entry::Incremental_object_entry): Don't check
4700         for shared library.
4701         (Incremental_object_entry::do_type): Likewise.
4702         (class Incremental_dynobj_entry): New class.
4703         (Incremental_input_entry_reader::as_needed): New function.
4704         (Incremental_input_entry_reader::get_soname): New function.
4705         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4706         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4707         size of shared library info entry.
4708         * layout.cc (Layout::finish_dynamic_section): Don't test for
4709         incremental link when adding DT_NEEDED entries.
4710         * object.h (Object::Object): Initialize new data member.
4711         (Object::dynobj): New function.
4712         (Object::set_as_needed): New function.
4713         (Object::as_needed): New function.
4714         (Object::do_dynobj): New function.
4715         (Object::as_needed_): New data member.
4716
4717 2011-05-24 Cary Coutant  <ccoutant@google.com>
4718
4719         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4720         info; adjust display of GOT entries.
4721         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4722         vector of input objects; remove file_status_.
4723         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4724         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4725         got_plt reader; call target hooks to reserve GOT entries.
4726         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4727         of input file info header and GOT info entry.
4728         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4729         relocation info.
4730         (Got_plt_view_info::got_descriptor): Remove.
4731         (Got_plt_view_info::sym_index): New data member.
4732         (Got_plt_view_info::input_index): New data member.
4733         (Local_got_offset_visitor::visit): Write input file index.
4734         (Global_got_offset_visitor::visit): Write 0 for input file index.
4735         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4736         with sym_index and input_index.
4737         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4738         incremental info GOT entry; replace got_descriptor with input_index.
4739         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4740         map from input file index to object.
4741         (Sized_relobj_incr::do_layout): Replace direct data member reference
4742         with accessor function.
4743         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4744         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4745         Adjust size of input file info header.
4746         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4747         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4748         (Incremental_input_entry_reader::get_input_section): Adjust size of
4749         input file info header.
4750         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4751         of incremental info GOT entry.
4752         (Incremental_got_plt_reader::get_got_desc): Remove.
4753         (Incremental_got_plt_reader::get_got_symndx): New function.
4754         (Incremental_got_plt_reader::get_got_input_index): New function.
4755         (Sized_incremental_binary::Sized_incremental_binary): Remove
4756         file_status_; add input_objects_.
4757         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4758         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4759         (Sized_incremental_binary::file_is_unchanged): Remove.
4760         (Sized_incremental_binary::set_input_object): New function.
4761         (Sized_incremental_binary::input_object): New function.
4762         (Sized_incremental_binary::file_status_): Remove.
4763         (Sized_incremental_binary::input_objects_): New data member.
4764         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4765         references.
4766         (Sized_relobj_incr::invalid_address): Move to base class.
4767         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4768         class.
4769         (Sized_relobj_incr::do_output_section_offset): Likewise.
4770         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4771         (Sized_relobj_incr::section_offsets_): Likewise.
4772         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4773         function.
4774         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4775         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4776         with accessor function.
4777         (Sized_relobj_file::do_layout): Likewise.
4778         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4779         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4780         (Sized_relobj_file::compute_final_local_value): Replace refs to
4781         section_offsets_ with accessor function.
4782         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4783         * object.h (Relobj::Relobj): Initialize new data members.
4784         (Relobj::add_dyn_reloc): New function.
4785         (Relobj::first_dyn_reloc): New function.
4786         (Relobj::dyn_reloc_count): New function.
4787         (Relobj::first_dyn_reloc_): New data member.
4788         (Relobj::dyn_reloc_count_): New data member.
4789         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4790         references.
4791         (Sized_relobj::Address): New typedef.
4792         (Sized_relobj::invalid_address): Move here from child class.
4793         (Sized_relobj::Sized_relobj): Initialize new data members.
4794         (Sized_relobj::sized_relobj): New function.
4795         (Sized_relobj::is_output_section_offset_invalid): Move here from
4796         child class.
4797         (Sized_relobj::get_output_section_offset): Likewise.
4798         (Sized_relobj::local_has_got_offset): Likewise.
4799         (Sized_relobj::local_got_offset): Likewise.
4800         (Sized_relobj::set_local_got_offset): Likewise.
4801         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4802         (Sized_relobj::clear_got_offsets): New function.
4803         (Sized_relobj::section_offsets): Move here from child class.
4804         (Sized_relobj::do_output_section_offset): Likewise.
4805         (Sized_relobj::do_set_section_offset): Likewise.
4806         (Sized_relobj::Local_got_offsets): Likewise.
4807         (Sized_relobj::local_got_offsets_): Likewise.
4808         (Sized_relobj::section_offsets_): Likewise.
4809         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4810         references.
4811         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4812         class.
4813         (Sized_relobj_file::sized_relobj): New function
4814         (Sized_relobj_file::local_has_got_offset): Move to base class.
4815         (Sized_relobj_file::local_got_offset): Likewise.
4816         (Sized_relobj_file::set_local_got_offset): Likewise.
4817         (Sized_relobj_file::get_output_section_offset): Likewise.
4818         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4819         (Sized_relobj_file::do_output_section_offset): Likewise.
4820         (Sized_relobj_file::do_set_section_offset): Likewise.
4821         (Sized_relobj_file::Local_got_offsets): Likewise.
4822         (Sized_relobj_file::local_got_offsets_): Likewise.
4823         (Sized_relobj_file::section_offsets_): Likewise.
4824         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4825         (all constructors).
4826         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4827         (Output_reloc::get_symbol_index): Likewise.
4828         (Output_reloc::local_section_offset): Likewise.
4829         (Output_reloc::get_address): Likewise.
4830         (Output_reloc::symbol_value): Likewise.
4831         (Output_data_got::reserve_slot): Move to class definition.
4832         (Output_data_got::reserve_local): New function.
4833         (Output_data_got::reserve_slot_for_global): Remove.
4834         (Output_data_got::reserve_global): New function.
4835         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4836         (all constructors, two instantiations).
4837         (Output_reloc::get_relobj): New function (two instantiations).
4838         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4839         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4840         (Output_data_reloc::add_global): Adjust type of relobj.
4841         (Output_data_reloc::add_global_relative): Likewise.
4842         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4843         (Output_data_reloc::add_local): Likewise.
4844         (Output_data_reloc::add_local_relative): Likewise.
4845         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4846         (Output_data_reloc::add_local_section): Likewise.
4847         (Output_data_reloc::add_output_section): Likewise.
4848         (Output_data_reloc::add_absolute): Likewise.
4849         (Output_data_reloc::add_target_specific): Likewise.
4850         (Output_data_got::reserve_slot): Move definition here.
4851         (Output_data_got::reserve_local): New function.
4852         (Output_data_got::reserve_global): New function.
4853         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4854         section_offsets_ with accessor function.
4855         (Sized_relobj_file::write_sections): Likewise.
4856         (Sized_relobj_file::do_relocate_sections): Likewise.
4857         * target.h (Sized_target::reserve_local_got_entry): New function.
4858         (Sized_target::reserve_global_got_entry): New function.
4859         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4860         (Target_x86_64::reserve_global_got_entry): New function.
4861         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4862
4863 2011-05-23 Cary Coutant  <ccoutant@google.com>
4864
4865         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4866         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4867         bit when checking got_type.
4868         * incremental.cc (Sized_incremental_binary::setup_readers):
4869         Store symbol table and string table locations; initialize bit vector
4870         of file status flags.
4871         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4872         unchanged files.
4873         (Sized_incremental_binary::do_process_got_plt): New function.
4874         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4875         (Output_section_incremental_inputs::set_final_data_size): Record
4876         file index for each input file.
4877         (Output_section_incremental_inputs::write_got_plt): Store file index
4878         instead of input entry offset for each GOT entry.
4879         * incremental.h
4880         (Incremental_input_entry::Incremental_input_entry): Initialize new
4881         data member.
4882         (Incremental_input_entry::set_offset): Store file index.
4883         (Incremental_input_entry::get_file_index): New function.
4884         (Incremental_input_entry::file_index_): New data member.
4885         (Incremental_binary::process_got_plt): New function.
4886         (Incremental_binary::do_process_got_plt): New function.
4887         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4888         data members.
4889         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4890         (Sized_incremental_binary::set_file_is_unchanged): New function.
4891         (Sized_incremental_binary::file_is_unchanged): New function.
4892         (Sized_incremental_binary::do_process_got_plt): New function.
4893         (Sized_incremental_binary::file_status_): New data member.
4894         (Sized_incremental_binary::main_symtab_loc_): New data member.
4895         (Sized_incremental_binary::main_strtab_loc_): New data member.
4896         * output.cc (Output_data_got::Got_entry::write): Add case
4897         RESERVED_CODE.
4898         (Output_data_got::add_global): Call add_got_entry.
4899         (Output_data_got::add_global_plt): Likewise.
4900         (Output_data_got::add_global_with_rel): Likewise.
4901         (Output_data_got::add_global_with_rela): Likewise.
4902         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4903         (Output_data_got::add_global_pair_with_rela): Likewise.
4904         (Output_data_got::add_local): Call add_got_entry.
4905         (Output_data_got::add_local_plt): Likewise.
4906         (Output_data_got::add_local_with_rel): Likewise.
4907         (Output_data_got::add_local_with_rela): Likewise.
4908         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4909         (Output_data_got::add_local_pair_with_rela): Likewise.
4910         (Output_data_got::reserve_slot): New function.
4911         (Output_data_got::reserve_slot_for_global): New function.
4912         (Output_data_got::add_got_entry): New function.
4913         (Output_data_got::add_got_entry_pair): New function.
4914         (Output_section::add_output_section_data): Edit FIXME.
4915         * output.h
4916         (Output_section_data_build::Output_section_data_build): New
4917         constructor with size parameter.
4918         (Output_data_space::Output_data_space): Likewise.
4919         (Output_data_got::Output_data_got): Initialize new data member; new
4920         constructor with size parameter.
4921         (Output_data_got::add_constant): Call add_got_entry.
4922         (Output_data_got::reserve_slot): New function.
4923         (Output_data_got::reserve_slot_for_global): New function.
4924         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4925         (Output_data_got::add_got_entry): New function.
4926         (Output_data_got::add_got_entry_pair): New function.
4927         (Output_data_got::free_list_): New data member.
4928         * target.h (Sized_target::init_got_plt_for_update): New function.
4929         (Sized_target::register_global_plt_entry): New function.
4930         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4931         Initialize new data member; call init; add constructor with PLT count.
4932         (Output_data_plt_x86_64::init): New function.
4933         (Output_data_plt_x86_64::add_relocation): New function.
4934         (Output_data_plt_x86_64::reserve_slot): New function.
4935         (Output_data_plt_x86_64::free_list_): New data member.
4936         (Target_x86_64::init_got_plt_for_update): New function.
4937         (Target_x86_64::register_global_plt_entry): New function.
4938         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4939         incremental updates.
4940         (Output_data_plt_x86_64::add_relocation): New function.
4941         * testsuite/object_unittest.cc (Object_test): Set default options.
4942
4943 2011-05-16  Ian Lance Taylor  <iant@google.com>
4944
4945         * options.h (class General_options): Make -i a synonym for -r.
4946
4947 2011-05-16  Ian Lance Taylor  <iant@google.com>
4948
4949         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4950
4951 2011-05-10 Cary Coutant  <ccoutant@google.com>
4952
4953         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4954         strip_all (-s).
4955
4956 2011-05-06  Ian Lance Taylor  <iant@google.com>
4957
4958         * layout.cc (Layout::layout): If the output section flags change,
4959         update the ordering.
4960
4961 2011-04-25 Cary Coutant  <ccoutant@google.com>
4962
4963         * incremental-dump.cc (dump_incremental_inputs): Print local
4964         symbol info for each input file.
4965         * incremental.cc
4966         (Output_section_incremental_inputs::set_final_data_size): Add local
4967         symbol info to input file entries in incremental info.
4968         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4969         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4970         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4971         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4972         implementation.
4973         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4974         (Sized_incr_relobj::do_relocate): Write the local symbols.
4975         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4976         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4977         Adjust size of input file header.
4978         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4979         (Incremental_inputs_reader::get_local_symbol_count): New function.
4980         (Incremental_inputs_reader::get_input_section): Adjust size of input
4981         file header.
4982         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
4983         (Sized_incr_relobj::This): New typedef.
4984         (Sized_incr_relobj::sym_size): New const data member.
4985         (Sized_incr_relobj::Local_symbol): New struct.
4986         (Sized_incr_relobj::do_output_local_symbol_count): New function.
4987         (Sized_incr_relobj::do_local_symbol_offset): New function.
4988         (Sized_incr_relobj::local_symbol_count_): New data member.
4989         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
4990         (Sized_incr_relobj::local_symbol_index_): New data member.
4991         (Sized_incr_relobj::local_symbol_offset_): New data member.
4992         (Sized_incr_relobj::local_dynsym_offset_): New data member.
4993         (Sized_incr_relobj::local_symbols_): New data member.
4994         * object.h (Relobj::output_local_symbol_count): New function.
4995         (Relobj::local_symbol_offset): New function.
4996         (Relobj::do_output_local_symbol_count): New function.
4997         (Relobj::do_local_symbol_offset): New function.
4998         (Sized_relobj::do_output_local_symbol_count): New function.
4999         (Sized_relobj::do_local_symbol_offset): New function.
5000
5001 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5002
5003         * descriptors.cc (set_close_on_exec): New function.
5004         (Descriptors::open): Use set_close_on_exec.
5005         * output.cc (S_ISLNK): Define if not defined.
5006
5007 2011-04-22 Cary Coutant  <ccoutant@google.com>
5008
5009         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5010         global symbol map.
5011         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5012         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5013         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5014         relocations.
5015         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5016         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5017         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5018         * incremental.h
5019         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5020         function.
5021         (Incremental_binary::apply_incremental_relocs): New function.
5022         (Incremental_binary::do_apply_incremental_relocs): New function.
5023         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5024         data member.
5025         (Sized_incremental_binary::add_global_symbol): New function.
5026         (Sized_incremental_binary::global_symbol): New function.
5027         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5028         (Sized_incremental_binary::symbol_map_): New data member.
5029         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5030         * target.h (Sized_target::apply_relocation): New function.
5031         * target-reloc.h (apply_relocation): New function.
5032         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5033
5034 2011-04-22  Doug Kwan  <dougkwan@google.com>
5035
5036         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5037         flag of a SHT_ARM_EXIDX section.
5038         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5039         * testsuite/Makefile.in: Regenerate.
5040         * testsuite/arm_exidx_test.s: New file.
5041         * testsuite/arm_exidx_test.sh: Same.
5042
5043 2011-04-20 Cary Coutant  <ccoutant@google.com>
5044
5045         PR gold/12689
5046         * archive.h (Incremental_archive_entry::Archive_member):
5047         Initialize arg_serial_ (second constructor).
5048
5049 2011-04-17  Ian Lance Taylor  <iant@google.com>
5050
5051         * object.cc (Relocate_info::location): Simplify location string.
5052         * errors.cc (Errors::error_at_location): Don't print program
5053         name.
5054         (Errors::warning_at_location): Likewise.
5055         (Errors::undefined_symbol): Likewise.
5056         * testsuite/debug_msg.sh: Update accordingly.
5057
5058 2011-04-14 Cary Coutant  <ccoutant@google.com>
5059
5060         * gold/layout.cc (Layout::symtab_section_offset): New function.
5061         * gold/layout.h (Layout::symtab_section_offset): New function.
5062         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5063
5064 2011-04-12  Ian Lance Taylor  <iant@google.com>
5065
5066         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5067         with MREMAP_MAYMOVE.
5068         * output.h (class Output_file): Add map_is_allocated_ field.
5069         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5070         not available, provide stubs.  If mremap is not available, #define
5071         it to gold_mremap.
5072         (MREMAP_MAYMOVE): Define if not defined.
5073         (Output_file::Output_file): Initialize map_is_allocated_.
5074         (Output_file::resize): Check map_is_allocated_.
5075         (Output_file::map_anonymous): If mmap fails, use malloc.
5076         (Output_file::unmap): Don't do anything for an anonymous map.
5077         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5078         is not available, provide stubs.
5079         (File_read::View::~View): Use free rather than delete[].
5080         (File_read::make_view): Use malloc rather than new[].  If mmap
5081         fails, use malloc.
5082         (File_read::find_or_make_view): Use malloc rather than new[].
5083         * gold.h: Remove HAVE_REMAP code.
5084         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5085         exists.  Rename mremap to gold_mremap.  If mmap is not available
5086         don't do anything.
5087         * configure, config.in: Rebuild.
5088
5089 2011-04-11  Ian Lance Taylor  <iant@google.com>
5090
5091         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5092         initialize local variable v.
5093
5094 2011-04-11  Cary Coutant  <ccoutant@google.com>
5095
5096         * archive.cc (Archive::include_member): Adjust call to
5097         report_object.
5098         (Add_archive_symbols::run): Track argument serial numbers.
5099         (Lib_group::include_member): Likewise.
5100         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5101         * archive.h (Incremental_archive_entry::Archive_member):
5102         Initialize arg_serial_.
5103         (Archive_member::arg_serial_): New data member.
5104         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5105         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5106         incremental link.
5107         (Sized_dynobj::do_for_all_local_got_entries): New function.
5108         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5109         function.
5110         * fileread.cc (get_mtime): New function.
5111         * fileread.h (get_mtime): New function.
5112         * gold.cc (queue_initial_tasks): Check for incremental update.
5113         (process_incremental_input): New function.
5114         (queue_middle_tasks): Don't force valid target for incremental
5115         update.
5116         * incremental-dump.cc (find_input_containing_global): Adjust
5117         size of symbol info entry.
5118         (dump_incremental_inputs): Dump argument serial number and
5119         in_system_directory flag; bias shndx by 1; print symbol names
5120         when dumping per-file symbol lists; use new symbol info readers.
5121         * incremental.cc
5122         (Output_section_incremental_inputs:update_data_size): New function.
5123         (Sized_incremental_binary::setup_readers): Setup input readers
5124         for each input file; build maps for files added from libraries
5125         and scripts.
5126         (Sized_incremental_binary::check_input_args): New function.
5127         (Sized_incremental_binary::do_check_inputs): Build map of argument
5128         serial numbers to input arguments.
5129         (Sized_incremental_binary::do_file_has_changed): Rename
5130         do_file_is_unchanged to this; compare file modification times.
5131         (Sized_incremental_binary::do_init_layout): New function.
5132         (Sized_incremental_binary::do_reserve_layout): New function.
5133         (Sized_incremental_binary::do_get_input_reader): Remove.
5134         (Sized_incremental_binary::get_symtab_view): New function.
5135         (Incremental_checker::can_incrementally_link_output_file): Remove.
5136         (Incremental_inputs::report_command_line): Exclude --debug options.
5137         (Incremental_inputs::report_archive_begin): Add parameter; track
5138         argument serial numbers; don't put input file entry for archive
5139         before archive members.
5140         (Incremental_inputs::report_archive_end): Put input file entry
5141         for archive after archive members.
5142         (Incremental_inputs::report_object): Add parameter; track argument
5143         serial numbers and in_system_directory flag.
5144         (Incremental_inputs::report_script): Add parameter; track argument
5145         serial numbers.
5146         (Output_section_incremental_inputs::set_final_data_size): Adjust
5147         size of symbol info entry; check for forwarding symbols.
5148         (Output_section_incremental_inputs::write_input_files): Write
5149         in_system_directory flag and argument serial number.
5150         (Output_section_incremental_inputs::write_info_blocks): Map section
5151         indices between incremental info and original input file; store
5152         input section index for each symbol.
5153         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5154         change operator() to visit().
5155         (class Global_got_offset_visitor): Likewise.
5156         (class Global_symbol_visitor_got_plt):
5157         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5158         classes.
5159         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5160         (Sized_incr_relobj::do_read_symbols): New function.
5161         (Sized_incr_relobj::do_layout): New function.
5162         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5163         (Sized_incr_relobj::do_add_symbols): New function.
5164         (Sized_incr_relobj::do_should_include_member): New function.
5165         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5166         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5167         (Sized_incr_relobj::do_section_size): New function.
5168         (Sized_incr_relobj::do_section_name): New function.
5169         (Sized_incr_relobj::do_section_contents): New function.
5170         (Sized_incr_relobj::do_section_flags): New function.
5171         (Sized_incr_relobj::do_section_entsize): New function.
5172         (Sized_incr_relobj::do_section_address): New function.
5173         (Sized_incr_relobj::do_section_type): New function.
5174         (Sized_incr_relobj::do_section_link): New function.
5175         (Sized_incr_relobj::do_section_info): New function.
5176         (Sized_incr_relobj::do_section_addralign): New function.
5177         (Sized_incr_relobj::do_initialize_xindex): New function.
5178         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5179         (Sized_incr_relobj::do_read_relocs): New function.
5180         (Sized_incr_relobj::do_gc_process_relocs): New function.
5181         (Sized_incr_relobj::do_scan_relocs): New function.
5182         (Sized_incr_relobj::do_count_local_symbols): New function.
5183         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5184         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5185         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5186         (Sized_incr_relobj::do_relocate): New function.
5187         (Sized_incr_relobj::do_set_section_offset): New function.
5188         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5189         (Sized_incr_dynobj::do_read_symbols): New function.
5190         (Sized_incr_dynobj::do_layout): New function.
5191         (Sized_incr_dynobj::do_add_symbols): New function.
5192         (Sized_incr_dynobj::do_should_include_member): New function.
5193         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5194         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5195         (Sized_incr_dynobj::do_section_size): New function.
5196         (Sized_incr_dynobj::do_section_name): New function.
5197         (Sized_incr_dynobj::do_section_contents): New function.
5198         (Sized_incr_dynobj::do_section_flags): New function.
5199         (Sized_incr_dynobj::do_section_entsize): New function.
5200         (Sized_incr_dynobj::do_section_address): New function.
5201         (Sized_incr_dynobj::do_section_type): New function.
5202         (Sized_incr_dynobj::do_section_link): New function.
5203         (Sized_incr_dynobj::do_section_info): New function.
5204         (Sized_incr_dynobj::do_section_addralign): New function.
5205         (Sized_incr_dynobj::do_initialize_xindex): New function.
5206         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5207         (make_sized_incremental_object): New function.
5208         (Incremental_library::copy_unused_symbols): New function.
5209         (Incremental_library::do_for_all_unused_symbols): New function.
5210         * incremental.h (enum Incremental_input_flags): New type.
5211         (class Incremental_checker): Remove.
5212         (Incremental_input_entry::Incremental_input_entry): Add argument
5213         serial number.
5214         (Incremental_input_entry::arg_serial): New function.
5215         (Incremental_input_entry::set_is_in_system_directory): New function.
5216         (Incremental_input_entry::is_in_system_directory): New function.
5217         (Incremental_input_entry::arg_serial_): New data member.
5218         (Incremental_input_entry::is_in_system_directory_): New data member.
5219         (class Script_info): Move here from script.h.
5220         (Script_info::Script_info): Add filename parameter.
5221         (Script_info::filename): New function.
5222         (Script_info::filename_): New data member.
5223         (Incremental_script_entry::Incremental_script_entry): Add argument
5224         serial number.
5225         (Incremental_object_entry::Incremental_object_entry): Likewise.
5226         (Incremental_object_entry::add_input_section): Build list of input
5227         sections with map to original shndx.
5228         (Incremental_object_entry::get_input_section_index): New function.
5229         (Incremental_object_entry::shndx_): New data member.
5230         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5231         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5232         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5233         serial number.
5234         (Incremental_inputs::report_archive_begin): Likewise.
5235         (Incremental_inputs::report_object): Likewise.
5236         (Incremental_inputs::report_script): Likewise.
5237         (class Incremental_global_symbol_reader): New class.
5238         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5239         and store flags and input file type.
5240         (Incremental_input_entry_reader::arg_serial): New function.
5241         (Incremental_input_entry_reader::type): Extract type from flags.
5242         (Incremental_input_entry_reader::is_in_system_directory): New function.
5243         (Incremental_input_entry_reader::get_input_section_count): Call
5244         accessor function for type.
5245         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5246         function for type; adjust size of global symbol entry.
5247         (Incremental_input_entry_reader::get_global_symbol_count): Call
5248         accessor function for type.
5249         (Incremental_input_entry_reader::get_object_count): Likewise.
5250         (Incremental_input_entry_reader::get_object_offset): Likewise.
5251         (Incremental_input_entry_reader::get_member_count): Likewise.
5252         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5253         (Incremental_input_entry_reader::get_member_offset): Likewise.
5254         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5255         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5256         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5257         (Incremental_input_entry_reader::get_global_symbol_reader): New
5258         function.
5259         (Incremental_input_entry_reader::get_output_symbol_index): New
5260         function.
5261         (Incremental_input_entry_reader::type_): Remove.
5262         (Incremental_input_entry_reader::flags_): New data member.
5263         (Incremental_inputs_reader::input_file_offset): New function.
5264         (Incremental_inputs_reader::input_file_index): New function.
5265         (Incremental_inputs_reader::input_file): Call input_file_offset.
5266         (Incremental_inputs_reader::input_file_at_offset): New function.
5267         (Incremental_relocs_reader::get_r_type): Reformat.
5268         (Incremental_relocs_reader::get_r_shndx): Reformat.
5269         (Incremental_relocs_reader::get_r_offset): Reformat.
5270         (Incremental_relocs_reader::data): New function.
5271         (Incremental_binary::Incremental_binary): Initialize new data members.
5272         (Incremental_binary::check_inputs): Add cmdline parameter.
5273         (Incremental_binary::file_is_unchanged): Remove.
5274         (Input_reader::arg_serial): New function.
5275         (Input_reader::get_unused_symbol_count): New function.
5276         (Input_reader::get_unused_symbol): New function.
5277         (Input_reader::do_arg_serial): New function.
5278         (Input_reader::do_get_unused_symbol_count): New function.
5279         (Input_reader::do_get_unused_symbol): New function.
5280         (Incremental_binary::input_file_count): New function.
5281         (Incremental_binary::get_input_reader): Change signature to use
5282         index instead of filename.
5283         (Incremental_binary::file_has_changed): New function.
5284         (Incremental_binary::get_input_argument): New function.
5285         (Incremental_binary::get_library): New function.
5286         (Incremental_binary::get_script_info): New function.
5287         (Incremental_binary::init_layout): New function.
5288         (Incremental_binary::reserve_layout): New function.
5289         (Incremental_binary::output_file): New function.
5290         (Incremental_binary::do_check_inputs): New function.
5291         (Incremental_binary::do_file_is_unchanged): Remove.
5292         (Incremental_binary::do_file_has_changed): New function.
5293         (Incremental_binary::do_init_layout): New function.
5294         (Incremental_binary::do_reserve_layout): New function.
5295         (Incremental_binary::do_input_file_count): New function.
5296         (Incremental_binary::do_get_input_reader): Change signature.
5297         (Incremental_binary::input_args_map_): New data member.
5298         (Incremental_binary::library_map_): New data member.
5299         (Incremental_binary::script_map_): New data member.
5300         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5301         new data members.
5302         (Sized_incremental_binary::output_section): New function.
5303         (Sized_incremental_binary::inputs_reader): Add const.
5304         (Sized_incremental_binary::symtab_reader): Add const.
5305         (Sized_incremental_binary::relocs_reader): Add const.
5306         (Sized_incremental_binary::got_plt_reader): Add const.
5307         (Sized_incremental_binary::get_symtab_view): New function.
5308         (Sized_incremental_binary::Inputs_reader): New typedef.
5309         (Sized_incremental_binary::Input_entry_reader): New typedef.
5310         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5311         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5312         (Sized_incremental_binary::do_file_has_changed): New function.
5313         (Sized_incremental_binary::do_init_layout): New function.
5314         (Sized_incremental_binary::do_reserve_layout): New function.
5315         (Sized_input_reader::Inputs_reader): Remove.
5316         (Sized_input_reader::Input_entry_reader): Remove.
5317         (Sized_input_reader::do_arg_serial): New function.
5318         (Sized_input_reader::do_get_unused_symbol_count): New function.
5319         (Sized_input_reader::do_get_unused_symbol): New function.
5320         (Sized_incremental_binary::do_input_file_count): New function.
5321         (Sized_incremental_binary::do_get_input_reader): Change signature;
5322         use index instead of filename.
5323         (Sized_incremental_binary::section_map_): New data member.
5324         (Sized_incremental_binary::input_entry_readers_): New data member.
5325         (class Sized_incr_relobj): New class.
5326         (class Sized_incr_dynobj): New class.
5327         (make_sized_incremental_object): New function.
5328         (class Incremental_library): New class.
5329         * layout.cc (Free_list::num_lists): New static data member.
5330         (Free_list::num_nodes): New static data member.
5331         (Free_list::num_removes): New static data member.
5332         (Free_list::num_remove_visits): New static data member.
5333         (Free_list::num_allocates): New static data member.
5334         (Free_list::num_allocate_visits): New static data member.
5335         (Free_list::init): New function.
5336         (Free_list::remove): New function.
5337         (Free_list::allocate): New function.
5338         (Free_list::dump): New function.
5339         (Free_list::print_stats): New function.
5340         (Layout_task_runner::run): Resize output file for incremental updates.
5341         (Layout::Layout): Initialize new data members.
5342         (Layout::set_incremental_base): New function.
5343         (Layout::init_fixed_output_section): New function.
5344         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5345         incremental updates.
5346         (Layout::create_gold_note): Do not create gold note section for
5347         incremental updates.
5348         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5349         for incremental updates.
5350         (Layout::set_section_offsets): For incremental updates, allocate space
5351         from free list.
5352         (Layout::create_symtab_sections): Layout with offsets relative to
5353         start of section; for incremental updates, allocate space from free
5354         list.
5355         (Layout::create_shdrs): For incremental updates, allocate space from
5356         free list.
5357         (Layout::finish_dynamic_section): For incremental updates, do not
5358         check --as-needed (fixed in subsequent patch).
5359         * layout.h (class Free_list): New class.
5360         (Layout::set_incremental_base): New function.
5361         (Layout::incremental_base): New function.
5362         (Layout::init_fixed_output_section): New function.
5363         (Layout::allocate): New function.
5364         (Layout::incremental_base_): New data member.
5365         (Layout::free_list_): New data member.
5366         * main.cc (main): Print Free_list statistics.
5367         * object.cc (Relobj::finalize_incremental_relocs): Add
5368         clear_counts parameter; clear counts only when clear_counts is set.
5369         (Sized_relobj::Sized_relobj): Initialize new base class.
5370         (Sized_relobj::do_layout): Don't report special sections.
5371         (Sized_relobj::do_for_all_local_got_entries): New function.
5372         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5373         symtab_off to all symbol table offsets.
5374         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5375         * object.h (class Got_offset_list): Move to top of file.
5376         (Object::Object): Allow case where input_file == NULL.
5377         (Object::~Object): Likewise.
5378         (Object::input_file): Assert that input_file != NULL.
5379         (Object::lock): Allow case where input_file == NULL.
5380         (Object::unlock): Likewise.
5381         (Object::is_locked): Likewise.
5382         (Object::token): Likewise.
5383         (Object::release): Likewise.
5384         (Object::is_incremental): New function.
5385         (Object::get_mtime): New function.
5386         (Object::for_all_local_got_entries): New function.
5387         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5388         (Object::set_is_in_system_directory): New function.
5389         (Object::is_in_system_directory): New function.
5390         (Object::do_is_incremental): New function.
5391         (Object::do_get_mtime): New function.
5392         (Object::do_for_all_local_got_entries): New function.
5393         (Object::is_in_system_directory_): New data member.
5394         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5395         (class Sized_relobj_base): New class.
5396         (class Sized_relobj): Derive from Sized_relobj_base.
5397         (class Sized_relobj::Symbols): Redeclare from base class.
5398         (class Sized_relobj::local_got_offset_list): Remove.
5399         (class Sized_relobj::Output_sections): Redeclare from base class.
5400         (class Sized_relobj::do_for_all_local_got_entries): New function.
5401         (class Sized_relobj::write_local_symbols): Add offset parameter.
5402         (class Sized_relobj::local_symbol_offset_): Update comment.
5403         (class Sized_relobj::local_dynsym_offset_): Update comment.
5404         * options.cc (Input_arguments::add_file): Remove const.
5405         * options.h (Input_file_argument::Input_file_argument):
5406         Initialize arg_serial_ (all constructors).
5407         (Input_file_argument::set_arg_serial): New function.
5408         (Input_file_argument::arg_serial): New function.
5409         (Input_file_argument::arg_serial_): New data member.
5410         (Input_arguments::Input_arguments): Initialize file_count_.
5411         (Input_arguments::add_file): Remove const.
5412         (Input_arguments::number_of_input_files): New function.
5413         (Input_arguments::file_count_): New data member.
5414         (Command_line::number_of_input_files): Call
5415         Input_arguments::number_of_input_files.
5416         * output.cc (Output_segment_headers::Output_segment_headers):
5417         Set current size.
5418         (Output_section::Input_section::current_data_size): New function.
5419         (Output_section::Output_section): Initialize new data members.
5420         (Output_section::add_input_section): Don't do merge sections for
5421         an incremental link; allocate space from free list for an
5422         incremental update.
5423         (Output_section::add_output_section_data): Allocate space from
5424         free list for an incremental update.
5425         (Output_section::update_data_size): New function.
5426         (Output_section::set_fixed_layout): New function.
5427         (Output_section::reserve): New function.
5428         (Output_segment::set_section_addresses): Remove const.
5429         (Output_segment::set_section_list_addresses): Remove const; allocate
5430         space from free list for an incremental update.
5431         (Output_segment::set_offset): Adjust size of RELRO segment for an
5432         incremental update.
5433         * output.h (Output_data::current_data_size): Move here from
5434         child classes.
5435         (Output_data::pre_finalize_data_size): New function.
5436         (Output_data::update_data_size): New function.
5437         (Output_section_headers::update_data_size): new function.
5438         (Output_section_data_build::current_data_size): Move to Output_data.
5439         (Output_data_strtab::update_data_size): New function.
5440         (Output_section::current_data_size): Move to Output_data.
5441         (Output_section::set_fixed_layout): New function.
5442         (Output_section::has_fixed_layout): New function.
5443         (Output_section::reserve): New function.
5444         (Output_section::update_data_size): New function.
5445         (Output_section::has_fixed_layout_): New data member.
5446         (Output_section::free_list_): New data member.
5447         (Output_segment::set_section_addresses): Remove const.
5448         (Output_segment::set_section_list_addresses): Remove const.
5449         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5450         New function.
5451         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5452         New function.
5453         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5454         parameter when calling Add_symbols constructor; store argument
5455         serial number for members of a lib group.
5456         (Add_symbols::locks): Allow case where token == NULL.
5457         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5458         (Read_member::~Read_member): New function.
5459         (Read_member::is_runnable): New function.
5460         (Read_member::locks): New function.
5461         (Read_member::run): New function.
5462         (Check_script::~Check_script): New function.
5463         (Check_script::is_runnable): New function.
5464         (Check_script::locks): New function.
5465         (Check_script::run): New function.
5466         (Check_library::~Check_library): New function.
5467         (Check_library::is_runnable): New function.
5468         (Check_library::locks): New function.
5469         (Check_library::run): New function.
5470         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5471         (Add_symbols::library_): New data member.
5472         (class Read_member): New class.
5473         (class Check_script): New class.
5474         (class Check_library): New class.
5475         * reloc.cc (Read_relocs::is_runnable): Allow case where
5476         token == NULL.
5477         (Read_relocs::locks): Likewise.
5478         (Scan_relocs::locks): Likewise.
5479         (Relocate_task::locks): Likewise.
5480         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5481         to clear counters.
5482         (Sized_relobj::incremental_relocs_scan): Fix comment.
5483         (Sized_relobj::do_relocate): Pass output file offset to
5484         write_local_symbols.
5485         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5486         from class declaration.
5487         * script.cc (read_input_script): Allocate Script_info; pass
5488         argument serial number to report_script.
5489         * script.h (class Script_info): Move to incremental.h.
5490         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5491         * symtab.h (Symbol_table::add_from_incrobj): New function.
5492         (Symbol_table::set_file_offset): New function.
5493
5494 2011-04-05  Cary Coutant  <ccoutant@google.com>
5495
5496         * incremental-dump.cc (dump_incremental_inputs): Change signature
5497         to take a Sized_incremental_binary; change caller.  Use readers
5498         in Sized_incremental_binary.
5499         * incremental.cc
5500         (Sized_incremental_binary::find_incremental_inputs_sections):
5501         Rename do_find_incremental_inputs_sections to this.
5502         (Sized_incremental_binary::setup_readers): New function.
5503         (Sized_incremental_binary::do_check_inputs): Check
5504         has_incremental_info_ flag; move setup code to setup_readers;
5505         use input readers.
5506         (Sized_incremental_binary::do_file_is_unchanged): New function.
5507         (Sized_incremental_binary::do_get_input_reader): New function.
5508         * incremental.h (class Incremental_binary): Move to end of file.
5509         (Incremental_binary::file_is_unchanged): New function.
5510         (Incremental_binary::do_file_is_unchanged): New function.
5511         (Incremental_binary::Input_reader): New class.
5512         (Incremental_binary::get_input_reader): New function.
5513         (class Sized_incremental_binary): Move to end of file.
5514         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5515         input section reader classes.
5516         (Sized_incremental_binary::has_incremental_info): New function.
5517         (Sized_incremental_binary::inputs_reader): New function.
5518         (Sized_incremental_binary::symtab_reader): New function.
5519         (Sized_incremental_binary::relocs_reader): New function.
5520         (Sized_incremental_binary::got_plt_reader): New function.
5521         (Sized_incremental_binary::do_file_is_unchanged): New function.
5522         (Sized_incremental_binary::Sized_input_reader): New class.
5523         (Sized_incremental_binary::get_input_reader): New function.
5524         (Sized_incremental_binary::find_incremental_inputs_sections):
5525         Rename do_find_incremental_inputs_sections to this.
5526         (Sized_incremental_binary::setup_readers): New function.
5527         (Sized_incremental_binary::has_incremental_info_): New data member.
5528         (Sized_incremental_binary::inputs_reader_): New data member.
5529         (Sized_incremental_binary::symtab_reader_): New data member.
5530         (Sized_incremental_binary::relocs_reader_): New data member.
5531         (Sized_incremental_binary::got_plt_reader_): New data member.
5532         (Sized_incremental_binary::current_input_file_): New data member.
5533
5534 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5535
5536         PR gold/12640
5537         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5538         violation.
5539
5540 2011-03-30  Cary Coutant  <ccoutant@google.com>
5541
5542         * archive.cc (Archive::include_member): Adjust call to report_object.
5543         (Add_archive_symbols::run): Add script_info to call to
5544         report_archive_begin.
5545         (Lib_group::include_member): Adjust call to report_object.
5546         (Add_lib_group_symbols::run): Adjust call to report_object.
5547         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5548         blocks.  Add object count for script input files.
5549         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5550         script_info parameter; change all callers.
5551         (Incremental_inputs::report_object): Add script_info parameter;
5552         change all callers.
5553         (Incremental_inputs::report_script): Store backpointer to
5554         incremental info entry.
5555         (Output_section_incremental_inputs::set_final_data_size): Record
5556         additional information for scripts.
5557         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5558         * incremental.h (Incremental_script_entry::add_object): New function.
5559         (Incremental_script_entry::get_object_count): New function.
5560         (Incremental_script_entry::get_object): New function.
5561         (Incremental_script_entry::objects_): New data member; adjust
5562         constructor.
5563         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5564         (Incremental_inputs::report_object): Add script_info parameter.
5565         (Incremental_inputs_reader::get_object_count): New function.
5566         (Incremental_inputs_reader::get_object_offset): New function.
5567         * options.cc (Input_arguments::add_file): Return reference to
5568         new input argument.
5569         * options.h (Input_argument::set_script_info): New function.
5570         (Input_argument::script_info): New function.
5571         (Input_argument::script_info_): New data member; adjust all
5572         constructors.
5573         (Input_file_group::add_file): Return reference to new input argument.
5574         (Input_file_lib::add_file): Likewise.
5575         (Input_arguments::add_file): Likewise.
5576         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5577         * script.cc (Parser_closure::Parser_closure): Add script_info
5578         parameter; adjust all callers.
5579         (Parser_closure::script_info): New function.
5580         (Parser_closure::script_info_): New data member.
5581         (read_input_script): Report scripts earlier to incremental info.
5582         (script_add_file): Set script_info in Input_argument.
5583         (script_add_library): Likewise.
5584         * script.h (Script_options::Script_info): Rewrite class.
5585
5586 2011-03-29  Cary Coutant  <ccoutant@google.com>
5587
5588         * archive.cc (Library_base::should_include_member): Move
5589         method here from class Archive.
5590         (Archive::Archive): Initialize base class.
5591         (Archive::should_include_member): Move to base class.
5592         (Archive::do_for_all_unused_symbols): New function.
5593         (Add_archive_symbols::run): Remove redundant access to
5594         incremental_inputs.
5595         (Lib_group::Lib_group): Initialize base class.
5596         (Lib_group::do_filename): New function.
5597         (Lib_group::include_member): Pass pointer to Lib_group to
5598         report_object.
5599         (Lib_group::do_for_all_unused_symbols): New function.
5600         (Add_lib_group_symbols::run): Report archive information for
5601         incremental links.
5602         * archive.h (class Library_base): New base class.
5603         (class Archive): Derive from Library_base.
5604         (Archive::filename): Move to base class.
5605         (Archive::set_incremental_info): Likewise.
5606         (Archive::incremental_info): Likewise.
5607         (Archive::Should_include): Likewise.
5608         (Archive::should_include_member): Likewise.
5609         (Archive::Armap_entry): Remove.
5610         (Archive::Unused_symbol_iterator): Remove.
5611         (Archive::unused_symbols_begin): Remove.
5612         (Archive::unused_symbols_end): Remove.
5613         (Archive::do_filename): New function.
5614         (Archive::do_get_mtime): New function.
5615         (Archive::do_for_all_unused_symbols): New function.
5616         (Archive::task_): Move to base class.
5617         (Archive::incremental_info_): Likewise.
5618         (class Lib_group): Derive from Library_base.
5619         (Lib_group::do_filename): New function.
5620         (Lib_group::do_get_mtime): New function.
5621         (Lib_group::do_for_all_unused_symbols): New function.
5622         (Lib_group::task_): Move to base class.
5623         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5624         function.
5625         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5626         function.
5627         * incremental.cc (Incremental_inputs::report_archive_begin):
5628         Use Library_base; call library's get_mtime; add incremental inputs
5629         entry before members.
5630         (class Unused_symbol_visitor): New class.
5631         (Incremental_inputs::report_archive_end): Use Library_base; use
5632         visitor class to record unused symbols; don't add incremental inputs
5633         entry after members.
5634         (Incremental_inputs::report_object): Use Library_base.
5635         * incremental.h
5636         (Incremental_archive_entry::Incremental_archive_entry): Remove
5637         unused Archive parameter.
5638         (Incremental_inputs::report_archive_begin): Use Library_base.
5639         (Incremental_inputs::report_archive_end): Likewise.
5640         (Incremental_inputs::report_object): Likewise.
5641         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5642         function.
5643         * object.h (Object::for_all_global_symbols): New function.
5644         (Object::do_for_all_global_symbols): New function.
5645         (Sized_relobj::do_for_all_global_symbols): New function.
5646         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5647         function.
5648         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5649         function.
5650
5651 2011-03-27  Ian Lance Taylor  <iant@google.com>
5652
5653         * archive.cc (Archive::interpret_header): Return -1 if something
5654         goes wrong.  Change callers accordingly.
5655
5656 2011-03-25  Cary Coutant  <ccoutant@google.com>
5657
5658         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5659         * testsuite/Makefile.in: Regenerate.
5660
5661 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5662
5663         * plugin.cc (get_view): New.
5664         (Plugin::load): Pass get_view to the plugin.
5665         (Plugin_manager::get_view): New.
5666
5667 2011-03-21  Ian Lance Taylor  <iant@google.com>
5668
5669         * testsuite/final_layout.sh: Rewrite to not use dc.
5670         * testsuite/relro_test.sh: Fail if dc is not present.
5671
5672 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5673
5674         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5675         Change == to -eq.
5676         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5677         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5678         Change == to -eq.
5679         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5680         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5681
5682 2011-03-14  Ian Lance Taylor  <iant@google.com>
5683
5684         * script-sections.cc (Sort_output_sections::script_compare):
5685         Rename from is_before, change return type.
5686         (Sort_output_sections::operator()): Adjust accordingly.
5687
5688 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5689
5690         PR gold/12572
5691         * testsuite/odr_violation2.cc: Add comment to make all error line
5692         numbers double digits.
5693         * testsuite/debug_msg.sh: Adjust expected errors.
5694
5695 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5696
5697         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5698         but mark earlier ones as non-canonical
5699         (offset_to_iterator): Update search target and example
5700         (do_addr2line): Return extra lines in a vector*
5701         (format_file_lineno): Extract from do_addr2line
5702         (one_addr2line): Add vector* out-param
5703         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5704         when a lineno entry appeared last for its instruction
5705         (Dwarf_line_info): Add vector* out-param
5706         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5707         * symtab.cc (Odr_violation_compare): Include the lineno in the
5708         comparison again.
5709         (linenos_from_loc): New. Combine the canonical line for an
5710         address with its other lines.
5711         (True_if_intersect): New. Helper functor to make
5712         std::set_intersection a query.
5713         (detect_odr_violations): Compare sets of lines instead of just
5714         one line for each function. This became less deterministic, but
5715         has fewer false positives.
5716         * symtab.h: Declarations.
5717         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5718         mix an optimized and non-optimized object in the same binary
5719         (odr_violation2.so): Same.
5720         * testsuite/Makefile.in: Regenerate from Makefile.am.
5721         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5722         * testsuite/debug_msg.sh: Update line numbers and add
5723         assertions.
5724         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5725         non-optimized context.
5726         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5727         isn't inlined, and use OdrDerived in an optimized context.
5728         * testsuite/odr_header1.h: Defines OdrDerived, where
5729         optimization will change the
5730         first-instruction-in-the-destructor's file and line number.
5731         * testsuite/odr_header2.h: Defines OdrBase.
5732
5733 2011-03-09  Ian Lance Taylor  <iant@google.com>
5734
5735         * fileread.cc (File_read::clear_views): Don't delete the whole
5736         file view.
5737
5738 2011-03-08  Ian Lance Taylor  <iant@google.com>
5739
5740         PR gold/12525
5741         * fileread.cc: #include <climits>.
5742         (GOLD_IOV_MAX): Define.
5743         (File_read::read_multiple): Limit number of entries by iov_max.
5744         * fileread.h (class File_read): Always set max_readv_entries to
5745         128.
5746
5747 2011-03-07  Ian Lance Taylor  <iant@google.com>
5748
5749         PR gold/12525
5750         * options.h (class General_options): Add -dy and -dn.
5751
5752 2011-03-02  Cary Coutant  <ccoutant@google.com>
5753
5754         * testsuite/script_test_9.t: Add TLS segment.
5755
5756 2011-03-02  Simon Baldwin  <simonb@google.com>
5757
5758         * configure.ac: Add check for gnu_indirect_function support in
5759         the toolchain building binutils.
5760         * configure: Rebuild.
5761
5762 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5763
5764         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5765         plugin only symbols.
5766         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5767         in plugin files as not needed in the symbol table.
5768
5769 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5770
5771         * output.cc (Output_section::add_input_section): Delay fill
5772         generation for section ordering.
5773
5774 2011-02-09  Ian Lance Taylor  <iant@google.com>
5775
5776         PR gold/12316
5777         * object.h (class Sized_relobj): Remove clear_local_symbols.
5778         * reloc.cc (Sized_relobj::do_relocate): Don't call
5779         clear_local_symbols.
5780
5781 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5782
5783         * plugin.cc (is_visible_from_outside): Return true for symbols
5784         in the -u option.
5785
5786 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5787
5788         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5789         filename.
5790
5791 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5792
5793         * icf.h (is_section_foldable_candidate): Change type of parameter
5794         to std::string.
5795         * icf.cc (Icf::find_identical_sections): Change type of local variable
5796         section_name to be std::string.
5797         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5798
5799 2011-01-25  Ian Lance Taylor  <iant@google.com>
5800
5801         * script.cc (script_add_extern): Rewrite to use
5802         add_symbol_reference.
5803
5804 2011-01-25  Doug Kwan  <dougkwan@google.com>
5805
5806         * icf.cc (get_section_contents): Always lock section's object.
5807
5808 2011-01-24  Ian Lance Taylor  <iant@google.com>
5809
5810         * options.h (class General_options): Accept
5811         --no-detect-odr-violations.
5812
5813 2011-01-24  Ian Lance Taylor  <iant@google.com>
5814
5815         * version.cc (version_string): Bump to 1.11.
5816
5817 2011-01-24  Ian Lance Taylor  <iant@google.com>
5818
5819         * plugin.cc (class Plugin_rescan): Define new class.
5820         (Plugin_manager::claim_file): Set any_claimed_.
5821         (Plugin_manager::save_archive): New function.
5822         (Plugin_manager::save_input_group): New function.
5823         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5824         necessary.
5825         (Plugin_manager::new_undefined_symbol): New function.
5826         (Plugin_manager::rescan): New function.
5827         (Plugin_manager::rescannable_defines): New function.
5828         (Plugin_manager::add_input_file): Set any_added_.
5829         * plugin.h (class Plugin_manager): define new fields rescannable_,
5830         undefined_symbols_, any_claimed_, and any_added_.  Declare
5831         Plugin_rescan as friend.  Declare new functions.
5832         (Plugin_manager::Rescannable): Define type.
5833         (Plugin_manager::Rescannable_list): Define type.
5834         (Plugin_manager::Undefined_symbol_list): Define type.
5835         (Plugin_manager::Plugin_manager): Initialize new fields.
5836         * archive.cc (Archive::defines_symbol): New function.
5837         (Add_archive_symbols::run): Pass archive to plugins if any.
5838         * archive.h (class Archive): Declare defines_symbol.
5839         * readsyms.cc (Input_group::~Input_group): New function.
5840         (Finish_group::run): Pass input_group to plugins if any.
5841         * readsyms.h (class Input_group): Declare destructor.
5842         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5843         any.
5844
5845 2011-01-10  Ian Lance Taylor  <iant@google.com>
5846
5847         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5848         section as relro.
5849         (Layout::set_segment_offsets): Reset increase_relro before calling
5850         set_section_addresses a second time.
5851
5852 2011-01-04  Cary Coutant  <ccoutant@google.com>
5853
5854         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5855         sections before NOBITS sections.
5856
5857 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5858
5859         * version.cc (print_version): Update copyright to 2011.
5860
5861 2010-12-23  Cary Coutant  <ccoutant@google.com>
5862
5863         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5864         of OS to this->add.  Add OD parameter to second form of the function.
5865
5866 2010-12-20  Ian Lance Taylor  <iant@google.com>
5867
5868         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5869         second of two consecutive entries with same offset.
5870
5871 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5872
5873         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5874         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5875         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5876         to avoid unneeded links against $(LDADD).
5877         * testsuite/Makefile.in: Regenerate.
5878
5879 2010-12-15  Ian Lance Taylor  <iant@google.com>
5880
5881         PR gold/12324
5882         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5883         for R_X86_64_32 and R_X86_64_PC32.
5884         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5885         ver_matching_def_pic.o.
5886         (ver_matching_def_pic.o): New target.
5887
5888 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5889
5890         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5891         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5892         Move definition before File_read::View member definitions.
5893         (File_read::View::~View): Initialize and hold lock before
5894         updating current_mapped_bytes.
5895
5896 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5897
5898         * dwarf_reader.cc: Remove outdated comment.
5899         * gold-threads.cc: Fix typo in error message.
5900         * archive.cc: Fix typos in comments.
5901         * archive.h: Likewise.
5902         * arm-reloc-property.cc: Likewise.
5903         * arm-reloc-property.h: Likewise.
5904         * arm-reloc.def: Likewise.
5905         * arm.cc: Likewise.
5906         * attributes.h: Likewise.
5907         * cref.cc: Likewise.
5908         * ehframe.cc: Likewise.
5909         * fileread.h: Likewise.
5910         * gold.h: Likewise.
5911         * i386.cc: Likewise.
5912         * icf.cc: Likewise.
5913         * incremental.h: Likewise.
5914         * int_encoding.cc: Likewise.
5915         * layout.h: Likewise.
5916         * main.cc: Likewise.
5917         * merge.h: Likewise.
5918         * object.cc: Likewise.
5919         * object.h: Likewise.
5920         * options.cc: Likewise.
5921         * readsyms.cc: Likewise.
5922         * reduced_debug_output.cc: Likewise.
5923         * reloc.cc: Likewise.
5924         * script-sections.cc: Likewise.
5925         * sparc.cc: Likewise.
5926         * symtab.h: Likewise.
5927         * target-reloc.h: Likewise.
5928         * target.cc: Likewise.
5929         * target.h: Likewise.
5930         * timer.cc: Likewise.
5931         * timer.h: Likewise.
5932         * x86_64.cc: Likewise.
5933
5934 2010-12-09  Cary Coutant  <ccoutant@google.com>
5935
5936         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5937         stack.
5938         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5939         parameter; change all callers.
5940         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5941         * options.h (warn_execstack): New option.
5942
5943 2010-12-07  Doug Kwan  <dougkwan@google.com>
5944
5945         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5946         like function call relocations.
5947
5948 2010-12-07  Ian Lance Taylor  <iant@google.com>
5949
5950         * archive.cc (Archive::get_elf_object_for_member): Permit
5951         punconfigured to be NULL.
5952         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5953         (Archive::include_member): Pass NULL to get_elf_object_for_member
5954         if we searched for the archive and this is the first included
5955         object.
5956
5957 2010-12-01  Ian Lance Taylor  <iant@google.com>
5958
5959         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5960         track_relocs_type_ field.
5961         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5962         Set track_relocs_type_.
5963         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5964         contents when using RELA relocs.
5965         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5966         reloc_map_.
5967         * reloc.cc (Track_relocs::next_addend): New function.
5968         * reloc.h (class Track_relocs): Declare next_addend.
5969
5970 2010-12-01  Ian Lance Taylor  <iant@google.com>
5971
5972         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5973         virtual destructor.
5974
5975 2010-12-01  Ian Lance Taylor  <iant@google.com>
5976
5977         * README: Update compilers known to work and fail.
5978
5979 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5980
5981         * configure.in: For --enable-gold, handle value `default' instead of
5982         `both*'.  Always install ld as ld.bfd, install as ld if gold is
5983         not the default.
5984         * configure: Regenerate.
5985
5986 2010-11-18  Doug Kwan  <dougkwan@google.com>
5987
5988         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
5989         and right_alignment to be zero.  Store result alignment only if it is
5990         greater than existing alignment.
5991
5992 2010-11-16  Cary Coutant  <ccoutant@google.com>
5993
5994         PR gold/12220
5995         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5996         Check for ".zdebug_line".
5997
5998 2010-11-16  Doug Kwan  <dougkwan@google.com>
5999             Cary Coutant  <ccoutant@google.com>
6000
6001         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6002         by reference; adjust all callers.
6003         * output.cc (Output_segment::set_section_addresses): Adjust references
6004         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6005         list is empty.
6006         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6007         end at page boundary.
6008
6009 2010-11-16  Cary Coutant  <ccoutant@google.com>
6010
6011         PR gold/12220
6012         * layout.cc (Layout::choose_output_section): Transform names of
6013         compressed sections even when using a script with a SECTIONS clause.
6014         (Layout::output_section_name): Remove code to transform
6015         compressed debug section names.
6016         * output.cc (Output_section::add_input_section): Use uncompressed
6017         section size when tracking input sections.
6018
6019 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6020
6021         * symtab.h (Symbol::NON_PIC_REF): Remove.
6022         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6023         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6024         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6025         (Symbol::use_plt_offset): Take a flags argument and pass it
6026         directly to needs_dynamic_reloc.  Restrict check for undefined
6027         weak symbols to function calls.
6028         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6029         (Target_arm::Scan::global): Use it.
6030         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6031         (Target_arm::Relocate::relocate): Likewise.
6032         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6033         parameter with an r_type parameter.  Use get_reference_flags
6034         to get the flags.
6035         (Target_arm::Relocate::relocate): Update accordingly.
6036         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6037         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6038         (Target_i386::Scan::global): Likewise.
6039         (Target_i386::Relocate::relocate): Likewise.
6040         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6041         parameter with an r_type parameter.  Use get_reference_flags
6042         to get the flags.
6043         (Target_i386::Relocate::relocate): Update accordingly.
6044         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6045         (Target_powerpc::Scan::global): Use it.
6046         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6047         (Target_powerpc::Relocate::relocate): Likewise.
6048         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6049         (Target_sparc::Scan::global): Use it.
6050         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6051         (Target_sparc::Relocate::relocate): Likewise.
6052         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6053         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6054         (Target_x86_64::Scan::global): Likewise.
6055         (Target_x86_64::Relocate::relocate): Likewise.
6056
6057 2010-11-08  Doug Kwan  <dougkwan@google.com>
6058             Cary Coutant  <ccoutant@google.com>
6059
6060         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6061         (Arm_exidx_merge_section::section_contents_): New data member.
6062         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6063         (Arm_input_section::~Arm_input_section): De-allocate memory.
6064         (Arm_input_section::original_contents_): New data member.
6065         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6066         in parameters instead of calling Object::section_contents without
6067         locking.
6068         (Arm_output_section::group_section): New parameter TASK.  Pass it
6069         to callees that need locking objects.
6070         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6071         to lock EXIDX input sections.  Fix a formatting issue.  Call
6072         Arm_exidx_merged_section::build_contents to create merged section
6073         contents.
6074         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6075         to lock object of stub table owner.
6076         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6077         TEXT_SIZE to initialize data member TEXT_SIZE_.
6078         (Arm_exidx_input_section::addralign): Fix typo in comment.
6079         (Arm_exidx_input_section::text_size): New method.
6080         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6081         that require locking objects.  Lock objects before scanning for stubs
6082         and updating local symbols.
6083         (Arm_input_section<big_endian>::init): Copy contents of original
6084         input section.
6085         (Arm_input_section<big_endian>::do_write): Use saved contents of
6086         original input section instead of calling Object::section_contents
6087         without locking.
6088         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6089         size without calling Object::section_size().
6090         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6091         for size.  Allocate a buffer for merged EXIDX entries.
6092         (Arm_exidx_merged_section::build_contents): New method.
6093         (Arm_exidx_merged_section::do_write): Move merge section contents
6094         building code to Arm_exidx_merged_section::build_contetns.  Write
6095         out contetns in buffer instead of building it on the fly.
6096         (Arm_relobj::make_exidx_input_section): Also pass text section size
6097         to Arm_exidx_input_section constructor.
6098         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6099         (Arm_dynobj::do_read_symbols): Fix memory leak.
6100         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6101         * target.h: (class Task): Add forward declaration.
6102         (Target::relax): Add new parameter TASK and pass it to
6103         Target::do_relax().
6104         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6105
6106 2010-11-05  Cary Coutant  <ccoutant@google.com>
6107
6108         PR gold/10708
6109         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6110         object when reading from the file.
6111         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6112         second layout pass.
6113         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6114         when reading section contents.
6115         (get_section_contents): Likewise.
6116         (icf::find_identical_sections): Likewise.
6117         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6118         object when reading from the file.
6119         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6120         the object when doing deferred section layout.
6121
6122 2010-11-03  Nick Clifton  <nickc@redhat.com>
6123
6124         PR gold/12001
6125         * script.h (class Symbol_assignment: name): New member.  Returns
6126         the name of the symbol.
6127         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6128         Returns true if the given symbol name is on the list of
6129         assignments wating to be processed.
6130         * archive.cc (should_incldue_member): If the symbol is undefined,
6131         check to see if it is on the list of symbols pending assignment.
6132
6133 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6134
6135         * script-sections.cc (Script_sections::find_memory_region): Check
6136         for a NULL output section pointer.
6137
6138 2010-10-29  Doug Kwan  <dougkwan@google.com>
6139
6140         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6141         Output_section::add_relaxed_input_section.
6142         * output.cc (Output_section::add_relaxed_input_section): Add new
6143         arguments LAYOUT and NAME.  Set section order index.
6144         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6145         Copy section order index.
6146         * output.h (Output_section::add_relaxed_input_section): Add new
6147         arguments LAYOUT and NAME.
6148
6149 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6150
6151         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6152         NATIVE_OR_CROSS_LINKER.
6153         * testsuite/Makefile.in: Regenerate.
6154
6155 2010-10-20  Doug Kwan  <dougkwan@google.com>
6156
6157         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6158         without SHF_LINK_ORDER flags.
6159         * layout.cc (Layout::choose_output_section): Do not filter
6160         SHF_LINK_ORDER flag in a relocatable link.
6161
6162 2010-10-17  Cary Coutant  <ccoutant@google.com>
6163
6164         * output.h (Output_segment::set_section_addresses): Change function
6165         signature.  Update all callers.
6166         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6167         sections.
6168         (Output_segment::set_section_addresses): Align after last TLS
6169         section.  Add padding before last relro section instead of after.
6170
6171 2010-10-17  Doug Kwan  <dougkwan@google.com>
6172
6173         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6174         GOT output section to be writable.
6175
6176 2010-10-14  Cary Coutant  <ccoutant@google.com>
6177
6178         * debug.h (DEBUG_INCREMENTAL): New flag.
6179         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6180         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6181         mode.
6182         * incremental.cc (report_command_line): Ignore all forms of
6183         --incremental.
6184         * layout.cc (Layout::Layout): Check parameters for incremental link
6185         mode.
6186         * options.cc (General_options::parse_incremental): New function.
6187         (General_options::parse_no_incremental): New function.
6188         (General_options::parse_incremental_full): New function.
6189         (General_options::parse_incremental_update): New function.
6190         (General_options::incremental_mode_): New data member.
6191         (General_options::finalize): Check incremental_mode_.
6192         * options.h (General_options): Update help text for --incremental.
6193         Add --no-incremental, --incremental-full, --incremental-update.
6194         (General_options::Incremental_mode): New enum type.
6195         (General_options::incremental_mode): New function.
6196         (General_options::incremental_mode_): New data member.
6197         * parameters.cc (Parameters::incremental_mode_): New data member.
6198         (Parameters::set_options): Set incremental_mode_.
6199         (Parameters::set_incremental_full): New function.
6200         (Parameters::incremental): New function.
6201         (Parameters::incremental_update): New function.
6202         (set_parameters_incremental_full): New function.
6203         * parameters.h (Parameters::set_incremental_full): New function.
6204         (Parameters::incremental): New function.
6205         (Parameters::incremental_update): New function.
6206         (Parameters::incremental_mode_): New data member.
6207         (set_parameters_incremental_full): New function.
6208         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6209         incremental link mode.
6210         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6211         (Sized_relobj::do_relocate_sections): Likewise.
6212         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6213         option.
6214         * testsuite/Makefile.in: Regenerate.
6215         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6216
6217 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6218
6219         * script-sections.h (class Script_sections): Make
6220         Sections_elements typedef public.
6221         * script-sections.cc (class Sort_output_sections): Add elements_
6222         field.  Add constructor which sets it; change all callers.
6223         (Sort_output_sections::is_before): New function.
6224         (Sort_output_sections::operator()): Call is_before.
6225         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6226         conditional.
6227         * testsuite/script_test_10.sh: New test. Test script section
6228         order.
6229         * testsuite/script_test_10.t: Likewise.
6230         * testsuite/script_test_10.s: Likewise.
6231         * testsuite/Makefile.am: Wrap the cross linker tests and the
6232         common tests into NATIVE_OR_CROSS_LINKER.
6233         (check_SCRIPTS): Add script_test_10.sh.
6234         (check_DATA): Add script_test_10.stdout.
6235         (script_test_10.o, script_test_10): New targets.
6236         (script_test_10.stdout): New target.
6237         * configure, testsuite/Makefile.in: Regenerate.
6238
6239 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6240
6241         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6242         error for the deprecated relocations.
6243         (Target_arm::Scan::global): Likewise.
6244         (Target_arm::Relocate::relocate): Likewise.
6245
6246 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6247
6248         * fileread.cc (Input_file::find_file): Initialize *found_name
6249         and *namep when using the fallback search for case 4.
6250
6251 2010-10-11  Cary Coutant  <ccoutant@google.com>
6252
6253         * options.h (class General_options): Redefine -z lazy as an alias for
6254         the negation of -z now.
6255
6256 2010-10-11  Ian Lance Taylor  <iant@google.com>
6257
6258         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6259         binding.
6260
6261 2010-10-06  Nick Clifton  <nickc@redhat.com>
6262
6263         * script-sections.cc(class Memory_region): Remove
6264         current_lma_offset_ field.  Rename current_vma_offset_ to
6265         current_offset_.  Add last_section_ field.
6266         (Memory_region::get_current_vma_address): Rename to
6267         get_current_address.
6268         (Memory_region::get_current_lma_address): Delete.
6269         (Memory_region::increment_vma_offset): Rename to
6270         increment_offset.
6271         (Memory_region::increment_lma_offset): Delete.
6272         (Memory_region::attributes_compatible): New method.  Returns
6273         true if the provided section is compatible with the region.
6274         (Memory_region::get_last_section): New method.  Returns the last
6275         section to use the region.
6276         (Memory_region::set_last_section): New method.  Stores the last
6277         section to use the region.
6278         (Script_sections::block_in_region): New method.  Returns true if
6279         a block of memory is contained within a region.
6280         (Script_sections::find_memory_region): New method.  Locates a
6281         memory region to be used to set a VMA or LMA address.
6282         (Output_section_definition::set_section_addresses): Add code to
6283         check for addresses set by memory regions.
6284         (Output_segment::set_section_addresses): Remove memory region
6285         walking code.
6286         (Script_sections::create_segment): Add a warning if a header
6287         segment is created outside of any region.
6288         * script-sections.h (class Script_sections): Add prototypes for
6289         find_memory_region and block_in_region methods.
6290         * testsuite/memory_test.s: Use .long instead of .word.
6291         * testsuite/memory_test.t: Add some more output sections.
6292         * testsuite/memory_test.sh: Update expected output.
6293
6294 2010-10-02  Doug Kwan  <dougkwan@google.com>
6295
6296         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6297         defintion to symtab.h
6298         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6299         declaration to defintion.
6300
6301 2010-10-01  Nick Clifton  <nickc@redhat.com>
6302
6303         * expression.cc (eval): Replace dummy argument with NULL.
6304         (eval_maybe_dot): Check for a NULL result section pointer.
6305         (Symbol_expression::value): Likewise.
6306         (Dot_expression::value): Likewise.
6307         (BINARY_EXPRESSION): Likewise.
6308         (Max_expression::value): Likewise.
6309         (Min_expression::value): Likewise.
6310         (Absolute_expression::value): Likewise.
6311         (Addr_expression::value_from_output_section): Likewise.
6312         (Loaddddr_expression::value_from_output_section): Likewise.
6313         (Segment_start_expression::value): Likewise.
6314         * script-sections.cc
6315         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6316         argument with NULL.
6317         (Sections_elememt_dot_assignment::set_section_addresses):
6318         Likewise.
6319         (Output_data_expression::do_write_to_buffer): Likewise.
6320         (Output_section_definition::finalize_symbols): Likewise.
6321         (Output_section_definition::set_section_addresses): Likewise.
6322
6323 2010-09-30  Doug Kwan  <dougkwan@google.com>
6324
6325         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6326
6327 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6328
6329         * target.h (Target::can_icf_inline_merge_sections): New virtual
6330         function.
6331         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6332         virtual function.
6333         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6334         virtual function.
6335         * icf.cc (get_section_contents): Inline merge sections only when
6336         target allows it.
6337
6338 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6339
6340         * configure: Regenerate.
6341
6342 2010-09-17  Ian Lance Taylor  <iant@google.com>
6343
6344         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6345         * testsuite/Makefile.am (memory_test.o): New target.
6346         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6347         memory_test.t.
6348         * testsuite/Makefile.in: Rebuild.
6349
6350 2010-09-17  Doug Kwan  <dougkwan@google.com>
6351
6352         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6353         defintion if relocation uses GOT entries of the symbol.
6354         * testsuite/icf_safe_test.sh: Fix test.
6355         * testsuite/icf_safe_so_test.sh: Fix test.
6356
6357 2010-09-16  Cary Coutant  <ccoutant@google.com>
6358
6359         * script_sections.cc (class Memory_region): Remove "NULL" from
6360         vector initializations.
6361
6362 2010-09-15  Cary Coutant  <ccoutant@google.com>
6363
6364         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6365         Resolve forwarding symbols.
6366
6367 2010-09-15  Doug Kwan  <dougkwan@google.com>
6368
6369         * gold/testsuite/script_test_3.t: Add ARM special sections.
6370         * gold/testsuite/script_test_4.t: Same.
6371         * gold/testsuite/script_test_5.t: Same.
6372         * gold/testsuite/script_test_6.t: Same.
6373         * gold/testsuite/script_test_7.t: Same.
6374         * gold/testsuite/script_test_7.t: Same.
6375         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6376
6377 2010-09-14  Cary Coutant  <ccoutant@google.com>
6378
6379         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6380         (Target_x86_64::Relocate::relocate_tls): Replace check for
6381         saw_tls_block_reloc_ with test for executable section.
6382
6383 2010-09-12  Cary Coutant  <ccoutant@google.com>
6384
6385         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6386         position-independent executables to shared libraries need dynamic
6387         relocations.
6388         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6389         position-independent executables.
6390         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6391         * testsuite/Makefile.in: Regenerate.
6392
6393 2010-09-10  Nick Clifton  <nickc@redhat.com>
6394
6395         PR gold/11997
6396         * testsuite/memory_test.t: Discard any sections that are not
6397         needed.
6398
6399 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6400
6401         PR gold/11996
6402         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6403         "This::" to work around a bug in gcc 4.2.
6404
6405         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6406
6407 2010-09-09  Rafael Espindola  <espindola@google.com>
6408
6409         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6410         sections with different PF_X flags in the same segment.
6411         (Layout::find_first_load_seg): Search all segments to find the first
6412         one.
6413         * options.h (rosegment): New.
6414
6415 2010-09-08  Rafael Espindola  <espindola@google.com>
6416
6417         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6418
6419 2010-09-08  Doug Kwan  <dougkwan@google.com>
6420
6421         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6422         (Arm_relobj::do_relocate_sections): Add new parameter for output
6423         file to match the parent.
6424         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6425         of local symbols instead of input values.  Update code to track
6426         changes in gold::relocate_section.
6427         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6428         (Sized_relobj::compute_final_local_value_internal): New methods.
6429         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6430         body into private version of Sized_relobj::compute_final_local_value.
6431         Call the inline method.
6432         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6433         merged symbol value if there is one.
6434         (Symbol_value::has_output_value): New method defintiion.
6435         (Sized_relobj::Compute_final_local_value_status): New enum type.
6436         (Sized_relobj::compute_final_local_value): New methods.
6437         (Sized_relobj::compute_final_local_value_internal): New methods.
6438         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6439         and arm_cortex_a8.sh.
6440         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6441         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6442         New tests.
6443         * Makefile.in: Regenerate.
6444         * testsuite/arm_bl_out_of_range.s: Update test.
6445         * testsuite/thumb_bl_out_of_range.s: Ditto.
6446         * testsuite/thumb_blx_out_of_range.s: Ditto.
6447         * testsuite/arm_branch_out_of_range.sh: New file.
6448         * testsuite/arm_cortex_a8.sh: Ditto.
6449         * testsuite/arm_cortex_a8_b.s: Ditto.
6450         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6451         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6452         * testsuite/arm_cortex_a8_bl.s: Ditto.
6453         * testsuite/arm_cortex_a8_blx.s: Ditto.
6454         * testsuite/arm_cortex_a8_local.s: Ditto.
6455         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6456         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6457
6458 2010-09-08  Rafael Espindola  <espindola@google.com>
6459
6460         * Makefile.am (memory_test.stdout): Run readelf with -W.
6461         * Makefile.in: Regenerate.
6462         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6463         64 bit output.
6464
6465 2010-09-08  Rafael Espindola  <espindola@google.com>
6466
6467         * script-sections.cc (Script_sections::add_memory_region): Convert
6468         field precision to int.
6469         * script.cc (script_set_section_region, script_set_section_region):
6470         Convert field precision to int.
6471
6472 2010-09-08  Rafael Espindola  <espindola@google.com>
6473
6474         * arm.cc (do_finalize_sections): Create the __exidx_start and
6475         __exdix_end symbols even when the section is missing.
6476
6477 2010-09-08  Nick Clifton  <nickc@redhat.com>
6478
6479         * README: Remove claim that MEMORY is not supported.
6480         * expression.cc (script_exp_function_origin)
6481         (script_exp_function_length): Move from here to ...
6482         * script.cc: ... here.
6483         (script_set_section_region, script_add_memory)
6484         (script_parse_memory_attr, script_include_directive): New
6485         functions.
6486         * script-sections.cc
6487         (class Memory_region): New class.
6488         (class Output_section_definition): Add set_memory_region,
6489         set_section_vma, set_section_lma and get_section_name methods.
6490         (class Script_Sections): Add add_memory_region,
6491         find_memory_region, find_memory_region_origin,
6492         find_memory_region_length and set_memory_region methods.
6493         Have set_section_addresses method walk the list of set memory
6494         regions.
6495         Extend the print methos to display memory regions.
6496         * script-sections.h: Add prototypes for new methods.
6497         Add enum for MEMORY region attributes.
6498         * yyscript.y: Add support for parsing MEMORY regions.
6499         * script-c.h: Add prototypes for new functions.
6500         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6501         * testsuite/Makefile.in: Regenerate.
6502         * testsuite/memory_test.sh: New script.
6503         * testsuite/memory_test.s: New assembler source file.
6504         * testsuite/memory_test.t: New linker script.
6505
6506 2010-08-27  Doug Kwan  <dougkwan@google.com>
6507
6508         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6509         reference override an existing dynamic weak reference.
6510         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6511         * testsuite/Makefile.in: Regenerate.
6512         * testsuite/dyn_weak_ref.sh: New file.
6513         * testsuite/dyn_weak_ref_1.c: Ditto.
6514         * testsuite/dyn_weak_ref_2.c: Ditto.
6515
6516 2010-08-27  Ian Lance Taylor  <iant@google.com>
6517
6518         * incremental.h (class Incremental_input_entry): Add virtual
6519         destructor.
6520
6521 2010-08-27  Ian Lance Taylor  <iant@google.com>
6522
6523         * testsuite/start_lib_test_3.c: Mark t3 as used.
6524
6525 2010-08-27  Nick Clifton  <nickc@redhat.com>
6526
6527         * options.cc (version_script): Fix small typo in previous
6528         whitespace tidyup.
6529
6530 2010-08-25  Nick Clifton  <nickc@redhat.com>
6531
6532         * archive.cc: Formatting fixes: Remove whitespace between
6533         typename and following asterisk.  Remove whitespace between
6534         function name and opening parenthesis.
6535         * archive.h: Likewise.
6536         * arm.cc: Likewise.
6537         * attributes.cc: Likewise.
6538         * attributes.h: Likewise.
6539         * common.cc: Likewise.
6540         * copy-relocs.cc: Likewise.
6541         * dirsearch.h: Likewise.
6542         * dynobj.cc: Likewise.
6543         * ehframe.cc: Likewise.
6544         * ehframe.h: Likewise.
6545         * expression.cc: Likewise.
6546         * fileread.cc: Likewise.
6547         * fileread.h: Likewise.
6548         * gc.h: Likewise.
6549         * gold-threads.cc: Likewise.
6550         * gold.cc: Likewise.
6551         * i386.cc: Likewise.
6552         * icf.h: Likewise.
6553         * incremental-dump.cc: Likewise.
6554         * incremental.cc: Likewise.
6555         * layout.cc: Likewise.
6556         * layout.h: Likewise.
6557         * main.cc: Likewise.
6558         * merge.cc: Likewise.
6559         * merge.h: Likewise.
6560         * object.cc: Likewise.
6561         * object.h: Likewise.
6562         * options.cc: Likewise.
6563         * options.h: Likewise.
6564         * output.cc: Likewise.
6565         * output.h: Likewise.
6566         * plugin.cc: Likewise.
6567         * plugin.h: Likewise.
6568         * powerpc.cc: Likewise.
6569         * reloc.cc: Likewise.
6570         * script-c.h: Likewise.
6571         * script-sections.cc: Likewise.
6572         * script.cc: Likewise.
6573         * stringpool.cc: Likewise.
6574         * symtab.cc: Likewise.
6575         * symtab.h: Likewise.
6576         * target.cc: Likewise.
6577         * timer.cc: Likewise.
6578         * timer.h: Likewise.
6579         * version.cc: Likewise.
6580         * x86_64.cc: Likewise.
6581
6582 2010-08-24  Nick Clifton  <nickc@redhat.com>
6583
6584         PR 11899
6585         * layout.cc (segment_precedes): Sort segments by their physical
6586         addresses, if they have been set.
6587
6588 2010-08-23  Cary Coutant  <ccoutant@google.com>
6589
6590         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6591         symbols data.
6592         (Lib_group::include_member): Unlock object after deleting its
6593         symbols data.
6594         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6595         the bug fixed here.
6596
6597 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6598             Cary Coutant  <ccoutant@google.com>
6599
6600         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6601         constructor, and set_blocker.
6602         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6603         readsyms_blocker_.
6604         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6605         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6606         * testsuite/Makefile.am (start_lib_test): New test case.
6607         * testsuite/Makefile.in: Regenerate.
6608         * testsuite/start_lib_test_main.c: New file.
6609         * testsuite/start_lib_test_1.c: New file.
6610         * testsuite/start_lib_test_2.c: New file.
6611         * testsuite/start_lib_test_3.c: New file.
6612
6613 2010-08-19  Ian Lance Taylor  <iant@google.com>
6614
6615         * Makefile.in: Rebuild with automake 1.11.1.
6616         * aclocal.m4: Likewise.
6617         * testsuite/Makefile.in: Likewise.
6618
6619 2010-08-19  Ian Lance Taylor  <iant@google.com>
6620
6621         PR 10893
6622         * i386.cc (class Output_data_plt_i386): Update declarations.
6623         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6624         local_ifuncs_ fields.
6625         (Target_i386::do_plt_section_for_global): New function.
6626         (Target_i386::do_plt_section_for_local): New function.
6627         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6628         parameter; change all callers.  Initialize global_ifuncs_ and
6629         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6630         __rel_iplt_end.
6631         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6632         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6633         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6634         symbols.
6635         (Target_i386::make_plt_section): New function, broken out of
6636         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6637         (Target_i386::make_plt_entry): Call make_plt_section.
6638         (Target_i386::make_local_ifunc_plt_entry): New function.
6639         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6640         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6641         R_386_IRELATIVE to switch.
6642         (Target_i386::Scan::global): Likewise.
6643         (Target_i386::Relocate::relocate): Likewise.
6644         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6645         switch.
6646         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6647         (Target_x86_64::do_plt_section_for_global): New function.
6648         (Target_x86_64::do_plt_section_for_local): New function.
6649         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6650         parameter; change all callers.  If doing a static link define
6651         __rela_iplt_start and __rela_iplt_end.
6652         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6653         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6654         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6655         to point to .plt.
6656         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6657         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6658         switch.
6659         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6660         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6661         R_X86_64_IRELATIVE to switch.
6662         (Target_x86_64::Scan::global): Likewise.
6663         (Target_x86_64::Relocate::relocate): Likewise.
6664         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6665         switch.
6666         * target.h (class Target): Add plt_section_for_global and
6667         plt_section_for_local functions.  Add do_plt_section_for_global
6668         and do_plt_section_for_local virtual functions.
6669         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6670         clarifying comments.
6671         (Symbol::use_plt_offset): Handle IFUNC symbol.
6672         * object.cc (Sized_relobj::Sized_relobj): Initialize
6673         local_plt_offsets_.
6674         (Sized_relobj::local_has_plt_offset): New function.
6675         (Sized_relobj::local_plt_offset): New function.
6676         (Sized_relobj::set_local_plt_offset): New function.
6677         (Sized_relobj::do_count): Handle IFUNC symbol.
6678         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6679         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6680         is_ifunc_symbol functions.
6681         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6682         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6683         local_plt_offsets_ field.
6684         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6685         * output.h (class Output_section_data): Add non-const
6686         output_section function.
6687         (class Output_data_got): Update declarations.
6688         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6689         Add use_plt_offset parameter to global and local constructors.
6690         Change all callers.  Change local_sym_index_ field to 31 bits.
6691         Change GSYM_CODE and CONSTANT_CODE accordingly.
6692         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6693         doing a static link don't set sh_link field.
6694         (Output_data_got::Got_entry::write): Use PLT offset if
6695         appropriate.
6696         (Output_data_got::add_global_plt): New function.
6697         (Output_data_got::add_local_plt): New function.
6698         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6699         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6700         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6701         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6702         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6703         IFUNC conditional.
6704         * testsuite/ifunc-sel.h: New file.
6705         * testsuite/ifuncmain1.c: New file.
6706         * testsuite/ifuncmain1vis.c: New file.
6707         * testsuite/ifuncmod1.c: New file.
6708         * testsuite/ifuncdep2.c: New file.
6709         * testsuite/ifuncmain2.c: New file.
6710         * testsuite/ifuncmain3.c: New file.
6711         * testsuite/ifuncmod3.c: New file.
6712         * testsuite/ifuncmain4.c: New file.
6713         * testsuite/ifuncmain5.c: New file.
6714         * testsuite/ifuncmod5.c: New file.
6715         * testsuite/ifuncmain6pie.c: New file.
6716         * testsuite/ifuncmod6.c: New file.
6717         * testsuite/ifuncmain7.c: New file.
6718         * configure, testsuite/Makefile.in: Rebuild.
6719
6720 2010-08-18  Ian Lance Taylor  <iant@google.com>
6721
6722         * incremental.cc
6723         (Output_section_incremental_inputs::write_input_files): Add cast
6724         to avoid signed/unsigned comparison warning.
6725         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6726
6727 2010-08-12  Cary Coutant  <ccoutant@google.com>
6728
6729         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6730
6731 2010-08-13  Ian Lance Taylor  <iant@google.com>
6732
6733         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6734
6735 2010-08-12  Cary Coutant  <ccoutant@google.com>
6736             Doug Kwan  <dougkwan@google.com>
6737
6738         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6739         defintion overrides non-weak undef, remember that the original undef
6740         is not weak.
6741         * symtab.cc (Symbol_table::sized_write_global): For undef without
6742         an original weak binding, set binding to global in output.
6743         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6744         * testsuite/Makefile.in: Regenerate.
6745         * testsuite/strong_ref_weak_def.sh: New file.
6746         * testsuite/strong_ref_weak_def_1.c: Ditto.
6747         * testsuite/strong_ref_weak_def_2.c: Ditto.
6748
6749 2010-08-12  Cary Coutant  <ccoutant@google.com>
6750
6751         * testsuite/incremental_test.sh: Rewrite.
6752         * testsuite/incremental_test_1.c: Rewrite.
6753         * testsuite/incremental_test_2.c: Rewrite.
6754
6755 2010-08-12  Cary Coutant  <ccoutant@google.com>
6756
6757         * arm.cc (Target_arm::got_size): Add const.
6758         (Target_arm::got_entry_count): New function.
6759         (Target_arm::plt_entry_count): New function.
6760         (Target_arm::first_plt_entry_offset): New function.
6761         (Target_arm::plt_entry_size): New function.
6762         (Output_data_plt_arm::entry_count): New function.
6763         (Output_data_plt_arm::first_plt_entry_offset): New function.
6764         (Output_data_plt_arm::get_plt_entry_size): New function.
6765         * i386.cc (Target_i386::got_size): Add const.
6766         (Target_i386::got_entry_count): New function.
6767         (Target_i386::plt_entry_count): New function.
6768         (Target_i386::first_plt_entry_offset): New function.
6769         (Target_i386::plt_entry_size): New function.
6770         (Output_data_plt_i386::entry_count): New function.
6771         (Output_data_plt_i386::first_plt_entry_offset): New function.
6772         (Output_data_plt_i386::get_plt_entry_size): New function.
6773         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6774         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6775         * incremental.cc: Include target.h.
6776         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6777         parameter.  Adjust all callers.  Find incremental_got_plt section.
6778         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6779         section.
6780         (Output_section_incremental_inputs::set_final_data_size): Calculate
6781         size of incremental_got_plt section.
6782         (Output_section_incremental_inputs::do_write): Write the
6783         incremental_got_plt section.
6784         (Got_plt_view_info): New struct.
6785         (Local_got_offset_visitor): New class.
6786         (Global_got_offset_visitor): New class.
6787         (Global_symbol_visitor_got_plt): New class.
6788         (Output_section_incremental_inputs::write_got_plt): New function.
6789         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6790         Add parameter.  Adjust all callers.
6791         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6792         (Incremental_inputs::got_plt_section): New function.
6793         (Incremental_inputs::got_plt_section_): New data member.
6794         (Incremental_got_plt_reader): New class.
6795         * layout.cc (Layout::create_incremental_info_sections): Add the
6796         incremental_got_plt section.
6797         * object.h (Got_offset_list::get_list): New function.
6798         (Got offset_list::for_all_got_offsets): New function.
6799         (Sized_relobj::local_got_offset_list): New function.
6800         * powerpc.cc (Target_powerpc::got_size): Add const.
6801         (Target_powerpc::got_entry_count): New function.
6802         (Target_powerpc::plt_entry_count): New function.
6803         (Target_powerpc::first_plt_entry_offset): New function.
6804         (Target_powerpc::plt_entry_size): New function.
6805         (Output_data_plt_powerpc::entry_count): New function.
6806         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6807         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6808         * sparc.cc (Target_sparc::got_size): Add const.
6809         (Target_sparc::got_entry_count): New function.
6810         (Target_sparc::plt_entry_count): New function.
6811         (Target_sparc::first_plt_entry_offset): New function.
6812         (Target_sparc::plt_entry_size): New function.
6813         (Output_data_plt_sparc::entry_count): New function.
6814         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6815         (Output_data_plt_sparc::get_plt_entry_size): New function.
6816         * symtab.h (Symbol::got_offset_list): New function.
6817         (Symbol_table::for_all_symbols): New function.
6818         * target.h (Sized_target::got_entry_count): New function.
6819         (Sized_target::plt_entry_count): New function.
6820         (Sized_target::plt_entry_size): New function.
6821         * x86_64.cc (Target_x86_64::got_size): Add const.
6822         (Target_x86_64::got_entry_count): New function.
6823         (Target_x86_64::plt_entry_count): New function.
6824         (Target_x86_64::first_plt_entry_offset): New function.
6825         (Target_x86_64::plt_entry_size): New function.
6826         (Output_data_plt_x86_64::entry_count): New function.
6827         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6828         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6829
6830 2010-08-12  Cary Coutant  <ccoutant@google.com>
6831
6832         * archive.cc: Include incremental.h.
6833         (Archive::Archive): Initialize incremental_info_.
6834         (Archive::include_member): Record archive members in incremental info.
6835         (Add_archive_symbols::run): Record begin and end of an archive in
6836         incremental info.
6837         (Lib_group::include_member): Record objects in incremental info.
6838         * archive.h (Incremental_archive_entry): Forward declaration.
6839         (Archive::set_incremental_info): New member function.
6840         (Archive::incremental_info): New member function.
6841         (Archive::Unused_symbol_iterator): New class.
6842         (Archive::unused_symbols_begin): New member function.
6843         (Archive::unused_symbols_end): New member function.
6844         (Archive::incremental_info_): New data member.
6845         * incremental-dump.cc (find_input_containing_global): New function.
6846         (dump_incremental_inputs): Dump new incremental info sections.
6847         * incremental.cc: Include symtab.h.
6848         (Output_section_incremental_inputs): New class.
6849         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6850         new incremental info sections.
6851         (Sized_incremental_binary::do_check_inputs): Likewise.
6852         (Incremental_inputs::report_archive): Remove.
6853         (Incremental_inputs::report_archive_begin): New function.
6854         (Incremental_inputs::report_archive_end): New function.
6855         (Incremental_inputs::report_object): New function.
6856         (Incremental_inputs::finalize_inputs): Remove.
6857         (Incremental_inputs::report_input_section): New function.
6858         (Incremental_inputs::report_script): Rewrite.
6859         (Incremental_inputs::finalize): Do nothing but finalize string table.
6860         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6861         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6862         (Incremental_inputs::create_data_sections): New function.
6863         (Incremental_inputs::relocs_entsize): New function.
6864         (Output_section_incremental_inputs::set_final_data_size): New function.
6865         (Output_section_incremental_inputs::do_write): New function.
6866         (Output_section_incremental_inputs::write_header): New function.
6867         (Output_section_incremental_inputs::write_input_files): New function.
6868         (Output_section_incremental_inputs::write_info_blocks): New function.
6869         (Output_section_incremental_inputs::write_symtab): New function.
6870         * incremental.h (Incremental_script_entry): Forward declaration.
6871         (Incremental_object_entry): Forward declaration.
6872         (Incremental_archive_entry): Forward declaration.
6873         (Incremental_inputs): Forward declaration.
6874         (Incremental_inputs_header_data): Remove.
6875         (Incremental_inputs_header): Remove.
6876         (Incremental_inputs_header_write): Remove.
6877         (Incremental_inputs_entry_data): Remove.
6878         (Incremental_inputs_entry): Remove.
6879         (Incremental_inputs_entry_write): Remove.
6880         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6881         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6882         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6883         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6884         Likewise.
6885         (Incremental_input_entry): New class.
6886         (Incremental_script_entry): New class.
6887         (Incremental_object_entry): New class.
6888         (Incremental_archive_entry): New class.
6889         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6890         (Incremental_inputs::report_inputs): Remove.
6891         (Incremental_inputs::report_archive): Remove.
6892         (Incremental_inputs::report_archive_begin): New function.
6893         (Incremental_inputs::report_archive_end): New function.
6894         (Incremental_inputs::report_object): Change prototype.
6895         (Incremental_inputs::report_input_section): New function.
6896         (Incremental_inputs::report_script): Change prototype.
6897         (Incremental_inputs::get_reloc_count): New function.
6898         (Incremental_inputs::set_reloc_count): New function.
6899         (Incremental_inputs::create_data_sections): New function.
6900         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6901         (Incremental_inputs::inputs_section): New function.
6902         (Incremental_inputs::symtab_section): New function.
6903         (Incremental_inputs::relocs_section): New function.
6904         (Incremental_inputs::get_stringpool): Add const.
6905         (Incremental_inputs::command_line): Add const.
6906         (Incremental_inputs::inputs): Remove.
6907         (Incremental_inputs::command_line_key): New function.
6908         (Incremental_inputs::input_file_count): New function.
6909         (Incremental_inputs::input_files): New function.
6910         (Incremental_inputs::relocs_entsize): New function.
6911         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6912         (Incremental_inputs::finalize_inputs): Remove.
6913         (Incremental_inputs::Input_info): Remove.
6914         (Incremental_inputs::lock_): Remove.
6915         (Incremental_inputs::inputs_): Change type.
6916         (Incremental_inputs::inputs_map_): Remove.
6917         (Incremental_inputs::current_object_entry_): New data member.
6918         (Incremental_inputs::inputs_section_): New data member.
6919         (Incremental_inputs::symtab_section_): New data member.
6920         (Incremental_inputs::relocs_section_): New data member.
6921         (Incremental_inputs::reloc_count_): New data member.
6922         (Incremental_inputs_reader): New class.
6923         (Incremental_symtab_reader): New class.
6924         (Incremental_relocs_reader): New class.
6925         * layout.cc (Layout::finalize): Move finalization of incremental info
6926         and creation of incremental info sections to follow finalization of
6927         symbol table.  Set offsets for postprocessing sections.
6928         (Layout::create_incremental_info_sections): Call
6929         Incremental_inputs::create_data_sections.  Add incremental symtab
6930         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6931         sections to layout after input sections.
6932         * layout.h (struct Timespec): Forward declaration.
6933         (Layout::incremental_inputs): Add const.
6934         (Layout::create_incremental_info_sections): Add parameter.
6935         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6936         * object.cc: Include incremental.h.
6937         (Relobj::finalize_incremental_relocs): New function.
6938         (Sized_relobj::do_layout): Record input sections in incremental info.
6939         * object.h (Object::output_section): New function.
6940         (Object::output_section_offset): Moved from Relobj.
6941         (Object::get_incremental_reloc_base): New function.
6942         (Object::get_incremental_reloc_count): New function.
6943         (Object::do_output_section): New function.
6944         (Object::do_output_section_offset): Moved from Relobj.
6945         (Object::do_get_incremental_reloc_base): New function.
6946         (Object::do_get_incremental_reloc_count): New function.
6947         (Object::Object): Initialize new data members.
6948         (Relobj::output_section): Renamed do_output_section and moved to
6949         protected.
6950         (Relobj::output_section_offset): Moved to Object.
6951         (Relobj::do_get_incremental_reloc_base): New function.
6952         (Relobj::do_get_incremental_reloc_count): New function.
6953         (Relobj::allocate_incremental_reloc_counts): New function.
6954         (Relobj::count_incremental_reloc): New function.
6955         (Relobj::finalize_incremental_relocs): New function.
6956         (Relobj::next_incremental_reloc_index): New function.
6957         (Relobj::reloc_counts_): New data member.
6958         (Relobj::reloc_bases_): New data member.
6959         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6960         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6961         (Sized_relobj::incremental_relocs_scan): New function.
6962         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6963         (Sized_relobj::incremental_relocs_write): New function.
6964         (Sized_relobj::incremental_relocs_write_reltype): New function.
6965         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6966         incremental link.
6967         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6968         archives and object files elsewhere.
6969         (Add_symbols::run): Report object files here.
6970         (Finish_group::run): Report end of archive at end of group.
6971         * reloc.cc: Include layout.h, incremental.h.
6972         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6973         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6974         (Sized_relobj::incremental_relocs_scan): New function.
6975         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6976         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6977         (Sized_relobj::incremental_relocs_write): New function.
6978         (Sized_relobj::incremental_relocs_write_reltype): New function.
6979         * script.cc (read_input_script): Rewrite test for incremental link.
6980         Change call to Incremental_inputs::report_script.
6981         * symtab.h (Symbol_table::first_global_index): New function.
6982         (Symbol_table::output_count): New function.
6983
6984 2010-08-12  Doug Kwan  <dougkwan@google.com>
6985
6986         * arm.cc (Target_arm::merge_object_attributes): Check command line
6987         options --no-wchar-size-warning and --no-enum-size-warning.
6988         * options.h (General_options): Add ld-compatible options
6989         --no-enum-size-warning and --no-wchar-size-warning.
6990
6991 2010-08-04  Ian Lance Taylor  <iant@google.com>
6992
6993         * x86_64.cc (Target_x86_64::Scan::local): Use
6994         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
6995         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
6996         (Target_x86_64::Scan::global): Likewise.
6997         (Target_x86_64::Relocate::relocate): Likewise.
6998         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
6999         Likewise.
7000
7001 2010-08-03  Cary Coutant  <ccoutant@google.com>
7002
7003         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7004         to reserve space in merged_strings vector. Keep total input size
7005         for stats.
7006         (Output_merge_string::do_print_merge_stats): Print total input size.
7007         * merge.h (Output_merge_string): Add input_size_ field.
7008         * stringpool.cc (Stringpool_template::string_length): Move
7009         implementations out of Stringpool_template class and place in
7010         stringpool.h.
7011         * stringpool.h (string_length): Move out of Stringpool_template.
7012
7013 2010-08-03  Ian Lance Taylor  <iant@google.com>
7014
7015         PR 11712
7016         * layout.cc (relaxation_loop_body): If address of load segment is
7017         set, adjust address to include headers if possible.
7018
7019 2010-08-03  Ian Lance Taylor  <iant@google.com>
7020
7021         * version.cc (version_string): Bump to 1.10.
7022
7023 2010-08-03  Ian Lance Taylor  <iant@google.com>
7024
7025         PR 11805
7026         * layout.h (enum Output_section_order): Define.
7027         (class Layout): Update declarations.
7028         * layout.cc (Layout::get_output_section): Add order parameter.
7029         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7030         is_first_non_relro parameters.  Change all callers.
7031         (Layout::choose_output_section): Likewise.
7032         (Layout::add_output_section_data): Likewise.
7033         (Layout::make_output_section): Likewise.  Set order.
7034         (Layout::default_section_order): New function.
7035         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7036         * output.cc (Output_section::Output_section): Initialize order_.
7037         Don't initialize deleted fields.
7038         (Output_segment::Output_segment): Don't initialize deleted
7039         fields.
7040         (Output_segment::add_output_section_to_load): New function
7041         replacing add_output_section.  Change all callers to call this or
7042         add_output_section_to_nonload.
7043         (Output_segment::add_output_section_to_nonload): New function.
7044         (Output_segment::remove_output_section): Rewrite.
7045         (Output_segment::add_initial_output_data): Likewise.
7046         (Output_segment::has_any_data_sections): Likewise.
7047         (Output_segment::is_first_section_relro): Likewise.
7048         (Output_segment::maximum_alignment): Likewise.
7049         (Output_segment::has_dynamic_reloc): New function replacing
7050         dynamic_reloc_count.  Change all callers.
7051         (Output_segment::has_dynamic_reloc_list): New function replacing
7052         dynamic_reloc_count_list.  Change all callers.
7053         (Output_segment::set_section_addresses): Rewrite.
7054         (Output_segment::set_offset): Rewrite.
7055         (Output_segment::find_first_and_last_list): Remove.
7056         (Output_segment::set_tls_offsets): Rewrite.
7057         (Output_segment::first_section_load_address): Likewise.
7058         (Output_segment::output_section_count): Likewise.
7059         (Output_segment::section_with_lowest_load_address): Likewise.
7060         (Output_segment::write_section_headers): Likewise.
7061         (Output_segment::print_sections_to_map): Likewise.
7062         * output.h (class Output_data): Remove dynamic_reloc_count_
7063         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7064         (Output_data::add_dynamic_reloc): Rewrite.
7065         (Output_data::has_dynamic_reloc): New function.
7066         (Output_data::dynamic_reloc_count): Remove.
7067         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7068         is_last_relro_, is_first_non_relro_, is_interp_,
7069         is_dynamic_linker_section_ fields.  Add order and set_order
7070         functions.  Remove is_relro_local, set_is_relro_local,
7071         is_last_relro, set_is_last_relro, is_first_non_relro,
7072         set_is_first_non_relro functions, is_interp, set_is_interp,
7073         is_dynamic_linker_section, and set_is_dynamic_linker_section
7074         functions.
7075         (class Output_segment): Change Output_data_list from std::list to
7076         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7077         output_bss_ fields.  Update declarations.
7078
7079 2010-08-02  Ian Lance Taylor  <iant@google.com>
7080
7081         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7082         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7083         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7084
7085 2010-08-02  Ian Lance Taylor  <iant@google.com>
7086
7087         PR 11855
7088         * script.cc (Script_options::Script_options): Initialize
7089         symbol_definitions_ and symbol_references_.
7090         (Script_options::add_symbol_assignment): Update
7091         symbol_definitions_ and symbol_references_.
7092         (Script_options::add_symbol_reference): New function.
7093         (script_symbol): New function.
7094         * script.h (class Script_options): Add symbol_definitions_ and
7095         symbol_references_ fields.
7096         (Script_options::referenced_const_iterator): New type.
7097         (Script_options::referenced_begin): New function.
7098         (Script_options::referenced_end): New function.
7099         (Script_options::is_referenced): New function.
7100         (Script_options::any_unreferenced): New function.
7101         * script-c.h (script_symbol): Declare.
7102         * yyscript.y (exp): Call script_symbol.
7103         * symtab.cc: Include "script.h".
7104         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7105         Change all callers.  Check symbols referenced by scripts.
7106         (Symbol_table::add_undefined_symbols_from_command_line): Add
7107         layout parameter.  Change all callers.
7108         (Symbol_table::do_add_undefined_symbols_from_command_line):
7109         Likewise.  Break out loop body.  Check symbols referenced by
7110         scripts.
7111         (Symbol_table::add_undefined_symbol_from_command_line): New
7112         function broken out of
7113         do_add_undefined_symbols_from_command_line.
7114         * symtab.h (class Symbol_table): Update declarations.
7115         * archive.cc: Include "layout.h".
7116         (Archive::should_include_member): Add layout parameter.  Change
7117         all callers.  Check for symbol mentioned in expression.
7118         * archive.h (class Archive): Update declaration.
7119         * object.cc (Sized_relobj::do_should_include_member): Add layout
7120         parameter.
7121         * object.h (Object::should_include_member): Add layout parameter.
7122         Change all callers.
7123         (Object::do_should_include_member): Add layout parameter.
7124         (class Sized_relobj): Update declaration.
7125         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7126         parameter.
7127         * dynobj.h (class Sized_dynobj): Update declaration.
7128         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7129         layout parameter.
7130         * plugin.h (class Sized_pluginobj): Update declaration.
7131
7132 2010-08-02  Ian Lance Taylor  <iant@google.com>
7133
7134         PR 11866
7135         * output.cc (Output_segment::set_offset): Search for the first and
7136         last sections rather than assuming that the list is in order.
7137         (Output_segment::find_first_and_last_list): New function.
7138         * output.h (class Output_segment): Update declarations.
7139         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7140         (relro_strip_test_SOURCES): New variable.
7141         (relro_strip_test_DEPENDENCIES): New variable.
7142         (relro_strip_test_LDFLAGS): New variable.
7143         (relro_strip_test_LDADD): New variable.
7144         (relro_strip_test.so): New target.
7145
7146 2010-08-02  Ian Lance Taylor  <iant@google.com>
7147
7148         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7149         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7150         (Target_i386::got_tlsdesc_section): New function.
7151         (Target_i386::got_section): Create space for GOT entries for
7152         TLSDESC relocations.
7153         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7154         R_386_TLS_GOTDESC.
7155         (Target_i386::Scan::global): Likewise.
7156         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7157         using TLSDESC GOT.
7158         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7159         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7160         (Target_x86_64::got_tlsdesc_section): New function.
7161         (Target_x86_64::got_section): Create space for GOT entries for
7162         TLSDESC relocations.
7163         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7164         R_386_TLS_GOTDESC.
7165         (Target_x86_64::Scan::global): Likewise.
7166         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7167         using TLSDESC GOT.
7168
7169 2010-08-02  Ian Lance Taylor  <iant@google.com>
7170
7171         * testsuite/final_layout.sh: Use dc to convert from hex to
7172         decimal.
7173
7174 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7175
7176         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7177         paramter to the call to gold::gc_process_relocs.
7178         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7179         paramter to the call to gold::gc_process_relocs.
7180         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7181         parameter to the call to gold::gc_process_relocs.
7182         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7183         template parameter to the call to gold::gc_process_relocs.
7184         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7185         paramter to the call to gold::gc_process_relocs.
7186         * gc.h (get_embedded_addend_size): New function.
7187         (gc_process_relocs): Save the size of the reloc for use by ICF.
7188         * icf.cc (get_section_contents): Get the addend from the text section
7189         for SHT_REL relocation sections.
7190         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7191         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7192         * int_encoding.h (read_from_pointer): New overloaded function.
7193         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7194         * testsuite/icf_sht_rel_addend_test.sh: New file.
7195         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7196         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7197
7198 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7199
7200         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7201         * Makefile.in: Regenerate.
7202         * testsuite/Makefile.in: Regenerate.
7203
7204 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7205
7206         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7207         * gold/testsuite/debug_msg.cc: Likewise.
7208         * gold/testsuite/odr_violation1.cc
7209         * gold/testsuite/odr_violation2.cc
7210
7211 2010-07-21  Cary Coutant  <ccoutant@google.com>
7212
7213         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7214         string, and length fields.
7215         (Output_merge_string::Merged_strings_list): New type.
7216         (Output_merge_string::Merged_strings_lists): New typedef.
7217         (Output_merge_string): Replace merged_strings_ with
7218         merged_strings_lists_.
7219         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7220         Merged_strings_list per input object and section.  Don't store pointer
7221         to the string.  Don't store length with each merged string entry.
7222         (Output_merge_string::finalize_merged_data): Loop over list of merged
7223         strings lists.  Recompute length of each merged string.
7224
7225 2010-07-15  Cary Coutant  <ccoutant@google.com>
7226
7227         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7228         here.
7229
7230 2010-07-14  Ian Lance Taylor  <iant@google.com>
7231
7232         * descriptors.cc (Descriptors::open): Report correct name in error
7233         message.
7234
7235 2010-07-13  Doug Kwan  <dougkwan@google.com>
7236
7237         * arm.cc (Arm_input_section::Arm_input_section): For a
7238         SHT_ARM_EXIDX section, always keeps the input sections.
7239         (Arm_input_section::set_exidx_section_link): New method.
7240         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7241         has_errors_ to false.
7242         (Arm_exidx_input_section::has_errors,
7243         Arm_exidx_input_section::set_has_errors): New methods.
7244         (Arm_exidx_input_section::has_errors_): New data member.
7245         (Arm_relobj::get_exidx_shndx_list): New method.
7246         (Arm_output_section::append_text_sections_to_list): Do not skip
7247         section without SHF_EXECINSTR.
7248         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7249         errors.
7250         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7251         section header.  Make error messages more verbose.  Check for
7252         a non-executable section linked to an EXIDX section.
7253         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7254         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7255         check that there is no deferred EXIDX section if we exit early.
7256         Instead of not making an EXIDX section in case of an error, make one
7257         and set the has_errors flag of it.
7258         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7259         in a relocatable link.
7260         (Target_arm::do_relax): Look for the EXIDX output section instead of
7261         assuming that it is called .ARM.exidx.
7262         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7263         section list.  Do not check for SHF_EXECINSTR section flags but
7264         skip any input section with errors.
7265         * output.cc (Output_section::Output_section): Initialize
7266         always_keeps_input_sections_ to false.
7267         (Output_section::add_input_section): Check for
7268         always_keeps_input_sections_.
7269         *  output.h (Output_section::always_keeps_input_sections,
7270         Output_section::set_always_keeps_input_sections): New methods.
7271         (Output_section::always_keeps_input_sections): New data member.
7272
7273 2010-07-13  Rafael Espindola  <espindola@google.com>
7274
7275         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7276         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7277
7278 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7279             Ian Lance Taylor  <iant@google.com>
7280
7281         * output.h (Output_section_lookup_maps::add_merge_section):
7282         Correct check of whether value was inserted.
7283         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7284         (Output_section_lookup_maps::add_relaxed_input_section):
7285         Likewise.
7286         * arm.cc (Target_arm::got_section): Remove used local os.
7287         * i386.cc (Target_i386::got_section): Likewise.
7288         * x86_64.cc (Target_x86_64::got_section): Likewise.
7289         * sparc.cc (Target_sparc::got_section): Likewise.
7290         (Target_sparc::relocate): Remove unused local have_got_offset.
7291         * powerpc.cc (Target_powerpc::relocate): Likewise.
7292
7293 2010-07-13  Ian Lance Taylor  <iant@google.com>
7294
7295         * compressed_output.cc (zlib_decompress): Fix signature in
7296         !HAVE_ZLIB_H case.
7297
7298         * archive.cc (Archive::include_member): Unlock an external member
7299         of a thin archive.  Don't bother to delete an object we know is
7300         NULL.
7301
7302 2010-07-12  Cary Coutant  <ccoutant@google.com>
7303
7304         * compressed_output.cc (zlib_decompress): New function.
7305         (get_uncompressed_size): New function.
7306         (decompress_input_section): New function.
7307         * compressed_output.h (get_uncompressed_size): New function.
7308         (decompress_input_section): New function.
7309         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7310         Handle compressed debug sections.
7311         * layout.cc (is_compressed_debug_section): New function.
7312         (Layout::output_section_name): Map compressed section names to
7313         canonical names.
7314         * layout.h (is_compressed_debug_section): New function.
7315         (is_debug_info_section): Recognize compressed debug sections.
7316         * merge.cc: Include compressed_output.h.
7317         (Output_merge_data::do_add_input_section): Handle compressed
7318         debug sections.
7319         (Output_merge_string::do_add_input_section): Handle compressed
7320         debug sections.
7321         * object.cc: Include compressed_output.h.
7322         (Sized_relobj::Sized_relobj): Initialize new data members.
7323         (build_compressed_section_map): New function.
7324         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7325         * object.h (Object::section_is_compressed): New method.
7326         (Object::do_section_is_compressed): New method.
7327         (Sized_relobj::Compressed_section_map): New type.
7328         (Sized_relobj::do_section_is_compressed): New method.
7329         (Sized_relobj::compressed_sections_): New data member.
7330         * output.cc (Output_section::add_input_section): Handle compressed
7331         debug sections.
7332         * reloc.cc: Include compressed_output.h.
7333         (Sized_relobj::write_sections): Handle compressed debug sections.
7334
7335 2010-07-08  Cary Coutant  <ccoutant@google.com>
7336
7337         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7338         weak when resolving to a dynamic def.
7339         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7340         for weak undef/dynamic def cases. Adjust callers.
7341         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7342         undef_binding_weak_.
7343         (Symbol_table::sized_write_globals): Adjust symbol binding.
7344         (Symbol_table::sized_write_symbol): Add binding parameter.
7345         * symtab.h (Symbol::set_undef_binding): New method.
7346         (Symbol::is_undef_binding_weak): New method.
7347         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7348         (Symbol_table::should_override): Add new parameter.
7349         (Symbol_table::sized_write_symbol): Add new parameter.
7350
7351         * testsuite/weak_undef_file1.cc: Add new test case.
7352         * testsuite/weak_undef_file2.cc: Fix header comment.
7353         * testsuite/weak_undef_test.cc: Add new test case.
7354
7355 2010-06-29  Doug Kwan  <dougkwan@google.com>
7356
7357         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7358         Initialize USE_SYMBOL_.
7359         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7360         definition.
7361         (Arm_reloc_property::uses_symbol_): New data member declaration.
7362         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7363         uses symbol value and symbol is undefined but not weakly undefined.
7364
7365 2010-06-28  Rafael Espindola  <espindola@google.com>
7366
7367         * plugin.cc (Plugin::load): Use dlerror.
7368
7369 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7370
7371         * symtab.cc (detect_odr_violations): When reporting an ODR
7372         violation, report an object where the symbol is defined.
7373
7374 2010-06-25  Doug Kwan  <dougkwan@google.com>
7375
7376         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7377         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7378         definition.
7379         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7380         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7381         target hook to detect function points.
7382         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7383         * icf.h (Icf::check_section_for_function_pointers): Change type of
7384         parameter SECTION_NAME to const reference to std::string.  Use
7385         target hook to determine if section may have unsafe pointers.
7386         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7387         method definition.
7388
7389 2010-06-21  Rafael Espindola  <espindola@google.com>
7390
7391         * fileread.cc (Input_file::find_fie): New
7392         (Input_file::open): Use Input_file::find_fie.
7393         * fileread.h (Input_file::find_fie): New
7394         * plugin.cc (set_extra_library_path): New.
7395         (Plugin::load): Add set_extra_library_path to the transfer vector.
7396         (Plugin_manager::set_extra_library_path): New.
7397         (Plugin_manager::add_input_file): Use the extra search path if set.
7398         (set_extra_library_path(): New.
7399         * plugin.h (Plugin_manager): Add set_extra_library_path and
7400         extra_search_path_.
7401
7402 2010-06-19  Cary Coutant  <ccoutant@google.com>
7403
7404         * layout.cc (gdb_sections): Add .debug_types.
7405         (lines_only_debug_sections): Likewise.
7406
7407 2010-06-18  Rafael Espindola  <espindola@google.com>
7408
7409         * plugin.cc (add_input_file,add_input_library)
7410         (Plugin_manager::add_input_file): Make filename arguments const.
7411         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7412         const.
7413
7414 2010-06-16  Doug Kwan  <dougkwan@google.com>
7415
7416         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7417         .ARM.attributes section if we have not merged any input
7418         attributes sections.
7419
7420 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7421
7422         * arm.cc: Allow combining objects with no EABI version
7423         information.
7424
7425 2010-06-15  Rafael Espindola  <espindola@google.com>
7426
7427         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7428
7429 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7430
7431         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7432         (struct iovec): Correct !HAVE_READV definition.
7433
7434 2010-06-10  Cary Coutant  <ccoutant@google.com>
7435
7436         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7437         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7438         reloc sections.
7439         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7440
7441         PR 11683
7442         * symtab.h (Symbol::is_placeholder): New member function.
7443         * target-reloc.h (relocate_section): Check for placeholder symbols.
7444
7445         * testsuite/Makefile.am (plugin_test_8): New test.
7446         (plugin_test_9): New test.
7447         * testsuite/Makefile.in: Regenerate.
7448
7449 2010-06-09  Nick Clifton  <nickc@redhat.com>
7450
7451         * yyscript.y (input_list_element): Allow strings prefixed with
7452         the '-' character.  Treat these as libraries.
7453         * script.cc (script_add_library): New function.  Adds a library
7454         specified by "-l<name>" found in an input script.
7455         * script-c.h: Add prototype for script_add_library.
7456
7457 2010-06-07  Doug Kwan  <dougkwan@google.com>
7458
7459         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7460         Restrict stub-group size to be within long conditional branch
7461         range when working around cortex-A8 erratum.
7462
7463 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7464
7465         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7466         #ifdef typo.
7467
7468 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7469
7470         PR gold/11658
7471         * output.cc
7472         (Output_section::Input_section_sort_entry::compare_section_ordering):
7473         Change to return non-zero correctly.
7474         (Output_section::Input_section_sort_section_order_index_compare
7475         ::operator()): Change to fix ambiguity in comparisons.
7476
7477 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7478
7479         * gold.h (is_wildcard_string): New function.
7480         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7481         (Layout::layout_eh_frame): Ditto.
7482         (Layout::find_section_order_index): New method.
7483         (Layout::read_layout_from_file): New method.
7484         * layout.h (Layout::find_section_order_index): New method.
7485         (Layout::read_layout_from_file): New method.
7486         (Layout::input_section_position_): New private member.
7487         (Layout::input_section_glob_): New private member.
7488         * main.cc (main): Call read_layout_from_file here.
7489         * options.h (--section-ordering-file): New option.
7490         * output.cc (Output_section::input_section_order_specified_): New
7491         member.
7492         (Output_section::Output_section): Initialize new member.
7493         (Output_section::add_input_section): Add new parameter.
7494         Keep input sections when --section-ordering-file is used.
7495         (Output_section::set_final_data_size): Sort input sections when
7496         section ordering file is specified.
7497         (Output_section::Input_section_sort_entry): Add new parameter.
7498         Check sorting type.
7499         (Output_section::Input_section_sort_entry::compare_section_ordering):
7500         New method.
7501         (Output_section::Input_section_sort_compare::operator()): Change to
7502         consider section_order_index.
7503         (Output_section::Input_section_sort_init_fini_compare::operator()):
7504         Change to consider section_order_index.
7505         (Output_section::Input_section_sort_section_order_index_compare
7506         ::operator()): New method.
7507         (Output_section::sort_attached_input_sections): Change to sort
7508         according to section order when specified.
7509         (Output_section::add_input_section<32, true>): Add new parameter.
7510         (Output_section::add_input_section<64, true>): Add new parameter.
7511         (Output_section::add_input_section<32, false>): Add new parameter.
7512         (Output_section::add_input_section<64, false>): Add new parameter.
7513         * output.h (Output_section::add_input_section): Add new parameter.
7514         (Output_section::input_section_order_specified): New
7515         method.
7516         (Output_section::set_input_section_order_specified): New method.
7517         (Input_section::Input_section): Initialize section_order_index_.
7518         (Input_section::section_order_index): New method.
7519         (Input_section::set_section_order_index): New method.
7520         (Input_section::section_order_index_): New member.
7521         (Input_section::Input_section_sort_section_order_index_compare): New
7522         struct.
7523         (Output_section::input_section_order_specified_): New member.
7524         * script-sections.cc (is_wildcard_string): Delete and move modified
7525         method to gold.h.
7526         (Output_section_element_input::Output_section_element_input): Modify
7527         call to is_wildcard_string.
7528         (Output_section_element_input::Input_section_pattern
7529         ::Input_section_pattern): Ditto.
7530         (Output_section_element_input::Output_section_element_input): Ditto.
7531         * testsuite/Makefile.am (final_layout): New test case.
7532         * testsuite/Makefile.in: Regenerate.
7533         * testsuite/final_layout.cc: New file.
7534         * testsuite/final_layout.sh: New file.
7535
7536 2010-06-01  Rafael Espindola  <espindola@google.com>
7537
7538         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7539
7540 2010-06-01  Rafael Espindola  <espindola@google.com>
7541
7542         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7543         visibility of symbols.
7544
7545 2010-05-27  Doug Kwan  <dougkwan@google.com>
7546
7547         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7548         from start of output section instead of address for a local symbol
7549         in a merged or relaxed section when doing a relocatable link.
7550
7551 2010-05-26  Rafael Espindola  <espindola@google.com>
7552
7553         PR 11604
7554         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7555         adding sections the garbage collector removed.
7556         * gold/testsuite/Makefile.am: Add test.
7557         * gold/testsuite/Makefile.in: Regenerate.
7558         * gold/testsuite/plugin_test_7.sh: New.
7559         * gold/testsuite/plugin_test_7_1.c: New.
7560         * gold/testsuite/plugin_test_7_2.c: New.
7561
7562 2010-05-26  Rafael Espindola  <espindola@google.com>
7563
7564         * script-sections.cc (Output_section_definition::set_section_addresses):
7565         Check for --section-start.
7566
7567 2010-05-26  Doug Kwan  <dougkwan@google.com>
7568
7569         * arm.cc (Arm_scan_relocatable_relocs): New class.
7570         (Target_arm::relocate_special_relocatable): New method.
7571         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7572         (Arm_relocate_functions::thumb_branch_common): Same.
7573         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7574         instead of Default_scan_relocatable_relocs.
7575         * target-reloc.h (relocate_for_relocatable): Let target handle
7576         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7577         * target.h (Sized_target::relocate_special_relocatable): New method.
7578
7579 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7580
7581         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7582
7583 2010-05-23  Doug Kwan  <dougkwan@google.com>
7584
7585         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7586         instead of a cast.
7587         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7588         with a direct branch, not a conditional branch, to a stub.
7589         * merge.cc (Output_merge_base::record_input_section): New method
7590         defintion.
7591         (Output_merge_data::do_add_input_section): Record input section if
7592         keeps-input-sections flag is set.
7593         (Output_merge_string::do_add_input_section): Ditto.
7594         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7595         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7596         INPUT_SECTIONS_.
7597         (Output_merge_base::keeps_input_sections,
7598         Output_merge_base::set_keeps_input_sections,
7599         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7600         method definitions.
7601         (Output_merge_base::Input_sections): New type declaration.
7602         (Output_merge_base::input_sections_begin,
7603         Output_merge_base::input_sections_end,
7604         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7605         (Output_merge_base::bool keeps_input_sections_,
7606         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7607         Output_merge_base::input_sections_): New data members.
7608         (Output_merge_data::do_set_keeps_input_sections): New method
7609         defintion.
7610         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7611         * output.cc (Output_section::Input_section::relobj): Move method
7612         defintion from class declaration to here and handle merge sections.
7613         (Output_section::Input_section::shndx): Ditto.
7614         (Output_section::Output_section): Remove initializations of removed
7615         data members and initialize new data member LOOKUP_MAPS_.
7616         (Output_section::add_input_section): Set keeps-input-sections flag
7617         for a newly created merge output section as appropriate.  Adjust code
7618         to use Output_section_lookup_maps class.
7619         (Output_section::add_relaxed_input_section): Adjst code for lookup
7620         maps code refactoring.
7621         (Output_section::add_merge_input_section): Add a new parameter
7622         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7623         class.  If adding input section to a newly created merge output
7624         section fails, remove the new merge section.
7625         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7626         Adjust code for use of the Output_section_lookup_maps class.
7627         (Output_section::find_merge_section): Ditto.
7628         (Output_section::build_lookup_maps): New method defintion.
7629         (Output_section::find_relaxed_input_section): Adjust code to use
7630         Output_section_lookup_maps class.
7631         (Output_section::get_input_sections): Export merge sections.  Adjust
7632         code to use Output_section_lookup_maps class.
7633         (Output_section:::add_script_input_section): Adjust code to use
7634         Output_section_lookup_maps class.  Update lookup maps for merge
7635         sections also.
7636         (Output_section::discard_states): Use Output_section_lookup_maps.
7637         (Output_section::restore_states): Same.
7638         * output.h (Merge_section_properties): Move class defintion out of
7639         Output_section.
7640         (Output_section_lookup_maps): New class.
7641         (Output_section::Input_section::is_merge_section): New method
7642         defintion.
7643         (Output_section::Input_section::relobj): Move defintion out of class
7644         defintion.  Declare method only.
7645         (Output_section::Input_section::shndx): Ditto.
7646         (Output_section::Input_section::output_merge_base): New method defintion.
7647         (Output_section::Input_section::u2_.pomb): New union field.
7648         (Output_section::Merge_section_by_properties_map,
7649         Output_section::Output_section_data_by_input_section_map,
7650         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7651         Remove types.
7652         (Output_section::add_merge_input_section): Add new parameter
7653         KEEPS_INPUT_SECTIONS.
7654         (Output_section::build_lookup_maps): New method declaration.
7655         (Output_section::merge_section_map_,
7656         Output_section::merge_section_by_properties_map_,
7657         Output_section::relaxed_input_section_map_,
7658         Output_section::is_relaxed_input_section_map_valid_): Remove data
7659         members.
7660         (Output_section::lookup_maps_): New data member.
7661
7662 2010-05-21  Doug Kwan  <dougkwan@google.com>
7663
7664         PR gold/11619
7665         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7666         avoid a compilation error.
7667
7668 2010-05-19  Rafael Espindola  <espindola@google.com>
7669
7670         * script-sections.cc (Output_section_definition::allocate_to_segment):
7671         Update the phdrs_list even when the output section is NULL.
7672         * testsuite/Makefile.am: Add test.
7673         * testsuite/Makefile.in: Regenerate.
7674         * testsuite/script_test_9.cc: New.
7675         * testsuite/script_test_9.sh: New.
7676         * testsuite/script_test_9.t: New.
7677
7678 2010-05-19  Doug Kwan  <dougkwan@google.com>
7679
7680         * arm.cc (Arm_input_section::original_size): New method.
7681         (Arm_input_section::do_addralign): Add a cast.
7682         (Arm_input_section::do_output_offset): Remove static cast.
7683         (Arm_input_section::original_addralign,
7684          Arm_input_section::original_size_): Change type to uint32_t.
7685         (Arm_input_section::init): Add safe casts for section alignment
7686         and size.
7687         (Arm_input_section::set_final_data_size): Do not set address and
7688         offset of stub table.
7689         (Arm_output_section::fix_exidx_coverage): Change use of of
7690         Output_section::Simple_input_section to that of
7691         Output_section::Input_section.
7692         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7693         except for the first pass.
7694         * output.cc (Output_section::get_input_sections): Change type of
7695         input_sections to std::list<Input_section>.
7696         (Output_section::add_script_input_section): Rename from
7697         Output_section::add_simple_input_section.  Change type of SIS
7698         parameter from Simple_input_section to Input_section.
7699         * output.h (Output_section::Simple_input_section): Remove class.
7700         (Output_section::Input_section): Change class visibility to public.
7701         (Output_section::Input_section::addralign): Use stored alignments
7702         for special input sections if set.
7703         (Output_section::Input_section::set_addralign): New method.
7704         (Output_section::get_input_sections): Change parameter type from
7705         list of Simple_input_section to list of Input_section.
7706         (Output_section::add_script_input_section): Rename from
7707         Output_section::add_simple_input_section. Change first parameter's
7708         type from Simple_input_section to Input_section and remove the
7709         second and third parameters.
7710         * script-sections.cc (Input_section::Input_section_list): Change
7711         type to list of Output_section::Input_section/
7712         (Input_section_info::Input_section_info): Change parameter type of
7713         INPUT_SECTION to Output_section::Input_section.
7714         (Input_section_info::input_section): Change return type.
7715         (Input_section_info::input_section_): Change type to
7716         Output_section::Input_section.
7717         (Output_section_element_input::set_section_addresses): Adjust code
7718         to use Output_section::Input_section instead of
7719         Output_section::Simple_input_section.  Adjust code for renaming
7720         of Output_section::add_simple_input_section.
7721         (Orphan_output_section::set_section_addresses): Ditto.
7722
7723 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7724
7725         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7726         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7727
7728 2010-05-18  Rafael Espindola  <espindola@google.com>
7729
7730         * options.cc (General_options::finalize): Handle -nostdlib.
7731         * options.h (nostdlib): New option.
7732         * script.cc (script_add_search_dir): Handle -nostdlib.
7733
7734 2010-05-12  Doug Kwan  <dougkwan@google.com>
7735
7736         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7737         attributes section only if there no attributes section after merging.
7738         (Target_arm::merge_object_attributes): Move value of
7739         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7740         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7741         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7742         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7743         and arm_attr_merge_7.stdout.
7744         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7745         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7746         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7747         arm_attr_merge_7b.o): New rules.
7748         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7749         arm_attr_merge_7
7750         * testsuite/Makefile.in: Regenerate.
7751         * testsuite/arm_attr_merge.sh: New file.
7752         * testsuite/arm_attr_merge_[67][ab].s: Same.
7753
7754 2010-05-05  Nick Clifton  <nickc@redhat.com>
7755
7756         * po/es.po: Updated Spanish translation.
7757
7758 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7759
7760         * Makefile.am (install-exec-local): Properly install gold as
7761         default cross linker.
7762         * Makefile.in: Regenerated.
7763
7764 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7765             Nick Clifton  <nickc@redhat.com>
7766
7767         * configure.ac (install_as_default): Define and set to false
7768         unless --enable-gold or --enable-gold=both/gold has been
7769         specified.
7770         * configure: Regenerate.
7771
7772         * Makefile.am (install-exec-local): Install the executable as
7773         'ld.gold'.  If install_as_default is true then also install it as
7774         'ld'.
7775         * Makefile.in: Regenerated.
7776
7777 2010-04-24  Ian Lance Taylor  <iant@google.com>
7778
7779         * layout.cc (Layout::layout_reloc): In relocatable link don't
7780         combine reloc sections for grouped sections.
7781
7782 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7783
7784         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7785         sections that are not ordinary to icf.
7786         * icf.cc (get_section_contents): Handle relocation pointing to section
7787         with no object or shndx information.
7788         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7789         * testsuite/Makefile.in: Regenerate.
7790         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7791         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7792
7793 2010-04-22  Ian Lance Taylor  <iant@google.com>
7794
7795         * expression.cc (Expression::Expression_eval_info): Add
7796         result_alignment_pointer field.
7797         (Expression::eval_with_dot): Add result_alignment_pointer
7798         parameter.  Change all callers.
7799         (Expression::eval_maybe_dot): Likewise.
7800         (class Binary_expression): Add alignment_pointer parameter to
7801         left_value and right_value.  Change all callers.
7802         (BINARY_EXPRESSION): Set result alignment.
7803         (class Trinary_expression): Add alignment_pointer parameter to
7804         arg2_value and arg3_value.  Change all callers.
7805         (Trinary_cond::value): Set result alignment.
7806         (Max_expression::value, Min_expression::value): Likewise.
7807         (Align_expression::value): Likewise.
7808         * script-sections.cc (class Sections_element): Add dot_alignment
7809         parameter to set_section_addresses virtual function.  Update
7810         instantiations.
7811         (class Output_section_element): Likewise.
7812         (Script_sections::create_segments): Add dot_alignment parameter.
7813         Change all callers.
7814         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7815         (Script_sections::set_phdrs_clause_addresses): Likewise.
7816         * script-sections.h: Update declarations.
7817         * script.h: Update declarations.
7818         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7819         min_p_align.
7820         * testsuite/script_test_3.t: Set large alignment.
7821         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7822         segment has expected alignment.
7823
7824 2010-04-22  Nick Clifton  <nickc@redhat.com>
7825
7826         * po/gold.pot: Updated by the Translation project.
7827         * po/vi.po: Updated Vietnamese translation.
7828
7829 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7830
7831         * testsuite/Makefile.am (check_PROGRAMS): Add
7832         icf_virtual_function_folding_test.
7833         * testsuite/Makefile.in: Regenerated.
7834
7835 2010-04-15  Andrew Haley  <aph@redhat.com>
7836
7837         * options.h (merge_exidx_entries): New option.
7838         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7839         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7840         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7841         (Target_arm::merge_exidx_entries): New function.
7842         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7843         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7844         to Arm_exidx_fixup constructor.
7845         Add new arg, merge_exidx_entries.
7846         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7847         Arm_output_section::fix_exidx_coverage.
7848
7849 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7850
7851         * icf.cc (get_section_contents): Check for preemptible functions.
7852         Ignore addend when appropriate.
7853         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7854         section folded.
7855         (add_from_relobj): Check for section folded.
7856         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7857         * symtab.h (should_add_dynsym_entry): Add new parameter.
7858         * target-reloc.h (scan_relocs): Check for section folded.
7859         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7860         Check reloc types for function pointers in shared objects.
7861         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7862         case.
7863         (icf_preemptible_functions_test): New test case.
7864         (icf_string_merge_test): New test case.
7865         * testsuite.Makefile.in: Regenerate.
7866         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7867         bar_glob.  Refactor code.
7868         * testsuite/icf_preemptible_functions_test.cc: New file.
7869         * testsuite/icf_preemptible_functions_test.sh: New file.
7870         * testsuite/icf_string_merge_test.cc: New file.
7871         * testsuite/icf_string_merge_test.sh: New file.
7872         * testsuite/icf_virtual_function_folding_test.cc: New file.
7873         * testsuite/icf_virtual_function_folding_test.sh: New file.
7874
7875 2010-04-14  Doug Kwan  <dougkwan@google.com>
7876
7877         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7878         for local symbol recounting if we remove a section due to ICF.
7879         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7880         there are no regular objects in input.
7881
7882 2010-04-13  Doug Kwan  <dougkwan@google.com>
7883
7884         * arm.cc (Arm_input_section::set_final_data_size): Compute
7885         accurate final data size instead of using current data size.
7886
7887 2010-04-09  Doug Kwan  <dougkwan@google.com>
7888
7889         * layout.cc (Layout::choose_output_section): Handle script section
7890         types.
7891         (Layout::make_output_section_for_script): Add section type parameter.
7892         Handle script section types.
7893         * layout.h (Layout::make_output_section_for_script): Add section
7894         type parameter.
7895         * output.cc (Output_section::Output_section): Initialize data member
7896         is_noload_.
7897         (Output_section::do_reset_address_and_file_offset): Do not set address
7898         to 0 if section is a NOLOAD section.
7899         * output.h (Output_section::is_noload): New method.
7900         (Output_section::set_is_noload): Ditto.
7901         (Output_section::is_noload_): New data member.
7902         * script-c.h (Script_section_type): New enum type.
7903         (struct Parser_output_section_header): Add new file section_type.
7904         * script-sections.cc (Sections_element::output_section_name): Add
7905         parameter for returning script section type.
7906         (Output_section_definition::output_section_name): Ditto.
7907         (Output_section_definition::section_type)P; New method.
7908         (Output_section_definiton::script_section_type_name): Ditto.
7909         (Output_section_definition::script_section_type_): New data member.
7910         (Output_section_definition::Output_section_definition): Initialize
7911         data member Output_section_definition::script_section_type_.
7912         (Output_section_definition::create_sections): Pass script section type
7913         to Layout::make_output_section_for_script.
7914         (Output_section_definition::output_section_name): Return script
7915         section type to caller.
7916         (Output_section_definition::set_section_address): Do not advance
7917         dot value and load address if section type is NOLOAD.  Set address
7918         of NOLOAD sections regardless of section flags.
7919         (Output_section_definition::print): Print section type if it is
7920         not SCRIPT_SECTION_TYPE_NONE.
7921         (Output_section_definition::section_type): New method.
7922         (Output_section_definition::script_section_type_name): Ditto.
7923         (Script_sections::output_section_name): Add new parameter
7924         PSECTION_TYPE for returning script section type.  Pass it to
7925         section elements.  Handle discard sections.
7926         (Sort_output_sections::operator()): Handle NOLOAD sections.
7927         * script-sections.h (Script_sections::Section_type): New enum type.
7928         (Script_sections::output_section_name): Add a new parameter for
7929         returning script section type.
7930         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7931         INFO and NOLOAD.
7932         * yyscript.y (union): Add new field SECTION_TYPE.
7933         (COPY, DSECT, INFO, NOLOAD): New tokens.
7934         (opt_address_and_section_type): Change type to output_section_header.
7935         (section_type): New non-terminal
7936         (section_header): Handle section type.
7937         (opt_address_and_section_type): Return section type value.
7938
7939 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7940
7941         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7942         * testsuite/plugin_common_test_2.c (foo): Likewise.
7943
7944 2010-04-08  Doug Kwan  <dougkwan@google.com>
7945
7946         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7947         Output_merge_data.
7948         * output.cc (Output_section::add_merge_input_section): Simplify
7949         code and return status of Output_merge_base::add_input_section.
7950         Update merge section map only if Output_merge_base::add_input_section
7951         returns true.
7952
7953 2010-04-07  Doug Kwan  <dougkwan@google.com>
7954
7955         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7956         if section is marked as containing instructions but has no mapping
7957         symbols.
7958         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7959         correct section index.
7960         (Arm_relobj::find_linked_text_section): Ditto.
7961
7962 2010-04-07  Cary Coutant  <ccoutant@google.com>
7963
7964         * archive.cc (include_member): Destroy Read_symbols_data object before
7965         releasing file.
7966         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7967         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7968         (Read_symbols_data::~Read_symbols_data) New destructor.
7969         (Section_relocs::Section_relocs) New constructor.
7970         (Section_relocs::~Section_relocs) New destructor.
7971         (Read_relocs_data::Read_relocs_data) New constructor.
7972         (Read_relocs_data::~Read_relocs_data) New destructor.
7973         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7974         pointers to NULL after deleting.
7975
7976 2010-04-07  Doug Kwan  <dougkwan@google.com>
7977
7978         * arm.cc: Replace "endianity" with "endianness" in comments.
7979         (Arm_exidx_cantunwind): Ditto.
7980         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7981         (Arm_relobj::merge_flags_and_attributes): New method.
7982         (Arm_relobj::merge_flags_and_attributes_): New data member.
7983         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
7984         (Arm_relobj::scan_sections_for_stubs): Ditto.
7985         (Arm_relobj::do_read_symbols): Check to see if we really want to
7986         merge processor-specific flags and attributes.  Exit early if
7987         an object is empty except for section names and the undefined symbol.
7988         (Target_arm::do_finalize_sections): Move check for ELF format to
7989         Arm_relobj::do_read_symbols.  Merge processor specific flags and
7990         attributes from a regular object only when we have determined that
7991         it is aapropriate.  Do not create an .ARM.attributes section in
7992         output if there is no regular input object.
7993         (Target_arm::merge_processor_specific_flags): Check
7994         --warn-mismatch before printing any error.
7995         (Target_arm::merge_object_attributes): Ditto.
7996         * gold.cc (queue_middle_tasks): Handle the case in which there is
7997         no regular object in input.
7998         * options.cc (General_options::parse_EB): New method.
7999         (General_options::parse_EL): Same.
8000         (General_options::General_options): Initialize endianness_.
8001         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8002         New options.
8003         (General_options::Endianness): New enum.
8004         (General_options::endianness): New method.
8005         (General_options::endianness_): New data member.
8006         * parameters.cc (Parameters::set_options): Check target endianness.
8007         (Parameters::set_target_once): Ditto.
8008         (Parameters::check_target_endianness): New method.
8009         (parameters_force_valid_target): If either -EL or -EB is specified,
8010         use it to define endianness of default target.
8011         * parameters.h (Parameters::check_target_endianness): New method
8012         declaration.
8013         * target.h (class Target): Change "endianity" to "endianness"
8014         in comments.
8015
8016 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8017
8018         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8019         * configure: Regenerate.
8020         * Makefile.in: Regenerate.
8021         * testsuite/Makefile.in: Regenerate.
8022
8023 2010-04-06  Cary Coutant  <ccoutant@google.com>
8024
8025         gcc PR lto/42757
8026         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8027         prevailing definitions of common symbols.
8028         * testsuite/plugin_test_6.sh: New test case.
8029         * testsuite/plugin_common_test_1.c: New test case.
8030         * testsuite/plugin_common_test_2.c: New test case.
8031         * testsuite/Makefile.am (plugin_test_6): New test case.
8032         * testsuite/Makefile.in: Regenerate.
8033
8034 2010-04-06  Nick Clifton  <nickc@redhat.com>
8035
8036         * po/vi.po: New Vietnamese translation.
8037
8038 2010-03-30  Doug Kwan  <dougkwan@google.com>
8039
8040         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8041
8042 2010-03-25  Doug Kwan  <dougkwan@google.com>
8043
8044         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8045         to avoid a conversion warning on a 32-bit host.
8046
8047 2010-03-24  Ian Lance Taylor  <iant@google.com>
8048
8049         * testsuite/script_test_3.t: Add a TLS segment.
8050         * testsuite/Makefile.am (check_PROGRAMS): Add
8051         tls_phdrs_script_test.
8052         (tls_phdrs_script_test_SOURCES): Define.
8053         (tls_phdrs_script_test_DEPENDENCIES): Define.
8054         (tls_phdrs_script_test_LDFLAGS): Define.
8055         (tls_phdrs_script_test_LDADD): Define.
8056         * testsuite/Makefile.in: Rebuild.
8057
8058 2010-03-23  Cary Coutant  <ccoutant@google.com>
8059
8060         * fileread.cc (find_or_make_view): Fix comment.
8061
8062 2010-03-23  Ian Lance Taylor  <iant@google.com>
8063
8064         * script-sections.cc (class Orphan_section_placement): Define
8065         PLACE_TLS and PLACE_TLS_BSS.
8066         (Orphan_section_placement::Orphan_section_placement): Initialize
8067         new places.
8068         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8069         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8070         (tls_script_test_SOURCES): Define.
8071         (tls_script_test_DEPENDENCIES): Define.
8072         (tls_script_test_LDFLAGS): Define.
8073         (tls_script_test_LDADD): Define.
8074         * testsuite/Makefile.in: Rebuild.
8075
8076 2010-03-22  Doug Kwan  <dougkwan@google.com>
8077
8078         * arm.cc (Arm_relocate_functions::abs8,
8079         Arm_relocate_functions::abs16): Use correct check for overflow
8080         specified in the ARM ELF specs.
8081         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8082         target of a BLX instruction specially.
8083         (Reloc_stub::stub_type_for_reloc): Ditto.
8084         (Relocate::relocate): Use symbolic names instead of numeric relocation
8085         codes to report error.
8086         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8087         workaround.
8088         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8089         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8090         thumb2_blx_out_of_range.stdout
8091         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8092         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8093         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8094         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8095         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8096         thumb2_blx_in_range, thumb2_blx_in_range.o,
8097         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8098         thumb2_blx_out_of_range.o): New rules.
8099         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8100         thumb2_blx_in_range and thumb2_blx_out_of_range.
8101         * testsuite/Makefile.in: Regenerate.
8102         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8103         * testsuite/thumb_blx_in_range.s: New file.
8104         * testsuite/thumb_blx_out_of_range.s: New file.
8105
8106 2010-03-22  Rafael Espindola  <espindola@google.com>
8107
8108         * archive.cc (Should_include): Move to archive.h.
8109         (should_include_member): Make it a member of Archive.
8110         (Lib_group): New.
8111         (Add_lib_group_symbols): New.
8112         * archive.h: Include options.h.
8113         (Archive_member): Moved from Archive.
8114         (Should_include): Moved from archive.cc.
8115         (Lib_group): New.
8116         (Add_lib_group_symbols): New.
8117         * dynobj.cc (do_should_include_member): New.
8118         * dynobj.h (do_should_include_member): New.
8119         * gold.cc (queue_initial_tasks): Update call to queue.
8120         * main.cc (main): Print lib group stats.
8121         * object.cc (do_should_include_member): New.
8122         * object.h: Include archive.h.
8123         (Object::should_include_member): New.
8124         (Object::do_should_include_member): New.
8125         (Sized_relobj::do_should_include_member): New.
8126         * options.cc (General_options::parse_start_lib): New.
8127         (General_options::parse_end_lib): New.
8128         (Input_arguments::add_file): Handle lib groups.
8129         (Input_arguments::start_group): Check we are not in a lib.
8130         (Input_arguments::start_lib): New.
8131         (Input_arguments::end_lib): New.
8132         * options.h (General_options): Add start_lib and end_lib.
8133         (Input_argument::lib_): New.
8134         (Input_argument::lib): New.
8135         (Input_argument::is_lib): New.
8136         (Input_file_lib): New.
8137         (Input_arguments::in_lib_): New.
8138         (Input_arguments::in_lib): New.
8139         (Input_arguments::start_lib): New.
8140         (Input_arguments::end_lib_): New.
8141         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8142         in unused members as preempted.
8143         (Sized_pluginobj::do_should_include_member): New.
8144         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8145         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8146         return the blocker.
8147         (Read_symbols::do_whole_lib_group): New.
8148         (Read_symbols::do_lib_group): New.
8149         (Read_symbols::do_read_symbols): Handle lib groups.
8150         (Read_symbols::get_name): Handle lib groups.
8151         * readsyms.h (Read_symbols): Add an archive member pointer.
8152         (Read_symbols::do_whole_lib_group): New.
8153         (Read_symbols::do_lib_group): New.
8154         (Read_symbols::member_): New.
8155         * script.cc (read_input_script): Update call to queue_soon.
8156
8157 2010-03-19  Doug Kwan  <dougkwan@google.com>
8158
8159         * arm.cc (Stub_table::Stub_table): Initialize new data members
8160         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8161         (Stub_table::add_reloc_stub): Assign stub offset and update
8162         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8163         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8164         New data members.
8165         (Stub_table::update_data_size_and_addralign): Use
8166         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8167         instead of going over all reloc stubs.
8168         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8169         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8170         Stringpool_template::offset_ to size of Stringpool_char.
8171         (Stringpool_template::new_key_offset): Remove code to initialize
8172         Stringpool_template::offset_.
8173         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8174         Stringpool_template::offset_ to zero.
8175
8176 2010-03-15  Doug Kwan  <dougkwan@google.com>
8177
8178         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8179         offset_.
8180         (Stringpool_template::new_key_offset): New method.
8181         (Stringpool_template::add_string): Assign offsets when adding new
8182         strings.
8183         (Stringpool_template::set_string_offsets): Do not set string offsets
8184         when not optimizing.
8185         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8186         member size_.
8187         (Chunked_vector::clear): Clear size_.
8188         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8189         (Chunked_vector::size): Return size_.
8190         (Chunked_vector::push_back): Use size_ to find insert position.
8191         (Chunked_vector::size_): New data member.
8192         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8193         (Stringpool_template::new_key_offset): New method declaration.
8194         (Stringpool_template::offset_): New data member.
8195
8196 2010-03-15   Rafael Espindola  <espindola@google.com>
8197
8198         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8199         Add_symbols' constructor.
8200         * readsyms.h (Add_symbols): Remove the input_group member.
8201
8202 2010-03-10  Ian Lance Taylor  <iant@google.com>
8203
8204         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8205         target to ask whether a reference to a symbol requires a stack
8206         split.
8207         * target.h (Target::is_call_to_non_split): New function.
8208         (Target::do_is_call_to_non_split): Declare virtual function.
8209         * target.cc: Include "symtab.h".
8210         (Target::do_is_call_to_non_split): New function.
8211         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8212
8213 2010-03-10  Cary Coutant  <ccoutant@google.com>
8214
8215         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8216         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8217         (File_read::open[2]): Add whole_file_view_ to list of views.
8218         (File_read::make_view): Remove test of whole_file_view_.
8219         (File_read::find_or_make_view): Create whole_file_view_ if
8220         necessary.
8221         (File_read::clear_views): Replace bool parameter with enum;
8222         adjust all callers.  Don't delete views with permanent data;
8223         do delete cached views and views from archives if
8224         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8225         if clearing the corresponding view.
8226         * fileread.h (File_read::Clear_views_mode): New enum.
8227         (File_read::View::is_permanent_view): New method.
8228         (File_read::clear_views): Replace bool parameter
8229         with enum; adjust all callers.
8230         * options.h (General_options): Change keep_files_mapped option;
8231         add map_whole_files.
8232         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8233         releasing the file.
8234         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8235         the file.
8236
8237 2010-03-10  David S. Miller  <davem@davemloft.net>
8238
8239         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8240
8241 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8242
8243         * icf.cc (get_section_contents): Add '@' marker after processing the
8244         merge reloc.
8245
8246 2010-03-08  Doug Kwan  <dougkwan@google.com>
8247
8248         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8249         due to a conversion warning.
8250         (Arm_relobj::update_output_local_symbol_count): Check for local
8251         symbol with unset output index.
8252
8253 2010-03-05  Ian Lance Taylor  <iant@google.com>
8254
8255         * options.h (class General_options): Add --spare-dynamic-tags.
8256         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8257         --spare-dynamic-tags.
8258
8259 2010-03-05  Ian Lance Taylor  <iant@google.com>
8260
8261         * incremental.cc: Include "libiberty.h".
8262
8263 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8264
8265         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8266         function, is_info_ member.
8267         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8268         (Versions::Versions): Update caller.
8269         (Versions::define_base_version): Likewise.
8270         (Versions::add_def): Likewise.
8271
8272 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8273
8274         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8275         (Scan::possible_function_pointer_reloc): New function.
8276         (Scan::local_reloc_may_be_function_pointer): Change to call
8277         possible_function_pointer_reloc.
8278         (Scan::global_reloc_may_be_function_pointer): Ditto.
8279         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8280         relocations in ".data.rel.ro._ZTV" section.
8281         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8282         * testsuite/icf_safe_so_test.cc: Ditto.
8283         * testsuite/icf_safe_test.cc: Ditto.
8284         * testsuite/icf_safe_test.sh: Ditto.
8285
8286 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8287             Ian Lance Taylor  <iant@google.com>
8288
8289         * target-reloc.h (relocate_section): Check the symbol table index
8290         for -1U before setting the local symbol index.
8291         (scan_relocatable_relocs): If copying the relocation, record that
8292         the local symbol is required.
8293         * object.h (Symbol_value::is_output_symtab_index_set): New
8294         function.
8295         (Symbol_value::may_be_discarded_from_output_symtab): New
8296         function.
8297         (Symbol_value::has_output_symtab_entry): New function.
8298         (Symbol_value::needs_output_symtab_entry): Remove.
8299         (Symbol_value::output_symtab_index): Make sure the symbol index is
8300         set.
8301         (Symbol_value::set_output_symtab_index): Make sure the symbol
8302         index is not set.  Make sure the new index is valid.
8303         (Symbol_value::set_must_have_output_symtab_entry): New function.
8304         (Symbol_value::has_output_dynsym_entry): New function.
8305         (Symbol_value::set_output_dynsym_index): Make sure the new index
8306         is valid.
8307         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8308         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8309         local symbol if permitted.
8310         (Sized_relobj::do_finalize_local_symbols): Call
8311         is_output_symtab_index_set rather than needs_output_symtab_entry.
8312         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8313         rather than needs_output_symtab_entry.  Call
8314         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8315         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8316         is_output_symtab_index_set rather than needs_output_symtab_entry.
8317         * testsuite/discard_locals_relocatable_test.c: New file.
8318         * testsuite/discard_locals_test.sh: Test -r.
8319         * testsuite/Makefile.am (check_DATA): Add
8320         discard_locals_relocatable_test1.syms,
8321         discard_local_relocatable_test2.syms.
8322         (MOSTLYCLEANFILES): Likewise.  Also add
8323         discard_locals_relocatable_test1.lout and
8324         discard_locals_relocatable_test2.out.
8325         (discard_locals_relocatable_test1.syms): New target.
8326         (discard_locals_relocatable_test.o): New target.
8327         (discard_locals_relocatable_test1.out): New target.
8328         (discard_locals_relocatable_test2.syms): New target.
8329         (discard_locals_relocatable_test2.out): New target.
8330         (various): Add missing ../ld-new dependencies.
8331         * testsuite/Makefile.in: Rebuild.
8332
8333 2010-03-03  Nick Clifton  <nickc@redhat.com>
8334
8335         * po/fi.po: New Finnish translation.
8336
8337 2010-03-01  Doug Kwan  <dougkwan@google.com>
8338
8339         * layout.cc (Layout::Layout): Force section types of .init_array*,
8340         .preinit_array* and .fini_array* sections.
8341         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8342         Fix check of return value of std::string::find.().
8343         (Output_section::Input_section_sort_compare::operator()): Remove
8344         comment about .init_array.
8345         (Output_section::Input_section_sort_init_fini_compare::operator()):
8346         New method.
8347         (Output_section::sort_attached_input_sections): Handle .init_array
8348         and .fini_array specially.
8349         * output.h (Output_section::Inut_section_sort_compare): Update
8350         comment.
8351         (Output_section::Input_section_sort_init_fini_compare): New struct.
8352
8353 2010-02-26  Doug Kwan  <dougkwan@google.com>
8354
8355         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8356         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8357         * testsuite/debug_msg.sh: Avoid matching source line number for
8358         use of global variable undef_int.
8359
8360 2010-02-26  Doug Kwan  <dougkwan@google.com>
8361
8362         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8363         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8364         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8365         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8366         * options.cc (General_options::General_options): Initialize member
8367         fix_v4bx_.
8368         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8369         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8370         and rm_no_fix_v4bx.stdout
8371         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8372         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8373         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8374         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8375         and arm_no_fix_v4bx.
8376         * Makefile.in: Regenerate.
8377         * testsuite/arm_fix_v4bx.s: New file.
8378         * testsuite/arm_fix_v4bx.sh: Ditto.
8379
8380 2010-02-24  Doug Kwan  <dougkwan@google.com>
8381
8382         * arm.cc (Target_arm::got_section): Make the .got section the first
8383         non RELRO section in the data segment.
8384         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8385         suffixes of section names.
8386
8387 2010-02-24  Doug Kwan  <dougkwan@google.com>
8388
8389         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8390         flags and attributes merging if an input file is a binary file.
8391         * fileread.cc (Input_file::open): Record format of original file.
8392         * fileread.h (Input_file::Format): New enum type.
8393         (Input_file::Input_file): Initialize data member format_.
8394         (Input_file::format): New method definition.
8395         (Input_file::format_):: New data member.
8396
8397 2010-02-24  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Arm_output_data_got): New class.
8400         (ARM_TCB_SIZE): New constant
8401         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8402         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8403         If user uses a script with a SECTIONS clause, issue only a warning
8404         for a misplaced EXIDX input section.  Otherwise, issue an error.
8405         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8406         garbage collection.
8407         (Target_arm::got_mode_index_entry): Handle static linking.
8408         (Target_arm::Scan::local): Ditto.
8409         (Target_arm::Scan::global): Ditto.
8410         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8411         all incorrectly implemented relocations.
8412         (Target_arm::fix_exidx_coverage): Pass layout to
8413         Arm_output_section::fix_exidx_coverage.
8414         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8415         from ".ARM.exidx." and ".ARM.extab.".
8416
8417 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8418
8419         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8420         section if it does not already exist.
8421         * attributes.cc (Attributes_section_data::Attributes_section_data):
8422         Don't crash if size is zero.
8423
8424 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8425             Ian Lance Taylor  <iant@google.com>
8426
8427         * gold.cc (queue_middle_tasks): If no input files were opened,
8428         exit.
8429         * workqueue.h (Task_function::Task_function): Assert that there is
8430         a blocker.
8431
8432 2010-02-22  Doug Kwan  <dougkwan@google.com>
8433
8434         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8435         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8436         types to avoid warnings due to different uint64_t implementations
8437         on different hosts.
8438
8439 2010-02-21  Doug Kwan  <dougkwan@google.com>
8440
8441         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8442         handling of the maximum backward branch offset.
8443         (Arm_relocate_functions::thumb_branch_common): Ditto.
8444         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8445         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8446         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8447         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8448         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8449         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8450         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8451         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8452         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8453         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8454         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8455         thumb2_bl_out_of_range.o): New rules.
8456         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8457         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8458         thumb2_bl_out_of_range
8459         * testsuite/Makefile.in: Regenerate.
8460         * testsuite/arm_bl_in_range.s: New file.
8461         * testsuite/arm_bl_out_of_range.s: Ditto.
8462         * testsuite/arm_branch_in_range.sh: Ditto.
8463         * testsuite/arm_branch_range.t: Ditto.
8464         * testsuite/thumb2_branch_range.t: Ditto.
8465         * testsuite/thumb_bl_in_range.s: Ditto.
8466         * testsuite/thumb_bl_out_of_range.s: Ditto.
8467         * testsuite/thumb_branch_range.t: Ditto.
8468
8469 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8470
8471         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8472         Add reloc offset information.
8473         * icf.cc (get_section_contents): Change iterators to point to the new
8474         vectors. Add reloc offset information to the contents.
8475         * icf.h (Icf::Sections_reachable_info): New typedef.
8476         (Icf::Sections_reachable_list): New typedef.
8477         (Icf::Offset_info): New typedef.
8478         (Icf::Reloc_info): New struct typedef.
8479         (Icf::Reloc_info_list): New typedef.
8480         (Icf::symbol_reloc_list): Delete method.
8481         (Icf::addend_reloc_list): Delete method.
8482         (Icf::section_reloc_list): Delete method.
8483         (Icf::reloc_info_list): New method.
8484         (Icf::reloc_info_list_): New member.
8485
8486 2010-02-19  Doug Kwan  <dougkwan@google.com>
8487
8488         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8489         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8490         * arm.cc (Arm_relocation_functions): New forward declaration.
8491         (Target_arm::Target_arm): Initialize new data members
8492         got_mod_index_offset_ and tls_base_symbol_defined_.
8493         (Target_arm::Relocate::relocate_tls): New method.
8494         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8495          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8496         New methods.
8497         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8498         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8499         (Target_arm::got_mod_index_offset_,
8500         Target_arm::tls_base_symbol_defined_): New data members.
8501         (Target_arm::Scan::local, Target::Scan::global,
8502         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8503         relocations.
8504
8505 2010-02-18  Doug Kwan  <dougkwan@google.com>
8506
8507         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8508         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8509         text section as a parameter becuase some broken tools may not set
8510         the link in section header.
8511         (Target_arm::has_got_section): New method.
8512         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8513         without any mapping symbol as data only.  Remove warning.
8514         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8515         link in its section header, try to discover the link by inspecting the
8516         REL31 relocation at the beginning of the section.
8517         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8518         in error message.
8519         (Target_arm::Scan::global): Treat any reference to the symbol
8520         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8521
8522 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8523
8524         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8525         (Scan::global_reloc_may_be_function_pointer): New function.
8526         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8527         (Scan::global_reloc_may_be_function_pointer): New function.
8528         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8529         (Scan::global_reloc_may_be_function_pointer): New function.
8530         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8531         (Scan::global_reloc_may_be_function_pointer): New function.
8532         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8533         (Scan::global_reloc_may_be_function_pointer): New function.
8534         (Scan::possible_function_pointer_reloc): New function.
8535         (Target_x86_64::can_check_for_function_pointers): New function.
8536         * gc.h (gc_process_relocs): Scan relocation types to determine if
8537         function pointers were taken for targets that support it.
8538         * icf.cc (Icf::find_identical_sections): Include functions for
8539         folding in safe ICF whose pointer is not taken.
8540         * icf.h (Secn_fptr_taken_set): New typedef.
8541         (fptr_section_id_): New member.
8542         (section_has_function_pointers): New function.
8543         (set_section_has_function_pointers): New function.
8544         (check_section_for_function_pointers): New function.
8545         * options.h: Fix comment for safe ICF option.
8546         * target.h (can_check_for_function_pointers): New function.
8547         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8548         Modify icf_safe_test for X86-64.
8549         * testsuite/Makefile.in: Regenerate.
8550         * testsuite/icf_safe_so_test.cc: New file.
8551         * testsuite/icf_safe_so_test.sh: New file.
8552         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8553         (main): Change to take pointer to function kept_func_3.
8554         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8555         folding is done correctly for X86-64.
8556
8557 2010-02-12  David S. Miller  <davem@davemloft.net>
8558
8559         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8560         is_symbolless parameter.
8561         (Output_reloc<SHT_REL>::is_symbolless): New.
8562         (Output_reloc<SHT_REL>::is_symbolless_): New.
8563         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8564         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8565         (Output_reloc<SHT_RELA>::is_symbolless): New.
8566         (Output_data_reloc::add_global): Handle is_symbolless.
8567         (Output_data_reloc::add_global_relative): Likewise.
8568         (Output_data_reloc::add_local): Likewise.
8569         (Output_data_reloc::add_local_relative): Likewise.
8570         (Output_data_reloc::add_symbolless_global_addend): New.
8571         (Output_data_reloc::add_symbolless_local_addend): New.
8572         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8573         is_symbolless.
8574         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8575         instead of ->is_relative_
8576         (Output_reloc::write): Likewise.
8577         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8578         (Output_reloc::write_rel): Simplify.
8579
8580         * sparc.cc (Target_sparc::Scan::local): Use
8581         ->add_symbolless_local_addend as needed.
8582         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8583         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8584         based upon relocation offset.
8585
8586 2010-02-11  Doug Kwan  <dougkwan@google.com>
8587
8588         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8589         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8590         beginning of function.
8591         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8592         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8593         parameter is_32bit in calls to should_apply_static_reloc.
8594         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8595         (check_DATA): Add arm_abs_global.stdout.
8596         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8597         arm_abs_global.stdout): New rules.
8598         (MOSTLLYCLEANFILES): Add arm_abs_global
8599         * Makefile.in: Regenerate.
8600         * testsuite/arm_abs_global.s: New file.
8601         * testsuite/arm_abs_global.sh: Ditto.
8602         * testsuite/arm_abs_lib.s: Ditto.
8603
8604 2010-02-11  Ian Lance Taylor  <iant@google.com>
8605
8606         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8607         Read_relocs task.
8608         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8609         Allocate_commons_task first.
8610         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8611         task, rather than symtab_lock_.
8612         (Gc_process_relocs::~Gc_process_relocs): New function.
8613         (Gc_process_relocs::is_runnable): Check this_blocker_.
8614         (Gc_process_relocs::locks): Use next_blocker_ rather than
8615         blocker_.
8616         (Scan_relocs::~Scan_relocs): New function.
8617         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8618         symtab_lock_.
8619         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8620         next_blocker_.
8621         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8622         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8623         constructor accordingly.
8624         (class Gc_process_relocs): Likewise.
8625         (class Scan_relocs): Likewise.
8626         * common.h (class Allocate_commons_task): Remove symtab_lock_
8627         field, and corresponding constructor parameter.
8628         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8629         symtab_lock_.
8630         (Allocate_commons_task::locks): Likewise.
8631
8632 2010-02-11  Ian Lance Taylor  <iant@google.com>
8633
8634         * gold-threads.h (class Once): Define.
8635         (class Initialize_lock): Rewrite as child of Once.
8636         * gold-threads.cc (class Once_initialize): Define.
8637         (once_pointer_control): New static variable.
8638         (once_pointer, once_arg): New static variables.
8639         (c_run_once): New static function.
8640         (Once::Once, Once::run_once, Once::internal_run): New functions.
8641         (class Initialize_lock_once): Remove.
8642         (initialize_lock_control): Remove.
8643         (initialize_lock_pointer): Remove.
8644         (initialize_lock_once): Remove.
8645         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8646         (Initialize_lock::initialize): Rewrite.
8647         (Initialize_lock::do_run_once): New function.
8648         * archive.cc (Archive::interpret_header): Only clear name if it is
8649         not already empty.
8650         * fileread.cc: Include "gold-threads.h"
8651         (file_counts_lock): New static variable.
8652         (file_counts_initialize_lock): Likewise.
8653         (File_read::release): Only increment counts when using --stats.
8654         Use a lock around the increment.
8655         * parameters.cc (class Set_parameters_target_once): Define.
8656         (set_parameters_target_once): New static variable.
8657         (Parameters::Parameters): Move here from parameters.h.
8658         (Parameters::set_target): Rewrite.
8659         (Parameters::set_target_once): New function.
8660         (Parameters::clear_target): Move here and rewrite.
8661         * parameters.h (class Parameters): Update declarations.  Add
8662         set_parameters_target_once_ field.
8663         (Parameters::Parameters): Move to parameters.cc.
8664         (Parameters::clear_target): Likewise.
8665         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8666         task.
8667         (Start_group::~Start_group): New function.
8668         (Start_group::is_runnable): New function.
8669         (Start_group::locks, Start_group::run): New functions.
8670         (Finish_group::run): Change saw_undefined to size_t.
8671         * readsyms.h (class Start_group): Define.
8672         (class Finish_group): Change saw_undefined_ field to size_t.
8673         (Finish_group::Finish_group): Remove saw_undefined and
8674         this_blocker parameters.  Change all callers.
8675         (Finish_group::set_saw_undefined): New function.
8676         (Finish_group::set_blocker): New function.
8677         * symtab.h (class Symbol_table): Change saw_undefined to return
8678         size_t.  Change saw_undefined_ field to size_t.
8679         * target-select.cc (Set_target_once::do_run_once): New function.
8680         (Target_selector::Target_selector): Initialize set_target_once_
8681         field.  Don't initialize lock_ and initialize_lock_ fields.
8682         (Target_selector::instantiate_target): Rewrite.
8683         (Target_selector::set_target): New function.
8684         * target-select.h (class Set_target_once): Define.
8685         (class Target_selector): Update declarations.  Make
8686         Set_target_once a friend.  Remove lock_ and initialize_lock_
8687         fields.  Add set_target_once_ field.
8688
8689 2010-02-10  Ian Lance Taylor  <iant@google.com>
8690
8691         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8692         queueing any tasks.
8693         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8694         (queue_middle_tasks): Add all blockers before queueing any tasks.
8695         (queue_final_tasks): Likewise.
8696         * token.h (Task_token::add_blockers): New function.
8697         * object.h (Input_objects::number_of_relobjs): New function.
8698
8699 2010-02-10  Ian Lance Taylor  <iant@google.com>
8700
8701         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8702         shared, not if not position independent.
8703         * x86_64.cc (Relocate::relocate_tls): Likewise.
8704         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8705         (tls_pie_pic_test): New target.
8706         * testsuite/Makefile.in: Rebuild.
8707
8708         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8709         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8710         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8711         * testsuite/Makefile.in: Rebuild.
8712
8713 2010-02-09  David S. Miller  <davem@davemloft.net>
8714
8715         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8716         R_SPARC_RELATIVE using ->add_local_relative().
8717         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8718
8719         * output.h (Output_data_dynamic::add_section_size): New method
8720         that takes two Output_data objects.
8721         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8722         entry param.  Handle it in initializers.
8723         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8724         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8725         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8726         arg.
8727         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8728         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8729         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8730         for dynrel_includes_plt.
8731         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8732         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8733         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8734         before .rela.plt
8735         (Target_sparc::do_finalize_sections): Update to pass true for
8736         dynrel_includes_plt.
8737         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8738         output before .rela.plt
8739         (Target_powerpc::do_finalize_sections): Update to pass true for
8740         dynrel_includes_plt when 32-bit.
8741
8742 2010-02-08  Doug Kwan  <dougkwan@google.com>
8743
8744         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8745         method.
8746         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8747         Arm_relobj::scan_section_for_cortex_a8_stubs,
8748         Arm_relobj::do_relocation_section): Instead of calling
8749         Output_section::output_address, use faster
8750         Arm_relobj::simple_input_section_output_address.
8751
8752 2010-02-08  David S. Miller  <davem@davemloft.net>
8753
8754         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8755         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8756         relocation helper function.
8757
8758         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8759         just like R_SPARC_GOT{10,13,22}.
8760         (Target_sparc::Scan::local): Likewise.
8761         (Target_sparc::Relocate:relocate): Likewise.
8762
8763 2010-02-06  Ian Lance Taylor  <iant@google.com>
8764
8765         * configure.ac: Rewrite targetobjs duplicate removal code to use
8766         only shell constructs.
8767         * configure: Rebuild.
8768
8769 2010-02-05  Doug Kwan  <dougkwan@google.com>
8770
8771         PR 11247
8772         * arm.cc (Arm_relobj::section_is_scannable): New method.
8773         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8774         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8775
8776 2010-02-04  Doug Kwan  <dougkwan@google.com>
8777
8778         PR 11247
8779         * arm-reloc-property.cc (cstdio): Include.
8780         * configure.ac (targetobjs): Remove duplicates.
8781         * configure: Regenerate.
8782         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8783         big and little endian version for a given address size.
8784
8785 2010-02-03  Doug Kwan  <dougkwan@google.com>
8786
8787         * arm-reloc-property.cc
8788         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8789         definition.
8790         * arm-reloc-property.h
8791         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8792         New method definition.
8793         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8794         declaration.
8795         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8796         overflow to N.
8797         (GOT_PREL): Change implemented to Y.
8798         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8799         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8800         (Arm_relocate_functions::movw_abs_nc): Remove method.
8801         (Arm_relocate_functions::movt_abs): Ditto.
8802         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8803         (Arm_relocate_functions::thm_movt_abs): Ditto.
8804         (Arm_relocate_functions::movw_rel_nc): Ditto.
8805         (Arm_relocate_functions::movw_rel): Ditto.
8806         (Arm_relocate_functions::movt_rel): Ditto.
8807         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8808         (Arm_relocate_functions:thm_movw_rel): Ditto.
8809         (Arm_relocate_functions:thm_movt_rel): Ditto.
8810         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8811         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8812         New method definitions.
8813         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8814         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8815         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8816         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8817         (Target_arm::Relocate::relocate): Check for non-static or
8818         unimplemented relocation code and exit early.  Change calls to
8819         Target_arm::reloc_uses_thumb_bit and
8820         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8821         instead.  Refactor code to handle similar relocations to increase
8822         code sharing.  Remove check for unsupported relocation code in switch
8823         statement.
8824         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8825         relocation property table to find out size.  Change error message to
8826         print out the name of a relocation code instead of the numeric value.
8827         (Target_arm::scan_reloc_for_stub): Use relocation property table
8828         instead of calling Target_arm::reloc_uses_thumb_bit().
8829
8830 2010-02-02  Doug Kwan  <dougkwan@google.com>
8831
8832         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8833         types of relaxed input section.
8834
8835 2010-02-02  Doug Kwan  <dougkwan@google.com>
8836
8837         * Makefile.am (HFILES): Add arm-reloc-property.h.
8838         (DEFFILES): New.
8839         (TARGETSOURCES): Add arm-reloc-property.cc
8840         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8841         (libgold_a_SOURCES): $(DEFFILES)
8842         * Makefile.in: Regenerate.
8843         * arm-reloc-property.cc: New file.
8844         * arm-reloc-property.h: New file.
8845         * arm-reloc.def: New file.
8846         * arm.cc: Update comments.
8847         (arm-reloc-property.h): New included header.
8848         (arm_reloc_property_table): New global variable.
8849         (Target_arm::do_select_as_default_target): New method definition.
8850         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8851         arm-reloc-property to targ_extra_obj.
8852         * parameters.cc (set_parameters_target): Call
8853         Target::select_as_default_target().
8854         * target.h (Target::select_as_default_target): New method definition.
8855         (Target::do_select_as_default_target): Same.
8856
8857 2010-02-01  Doug Kwan  <dougkwan@google.com>
8858
8859         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8860         first_output_text_section_.
8861         (Arm_exidx_fixup::first_output_text_section): New method definition.
8862         (Arm_exidx_fixup::first_output_text_section_): New data member.
8863         (Arm_exidx_fixup::process_exidx_section): Record the first text
8864         output section seen.
8865         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8866         and entsize in output section header.
8867
8868 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8869
8870         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8871         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8872         (Arm_relocate_functions::thm_alu11): New Method.
8873         (Arm_relocate_functions::thm_pc8): New Method.
8874         (Arm_relocate_functions::thm_pc12): New Method.
8875         (Target_arm::Scan::local): Handle the relocations.
8876         (Target_arm::Scan::global): Likewise.
8877         (Target_arm::Relocate::relocate): Likewise.
8878         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8879
8880 2010-01-29  Doug Kwan  <dougkwan@google.com>
8881
8882         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8883         of relocation types as ld.
8884
8885 2010-01-29  Doug Kwan  <dougkwan@google.com>
8886
8887         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8888         to public.
8889         (Arm_relocate_functions::thumb_branch_common): Ditto.
8890         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8891         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8892         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8893         Arm_relocate_functions::jump24): Remove.
8894         (Target_arm::Relocate::relocate): Adjust code to call
8895         Arm_relocation_functions::arm_branch_common and
8896         Arm_relocation_functions::thumb_branch_common instead of their removed
8897         wrappers.  Merge switch-cases together to reduce source code size.
8898
8899 2010-01-29  Doug Kwan  <dougkwan@google.com>
8900
8901         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8902         output_local_symbol_count_needs_update_.
8903         (Arm_relobj::output_local_symbol_count_needs_update,
8904          Arm_relobj::set_output_local_symbol_count_needs_update,
8905          Arm_relobj::update_output_local_symbol_count): New methods.
8906         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8907         member.
8908         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8909         of pointed function as in a R_ARM_PREL31 relocation.
8910         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8911         for output local symbol count updating.
8912         (Target_arm::do_relax): Update output local symbol counts in objects
8913         if necessary.
8914         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8915
8916 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8917
8918         * arm.cc: Added support for the ARM relocations:
8919         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8920         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8921         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8922         movw_prel_nc).
8923         (Arm_relocate_functions::movw_rel): New method.
8924         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8925         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8926         thm_movw_prel_nc).
8927         (Arm_relocate_functions::thm_movw_rel): New method.
8928         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8929         thm_movt_prel).
8930         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8931         relocations.
8932         (Target_arm::Scan::global): Likewise.
8933         (Target_arm::Relocate::relocate): Likewise.
8934         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8935         Likewise.
8936
8937 2010-01-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8938
8939         * arm.cc: Added support for ARM group relocations.
8940         (Target_arm::reloc_needs_sym_origin): New method.
8941         (Arm_relocate_functions::calc_grp_kn): New method.
8942         (Arm_relocate_functions::calc_grp_residual): New method.
8943         (Arm_relocate_functions::calc_grp_gn): New method.
8944         (Arm_relocate_functions::arm_grp_alu): New Method.
8945         (Arm_relocate_functions::arm_grp_ldr): New Method.
8946         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8947         (Arm_relocate_functions::arm_grp_ldc): New Method.
8948         (Target_arm::Scan::local): Handle the ARM group relocations.
8949         (Target_arm::Scan::global): Likewise.
8950         (Target_arm::Relocate::relocate): Likewise.
8951         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8952         Likewise.
8953
8954 2010-01-26  Doug Kwan  <dougkwan@google.com>
8955
8956         * arm.cc (set): Include.
8957         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8958         pointer type.
8959         (Arm_output_section::Text_section_list): New type.
8960         (Arm_output_section::append_text_sections_to_list): New method.
8961         (Arm_output_section::fix_exidx_coverage): Ditto.
8962         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8963         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8964         Relobj::set_section_offset() instead of
8965         Sized_relobj::invalidate_section_offset().
8966         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8967         parameter for section headers. Ignore relocation sections for
8968         unallocated sections and EXIDX sections.
8969         (Target_arm::fix_exidx_coverage): New method.
8970         (Target_arm::output_section_address_less_than): New type.
8971         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8972         linked text section instead of the EXIDX section.
8973         (Arm_output_section::create_stub_group): Add an assertion to check
8974         that this is not an EXIDX output section.
8975         (Arm_output_section::append_text_sections_to_list): New method.
8976         (Arm_output_section::fix_exidx_coverage): Ditto.
8977         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8978         Arm_relobj::section_needs_reloc_stub_scanning.
8979         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8980         first pass.
8981         (Target_arm::fix_exidx_coverage): New method.
8982         * object.h (Relobj::set_output_section): New method.
8983         (Sized_relobj::invalidate_section_offset): Remove method.
8984         (Sized_relobj::do_invalidate_section_offset): Remove method.
8985         (Sized_relobj::do_set_section_offset): Handle offset value -1.
8986
8987 2010-01-25  Doug Kwan  <dougkwan@google.com>
8988
8989         * arm.cc (Arm_exidx_merged_section::do_output_offset):
8990         Fix warning due to signed and unsigned comparison on a 32-bit host.
8991
8992 2010-01-22  Doug Kwan  <dougkwan@google.com>
8993
8994         * arm.cc (Target_arm::do_relax): Record an output section for section
8995         offset adjustment it contains any stub table that has changed.
8996         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
8997         offsets in an output section if necessary.
8998         * output.cc (Output_section::Output_section): Initialize
8999         section_offsets_need_adjustments_.
9000         (Output_section::add_input_section_for_script): Renamed to
9001         Output_section::add_simple_input_section.
9002         (Output_section::save_states): Add a comment.
9003         (Output_section::discard_states): New method defintion.
9004         (Output_section::adjust_section_offsets): Same.
9005         * output.h (Output_section::add_input_section_for_script): Renamed to
9006         Output_section::add_simple_input_section.
9007         (Output_section::discard_states): New method declaration.
9008         (Output_section::adjust_section_offsets): Same.
9009         (Output_section::section_offsets_need_adjustment,
9010         Output_section::set_section_offsets_need_adjustment): New method
9011         definitions.
9012         (Output_section::section_offsets_need_adjustment_): New data member.
9013         * script-sections.cc
9014         (Output_section_element_input::set_section_address): Adjust code for
9015         renaming of Output_section::add_input_section_for_script.
9016         (Orphan_output_section::set_section_address): Same.
9017
9018 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9019
9020         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9021         Fix_v4bx enum values .
9022         * gold/options.h (General_options): New option definitions.
9023         (General_options::fix_v4bx): New method.
9024         (General_options::Fix_v4bx): New enum.
9025         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9026         (General_options::parse_fix_v4bx_interworking): New method.
9027
9028 2010-01-22  Doug Kwan  <dougkwan@google.com>
9029
9030         * arm.cc (Arm_exidx_fixup): New class.
9031
9032 2010-01-21  Doug Kwan  <dougkwan@google.com>
9033
9034         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9035         classes.
9036         (Arm_exidx_section_offset_map): New type.
9037
9038 2010-01-21  Doug Kwan  <dougkwan@google.com>
9039
9040         * arm.cc (Arm_exidx_input_section): New class.
9041         (Arm_relobj::exidx_input_section_by_link,
9042         Arm_relobj::exidx_input_section_by_shndx,
9043         Arm_relobj::make_exidx_input_section): New methods.
9044         (read_arm_attributes_section): Remove.
9045         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9046         information about them.
9047         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9048         to here.
9049
9050 2010-01-20  Doug Kwan  <dougkwan@google.com>
9051
9052         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9053         Input_section_specifier to Section_id.
9054         (Target_arm::new_arm_input_section: Adjust code for change of key
9055         type.
9056         (Target_arm::find_arm_input_section): Ditto.
9057         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9058         (Section_id): Remove.
9059         (Garbage_collection::Section_id_hash): Remove.
9060         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9061         (Section_id): Remove.
9062         (Icf::Section_id_hash): Remove.
9063         * object.h (Section_id, Const_section_id, Section_id_hash,
9064         Const_section_id_hash): New type definitions.
9065         * output.cc (Output_section::add_relaxed_input_section): Change to
9066         use Const_section_id instead of Input_section_specifier as key type.
9067         (Output_section::add_merge_input_section): Ditto.
9068         (Output_section::build_relaxation_map): Change to use Section_id
9069         instead of Input_section_specifier as key type.
9070         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9071         Ditto.
9072         (Output_section::convert_input_sections_to_relaxed_sections): Change
9073         to use Const_section_id instead of Input_section_specifier as key type.
9074         (Output_section::find_merge_section): Ditto.
9075         (Output_section::find_relaxed_input_section): Ditto.
9076         * output.h (Input_section_specifier): Remove class.
9077         (Output_section::Output_section_data_by_input_section_map): Change
9078         key type to Const_section_id.
9079         (Output_section::Output_relaxed_input_section_by_input_section_map):
9080         Ditto.
9081         (Output_section::Relaxation_map): Change key type to Section_id.
9082
9083 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9084
9085         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9086         (class Arm_v4bx_stub): New class.
9087         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9088         (Stub_factory::make_arm_v4bx_stub): New method.
9089         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9090         (Stub_table::empty): Handle v4bx stubs.
9091         (Stub_table::add_arm_v4bx_stub): New method.
9092         (Stub_table::find_arm_v4bx_stub): New method.
9093         (Arm_relocate_functions::v4bx): New method.
9094         (Target_arm::fix_v4bx): New method.
9095         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9096         (Stub_table::relocate_stubs): Likewise.
9097         (Stub_table::do_write): Likewise.
9098         (Stub_table::update_data_size_and_addralign): Likewise.
9099         (Stub_table::finalize_stubs):  Likewise.
9100         (Target_arm::Scan::local): Likewise.
9101         (Target_arm::Scan::global): Likewise.
9102         (Target_arm::do_finalize_sections): Likewise.
9103         (Target_arm::Relocate::relocate): Likewise.
9104         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9105         Likewise.
9106         (Target_arm::scan_reloc_for_stub): Likewise.
9107         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9108
9109 2010-01-19  Ian Lance Taylor  <iant@google.com>
9110
9111         * output.cc (Output_section_headers::do_sized_write): Write large
9112         segment count to sh_info field.
9113         (Output_file_header::do_sized_write): For large segment count,
9114         write PN_XNUM to e_phnum field.
9115
9116 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9117
9118         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9119         (Arm_relocate_functions::thm_jump8): New function.
9120         (Arm_relocate_functions::thm_jump11): New function.
9121         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9122         R_ARM_THM_JUMP11.
9123         (Target_arm::Scan::global): Likewise.
9124         (Target_arm::Relocate::relocate): Likewise.
9125         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9126         Likewise.
9127
9128 2010-01-14  Doug Kwan  <dougkwan@google.com>
9129
9130         * arm.cc (map, utility): Include headers.
9131         (Target_arm::apply_cortex_a8_workaround): New method.
9132         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9133         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9134         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9135         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9136         the --[no-]fix-cortex-a8 command line options.
9137         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9138         (Target_arm::relocate_stub): Use addend in instruction template.
9139         * options.h (DEFINE_bool): Set the user-set flag.
9140         (General_options): Add --[no-]-fix-cortex options.
9141         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9142         : Update fast look-up map after conversion.
9143
9144 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9145
9146         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9147         in the first pass of do_layout.
9148
9149 2010-01-13  Doug Kwan  <dougkwan@google.com>
9150
9151         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9152         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9153         apparent compiler problem of not folding static constant integral
9154         data members of elfcpp::Elf_sizes<32>.
9155
9156 2010-01-13  Doug Kwan  <dougkwan@google.com>
9157
9158         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9159         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9160         Arm_relobj::scan_section_for_cortex_a8_erratum,
9161         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9162         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9163         sections to scan for relocation stubs into a new method
9164         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9165         relocation and Cortex-A8 stub scanning.
9166         (Target_arm::do_relax): Force stubs to be after stubbed sections
9167         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9168         the beginning of a new relaxation pass.  Update a comment.
9169         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9170
9171 2010-01-12  Ian Lance Taylor  <iant@google.com>
9172
9173         * target-reloc.h (visibility_error): New inline function.
9174         (relocate_section): Call visibility_error.
9175         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9176         (MOSTLYCLEANFILES): Likewise.
9177         (protected_4_pic.o, protected_3.err): New targets.
9178         * testsuite/protected_4.cc: New file.
9179
9180 2010-01-12  Doug Kwan  <dougkwan@google.com>
9181
9182         * arm.cc (Cortex_a8_reloc): New class.
9183         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9184         and cortex_a8_relocs_info_.
9185         (Target_arm::fix_cortex_a8): New method definition.
9186         (Target_arm::Cortex_a8_relocs_info): New type.
9187         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9188         New data member declarations.
9189         (Target_arm::scan_reloc_for_stub): Record information about
9190         relocations for THUMB branches that might be exempted from the
9191         Cortex-A8 workaround.
9192         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9193         at the beginning of a relaxation pass.
9194
9195 2010-01-12  Doug Kwan  <dougkwan@google.com>
9196
9197         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9198         (Arm_relobj::Mapping_symbol_position,
9199          Arm_reloj::Mapping_symbol_position_less,
9200          Arm_relobj::Mapping_symbols_info): New types.
9201         (Target_arm::is_mapping_symbol_name): New method definition.
9202         (Arm_relobj::do_count_local_symbols): Save information about mapping
9203         symbols.
9204
9205 2010-01-11  Doug Kwan  <dougkwan@google.com>
9206
9207         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9208         Arm_relocate_functions::thumb32_branch_upper,
9209         Arm_relocate_functions::thumb32_branch_lower,
9210         Arm_relocate_functions::thumb32_cond_branch_offset,
9211         Arm_relocate_functions::thumb32_cond_branch_upper,
9212         Arm_relocate_functions::thumb32_cond_branch_lower,
9213         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9214         branch offset encoding.
9215         (Arm_relocate_functions::thumb_branch_common): Use new branch
9216         offset encoding methods to avoid code duplication.
9217         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9218         (Stub_addend_reader::operator()): Use new branch encoding method
9219         to avoid code duplication.
9220
9221 2010-01-11  Doug Kwan  <dougkwan@google.com>
9222
9223         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9224         (Target_arm::do_finalize_sections): Define special EXIDX section
9225         symbols only if referenced.
9226         * gc.h (Garbage_collection::add_reference): New method.
9227         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9228         code duplication.
9229
9230 2010-01-11  Ian Lance Taylor  <iant@google.com>
9231
9232         * script.cc (Version_script_info::build_expression_list_lookup):
9233         Change complaing about duplicate wildcard match from error to
9234         warning.
9235
9236         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9237         of 2009-12-30.
9238         (Version_script_info::Version_script_info): Initialize globs_,
9239         default_version_, default_is_global_, and exact_.  Don't
9240         initialize globals_ or locals_.
9241         (Version_script_info::build_lookup_tables): Build local symbols
9242         first.
9243         (Version_script_info::unquote): New function.
9244         (Version_script_info::add_exact_match): New function.
9245         (Version_script_info::build_expression_list_lookup): Remove lookup
9246         parameter.  Add is_global parameter.  Change all callers.  Handle
9247         wildcard pattern specially.  Unquote pattern.  Call
9248         add_exact_match.
9249         (Version_script_info::get_name_to_match): New function.
9250         (Version_script_info::get_symbol_version): New function.
9251         (Version_script_info::get_symbol_version_helper): Remove.
9252         (Version_script_info::check_unmatched_names): Call unquote.
9253         * script.h (class Version_script_info): Change get_symbol_version
9254         to be non-inline and add is_global parameter; change all callers.
9255         Rewrite symbol_is_local.  Update declarations.  Define struct
9256         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9257         Remove globals_ and locals_ members.  Add exact_, globs_,
9258         default_version_, is_global_.
9259         (Version_script_info::Glob): Remove pattern, add expression and
9260         is_global.  Update constructor.  Change all callers.
9261         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9262         default version.
9263         (Versions::symbol_section_contents): If a symbol is undefined, or
9264         defined in a dynamic object, set the version index to
9265         VER_NDX_LOCAL.
9266         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9267         symbol_is_local.
9268         (Symbol_table::add_from_pluginobj): Likewise.
9269         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9270
9271 2010-01-11  Doug Kwan  <dougkwan@google.com>
9272
9273         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9274         (incremental_dump_LDADD): Add linking option for libintl.
9275         * Makefile.in: Regenerate.
9276
9277 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9278
9279         PR gold/11144
9280         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9281         instead of -Ds.
9282         * testsuite/Makefile.in: Regenerated.
9283
9284 2010-01-10  Doug Kwan  <dougkwan@google.com>
9285
9286         * options.h (DEFINE_var): Use parentheses around argument varname__
9287         in macro body to avoid any unintended subsequent substitutions.
9288
9289 2010-01-10  Ian Lance Taylor  <iant@google.com>
9290
9291         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9292         candidates before doing symbol resolution.
9293
9294         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9295         ODR candidates if only one is weak.
9296
9297 2010-01-08  Ian Lance Taylor  <iant@google.com>
9298
9299         * script.cc (Version_script_info::build_expression_list_lookup):
9300         Don't warn about ambiguous version, just record the ambiguity.
9301         (Version_script_info::get_symbol_version_helper): Give error if
9302         version is ambiguous.
9303
9304 2010-01-08  Doug Kwan  <dougkwan@google.com>
9305
9306         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9307         prev_data_size_ and prev_addralign_.  Remove initializer for
9308         deleted data member has_been_changed_.
9309         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9310         to determine if the table is empty.
9311         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9312         Remove.
9313         (Stub_table::add_reloc_stub): Define method in class definition
9314         instead of just declaring it there.
9315         (Stub_table::add_cortex_a8_stub): New method definition.
9316         (Stub_table::update_data_size_and_addralign): Ditto.
9317         (Stub_table::finalize_stubs): Ditto.
9318         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9319         (Stub_table::do_addralign_): Return address alignment in the
9320         (Stub_table::do_reset_address_and_file_offset): Define method in
9321         class definition instead of declaring it there.  Set current data
9322         size to be the data size of the previous pass.
9323         (Stub_table::set_final_data_size): Use current data size as the
9324         final data size.
9325         (Stub_table::relocate_stub): Change parameter type of stub from
9326         Reloc_stub pointer to Stub pointer.
9327         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9328         (Stub_table::Cortex_a8_stub_list): New typedef.
9329         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9330          Stub_table::prev_addralign_): New data member.
9331         (Arm_relobj::Arm_relobj): Initialize data member
9332         section_has_cortex_a8_workaround_.
9333         (Arm_relobj::section_has_cortex_a8_workaround,
9334          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9335          definitions.
9336         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9337         declarations.
9338         (Target_arm::relocate_stub): Change parameter type of stub from
9339         Reloc_stub pointer to Stub pointer.
9340         (Insn_template::size, Insn_template::alignment): Handle
9341         THUMB16_SPECIAL_TYPE.
9342         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9343          Stub_table::update_data_size_and_addralign,
9344          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9345         definitions.
9346         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9347         (Stub_table::do_write): Ditto.
9348         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9349
9350 2010-01-08  Ian Lance Taylor  <iant@google.com>
9351
9352         PR 11108
9353         * symtab.h (class Symbol): Remove fields is_target_special_ and
9354         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9355         (Symbol::is_defined_in_discarded_section): New function.
9356         (Symbol::set_is_defined_in_discarded_section): New function.
9357         (Symbol::has_plt_offset): Rewrite.
9358         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9359         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9360         Don't initialize is_target_special_ or has_plt_offset_.
9361         Initialize is_defined_in_discarded_section_.
9362         (Symbol_table::add_from_relobj): If appropriate, set
9363         is_defined_in_discarded_section.
9364         * resolve.cc (Symbol::override_base_with_special): Don't test
9365         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9366         * target-reloc.h (relocate_section): Do special handling for
9367         symbols defined in discarded sections for global symbols as well
9368         as local symbols.
9369
9370 2010-01-08  Ian Lance Taylor  <iant@google.com>
9371
9372         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9373         the SHT_SYMTAB case.
9374
9375 2010-01-08  Ian Lance Taylor  <iant@google.com>
9376
9377         * object.cc (Sized_relobj::do_layout): Don't get confused if
9378         layout_eh_frame returns NULL.
9379
9380 2010-01-08  Ian Lance Taylor  <iant@google.com>
9381
9382         PR 11084
9383         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9384         dynamic symbol table, use the normal symbol table.
9385         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9386         symbol table.
9387
9388 2010-01-08  Ian Lance Taylor  <iant@google.com>
9389
9390         PR 11072
9391         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9392         sections.
9393
9394 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9395
9396         * version.cc (print_version): Change to "Copyright 2010".
9397
9398 2010-01-08  Ian Lance Taylor  <iant@google.com>
9399
9400         PR 10287
9401         PR 11063
9402         * i386.cc (class Target_i386): Change return type of plt_section
9403         to be non-const.
9404         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9405         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9406         tls_desc_rel_ field.
9407         (Output_data_plt_i386::rel_tls_desc): New function.
9408         (Target_i386::rel_tls_desc_section): New function.
9409         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9410         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9411         R_386_TLS_DESC reloc in rel_tls_desc_section.
9412         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9413         Define struct Tlsdesc_info.
9414         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9415         (Target_x86_64::do_reloc_symbol_index): New function.
9416         (Target_x86_64::add_tlsdesc_info): New function.
9417         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9418         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9419         tlsdesc_rel_ field.
9420         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9421         all callers.
9422         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9423         (Target_x86_64::rela_tlsdesc_section): New function.
9424         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9425         handling.
9426         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9427         (Target_x86_64::do_reloc_addend): New function.
9428         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9429         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9430         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9431         (Output_reloc::type): New function.
9432         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9433         (Output_reloc::is_target_specific): New function.
9434         (Output_reloc::target_arg): New function.
9435         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9436         absolute relocs and target specific relocs.
9437         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9438         add_target_specific.
9439         (class Output_data_reloc) [SHT_RELA]: Likewise.
9440         * output.cc (Output_reloc::Output_reloc): Add four new versions
9441         for absolute relocs and target specific relocs.
9442         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9443         (Output_reloc::get_symbol_index): Likewise.
9444         (Output_reloc::local_section_offset): Check that local_sym_index_
9445         is not TARGET_CODE or 0.
9446         (Output_reloc::symbol_value): Likewise.
9447         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9448         reloc.
9449         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9450         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9451         functions.
9452         * layout.cc (add_target_dynamic_tags): Use output section for
9453         DT_PLTRELSZ and DT_JMPREL.
9454
9455 2010-01-07  Ian Lance Taylor  <iant@google.com>
9456
9457         PR 11061
9458         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9459         function.
9460         (class Output_data_reloc_generic): Define.
9461         (class Output_data_reloc_base): Change base class to
9462         Output_data_reloc_generic.  Change add() method to call
9463         bump_relative_reloc_count for a relative reloc.  Remove
9464         sort_relocs_ field.
9465         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9466         to sort_relocs().
9467         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9468         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9469         appropriate.
9470         * layout.h (class Layout): Update declaration.
9471
9472 2010-01-07  Ian Lance Taylor  <iant@google.com>
9473
9474         * output.h (class Output_data): Add const version of
9475         output_section and do_output_section.
9476         (class Output_section_data): Add const version of
9477         do_output_section.
9478         (class Output_section): Likewise.
9479         * layout.cc (Layout::add_target_dynamic_tags): New function.
9480         * layout.h (class Layout): Update declarations.
9481         * arm.cc (Target_arm::do_finalize_sections): Use
9482         add_target_dynamic_tags.
9483         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9484         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9485         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9486         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9487
9488 2010-01-07  Ian Lance Taylor  <iant@google.com>
9489
9490         PR 11042
9491         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9492         object as needed.
9493
9494 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9495             Ian Lance Taylor  <iant@google.com>
9496
9497         PR 11019
9498         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9499         Xindex::read_symtab_xindex.
9500
9501 2010-01-07  Doug Kwan  <dougkwan@google.com>
9502
9503         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9504         (Insn_template::thumb16_bcond_insn): New method declaration.
9505         (Insn_template): Fix spelling.
9506         (Stub::thumb16_special): New method declaration.
9507         (Stub::do_write): Define virtual method which was previously pure
9508         virtual.
9509         (Stub::do_thumb16_special): New method declaration.
9510         (Stub::do_fixed_endian_write): New template member.
9511         (Reloc_stub::do_write): Remove.
9512         (Reloc_stub::do_fixed_endian_write): Remove.
9513         (Cortex_a8_stub): New class definition.
9514         (Stub_factory::make_cortex_a8_stub): New method definition.
9515         (Stub_factory::Stub_factory): Add missing static storage class
9516         qualifier for elf32_arm_stub_a8_veneer_blx.
9517
9518 2010-01-07  Ian Lance Taylor  <iant@google.com>
9519
9520         PR 10980
9521         * options.h (class General_options): Add --warn-unresolved-symbols
9522         and --error-unresolved-symbols.
9523         * errors.cc (Errors::undefined_symbol): Implement
9524         --warn-unresolved-symbols.
9525
9526         * options.h (class General_options): Add -z text and -z textoff.
9527         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9528
9529 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9530
9531         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9532         (Garbage_collection::cident_sections): New function.
9533         (Garbage_collection::add_cident_section): New function.
9534         (Garbage_collection::cident_sections_): New member.
9535         (gc_process_relocs): Add references to sections whose names are C
9536         identifiers.
9537         * gold.h (cident_section_start_prefix): New constant.
9538         (cident_section_stop_prefix): New constant.
9539         (is_cident): New function.
9540         * layout.cc (Layout::define_section_symbols): Replace string constants
9541         with the newly defined constants.
9542         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9543         C identifiers.
9544         * testsuite/Makefile.am: Add gc_orphan_section_test.
9545         * testsuite/Makefile.in: Regenerate.
9546         * testsuite/gc_orphan_section_test.cc: New file.
9547         * testsuite/gc_orphan_section_test.sh: New file.
9548
9549 2010-01-06  Ian Lance Taylor  <iant@google.com>
9550
9551         PR 10980
9552         * options.h (class General_options): Add --warn-shared-textrel.
9553         * layout.cc (Layout::finish_dynamic_section): Implement
9554         --warn-shared-textrel.
9555
9556         PR 10980
9557         * options.h (class General_options): Add --warn-multiple-gp.
9558
9559 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9560
9561         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9562         $(THREADSLIB) and $(LIBDL).
9563         * Makefile.in: Rebuild.
9564
9565 2010-01-06  Ian Lance Taylor  <iant@google.com>
9566
9567         PR 10980
9568         * options.cc (General_options::parse_section_start): New function.
9569         (General_options::section_start): New function.
9570         (General_options::General_options): Initialize all members.
9571         * options.h: Include <map>
9572         (class General_options): Add --section-start.  Add section_starts_
9573         member.
9574         * layout.cc (Layout::attach_allocated_section_to_segment): If
9575         --section-start was used, set the address of the segment.  Remove
9576         local sort_sections.
9577         (Layout::relaxation_loop_body): If the address of the load segment
9578         has been set by --section-start, don't use it.
9579         * output.h (Output_segment::update_flags_for_output_section): New
9580         function.
9581         * output.cc (Output_segment::add_output_section): Call
9582         update_flags_for_output_section.
9583
9584 2010-01-05  Ian Lance Taylor  <iant@google.com>
9585
9586         PR 10980
9587         * options.h (class General_options): Add --undefined-version.
9588         * script.cc (struct Version_expression): Add was_matched_by_symbol
9589         field.
9590         (Version_script_info::matched_symbol): New function.
9591         (Version_script_info::get_symbol_version_helper): Call
9592         matched_symbol.
9593         (Version_script_info::check_unmatched_names): New function.
9594         * script.h (class Version_script_info): Update declarations.
9595         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9596
9597         * options.h (class General_options): Use DEFINE_bool_alias for
9598         allow_multiple_definition.
9599         * resolve.cc (Symbol_table::should_override): Don't test
9600         allow_multiple_definition.
9601
9602         PR 10980
9603         * options.h (class General_options): Add --cref.
9604         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9605         until after printing cref table.
9606         * cref.cc: Include "symtab.h".
9607         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9608         (Cref_table_compare::operator()): New function.
9609         (Cref_inputs::gather_cref): New function.
9610         (filecol): New static const.
9611         (Cref_inputs::print_cref): New function.
9612         (Cref::print_cref): New function.
9613         * cref.h: Include <cstdio>.
9614         (class Cref): Update declarations.
9615         * mapfile.h (Mapfile::file): New function.
9616         * object.h (class Object): Define Symbols.  Declare virtual
9617         do_get_global_symbols.
9618         (Object::get_global_symbols): New function.
9619         * object.cc (Input_objects::add_object): Pass object to cref_ if
9620         --cref.
9621         (Input_objects::archive_start): Likewise.
9622         (Input_objects::archive_stop): Likewise.
9623         (Input_objects::print_cref): New function.
9624         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9625         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9626         --cref.
9627         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9628         function.
9629         * plugin.h (class Sized_pluginobj): Update declarations.
9630
9631 2010-01-05  Ian Lance Taylor  <iant@google.com>
9632
9633         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9634         to is_default_version.  Rename insdef to insdefault.
9635         (Symbol_table::add_from_relobj): Rename def to is_default_version
9636         and local to is_forced_local.
9637         (Symbol_table::add_from_pluginobj): Likewise.
9638         (Symbol_table::add_from_dynobj): Likewise.
9639         (Symbol_table::define_special_symbol): Rename insdef to
9640         insdefault.
9641
9642 2010-01-04  Ian Lance Taylor  <iant@google.com>
9643
9644         PR 10980
9645         * options.h (class General_options): Add
9646         --allow-multiple-definition and -z muldefs.
9647         * resolve.cc (Symbol_table::should_override): Don't warn about a
9648         multiple symbol definition if --allow-multiple-definition or -z
9649         muldefs.
9650
9651         PR 10980
9652         * options.h (class General_options): Add --add-needed and
9653         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9654         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9655         error if --copy-dt-needed-entries aka --add-needed is used and
9656         would cause a change in behaviour.
9657
9658         PR 10980
9659         * options.h (class General_options): Add -G as a short version of
9660         --shared.  Add no-op options -assert, -g, and -i.
9661
9662 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9663
9664         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9665         check for .text or .gnu.linkonce.t sections.
9666         * icf.cc (Icf::find_identical_sections): Ditto.
9667         Change the detection for mangled function name within the section
9668         name.
9669         * icf.h (is_section_foldable_candidate): New function.
9670
9671 2009-12-30  Ian Lance Taylor  <iant@google.com>
9672
9673         PR 10980
9674         * options.h (class General_options): Permit two dashes with
9675         --retain-symbols-file.
9676
9677 2009-12-30  Ian Lance Taylor  <iant@google.com>
9678
9679         PR 10979
9680         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9681         don't put the file header and segment headers in the text
9682         segment.
9683
9684         PR 10979
9685         * common.cc (Sort_commons::operator()): Stabilize sort when both
9686         entries are NULL.
9687         (Symbol_table::do_allocate_commons_list): When allocating common
9688         symbols, skip a symbol which is no longer common.
9689         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9690         an object before checking its type.
9691         * testsuite/common_test_2.c: New file.
9692         * testsuite/common_test_3.c: New file.
9693         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9694         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9695         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9696         (common_test_2_pic.o, common_test_2.so): New targets.
9697         (common_test_3_pic.o, common_test_3.so): New targets.
9698         * testsuite/Makefile.in: Rebuild.
9699
9700         PR 10979
9701         * script.cc (read_input_script): If we see a new SECTIONS clause,
9702         and we have added an input section, give an error.
9703         * layout.h (class Layout): Add have_added_input_section function.
9704         Add have_added_input_section_ field.
9705         * layout.cc (Layout::Layout): Initialize
9706         have_added_input_section_.
9707         (Layout::layout): Set have_added_input_section_.
9708         (Layout::layout_eh_frame): Likewise.
9709
9710 2009-12-30  Ian Lance Taylor  <iant@google.com>
9711
9712         PR 10931
9713         * options.h (class General_options): Add --sort-common option.
9714         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9715         * common.cc (Sort_common): Add sort_order parameter to
9716         constructor.  Add sort_order_ field.
9717         (Sort_commons::operator): Check sort_order_.
9718         (Symbol_table::allocate_commons): Determine the sort order.
9719         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9720         Change all callers.
9721         (Symbol_table::do_allocate_commons_list): Likewise.
9722
9723 2009-12-30  Ian Lance Taylor  <iant@google.com>
9724
9725         PR 10916
9726         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9727         symbols from this object, don't change the visibility of an
9728         undefined symbol.
9729         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9730
9731 2009-12-30  Ian Lance Taylor  <iant@google.com>
9732
9733         PR 10861
9734         * script.h (class Version_script_info): Define Language enum.
9735         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9736         new fields globals_, locals_, and is_finalized_.
9737         * script.cc: Various formatting fixes.
9738         (class Parser_closure): Change language_stack_ from a vector of
9739         std::string to one of Version_script_info::Language.  Adjust all
9740         uses accordingly.
9741         (class Lazy_demangler): Remove.
9742         (struct Version_expression): Change language from std::string to
9743         Version_script_info::Language.
9744         (Version_script_info::Version_script_info): New function.
9745         (Version_script_info::~Version_script_info): Don't call clear.
9746         (Version_script_info::finalize): New function.
9747         (Version_script_info::build_lookup_tables): New function.
9748         (Version_script_info::build_expression_list_lookup): New
9749         function.
9750         (Version_script_info::get_symbol_version_helper): Rewrite to use
9751         lookup tables.
9752         (Version_script_info::print_expression_list): Adjust to use
9753         Version_script_info::Language.
9754         (script_push_lex_into_version_mode): Check that the version script
9755         has not been finalized.
9756         (version_script_push_lang): Change language string to
9757         Version_script_info::Language.
9758         * options.cc (Command_line::version_script): New function.
9759         * options.h (class General_options): Add finalize_dynamic_list
9760         function.  Change version_script from declaration to definition.
9761         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9762         * testsuite/version_script.map: Remove duplicate def of foo.
9763         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9764         version_script.map.
9765         * testsuite/Makefile.in: Rebuild.
9766
9767 2009-12-30  Ian Lance Taylor  <iant@google.com>
9768
9769         PR 10843
9770         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9771         if the input symbol index is 0, make the output symbol index 0.
9772
9773 2009-12-30  Ian Lance Taylor  <iant@google.com>
9774
9775         PR 10670
9776         * options.h (class General_options): Add -x/--discard-all.
9777         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9778         --discard-all.  If the local symbol needs a dynamic entry, check
9779         that before handling --discard-locals.
9780
9781 2009-12-30  Ian Lance Taylor  <iant@google.com>
9782
9783         PR 10450
9784         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9785         flags to PF_R.
9786         (Output_segment::add_output_section): Don't change the flags if
9787         the type is PT_TLS.
9788
9789         PR 10450
9790         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9791         GNU hash table if they need a dynamic value.  Otherwise, don't add
9792         them if they are defined in a dynamic object or are forced local.
9793
9794 2009-12-29  Ian Lance Taylor  <iant@google.com>
9795
9796         PR 10450
9797         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9798         .gnu.hash table for a 32-bit target.
9799
9800         PR 10450
9801         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9802         regular and a dynamic object only needs a dynamic symbol table
9803         entry if it is externally visible.
9804
9805         PR 10450
9806         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9807         constructor.  Add global_offset_table_ field.
9808         (Target_i386::got_section): Set global_offset_table_.
9809         (Target_i386::do_finalize_sections): Set global_offset_table_
9810         size.
9811         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9812         in constructor.  Add global_offset_table_ field.
9813         (Target_x86_64::got_section): Set global_offset_table_.
9814         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9815         size.
9816
9817         * layout.cc (Layout::Layout): Initialize increase_relro_.
9818         (Layout::get_output_section): Add is_relro, is_last_relro, and
9819         is_first_non_relro parameters.  Change all callers.
9820         (Layout::choose_output_section): Likewise.
9821         (Layout::add_output_section_data): Likewise.
9822         (Layout::make_output_section): Likewise.
9823         (Layout::set_segment_offsets): Clear increase_relro when using a
9824         linker script.
9825         * layout.h (class Layout): Add increase_relro method.  Add
9826         increase_relro_ field.  Update declarations.
9827         * output.cc (Output_section::Output_section): Initialize
9828         is_last_relro_ and is_first_non_relro_.
9829         (Output_segment::add_output_section): Group relro sections is
9830         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9831         (Output_segment::maximum_alignment): Remove relro handling.
9832         (Output_segment::set_section_addresses): Add increase_relro
9833         parameter.  Change all callers.  Add initial alignment to align
9834         relro sections on separate page.  Remove old relro handling.
9835         (Output_segment::set_section_list_addresses): Remove in_relro
9836         parameter.  Change all callers.
9837         (Output_segment::set_offset): Add increase parameter.  Change all
9838         callers.  Remove old relro handling.
9839         * output.h (class Output_section): Add new methods: is_last_relro,
9840         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9841         Add is_last_relro_ and is_first_non_relro_ fields.
9842         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9843         Create separate .got.plt section.  Call increase_relro.
9844         * x86_64.cc (Target_x86_64::got_section): Likewise.
9845         * testsuite/relro_script_test.t: Add .got.plt.
9846
9847         PR 10450
9848         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9849         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9850         (Layout::finalize): Call set_dynamic_symbol_size.
9851         (Layout::set_dynamic_symbol_size): New function.
9852         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9853         set_dynamic_symbol_size.
9854
9855         PR 10450
9856         * output.h (class Output_section): Add is_entsize_zero_ field.
9857         * output.cc (Output_section::Output_section): Initialize
9858         is_entsize_zero_.
9859         (Output_section::set_entsize): If two different entsizes are
9860         requested, force it to zero.
9861         (Output_section::add_input_section): Set flags for .debug_str
9862         before updating section flags.  Set entsize.
9863         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9864         and SHF_STRING if all input sections have those flags.
9865
9866 2009-12-29   Rafael Espindola  <espindola@google.com>
9867
9868         * main.cc (main): Fix the sys time reporting.
9869         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9870         reporting.
9871
9872 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9873
9874         * options.cc (General_options::parse_version): Allow -v to exit
9875         without an error if there is nothing to link.
9876
9877 2009-12-29  Ian Lance Taylor  <iant@google.com>
9878
9879         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9880         using a version of gcc before 4.1.
9881         * configure: Rebuild.
9882
9883 2009-12-28  Chris Demetriou  <cgd@google.com>
9884
9885         * attributes.cc (Output_attributes_section_data::do_write): Use
9886         std::vector::front rather than std::vector::data.
9887
9888 2009-12-28  Ian Lance Taylor  <iant@google.com>
9889
9890         * symtab.h (class Symbol_table): Add enum Defined.
9891         * resolve.cc (Symbol_table::should_override): Add defined
9892         parameter.  Change all callers.  Test whether object is NULL
9893         before calling a method on it.
9894         (Symbol_table::report_resolve_problem): Add defined parameter.
9895         Change all callers.
9896         (Symbol_table::should_override_with_special): Likewise.
9897         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9898         parameter.  Change all callers.
9899         (Symbol_table::do_define_in_output_data): Likewise.
9900         (Symbol_table::define_in_output_segment): Likewise.
9901         (Symbol_table::do_define_in_output_segment): Likewise.
9902         (Symbol_table::define_as_constant): Likewise.
9903         (Symbol_table::do_define_as_constant): Likewise.
9904         * script.h (class Symbol_assignment): Add is_defsym parameter to
9905         constructor; change all callers.
9906         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9907         parameter.  Change all callers.  Add is_defsym_ field.
9908         (class Parser_closure): Add parsing_defsym parameter to
9909         constructor; change all callers.  Add parsing_defsym accessor
9910         function.  Add parsing_defsym_ field.
9911
9912 2009-12-28  Ian Lance Taylor  <iant@google.com>
9913
9914         * gold.cc (queue_middle_tasks): Fix formatting.
9915         * object.cc (Relobj::is_section_name_included): Likewise.
9916
9917 2009-12-23  Ian Lance Taylor  <iant@google.com>
9918
9919         * i386.cc (Target_i386::do_calls_non_split): Recognize
9920         -fsplit-stack prologue for a function with a static chain.
9921         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9922         -fsplit-stack prologue when using %r11.
9923
9924 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9925
9926         * options.cc (General_options::parse_version): Make -v continue and do
9927         the link like GNU ld does.
9928
9929 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9930
9931         * Makefile.am (CCFILES): Add timer.cc.
9932         (HFILES): Add timer.h.
9933         * configure.ac: Check for sysconf and times.
9934         * main.cc: include timer.h.
9935         (main): Use Timer instead of get_run_time.
9936         * timer.cc: New.
9937         * timer.h: New.
9938         * workqueue.cc: include timer.h.
9939         (Workqueue::find_and_run_task):
9940         Report user, sys and wall time.
9941         * Makefile.in: Regenerate.
9942         * config.in: Regenerate.
9943         * configure: Regenerate.
9944
9945 2009-12-16  Doug Kwan  <dougkwan@google.com>
9946
9947         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9948         sections.
9949         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9950         relaxed input sections.
9951         * output.cc (Output_section::find_relaxed_input_section): Change
9952         return type to Output_relaxed_input_section pointer.  Adjust code
9953         for new type of relaxed_input_section_map_.
9954         * output.h (Output_section::find_relaxed_input_section): Change
9955         return type to Output_relaxed_input_section pointer.
9956         (Output_section::Output_relaxed_input_section_by_input_section_map):
9957         New type.
9958         (Output_section::relaxed_input_section_map_): Change type to
9959         Output_section::Output_relaxed_input_section_by_input_section_map.
9960         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9961         input section.
9962
9963 2009-12-15  Ian Lance Taylor  <iant@google.com>
9964
9965         * layout.cc (Layout::create_shstrtab): Only write out after input
9966         sections if we are compressing debug sections.
9967
9968 2009-12-15  Ian Lance Taylor  <iant@google.com>
9969
9970         * archive.cc (Archive::add_symbols): Only look up a symbol without
9971         a version if there is, in fact, a version.
9972
9973 2009-12-14  Ian Lance Taylor  <iant@google.com>
9974
9975         Revert -Wshadow changes, all changes from:
9976         2009-12-11  Doug Kwan  <dougkwan@google.com>
9977         2009-12-11  Nick Clifton  <nickc@redhat.com>
9978         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9979
9980 2009-12-11  Doug Kwan  <dougkwan@google.com>
9981
9982         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
9983         due to -Wshadow.
9984         * attributes.cc (Object_attribute::size): Ditto.
9985         (Attributes_section_data::size): Ditto.
9986         (Attributes_section_data::Attributes_section_data): Ditto.
9987         (Output_attributes_section_data::do_write): Ditto.
9988         * attributes.h (Object_attribute::set_type): Ditto.
9989         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
9990
9991 2009-12-11  Nick Clifton  <nickc@redhat.com>
9992
9993         * archive.cc: Fix shadowed variable warnings.
9994         * arm.cc: Likewise.
9995         * compressed_output.cc: Likewise.
9996         * compressed_output.h: Likewise.
9997         * configure: Likewise.
9998         * dwarf_reader.cc: Likewise.
9999         * dynobj.cc: Likewise.
10000         * dynobj.h: Likewise.
10001         * ehframe.cc: Likewise.
10002         * ehframe.h: Likewise.
10003         * errors.cc: Likewise.
10004         * expression.cc: Likewise.
10005         * fileread.cc: Likewise.
10006         * fileread.h: Likewise.
10007         * freebsd.h: Likewise.
10008         * i386.cc: Likewise.
10009         * icf.cc: Likewise.
10010         * incremental.h: Likewise.
10011         * layout.cc: Likewise.
10012         * layout.h: Likewise.
10013         * mapfile.cc: Likewise.
10014         * merge.cc: Likewise.
10015         * merge.h: Likewise.
10016         * object.cc: Likewise.
10017         * object.h: Likewise.
10018         * options.h: Likewise.
10019         * output.cc: Likewise.
10020         * output.h: Likewise.
10021         * parameters.cc: Likewise.
10022         * plugin.cc: Likewise.
10023         * powerpc.cc: Likewise.
10024         * reduced_debug_output.cc: Likewise.
10025         * reduced_debug_output.h: Likewise.
10026         * reloc.cc: Likewise.
10027         * reloc.h: Likewise.
10028         * resolve.cc: Likewise.
10029         * script-sections.cc: Likewise.
10030         * script.cc: Likewise.
10031         * script.h: Likewise.
10032         * sparc.cc: Likewise.
10033         * symtab.cc: Likewise.
10034         * symtab.h: Likewise.
10035         * target-select.cc: Likewise.
10036         * target-select.h: Likewise.
10037         * token.h: Likewise.
10038         * workqueue.cc: Likewise.
10039         * workqueue.h: Likewise.
10040         * x86_64.cc: Likewise.
10041
10042 2009-12-10  Doug Kwan  <dougkwan@google.com>
10043
10044         * arm.cc (attributes.h): New include.
10045         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10046         (Arm_relobj::~Arm_relobj): Delete object pointed by
10047         attributes_section_data_.
10048         (Arm_relobj::attributes_section_data): New method definition.
10049         (Arm_relobj::attributes_section_data_): New data member declaration.
10050         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10051         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10052         attributes_section_data_.
10053         (Arm_dynobj::attributes_section_data): New method definition.
10054         (Arm_dynobj::attributes_section_data_): New data member declaration.
10055         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10056         initialization value of may_use_blx_ to false.
10057         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10058         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10059         object attributes to compute results instead of hard-coding.
10060         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10061         Target_arm::get_secondary_compatible_arch,
10062         Target_arm::set_secondary_compatible_arch
10063         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10064         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10065         New method declarations.
10066         (Target_arm::get_aeabi_object_attribute): New method definition.
10067         (Target_arm::attributes_section_data_): New data member declaration.
10068         (read_arm_attributes_section): New template definition.
10069         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10070         (Arm_dynobj::do_read_symbols): Ditto.
10071         (Target_arm::do_finalize_sections): Merge attributes sections from
10072         input.  Check for BLX use after attributes section merging.
10073         Fix __exidx_start and __exidx_end visibility.  Create an
10074         .ARM.attributes section if necessary.
10075         (Target_arm::get_secondary_compatible_arch,
10076         Target_arm::set_secondary_compatible_arch,
10077         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10078         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10079         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10080         New method definitions.
10081
10082 2009-12-09  Ian Lance Taylor  <iant@google.com>
10083
10084         * plugin.cc (Plugin::load): Don't cast from void* to a function
10085         pointer.
10086
10087 2009-12-09  Ian Lance Taylor  <iant@google.com>
10088
10089         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10090         information fields.
10091
10092 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10093
10094         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10095         Replace two_file_shared_1.so with two_file_shared_2.so.
10096         * testsuite/Makefile.in: Regenerated.
10097
10098 2009-12-08  Doug Kwan  <dougkwan@google.com>
10099
10100         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10101         (HFILES): Add attributes.h and int_encoding.h.
10102         * Makefile.in: Regenerate.
10103         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10104         function definitions to int_encoding.cc
10105         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10106         prototypes to int_encoding.h
10107         * reduced_debug_output.cc (int_encoding.h): New include.
10108         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10109         function definitions to int_encoding.cc
10110         (insert_into_vector, read_from_pointer): Move template definitions to
10111         int_encoding.h
10112         * attributes.cc: New file.
10113         * attributes.h: New file.
10114         * int_encoding.cc: New file.
10115         * int_encoding.h: New file.
10116
10117 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10118
10119         PR gold/11055
10120         * incremental-dump.cc (dump_incremental_inputs): New.
10121         (main): Use dump_incremental_inputs.
10122
10123 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10124
10125         PR gold/10893
10126         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10127         checking elfcpp::STT_FUNC.
10128         (Target_i386::Relocate::relocate): Likewise.
10129         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10130
10131         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10132         symbols from shared libraries into normal FUNC symbols.
10133
10134         * symtab.h (Symbol): Add is_func and use it.
10135
10136 2009-12-05  Doug Kwan  <dougkwan@google.com>
10137
10138         * arm.cc (Target_arm::arm_info): Initialize new fields
10139         attributes_section and attributes_vendor.
10140         * i386.cc (Target_i386::i386_info): Same.
10141         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10142         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10143         fields attributes_section and attributes_vendor.
10144         * sparc.cc (Target_sparc::sparc_info): Same.
10145         * target.h (Target::attributes_section, Target::attributes_vendor,
10146         Target::is_attributes_section, Target::attribute_arg_type,
10147         Target::attributes_order): New method definitions.
10148         (Target::Target_info::attributes_section,
10149         Target::Target_info::attributes_vendor): New fields.
10150         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10151         virtual method definitions.
10152         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10153         attributes_section and attributes_vendor.
10154         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10155
10156 2009-12-05  Doug Kwan  <dougkwan@google.com>
10157
10158         * arm.cc: Update comments about interworking and stub generation.
10159         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10160         considered as non-PIC.
10161         (Arm_relocate_functions::base_abs): Fix formatting.
10162         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10163         of function to use GOT entry address instead of offset.
10164         (Target_arm::Scan::global): Issue an error if a symbol would need a
10165         PLT does not get one because it is untyped.  Remove code to create
10166         dynamic symbols for relative branches.
10167         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10168         takes unsigned integer instead of boolean.
10169
10170 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10171
10172         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10173         (two_file_test_LDADD): Likewise.
10174         (common_test_1_LDADD): Likewise.
10175         (exception_test_LDADD) Likewise.
10176         (weak_test_LDADD): Likewise.
10177         (many_sections_test_LDADD): Likewise.
10178         (initpri1_LDADD): Likewise.
10179         (script_test_1_LDADD): Likewise.
10180         (script_test_2_LDADD): Likewise.
10181         (justsyms_LDADD): Likewise.
10182         (binary_test_LDADD): Likewise.
10183         (large_LDADD): Likewise.
10184         * testsuite/Makefile.in: Regenerated.
10185
10186 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10187
10188         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10189         (Symbol_table::override_with_special): Likewise.
10190         (Symbol_table::add_from_object): Likewise.
10191
10192 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10193
10194         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10195         Don't set the data_offset twice.
10196
10197 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10198
10199         * testsuite/Makefile.in: Regenerate.
10200
10201 2009-12-03  Doug Kwan  <dougkwan@google.com>
10202
10203         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10204         (Target_arm::do_finalize_sections): Add parameter for symbol table
10205         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10206         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10207         parameter for symbol table pointer.
10208         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10209         an additional parameter for a pointer to symbol table.
10210         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10211         parameter for a symbol table pointer.
10212         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10213         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10214         Ditto.
10215         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10216         parameter for a symbol table pointer.
10217
10218 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10219
10220         * incremental.cc (Incremental_inputs_header)
10221         (Incremental_inputs_header_write, Incremental_inputs_entry)
10222         (Incremental_inputs_entry_write): Move ...
10223         * incremental.h (Incremental_inputs_header)
10224         (Incremental_inputs_header_write, Incremental_inputs_entry)
10225         (Incremental_inputs_entry_write): here.
10226
10227 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10228
10229         * incremental.cc (make_sized_incremental_binary): Set the target.
10230         Error if it is incompatible.
10231         * output.h (Output_file): Add filename method.
10232
10233 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10234
10235         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10236         from the get_* methods.
10237
10238 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10239
10240         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10241         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10242         Write 0 for the data_offset of scripts.
10243
10244 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10245
10246         * testsuite/Makefile.am: Add the incremental_test.sh test.
10247         * testsuite/incremental_test.sh: New.
10248         * testsuite/incremental_test_1.c: New.
10249         * testsuite/incremental_test_2.c: New.
10250
10251 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10252
10253         * incremental-dump.cc (main): Fix typos.
10254
10255 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10256
10257         PR gold/11025
10258         * incremental-dump.cc (main): Use llu to print 64 bit values.
10259
10260 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10261             H.J. Lu  <hongjiu.lu@intel.com>
10262
10263         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10264         $(LIBDL).
10265         (incremental_dump_LDADD): Likewise.
10266         * Makefile.in: Regenerated.
10267
10268 2009-11-25  Doug Kwan  <dougkwan@google.com>
10269
10270         Revert:
10271
10272         2009-11-25  Doug Kwan  <dougkwan@google.com>
10273
10274                 * arm.cc (Target_arm::Target_arm): Move method definition
10275                 outside of class definition.  Add code to handle
10276                 --target1-rel, --target1-abs and --target2= options.
10277                 (Target_arm::get_reloc_reloc_type): Change method to be
10278                 non-static and const.
10279                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10280                 New data member declaration.
10281                 (Target_arm::Scan::local, Target_arm::Scan::global,
10282                 Target_arm::Relocate::relocate,
10283                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10284                 Adjust call to Target_arm::get_real_reloc_type.
10285                 (Target_arm::get_real_reloc_type): Use command line options
10286                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10287                 * options.h (--target1-rel, --target1-abs, --target2): New
10288                 ARM-only options.
10289
10290 2009-11-25  Doug Kwan  <dougkwan@google.com>
10291
10292         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10293         class definition.  Add code to handle --target1-rel, --target1-abs
10294         and --target2= options.
10295         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10296         and const.
10297         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10298         member declaration.
10299         (Target_arm::Scan::local, Target_arm::Scan::global,
10300         Target_arm::Relocate::relocate,
10301         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10302         call to Target_arm::get_real_reloc_type.
10303         (Target_arm::get_real_reloc_type): Use command line options to
10304         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10305         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10306         options.
10307
10308 2009-11-25  Doug Kwan  <dougkwan@google.com>
10309
10310         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10311         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10312         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10313         formatting.
10314         (Arm_relocate_functions::thm_call): Replace body with a call to
10315         Arm_relocate_functions::thumb_branch_common.
10316         (Arm_relocate_functions::thm_jump24,
10317         Arm_relocate_functions::thm_xpc22): New method definitions.
10318         (Arm_relocate_functions::thumb_branch_common): New method definition.
10319         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10320         operator.
10321         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10322         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10323
10324 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10325
10326         * Makefile.am: Build incremental-dump
10327         * Makefile.in: Regenerate.
10328         * incremental-dump.cc: New.
10329         * incremental.cc (Incremental_inputs_header_data,
10330         Incremental_inputs_entry_data): Move to incremental.h
10331         * incremental.h: (Incremental_inputs_header_data,
10332         Incremental_inputs_entry_data): Move from incremental.cc
10333
10334 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10335
10336         * incremental.cc (Incremental_inputs_header,
10337         Incremental_inputs_header_write, Incremental_inputs_entry,
10338         Incremental_inputs_entry_write): Add a typedef with the data type.
10339
10340 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10341
10342         * incremental.cc (Incremental_inputs_header,
10343         Incremental_inputs_header_write, Incremental_inputs_entry,
10344         Incremental_inputs_entry_write): Update comment about which
10345         type has the filed descriptions.
10346
10347 2009-11-15  Doug Kwan  <dougkwan@google.com>
10348
10349         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10350         (Arm_relocate_functions::arm_branch_common): Change method defintion
10351         in class definition to a method declaration and update list of formal
10352         parameters.
10353         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10354         Arm_relocation_functions::jump24): Adjust call to
10355         Arm_relocate_functions::arm_branch_common.  Update list of formal
10356         parameters.
10357         (Arm_relocate_functions::xpc25): New method definition.
10358         (Arm_relocate_functions::arm_branch_common): Move method defintion
10359         out from class definition.  Use stubs for mode-switching and extending
10360         branch ranges.
10361         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10362         specially.  Change code to enable use of stubs in ARM branches.
10363
10364 2009-11-10  Doug Kwan  <dougkwan@google.com>
10365
10366         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10367         in method declaration.
10368         (Target_arm::relocate_stub): New method declaration.
10369         (Target_arm::default_target): Change to return a pointer instead of
10370         a const reference.
10371         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10372         Target_arm::default_target.
10373         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10374         method definition.
10375         (Target_arm::relocate_section): Adjust view.
10376         (Target_arm::relocate_stub): New method definition.
10377
10378 2009-11-10  Doug Kwan  <dougkwan@google.com>
10379
10380         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10381         a format warning.
10382         * incremental.cc (open_incremental_binary): Initialized local
10383         variables to avoid warnings.
10384         * object.cc (make_elf_object): Ditto.
10385         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10386         a format warning.
10387
10388 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10389
10390         PR gold/10930
10391         * testsuite/plugin_test.c: Include "config.h".
10392
10393 2009-11-09  Doug Kwan  <dougkwan@google.com>
10394
10395         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10396         (arm_symbol_value): Remove.
10397         (Arm_relocate_functions::arm_branch_common,
10398         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10399         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10400         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10401         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10402         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10403         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10404         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10405         Arm_relocate_functions::thm_mobw_abs_nc,
10406         Arm_relocate_functions::thm_mov_abs,
10407         Arm_relocate_functions::movw_prel_nc,
10408         Arm_relocate_functions::thm_movt_abs,
10409         Arm_relocate_functions::movt_prel,
10410         Arm_relocate_functions::thm_movw_prel_nc,
10411         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10412         (Target_arm::Relocate::relocate): Only decompose address into two
10413         parts if relocation type uses the thumb-bit and pass the actual
10414         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10415         calls to methods in Arm_relocate_functions for this change.
10416
10417 2009-11-08  Ian Lance Taylor  <iant@google.com>
10418
10419         PR 10925
10420         * reloc.cc: Instantiate
10421         Sized_relobj::initialize_input_to_output_maps and
10422         Sized_relobj:free_input_to_output_maps.
10423
10424 2009-11-06  Ian Lance Taylor  <iant@google.com>
10425
10426         PR 10876
10427         * defstd.cc (in_segment): Set only_if_ref true for "end".
10428
10429 2009-11-06  Doug Kwan  <dougkwan@google.com>
10430
10431         * arm.cc (class Reloc_stub): Correct a comment.
10432         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10433         (Target_arm::scan_section_for_stubs): New method declaration.
10434         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10435         Change methods from private to protected.
10436         (Target_arm::do_may_relax): New method definition.
10437         (Target_arm::do_relax, Target_arm::group_sections,
10438         Target_arm::scan_reloc_for_stub,
10439         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10440         (Target_arm::arm_input_section_map_): New data member declaration.
10441         (Target_arm::scan_reloc_for_stub,
10442         Target_arm::scan_reloc_section_for_stubs,
10443         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10444         Target_arm::do_relax): New method definitions.
10445
10446 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10447
10448         * configure.ac: Check for (struct stat)::st_mtim
10449         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10450         * config.in: Regenerate.
10451         * configure: Regenerate.
10452
10453 2009-11-05  Ian Lance Taylor  <iant@google.com>
10454
10455         PR 10910
10456         * output.cc (Output_segment::add_output_section): Add missing
10457         return statement.
10458
10459 2009-11-04  Ian Lance Taylor  <iant@google.com>
10460
10461         PR 10880
10462         * object.h (class Object): Add is_needed and set_is_needed
10463         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10464         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10465         defined in a dynamic object and referenced by a regular object,
10466         set is_needed for the dynamic object.
10467         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10468         if the file is marked with as_needed and it is not needed.
10469
10470 2009-11-04  Ian Lance Taylor  <iant@google.com>
10471
10472         PR 10887
10473         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10474         tags if data is discarded by linker script.
10475         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10476         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10477         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10478         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10479
10480 2009-11-04  Ian Lance Taylor  <iant@google.com>
10481
10482         * layout.cc (Layout::get_output_section): Add is_interp and
10483         is_dynamic_linker_section parameters.  Change all callers.
10484         (Layout::choose_output_section): Likewise.
10485         (Layout::make_output_section): Likewise.
10486         (Layout::add_output_section_data): Add is_dynamic_linker_section
10487         parameter.  Change all callers.
10488         * layout.h (class Layout): Update declarations.
10489         * output.h (class Output_section): Add is_interp, set_is_interp,
10490         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10491         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10492         generate_code_fills_at_write_ to a bitfield.
10493         * output.cc (Output_section::Output_sections): Initialize new
10494         fields.
10495         (Output_segment::add_output_section): Add do_sort parameter.
10496         Change all callers.
10497
10498 2009-11-03  Ian Lance Taylor  <iant@google.com>
10499
10500         PR 10860
10501         * options.h (class General_options): Add --warn-common.
10502         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10503         merging two common symbols.
10504         (Symbol_table::should_override): Handle --warn-common when merging
10505         a common symbol with a defined symbol.  Use report_resolve_problem
10506         for multiple definitions.
10507         (Symbol_table::report_resolve_problem): New function.
10508         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10509
10510 2009-11-03  Doug Kwan  <dougkwan@google.com>
10511
10512         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10513         stub_factory_.
10514         (Target_arm::stub_factory): New method definition.
10515         (Target_arm::new_arm_input_section,
10516         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10517         Target_arm::reloc_uses_thumb_bit): New method declarations.
10518         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10519         New type definitions.
10520         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10521         member declarations.
10522         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10523         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10524         New method definitions.
10525
10526 2009-11-03  Ian Lance Taylor  <iant@google.com>
10527
10528         * options.h (class General_options): Add --warn_constructors.
10529
10530 2009-11-03  Ian Lance Taylor  <iant@google.com>
10531
10532         PR 10893
10533         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10534         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10535
10536 2009-11-03  Ian Lance Taylor  <iant@google.com>
10537
10538         PR 10895
10539         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10540         --msgid-bugs-address.
10541         (install-pdf): New target.
10542         (install-data_yes): Look up one directory to find mkinstalldirs.
10543
10544 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10545
10546         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10547         tree.
10548
10549 2009-10-30  Doug Kwan  <dougkwan@google.com>
10550
10551         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10552
10553 2009-10-30  Doug Kwan  <dougkwan@google.com>
10554
10555         * arm.cc (Stub_addend_reader): New struct template definition
10556         and partial specializations.
10557         (Stub_addend_reader::operator()): New method definition for a
10558         partially specialized template.
10559
10560 2009-10-30  Doug Kwan  <dougkwan@google.com>
10561
10562         * arm.cc (Arm_relobj::processor_specific_flags): New method
10563         definition.
10564         (Arm_relobj::do_read_symbols): New method declaration.
10565         (Arm_relobj::processor_specific_flags_): New data member declaration.
10566         (Arm_dynobj): New class definition.
10567         (Target_arm::do_finalize_sections): Add input_objects parameter.
10568         (Target_arm::do_adjust_elf_header): New method declaration.
10569         (Target_arm::are_eabi_versions_compatible,
10570         (Target_arm::merge_processor_specific_flags): New method declaration.
10571         (Target_arm::do_make_elf_object): New overloaded method definitions
10572         and declaration.
10573         (Arm_relobj::do_read_symbols): New method definition.
10574         (Arm_dynobj::do_read_symbols): Ditto.
10575         (Target_arm::do_finalize_sections): Add input_objects parameters.
10576         Merge processor-specific flags from all input objects.
10577         (Target_arm::are_eabi_versions_compatible,
10578         Target_arm::merge_processor_specific_flags,
10579         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10580         New method definitions.
10581         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10582         Input_objects pointer type parameter.
10583         * layout.cc (Layout::finalize): Pass input objects to target's.
10584         finalize_sections function.
10585         * output.cc (Output_file_header::do_sized_write): Set ELF file
10586         header's processor-specific flags.
10587         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10588         Input_objects pointer type parameter.
10589         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10590         * target.h (Input_objects): New forward class declaration.
10591         (Target::processor_specific_flags,
10592         Target::are_processor_specific_flags_sect): New method definitions.
10593         (Target::finalize_sections): Add input_objects parameter.
10594         (Target::Target): Initialize processor_specific_flags_ and
10595         are_processor_specific_flags_set_.
10596         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10597         parameter.
10598         (Target::set_processor_specific_flags): New method definition.
10599         (Target::processor_specific_flags_,
10600         Target::are_processor_specific_flags_set_): New data member
10601         declarations.
10602         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10603         Input_objects pointer type parameter.
10604
10605 2009-10-30  Doug Kwan  <dougkwan@google.com>
10606
10607         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10608
10609 2009-10-28  Ian Lance Taylor  <iant@google.com>
10610
10611         * object.h (class Relobj): Drop options parameter from
10612         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10613         do_scan_relocs, do_relocate.  Change all callers.
10614         (class Sized_relobj): Drop options parameters from
10615         do_gc_process_relocs, do_scan_relocs, do_relocate,
10616         do_relocate_sections, relocate_sections, emit_relocs_scan,
10617         emit_relocs_scan_reltype.  Change all callers.
10618         (struct Relocate_info): Remove options field and all references to
10619         it.
10620         * reloc.h (class Read_relocs): Remove options constructor
10621         parameter and options_ field.  Change all callers.
10622         (class Gc_process_relocs, class Scan_relocs): Likewise.
10623         (class Relocate_task): Likewise.
10624         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10625         all callers.
10626         (scan_relocatable_relocs): Likewise.
10627         * target.h (class Sized_target): Remove options parameter from
10628         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10629         all callers.
10630         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10631         callers.
10632         * arm.cc: Update functions to remove options parameters.
10633         * i386.cc: Likewise.
10634         * powerpc.cc: Likewise.
10635         * sparc.cc: Likewise.
10636         * x86_64.cc: Likewise.
10637         * testsuite/testfile.cc: Likewise.
10638
10639 2009-10-28  Doug Kwan  <dougkwan@google.com>
10640
10641         * arm.cc (Arm_relobj): New class definition.
10642         (Arm_relobj::scan_sections_for_stubs,
10643         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10644         New method definitions.
10645
10646 2009-10-28  Cary Coutant  <ccoutant@google.com>
10647
10648         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10649         (Plugin::cleanup_done_): New member.
10650         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10651         (Plugin_manager::cleanup_done_): Remove.
10652         (Plugin_manager::add_input_file): Edit error message.
10653         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10654         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10655
10656 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10657
10658         * fileread.cc: (File_read::View::~View): Use the new
10659         data_ownership_ filed.
10660         (File_read::~File_read): Dispose the new whole_file_view_.
10661         (File_read::open): Mmap the whole file if needed.
10662         (File_read::open): Use whole_file_view_ instead of contents_.
10663         (File_read::find_view): Use whole_file_view_ if applicable.
10664         (File_read::do_read): Use whole_file_view_ instead of contents_.
10665         (File_read::make_view): Use whole_file_view_ instead of contents_,
10666         update File_read::View::View call.
10667         (File_read::find_or_make_view): Update File_read::View::View
10668         call.
10669         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10670         remove contents_
10671         (File_read::View::Data_ownership): New enum.
10672         (File_read::View::View): Replace bool mapped_ with Data_ownership
10673         argument.
10674         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10675         (File_read::View::data_ownership_): New field.
10676         (File_read::contents_): Remove (replaced by whole_file_view_).
10677         (File_read::whole_file_view_): New field.
10678         * options.h (class General_options): Add --keep-files-mapped.
10679
10680 2009-10-27  Cary Coutant  <ccoutant@google.com>
10681
10682         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10683         * testsuite/Makefile.am (plugin_test_5): New test case.
10684         * testsuite/Makefile.in: Regenerate.
10685
10686 2009-10-25  Doug Kwan  <dougkwan@google.com>
10687
10688         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10689         from private to protected to allow access by child class.
10690         (Sized_relobj::do_relocate_sections): New method declaration.
10691         (Sized_relobj::relocate_sections): Virtualize.
10692         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10693         Sized_relobj::relocate_sections.  Instantiate template explicitly
10694         for different target sizes and endianity.
10695
10696 2009-10-24  Doug Kwan  <dougkwan@google.com>
10697
10698         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10699         (Arm_input_section::as_arm_input_section): New method.
10700         (Arm_output_section): New class definition.
10701         (Arm_output_section::create_stub_group,
10702         Arm_output_section::group_sections): New method definitions.
10703
10704 2009-10-22  Doug Kwan  <dougkwan@google.com>
10705
10706         * arm.cc (Arm_input_section): New class definition.
10707         (Arm_input_section::init, Arm_input_section:do_write,
10708         Arm_input_section::set_final_data_size,
10709         Arm_input_section::do_reset_address_and_file_offset): New method
10710         definitions.
10711
10712 2009-10-21  Doug Kwan  <dougkwan@google.com>
10713
10714         * arm.cc (Stub_table, Arm_input_section): New forward class
10715         declarations.
10716         (Stub_table): New class defintion.
10717         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10718         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10719         New method definition.
10720
10721 2009-10-21  Doug Kwan  <dougkwan@google.com>
10722
10723         * arm.cc: Update copyright comments.
10724         (Target_arm): New forward class template declaration.
10725         (Arm_address): New type.
10726         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10727         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10728         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10729         constants.
10730         (Insn_template): Same.
10731         (DEF_STUBS): New macro.
10732         (Stub_type): New enum type.
10733         (Stub_template): New class definition.
10734         (Stub): Same.
10735         (Reloc_stub): Same.
10736         (Stub_factory): Same.
10737         (Target_arm::Target_arm): Initialize may_use_blx_ and
10738         should_force_pic_veneer_.
10739         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10740         Target_arm::should_force_pic_veneer,
10741         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10742         Target_arm::using_thumb_only, Target_arm:;default_target): New
10743         method defintions.
10744         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10745         New data member declarations.
10746         (Insn_template::size, Insn_template::alignment): New method defintions.
10747         (Stub_template::Stub_template): New method definition.
10748         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10749         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10750         (Stub_factory::Stub_factory): New method definition.
10751         * gold.h (string_hash): New template.
10752         * output.h (Input_section_specifier::hash_value): Use
10753         gold::string_hash.
10754         (Input_section_specifier::string_hash): Remove.
10755         * stringpool.cc (Stringpool_template::string_hash): Use
10756         gold::string_hash.
10757
10758 2009-10-20  Doug Kwan  <dougkwan@google.com>
10759
10760         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10761         symbols of relaxed input sections.
10762         * output.h (Output_section::find_relaxed_input_section): Make
10763         method public.
10764
10765 2009-10-16  Doug Kwan  <dougkwan@google.com>
10766
10767         * dynobj.cc (Versions::Versions): Initialize version_script_.
10768         Only insert base version symbol definition for a shared object
10769         if version script defines any version versions.
10770         (Versions::define_base_version): New method definition.
10771         (Versions::add_def): Check that base version is not needed.
10772         (Versions::add_need): Define base version lazily.
10773         * dynobj.h (Versions::define_base_version): New method declaration.
10774         (Versions::needs_base_version_): New data member declaration.
10775         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10776         (check_DATA): Add no_version_test.stdout.
10777         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10778         New make rules.
10779         * testsuite/Makefile.in: Regenerate.
10780         * testsuite/no_version_test.c: New file.
10781         * testsuite/no_version_test.sh: Ditto.
10782
10783 2009-10-16  Doug Kwan  <dougkwan@google.com>
10784
10785         * expression.cc (class Segment_start_expression): New class definition.
10786         (Segment_start_expression::value): New method definition.
10787         (script_exp_function_segment_start): Return a new
10788         Segment_start_expression.
10789         * gold/script-c.h (script_saw_segment_start_expression): New function
10790         prototype.
10791         * script-sections.cc (Script_sections::Script_sections): Initialize
10792         SAW_SEGMENT_START_EXPRESSION_ to false.
10793         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10794         and -Tbbs options to specify section addresses if given in
10795         command line and no SEGMENT_START expression is seen in a script.
10796         * script-sections.h (Script_sections::saw_segment_start_expression,
10797         Script_sections::set_saw_segment_start_expression): New method
10798         definition.
10799         (Script_sections::saw_segment_start_expression_): New data member
10800         declaration.
10801         * script.cc (script_saw_segment_start_expression): New function.
10802         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10803         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10804         script_test_7.sh and script_test_8.sh.
10805         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10806         script_test_8.stdout.
10807         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10808         (script_test_6, script_test_6.stdout, script_test_7,
10809         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10810         * Makefile.in: Regenerate.
10811         * testsuite/script_test_6.sh: New file.
10812         * testsuite/script_test_6.t: Same.
10813         * testsuite/script_test_7.sh: Same.
10814         * testsuite/script_test_7.t: Same.
10815         * testsuite/script_test_8.sh: Same.
10816
10817 2009-10-16  Doug Kwan  <dougkwan@google.com>
10818
10819         * output.cc (Output_segment::set_section_list_address): Cast
10820         expressions to unsigned long long type to avoid format warnings.
10821
10822 2009-10-15  Ian Lance Taylor  <iant@google.com>
10823
10824         * script.cc (Script_options::add_symbol_assignment): Always add a
10825         dot assignment to script_sections_.
10826         * script-sections.cc (Script_sections::add_dot_assignment):
10827         Initialize if necessary.
10828
10829         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10830         program headers with no load segment if there is a linker script.
10831
10832         * layout.cc (Layout::set_segment_offsets): Align the file offset
10833         to the segment aligment for -N or -n with no load segment.
10834         * output.cc (Output_segment::add_output_section): Don't crash if
10835         the first section is a TLS section.
10836         (Output_segment::set_section_list_addresses): Print an error
10837         message if the address moves backward in a linker script.
10838         * script-sections.cc
10839         (Output_section_element_input::set_section_addresses): Don't
10840         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10841         (Orphan_output_section::set_section_addresses): Likewise.
10842
10843 2009-10-15  Doug Kwan  <dougkwan@google.com>
10844
10845         * layout.cc (Layout::finish_dynamic_section): Generate tags
10846         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10847         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10848         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10849
10850 2009-10-14  Ian Lance Taylor  <iant@google.com>
10851
10852         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10853         fields.
10854         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10855         data_shdr fields of relinfo.
10856         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10857         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10858         R_386_TLS_LDO_32, adjust based on section flags.
10859         (Target_i386::Relocate::fix_up_ldo): Remove.
10860
10861 2009-10-13  Ian Lance Taylor  <iant@google.com>
10862
10863         Add support for -pie.
10864         * options.h (class General_options): Add -pie and
10865         --pic-executable.
10866         (General_options::output_is_position_independent): Test -pie.
10867         (General_options::output_is_executable): Return true if not shared
10868         and not relocatable.
10869         (General_options::output_is_pie): Remove.
10870         * options.cc (General_options::finalize): Reject incompatible uses
10871         of -pie.
10872         * gold.cc (queue_middle_tasks): A -pie link is not static.
10873         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10874         * symtab.cc (Symbol::final_value_is_known): Return false if
10875         output_is_position_independent.
10876         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10877         output_is_position_independent.
10878         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10879         output_is_position_independent.
10880         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10881         output_is_position_independent.
10882         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10883         two_file_pie_test.
10884         (basic_pie_test.o, basic_pie_test): New targets.
10885         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10886         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10887         (two_file_pie_test): New target.
10888         * testsuite/Makefile.in: Rebuild.
10889         * README: Remove note saying that -pie is not supported.
10890
10891 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10892
10893         * options.h (class General_options): Add -init and -fini.
10894         * layout.cc (Layout::finish_dynamic_section): Emit
10895         given init and fini functions.
10896
10897 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10898
10899         * gc.h (gc_process_relocs): Check if icf is enabled using new
10900         function.
10901         * gold.cc (queue_initial_tasks): Likewise.
10902         (queue_middle_tasks): Likewise.
10903         * object.cc (do_layout): Likewise.
10904         * symtab.cc (is_section_folded): Likewise.
10905         * main.cc (main): Likewise.
10906         * reloc.cc (Read_relocs::run): Likewise.
10907         (Sized_relobj::do_scan_relocs): Likewise.
10908         * icf.cc (is_function_ctor_or_dtor): New function.
10909         (Icf::find_identical_sections): Check if function is ctor or dtor when
10910         safe icf is chosen.
10911         * options.h (General_options::icf): Change option to be an enum.
10912         (Icf_status): New enum.
10913         (icf_enabled): New method.
10914         (icf_safe_folding): New method.
10915         (set_icf_status): New method.
10916         (icf_status_): New variable.
10917         * (options.cc) (General_options::finalize): Set icf_status_.
10918         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10919         icf_test and icf_keep_unique_test to use the --icf enum flag.
10920         * testsuite/icf_safe_test.sh: New file.
10921         * testsuite/icf_safe_test.cc: New file.
10922
10923 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10924
10925         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10926         includes to gc.h and icf.h.
10927         * arm.cc: Include gc.h.
10928         * gold.cc: Likewise.
10929         * i386.cc: Likewise.
10930         * powerpc.cc: Likewise.
10931         * sparc.cc: Likewise.
10932         * x86_64.cc: Likewise.
10933         * gc.h: Include icf.h.
10934
10935 2009-10-11  Ian Lance Taylor  <iant@google.com>
10936
10937         * plugin.cc: Include "gold.h" before other header files.
10938
10939 2009-10-10  Chris Demetriou  <cgd@google.com>
10940
10941         * options.h (Input_file_argument::Input_file_type): New enum.
10942         (Input_file_argument::is_lib_): Replace with...
10943         (Input_file_argument::type_): New member.
10944         (Input_file_argument::Input_file_argument): Take Input_file_type
10945         'type' rather than boolean 'is_lib' as second argument.
10946         (Input_file_argument::is_lib): Use type_.
10947         (Input_file_argument::is_searched_file): New function.
10948         (Input_file_argument::may_need_search): Handle is_searched_file.
10949         * options.cc (General_options::parse_library): Support -l:filename.
10950         (General_options::parse_just_symbols): Update for Input_file_argument
10951         changes.
10952         (Command_line::process): Likewise.
10953         * archive.cc (Archive::get_file_and_offset): Likewise.
10954         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10955         * script.cc (read_script_file, script_add_file): Likewise.
10956         * fileread.cc (Input_file::Input_file): Likewise.
10957         (Input_file::will_search_for): Handle is_searched_file.
10958         (Input_file::open): Likewise.
10959         * readsyms.cc (Read_symbols::get_name): Likewise.
10960         * testsuite/Makefile.am (searched_file_test): New test.
10961         * testsuite/Makefile.in: Regenerate.
10962         * testsuite/searched_file_test.cc: New file.
10963         * testsuite/searched_file_test_lib.cc: New file.
10964
10965 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10966             Ian Lance Taylor  <iant@google.com>
10967
10968         * descriptor.cc: Include <cstdio> and "binary-io.h".
10969         (Descriptors::open): Open the files in binary mode always.
10970         * script.cc (Lex::get_token): Treat \r as whitespace.
10971
10972 2009-10-09  Ian Lance Taylor  <iant@google.com>
10973
10974         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10975
10976 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10977             Ian Lance Taylor  <iant@google.com>
10978
10979         * configure.ac: Check for readv function also.
10980         * fileread.cc (readv): Define if not HAVE_READV.
10981         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10982         does not exist.
10983         * config.in: Regenerate.
10984         * configure: Regenerate.
10985
10986 2009-10-09  Doug Kwan  <dougkwan@google.com>
10987
10988         * layout.cc (Layout::make_output_section): Call target hook to make
10989         ordinary output section.
10990         (Layout::finalize): Adjust parameter list of call the
10991         Target::may_relax().
10992         * layout.h (class Layout::section_list): New method.
10993         * merge.h (Output_merge_base::entsize): Change visibility to public.
10994         (Output_merge_base::is_string, Output_merge_base::do_is_string):
10995         New methods.
10996         (Output_merge_string::do_is_string): New method.
10997         * object.cc (Sized_relobj::do_setup): renamed from
10998         Sized_relobj::set_up.
10999         * object.h (Sized_relobj::adjust_shndx,
11000         Sized_relobj::initializ_input_to_output_maps,
11001         Sized_relobj::free_input_to_output_maps): Change visibilities to
11002         protected.
11003         (Sized_relobj::setup): Virtualize.
11004         (Sized_relobj::do_setup): New method declaration.
11005         (Sized_relobj::invalidate_section_offset,
11006         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11007         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11008         * options.cc (parse_int): New function.
11009         * options.h (parse_int): New declaration.
11010         (DEFINE_int): New macro.
11011         (stub_group_size): New option.
11012         * output.cc (Output_section::Output_section): Initialize memebers
11013         merge_section_map_, merge_section_by_properties_map_,
11014         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11015         (Output_section::add_input_section): Handled deferred code-fill
11016         generation and remove an old comment.
11017         (Output_section::add_relaxed_input_section): New method definition.
11018         (Output_section::add_merge_input_section): Use merge section by
11019         properties map to speed to search.  Update merge section maps
11020         as appropriate.
11021         (Output_section::build_relaxation_map): New method definition.
11022         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11023         Same.
11024         (Output_section::relax_input_section): Renamed to
11025         Output_section::convert_input_sections_to_relaxed_sections and change
11026         interface to take a vector of pointers to relaxed sections.
11027         (Output_section::find_merge_section,
11028         Output_section::find_relaxed_input_section): New method definitions.
11029         (Output_section::is_input_address_mapped,
11030         Output_section::output_offset, Output_section::output_address):
11031         Use output section data maps to speed up searching.
11032         (Output_section::find_starting_output_address): Add comments.
11033         (Output_section::do_write,
11034         Output_section::write_to_postprocessing_buffer): Do code-fill
11035         generation as appropriate.
11036         (Output_section::get_input_sections): Invalidate relaxed input section
11037         map.
11038         (Output_section::restore_states): Adjust type of checkpoint .
11039         Invalidate relaxed input section map.
11040         * output.h (Output_merge_base): New class declaration.
11041         (Input_section_specifier): New class defintion.
11042         (class Output_relaxed_input_section) Change base class to
11043         Output_section_data_build.
11044         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11045         base class initializer.
11046         (Output_section::add_relaxed_input_section): New method declaration.
11047         (Output_section::Input_section): Change visibility to protected.
11048         (Output_section::Input_section::relobj,
11049         Output_section::Input_section::shndx): Handle relaxed input sections.
11050         Output_section::input_sections) Change visibility to protected.  Also
11051         define overload to return a non-const pointer.
11052         (Output_section::Merge_section_properties): New class defintion.
11053         (Output_section::Merge_section_by_properties_map,
11054         Output_section::Output_section_data_by_input_section_map,
11055         Output_section::Relaxation_map): New types.
11056         (Output_section::relax_input_section): Rename method to
11057         Output_section::convert_input_sections_to_relaxed_sections and change
11058         interface to take a vector of relaxed section pointers.
11059         (Output_section::find_merge_section,
11060         Output_section::find_relaxed_input_section,
11061         Output_section::build_relaxation_map,
11062         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11063         New method declarations.
11064         (Output_section::merge_section_map_
11065         Output_section::merge_section_by_properties_map_,
11066         Output_section::relaxed_input_section_map_,
11067         Output_section::is_relaxed_input_section_map_valid_,
11068         Output_section::generate_code_fills_at_write_): New data members.
11069         * script-sections.cc
11070         (Output_section_element_input::set_section_addresses): Call
11071         current_data_size and addralign methods of relaxed input sections.
11072         (Orphan_output_section::set_section_addresses): Call current_data_size
11073         and addralign methods of relaxed input sections.
11074         * symtab.cc (Symbol_table::compute_final_value): Extract template
11075         from the body of Symbol_table::sized_finalize_symbol.
11076         (Symbol_table::sized_finalized_symbol): Call
11077         Symbol_table::compute_final_value.
11078         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11079         (Symbol_table::compute_final_value): New templated method declaration.
11080         * target.cc (Target::do_make_output_section): New method defintion.
11081         * target.h (Target::make_output_section): New method declaration.
11082         (Target::relax): Add more parameters for input objects, symbol table
11083         and layout.  Adjust call to do_relax.
11084         (Target::do_make_output_section): New method declaration.
11085         (Target::do_relax): Add parameters for input objects, symbol table
11086         and layout.
11087
11088 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11089
11090         * pread.c: Include stdio.h.
11091
11092 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11093
11094         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11095         defined.
11096
11097 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11098
11099         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11100         Change read_shndx type to unsigned int.
11101         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11102         int.
11103         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11104         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11105         Change read_shndx type to unsigned int.
11106         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11107         int.
11108         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11109         * layout.cc (Layout::create_symtab_sections): Cast the result of
11110         local_symcount * symsize to off_t in the gold_assert.
11111
11112 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11113
11114         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11115         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11116         R_ARM_BASE_ABS.
11117         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11118         (Arm_relocate_functions::thm_abs5): New function.
11119         (Arm_relocate_functions::abs12): New function.
11120         (Arm_relocate_functions::abs16): New function.
11121         (Arm_relocate_functions::base_abs): New function.
11122         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11123         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11124         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11125         R_ARM_BASE_ABS.
11126         (Scan::global): Likewise.
11127         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11128         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11129         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11130         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11131         R_ARM_BASE_ABS.
11132
11133 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11134
11135         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11136         (Arm_relocate_functions::movt_prel): New function.
11137         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11138         (Arm_relocate_functions::thm_movt_prel): New function.
11139         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11140         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11141         (Scan::global, Relocate::relocate): Likewise.
11142         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11143
11144 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11145
11146         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11147         Incremental_checker.
11148         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11149         unsigned int.
11150         (class Incremental_inputs_header): New class.
11151         (Incremental_inputs_header_writer): Edit comment.
11152         (Incremental_inputs_entry): New class.
11153         (Incremental_inputs_entry_writer): Edit comment.
11154         (Sized_incremental_binary::do_find_incremental_inputs_section):
11155         Add *strtab_shndx parameter, fill it.
11156         (Sized_incremental_binary::do_check_inputs): New method.
11157         (Incremental_checker::can_incrementally_link_output_file): Use
11158         Sized_incremental_binary::check_inputs.
11159         (Incremental_inputs::report_command_line): Save command line in
11160         command_line_.
11161         * incremental.h:
11162         (Incremental_binary::find_incremental_inputs_section): New
11163         method.
11164         (Incremental_binary::do_find_incremental_inputs_section): Add
11165         strtab_shndx parameter.
11166         (Incremental_binary::do_check_inputs): New pure virtual method.
11167         (Sized_incremental_binary::do_check_inputs): Declare.
11168         (Incremental_checker::Incremental_checker): Add incremental_inputs
11169         parameter, use it to initialize incremental_inputs_.
11170         (Incremental_checker::incremental_inputs_): New field.
11171         (Incremental_checker::command_line): New method.
11172         (Incremental_checker::inputs): New method.
11173         (Incremental_checker::command_line_): New field.
11174
11175 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11176
11177         * incremental.cc: Include <cstdarg> and "target-select.h".
11178         (vexplain_no_incremental): New function.
11179         (explain_no_incremental): New function.
11180         (Incremental_binary::error): New method.
11181         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11182         method.
11183         (make_sized_incremental_binary): New function.
11184         (open_incremental_binary): New function.
11185         (can_incrementally_link_file): Add checks if output is ELF and has
11186         inputs section.
11187         * incremental.h: Include "elfcpp_file.h" and "output.h".
11188         (Incremental_binary): New class.
11189         (Sized_incremental_binary): New class.
11190         (open_incremental_binary): Declare.
11191         * object.cc (is_elf_object): Use
11192         elfcpp::Elf_recognizer::is_elf_file.
11193         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11194         * output.h (Output_file::filesize): New method.
11195
11196 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11197
11198         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11199         New function.
11200         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11201         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11202         function.
11203         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11204         function.
11205         (Arm_relocate_functions::movw_abs_nc): New function.
11206         (Arm_relocate_functions::movt_abs): New function.
11207         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11208         (Arm_relocate_functions::thm_movt_abs): New function.
11209         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11210         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11211         (Scan::global): Likewise.
11212         (Relocate::relocate): Likewise.
11213         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11214
11215 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11216
11217         * arm.cc (Arm_relocate_functions::got_prel) New function.
11218         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11219         (Relocate::relocate): Likewise.
11220         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11221
11222 2009-10-06  Ian Lance Taylor  <iant@google.com>
11223
11224         * options.h (class General_options): Define
11225         split_stack_adjust_size parameter.
11226         * object.h (class Object): Add uses_split_stack_ and
11227         has_no_split_stack_ fields.  Add uses_split_stack and
11228         has_no_split_stack accessor functions.  Declare
11229         handle_split_stack_section.
11230         (class Reloc_symbol_changes): Define.
11231         (class Sized_relobj): Define Function_offsets.  Declare
11232         split_stack_adjust, split_stack_adjust_reltype, and
11233         find_functions.
11234         * object.cc (Object::handle_split_stack_section): New function.
11235         (Sized_relobj::do_layout): Call handle_split_stack_section.
11236         * dynobj.cc (Sized_dynobj::do_layout): Call
11237         handle_split_stack_section.
11238         * reloc.cc (Sized_relobj::relocate_sections): Call
11239         split_stack_adjust for executable sections in split_stack
11240         objects.  Pass reloc_map to relocate_section.
11241         (Sized_relobj::split_stack_adjust): New function.
11242         (Sized_relobj::split_stack_adjust_reltype): New function.
11243         (Sized_relobj::find_functions): New function.
11244         * target-reloc.h: Include "object.h".
11245         (relocate_section): Add reloc_symbol_changes parameter.  Change
11246         all callers.
11247         * target.h (class Target): Add calls_non_split method.  Declare
11248         do_calls_non_split virtual method.  Declare match_view and
11249         set_view_to_nop.
11250         * target.cc: Include "elfcpp.h".
11251         (Target::do_calls_non_split): New function.
11252         (Target::match_view): New function.
11253         (Target::set_view_to_nop): New function.
11254         * gold.cc (queue_middle_tasks): Give an error if mixing
11255         split-stack and non-split-stack objects with -r.
11256         * i386.cc (Target_i386::relocate_section): Add
11257         reloc_symbol_changes parameter.
11258         (Target_i386::do_calls_non_split): New function.
11259         * x86_64.cc (Target_x86_64::relocate_section): Add
11260         reloc_symbol_changes parameter.
11261         (Target_x86_64::do_calls_non_split): New function.
11262         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11263         parameter.
11264         * powerpc.cc (Target_powerpc::relocate_section): Add
11265         reloc_symbol_changes parameter.
11266         * sparc.cc (Target_sparc::relocate_section): Add
11267         reloc_symbol_changes parameter.
11268         * configure.ac: Call AM_CONDITIONAL for the default target.
11269         * configure: Rebuild.
11270         * testsuite/Makefile.am (TEST_AS): New variable.
11271         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11272         (check_DATA): Add split_i386 and split_x86_64 files.
11273         (SPLIT_DEFSYMS): Define.
11274         (split_i386_[1234n].o): New targets.
11275         (split_i386_[124]): New targets.
11276         (split_i386_[1234r].stdout): New targets.
11277         (split_x86_64_[1234n].o): New targets.
11278         (split_x86_64_[124]): New targets.
11279         (split_x86_64_[1234r].stdout): New targets.
11280         (MOSTLYCLEANFILES): Add new executables.
11281         * testsuite/split_i386.sh: New file.
11282         * testsuite/split_x86_64.sh: New file.
11283         * testsuite/split_i386_1.s: New file.
11284         * testsuite/split_i386_2.s: New file.
11285         * testsuite/split_i386_3.s: New file.
11286         * testsuite/split_i386_4.s: New file.
11287         * testsuite/split_i386_n.s: New file.
11288         * testsuite/split_x86_64_1.s: New file.
11289         * testsuite/split_x86_64_2.s: New file.
11290         * testsuite/split_x86_64_3.s: New file.
11291         * testsuite/split_x86_64_4.s: New file.
11292         * testsuite/split_x86_64_n.s: New file.
11293         * testsuite/testfile.cc (Target_test): Update relocation_section
11294         function.
11295         * testsuite/Makefile.in: Rebuild.
11296
11297 2009-10-06  Ian Lance Taylor  <iant@google.com>
11298
11299         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11300         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11301         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11302         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11303         the address on ldo_addrs_.
11304         (Target_i386::Relocate::fix_up_ldo): New function.
11305
11306 2009-10-06   Rafael Espindola  <espindola@google.com>
11307
11308         * plugin.cc (add_input_library): New.
11309         (Plugin::load): Add add_input_library to tv.
11310         (Plugin_manager::add_input_file): Add the is_lib argument.
11311         (add_input_file): Update call to Plugin_manager::add_input_file.
11312         (add_input_library): New.
11313         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11314
11315 2009-09-30  Doug Kwan  <dougkwan@google.com>
11316
11317         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11318         symbol and call Symbol::may_need_copy_reloc to determine if
11319         a copy reloc is needed.
11320         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11321         nocopyreloc is given in command line.
11322         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11323         given in command line.
11324         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11325         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11326         of the removed Target_i386::may_need_copy_reloc.
11327         * options.h (copyreloc): New option with default value false.
11328         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11329         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11330         instead of the removed Target_powerpc::may_need_copy_reloc.
11331         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11332         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11333         instead of the removed Target_sparc::may_need_copy_reloc.
11334         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11335         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11336         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11337         instead of the removed Target_x86_64::may_need_copy_reloc.
11338
11339 2009-09-30  Ian Lance Taylor  <iant@google.com>
11340
11341         * object.h (class Object): Remove target_ field, and target,
11342         sized_target, and set_target methods.
11343         (Object::sized_target): Remove.
11344         (class Sized_relobj): Update declarations.  Remove sized_target.
11345         * object.cc (Sized_relobj::setup): Remove target parameter.
11346         Change all callers.
11347         (Input_objects::add_object): Don't do anything with the target.
11348         (make_elf_sized_object): Add punconfigured parameter.  Change all
11349         callers.  Set or test parameter target.
11350         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11351         Change all callers.
11352         * parameters.cc (Parameters::set_target): Change parameter type to
11353         be non-const.
11354         (Parameters::default_target): Remove.
11355         (set_parameters_target): Change parameter type to be non-const.
11356         (parameters_force_valid_target): New function.
11357         (parameters_clear_target): New function.
11358         * parameters.h (class Parameters): Update declarations.  Remove
11359         default_target method.  Add sized_target and clear_target
11360         methods.  Change target_ to be non-const.
11361         (set_parameters_target): Update declaration.
11362         (parameters_force_valid_target): Declare.
11363         (parameters_clear_target): Declare.
11364         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11365         as NULL if we aren't searching.
11366         (Add_symbols::run): Don't check for compatible target.
11367         * fileread.cc (Input_file::open_binary): Call
11368         parameters_force_valid_target.
11369         * gold.cc (queue_middle_tasks): Likewise.
11370         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11371         set_target on object.
11372         * dynobj.h (class Sized_dynobj): Update declarations.
11373         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11374         make_elf_object returns NULL.
11375         (Archive::include_member): Don't check whether object target is
11376         compatible.
11377         * output.cc (Output_section::add_input_section): Get target from
11378         parameters.
11379         (Output_section::relax_input_section): Likewise.
11380         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11381         parameters.
11382         (Sized_relobj::do_scan_relocs): Likewise.
11383         (Sized_relobj::relocate_sections): Likewise.
11384         * resolve.cc (Symbol_table::resolve): Likewise.
11385         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11386         parameter.  Change all callers.
11387         (Symbol_table::add_from_object): Get target from parameters.
11388         (Symbol_table::add_from_relobj): Don't check object target.
11389         (Symbol_table::add_from_dynobj): Likewise.
11390         (Symbol_table::define_special_symbol): Get target from
11391         parameters.
11392         * symtab.h (class Symbol_table): Update declaration.
11393         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11394         parameter.  Change all callers.  Clear parameter target.
11395         (Binary_test): Test target here.
11396         * testsuite/object_unittest.cc (gold_testsuite): Remove
11397         target_test_pointer parameter.  Change all callers.
11398         (Object_test): Test target here.
11399
11400 2009-09-26  Ian Lance Taylor  <iant@google.com>
11401
11402         * testsuite/initpri1.c: Don't try to use constructor priorities if
11403         compiling with gcc before 4.3.
11404
11405 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11406
11407         * testsuite/retain_symbols_file_test.sh (check_present): Change
11408         output file name to retain_symbols_file_test.stdout.
11409         (check_absent): Likewise.
11410
11411 2009-09-18  Craig Silverstein  <csilvers@google.com>
11412
11413         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11414         * options.cc: Include <cerrno> and <fstream>.
11415         (General_options::finalize): Parse -retain-symbols-file tag.
11416         * options.h: New flag.
11417         (General_options): New method should_retain_symbol, new
11418         variable symbols_to_retain.
11419         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11420         should_retain_symbol map.
11421         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11422         * testsuite/Makefile.in: Regenerate.
11423         * testsuite/retain_symbols_file_test.sh: New file.
11424
11425 2009-09-18  Nick Clifton  <nickc@redhat.com>
11426
11427         * po/es.po: Updated Spanish translation.
11428
11429 2009-09-17  Doug Kwan  <dougkwan@google.com>
11430
11431         * debug.h (DEBUG_RELAXATION): New constant.
11432         (DEBUG_ALL): Add DEBUG_RELAXATION.
11433         (debug_string_to_enum): Add relaxation debug option.
11434         * layout.cc
11435         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11436         Layout::Relaxation_debug_check::read_sections,
11437         Layout::Relaxation_debug_check::read_sections): New method definitions.
11438         (Layout::Layout): Initialize data members
11439         record_output_section_data_from_scrips_,
11440         script_output_section_data_list_ and relaxation_debug_check_.
11441         (Layout::save_segments, Layout::restore_segments,
11442         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11443         Layout::relaxation_loop_body): New method definitions.
11444         (Layout::finalize): Support relaxation.  Move section layout code to
11445         Layout::relaxation_loop_body.
11446         (Layout::set_asection_address_from_script): Move code for orphan
11447         section placement out.
11448         (Layout::place_orphan_sections_in_script): New method definition.
11449         * layout.h (Output_segment_headers, Output_file_header):
11450         New forward class declarations.
11451         (Layout::~Layout): Define.
11452         (Layout::new_output_section_data_from_script): New method definition.
11453         (Layout::place_orphan_sections_in_script): New method declaration.
11454         (Layout::Segment_states): New type declaration.
11455         (Layout::save_segments, Layout::restore_segments,
11456         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11457         Layout::relaxation_loop_body): New method declarations.
11458         (Layout::Output_section_data_list): New type declaration.
11459         (Layout::Relaxation_debug_check): New class definition.
11460         (Layout::record_output_section_data_from_script_,
11461         Layout::script_output_section_data_list_, Layout::segment_states_,
11462         Layout::relaxation_debug_check_): New data members.
11463         * output.cc: (Output_section_headers::do_size): New method definition.
11464         (Output_section_headers::Output_section_headers): Move size
11465         computation to Output_section_headers::do_size.
11466         (Output_segment_headers::do_size): New method definition.
11467         (Output_file_header::Output_file_header): Move size computation to
11468         Output_file_header::do_size and call it.
11469         (Output_file_header::do_size): New method definition.
11470         (Output_data_group::Output_data_group): Adjust call to
11471         Output_section_data.
11472         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11473         (Output_symtab_xindex::do_write): Add array bound check.
11474         (Output_section::Input_section::print_to_mapfile): Handle
11475         RELAXED_INPUT_SECTION_CODE.
11476         (Output_section::Output_section): Initialize data member checkpoint_.
11477         (Output_section::~Output_section): Delete checkpoint object pointed
11478         by checkpoint_.
11479         (Output_section::add_input_section): Always add an Input_section if
11480         relaxing.
11481         (Output_section::add_merge_input_section): Add assert.
11482         (Output_section::relax_input_section): New method definition.
11483         (Output_section::set_final_data_size): Set load address to zero for
11484         an unallocated section.
11485         (Output_section::do_address_and_file_offset_have_reset_values):
11486         New method definition.
11487         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11488         Handle relaxed input section.
11489         (Output_section::sort_attached_input_sections): Checkpoint input
11490         section list lazily.
11491         (Output_section::get_input_sections): Change type of input_sections to
11492         list of Simple_input_section pointers.  Checkpoint input section list
11493         lazily.  Also handle relaxed input sections.
11494         (Output_section::add_input_section_for_script): Take a reference to
11495         a Simple_input_section object instead of Relobj pointer and section
11496         index as parameter.  Handle relaxed input sections.
11497         (Output_section::save_states, Output_section::restore_states): New
11498         method definitions.
11499         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11500         (Output_data::is_data_size_fixed): New method definition.
11501         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11502         if it is fixed.
11503         (Output_data::address_and_file_offset_have_reset_values): New method
11504         definition.
11505         (Output_data::do_address_and_file_offset_have_reset_values): New method
11506         definition.
11507         (Output_data::set_data_size): Check that data size is not fixed.
11508         (Output_data::fix_data_size): New method definition.
11509         (Output_data::is_data_size_fixed_): New data member.
11510         (Output_section_headers::set_final_data_size): New method definition.
11511         (Output_section_headers::do_size): New method declaration.
11512         (Output_segment_headers::set_final_data_size): New method definition.
11513         (Output_segment_headers::do_size): New method declaration.
11514         (Output_file_header::set_final_data_size)::New method definition.
11515         (Output_file_header::do_size)::New method declaration.
11516         (Output_section_data::Output_section_data): Add new parameter
11517         is_data_size_fixed and use it to fix data size.
11518         (Output_data_const::Output_data_const): Adjust call to base class
11519         constructor and fix data size.
11520         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11521         base class constructor and fix data size.
11522         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11523         base class constructor and fix data size.
11524         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11525         class constructor and fix data size.
11526         (Output_data_group::set_final_data_size): New method definition.
11527         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11528         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11529         class constructor and fix data size.
11530         (Output_relaxed_input_section): New class definition.
11531         (Output_section::Simple_input_section): New class definition.
11532         (Output_section::get_input_sections): Adjust parameter list.
11533         (Output_section::add_input_section_for_script): Same.
11534         (Output_section::save_states, Output_section::restore_states,
11535         Output_section::do_address_and_file_offset_have_reset_values,
11536         (Output_section::Input_section::Input_section): Handle
11537         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11538         Output_relaxed_input_section.
11539         (Output_section::Input_section::is_input_section,
11540         Output_section::Input_section::set_output_section): Handle relaxed
11541         input section.
11542         (Output_section::Input_section::is_relaxed_input_section,
11543         Output_section::Input_section::output_section_data,
11544         Output_section::Input_section::relaxed_input_section): New method
11545         definitions.
11546         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11547         value.
11548         (Output_section::Input_section::u1_): Update comments.
11549         (Output_section::Input_section::u2_): Add new union member poris.
11550         (Output_section::Checkpoint_output_section): New classs definition.
11551         (Output_section::relax_input_section): New method declaration.
11552         (Output_section::checkpoint_): New data member.
11553         (Output_segment): Update comments.
11554         (Output_segment::Output_segment): Un-privatize copy constructor.
11555         (Output_segment::operator=): Un-privatize.
11556         * script-sections.cc (Output_section_element::Input_section_list):
11557         Change element type to Output_section::Simple_input_section.
11558         (Output_section_element_dot_assignment::set_section_addresses):
11559         Register output section data for relaxation clean up.
11560         (Output_data_exression::Output_data_expression): Adjust call to base
11561         constructor to fix data size.
11562         (Output_section_element_data::set_section_addresses): Register
11563         Output_data_expression object for relaxation clean up.
11564         (struct Input_section_info): Replace Relobj pointer and section index
11565         pair with Output_section::Simple_input_section and Convert struct to a
11566         class.
11567         (Input_section_sorter::operator()): Adjust access to
11568         Input_section_info data member to use accessors.
11569         (Output_section_element_input::set_section_addresses): Use layout
11570         parameter.  Adjust code to use Output_section::Simple_input_section
11571         and Input_secction_info classes.  Register filler for relaxation
11572         clean up.
11573         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11574         and section index pair with Output_section::Simple_input_section
11575         class.  Adjust code accordingly.
11576         (Phdrs_element::release_segment): New method definition.
11577         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11578         segment list.
11579         (Script_sections::release_segments): New method definition.
11580         * gold/script-sections.h (Script_sections::release_segments): New
11581         method declaration.
11582         * gold/target.h (Target::may_relax, Target::relax,
11583         Target::do_may_relax, Target::do_relax): New method definitions.
11584
11585 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11586
11587         * arm.cc (has_signed_unsigned_overflow): New function.
11588         (Arm_relocate_functions::abs8): New function.
11589         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11590         (Target_arm::Scan::global): Likewise.
11591         (Target_arm::relocate::relocate): Likewise.
11592         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11593         Likewise.
11594
11595 2009-09-16  Cary Coutant  <ccoutant@google.com>
11596
11597         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11598         * testsuite/Makefile.in: Regenerate.
11599
11600 2009-09-11  Nick Clifton  <nickc@redhat.com>
11601
11602         * po/gold.pot: Updated by the Translation project.
11603
11604 2009-09-08  Cary Coutant  <ccoutant@google.com>
11605
11606         * output.cc (Output_file::open): Add execute permission to empty file.
11607         * testsuite/Makefile.am (permission_test): New test.
11608         * testsuite/Makefile.in: Regenerate.
11609
11610 2009-09-02  Ian Lance Taylor  <iant@google.com>
11611
11612         * output.cc (Output_file::resize): Call map_no_anonymous rather
11613         than map.
11614
11615 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11616
11617         * gold.cc: Include "incremental.h".
11618         (queue_initial_tasks): Call Incremental_checker methods.
11619         * incremental.cc: Include "output.h".
11620         (Incremental_checker::can_incrementally_link_output_file): New
11621         method.
11622         * incremental.h (Incremental_checker): New class.
11623
11624         * output.cc (Output_file::open_for_modification): New method.
11625         (Output_file::map_anonymous): Changed return type to bool.  Record
11626         map in base_ field.
11627         (Output_file::map_no_anonymous): New method, broken out of map.
11628         (Output_file::map): Use map_no_anonymous and map_anonymous.
11629         * output.h (class Output_file): Update declarations.
11630
11631 2009-08-24  Cary Coutant  <ccoutant@google.com>
11632
11633         * options.h (Command_line::Pre_options): New class.
11634         (Command_line::pre_options): New member.
11635         * options.cc (gold::options::ready_to_register): New variable.
11636         (One_option::register_option): Do nothing if not registering options.
11637         Assert if same short option registered twice.
11638         (General_options::General_options): Turn off option registration when
11639         done constructing.
11640         (Command_line::Pre_options::Pre_options): New constructor.
11641
11642 2009-08-24  Cary Coutant  <ccoutant@google.com>
11643
11644         * options.h (General_options::no_keep_memory): Remove incorrect
11645         short option.
11646
11647 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11648
11649         * Makefile.am (am__skiplex, am__skipyacc): New.
11650         * Makefile.in: Regenerate.
11651
11652 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11653
11654         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11655         (INCLUDES): ... this.
11656         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11657         (AM_CPPFLAGS): Renamed from ...
11658         (INCLUDE): ... this.
11659         * Makefile.in, testsuite/Makefile.in: Regenerate.
11660
11661         * Makefile.in: Regenerate.
11662         * aclocal.m4: Likewise.
11663         * config.in: Likewise.
11664         * configure: Likewise.
11665         * testsuite/Makefile.in: Likewise.
11666
11667         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11668         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11669         * Makefile.in: Regenerate.
11670         * testsuite/Makefile.in: Regenerate.
11671
11672 2009-08-19  Cary Coutant  <ccoutant@google.com>
11673
11674         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11675         symbols in shared libraries overridden by hidden or internal symbols
11676         in the main program.
11677
11678 2009-08-19  Chris Demetriou  <cgd@google.com>
11679
11680         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11681         checking source file names in error messages.
11682
11683 2009-08-18  Doug Kwan  <dougkwan@google.com>
11684
11685         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11686         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11687         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11688         an elfcpp::Ehdr as parameter.
11689         * object.cc (Object::set_target): Remove the version that looks up
11690         a target and sets it.
11691         (Sized_relobj::setup): Take a Target object instead of
11692         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11693         (make_elf_sized_object): Find target and ask target to
11694         make an ELF object.
11695         * object.h: (Object::set_target): Remove the version that looks up
11696         a target and sets it.
11697         (Sized_relobj::setup): Take a Target object instead of
11698         an elfcpp:Ehdr as parameter.
11699         * target.cc: Include dynobj.h.
11700         (Target::do_make_elf_object_implementation): New.
11701         (Target::do_make_elf_object): New.
11702         * target.h (Target::make_elf_object): New template declaration.
11703         (Target::do_make_elf_object): New method declarations.
11704         (Target::do_make_elf_object_implementation): New template declaration.
11705
11706 2009-08-14  Ian Lance Taylor  <iant@google.com>
11707
11708         * gold.h (FUNCTION_NAME): Define.
11709         (gold_unreachable): Use FUNCTION_NAME.
11710
11711 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11712
11713         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11714         symbol in the --keep-unique list is not found.
11715
11716 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11717
11718         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11719         been maked as --keep-unique.
11720         (Icf::unfold_section): New function.
11721         * icf.h (Icf::unfold_section): New function.
11722         * options.h (General_options::keep_unique): New option.
11723         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11724         * testsuite/Makefile.in: Regenerate.
11725         * testsuite/icf_keep_unique_test.sh: New file.
11726         * testsuite/icf_keep_unique_test.cc: New file.
11727
11728 2009-08-12  Cary Coutant  <ccoutant@google.com>
11729
11730         PR 10471
11731         * resolve.cc (Symbol_table::resolve): Check for references from
11732         dynamic objects to hidden and internal symbols.
11733         * testsuite/Makefile.am (hidden_test.sh): New test.
11734         * testsuite/Makefile.in: Regenerate.
11735         * testsuite/hidden_test.sh: New script.
11736         * testsuite/hidden_test_1.c: New test source.
11737         * testsuite/hidden_test_main.c: New test source.
11738
11739 2009-08-11  Doug Kwan  <dougkwan@google.com>
11740
11741         * arm.cc: Update comments.
11742         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11743         segment to locate the .ARM.exidx section if present.
11744
11745 2009-08-09  Doug Kwan  <dougkwan@google.com>
11746
11747         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11748         patch.
11749
11750 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11751         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11752         compiler warnings.
11753
11754 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11755
11756         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11757         valid tls_segment only for non-debug-section relocations.
11758         * testsuite/Makefile.am: Add gc_tls_test.
11759         * testsuite/Makefile.in: Regenerate.
11760         * testsuite/gc_tls_test.cc: New file.
11761         * testsuite/gc_tls_test.sh: New file.
11762
11763 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11764
11765         * icf.cc: New file.
11766         * icf.h: New file.
11767         * Makefile.am (CCFILES): Add icf.cc.
11768         (HFILES): Add icf.h
11769         * Makefile.in: Regenerate.
11770         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11771         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11772         section, symbol and addend information for the relocs.
11773         * gold.cc (queue_middle_tasks): Call identical code folding.
11774         * gold.h: Add defines for multimap.
11775         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11776         to the call of finalize_local_symbols.
11777         * main.cc (main): Create object of class Icf.
11778         * object.cc (Sized_relobj::do_layout): Allow this function to be
11779         called twice during icf.
11780         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11781         to sections marked as identical by icf.
11782         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11783         when available.
11784         (Sized_relobj::do_section_entsize): New function.
11785         * object.h (Object::section_entsize): New function.
11786         (Object::do_section_entsize): New pure virtual function.
11787         (Relobj::finalize_local_symbols): Add new parameter.
11788         (Relobj::do_section_entsize): New function.
11789         * options.h (General_options::icf): New option.
11790         (General_options::icf_iterations): New option.
11791         (General_options::print_icf_sections): New option.
11792         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11793         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11794         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11795         icf.
11796         * symtab.cc (Symbol_table::is_section_folded): New function.
11797         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11798         to sections marked as identical by icf.
11799         * symtab.h (Symbol_table::set_icf): New function.
11800         (Symbol_table::icf): New function.
11801         (Symbol_table::is_section_folded): New function.
11802         (Symbol_table::icf_): New data member.
11803         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11804         * testsuite/Makefile.am: Add commands to build icf_test.
11805         * testsuite/Makefile.in: Regenerate.
11806         * testsuite/icf_test.sh: New file.
11807         * testsuite/icf_test.cc: New file.
11808
11809 2009-07-24  Chris Demetriou  <cgd@google.com>
11810
11811         * layout.cc (is_compressible_debug_section): Fix incorrect
11812         comment about compressed section names.
11813
11814 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11815
11816         PR 10419
11817         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11818
11819 2009-07-16  Ian Lance Taylor  <iant@google.com>
11820
11821         PR 10400
11822         * layout.h: #include <map>.
11823         (class Kept_section): Change from struct to class.  Add accessors
11824         and setters.  Add section size to Comdat_group mapping.  Change
11825         Comdat_group to std::map.  Add is_comdat_ field.  Add
11826         linkonce_size field in union.
11827         (class Layout): Update declaration of find_or_add_kept_section.
11828         Don't declare find_kept_object.
11829         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11830         parameter.  Add object, shndx, is_comdat, and is_group_name
11831         parameters.  Change all callers.  Adjust for new Kept_section.
11832         (Layout::find_kept_object): Remove.
11833         * object.cc (Sized_relobj::include_section_group): Update use of
11834         Kept_section.  Rename secnum to shndx.  Only record
11835         Kept_comdat_section if sections are the same size.
11836         (Sized_relobj::include_linkonce_section): Update use of
11837         Kept_section.  Only record Kept_comdat_section if sections are the
11838         same size.  Set size of linkonce section.
11839         (Sized_relobj::map_to_kept_section): Update call to
11840         get_kept_comdat_section.
11841         * object.h (class Sized_relobj): Rename fields in
11842         Kept_comdat_section to drop trailing underscores; change object
11843         field to Relobj*.  Change Kept_comdat_section_table to store
11844         struct rather than pointer.
11845         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11846         Add kept_object and kept_shndx parameters.  Change all callers.
11847         (Sized_relobj::get_kept_comdat_section): Change return type to
11848         bool.  Add kept_object and kept_shndx parameters.  Change all
11849         callers.
11850         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11851         Layout::find_or_add_kept_section.
11852
11853 2009-07-09  Ian Lance Taylor  <iant@google.com>
11854
11855         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11856         Reserve space in the hash table.
11857
11858 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11859
11860         * fileread.cc (File_read::get_mtime): New method.
11861         * fileread.h (Timespec): New structure.
11862         (File_read::get_mtime): New method.
11863         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11864         Renamed from timestamp_nsec.
11865         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11866         Elf_Xword.
11867         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11868         timestamp_nsec.
11869         (Incremental_inputs::report_archive): Save mtime; style fix.
11870         (Incremental_inputs::report_obejct): Save mtime; style fix.
11871         (Incremental_inputs::report_script): Save mtime; style fix.
11872         (Incremental_inputs::finalize_inputs): Style fix.
11873         (Incremental_inputs::finalize): Style fix.
11874         (Incremental_inputs::create_input_section_data): Store inputs
11875         mtime.
11876         * incremental.h (Incremental_inputs::report_script): Add mtime
11877         argument.
11878         (Incremental_inputs::Input_info::Input_info): Intialize only one
11879         union member.
11880         (Incremental_inputs::Input_info::archive): Move to nameless
11881         union.
11882         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11883         (Incremental_inputs::Input_info::script): Move to nameless union.
11884         (Incremental_inputs::mtime): New field.
11885         * script.cc (read_input_script): Pass file mtime to
11886         Incremental_input.
11887         * script.h (Script_info::inputs): Style fix.
11888
11889 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11890
11891         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11892         instead of 32.
11893
11894 2009-06-24  Ian Lance Taylor  <iant@google.com>
11895
11896         PR 10156
11897         * layout.cc (Layout::choose_output_section): If we find an
11898         existing section, update the flags.
11899         (Layout::create_notes): New function, broken out of
11900         Layout::finalize.
11901         (Layout::finalize): Don't create note sections.
11902         (Layout::create_note): Don't crash if linker script discards
11903         section.
11904         (Layout::create_gold_note): Likewise.
11905         (Layout::create_build_id): Likewise.  Don't set
11906         after_input_sections on the section.
11907         (Layout::create_executable_stack_info): Remove target parameter.
11908         Change caller.
11909         * layout.h (class Layout): Declare create_notes.  Update
11910         declaration of create_executable_stack_info.
11911         * gold.cc (queue_middle_tasks): Call create_notes.
11912         * output.cc (Output_section::update_flags_for_input_section): Move
11913         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11914         invalid.
11915         * output.h (Output_data::mark_address_invalid): New function.
11916         (class Output_section): Only declare, not define,
11917         update_flags_for_input_section.  Remove set_flags.
11918
11919 2009-06-24  Ian Lance Taylor  <iant@google.com>
11920
11921         * script-sections.cc (Output_section_definition::
11922         set_section_addresses): Rename shadowing local load_address to
11923         laddr.
11924
11925 2009-06-24  Ian Lance Taylor  <iant@google.com>
11926
11927         PR 10244
11928         * reloc.cc (relocate_sections): Skip empty relocation sections.
11929
11930 2009-06-23  Ian Lance Taylor  <iant@google.com>
11931
11932         PR 10156
11933         * layout.cc (Layout::create_note): Use choose_output_section
11934         rather than make_output_section.
11935
11936 2009-06-23  Ian Lance Taylor  <iant@google.com>
11937
11938         PR 10237
11939         * options.cc (General_options::parse_V): Set printed_version_.
11940         (General_options::General_options): Initialize printed_version_.
11941         * options.h (class General_options): Add printed_version_ field.
11942         * gold.cc (queue_initial_tasks): If there are no input files,
11943         don't give a fatal error if we printed the version information.
11944         (queue_middle_tasks): If using -r with a shared object, give a
11945         fatal error rather than an ordinary error.
11946
11947 2009-06-23  Ian Lance Taylor  <iant@google.com>
11948
11949         PR 10219
11950         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11951         (Layout::make_output_section): Set have_stabstr_section_ if we see
11952         a .stab*str section.
11953         (Layout::finalize): Call link_stabs_sections.
11954         (Layout::link_stabs_sections): New file.
11955         * layout.h (class Layout): Add have_stabstr_section_ field.
11956         Declare link_stabs_sections.
11957
11958 2009-06-23  Doug Kwan  <dougkwan@google.com>
11959
11960         * Makefile.am (libgold_a_LIBADD): New.
11961         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11962         * Makefile.in: Regenerate.
11963         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11964         * configure: Regenerate.
11965         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11966         * fileread.cc: Include sys/state.h
11967         * gold.h: Declare memmem and strndup if found missing.
11968         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11969
11970 2009-06-23  Ian Lance Taylor  <iant@google.com>
11971
11972         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11973         * configure: Rebuild.
11974
11975 2009-06-23  Ian Lance Taylor  <iant@google.com>
11976
11977         PR 10147
11978         * object.cc (Object::section_contents): Don't try to get a view if
11979         the section has length zero.
11980         (Object::handle_gnu_warning_section): If the section is empty, use
11981         the name of the section as the warning.
11982
11983 2009-06-23  Ian Lance Taylor  <iant@google.com>
11984
11985         PR 10133
11986         * stringpool.h (class Stringpool_template): Add optimize_ field.
11987         (Stringpool_template::set_optimize): New function.
11988         * stringpool.cc (Stringpool_template::Stringpool_template):
11989         Initialize optimize_ field.
11990         (Stringpool_template::set_string_offsets): Test local optimize
11991         fild rather than parameter.
11992         * layout.cc (Layout::Layout): Call set_optimize on the section
11993         name stringpool.
11994
11995 2009-06-22  Ian Lance Taylor  <iant@google.com>
11996
11997         PR 10030
11998         * yyscript.y: Parse TARGET.
11999         * script.cc (script_set_target): New function.
12000         * script-c.h (script_set_target): Declare.
12001         * options.cc (General_options::string_to_object_format): Rename
12002         from string_to_object_format in anonymous namespace.  Change
12003         callers.
12004         * options.h (class General_options): Declare
12005         string_to_object_format.
12006
12007 2009-06-22  Ian Lance Taylor  <iant@google.com>
12008
12009         * script-sections.cc (Script_sections::create_segments): Don't put
12010         program headers in a PT_LOAD segment if -n or -N.
12011
12012 2009-06-22  Ian Lance Taylor  <iant@google.com>
12013
12014         PR 10141
12015         * options.h (class General_options): Add -z lazy and -z now.  Sort
12016         -z options into alphabetical order.
12017         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12018
12019 2009-06-21  Ian Lance Taylor  <iant@google.com>
12020
12021         * layout.cc (Layout::make_output_section): Call
12022         Target::new_output_section.
12023         (Layout::attach_allocated_section_to_segment): Put large section
12024         sections in a separate load segment with the large segment flag
12025         set.
12026         (Layout::segment_precedes): Sort large data segments after other
12027         load segments.
12028         (align_file_offset): New static function.
12029         (Layout::set_segment_offsets): Use align_file_offset.
12030         * output.h (class Output_section): Add is_small_section_ and
12031         is_large_section_ fields.
12032         (Output_section::is_small_section): New function.
12033         (Output_section::set_is_small_section):  New function.
12034         (Output_section::is_large_section): New function.
12035         (Output_section::set_is_large_section): New function.
12036         (Output_section::is_large_data_section): New function.
12037         (class Output_segment): Add is_large_data_segment_ field.
12038         (Output_segment::is_large_data_segment): New function.
12039         (Output_segment::set_is_large_data_segment): New function.
12040         * output.cc (Output_section::Output_section): Initialize new
12041         fields.
12042         (Output_segment::Output_segment): Likewise.
12043         (Output_segment::add_output_section): Add assertion that large
12044         data sections always go in large data segments.  Force small data
12045         sections to the end of the list of data sections.  Force small BSS
12046         sections to the start of the list of BSS sections.  For large BSS
12047         sections to the end of the list of BSS sections.
12048         * symtab.h (class Symbol): Declare is_common_shndx.
12049         (Symbol::is_defined): Check Symbol::is_common_shndx.
12050         (Symbol::is_common): Likewise.
12051         (class Symbol_table): Define enum Commons_section_type.  Update
12052         declarations.  Add small_commons_ and large_commons_ fields.
12053         * symtab.cc (Symbol::is_common_shndx): New function.
12054         (Symbol_table::Symbol_table): Initialize new fields.
12055         (Symbol_table::add_from_object): Put small and large common
12056         symbols in the right list.
12057         (Symbol_table::sized_finalized_symbol): Check
12058         Symbol::is_common_shndx.
12059         (Symbol_table::sized_write_globals): Likewise.
12060         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12061         common symbol lists.  Don't call do_allocate_commons_list if the
12062         list is empty.
12063         (Symbol_table::do_allocate_commons_list): Remove is_tls
12064         parameter.  Add comons_section_type parameter.  Change all
12065         callers.  Handle small and large common symbols.
12066         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12067         Symbol::is_common_shndx.
12068         * resolve.cc (symbol_to_bits): Likewise.
12069         * target.h (Target::small_common_shndx): New function.
12070         (Target::small_common_section_flags): New function.
12071         (Target::large_common_shndx): New function.
12072         (Target::large_common_section_flags): New function.
12073         (Target::new_output_section): New function.
12074         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12075         small_common_section_flags, and large_common_section_flags
12076         fields.
12077         (Target::do_new_output_section): New virtual function.
12078         * arm.cc (Target_arm::arm_info): Initialize new fields.
12079         * i386.cc (Target_i386::i386_info): Likewise.
12080         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12081         Likewise.
12082         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12083         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12084         (Target_x86_64::do_new_output_section): New function.
12085         * configure.ac: Define conditional MCMODEL_MEDIUM.
12086         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12087         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12088         (large_LDFLAGS): Define.
12089         * testsuite/large.c: New file.
12090         * testsuite/testfile.cc (Target_test::test_target_info):
12091         Initialize new fields.
12092         * configure, testsuite/Makefile.in: Rebuild.
12093
12094 2009-06-05  Doug Kwan  <dougkwan@google.com>
12095
12096         * Makefile.am (CCFILES): Add target.cc.
12097         * Makefile.in: Regenerate.
12098         * i386.cc (class Target_i386): Define new virtual method to
12099         override do_is_local_label_name in parent.
12100         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12101         local symbols if --discard-locals or -X is given.
12102         * options.h (class General_options): Declare new options
12103         '--discard-locals' and '-X' for discarding locals.
12104         * target.h (class Target): Define new methods is_local_label_name.
12105         Declare new virtual method do_is_local_label_name.
12106         * target.cc: New file.
12107         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12108         (check_SCRIPTS): Add discard_locals_test.sh.
12109         (check_DATA): Add discard_local_tests.syms.
12110         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12111         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12112         * testsuite/Makefile.in: Regenerate.
12113         * testsuite/discard_locals_test.c: New file.
12114         * testsuite/discard_locals_test.sh: Same.
12115
12116 2009-06-05  Doug Kwan  <dougkwan@google.com>
12117
12118         * object.cc (Sized_relobj::Sized_relobj): Initialize
12119         discarded_eh_frame_shndx_ to -1U.
12120         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12121         section.
12122         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12123         a discarded .eh_frame section.
12124         (Sized_relobj::do_finalize_local_symbols): Ditto.
12125         * object.h (class Sized_relobj): Declare new member
12126         discarded_eh_frame_shndx_.
12127         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12128         (local_labels_test.o, local_labels_test): New rules.
12129         * testsuite/Makefile.in: Regenerate.
12130
12131 2009-06-04  Doug Kwan  <dougkwan@google.com>
12132
12133         * layout.cc (Layout::section_name_mapping): Add mapping for
12134         special ARM sections.
12135
12136 2009-06-03  Doug Kwan  <dougkwan@google.com>
12137
12138         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12139         (utils::has_overflow): Same.
12140
12141 2009-06-03  Ian Lance Taylor  <iant@google.com>
12142
12143         * layout.cc (Layout::section_name_mapping): New array, replacing
12144         Layout::linkonce_mapping.
12145         (Layout::section_name_mapping_count): New variable, replacing
12146         Layout::linkonce_mapping_count.
12147         (Layout::linkonce_output_name): Remove.
12148         (Layout::output_section_name): Rewrite.
12149         * layout.h (class Layout): Rename Linkonce_mapping to
12150         Section_name_mapping, linkonce_mapping to section_name_mapping,
12151         linkonce_mapping_count to section_name_mapping_count.  Don't
12152         declare linkonce_output_name.
12153
12154 2009-06-03  Doug Kwan  <dougkwan@google.com>
12155
12156         * gold/arm.cc (namespace utils): New.
12157         (Target_arm::reloc_is_non_pic): Define new method.
12158         (class Arm_relocate_functions): New.
12159         (Target_arm::Relocate::relocate): Handle relocation types used by
12160         Android.
12161
12162 2009-06-03  Ian Lance Taylor  <iant@google.com>
12163
12164         * arm.cc (Target_arm::scan::global): Use || instead of |.
12165
12166 2009-06-02  Doug Kwan  <dougkwan@google.com>
12167
12168         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12169         issued_non_pic_error_.
12170         (class Target_arm::Scan): Declare new method check_non_pic.
12171         Define new method symbol_needs_plt_entry.
12172         Declare new data member issued_non_pic_error_.
12173         (class Target_arm::Relocate): Declare new method
12174         should_apply_static_reloc.
12175         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12176         (Target_arm::Scan::check_non_pic): Define new method.
12177         (Target_arm::Scan::local): Handle a small subset of reloc types used
12178         by Android.
12179         (Target_arm::Scan::local): Same.
12180         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12181
12182 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12183
12184         * incremental.cc (Incremental_inputs::report_command_line): Filter
12185         out --incremental-* options.
12186
12187 2009-05-29  Doug Kwan  <dougkwan@google.com>
12188
12189         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12190         template class.
12191         (class Target_arm): Update comment.
12192         (Target_arm::Target_arm): Initialize new data members GOT_,
12193         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12194         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12195         and Target_arm::rel_dyn_section.
12196         Declare new_enum Target_arm::Got_type.
12197         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12198         and DYNBSS_.
12199         Update commments for member do_dynsym_value.
12200         (Target_arm::got_size, Target_arm::plt_section,
12201         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12202         new methods inside class defintion.
12203         (Target_arm::got_section): Define new method.
12204         (Target_arm::rel_dyn_section): Same.
12205         (Output_data_plt_arm): New template class.
12206         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12207         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12208         (Output_data_plt_arm::add_entry): Same.
12209         (Output_data_plt_arm::first_plt_entry): Define new
12210         static data member for PLT instruction template.
12211         (Output_data_plt_arm::plt_entry): Same.
12212         (Output_data_plt_arm::do_write): Define new method.
12213         (Target_arm::make_plt_entry): Same.
12214         (Target_arm::do_finalize_sections): Same.
12215         (Target_arm::do_dynsym_value): Same.
12216
12217 2009-05-28  Doug Kwan  <dougkwan@google.com>
12218
12219         * Makefile.am (TARGETSOURCES): Add arm.cc.
12220         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12221         * Makefile.in: Regenerate.
12222         * arm.cc: New file.
12223         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12224
12225 2009-05-26  Doug Kwan  <dougkwan@google.com>
12226
12227         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12228         (General_options::check_excluded_libs): Strip off directories in
12229         archive name before matching like GNU ld does.
12230         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12231         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12232         (exclude_libs_test_LDFLAGS): Add linker option
12233         -Wl,--exclude-libs,libexclude_libs_test_3
12234         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12235         an explicit archive without using -l.
12236         (alt/libexclude_libs_test_3.a): New make rule.
12237         * testsuite/Makefile.in: Regenerate.
12238         * testsuite/exclude_libs_test.c : Declare lib3_default().
12239         (main): Call it.
12240         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12241         * exclude_libs_test_3.c: New file.
12242
12243 2009-05-26  Nick Clifton  <nickc@redhat.com>
12244
12245         * po/id.po: New Indonesian translation.
12246         * po/gold.pot: Updated template file.
12247
12248 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12249
12250         * testsuite/Makefile.am: Add -ffunction-sections to compile
12251         gc_comdat_test files.  Add -Wl,--gc-sections to build
12252         gc_comdat_test.
12253         * testsuite/Makefile.in: Regenerate.
12254         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12255
12256 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12257
12258         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12259         kept comdat section was garbage collected.
12260         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12261         * testsuite/Makefile.in: Regenerate.
12262         * testsuite/gc_comdat_test.sh: New file.
12263         * testsuite/gc_comdat_test_1.cc: New file.
12264         * testsuite/gc_comdat_test_2.cc: New file.
12265
12266 2009-05-19  Doug Kwan  <dougkwan@google.com>
12267
12268         * archive.cc (Archive::Archive): Move constructor from archive.h
12269         to here.  Initialize no_export_.
12270         (Archive::get_elf_object_for_member): Set no_export flag of object.
12271         * archive.h (Archive::Archive): Move constructor body to
12272         archive.cc.
12273         (Archive::no_export): New method.
12274         (Archive::no_export_): New field.
12275         * object.h (Object::Object): Initialize no_export_ to false.
12276         (Object::no_export, Object::set_no_export): New methods.
12277         (Object::no_export_): New field.
12278         * options.cc (General_options::parse_exclude_libs): New method.
12279         (General_options::check_excluded_libs) Same.
12280         * options.h (exclude_libs): New option.
12281         (General_options::check_excluded_libs): New method declaration.
12282         (General_options::excluded_libs_): New field.
12283         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12284         default or protected visibility if an object has no-export flag set.
12285         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12286         (check_SCRIPTS): Add exclude_libs_test.sh.
12287         (check_DATA): Add exclude_libs_test.syms.
12288         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12289         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12290         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12291         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12292         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12293         libexclude_libs_test_2.a): New rules.
12294         * testsuite/Makefile.in: Regenerate.
12295         * testsuite/exclude_libs_test.c: New file.
12296         * testsuite/exclude_libs_test.sh: Ditto.
12297         * testsuite/exclude_libs_test_1.c: Ditto.
12298         * testsuite/exclude_libs_test_2.c: Ditto.
12299
12300 2009-05-15  Ian Lance Taylor  <iant@google.com>
12301
12302         * configure.ac: Check for declarations for cases where libiberty.h
12303         checks HAVE_DECL_xxx.
12304         * configure, config.in: Rebuild.
12305
12306 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12307
12308         * gold.h (Incremental_argument_list): Remove (invalid) forward
12309         declaration.
12310         * incremental.cc (Incremental_inputs::report_achive): New method.
12311         (Incremental_inputs::report_object): New method.
12312         (Incremental_inputs::report_script): New method.
12313         (Incremental_inputs::finalize_inputs): New method.
12314         (Incremental_inputs::finalize): Call finalize_inputs().
12315         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12316         Create inputs entries.
12317         * incremental.h (Incremental_input_type): New enum.
12318         (Incremental_inputs::Incremental_input): Initialize new fields.
12319         (Incremental_inputs::report_inputs): New method.
12320         (Incremental_inputs::report_achive): New method.
12321         (Incremental_inputs::report_object): New method.
12322         (Incremental_inputs::report_script): New method.
12323         (Incremental_inputs::finalize_inputs): New method.
12324         (Incremental_inputs::Input_info): New struct.
12325         (Incremental_inputs::Input_info_map): New typedef.
12326         (Incremental_inputs::lock_): New field.
12327         (Incremental_inputs::Inputs_): New field.
12328         (Incremental_inputs::Inputs_map): New field.
12329         * main.cc (main): Call Incremental_input::report_inputs.
12330         * options.h (Input_argument_list): Typedef moved from
12331         Input_arguments.
12332         (Input_file_group::Files): Remove, use ::Input_argument_list.
12333         (Input_file_group::Input_argument_list): Remove, use
12334         ::Input_argument_list.
12335         * plugin.cc (Plugin_manager::add_input_file): Add error in
12336         incremental build.
12337         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12338         functions.
12339         * script.cc (read_input_script): Call
12340         Incremental_input::report_script.
12341         * script.h (Script_info): New class.
12342
12343 2009-04-27  Ian Lance Taylor  <iant@google.com>
12344
12345         * x86_64.cc (do_adjust_output_section): Set entsize to
12346         plt_entry_size.
12347
12348 2009-04-23  Elliott Hughes  <enh@google.com>
12349
12350         * output.cc (Output_file::close): After short writes, continue
12351         writing from the correct offset in the buffer being written.
12352
12353 2009-04-23  Chris Demetriou  <cgd@google.com>
12354
12355         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12356         * configure: Regenerate.
12357         * config.in: Regenerate.
12358         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12359         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12360
12361 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12362
12363         * incremental.cc (Incremental_inputs_header_data): Renamed from
12364         Incremental_input_header_data.
12365         (Incremental_inputs_header_data::data_size): New field.
12366         (Incremental_inputs_header_data::put_input_file_count): Renamed
12367         from input_file_count.
12368         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12369         from command_line_offset.
12370         (Incremental_inputs_header_data::put_reserved): Renamed from
12371         put_reserved.
12372         (Incremental_inputs_entry_data): Renamed from
12373         Incremental_input_entry_data.
12374         (Incremental_inputs_entry_data::data_size): New field.
12375         (Incremental_inputs::report_command_line): New method.
12376         (Incremental_inputs::finalize): New method.
12377         (Incremental_inputs::create_incremental_inputs_data): New method.
12378         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12379         * incremental.h: New file.
12380         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12381         (Layout::finalize): Create incremental inputs section in
12382         incremental builds.
12383         (Layout::create_incremental_info_sections): New method.
12384         * layout.h (Layout::incremental_inputs): New method.
12385         (Layout::create_incremental_info_sections): New method.
12386         (Layout::incremental_inputs_): New field.
12387         * main.cc (main): Notify Incremental_input of the command line.
12388
12389 2009-04-01  Ian Lance Taylor  <iant@google.com>
12390             Mikolaj Zalewski  <mikolajz@google.com>
12391
12392         * gold.h (reserve_unordered_map): Define, three versions, one for
12393         each version of Unordered_map.
12394         * layout.cc (Layout::Layout): Remove options parameter.  Add
12395         number_of_input_files parameter.  Don't initialize options_.
12396         Initialize number_of_input_files_ and resized_signatures_.  Move
12397         sections_are_attached_.
12398         (Layout::layout_group): Reserve space for group_signatures_.
12399         (Layout::find_or_add_kept_section): Change name parameter to be a
12400         reference.  Resize signatures_ map when it gets large enough.
12401         (Layout::layout_eh_frame): Use parameters->options() instead of
12402         this->options_.
12403         (Layout::make_output_section): Likewise.
12404         (Layout::attach_allocated_section_to_segment): Likewise.
12405         (Layout::finalize, Layout::create_executable_stack): Likewise.
12406         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12407         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12408         * layout.h (class Layout): Update declarations.  Remove options_
12409         field.  Add number_of_input_files_ and resized_signatures_
12410         fields.  Move sections_are_attached_ field.
12411         * main.cc (main): Pass number of input files to Layout
12412         constructor.  Don't pass options.
12413
12414 2009-03-30  Ian Lance Taylor  <iant@google.com>
12415
12416         * ffsll.c (ffsll): Correct implementation.
12417
12418 2009-03-27  Ian Lance Taylor  <iant@google.com>
12419
12420         * ffsll.c: New file.
12421         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12422         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12423         * ftruncate.c (ftruncate): Declare before definition.
12424         * mremap.c (mremap): Likewise.
12425         * pread.c (pread): Likewise.
12426         * configure, Makefile.in, config.in: Rebuild.
12427
12428         * mremap.c: New file.
12429         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12430         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12431         (mremap): Declare if HAVE_MREMAP is not defined.
12432         * configure, Makefile.in, config.in: Rebuild.
12433
12434 2009-03-27  Cary Coutant  <ccoutant@google.com>
12435
12436         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12437         position independent.
12438         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12439         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12440
12441 2009-03-24  Cary Coutant  <ccoutant@google.com>
12442
12443         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12444         an executable.
12445         (needs_dynamic_reloc): Likewise.
12446
12447 2009-03-24  Ian Lance Taylor  <iant@google.com>
12448
12449         * yyscript.y (file_cmd): Recognize EXTERN.
12450         (extern_name_list, extern_name_list_body): New nonterminals.
12451         * script.cc (script_add_extern): Define.
12452         * script-c.h (script_add_extern): Declare.
12453
12454 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12455
12456         * object.cc (is_elf_object): Define.
12457         * object.h (is_elf_object): Declare.
12458         * archive.cc (Archive::get_elf_object_for_member): Call
12459         is_elf_object.
12460         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12461
12462 2009-03-24  Elliott Hughes  <enh@google.com>
12463
12464         * output.cc (Output_file::map_anonymous): Define.
12465         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12466         try an anonymous one.  Report the size if the mmap fails.
12467         * output.h (class Output_file): Declare map_anonymous.
12468
12469 2009-03-24  Ian Lance Taylor  <iant@google.com>
12470
12471         * target-select.cc (instantiate_target): Don't acquire the lock if
12472         the instantiated_target_ field has already been set.
12473
12474 2009-03-23  Ian Lance Taylor  <iant@google.com>
12475
12476         * gold-threads.h (class Initialize_lock): Define.
12477         * gold-threads.cc (class Initialize_lock_once): Define.
12478         (initialize_lock_control): New static variable.
12479         (initialize_lock_pointer): New static variable.
12480         (initialize_lock_once): New static function.
12481         (Initialize_lock::Initialize_lock): Define.
12482         (Initialize_lock::initialize): Define.
12483         * target-select.h: Include "gold-threads.h".
12484         (class Target_selector): Add lock_ and initialize_lock_ fields.
12485         Don't define instantiate_target, just declare it.
12486         * target-select.cc (Target_selector::Target_selector): Initialize
12487         new fields.
12488         (Target_selector::instantiate_target): Define.
12489         * descriptors.h: Include "gold-threads.h".
12490         (class Descriptors): Add initialize_lock_ field.
12491         * descriptors.cc (Descriptors::Descriptors): Initialize new
12492         field.
12493         (Descriptors::open): Use initialize_lock_ field
12494         * errors.h (class Errors): Add initialize_lock_ field.
12495         * errors.cc (Errors::Errors): Initialize new field.
12496         (Errors::initialize_lock): Use initialize_lock_ field.
12497         * powerpc.cc (class Target_selector_powerpc): Remove
12498         instantiated_target_ field.  In do_recognize call
12499         instantiate_target rather than do_instantiate_target.  In
12500         do_instantiate_target just allocate a new target.
12501         * sparc.cc (class Target_selector_sparc): Likewise.
12502
12503         * freebsd.h: New file.
12504         * i386.cc: Include "freebsd.h".
12505         (Target_i386): Derive from Target_freebsd rather than
12506         Sized_target.
12507         (Target_selector_i386): Derive from Target_selector_freebsd rather
12508         than Target_selector.
12509         * x86_64.cc: Include "freebsd.h".
12510         (Target_x86_64): Derive from Target_freebsd rather than
12511         Sized_target.
12512         (Target_selector_x86_64): Derive from Target_selector_freebsd
12513         rather than Target_selector.
12514         * target.h (class Target): Add adjust_elf_header and
12515         do_adjust_elf_header.
12516         * output.cc (Output_file_header:: do_sized_write): Call target
12517         adjust_elf_header routine.
12518         * configure.tgt: Set targ_osabi.
12519         * configure.ac: Define GOLD_DEFAULT_OSABI.
12520         * parameters.cc (Parameters::default_target): Pass
12521         GOLD_DEFAULT_OSABI to select_target.
12522         * target-select.h (class Target_selector): Make instantiate_target
12523         protected rather than private.
12524         * Makefile.am (HFILES): Add freebsd.h.
12525         * configure, Makefile.in, config.in: Rebuild.
12526
12527         * merge.cc (do_add_input_section): Correct pend value.  Change
12528         message about last entry not being null terminated from error to
12529         warning.
12530
12531 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12532
12533         * incremental.cc: New file.
12534         * Makefile.am (CCFILES): Add incremental.cc.
12535         * Makefile.in: Rebuild.
12536
12537 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12538
12539         * layout.cc (Layout::output_section_name): Preserve names
12540         of '.note.' sections.
12541
12542 2009-03-19  Ian Lance Taylor  <iant@google.com>
12543
12544         * descriptors.cc (Descriptors::open): Check that the options are
12545         valid before using them.
12546
12547 2009-03-18  Ian Lance Taylor  <iant@google.com>
12548
12549         * script-sections.h: Include <list>.
12550         (class Script_sections): Change Sections_elements from std::vector
12551         to std::list.  Typedef public Elements_iterator.  Add
12552         orphan_section_placement_, data_segment_align_start_, and
12553         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12554         field.
12555         * script-sections.cc (class Orphan_section_placement): New class.
12556         (class Sections_element): Add virtual functions is_relro and
12557         orphan_section_init.  Remove virtual function place_orphan_here.
12558         (class Output_section_definition): Add is_relro and
12559         orphan_section_init.  Remove place_orphan_here.
12560         (class Orphan_output_section): Likewise.
12561         (Script_sections::Script_sections): Update for field changes.
12562         (Script_sections::data_segment_align): Set saw_data_segment_align_
12563         and data_segment_align_start_, not data_segment_align_index.
12564         (Script_sections::data_segment_relro_end): Check
12565         saw_data_segment_align_.  Use data_segment_align_start_ rather
12566         than data_segment_align_index_.
12567         (Script_sections::place_orphan): Rewrite to use
12568         Orphan_section_placement.
12569
12570 2009-03-17  Ian Lance Taylor  <iant@google.com>
12571
12572         * archive.cc (Archive::add_symbols): Check for a version attached
12573         to the symbol name in the archive map.
12574         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12575         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12576         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12577         (ver_test_11.a): New target.
12578         * testsuite/Makefile.in: Rebuild.
12579
12580         * configure.ac: Check for chsize and posix_fallocate.  Replace
12581         ftruncate.
12582         * ftruncate.c: New file, from gnulib.
12583         * output.cc (posix_fallocate): Define dummy version if not
12584         HAVE_POSIX_FALLOCATE.
12585         (Output_file::map): Call posix_fallocate rather than lseek and
12586         write.
12587         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12588         * configure, Makefile.in, config.in: Rebuild.
12589
12590 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12591
12592         * layout.h (Layout::create_note): Add section_name parameter.
12593         * layout.cc (Layout::create_note): Likewise.
12594         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12595
12596 2009-03-17  Ian Lance Taylor  <iant@google.com>
12597
12598         * descriptors.cc: Include "options.h".
12599         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12600         (Descriptors::open): Always use O_CLOEXEC when opening a new
12601         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12602         then set FD_CLOEXEC.
12603
12604         * sparc.cc (class Target_sparc): Add has_got_section.
12605         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12606         make sure we have a GOT section.
12607
12608         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12609         (Target_sparc::Scan::local): Likewise.
12610         (Target_sparc::Scan::global): Likewise.
12611         (Target_sparc::Relocate::relocate): Likewise.
12612         (Target_sparc::Relocate::relocate_tls): Likewise.
12613
12614         * symtab.cc (Symbol_table::define_default_version): New function,
12615         broken out of add_from_object.
12616         (Symbol_table::add_from_object): Call define_default_version.
12617         (Symbol_table::define_special_symbol): Add resolve_oldsym
12618         parameter.  Change all callers.  If the version for a symbol comes
12619         from a version script, resolve it with the symbol with the same
12620         name with no version.  Also add the symbol without a version if
12621         appropriate.
12622         (do_define_in_output_data): If resolving with oldsym, don't delete
12623         sym.
12624         (do_define_in_output_segment): Likewise.
12625         (do_define_as_constant): Likewise.
12626         * symtab.h (class Symbol_table): Update declarations.
12627
12628 2009-03-13  Ian Lance Taylor  <iant@google.com>
12629
12630         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12631         (Read_symbols::requeue): New function.
12632         (Read_symbols::do_read_symbols): If make_elf_object fails because
12633         the target type is not configured, and the file was searched for,
12634         issue a warning and retry with the next directory.
12635         (Add_symbols::run): If the file has an incompatible format, and
12636         it was searched for, requeue the Read_symbols task.  On error,
12637         release the object.
12638         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12639         dirindex parameter to constructor.  Change all callers.  Declare
12640         incompatible_warning and requeue.
12641         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12642         input_argument_ and input_group_ fields.  Add them to
12643         constructor.  Change all callers.
12644         (class Read_script): Add dirindex_ field.  Add it to constructor.
12645         Change all callers.
12646         * archive.cc (Archive::setup): Remove input_objects parameter.
12647         Change all callers.
12648         (Archive::get_file_and_offset): Likewise.
12649         (Archive::read_all_symbols): Likewise.
12650         (Archive::read_symbols): Likewise.
12651         (Archive::get_elf_object_for_member): Remove input_objects
12652         parameter.  Add punconfigured parameter.  Change all callers.
12653         (Archive::add_symbols): Change return type to bool.  Check return
12654         value of include_member.
12655         (Archive::include_all_members): Likewise.
12656         (Archive::include_member): Change return type to bool.  Return
12657         false if first included object has incompatible target.  Set
12658         included_member_ field.
12659         (Add_archive_symbols::run): If add_symbols returns false, requeue
12660         Read_symbols task.
12661         * archive.h (class Archive): Add included_member_ field.
12662         Initialize it in constructor.  Add input_file and searched_for
12663         methods.  Update declarations.
12664         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12665         input_argument_ fields.  Add them to constructor.  Change all
12666         callers.
12667         * script.cc: Include "target-select.h".
12668         (class Parser_closure): Add skip_on_incompatible_target_ and
12669         found_incompatible_target_ fields.  Add
12670         skip_on_incompatible_target parameter to constructor.  Change all
12671         callers.  Add methods skip_on_incompatible_target,
12672         clear_skip_on_incompatible_target, found_incompatible_target, and
12673         set_found_incompatible_target.
12674         (read_input_script): Add dirindex parameter.  Change all callers.
12675         If parser finds an incompatible target, requeue Read_symbols
12676         task.
12677         (script_set_symbol): Clear skip_on_incompatible_target in
12678         closure.
12679         (script_add_assertion, script_parse_option): Likewise.
12680         (script_start_sections, script_add_phdr): Likewise.
12681         (script_check_output_format): New function.
12682         * script.h (read_input_script): Update declaration.
12683         * script-c.h (script_check_output_format): Declare.
12684         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12685         (ignore_cmd): Remove OUTPUT_FORMAT.
12686         * fileread.cc (Input_file::Input_file): Add explicit this.
12687         (Input_file::will_search_for): New function.
12688         (Input_file::open): Add pindex parameter.  Change all callers.
12689         * fileread.h (class Input_file): Add input_file_argument method.
12690         Declare will_search_for.  Update declarations.
12691         * object.cc (make_elf_object): Add punconfigured parameter.
12692         Change all callers.
12693         * object.h (class Object): Make input_file public.  Add
12694         searched_for method.
12695         (make_elf_object): Update declaration.
12696         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12697         restart search.
12698         * dirsearch.h (class Dirsearch): Update declaration.
12699         * options.h (class General_options): Add --warn-search-mismatch.
12700         * parameters.cc (Parameters::is_compatible_target): New function.
12701         * parameters.h (class Parameters): Declare is_compatible_target.
12702         * workqueue.cc (Workqueue::add_blocker): New function.
12703         * workqueue.h (class Workqueue): Declare add_blocker.
12704
12705         * fileread.cc (Input_file::open): Remove options parameter.
12706         Change all callers.
12707         (Input_file::open_binary): Likewise.
12708         * script.cc (read_input_script): Likewise.
12709         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12710         options parameter from constructor.  Change all callers.
12711         (class Read_script): Likewise.
12712         * fileread.h (class Input_file): Update declarations.
12713         * script.h (read_input_script): Update declaration.
12714
12715 2009-03-10  Nick Clifton  <nickc@redhat.com>
12716
12717         * po/es.po: New Spanish translation.
12718
12719 2009-03-06  Cary Coutant  <ccoutant@google.com>
12720
12721         * options.cc (parse_short_option): Keep dash_z from registering itself.
12722
12723 2009-03-03  Ian Lance Taylor  <iant@google.com>
12724
12725         PR 9918
12726         * target-reloc.h (relocate_section): Pass output_section to
12727         relocate.
12728         * i386.cc (Target_i386::should_apply_static_reloc): Add
12729         output_section parameter.  Change all callers.
12730         (Target_i386::Relocate::relocate): Add output_section parameter.
12731         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12732         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12733         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12734         * testsuite/two_file_shared.sh: New script.
12735         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12736         (check_DATA): Add two_file_shared.dbg.
12737         (two_file_shared.dbg): New target.
12738         * testsuite/Makefile.in: Rebuild.
12739
12740 2009-03-01  Ian Lance Taylor  <iant@google.com>
12741
12742         * configure.ac: Check for byteswap.h.
12743         * configure: Rebuild.
12744         * config.in: Rebuild.
12745
12746 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12747
12748         * layout.cc (Layout::find_or_add_kept_section): New function.
12749         (Layout::add_comdat): Removed.
12750         * layout.h (struct Kept_section): Move out of class Layout.
12751         Remove trailing underscores from field names.  Add group_sections
12752         field.  Rename group_ field to is_group.  Change all uses.
12753         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12754         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12755         comdat_groups_ field.
12756         (Sized_relobj::include_section_group): Use
12757         find_or_add_kept_section and Kept_section::group_sections.
12758         (Sized_relobj::include_linkonce_section): Likewise.
12759         * object.cc (class Sized_relobj): Don't define Comdat_group or
12760         Comdat_group_table.  Remove find_comdat_group and
12761         add_comdat_group.  Remove comdat_groups_ field.
12762         * plugin.cc (include_comdat_group): Use
12763         Layout::find_or_add_kept_section.
12764
12765 2009-02-28  Ian Lance Taylor  <iant@google.com>
12766
12767         * README: --gc-sections and map files are now supported.  Document
12768         some build requirements.
12769
12770         PR 6992
12771         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12772         relocatable link set the value of the section symbol to zero.
12773         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12774         relocatable link don't include the section address in the local
12775         symbol value.
12776
12777 2009-02-27  Ian Lance Taylor  <iant@google.com>
12778
12779         PR 6811
12780         * options.h (class Search_directory): Add is_system_directory.
12781         (class General_options): Declare is_in_system_directory.
12782         * options.cc (get_relative_sysroot): Make static.
12783         (get_default_sysroot): Make static.
12784         (General_optoins::is_in_system_directory): New function.
12785         * fileread.cc (Input_file::is_in_system_directory): New function.
12786         * fileread.h (class Input_file): Declare is_in_system_directory.
12787         * object.h (class Object): Add is_in_system_directory.
12788         (class Input_objects): Remove system_library_directory_ field.
12789         * object.cc (Input_objects::add_object): Don't set
12790         system_library_directory_.
12791         (input_objects::found_in_system_library_directory): Remove.
12792         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12793         parameter.  Change all callers.
12794         (Symbol_table::sized_write_globals): Likewise.
12795         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12796         Call Object::is_in_system_directory.
12797         * symtab.h (class Symbol_table): Update declarations.
12798
12799         PR 5990
12800         * descriptors.h (Open_descriptor): Add is_on_stack field.
12801         * descriptors.cc (Descriptors::open): If the descriptor is on the
12802         top of the stack, remove it.  Initialize is_on_stack field.
12803         (Descriptors::release): Only add pod to stack if it is not on the
12804         stack already.
12805         (Descriptors::close_some_descriptor): Clear stack_next and
12806         is_on_stack fields.
12807
12808         PR 7091
12809         * output.cc (Output_section::find_starting_output_address): Rename
12810         from starting_output_address; add PADDR parameter; change return
12811         type.
12812         * output.h (class Output_section): Declare
12813         find_starting_output_address instead of starting_output_address.
12814         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12815         section symbol for which we can't find a merge section.
12816
12817         PR 9836
12818         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12819         hidden or internal, force the symbol to be local.
12820         * resolve.cc (Symbol::override_visibility): Define.
12821         (Symbol::override_base): Use override_visibility.
12822         (Symbol_table::resolve): Likewise.
12823         (Symbol::override_base_with_special): Likewise.
12824         (Symbol_table::override_with_special): If the visibility is hidden
12825         or internal, force the symbol to be local.
12826         * symtab.h (class Symbol): Add set_visibility and
12827         override_visibility.
12828         * testsuite/ver_test_1.sh: New file.
12829         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12830         (check_DATA): Add ver_test_1.syms.
12831         (ver_test_1.syms): New target.
12832         * testsuite/Makefile.in: Rebuild.
12833
12834 2009-02-25  Cary Coutant  <ccoutant@google.com>
12835
12836         * layout.cc (Layout::choose_output_section): Don't rename sections
12837         when using a linker script that has a SECTIONS clause.
12838         * Makefile.in: Regenerate.
12839
12840         * testsuite/Makefile.am (script_test_5.sh): New test case.
12841         * testsuite/Makefile.in: Regenerate.
12842         * testsuite/script_test_5.cc: New file.
12843         * testsuite/script_test_5.sh: New file.
12844         * testsuite/script_test_5.t: New file.
12845
12846 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12847
12848         * archive.cc (Archive::include_member): Update calls to add_symbols.
12849         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12850         the Layout argument.
12851         * dynobj.h (do_add_symbols): Add the Layout argument.
12852         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12853         Layout argument.
12854         * object.h (Object::add_symbols): Add the Layout argument.
12855         (Object::do_add_symbols): Add the Layout argument.
12856         (Sized_relobj::do_add_symbols): Add the Layout argument.
12857         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12858         Unify the two versions.
12859         (Add_plugin_symbols): Remove.
12860         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12861         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12862         (Add_plugin_symbols): Remove.
12863         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12864         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12865         (Add_symbols::run): Make it work with Pulginobj.
12866
12867 2009-02-06  Ian Lance Taylor  <iant@google.com>
12868
12869         * object.cc (Sized_relobj::do_layout): Make info message start
12870         with lower case letter.
12871
12872 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12873
12874         * binary.cc: Fix file comment.
12875
12876         * options.h (enum Incremental_disposition): Define.
12877         (class General_options): Add new options: --incremental,
12878         --incremental_changed, --incremental_unchanged,
12879         --incremental_unknown.  Add incremental_disposition_ and
12880         implicit_incremental_ fields.
12881         (General_options::incremental_disposition): New function.
12882         (class Position_dependent_options): Add incremental_disposition
12883         option.
12884         (Position_dependent_options::copy_from_options): Set incremental
12885         dispositions.
12886         * options.cc (General_options::parse_incremental_changed): New
12887         function.
12888         (General_options::parse_incremental_unchanged): New function.
12889         (General_options::parse_incremental_unknown): New function.
12890         (General_options::General_options): Initialize new fields
12891         incremental_disposition_ and implicit_incremental_.
12892         (General_options::finalize): Check for uasge of --incremental-*
12893         without --incremental.
12894
12895 2009-02-06  Chris Demetriou  <cgd@google.com>
12896
12897         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12898         pointer and to report location as the file name associated with
12899         the symbol.
12900         (gold_undefined_symbol_at_location): New function to replace the
12901         old gold_undefined_symbol functionality.
12902         * target-reloc.h (relocate_section): Update to use
12903         gold_undefined_symbol_at_location.
12904         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12905         Call gold_undefined_symbol function rather than gold_error.
12906         * errors.h (Errors::undefined_symbol): Take location as a
12907         string, rather than calculating it from a relocation.
12908         * errors.cc (Errors::fatal): Print "fatal error:" before the
12909         formatted message.
12910         (Errors::error, Errors::error_at_location): Print "error: "
12911         before the formatted message.
12912         (Errors::undefined_symbol): Take location as a string, rather
12913         than calculating it from a relocation.
12914         (gold_undefined_symbol_at_location): New function akin to
12915         old gold_undefined_symbol, calculates location from relocation.
12916         (gold_undefined_symbol): Change to take only a Symbol pointer
12917         and to report location as the file name associated with the symbol.
12918         * testsuite/debug_msg.sh: Update for changed error messages.
12919         * testsuite/undef_symbol.sh: Likewise.
12920
12921 2009-02-04  Duncan Sands  <baldrick@free.fr>
12922
12923         PR 9812
12924         * reduced_debug_output.h
12925         (Output_reduced_debug_abbrev_section::failed): Use format for
12926         gold_warning.
12927         (Output_reduced_debug_info_section::faild): Likewise.
12928
12929 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12930
12931         * script.cc (Lazy_demangler): New class.
12932         (Version_script_info::get_symbol_version_helper): Demangle a
12933         symbol only once.
12934
12935 2009-01-29  Cary Coutant  <ccoutant@google.com>
12936
12937         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12938         to __tls_get_addr.
12939         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12940
12941 2009-01-28  Ian Lance Taylor  <iant@google.com>
12942
12943         * version.cc (version_string): Bump to 1.9.
12944
12945         * gold.h: Include <cstring> and <stdint.h>.
12946         * version.cc: Include <cstdio>.
12947         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12948         warning.
12949         * reduced_debug_output.cc (insert_into_vector): Rename from
12950         Insert_into_vector; change all callers.  Use Swap_unaligned to
12951         avoid aliasing issue; remove union since it is unnecessary.
12952
12953 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12954
12955         * Makefile.am (CCFILES): Add gc.cc.
12956         (HFILES): Add gc.h.
12957         * Makefile.in: Regenerate.
12958         * gold.cc (Gc_runner): New class.
12959         (queue_initial_tasks): Call garbage collection related tasks
12960         when corresponding options are invoked.
12961         (queue_middle_gc_tasks): New function.
12962         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12963         processed early before laying out sections during garbage collection.
12964         * gold.h (queue_middle_gc_tasks): New function.
12965         (is_prefix_of): Move from "layout.cc".
12966         * i386.cc (Target_i386::gc_process_relocs): New function.
12967         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12968         * main.cc (main): Create object of class "Garbage_collection".
12969         * object.cc (Relobj::copy_symbols_data): New function.
12970         (Relobj::is_section_name_included): New function.
12971         (Sized_relobj::do_layout): Allow this function to be called twice
12972         during garbage collection and defer layout of section during the
12973         first call.
12974         * object.h (Relobj::get_symbols_data): New function.
12975         (Relobj::is_section_name_included): New function.
12976         (Relobj::copy_symbols_data): New function.
12977         (Relobj::set_symbols_data): New function.
12978         (Relobj::get_relocs_data): New function.
12979         (Relobj::set_relocs_data): New function.
12980         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12981         (Relobj::gc_process_relocs): New function.
12982         (Relobj::do_gc_process_relocs): New pure virtual function.
12983         (Relobj::sd_): New data member.
12984         (Sized_relobj::is_output_section_offset_invalid): New function.
12985         (Sized_relobj::do_gc_process_relocs): New function.
12986         * options.h (General_options::gc_sections): Modify to not be a no-op.
12987         (General_options::print_gc_sections): New option.
12988         * plugin.cc (Plugin_finish::run): Remove function call to
12989         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
12990         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
12991         * reloc.cc (Read_relocs::run): Add task to process relocs and
12992         determine unreferenced sections when doing garbage collection.
12993         (Gc_process_relocs): New class.
12994         (Sized_relobj::do_gc_process_relocs): New function.
12995         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
12996         sections that are garbage collected.
12997         * reloc.h (Gc_process_relocs): New class.
12998         * sparc.cc (Target_sparc::gc_process_relocs): New function.
12999         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13000         symbols whose corresponding sections are garbage collected.
13001         (Symbol_table::Symbol_table): Add new parameter for the garbage
13002         collection object.
13003         (Symbol_table::gc_mark_undef_symbols): New function.
13004         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13005         (Symbol_table::gc_mark_dyn_syms): New function.
13006         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13007         as garbage.
13008         (Symbol_table::add_from_object): Likewise.
13009         (Symbol_table::add_from_relobj): When building shared objects, do not
13010         treat externally visible symbols as garbage.
13011         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13012         table information for static and relocatable links.
13013         * symtab.h (Symbol_table::set_gc): New function.
13014         (Symbol_table::gc): New function.
13015         (Symbol_table::gc_mark_undef_symbols): New function.
13016         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13017         (Symbol_table::gc_mark_dyn_syms): New function.
13018         (Symbol_table::gc_): New data member.
13019         * target.h (Sized_target::gc_process_relocs): New pure virtual
13020         function.
13021         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13022         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13023
13024 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13025
13026         * options.h (General_options::gc_sections): Define as a no-op for now.
13027         (General_options::no_keep_memory): Ditto.
13028         (General_options::Bshareable): Define.
13029         * options.cc (General_options::finalize): Honor -Bshareable.
13030
13031 2009-01-20  Andreas Schwab  <schwab@suse.de>
13032
13033         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13034         read the value in the contents, since we don't use it.  Use the
13035         template endianness when writing.
13036         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13037
13038 2009-01-19  Andreas Schwab  <schwab@suse.de>
13039
13040         * configure.tgt (powerpc64-*): Fix targ_obj.
13041
13042 2009-01-15  Ian Lance Taylor  <iant@google.com>
13043
13044         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13045         local symbols when stripping all symbols.
13046
13047 2009-01-14  Cary Coutant  <ccoutant@google.com>
13048
13049         * output.cc (Output_reloc): Add explicit instantiations.
13050
13051 2009-01-14  Cary Coutant  <ccoutant@google.com>
13052
13053         * archive.cc (Archive::get_elf_object_for_member): Remove call
13054         to File_read::claim_for_plugin.
13055         * descriptors.cc (Descriptors::open): Remove reference to
13056         is_claimed.
13057         (Descriptors::claim_for_plugin): Remove.
13058         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13059         (Descriptors::is_claimed): Remove.
13060         (claim_descriptor_for_plugin): Remove.
13061         * fileread.cc (File_read::claim_for_plugin): Remove.
13062         * fileread.h (File_read::claim_for_plugin): Remove.
13063         (File_read::descriptor): Reopen descriptor if necessary.
13064         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13065         (Plugin_manager::all_symbols_read): Add task parameter. Change
13066         all callers.
13067         (Plugin_manager::get_input_file): New function.
13068         (Plugin_manager::release_input_file): New function.
13069         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13070         corresponding data member.
13071         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13072         and pass to base constructor. Change all callers.
13073         (get_input_file, release_input_file): New functions.
13074         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13075         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13076         (Plugin_manager::all_symbols_read): Add task parameter.
13077         (Plugin_manager::get_input_file): New function.
13078         (Plugin_manager::release_input_file): New function.
13079         (Plugin_manager::task_): New data member.
13080         (Pluginobj::Pluginobj): Add filesize parameter.
13081         (Pluginobj::filename): New function.
13082         (Pluginobj::descriptor): New function.
13083         (Pluginobj::filesize): New function.
13084         (Pluginobj::filesize_): New data member.
13085         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13086         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13087         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13088
13089         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13090         with archive libraries.
13091         * testsuite/Makefile.in: Regenerate.
13092         * testsuite/plugin_test.c (struct sym_info): New type.
13093         (get_input_file, release_input_file): New static variables.
13094         (onload): Capture new transfer vector entries.
13095         (claim_file_hook): Stop reading at end of file according to filesize.
13096         Factor out parsing of readelf output into separate function.
13097         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13098         APIs and get the source file name from the symbol table.  Convert
13099         source file name to corresponding object file name.  Print info
13100         message when adding new input files.
13101         (parse_readelf_line): New function.
13102         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13103         * testsuite/plugin_test_2.sh: Likewise.
13104         * testsuite/plugin_test_3.sh: Likewise.
13105         * testsuite/plugin_test_4.sh: New test case.
13106
13107 2009-01-07  Ian Lance Taylor  <iant@google.com>
13108
13109         * version.cc (version_string): Bump to 1.8.
13110
13111 2008-12-23  Cary Coutant  <ccoutant@google.com>
13112
13113         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13114         * plugin.cc (Plugin_manager::finish): Rename as
13115         layout_deferred_objects.  Move cleanup to separate function.
13116         (Plugin_manager::cleanup): New function.
13117         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13118         separately.
13119         * plugin.h (Plugin_manager::finish): Rename as
13120         layout_deferred_objects.
13121         (Plugin_manager::cleanup): New function.
13122         (Plugin_manager::cleanup_done): New field.
13123
13124 2008-12-23  Cary Coutant  <ccoutant@google.com>
13125
13126         * plugin.cc (is_visible_from_outside): New function.
13127         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13128         so we don't return "IR only" status for exported symbols or -r links.
13129
13130         * testsuite/Makefile.am (plugin_test_3): New test case.
13131         * testsuite/Makefile.in: Regenerate.
13132         * testsuite/plugin_test_3.sh: New file.
13133
13134 2008-12-22  Cary Coutant  <ccoutant@google.com>
13135
13136         * object.cc (Sized_relobj::layout_section): New function.
13137         (Sized_relobj::do_layout): Defer layout of input sections until after
13138         plugin has provided replacement files.
13139         (Sized_relobj::do_layout_deferred_sections): New function.
13140         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13141         (Relobj::layout_deferred_sections): New function.
13142         (Relobj::do_layout_deferred_sections): New function.
13143         (Sized_relobj::do_layout_deferred_sections): New function.
13144         (Sized_relobj::layout_section): New function.
13145         (Sized_relobj::Deferred_layout): New structure.
13146         (Sized_relobj::deferred_layout_): New field.
13147         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13148         Change all callers.  Layout deferred sections.
13149         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13150         references.
13151         (Plugin_hook::run): Move code from do_plugin_hook inline.
13152         (Plugin_hook::do_plugin_hook): Remove.
13153         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13154         (Plugin_manager::finish): Renamed, was cleanup.
13155         (Plugin_manager::should_defer_layout): New function.
13156         (Plugin_manager::add_deferred_layout_object): New function.
13157         (Plugin_manager::Deferred_layout_list): New type.
13158         (Plugin_manager::deferred_layout_objects_): New field.
13159         (Plugin_hook::do_plugin_hook): Remove.
13160
13161 2008-12-17  Ian Lance Taylor  <iant@google.com>
13162
13163         * options.h (class General_options): Add --no case for
13164         --export-dynamic.
13165
13166 2008-12-16  Cary Coutant  <ccoutant@google.com>
13167
13168         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13169         vector.
13170         (Plugin_manager::claim_file): Create plugin object even if
13171         plugin did not call the add_symbols callback.
13172         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13173         asking for more symbols than were added.
13174         * testsuite/Makefile.am (plugin_test_1): Add test case with
13175         no global symbols.
13176         (empty.syms): New target.
13177         * testsuite/Makefile.in: Regenerate.
13178         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13179         message. Don't call add_symbols if no globals.
13180         (all_symbols_read_hook): Don't provide replacement for empty
13181         claimed file.
13182
13183 2008-12-12  Ian Lance Taylor  <iant@google.com>
13184
13185         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13186         r_type == 0 for a local symbol with r_sym == 0.
13187         (scan_relocatable_relocs): Pass r_sym to
13188         local_non_section_strategy.
13189         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13190         r_sym parameter.
13191
13192         * configure.ac: Update test for TLS descriptors: they are
13193         supported as of glibc 2.9.
13194         * configure: Rebuild.
13195
13196 2008-12-11  Ian Lance Taylor  <iant@google.com>
13197
13198         PR 7091
13199         * target-reloc.h (Default_scan_relocatable_relocs): For each
13200         function, map r_type == 0 to RELOC_DISCARD.
13201
13202 2008-12-10  Cary Coutant  <ccoutant@google.com>
13203
13204         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13205         object to override a kept COMDAT group from a plugin object.
13206
13207 2008-12-09  Ian Lance Taylor  <iant@google.com>
13208
13209         PR 7088
13210         * yyscript.y (file_cmd): Handle INPUT.
13211
13212         * testsuite/initpri1.c: Change all declarations to be full
13213         prototypes by adding void, to avoid compiler warnings.
13214
13215 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13216
13217         * options.cc (General_options::parse_plugin_opt): New.
13218         (General_options::add_plugin): The argument now is just the filename.
13219         (General_options::add_plugin_option): New.
13220         * options.h (plugin_opt): New.
13221         (add_plugin): Change argument name.
13222         (add_plugin_option): New.
13223         * plugin.cc (Plugin::load): Don't parse the plugin option.
13224         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13225         (Plugin::add_option): New.
13226         (Plugin::args_): Change type.
13227         (Plugin::filename_): New.
13228         (Plugin_manager::add_plugin_option): New.
13229         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13230         * testsuite/Makefile.in: Regenerate.
13231
13232 2008-12-05  Cary Coutant  <ccoutant@google.com>
13233
13234         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13235         Handle --strip-lto-sections option.
13236         * options.h (strip_lto_sections): New option.
13237
13238 2008-12-01  Cary Coutant  <ccoutant@google.com>
13239
13240         * plugin.cc (ld_plugin_message): Change format parameter to const.
13241         Fix mismatch between new[] and delete.
13242
13243 2008-11-14  Cary Coutant  <ccoutant@google.com>
13244
13245         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13246         instead of -1U.
13247
13248 2008-11-05  Craig Silverstein  <csilvers@google.com>
13249
13250         * options.cc (General_options::parse_dynamic_list): New function.
13251         * options.h (General_options): New flags dynamic_list,
13252         dynamic_list_data, dynamic_list_cpp_new, and
13253         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13254         (General_options::in_dynamic_list): New function.
13255         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13256         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13257         (Lex::can_continue_name): Likewise.
13258         (yylex): Likewise.
13259         (read_script_file): New parameter script_options.
13260         (read_dynamic_list): New function.
13261         (Script_options::define_dynamic_list): New function.
13262         (dynamic_list_keyword_parsecodes): New variable.
13263         (dynamic_list_keywords): New variable.
13264         * script.h (Script_options::define_dynamic_list): New function
13265         prototype.
13266         (read_dynamic_list): New function prototype.
13267         * symtab.cc (strprefix): New macro.
13268         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13269         dynamic_list_data, dynamic_list_cpp_new, and
13270         dynamic_list_cpp_typeinfo.
13271         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13272         (dynamic_list_expr): New rule.
13273         (dynamic_list_nodes): Likewise.
13274         (dynamic_list_node): Likewise.
13275         * testsuite/Makefile.am (dynamic_list): New test.
13276         * testsuite/Makefile.in: Regenerated.
13277         * testsuite/dynamic_list.t: New file.
13278         * testsuite/dynamic_list.sh: New file.
13279
13280 2008-11-05  Craig Silverstein  <csilvers@google.com>
13281
13282         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13283         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13284         (t11_last): Likewise.
13285         * testsuite/ver_test_6.c (main): Likewise.
13286
13287 2008-10-07  Cary Coutant  <ccoutant@google.com>
13288
13289         * options.c (General_options::finalize): Add check for -static and
13290         -shared.
13291         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13292         is not empty.
13293
13294 2008-10-02  Cary Coutant  <ccoutant@google.com>
13295
13296         * plugin.cc (make_sized_plugin_object): Fix conditional
13297         compilation to work when not all targets are enabled.
13298
13299 2008-09-29  Cary Coutant  <ccoutant@google.com>
13300
13301         * archive.cc (Archive::get_file_and_offset): Use filename instead
13302         of name to get library path.
13303         (Archive::include_member): Unlock external member of a thin archive.
13304
13305         * testsuite/Makefile.am (TEST_AR): New variable.
13306         (thin_archive_test_1): New test.
13307         (thin_archive_test_2): New test.
13308         * testsuite/Makefile.in: Regenerate.
13309         * testsuite/thin_archive_main.cc: New file.
13310         * testsuite/thin_archive_test_1.cc: New file.
13311         * testsuite/thin_archive_test_2.cc: New file.
13312         * testsuite/thin_archive_test_3.cc: New file.
13313         * testsuite/thin_archive_test_4.cc: New file.
13314
13315 2008-09-29  Cary Coutant  <ccoutant@google.com>
13316
13317         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13318         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13319         instead of -1U.
13320         (Sized_relobj::do_finalize_local_symbols): Likewise.
13321         (Sized_relobj::map_to_kept_section): Likewise.
13322         * object.h (Sized_relobj::invalid_address): New constant.
13323         (Sized_relobj::do_output_section_offset): Check for invalid_address
13324         and return -1ULL.
13325         * output.cc (Output_reloc::local_section_offset): Use constant
13326         invalid_address instead of -1U.
13327         (Output_reloc::get_address): Likewise.
13328         (Output_section::output_address): Change -1U to -1ULL.
13329         * output.h (Output_reloc::invalid_address): New constant.
13330         * reloc.cc (Sized_relobj::write_sections): Use constant
13331         invalid_address instead of -1U.
13332         (Sized_relobj::relocate_sections): Likewise.
13333         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13334         values for merge sections.
13335         * target-reloc.h (relocate_for_relocatable): Use constant
13336         invalid_address instead of -1U.
13337
13338 2008-09-19  Cary Coutant  <ccoutant@google.com>
13339
13340         Add plugin functionality for link-time optimization (LTO).
13341         * configure.ac (plugins): Add --enable-plugins option.
13342         * configure: Regenerate.
13343         * config.in: Regenerate.
13344         * Makefile.am (LIBDL): New variable.
13345         (CCFILES): Add plugin.cc.
13346         (HFILES): Add plugin.h.
13347         (ldadd_var): Add LIBDL.
13348         * Makefile.in: Regenerate.
13349
13350         * archive.cc: Include "plugin.h".
13351         (Archive::setup): Don't preread archive symbols when using a plugin.
13352         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13353         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13354         files.
13355         (Archive::include_member): Add symbols from plugin objects.
13356         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13357         * descriptors.cc (Descriptors::open): Check for file descriptors
13358         abandoned by plugins.
13359         (Descriptors::claim_for_plugin): New function.
13360         * descriptors.h (Descriptors::claim_for_plugin): New function.
13361         (Open_descriptor::is_claimed): New field.
13362         (claim_descriptor_for_plugin): New function.
13363         * fileread.cc (File_read::claim_for_plugin): New function.
13364         * fileread.h (File_read::claim_for_plugin): New function.
13365         (File_read::descriptor): New function.
13366         * gold.cc: Include "plugin.h".
13367         (queue_initial_tasks): Add task to call plugin hooks for generating
13368         new object files.
13369         * main.cc: Include "plugin.h".
13370         (main): Load plugin libraries.
13371         * object.h (Pluginobj): Declare.
13372         (Object::pluginobj): New function.
13373         (Object::do_pluginobj): New function.
13374         (Object::set_target): New function.
13375         * options.cc: Include "plugin.h".
13376         (General_options::parse_plugin): New function.
13377         (General_options::General_options): Initialize plugins_ field.
13378         (General_options::add_plugin): New function.
13379         * options.h (Plugin_manager): Declare.
13380         (General_options): Add --plugin option.
13381         (General_options::has_plugins): New function.
13382         (General_options::plugins): New function.
13383         (General_options::add_plugin): New function.
13384         (General_options::plugins_): New field.
13385         * plugin.cc: New file.
13386         * plugin.h: New file.
13387         * readsyms.cc: Include "plugin.h".
13388         (Read_symbols::do_read_symbols): Check for archive before checking
13389         for ELF file.  Call plugin hooks to claim files.
13390         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13391         from a real object file; force override when processing replacement
13392         files.
13393         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13394         (Symbol::init_base_object): Likewise.
13395         (Symbol::init_base_output_data): Likewise.
13396         (Symbol::init_base_output_segment): Likewise.
13397         (Symbol::init_base_constant): Likewise.
13398         (Symbol::init_base_undefined): Likewise.
13399         (Symbol::output_section): Assert that object is not a plugin.
13400         (Symbol_table::add_from_pluginobj): New function.
13401         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13402         undefined.
13403         (Symbol_table::sized_write_globals): Likewise.
13404         (Symbol_table::add_from_pluginobj): Instantiate template.
13405         * symtab.h (Sized_pluginobj): Declare.
13406         (Symbol::in_real_elf): New function.
13407         (Symbol::set_in_real_elf): New function.
13408         (Symbol::in_real_elf_): New field.
13409         (Symbol_table::add_from_pluginobj): New function.
13410
13411         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13412         (LIBDL): New variable.
13413         (LDADD): Add LIBDL.
13414         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13415         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13416         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13417         (MOSTLYCLEANFILES): Likewise.
13418         * testsuite/Makefile.in: Regenerate.
13419         * testsuite/plugin_test.c: New file.
13420         * testsuite/plugin_test_1.sh: New file.
13421         * testsuite/plugin_test_2.sh: New file.
13422
13423 2008-09-16  Ian Lance Taylor  <iant@google.com>
13424
13425         * target-reloc.h (relocate_section): Check whether a symbol is
13426         defined by the ABI before reporting an undefined symbol error.
13427         * target.h (Target::is_defined_by_abi): Make parameter const.
13428         (Target::do_is_defined_by_abi): Likewise.
13429         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13430         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13431         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13432         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13433         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13434         * testsuite/Makefile.in: Rebuild.
13435
13436         * fileread.cc (make_view): Add casts to avoid warning.
13437
13438 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13439
13440         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13441         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13442
13443 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13444
13445         * options.h (General_options::output_is_executable): New.
13446         (General_options::output_is_pie): New.
13447         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13448         for shared libraries.
13449         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13450
13451 2008-09-11  Chris Demetriou  <cgd@google.com>
13452
13453         * options.h (origin): New -z option.
13454         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13455         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13456         in DT_FLAGS_1.
13457
13458 2008-09-05  Cary Coutant  <ccoutant@google.com>
13459
13460         * fileread.cc (File_read::make_view): Add check for attempt to map
13461         beyond end of file.
13462
13463 2008-09-05  Cary Coutant  <ccoutant@google.com>
13464
13465         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13466         explicit instantiations.
13467
13468 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13469
13470         PR gold/6858
13471         * options.cc (General_options::finalize): Allow undefined symbols
13472         in shlibs if linking -shared.
13473
13474         PR gold/6859
13475         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13476         symbols as not needing a dynsym entry.
13477
13478 2008-08-20  Craig Silverstein  <csilvers@google.com>
13479
13480         * fileread.cc (File_read::open): Do not lock the file unless it
13481         was successfully opened.
13482
13483 2008-08-14  Cary Coutant  <ccoutant@google.com>
13484
13485         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13486         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13487         * testsuite/tls_test.cc (struct int128): 128-bit struct
13488         for testing TLS relocs with non-zero addend.
13489         (v12): New TLS variable.
13490         (t12): New test.
13491         (t_last): Add check for v12.
13492         * testsuite/tls_test.h (t12): New function.
13493         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13494
13495 2008-08-13  Ian Lance Taylor  <iant@google.com>
13496
13497         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13498         set tls_segment_ or relro_segment_.
13499         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13500         when appropriate.
13501         * output.h (Output_section::clear_is_relro): New function.
13502         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13503         sections specially even when output_data_ is empty.
13504         (Output_segment::maximum_alignment): When first section is relro,
13505         only force alignment for PT_LOAD segments.
13506         * script.cc (script_data_segment_align): New function.
13507         (script_data_segment_relro_end): New function.
13508         * script-c.h (script_data_segment_align): Declare.
13509         (script_data_segment_relro_end): Declare.
13510         * script-sections.h (class Script_sections): Declare
13511         data_segment_align and data_segment_relro_end.  Add fields
13512         segment_align_index_ and saw_relro_end_.
13513         * script-sections.cc (class Sections_element): Add set_is_relro
13514         virtual function.  Add new bool* parameter to place_orphan_here.
13515         Add get_output_section virtual function.
13516         (class Output_section_definition): Add set_is_relro.  Add new
13517         bool* parameter to place_orphan_here.  Add get_output_section.
13518         Add is_relro_ field.
13519         (Output_section_definition::Output_section_definition): Initialize
13520         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13521         and is_relro_ fields.
13522         (Output_section_definition::place_orphan_here): Add is_relro
13523         parameter.
13524         (Output_section_definition::set_section_addresses): Set relro for
13525         output section.
13526         (Output_section_definition::alternate_constraint): Likewise.
13527         (class Orphan_output_section): Add new bool* parameter to
13528         place_orphan_here.  Add get_output_section.
13529         (Orphan_output_section::place_orphan_here): Add is_relro
13530         parameter.
13531         (Script_sections::Script_sections): Initialize
13532         data_segment_align_index_ and saw_relro_end_.
13533         (Script_sections::data_segment_align): New function.
13534         (Script_sections::data_segment_relro_end): New function.
13535         (Script_sections::place_orphan): Set or clear is_relro.
13536         (Script_sections::set_section_addresses): Force alignment of first
13537         TLS section.
13538         * yyscript.y (exp): Call script_data_segment_align and
13539         script_data_segment_relro_end.
13540         * testsuite/relro_script_test.t: New file.
13541         * testsuite/relro_test.cc (using_script): Declare.
13542         (t1, t2): Test using_script.
13543         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13544         (relro_script_test_SOURCES): Define.
13545         (relro_script_test_DEPENDENCIES): Define.
13546         (relro_script_test_LDFLAGS): Define.
13547         (relro_script_test_LDADD): Define.
13548         (relro_script_test.so): New target.
13549         * testsuite/Makefile.in: Rebuild.
13550
13551 2008-08-06  Cary Coutant <ccoutant@google.com>
13552
13553         * archive.cc (Archive::total_archives, Archive::total_members)
13554         (Archive::total_members_loaded): New variables.
13555         (Archive::setup): Add parameter.  Add option to preread
13556         archive symbols.
13557         (Archive::read_armap): Add counter.
13558         (Archive::get_file_and_offset): New function.
13559         (Archive::get_elf_object_for_member): New function.
13560         (Archive::read_all_symbols): New function.
13561         (Archive::read_symbols): New function.
13562         (Archive::add_symbols): Add counters.
13563         (Archive::include_all_members): Use armap to find members if it's
13564         already built.
13565         (Archive::include_member): Skip reading symbols if already read.
13566         Factored code into Archive::get_file_and_offset and
13567         Archive::get_elf_object_for_member.  Changed call to
13568         Mapfile::report_include_archive_member.
13569         (Archive::print_stats): New function.
13570         * archive.h: Declare Object and Read_symbols_data classes.
13571         (Archive::Archive): Add initializers for new members.
13572         (Archive::setup): Add parameter.
13573         (Archive::print_stats): New function.
13574         (Archive::total_archives, Archive::total_members)
13575         (Archive::total_members_loaded): New variables.
13576         (Archive::get_file_and_offset): New function.
13577         (Archive::get_elf_object_for_member): New function.
13578         (Archive::read_all_symbols): New function.
13579         (Archive::read_symbols): New function.
13580         (Archive::Archive_member): New class.
13581         (Archive::members_): New member.
13582         (Archive::num_members_): New member.
13583         * main.cc: Include archive.h.
13584         (main): Call Archive::print_stats.
13585         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13586         archive parameter; member_name is now the fully-decorated name.
13587         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13588         * options.h: (General_options): Add --preread-archive-symbols option.
13589         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13590         Archive::setup.
13591
13592 2008-08-04  Ian Lance Taylor  <iant@google.com>
13593
13594         * symtab.h (Symbol::use_plt_offset): New function.
13595         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13596         * powerpc.cc (Relocate::relocate): Likewise.
13597         * sparc.cc (Relocate::relocate): Likewise.
13598         * x86_64.cc (Relocate::relocate): Likewise.
13599         * testsuite/weak_plt.sh: New test.
13600         * testsuite/weak_plt_main.cc: New test.
13601         * testsuite/weak_plt_shared.cc: New test.
13602         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13603         (check_PROGRAMS): Add weak_plt.
13604         (check_DATA): Add weak_plt_shared.so.
13605         (weak_plt_main_pic.o, weak_plt): New targets.
13606         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13607         * testsuite/Makefile.in: Rebuild.
13608
13609         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13610         gcctestdir/ld.
13611         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13612         * testsuite/Makefile.in: Rebuild.
13613
13614 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13615
13616         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13617         * Makefile.in: Regenerate.
13618         * po/POTFILES.in: Regenerate.
13619
13620 2008-07-29  Ian Lance Taylor  <iant@google.com>
13621
13622         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13623         symbols before other symbols.
13624         * testsuite/script_test_2.cc (test_addr): Declare.
13625         (test_addr_alias): Declare.
13626         (main): Check that test_addr and test_addr_alias have the right
13627         values.
13628         * testsuite/script_test_2.t: Define test_addr_alias and
13629         test_addr.
13630
13631 2008-07-24  Ian Lance Taylor  <iant@google.com>
13632
13633         PR 5990
13634         * descriptors.cc: New file.
13635         * descriptors.h: New file.
13636         * gold-threads.h (class Hold_optional_lock): New class.
13637         * fileread.cc: Include "descriptors.h".
13638         (File_read::~File_read): Release descriptor rather than closing
13639         it.
13640         (File_read::open) [file]: Call open_descriptor rather than open.
13641         Set is_descriptor_opened_.
13642         (File_read::open) [memory]: Assert that descriptor is not open.
13643         (File_read::reopen_descriptor): New function.
13644         (File_read::release): Release descriptor.
13645         (File_read::do_read): Make non-const.  Reopen descriptor.
13646         (File_read::read): Make non-const.
13647         (File_read::make_view): Reopen descriptor.
13648         (File_read::do_readv): Likewise.
13649         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13650         Update declarations.
13651         * layout.cc: Include "descriptors.h".
13652         (Layout::create_build_id): Use open_descriptor rather than open.
13653         * output.cc: Include "descriptors.h".
13654         (Output_file::open): Use open_descriptor rather than open.
13655         * archive.cc (Archive::const_iterator): Change Archive to be
13656         non-const.
13657         (Archive::begin, Archive::end): Make non-const.
13658         (Archive::count_members): Likewise.
13659         * archive.h (class Archive): Update declarations.
13660         * object.h (Object::read): Make non-const.
13661         * Makefile.am (CCFILES): Add descriptors.cc.
13662         (HFILES): Add descriptors.h.
13663         * Makefile.in: Rebuild.
13664
13665         PR 6716
13666         * gold.h: Always include <clocale>.  Add Solaris workarounds
13667         following code in binutils/sysdep.h.
13668
13669         PR 6048
13670         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13671         this->eh_frame_hdr_ is NULL before using it.
13672
13673         * dynobj.cc (Versions::Versions): Update comment.
13674
13675         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13676         the base version name.
13677
13678         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13679         array size plus one.
13680         (Stringpool_template::set_string_offsets): Subtract one from key
13681         before using it as an array index.
13682         (Stringpool_template::get_offset_with_length): Likewise.
13683         (Stringpool_template::write_to_buffer): Likewise.
13684         * stringpool.h (Stringpool_template::get_offset_from_key):
13685         Likewise.
13686
13687 2008-07-23  Ian Lance Taylor  <iant@google.com>
13688
13689         PR 6658
13690         * object.h (Merged_symbol_value::value): Do our best to handle a
13691         negative addend.
13692
13693         PR 6647
13694         * script.cc (Version_script_info::get_versions): Don't add empty
13695         version tag to return value.
13696         (Version_script_info::get_symbol_version_helper): Change return
13697         type to bool.  Add pversion parameter.  Change all callers.
13698         (script_register_vers_node): Don't require a non-NULL tag.
13699         * script.h (class Version_script_info): Update declarations.
13700         (Version_script_info::get_symbol_version): Change return type to
13701         bool.  Add version parameter.  Change all callers.
13702         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13703         handling.  Handle an empty version from a version script.
13704         (Symbol_table::define_special_symbol): Likewise.
13705         * testsuite/ver_test_10.script: New file.
13706         * testsuite/ver_test_10.sh: New file.
13707         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13708         (check_DATA): Add ver_test_10.syms.
13709         (ver_test_10.syms, ver_test_10.so): New target.
13710         * testsuite/Makefile.in: Rebuild.
13711
13712 2008-07-23  Simon Baldwin  <simonb@google.com>
13713
13714         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13715         to zero for undefined symbols from dynamic libraries.
13716
13717 2008-07-23  Ian Lance Taylor  <iant@google.com>
13718
13719         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13720         Change all callers.
13721         * symtab.h (class Symbol_table): Update declaration.
13722         * testsuite/ver_test_9.cc: New file.
13723         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13724         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13725         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13726         (ver_test_9.so, ver_test_9.o): New targets.
13727         * testsuite/Makefile.in: Rebuild.
13728
13729 2008-07-22  Ian Lance Taylor  <iant@google.com>
13730
13731         * options.h (class General_options): Define --check-sections.
13732         * layout.cc (Layout::set_segment_offsets): Handle
13733         --check-sections.
13734
13735         * options.h (class General_options): Define -n/--nmagic and
13736         -N/--omagic.
13737         * options.cc (General_options::finalize): For -n/--nmagic or
13738         -N/--omagic, set -static.
13739         * layout.cc (Layout::attach_allocated_section_to_segment): If
13740         -N/--omagic, don't put read-only and read-write sections in
13741         different segments.
13742         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13743         finding a read-only segment.
13744         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13745         don't set the minimum segment alignment to the common page size,
13746         and don't set the file offset to the address modulo the page size.
13747         * script-sections.cc (Script_sections::create_segments): If
13748         -n/--omagic, don't put read-only and read-write sections in
13749         different segments.
13750
13751         * cref.cc: New file.
13752         * cref.h: New file.
13753         * options.h (class General_options): Add --print-symbol-counts.
13754         * main.cc (main): Issue defined symbol report if requested.
13755         * archive.cc (Archive::interpret_header): Make into a const member
13756         function.
13757         (Archive::add_symbols): Call Input_objects::archive_start and
13758         archive_stop.
13759         (Archive::const_iterator): Define new class.
13760         (Archive::begin, Archive::end): New functions.
13761         (Archive::include_all_members): Rewrite to use iterator.
13762         (Archive::count_members): New function.
13763         * archive.h (class Archive): Update declarations.
13764         (Archive::filename): New function.
13765         * object.cc: Include "cref.h".
13766         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13767         (Sized_relobj::do_get_global_symbol_counts): New function.
13768         (Input_objects::add_object): Add object to cross-referencer.
13769         (Input_objects::archive_start): New function.
13770         (Input_objects::archive_stop): New function.
13771         (Input_objects::print_symbol_counts): New function.
13772         * object.h: Declare Cref and Archive.
13773         (Object::get_global_symbol_counts): New function.
13774         (Object::do_get_global_symbol_counts): New pure virtual function.
13775         (class Sized_relobj): Add defined_count_ field.  Update
13776         declarations.
13777         (class Input_objects): Add cref_ field.  Update constructor.
13778         Update declarations.
13779         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13780         defined_count_.
13781         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13782         symbol counts.
13783         (Sized_dynobj::do_get_global_symbol_counts): New function.
13784         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13785         defined_count_.  Update declarations.  Define Symbols typedef.
13786         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13787         parameter.  Change all callers.
13788         (Symbol_table::add_from_dynobj): Add sympointers and defined
13789         parameters.  Change all callers.
13790         * symtab.h (class Symbol_table): Update declarations.
13791         * Makefile.am (CCFILES): Add cref.cc.
13792         (HFILES): Add cref.h.
13793         * Makefile.in: Rebuild.
13794
13795 2008-07-22  Simon Baldwin  <simonb@google.com>
13796
13797         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13798         to zero when writing undefined symbols.
13799
13800 2008-07-22  Ian Lance Taylor  <iant@google.com>
13801
13802         * output.cc (Output_section::add_input_section): Don't try to
13803         merge empty merge sections.
13804
13805 2008-07-21  Craig Silverstein  <csilvers@google.com>
13806
13807         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13808         Include symbol version in error message.
13809
13810 2008-07-20  Chris Demetriou  <cgd@google.com>
13811
13812         * configure.ac (gold_cv_c_random_seed): New configured variable.
13813         (RANDOM_SEED_CFLAGS): New substituted variable.
13814         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13815         * configure: Rebuild.
13816         * Makefile.in: Likewise.
13817         * testsuite/Makefile.in: Likewise.
13818
13819 2008-07-18  Ian Lance Taylor  <iant@google.com>
13820
13821         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13822         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13823         * testsuite/ver_test_main.cc (main): Call t4.
13824         (t4, t4_2a): Define.
13825         * testsuite/ver_test_2.cc (t4_2): Define.
13826         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13827         * testsuite/ver_test_4.cc (t4_2a): Define.
13828         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13829         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13830
13831 2008-07-17  Ian Lance Taylor  <iant@google.com>
13832
13833         * dynobj.cc (Versions::add_def): If we give an error about a
13834         missing version, go ahead and create the version anyhow.
13835
13836 2008-07-10  Ian Lance Taylor  <iant@google.com>
13837
13838         Handle output sections with more than 0x7fffffff bytes.
13839         * object.h (class Relobj): Change map_to_output_ to
13840         output_sections_, and just keep a section pointer.  Change all
13841         uses.  Move comdat group support to Sized_relobj.
13842         (Relobj::is_section_specially_mapped): Remove.
13843         (Relobj::output_section): Remove poff parameter.  Change all
13844         callers.
13845         (Relobj::output_section_offset): New function.
13846         (Relobj::set_section_offset): Rewrite.
13847         (Relobj::map_to_output): Remove.
13848         (Relobj::output_sections): New function.
13849         (Relobj::do_output_section_offset): New pure virtual function.
13850         (Relobj::do_set_section_offset): Likewise.
13851         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13852         group support from Relobj.  Update declarations.
13853         (Sized_relobj::get_output_section_offset): New function.
13854         (Sized_relobj::do_output_section_offset): New function.
13855         (Sized_relobj::do_set_section_offset): New function.
13856         * object.cc (Relobj::output_section_address): Remove.
13857         (Sized_relobj::Sized_relobj): Initialize new fields.
13858         (Sized_relobj::include_section_group): Cast find_kept_object to
13859         Sized_relobj.
13860         (Sized_relobj::include_linkonce_section): Likewise.
13861         (Sized_relobj::do_layout): Use separate arrays for output section
13862         and output offset.
13863         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13864         output_sections.
13865         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13866         output_sections and section_offsets.
13867         (Sized_relobj::write_local_symbols): Likewise.
13868         (map_to_kept_section): Compute output address directly.
13869         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13870         output_sections and section_offsets.
13871         (Sized_relobj::write_sections): Likewise.
13872         (Sized_relobj::relocate_sections): Likewise.
13873         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13874         * output.h (class Output_reloc): Update declarations.  Change
13875         u2_.relobj to Sized_relobj*.
13876         (class Output_data_reloc): Change add functions to use
13877         Sized_relobj*.
13878         * output.cc (Output_reloc::Output_reloc): Change relobj to
13879         Sized_relobj*.
13880         (Output_reloc::local_section_offset): Change return type to
13881         Elf_Addr.  Use get_output_section_offset.
13882         (Output_reloc::get_address): Likewise.
13883         (Output_section::is_input_address_mapped): Don't call
13884         is_section_specially_mapped.
13885         (Output_section::output_offset): Likewise.
13886         (Output_section::output_address): Likewise.
13887         (Output_section::starting_output_address): Likewise.
13888         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13889         parameter to Sized_relobj*.
13890         (Copy_relocs::need_copy_reloc): Likewise.
13891         (Copy_relocs::save): Likewise.
13892         * copy-relocs.h (class Copy_relocs): Update declarations.
13893         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13894         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13895         * target-reloc.h (relocate_for_relocatable): Change
13896         offset_in_output_section type to Elf_Addr.  Change code that uses
13897         it as well.
13898         * layout.cc (Layout::layout): Always set *off.
13899         * mapfile.cc (Mapfile::print_input_section): Use
13900         output_section_offset.
13901         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13902         Sized_relobj*.
13903         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13904         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13905         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13906
13907 2008-07-03  Ian Lance Taylor  <iant@google.com>
13908
13909         * layout.cc (Layout::include_section): Do not discard unrecognized
13910         SHT_STRTAB sections.
13911
13912 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13913
13914         * script.cc (Lex::can_continue_name): Make '?' allowable in
13915         version-script names.
13916         * testsuite/version_script.map: Change glob pattern to use '?'
13917
13918 2008-06-30  Manish Singh  <yosh@gimp.org>
13919
13920         PR 6585
13921         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13922         Correct typo.
13923
13924 2008-06-30  Ian Lance Taylor  <iant@google.com>
13925
13926         PR 6660
13927         PR 6682
13928         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13929         versions]: Don't try to read the value in the contents, since we
13930         don't use it.  Use the template endianness when writing.
13931
13932 2008-06-25  Cary Coutant  <ccoutant@google.com>
13933
13934         * fileread.cc (File_read::make_view): Assert on zero-length view.
13935         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13936         symbol table when there are no symbols to read.
13937
13938 2008-06-23  Craig Silverstein  <csilvers@google.com>
13939
13940         * version.cc (version_string): Bump to 1.7
13941
13942 2008-06-18  Craig Silverstein  <csilvers@google.com>
13943
13944         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13945         constant 0xFFFF to type Valtype.
13946         (Powerpc_relocate_functions::rel16_ha): Likewise.
13947
13948 2008-06-17  Ian Lance Taylor  <iant@google.com>
13949
13950         * output.h (Output_section::Input_section): Initialize p2align_ to
13951         zero for Output_section_data constructors.
13952         (Output_section::Input_section::addralign): If not an input
13953         section, return the alignment of the Output_section_data.
13954         * testsuite/copy_test.cc: New file.
13955         * testsuite/copy_test_1.cc: New file.
13956         * testsuite/copy_test_2.cc: New file.
13957         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13958         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13959         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13960         (copy_test_1_pic.o, copy_test_1.so): New targets.
13961         (copy_test_2_pic.o, copy_test_2.so): New targets.
13962         * testsuite/Makefile.in: Rebuild.
13963
13964         * script-sections.cc (Script_sections::place_orphan): Initialize
13965         local variable exact.
13966
13967 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13968
13969         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13970
13971 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13972             David S. Miller  <davem@davemloft.net>
13973
13974         * powerpc.cc: New file.
13975         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13976         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13977         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13978         * Makefile.in: Rebuild.
13979
13980 2008-06-09  Ian Lance Taylor  <iant@google.com>
13981
13982         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
13983         <exception>.
13984         (throwing, orig_terminate): New static variables.
13985         (terminate_handler): New static function.
13986         (t2): Set terminate handler.
13987
13988 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
13989
13990         PR 6584
13991         * binary.cc (Binary_to_elf::sized_convert): Fix .data
13992         alignment.
13993
13994 2008-05-30  Cary Coutant  <ccoutant@google.com>
13995
13996         * archive.cc (Archive::include_all_members) Correct to step
13997         over symbol table and extended name table in thin archives.
13998
13999 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14000
14001         PR 6407
14002         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14003         calculation.
14004
14005 2008-05-28  Caleb Howe  <cshowe@google.com>
14006
14007         * reduced_debug_output.cc: New file.
14008         * reduced_debug_output.h: New file.
14009         * options.h (class General_options): Add --strip-debug-non-line.
14010         * options.cc (General_options::finalize): Add strip_debug_non_line
14011         to the strip heirarchy.
14012         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14013         fields.
14014         * layout.cc: Include "reduced_debug_output.h".
14015         (Layout::Layout): Initialize new fields.
14016         (line_only_debug_sections): New static array.
14017         (is_lines_only_debug_sections): New static inline function.
14018         (Layout::include_section): Handle --strip-debug-non-line.
14019         (Layout::make_output_section): If --strip-debug-non-line, build
14020         new output sections for .debug_abbrev and .debug_info.
14021         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14022         gold.  Warn about possible overflow.
14023         (read_signed_LEB_128): Likewise.
14024         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14025         (read_signed_LEB_128): Declare.
14026         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14027         (HFILES): Add reduced_debug_output.h.
14028         * Makefile.in: Rebuild.
14029
14030 2008-05-21  Ian Lance Taylor  <iant@google.com>
14031
14032         * mapfile.cc: New file.
14033         * mapfile.h: New file.
14034         * options.h (class General_options): Add -M/--print-map and -Map.
14035         * options.cc (General_options::finalize): Make -M equivalent to
14036         -Map -.
14037         * main.cc: Include <cstdio> and "mapfile.h".
14038         (main): Open mapfile if requested.
14039         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14040         constructor.  Change caller.
14041         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14042         (queue_middle_tasks): Likewise.
14043         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14044         declarations.
14045         * archive.cc: Include "mapfile.h".
14046         (Archive::add_symbols): Add mapfile parameter.  Change all
14047         callers.  Pass mapfile, symbol, and reason to include_member.
14048         (Archive::include_all_members): Add mapfile parameter.  Change all
14049         callers.
14050         (Archive::include_member): Add mapfile, sym, and why parameters.
14051         Change all callers.  Report inclusion to map file.
14052         * archive.h: Include "fileread.h".
14053         (class Archive): Update declarations.
14054         (Archive::file): New const method.
14055         (class Add_archive_symbols): Add mapfile_ field.  Update
14056         constructor.  Change all callers.
14057         * readsyms.h (class Read_symbols): Likewise.
14058         (class Finish_group): Likewise.
14059         (class Read_script): Likewise.
14060         * common.cc: Include "mapfile.h".
14061         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14062         all callers.
14063         (Symbol_table::do_allocate_commons): Likewise.
14064         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14065         symbol allocation to mapfile.
14066         * common.h (class Allocate_commons_task): Add mapfile_ field.
14067         Update constructor.  Change all callers.
14068         * symtab.h (class Symbol_table): Update declarations.
14069         * layout.cc: Include "mapfile.h".
14070         (Layout_task_runner::run): Print information to mapfile.
14071         (Layout::create_gold_note): Change Output_data_fixed_space to
14072         Output_data_zero_fill.
14073         (Layout::create_build_id): Likewise.
14074         (Layout::print_to_mapfile): New function.
14075         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14076         constructor.  Change caller.
14077         (class Layout): Declare print_to_mapfile.
14078         * output.cc (Output_section::Input_section::print_to_mapfile): New
14079         function.
14080         (Output_section::add_input_section): If producing a map, always
14081         add to input_sections_ list.
14082         (Output_section::do_print_to_mapfile): New function.
14083         (Output_segment::print_sections_to_mapfile): New function.
14084         (Output_segment::print_section_list_to_mapfile): New function.
14085         * output.h: Include "mapfile.h".
14086         (Output_data::print_to_mapfile): New function.
14087         (Output_data::do_print_to_mapfile): New virtual function.
14088         (Output_segment_headers::do_print_to_mapfile): New function.
14089         (Output_file_header::do_print_to_mapfile): New function.
14090         (Output_data_const::do_print_to_mapfile): New function.
14091         (class Output_data_const_buffer): Add map_name_ field.  Update
14092         constructor.  Change all callers.  Add do_print_to_mapfile
14093         function.
14094         (class Output_data_fixed_space): Likewise.
14095         (class Output_data_space): Likewise.
14096         (class Output_data_zero_fill): New class.
14097         (Output_data_strtab::do_print_to_mapfile): New function.
14098         (Output_data_reloc_base::do_print_to_mapfile): New function.
14099         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14100         (Output_data_group::do_print_to_mapfile): New function.
14101         (Output_data_got::do_print_to_mapfile): New function.
14102         (Output_data_dynamic::do_print_to_mapfile): New function.
14103         (Output_symtab_xindex::do_print_to_mapfile): New function.
14104         (class Output_section): Declare do_print_to_mapflie.  Declare
14105         print_to_mapfile in Input_section.
14106         (class Output_segment): Declare new functions.
14107         * object.h (Sized_relobj::symbol_count): New function.
14108         * script-sections.cc
14109         (Output_section_element_dot_assignment::set_section_addresses):
14110         Change Output_data_fixed_space to Output_data_zero_fill.
14111         (Output_data_expression::do_print_to_mapfile): New function.
14112         * script.cc (read_input_script): Add mapfile parameter.  Change
14113         all callers.
14114         * script.h (read_input_script): Update declaration.
14115         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14116         (Eh_frame::do_print_to_mapfile): New function.
14117         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14118         (Output_merge_string::do_print_to_mapfile): New function.
14119         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14120         function.
14121         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14122         function.
14123         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14124         function.
14125         * Makefile.am (CCFILES): Add mapfile.cc.
14126         (HFILES): Add mapfile.h.
14127         * Makefile.in: Rebuild.
14128
14129 2008-05-19  Ian Lance Taylor  <iant@google.com>
14130
14131         * options.h (class General_options): Add -z relro.
14132         * layout.cc (Layout::Layout): Initialize relro_segment_.
14133         (Layout::add_output_section_data): Return the output section.
14134         (Layout::make_output_section): Rcognize relro sections and mark
14135         them appropriately.
14136         (Layout::attach_allocated_section_to_segment): Put relro sections
14137         in a PT_GNU_RELRO segment.
14138         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14139         section as relro.
14140         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14141         PT_TLS segments.
14142         (Layout::linkonce_mapping): Map d.rel.ro.local to
14143         .data.rel.ro.local.
14144         (Layout::output_section_name): Us .data.rel.ro.local for any
14145         section which begins with that.
14146         * layout.h (class Layout): Update add_output_section_data
14147         declaration.  Add relro_segment_ field.
14148         * output.cc (Output_section::Output_section): Initialize is_relro_
14149         and is_relro_local_ fields.
14150         (Output_segment::add_output_section): Group relro sections.
14151         (Output_segment::is_first_section_relro): New function.
14152         (Output_segment::maximum_alignment): If there is a relro section,
14153         align the segment to the common page size.
14154         (Output_segment::set_section_addresses): Track whether we are
14155         looking at relro sections.  If the last section is a relro
14156         section, align to the common page size.
14157         (Output_segment::set_section_list_addresses): Add in_relro
14158         parameter.  Change all callers.  Align to the page size when
14159         moving from relro to non-relro section.
14160         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14161         segment.
14162         * output.h (class Output_section): Add is_relro_ and
14163         is_relro_local_ fields.
14164         (Output_section::is_relro): New function.
14165         (Output_section::set_is_relro): New function.
14166         (Output_section::is_relro_local): New function.
14167         (Output_section::set_is_relro_local): New function.
14168         (class Output_segment): Update declarations.
14169         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14170         * sparc.cc (Target_sparc::got_section): Likewise.
14171         * x86_64.cc (Target_x86_64::got_section): Likewise.
14172         * testsuite/relro_test_main.cc: New file.
14173         * testsuite/relro_test.cc: New file.
14174         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14175         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14176         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14177         (relro_test.so, relro_test_pic.o): New targets.
14178         * testsuite/Makefile.in: Rebuild.
14179
14180 2008-05-16  Ian Lance Taylor  <iant@google.com>
14181
14182         * output.cc (Output_segment::add_output_section): Remove front
14183         parameter.
14184         * output.h (class Output_segment): Remove
14185         add_initial_output_section and overloaded add_output_section.
14186         Update declaration of remaining add_output_section.
14187         * layout.cc (Layout::create_interp): Call add_output_section
14188         rather than add_initial_output_section.
14189         (Layout::finish_dynamic_section): Likewise.
14190
14191         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14192         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14193         know the dynamic type.
14194         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14195         field.  Initialize it in constructor.
14196         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14197         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14198         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14199         reloc.
14200
14201         * output.cc (Output_reloc::get_address): Change return type to
14202         Elf_Addr.
14203         * output.h (class Output_reloc): Update get_address declaration.
14204         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14205         for section addresses.
14206
14207 2008-05-09  Ian Lance Taylor  <iant@google.com>
14208
14209         PR 6493
14210         * gold.cc (gold_nomem): Use return value of write.
14211
14212 2008-05-08  Ian Lance Taylor  <iant@google.com>
14213
14214         * symtab.c (Symbol::init_base_output_data): Add version
14215         parameter.  Change all callers.
14216         (Symbol::init_base_output_segment): Likewise.
14217         (Symbol::init_base_constant): Likewise.
14218         (Symbol::init_base_undefined): Likewise.
14219         (Sized_symbol::init_output_data): Likewise.
14220         (Sized_symbol::init_output_segment): Likewise.
14221         (Sized_symbol::init_constant): Likewise.
14222         (Sized_symbol::init_undefined): Likewise.
14223         (Symbol_table::do_define_in_output_data): If the new symbol has a
14224         version, mark it as the default.
14225         (Symbol_table::do_define_in_output_segment): Likewise.
14226         (Symbol_table::do_define_as_constant): Likewise.
14227         * symtab.h (class Symbol): Update declarations.
14228         (class Sized_symbol): Likewise.
14229         * resolve.cc (Symbol::override_version): New function.
14230         (Symbol::override_base): Call override_version.
14231         (Symbol::override_base_with_special): Likewise.
14232         * testsuite/ver_script_8.script: New file.
14233         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14234         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14235         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14236         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14237
14238 2008-05-06  Ian Lance Taylor  <iant@google.com>
14239
14240         PR 6049
14241         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14242         functions.
14243         (class General_options): Remove existing --undefined, and add
14244         --no-undefined instead.  Add new --undefined as synonym for -u.
14245         * archive.cc (Archive::add_symbols): Check whether symbol was
14246         named with -u.
14247         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14248         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14249         all uses.  Add IS_UNDEFINED.  Update declarations to split
14250         different versions of init_base.  Declare init_base_undefined.
14251         (Symbol::is_defined): Handle IS_UNDEFINED.
14252         (Symbol::is_undefined): Likewise.
14253         (Symbol::is_weak_undefined): Call is_undefined.
14254         (Symbol::is_absolute): Handle IS_CONSTANT.
14255         (class Sized_symbol): Update declarations to split different
14256         versions of init.  Declare init_undefined.
14257         (class Symbol_table): Declare new functions.
14258         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14259         Change all callers.
14260         (Symbol::init_base_output_data): Likewise.
14261         (Symbol::init_base_output_segment): Likewise.
14262         (Symbol::init_base_constant): Likewise.
14263         (Symbol::init_base_undefined): New function.
14264         (Sized_symbol::init_object): Rename from init.  Change all
14265         callers.
14266         (Sized_symbol::init_output_data): Likewise.
14267         (Sized_symbol::init_output_segment): Likewise.
14268         (Sized_symbol::init_constant): Likewise.
14269         (Sized_symbol::init_undefined): New function.
14270         (Symbol_table::add_undefined_symbols_from_command_line): New
14271         function.
14272         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14273         function.
14274         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14275         (Symbol::output_section): Likewise.
14276         (Symbol::set_output_section): Likewise.
14277         (Symbol_table::sized_finalize_symbol): Likewise.
14278         (Symbol_table::sized_write_globals): Likewise.
14279         * resolve.cc (Symbol_table::should_override): Likewise.
14280         (Symbol::override_base_with_special): Likewise.
14281
14282         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14283         symbol, change it to have default visibility.
14284         * testsuite/protected_1.cc: New file.
14285         * testsuite/protected_2.cc: New file.
14286         * testsuite/protected_3.cc: New file.
14287         * testsuite/protected_main_1.cc: New file.
14288         * testsuite/protected_main_2.cc: New file.
14289         * testsuite/protected_main_3.cc: New file.
14290         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14291         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14292         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14293         (protected_1.so): New target.
14294         (protected_1_pic.o, protected_2_pic.o): New targets.
14295         (protected_3_pic.o): New target.
14296         (check_PROGRAMS): Add protected_2.
14297         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14298         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14299         * testsuite/Makefile.in: Rebuild.
14300
14301         * options.h (DEFINE_var): Add set_user_set_##varname__.
14302         (DEFINE_bool_alias): New macro.
14303         (class General_options): Define -Bstatic using DEFINE_bool_alias
14304         rather than DEFINE_special.  Add --undefined as an alias for -z
14305         defs.
14306         * options.cc (General_options::parse_Bstatic): Remove.
14307
14308         * options.h (class General_options): Add --fatal-warnings.
14309         * main.cc (main): Implement --fatal-warnings.
14310         * errors.h (Errors::warning_count): New function.
14311
14312         * options.h (class General_options): Add -Bsymbolic-functions.
14313         * symtab.h (Symbol::is_preemptible): Check for
14314         -Bsymbolic-functions.
14315
14316 2008-05-05  Ian Lance Taylor  <iant@google.com>
14317
14318         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14319         as noVARNAME rather than no-VARNAME.
14320         (class General_options): Add option -z combreloc.
14321         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14322         get_address.
14323         (Output_reloc::sort_before) [SHT_REL]: New function.
14324         (Output_reloc::sort_before) [SHT_RELA]: New function.
14325         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14326         Sort_relocs_comparison.
14327         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14328         parameter.  Change all callers.
14329         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14330         sort_relocs parameter.  Change all callers.
14331         * output.cc (Output_reloc::get_address): New function, broken out
14332         of write_rel.
14333         (Output_reloc::write_rel): Call it.
14334         (Output_reloc::compare): New function.
14335         (Output_data_reloc_base::do_write): Optionally sort relocs.
14336
14337         * configure.ac: If targ_extra_obj is set, link it in.
14338         * configure.tgt: Initialize all variables.
14339         (x86_64*): Set targ_extra_obj and targ_extra_size.
14340         * configure: Rebuild.
14341
14342         * object.cc (Sized_relobj::include_section_group): Adjust section
14343         indexes read from group data.  Build vector to pass to
14344         layout_group.
14345         * layout.cc (Layout::layout_group): Add flags and shndxes
14346         parameters.  Remove contents parameter.  Change caller.  Update
14347         explicit instantiations.
14348         * layout.h (class Layout): Update layout_group declaration.
14349         * output.cc (Output_data_group::Output_data_group): Add flags and
14350         input_shndxes parameters.  Remove contents parameter.  Change
14351         caller.
14352         (Output_data_group::do_write): Change input_sections_ to
14353         input_shndxes_.
14354         * output.h (class Output_data_group): Update constructor
14355         declaration.  Rename input_sections_ to input_shndxes_.
14356         * testsuite/many_sections_test.cc: Add template.
14357
14358 2008-04-30  Cary Coutant  <ccoutant@google.com>
14359
14360         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14361
14362         * layout.cc (Layout::include_section): Refactored check for debug
14363         info section.
14364         (Layout::add_comdat): Add new parameters.  Change type
14365         of signature parameter.  Add object and shndx to signatures table.
14366         (Layout::find_kept_object): New function.
14367         * layout.h: Include <cstring>.
14368         (Layout::is_debug_info_section): New function.
14369         (Layout::add_comdat): Add new parameters.
14370         (Layout::find_kept_object): New function.
14371         (Layout::Kept_section): New struct.
14372         (Layout::Signatures): Change type of map range.
14373         * object.cc (Relobj::output_section_address): New function.
14374         (Sized_relobj::include_section_group): Add new parameters.  Change
14375         calls to Layout::add_comdat.  Change to build table of kept comdat
14376         groups and table mapping discarded sections to kept sections.
14377         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14378         (Sized_relobj::do_layout): Change calls to include_section_group and
14379         include_linkonce_section.
14380         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14381         value to zero when section is discarded.
14382         (Sized_relobj::map_to_kept_section): New function.
14383         * object.h (Relobj::output_section_address): New function.
14384         (Relobj::Comdat_group): New type.
14385         (Relobj::find_comdat_group): New function.
14386         (Relobj::Comdat_group_table): New type.
14387         (Relobj::Kept_comdat_section): New type.
14388         (Relobj::Kept_comdat_section_table): New type.
14389         (Relobj::add_comdat_group): New function.
14390         (Relobj::set_kept_comdat_section): New function.
14391         (Relobj::get_kept_comdat_section): New function.
14392         (Relobj::comdat_groups_): New field.
14393         (Relobj::kept_comdat_sections_): New field.
14394         (Symbol_value::input_value): Update comment.
14395         (Sized_relobj::map_to_kept_section) New function.
14396         (Sized_relobj::include_linkonce_section): Add new parameter.
14397         * target-reloc.h (Comdat_behavior): New type.
14398         (get_comdat_behavior): New function.
14399         (relocate_section): Add code to map a discarded section to the
14400         corresponding kept section when applying a relocation.
14401
14402 2008-04-30  Craig Silverstein  <csilvers@google.com>
14403
14404         * dwarf_reader.cc (next_generation_count): New static var.
14405         (Addr2line_cache_entry): New struct.
14406         (addr2line_cache): New static var.
14407         (Dwarf_line_info::one_addr2line): Added caching.
14408         (Dwarf_line_info::clear_addr2line_cache): New function.
14409         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14410         cache-size parameter.
14411         (Dwarf_line_info::one_addr2line_cache): New function.
14412         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14413         new cache-size argument to one_addr2line(), and clear cache.
14414
14415 2008-04-28  Cary Coutant  <ccoutant@google.com>
14416
14417         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14418         R_386_PC8 relocations.
14419
14420 2008-04-23  Ian Lance Taylor  <iant@google.com>
14421
14422         * object.cc (Sized_relobj::include_section_group): Check for
14423         invalid section group.
14424
14425         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14426         header size.
14427
14428         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14429         than read for file header.
14430         * archive.cc (Archive::include_member): Likewise.
14431
14432 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14433
14434         * aclocal.m4: Regenerate.
14435         * configure: Regenerate.
14436
14437 2008-04-19  Ian Lance Taylor  <iant@google.com>
14438
14439         * version.cc (version_string): Bump to 1.6.
14440
14441         * testsuite/Makefile.am (many_sections_r_test): New target.
14442         (many_sections_r_test_SOURCES): Remove.
14443         (many_sections_r_test_DEPENDENCIES): Remove.
14444         (many_sections_r_test_LDFLAGS): Remove.
14445         (many_sections_r_test_LDADD): Remove.
14446
14447         * object.cc (Sized_relobj::do_add_symbols): Always pass
14448         local_symbol_count_ to add_from_relobj.
14449
14450         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14451         every thousand variables.
14452         * testsuite/Makefile.in: Rebuild.
14453
14454         * object.cc (Xindex::initialize_symtab_xindex): New function.
14455         (Xindex::read_symtab_xindex): New function.
14456         (Xindex::sym_xindex_to_shndx): New function.
14457         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14458         available.
14459         (Sized_relobj::do_initialize_xindex): New function.
14460         (Sized_relobj::do_read_symbols): Adjust section links.
14461         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14462         parameter.  Change all callers.
14463         (Sized_relobj::include_section_group): Adjust section links and
14464         symbol section indexes.
14465         (Sized_relobj::do_layout): Adjust section links.
14466         (Sized_relobj::do_count_local_symbols): Adjust section links and
14467         symbol section indexes.
14468         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14469         ordinary and special symbols.
14470         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14471         dynsym_xindex parameters.  Change all callers.  Adjust section
14472         links.  Use SHN_XINDEX when needed.
14473         (Sized_relobj::get_symbol_location_info): Adjust section links.
14474         Don't get fooled by special symbols.
14475         * object.h (class Xindex): Define.
14476         (class Object): Add xindex_ parameter.  Declare virtual functoin
14477         do_initialize_xindex.
14478         (Object::adjust_sym_shndx): New function.
14479         (Object::set_xindex): New protected function.
14480         (class Symbol_value): Add is_ordinary_shndx_ field.
14481         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14482         (Symbol_value::value): Assert ordinary section.
14483         (Symbol_value::initialize_input_to_output_map): Likewise.
14484         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14485         Change all callers.
14486         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14487         all callers.
14488         (class Sized_relobj): Update declarations.
14489         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14490         parameter.  Change all callers.
14491         (Sized_relobj::adjust_shndx): New function.
14492         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14493         field.
14494         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14495         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14496         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14497         (Sized_dynobj::read_dynsym_section): Adjust section links.
14498         (Sized_dynobj::read_dynamic): Likewise.
14499         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14500         section links.
14501         (Sized_dynobj::do_initialize_xindex): New function.
14502         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14503         do_initialize_xindex.
14504         (Sized_dynobj::adjust_shndx): New function.
14505         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14506         dynsym_xindex_ fields.
14507         (Layout::finalize): Add a call to set_section_indexes before
14508         creating the symtab sections.
14509         (Layout::set_section_indexes): Don't do anything if the section
14510         already has a section index.
14511         (Layout::create_symtab_sections): Add shnum parameter.  Change
14512         caller.  Create .symtab_shndx section if needed.
14513         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14514         caller.
14515         (Layout::allocated_output_section_count): New function.
14516         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14517         needed.
14518         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14519         fields.  Update declarations.
14520         (Layout::symtab_xindex): New function.
14521         (Layout::dynsym_xindex): New function.
14522         (class Write_symbols_task): Add layout_ field.
14523         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14524         Change caller.
14525         * output.cc (Output_section_headers::Output_section_headers): Add
14526         shstrtab_section parameter.  Change all callers.
14527         (Output_section_headers::do_sized_write): Store overflow values
14528         for section count and section string table section index in
14529         section header zero.
14530         (Output_file_header::do_sized_write): Check for overflow of
14531         section count and section string table section index.
14532         (Output_symtab_xindex::do_write): New function.
14533         (Output_symtab_xindex::endian_do_write): New function.
14534         * output.h (class Output_section_headers): Add shstrtab_section_.
14535         Update declarations.
14536         (class Output_symtab_xindex): Define.
14537         (Output_section::has_out_shndx): New function.
14538         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14539         field.
14540         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14541         Change all callers.
14542         (Sized_symbol::init): Likewise.
14543         (Symbol::output_section): Check for ordinary symbol.
14544         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14545         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14546         callers.
14547         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14548         Change all callers.  Simplify handling of symbols from sections
14549         not included in the link.
14550         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14551         distinction.
14552         (Weak_alias_sorter::operator()): Assert that symbols are
14553         ordinary.
14554         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14555         distinction.
14556         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14557         parameters.  Change all callers.
14558         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14559         symbol distinction.  Use SHN_XINDEX when needed.
14560         (Symbol_table::write_section_symbol): Add symtab_xindex
14561         parameter.  Change all callers.
14562         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14563         SHN_XINDEX when needed.
14564         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14565         declarations.
14566         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14567         (Symbol::is_defined): Check is_ordinary.
14568         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14569         (Symbol::is_absolute, Symbol::is_common): Likewise.
14570         (class Sized_symbol): Update declarations.
14571         (class Symbol_table): Update declarations.
14572         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14573         parameters.  Change all callers.
14574         (Sized_symbol::override): Likewise.
14575         (Symbol_table::override): Likewise.
14576         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14577         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14578         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14579         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14580         to be in an ordinary section.
14581         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14582         object and is_ordinary parameters.  Change all callers.
14583         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14584         Change all callers.  Don't add undefined or non-ordinary symbols
14585         to reloc_map_.
14586         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14587         Change all callers.
14588         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14589         declarations.
14590         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14591         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14592         (Sized_relobj::relocate_sections): Likewise.
14593         * target-reloc.h (scan_relocs): Adjust section symbol index.
14594         (scan_relocatable_relocs): Likewise.
14595         * i386.cc (Scan::local): Check for ordinary symbols.
14596         * sparc.cc (Scan::local): Likewise.
14597         * x86_64.cc (Scan::local): Likewise.
14598         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14599         to symbol_section_and_value.
14600         * testsuite/many_sections_test.cc: New file.
14601         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14602         (check_PROGRAMS): Add many_sections_test.
14603         (many_sections_test_SOURCES): Define.
14604         (many_sections_test_DEPENDENCIES): Define.
14605         (many_sections_test_LDFLAGS): Define.
14606         (BUILT_SOURCES): Add many_sections_define.h.
14607         (many_sections_define.h): New target.
14608         (BUILT_SOURCES): Add many_sections_check.h.
14609         (many_sections_check.h): New target.
14610         (check_PROGRAMS): Add many_sections_r_test.
14611         (many_sections_r_test_SOURCES): Define.
14612         (many_sections_r_test_DEPENDENCIES): Define.
14613         (many_sections_r_test_LDFLAGS): Define.
14614         (many_sections_r_test_LDADD): Define.
14615         (many_sections_r_test.o): New target.
14616         * testsuite/Makefile.in: Rebuild.
14617
14618 2008-04-17  Cary Coutant  <ccoutant@google.com>
14619
14620         * errors.cc (Errors::info): New function.
14621         (gold_info): New function.
14622         * errors.h (Errors::info): New function.
14623         * gold.h (gold_info): New function.
14624         * object.cc (Input_objects::add_object): Print trace output.
14625         * options.cc (options::parse_set): New function.
14626         (General_options::parse_wrap): Deleted.
14627         (General_options::General_options): Deleted initializer.
14628         * options.h (options::String_set): New typedef.
14629         (options::parse_set): New function.
14630         (DEFINE_set): New macro.
14631         (General_options::wrap): Changed to use DEFINE_set. Changed
14632         callers of any_wrap_symbols and is_wrap_symbol.
14633         (General_options::trace, General_options::trace_symbol):
14634         New options.
14635         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14636         (General_options::wrap_symbols_): Deleted.
14637         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14638
14639 2008-04-17  David S. Miller  <davem@davemloft.net>
14640
14641         * options.cc (General_options::parse_V): New function.
14642         * options.h: Add entries for -V and -Qy.
14643
14644 2008-04-17  Ian Lance Taylor  <iant@google.com>
14645
14646         * common.cc (Symbol_table::allocate_commons): Remove options
14647         parameter.  Change caller.
14648         (Symbol_table::do_allocate_commons): Remove options parameter.
14649         Change caller.  Just call do_allocate_commons_list twice.
14650         (Symbol_table::do_allocate_commons_list): New function, broken out
14651         of do_allocate_commons.
14652         * common.h (class Allocate_commons_task): Remove options_ field.
14653         Update constructor.
14654         * symtab.cc (Symbol_table::Symbol_table): Initialize
14655         tls_commons_.
14656         (Symbol_table::add_from_object): Put TLS common symbols on
14657         tls_commons_ list.
14658         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14659         which are IN_OUTPUT_DATA.
14660         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14661         allocate_commons and do_allocate_commons declarations.  Declare
14662         do_allocate_commons_list.
14663         * gold.cc (queue_middle_tasks): Update creation of
14664         Allocate_commons_task to not pass options.
14665         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14666         (TLS_TEST_C_FLAGS): New variable.
14667         (tls_test_c_pic.o): New target.
14668         (tls_test_shared.so): Link in tls_test_c_pic.o.
14669         (tls_test_c_pic_ie.o): New target.
14670         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14671         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14672         (tls_test_c.o): New target.
14673         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14674         (tls_pic_test_LDADD): Likewise.
14675         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14676         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14677         (tls_test_c_gnu2.o): New target.
14678         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14679         tls_test_c_gnu2.o.
14680         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14681         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14682         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14683         * testsuite/tls_test.cc: Include "config.h".
14684         (t_last): Call t11_last.
14685         * testsuite/tls_test.h (t11, t11_last): Declare.
14686         * testsuite/tls_test_c.c: New file.
14687         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14688         * configure.ac: Check for OpenMP support.
14689         * configure, config.in, Makefile.in: Rebuild.
14690         * testsuite/Makefile.in: Rebuild.
14691
14692 2008-04-16  Cary Coutant  <ccoutant@google.com>
14693
14694         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14695         (Target_i386::tls_base_symbol_defined_): New field.
14696         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14697         (Target_i386::Scan::global): Likewise.
14698         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14699         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14700         (Target_x86_64::tls_base_symbol_defined_): New field.
14701         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14702         (Target_x86_64::Scan::global): Likewise.
14703
14704 2008-04-16  Cary Coutant  <ccoutant@google.com>
14705
14706         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14707         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14708         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14709         building shared libraries.
14710         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14711         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14712         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14713         * testsuite/Makefile.in: Rebuild.
14714         * testsuite/weak_undef.h: New file.
14715         * testsuite/weak_undef_file1.cc: Add extra test cases.
14716         * testsuite/weak_undef_file2.cc: Likewise.
14717         * testsuite/weak_undef_test.cc: Likewise.
14718
14719 2008-04-16  David S. Miller  <davem@davemloft.net>
14720
14721         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14722         Add issued_non_pic_error_ field.  Declare check_non_pic.
14723         (Target_sparc::Scan::check_non_pic): New function.
14724         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14725         (Target_sparc::Scan::global): Likewise.
14726
14727         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14728         * configure: Rebuild.
14729
14730         * options.h (DEFINE_enable): New macro.
14731         (new_dtags): New enable option.
14732         (initfirst, interpose, loadfltr, nodefaultlib,
14733         nodelete, nodlopen, nodump): New -z options.
14734         * layout.cc (Layout:finish_dynamic_section): If new
14735         dtags enabled, emit DT_RUNPATH.  Also, emit a
14736         DT_FLAGS_1 containing any specified -z flags.
14737
14738 2008-04-16  Ian Lance Taylor  <iant@google.com>
14739
14740         * copy-relocs.cc: New file.
14741         * copy-relocs.h: New file.
14742         * reloc.cc: Remove Copy_relocs code.
14743         * reloc.h: Likewise.
14744         * reloc-types.h (struct Reloc_types) [both versions]: Add
14745         get_reloc_addend_noerror.
14746         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14747         variants of add_global which take an addend which must be zero.
14748         * i386.cc: Include "copy-relocs.h".
14749         (class Target_i386): Change type of copy_relocs_ to variable,
14750         update initializer.
14751         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14752         Change all callers.
14753         (Target_i386::do_finalize_sections): Change handling of
14754         copy_relocs_.
14755         * sparc.cc: Include "copy-relocs.h".
14756         (class Target_sparc): Change type of copy_relocs_ to variable,
14757         update initializer.
14758         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14759         Change all callers.
14760         (Target_sparc::do_finalize_sections): Change handling of
14761         copy_relocs_.
14762         * x86_64.cc: Include "copy-relocs.h".
14763         (class Target_x86_64): Change type of copy_relocs_ to variable,
14764         update initializer.
14765         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14766         class.  Change all callers.
14767         (Target_x86_64::do_finalize_sections): Change handling of
14768         copy_relocs_.
14769         * Makefile.am (CCFILES): Add copy-relocs.cc.
14770         (HFILES): Add copy-relocs.h.
14771
14772         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14773
14774         * testsuite/script_test_4.sh: Permit leading zeroes.
14775
14776 2008-04-15  Ian Lance Taylor  <iant@google.com>
14777
14778         * script-sections.cc (Script_sections::create_segments): Use
14779         header_size_adjustment even when there is enough room for the
14780         headers.
14781         * testsuite/script_test_4.sh: New file.
14782         * testsuite/script_test_4.t: New file.
14783         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14784         (check_DATA): Add script_test_4.stdout.
14785         (MOSTLYCLEANFILES): Likewise.
14786         (script_test_4): New target.
14787         (script_test_4.stdout): New target.
14788         * testsuite/Makefile.in: Rebuild.
14789
14790         * sparc.cc: Add definitions for Output_data_plt_sparc class
14791         constants.
14792
14793 2008-04-14  David S. Miller  <davem@davemloft.net>
14794
14795         * sparc.cc: New file.
14796         * Makefile.am (TARGETSOURCES): Add sparc.cc
14797         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14798         * configure.tgt: Document targ_extra_size and
14799         targ_extra_big_endian.  Add entries for sparc-* and
14800         sparc64-*.
14801         * configure.ac: Handle targ_extra_size and
14802         targ_extra_big_endian.
14803         * Makefile.in: Rebuild.
14804         * configure: Likewise.
14805         * po/POTFILES.in: Likewise.
14806         * po/gold.pot: Likewise.
14807
14808 2008-04-14  Ian Lance Taylor  <iant@google.com>
14809
14810         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14811         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14812         in the name/type/flags to section mapping.  Don't call
14813         allocate_output_section.
14814         (Layout::choose_output_section): Change parameter from adjust_name
14815         to is_input_section.  Don't permit input sections after sections
14816         are attached to segments.  Don't call allocate_output_section.
14817         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14818         not write_enable_output_section.
14819         (Layout::make_output_section): Don't push to
14820         unattached_section_list_ nor call attach_to_segment.  Call
14821         attach_section_to_segment if sections are attached.
14822         (Layout::attach_sections_to_segments): New function.
14823         (Layout::attach_section_to_segment): New function.
14824         (Layout::attach_allocated_section_to_segment): Rename from
14825         attach_to_segment.  Remove flags parameter.
14826         (Layout::allocate_output_section): Remove function.
14827         (Layout::write_enable_output_section): Remove function.
14828         * layout.h (class Layout): Update for above changes.  Add new
14829         field sections_are_attached_.
14830         * output.h (Output_section::update_flags_for_input_section): New
14831         function.
14832         * output.cc (Output_section::add_input_section): Call
14833         update_flags_for_input_section.
14834         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14835
14836 2008-04-11  Cary Coutant  <ccoutant@google.com>
14837
14838         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14839         thought unnecessary.
14840         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14841
14842 2008-04-11  Ian Lance Taylor  <iant@google.com>
14843
14844         * output.h (class Output_section_data): Remove inline definition
14845         of set_addralign.
14846         * output.cc (Output_section_data::set_addralign): New function.
14847
14848 2008-04-11  Cary Coutant  <ccoutant@google.com>
14849
14850         Add support for TLS descriptors for i386 and x86_64.
14851         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14852         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14853         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14854         GOT_TYPE_TLS_DESC.
14855         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14856         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14857         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14858         relocations.
14859         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14860         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14861         Fix problem with initial-exec relocations.
14862         (Target_i386::Relocate::relocate_tls): Likewise.
14863         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14864         relaxation.
14865         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14866         support for section-plus-offset dynamic table entries.
14867         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14868         (Output_data_dynamic::Dynamic_entry): Add support for
14869         section-plus-offset dynamic table entries.
14870         (Output_data_dynamic::Classification): Likewise.
14871         (Output_data_dynamic::classification_): Renamed offset_.
14872         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14873         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14874         (Target_x86_64::make_plt_section): New function.
14875         (Target_x86_64::reserve_tlsdesc_entries): New function.
14876         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14877         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14878         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14879         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14880         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14881         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14882         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14883         add extra PLT entry for TLS descriptors.
14884         (Output_data_plt_x86_64::got_): New field.
14885         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14886         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14887         fields.
14888         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14889         descriptors.
14890         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14891         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14892         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14893         R_386_TLS_DESC_CALL relocations.
14894         (Target_x86_64::Scan::global): Likewise.
14895         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14896         for TLS descriptors.
14897         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14898         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14899         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14900         GD-to-IE relaxation.
14901         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14902         and TLS_DESCRIPTORS.
14903         * Makefile.in: Rebuild.
14904         * configure: Rebuild.
14905         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14906         (tls_test_shared2.so): New target.
14907         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14908         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14909         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14910         (tls_shared_gd_to_ie_test_LDADD): New variable.
14911         (tls_shared_gnu2_gd_to_ie_test): New target.
14912         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14913         New targets.
14914         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14915         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14916         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14917         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14918         (tls_shared_gnu2_test): New target.
14919         (tls_test_gnu2_shared.so): New target.
14920         (tls_shared_gnu2_test_SOURCES): New variable.
14921         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14922         (tls_shared_gnu2_test_LDFLAGS): New variable.
14923         (tls_shared_gnu2_test_LDADD): New variable.
14924         * testsuite/Makefile.in: Rebuild.
14925         * testsuite/Makefile.
14926
14927 2008-04-11  Ian Lance Taylor  <iant@google.com>
14928
14929         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14930         justsyms.t.
14931         * testsuite/Makefile.in: Rebuild.
14932
14933         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14934         long.
14935         * testsuite/script_test_2.cc (main): Adjust test.
14936
14937 2008-04-11  David S. Miller  <davem@davemloft.net>
14938             Ian Lance Taylor  <iant@google.com>
14939
14940         * options.h (General_options): Add entries for '-Y' and
14941         '-relax'.
14942         * options.cc (General_options:finalize): If -Y was used, add those
14943         entries to the library path instead of the default "/lib" and
14944         "/usr/lib".
14945
14946 2008-04-11  David S. Miller  <davem@davemloft.net>
14947
14948         * testsuite/justsyms.t: Start at 0x100.
14949         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14950         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14951         long.
14952         * testsuite/script_test_2.cc: Adjust string and section length
14953         checks.
14954
14955 2008-04-09  Ian Lance Taylor  <iant@google.com>
14956
14957         PR gold/5996
14958         * script-sections.cc (Sections_element::allocate_to_segment): Add
14959         orphan parameter.
14960         (Output_section_definition::allocate_to_segment): Likewise.
14961         (Orphan_output_section::allocate_to_segment): Likewise.
14962         (Script_sections::attach_sections_using_phdrs_clause): Don't
14963         propagate non-PT_LOAD segments to orphan sections.
14964         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14965         readelf rather than objdump.
14966         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14967         .interp section and PT_INTERP segment are the same size.
14968         * testsuite/Makefile.in: Rebuild.
14969
14970         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14971         aliases for symbols defined in the same object.
14972         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14973         (weak_alias_test_SOURCES): New variable.
14974         (weak_alias_test_DEPENDENCIES): New variable.
14975         (weak_alias_test_LDFLAGS): New variable.
14976         (weak_alias_test_LDADD): New variable.
14977         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14978         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14979         (weak_alias_test_3.o): New target.
14980         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14981         * testsuite/weak_alias_test_main.cc: New file.
14982         * testsuite/weak_alias_test_1.cc: New file.
14983         * testsuite/weak_alias_test_2.cc: New file.
14984         * testsuite/weak_alias_test_3.cc: New file.
14985
14986 2008-04-08  Ian Lance Taylor  <iant@google.com>
14987
14988         * options.h (class General_options): Add --noinhibit-exec option.
14989         * main.cc (main): Check --noinhibit-exec.
14990
14991         * options.h (class General_options): Define --wrap as a special
14992         option.  Add wrap_symbols_ field.
14993         (General_options::any_wrap_symbols): New function.
14994         (General_options::is_wrap_symbol): New function.
14995         * options.cc (General_options::parse_wrap): New function.
14996         (General_options::General_options): Initialize wrap_symbols_.
14997         * symtab.cc (Symbol_table::wrap_symbol): New function.
14998         (Symbol_table::add_from_object): Handle --wrap.
14999         * symtab.h (class Symbol_table): Declare wrap_symbol.
15000         * target.h (Target::wrap_char): New function.
15001         (Target::Target_info): Add wrap_char field.
15002         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15003         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15004         * testsuite/testfile.cc (Target_test::test_target_info):
15005         Likewise.
15006
15007         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15008         there is one.
15009
15010         * layout.h (class Layout): Add added_eh_frame_data_ field.
15011         * layout.cc (Layout::Layout): Initialize new field.
15012         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15013         output section until we find a section we merged successfully.
15014         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15015         that the size be non-zero.
15016
15017         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15018         qualifier.
15019
15020 2008-04-08  Craig Silverstein  <csilvers@google.com>
15021
15022         * configure.ac: Export new conditional variable HAVE_ZLIB.
15023         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15024         on HAVE_ZLIB.
15025         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15026         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15027
15028 2008-04-07  Ian Lance Taylor  <iant@google.com>
15029
15030         * version.cc (version_string): Set to "1.5".
15031
15032         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15033         Add issued_non_pic_error_ field.  Declare check_non_pic.
15034         (Target_x86_64::Scan::check_non_pic): New function.
15035         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15036         (Target_x86_64::Scan::global): Likewise.
15037
15038         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15039         addend parameter.  Change caller.  Handle merge sections.
15040         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15041         Address to Addend.  Don't add in the result of
15042         local_section_offset, pass down the addend and use the returned
15043         value.
15044         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15045         Update declarations of local_section_offset and symbol_value.
15046         * testsuite/two_file_test_1.cc (t18): New function.
15047         * testsuite/two_file_test_2.cc (f18): New function.
15048         * testsuite/two_file_test_main.cc (main): Call t18.
15049         * testsuite/two_file_test.h (t18, f18): Declare.
15050
15051         * configure.ac: Don't test for objdump, c++filt, or readelf.
15052         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15053         conditionals.
15054         (TEST_READELF): New variable.
15055         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15056         (check_PROGRAMS): Add two_file_strip_test.
15057         (two_file_strip_test): New target.
15058         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15059         (two_file_same_shared_strip_test_SOURCES): New variable.
15060         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15061         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15062         (two_file_same_shared_strip_test_LDADD): New variable.
15063         (two_file_shared_strip.so): New target.
15064         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15065         (ver_test_5.syms, ver_test_7.syms): Likewise.
15066         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15067         (strip_test_3.stdout): Use TEST_OBJDUMP.
15068         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15069
15070 2008-04-04  Cary Coutant  <ccoutant@google.com>
15071
15072         * symtab.h (Symbol::is_weak_undefined): New function.
15073         (Symbol::is_strong_undefined): New function.
15074         (Symbol::is_absolute): New function.
15075         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15076         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15077         absolute symbols.
15078         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15079         (weak_undef_test): New target.
15080         * testsuite/Makefile.in: Rebuild.
15081         * testsuite/weak_undef_file1.cc: New file.
15082         * testsuite/weak_undef_file2.cc: New file.
15083         * testsuite/weak_undef_test.cc: New file.
15084
15085 2008-04-03  Craig Silverstein  <csilvers@google.com>
15086
15087         * compressed_output.h (class Output_compressed_section): Use
15088         unsigned buffer.
15089         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15090         add zlib header.
15091         (zlib_compressed_suffix): Removed.
15092         (Output_compressed_section::set_final_data_size): Use unsigned
15093         buffers.
15094         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15095         Fix linker invocation.
15096         (flagstest_o_specialfile_and_compress_debug_sections):
15097         Likewise.
15098         * testsuite/Makefile.in: Regenerated.
15099
15100 2008-04-02  David S. Miller  <davem@davemloft.net>
15101
15102         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15103         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15104
15105 2008-04-02  Craig Silverstein  <csilvers@google.com>
15106
15107         * TODO: New file.
15108
15109 2008-04-02  Ian Lance Taylor  <iant@google.com>
15110
15111         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15112         parameters.  Update for new key type to views_.  Change all
15113         callers.
15114         (File_read::read): Adjust for byteshift in returned view.
15115         (File_read::add_view): New function, broken out of
15116         find_and_make_view.
15117         (File_read::make_view): New function, broken out of
15118         find_and_make_view.
15119         (File_read::find_or_make_view): Add offset and aligned
15120         parameters.  Rewrite accordingly.  Change all callers.
15121         (File_read::get_view): Add offset and aligned parameters.  Adjust
15122         for byteshift in return value.
15123         (File_read::get_lasting_view): Likewise.
15124         * fileread.h (class File_read): Update declarations.
15125         (class File_read::View): Add byteshift_ field.  Add byteshift to
15126         constructor.  Add byteshift method.
15127         * archive.h (Archive::clear_uncached_views): New function.
15128         (Archive::get_view): Add aligned parameter.  Change all callers.
15129         * object.h (Object::get_view): Add aligned parameter.  Change all
15130         callers.
15131         (Object::get_lasting_view): Likewise.
15132
15133         * fileread.cc (File_read::release): Don't call clear_views if
15134         there are multiple objects.
15135         * fileread.h (File_read::clear_uncached_views): New function.
15136         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15137         on the archive.
15138
15139 2008-03-31  Cary Coutant  <ccoutant@google.com>
15140
15141         Add thin archive support.
15142         * archive.cc (Archive::armagt): New const.
15143         (Archive::setup): Remove task parameter and calls to unlock.
15144         (Archive::unlock_nested_archives): New function.
15145         (Archive::read_header): Add nested_off parameter. Change
15146         all callers.
15147         (Archive::interpret_header): Likewise.
15148         (Archive::include_all_members): Change to handle thin
15149         archives.
15150         (Archive::include_member): Likewise.
15151         * archive.h (Archive::Archive): Add new parameters and
15152         initializers.
15153         (Archive::armagt): New const.
15154         (Archive::setup): Remove task parameter.
15155         (Archive::unlock_nested_archives): New function.
15156         (Archive::read_header): Add nested_off parameter.
15157         (Archive::interpret_header): Likewise.
15158         (Archive::Nested_archive_table): New typedef.
15159         (Archive::is_thin_archive_): New field.
15160         (Archive::nested_archives_): New field.
15161         (Archive::options_): New field.
15162         (Archive::dirpath_): New field.
15163         (Archive::task_): New field.
15164         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15165         for thin archives.  Pass additional parameters to
15166         Archive::Archive.  Unlock the archive file after calling
15167         Archive::setup.
15168
15169 2008-03-29  Ian Lance Taylor  <iant@google.com>
15170
15171         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15172         version symbol to be local.
15173         * testsuite/ver_test_4.sh: New file.
15174         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15175         (check_DATA): Add ver_test_4.syms.
15176         (ver_test_4.syms): New target.
15177         * testsuite/Makefile.in: Rebuild.
15178
15179         * output.cc
15180         (Output_section::Input_section_sort_entry::has_priority): New
15181         function.
15182         (Output_section::Input_section_sort_entry::match_file_name): New
15183         function.
15184         (Output_section::Input_section_sort_entry::match_section_name):
15185         Remove.
15186         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15187         Remove.
15188         (Output_section::Input_section_sort_entry::match_section_file):
15189         Remove.
15190         (Output_section::Input_section_sort_compare::operator()): Rewrite
15191         using new Input_section_sort_entry functions.  Sort crtbegin and
15192         crtend first.  Sort sections with no priority before sections with
15193         a priority.
15194         * testsuite/initpri1.c (d3): Check j != 4.
15195         (cd5): New constructor/destructor function.
15196         (main): Check j != 2.
15197
15198         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15199         new symbol when resolving, don't call set_is_default.
15200         * testsuite/ver_test_7.cc: New file.
15201         * testsuite/ver_test_7.sh: New file.
15202         * testsuite/Makefile.am (ver_test_7.so): New target.
15203         (ver_test_7.o): New target.
15204         (check_SCRIPTS): Add ver_test_7.sh.
15205         (check_DATA): Add ver_test_7.syms.
15206         (ver_test_7.syms): New target.
15207
15208 2008-03-28  Ian Lance Taylor  <iant@google.com>
15209
15210         * layout.cc (Layout::layout): If we see an input section with a
15211         name that needs sorting, set the must_sort flag for the output
15212         section.
15213         (Layout::make_output_section): If the name of the output section
15214         indicates that it might require sorting, set the may_sort flag.
15215         * output.h (Output_section::may_sort_attached_input_sections): New
15216         function.
15217         (Output_section::set_may_sort_attached_input_sections): New
15218         function.
15219         (Output_section::must_sort_attached_input_sections): New
15220         function.
15221         (Output_section::set_must_sort_attached_input_sections): New
15222         function.
15223         (class Output_section): Declare Input_section_sort_entry.  Define
15224         Input_section_sort_compare.  Declare
15225         sort_attached_input_sections.  Add new fields:
15226         may_sort_attached_input_sections_,
15227         must_sort_attached_input_sections_,
15228         attached_input_sections_are_sorted_.
15229         * output.cc (Output_section::Output_section): Initialize new
15230         fields.
15231         (Output_section::add_input_section): Add an entry to
15232         input_sections_ if may_sort or must_sort are true.
15233         (Output_section::set_final_data_size): Call
15234         sort_attached_input_sections if necessary.
15235         (Output_section::Input_section_sort_entry): Define new class.
15236         (Output_section::Input_section_sort_compare::operator()): New
15237         function.
15238         (Output_section::sort_attached_input_sections): New function.
15239         * configure.ac: Check whether the compiler supports constructor
15240         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15241         * testsuite/initpri1.c: New file.
15242         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15243         CONSTRUCTOR_PRIORITY.
15244         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15245         (initpri1_LDFLAGS): New variable.
15246         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15247
15248 2008-03-27  Ian Lance Taylor  <iant@google.com>
15249
15250         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15251         * testsuite/common_test_1.c: New file.
15252         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15253         (common_test_1_SOURCES): New variable.
15254         (common_test_1_DEPENDENCIES): New variable.
15255         (common_test_1_LDFLAGS): New variable.
15256
15257         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15258         and commons_ correctly when NAME/VERSION does not override
15259         NAME/NULL.
15260         * testsuite/ver_test_6.c: New file.
15261         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15262         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15263         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15264
15265 2008-03-26  Ian Lance Taylor  <iant@google.com>
15266
15267         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15268         of an undefined symbol from a version script.
15269         * testsuite/Makefile.am (ver_test_5.so): New target.
15270         (ver_test_5.o): New target.
15271         (check_SCRIPTS): Add ver_test_5.sh.
15272         (check_DATA): Add ver_test_5.syms.
15273         (ver_test_5.syms): New target.
15274         * testsuite/ver_test_5.cc: New file.
15275         * testsuite/ver_test_5.script: New file.
15276         * testsuite/ver_test_5.sh: New file.
15277         * Makefile.in, testsuite/Makefile.in: Rebuild.
15278
15279         PR gold/5986
15280         Fix problems building gold with gcc 4.3.0.
15281         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15282         (gold_error_at_location, gold_warning_at_location): Use it.
15283         * configure.ac: Check whether we can compile and use a template
15284         function with a printf attribute.
15285         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15286         when jumping over bytes.
15287         * object.cc: Instantiate Object::read_section_data.
15288         * debug.h: Include <cstring>
15289         * dwarf_reader.cc: Include <algorithm>
15290         * main.cc: Include <cstring>.
15291         * options.cc: Include <cstring>.
15292         * output.cc: Include <cstring>.
15293         * script.cc: Include <cstring>.
15294         * script.h: Include <string>.
15295         * symtab.cc: Include <cstring> and <algorithm>.
15296         * target-select.cc: Include <cstring>.
15297         * version.cc: Include <string>.
15298         * testsuite/testmain.cc: Include <cstdlib>.
15299         * configure, config.in: Rebuild.
15300
15301 2008-03-25  Ian Lance Taylor  <iant@google.com>
15302
15303         * options.cc: Include "../bfd/bfdver.h".
15304         (options::help): Print bug reporting address.
15305
15306         * version.cc (print_version): Adjust output for current value of
15307         BFD_VERSION_STRING.
15308
15309         * NEWS: New file.
15310
15311         * options.cc (options::help): Print list of supported targets.
15312         * target-select.h: Include <vector>.
15313         (class Target_selector): Make machine_, size_, and is_big_endian_
15314         fields const.  Add bfd_name_ and instantiated_target_ fields.
15315         (Target_selector::Target_selector): Add bfd_name parameter.
15316         (Target_selector::recognize): Make non-virtual, call
15317         do_recognize.
15318         (Target_selector::recognize_by_name): Make non-virtual, call
15319         do_recognize_by_name.
15320         (Target_selector::supported_names): New function.
15321         (Target_selector::bfd_name): New function.
15322         (Target_selector::do_instantiate_target): New pure virtual
15323         function.
15324         (Target_selector::do_recognize): New virtual function.
15325         (Target_selector::do_recognize_by_name): New virtual function.
15326         (Target_selector::instantiate_target): New private function.
15327         (supported_target_names): Declare.
15328         * target-select.cc (Target_selector::Target_selector): Update for
15329         new parameter and fields.
15330         (select_target_by_name): Check that the name matches before
15331         calling recognize_by_name.
15332         (supported_target_names): New function.
15333         * i386.cc (class Target_selector_i386): Update Target_selector
15334         constructor call.  Remove recognize and recognize_by_name.  Add
15335         do_instantiate_target.
15336         * x86_64.cc (class Target_selector_x86_64): Likewise.
15337         * testsuite/testfile.cc (class Target_selector_test): Update for
15338         changes to Target_selector.
15339
15340         * README: Rewrite, with some notes on unsupported features.
15341
15342 2008-03-24  Cary Coutant  <ccoutant@google.com>
15343
15344         * i386.cc (Target_i386::Got_type): New enum declaration.
15345         (Target_i386::Scan::local): Updated callers of Output_data_got
15346         member functions.
15347         (Target_i386::Scan::global): Likewise.
15348         (Target_i386::Relocate::relocate): Likewise.
15349         (Target_i386::Relocate::relocate_tls): Likewise.
15350         * object.h (Got_offset_list): New class.
15351         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15352         (Sized_relobj::local_got_offset): Likewise.
15353         (Sized_relobj::set_local_got_offset): Likewise.
15354         (Sized_relobj::local_has_tls_got_offset): Removed.
15355         (Sized_relobj::local_tls_got_offset): Removed.
15356         (Sized_relobj::set_local_tls_got_offset): Removed.
15357         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15358         * output.cc (Output_data_got::add_global): Added got_type parameter.
15359         (Output_data_got::add_global_with_rel): Likewise.
15360         (Output_data_got::add_global_with_rela): Likewise.
15361         (Output_data_got::add_global_pair_with_rel): New function.
15362         (Output_data_got::add_global_pair_with_rela): New function.
15363         (Output_data_got::add_local): Added got_type parameter.
15364         (Output_data_got::add_local_with_rel): Likewise.
15365         (Output_data_got::add_local_with_rela): Likewise.
15366         (Output_data_got::add_local_pair_with_rel): New function.
15367         (Output_data_got::add_local_pair_with_rela): New function.
15368         (Output_data_got::add_global_tls): Removed.
15369         (Output_data_got::add_global_tls_with_rel): Removed.
15370         (Output_data_got::add_global_tls_with_rela): Removed.
15371         (Output_data_got::add_local_tls): Removed.
15372         (Output_data_got::add_local_tls_with_rel): Removed.
15373         (Output_data_got::add_local_tls_with_rela): Removed.
15374         * output.h (Output_data_got::add_global): Added got_type parameter.
15375         (Output_data_got::add_global_with_rel): Likewise.
15376         (Output_data_got::add_global_with_rela): Likewise.
15377         (Output_data_got::add_global_pair_with_rel): New function.
15378         (Output_data_got::add_global_pair_with_rela): New function.
15379         (Output_data_got::add_local): Added got_type parameter.
15380         (Output_data_got::add_local_with_rel): Likewise.
15381         (Output_data_got::add_local_with_rela): Likewise.
15382         (Output_data_got::add_local_pair_with_rel): New function.
15383         (Output_data_got::add_local_pair_with_rela): New function.
15384         (Output_data_got::add_global_tls): Removed.
15385         (Output_data_got::add_global_tls_with_rel): Removed.
15386         (Output_data_got::add_global_tls_with_rela): Removed.
15387         (Output_data_got::add_local_tls): Removed.
15388         (Output_data_got::add_local_tls_with_rel): Removed.
15389         (Output_data_got::add_local_tls_with_rela): Removed.
15390         * resolve.cc (Symbol::override_base_with_special): Removed
15391         reference to has_got_offset_ field.
15392         * symtab.cc (Symbol::init_fields): Replaced initialization
15393         of got_offset_ with got_offsets_.  Removed initialization
15394         of has_got_offset_
15395         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15396         (Symbol::got_offset): Likewise.
15397         (Symbol::set_got_offset): Likewise.
15398         (Symbol::has_tls_got_offset): Removed.
15399         (Symbol::tls_got_offset): Removed.
15400         (Symbol::set_tls_got_offset): Removed.
15401         (Symbol::got_offset_): Removed.
15402         (Symbol::tls_mod_got_offset_): Removed.
15403         (Symbol::tls_pair_got_offset_): Removed.
15404         (Symbol::got_offsets_): New field.
15405         (Symbol::has_got_offset): Removed.
15406         (Symbol::has_tls_mod_got_offset): Removed.
15407         (Symbol::has_tls_pair_got_offset): Removed.
15408         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15409         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15410         member functions.
15411         (Target_x86_64::Scan::global): Likewise.
15412         (Target_x86_64::Relocate::relocate): Likewise.
15413         (Target_x86_64::Relocate::relocate_tls): Likewise.
15414
15415 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15416
15417         * yyscript.y: Fix spelling error in comment.
15418
15419 2008-03-24  Ian Lance Taylor  <iant@google.com>
15420
15421         * options.h (class General_options): Define build_id option.
15422         * layout.h (class Layout): Declare write_build_id, create_note,
15423         create_build_id.  Add build_id_note_ member.
15424         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15425         "libiberty.h", "md5.h", "sha1.h".
15426         (Layout::Layout): Initialize eh_frame_data_,
15427         eh_frame_hdr_section_, and build_id_note_.
15428         (Layout::finalize): Call create_build_id.
15429         (Layout::create_note): New function, broken out of
15430         Layout::create_gold_note.
15431         (Layout::create_gold_note): Call create_note.
15432         (Layout::create_build_id): New function.
15433         (Layout::write_build_id): New function.
15434         (Close_task_runner::run): Call write_build_id.
15435
15436         * x86_64.cc: Correct license to GPLv3.
15437
15438 2008-03-23  Ian Lance Taylor  <iant@google.com>
15439
15440         * options.cc: Include "demangle.h".
15441         (parse_optional_string): New function.
15442         (parse_long_option): Handle takes_optional_argument.
15443         (parse_short_option): Update dash_z initializer.  Handle
15444         takes_optional_argument.
15445         (General_options::General_options): Initialize do_demangle_.
15446         (General_options::finalize): Set do_demangle_.  Handle demangling
15447         style.
15448         * options.h (parse_optional_string): Declare.
15449         (struct One_option): Add optional_arg field.  Update constructor.
15450         Update call constructor calls.  Add takes_optional_argument
15451         function.
15452         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15453         (DEFINE_optional_string): Define.
15454         (General_options::demangle): Change from DEFINE_bool to
15455         DEFINE_optional_string.
15456         (General_options::no_demangle): New function.
15457         (General_options::do_demangle): New function.
15458         (General_options::set_do_demangle): New function.
15459         (General_options::execstack_status_): Move definition to end of
15460         class definition.
15461         (General_options::static_): Likewise.
15462         (General_options::do_demangle_): New field.
15463         * object.cc (big_endian>::get_symbol_location_info): Call
15464         Options::do_demangle, not Options::demangle.
15465         * symtab.cc (demangle): Likewise.
15466
15467 2008-03-22  Ian Lance Taylor  <iant@google.com>
15468
15469         * gold.h: Include <cstddef> and <sys/types.h>
15470         * options.h: Include <cstring>.
15471
15472 2008-03-21  Ian Lance Taylor  <iant@google.com>
15473
15474         * Added source code to GNU binutils.
15475 \f
15476 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15477
15478 Copying and distribution of this file, with or without modification,
15479 are permitted in any medium without royalty provided the copyright
15480 notice and this notice are preserved.
15481
15482 Local Variables:
15483 mode: change-log
15484 left-margin: 8
15485 fill-column: 74
15486 version-control: never
15487 End: