a9b583bc82004b9c066136ca2663161fded0233d
[external/binutils.git] / gold / ChangeLog
1 2014-01-08  H.J. Lu  <hongjiu.lu@intel.com>
2
3         * version.cc (print_version): Update copyright year to 2014.
4
5 2013-12-19  Dimitry Andric  <dimitry@andric.com>
6
7         * stringpool.cc (Stringpool_template::reserve): Add
8         HAVE_UNORDERED_MAP case.
9         * stringpool.cc (Stringpool_template::print_stats): Likewise.
10
11 2013-12-18  Cary Coutant  <ccoutant@google.com>
12
13         * configure.ac: Check for <unordered_set> and <unordered_map>.
14         * config.in: Regenerate.
15         * configure: Regenerate.
16         * system.h: Use <unordered_set> and <unordered_map> if available.
17
18 2013-12-10  Roland McGrath  <mcgrathr@google.com>
19
20         * Makefile.am (install-exec-local): Prefix $(INSTALL_PROGRAM) uses
21         with $(INSTALL_PROGRAM_ENV).
22         * Makefile.in: Regenerate.
23
24 2013-11-22  Cary Coutant  <ccoutant@google.com>
25
26         * configure.ac: Add check for which library is needed for
27         dlopen.
28         * configure: Regenerate.
29
30 2013-11-22  Cary Coutant  <ccoutant@google.com>
31
32         * testsuite/Makefile.am (exception_x86_64_bnd_test): Use in-tree
33         assembler.
34         * testsuite/Makefile.in: Regenerate.
35
36 2013-11-17  H.J. Lu  <hongjiu.lu@intel.com>
37
38         * x86_64.cc (Target_x86_64<size>::Scan::get_reference_flags):
39         Handle R_X86_64_PC32_BND and R_X86_64_PLT32_BND just like
40         R_X86_64_PC32 and R_X86_64_PLT32, respectively.
41         (Target_x86_64<size>::Scan::local): Likewise.
42         (Target_x86_64<size>::Scan::global): Likewise.
43         (Target_x86_64<size>::Relocate::relocate): Likewise.
44         (Target_x86_64<size>::Relocatable_size_for_reloc::get_size_for_reloc):
45         Likewise.
46         (Target_x86_64<size>::Scan::check_non_pic(): Handle
47         R_X86_64_PC32_BND.
48
49         * testsuite/Makefile.am (check_PROGRAMS): Add
50         exception_x86_64_bnd_test.
51         (exception_x86_64_bnd_test_SOURCES): New macro.
52         (exception_x86_64_bnd_test_DEPENDENCIES): Likewise.
53         (exception_x86_64_bnd_test_LDFLAGS): Likewise.
54         (exception_x86_64_bnd_test_LDADD): Likewise.
55         (exception_x86_64_bnd_1.o): New rule.
56         (exception_x86_64_bnd_2.o): Likewise.
57         * testsuite/Makefile.in: Regenerated.
58
59 2013-11-15  Alan Modra  <amodra@gmail.com>
60
61         * powerpc.cc (Target_powerpc::glink_section): Provide non-const
62         accessor.
63         (Target_powerpc::Branch_info::make_stub): Make global entry stubs.
64         Only call ppc64_local_entry_offset for 64-bit.  Restrict
65         symval_for_branch lookup to ELFv1.
66         (Stub_table::add_plt_call_entry): Use unsigned int off.
67         (Output_data_glink::Address, invalid_address): New.
68         (Output_data_glink::add_eh_frame): Move out of line.  Add
69         support for ELFv2.
70         (Output_data_glink::add_global_entry, find_global_entry,
71         global_entry_address): New functions.
72         (Output_data_glink::global_entry_stubs_, end_branch_table_,
73         ge_size): New variables.
74         (Output_data_glink::set_final_data_size): Add global entry
75         stub sizing.
76         (Output_data_glink::do_write): Write global entry stubs.
77         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Add target
78         parameter.  Return true for ELFv2.  Adjust callers.
79         (Target_powerpc::Scan::local, global): Restrict opd lookup to
80         ELFv1.  Similarly for ifunc and dynamic relocation processing
81         specific to ELFv1.  Recognize that symbols are defined on
82         their plt entries for ELFv2.
83         (Target_powerpc::symval_for_branch): Assert if called for
84         ELFv2 or ppc32.
85         (Target_powerpc::Relocate::relocate): Use global entry plt
86         stub for symbol value if such exists on ELFv2.
87         (Target_powerpc::Relocate::relocate): Don't call
88         symval_for_branch when ELFv2.  Do adjust for local entry
89         offset when ELFv2.
90         (Target_powerpc::do_dynsym_value): Set symbols to global entry
91         plt stub for ELFv2.
92         (Target_powerpc::do_plt_address_for_global): Similarly.
93
94 2013-11-14  Cary Coutant  <ccoutant@google.com>
95
96         Revert patch -- this did not fix the problem, and there is
97         no race there.
98
99         2013-11-14  Cary Coutant  <ccoutant@google.com>
100
101             PR gold/14860
102             * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
103             (Ehframe_hdr::set_final_data_size): Allocate a Lock.
104             * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
105             updating fde_offsets_.
106             (Eh_frame_hdr::lock_): New data member.
107
108 2013-11-14  Cary Coutant  <ccoutant@google.com>
109
110         * dwp.cc (Dwo_file_entry): New type.
111         (File_list): Use Dwo_file_entry.
112         (Dwo_file::verify): New function.
113         (Dwo_file::verify_dwo_list): New function.
114         (Dwo_file::sized_verify_dwo_list): New function.
115         (Dwo_name_info_reader::visit_compilation_unit): Add dwo_id to file
116         list.
117         (Dwp_options): New enum type.
118         (dwp_options): Add --verify-only.
119         (usage): Likewise.
120         (main): Likewise.
121         * dwp.h (gold_info): Add declaration.
122
123 2013-11-14  Cary Coutant  <ccoutant@google.com>
124
125         PR gold/14860
126         * ehframe.cc (Eh_frame_hdr::Eh_frame_hdr): Initialize lock_.
127         (Ehframe_hdr::set_final_data_size): Allocate a Lock.
128         * ehframe.h (Eh_frame_hdr::record_fde): Hold the lock while
129         updating fde_offsets_.
130         (Eh_frame_hdr::lock_): New data member.
131
132 2013-11-06  Cary Coutant  <ccoutant@google.com>
133
134         PR gold/15758
135         * object.cc (Sized_relobj_file::do_layout): Handle .eh_frame sections
136         before reloc sections.
137
138 2013-11-04  Alan Modra  <amodra@gmail.com>
139
140         * symtab.h (Symbol::Reference_flags): Add FUNC_DESC_ABI.
141         (Symbol::needs_dynamic_reloc): Test new flag.
142         * powerpc.cc (needs_dynamic_reloc, use_plt_offset): Delete.
143         (Target_powerpc::Scan::get_reference_flags): Add target param.
144         Return FUNC_DESC_ABI for 64-bit ELFv1.
145         (Target_powerpc::Branch_info::make_stub): Adjust get_reference_flags
146         call.
147         (Target_powerpc::Scan::global): Use Symbol::needs_dynamic_reloc.
148         (Target_powerpc::Relocate::relocate): Use Symbol::use_plt_offset.
149
150 2013-10-31  Cary Coutant  <ccoutant@google.com>
151
152         Restore support for dwp v2 DWARF package file format.
153
154         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
155         tu_length parameter.  Adjust all callers.
156         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
157         * dwp.cc: Include dwarf.h.
158         (Section_bounds): New struct type.
159         (Unit_set): New struct type.
160         (Dwo_file::Dwo_file): Initialize new data member.
161         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
162         Combine and rename to...
163         (Dwo_file::read_unit_index): ...this.
164         (Dwo_file::sized_read_compunit_index)
165         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
166         (Dwo_file::sized_read_unit_index): ...this.
167         (Dwo_file::copy_section): Remove section_name, is_str_offsets
168         parameters; add section_id parameter.
169         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
170         (Dwo_file::add_unit_set): ...this.
171         (Dwo_file::shndx_map_): Remove.
172         (Dwo_file::sect_offsets_): New data member.
173         (Dwp_output_file::Dwp_output_file): Initialize new data members.
174         (Dwp_output_file::add_section): Rename to...
175         (Dwp_output_file::add_contribution): ...this.
176         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
177         (Dwp_output_file::add_tu_set): Likewise.
178         (Dwp_output_file::Contribution): New type.
179         (Dwp_output_file::Section::contributions): New data member.
180         (Dwp_output_file::Cu_or_tu_set): Remove.
181         (Dwp_output_file::Section::Section): New ctor.
182         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
183         (Dwp_output_file::Dwp_index::Section_table): New type.
184         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
185         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
186         parameter.
187         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
188         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
189         (Dwp_output_file::Dwp_index::section_table): New member function.
190         (Dwp_output_file::Dwp_index::section_table_end): New member function.
191         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
192         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
193         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
194         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
195         (Dwp_output_file::Dwp_index::section_table_): New data member.
196         (Dwp_output_file::Dwp_index::section_mask_): New data member.
197         (Dwp_output_file::add_output_section): New member function.
198         (Dwp_output_file::write_new_section): New member function.
199         (Dwp_output_file::write_contributions): New member function.
200         (Dwp_output_file::section_id_map_): New data member.
201         (class Dwo_id_info_reader): Remove.
202         (class Unit_reader): New class.
203         (get_dwarf_section_name): New function.
204         (Dwo_file::read_executable): Adjust initializations of class data.
205         (Dwo_file::read): Add support for v2 package file format.
206         (Dwo_file::read_unit_index): Likewise.
207         (Dwo_file::sized_read_unit_index): Likewise.
208         (Dwo_file::copy_section): Likewise.
209         (Dwo_file::add_unit_set): Likewise.
210         (Dwp_output_file::add_output_section): Likewise.
211         (Dwp_output_file::add_contribution): Likewise.
212         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
213         for empty slot.
214         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
215         file format.
216         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
217         slot.
218         (Dwp_output_file::initialize): Remove unused function.
219         (Dwp_output_file::finalize): Add support for v2 package file format.
220         (Dwp_output_file::write_index): Likewise.
221         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
222         function prototype.
223
224 2013-10-31  Cary Coutant  <ccoutant@google.com>
225
226         * configure.ac: Fix check for -fmerge-constants.
227         * configure.ac: Regenerate.
228
229 2013-10-30  Roland McGrath  <mcgrathr@google.com>
230
231         * x86_64.cc (Output_data_plt_x86_64_nacl::first_plt_entry):
232         Correct 9-byte nop sequence to match what the assembler generates.
233
234 2013-10-30  Alan Modra  <amodra@gmail.com>
235
236         * powerpc.cc (Powerpc_relobj::abiversion, set_abiversion,
237         ppc64_local_entry_offset, ppc64_local_entry_offset,
238         do_read_symbols): New functions.
239         (Powerpc_relobj::e_flags_, st_other_): New vars.
240         (Powerpc_relobj::Powerpc_relobj): Call set_abiversion.
241         (Powerpc_dynobj::abiversion, set_abiversion): New functions.
242         (Powerpc_relobj::e_flags_): New var.
243         (Target_powerpc::first_plt_entry_offset, plt_entry_size): Inline
244         and adjust for ELFv2.
245         (Target_powerpc::abiversion, set_abiversion, stk_toc): New functions.
246         (Powerpc_relobj::do_find_special_sections): Check no .opd in ELFv2.
247         (Powerpc_dynobj::do_find_special_sections): Likewise.
248         (Target_powerpc::do_define_standard_symbols): Define ".TOC.".
249         (Target_powerpc::Branch_info::make_stub): Adjust stub destination
250         to ELFv2 local entry.
251         (Target_powerpc::do_relax): No thread safe barriers needed for
252         ELFv2.
253         (Output_data_plt_powerpc::initial_plt_entry_size_,
254         plt_entry_size): Delete.  Replace all uses with
255         first_plt_entry_offset() and plt_entry_size().
256         (Output_data_plt_powerpc::Output_data_plt_powerpc): Remove
257         reserved_size parm.  Update callers.
258         (Output_data_plt_powerpc::entry_count): Update.
259         (Output_data_plt_powerpc::first_plt_entry_offset): Make private
260         and use Target_powerpc::first_plt_entry_offset().
261         (Output_data_plt_powerpc::get_plt_entry_size): Similarly and
262         rename to plt_entry_size.
263         (Output_data_plt_powerpc::add_ifunc_entry,
264         add_local_ifunc_entry): Adjust reloc for ELFv2.
265         (glink_eh_frame_fde_64): Rename to glink_eh_frame_fde_64v1.
266         (glink_eh_frame_fde_64v2): New.
267         (Stub_table::plt_call_size): Support ELFv2 sizing.
268         (Output_data_glink::add_eh_frame): Use the new FDE.
269         (Output_data_glink::set_final_data_size): Adjust for ELFv2 glink.
270         (Stub_table::do_write): Write ELFv2 stubs and glink.
271         (Target_powerpc::Relocate::relocate): Replaces nop after call
272         with ld 2,24(1) and adjust local offset destination for ELFv2.
273
274 2013-10-30  Alan Modra  <amodra@gmail.com>
275
276         * powerpc.cc (Target_powerpc::Scan::check_non_pic): Handle new relocs.
277         (Target_powerpc::Scan::global, local): Likewise.
278         (Target_powerpc::Relocate::relocate): Likewise.  Check for overflow
279         on all ppc64 @h and @ha relocs.
280
281 2013-10-14  Alan Modra  <amodra@gmail.com>
282
283         * output.h (Output_data_got::add_constant): Tidy.
284         (Output_data_got::add_constant_pair): New function.
285         * powerpc.cc (Output_data_got_powerpc): Override all Output_data_got
286         methods used so as to first call reserve_ent().
287
288 2013-10-11  Roland McGrath  <mcgrathr@google.com>
289
290         * powerpc.cc (Output_data_got_powerpc): Remove unused methods
291         add_got_entry and add_got_entry_pair.
292
293         * configure.ac (TLS_GNU2_DIALECT): Use -Werror in test.
294         (HAVE_PUBNAMES): Likewise.
295         * configure: Regenerate.
296
297         * testsuite/Makefile.am: Replace '-T foo' with '-Wl,-T,foo' throughout.
298         * testsuite/Makefile.in: Regenerate.
299
300         * target.h (Target::adjust_elf_header, Target::do_adjust_elf_header):
301         Remove const from declaration.
302         * target.cc (Sized_target::do_adjust_elf_header): Update definition.
303         * sparc.cc (Target_sparc::do_adjust_elf_header): Likewise.
304         * output.h (Output_file_header): Remove const from member target_
305         and corresponding constructor argument.
306         * output.cc (Output_file_header::Output_file_header): Update prototype.
307         (Output_file_header::do_sized_write): Use this->target_ in place
308         of parameters()->target().
309
310         * testsuite/undef_symbol.cc (Foo::get_a): New method.
311
312         * configure.ac (MERGE_CONSTANTS_FLAG): New check.
313         * configure: Regenerate.
314         * Makefile.in: Regenerate.
315         * testsuite/merge_string_literals_1.c: Renamed to have .cc suffix.
316         * testsuite/merge_string_literals_2.c: Likewise.
317         * testsuite/Makefile.am
318         (merge_string_literals_1.o, merge_string_literals_2.o): Update deps.
319         (AM_CFLAGS, AM_CXXFLAGS): Use $(MERGE_CONSTANTS_FLAG) in place of
320         literal -fmerge-constants.
321         * testsuite/Makefile.in: Regenerate.
322
323         * i386.cc (Target_i386): Remove unused member dynbss_.
324         * arm.cc (Target_arm): Likewise.
325         * powerpc.cc (Target_powerpc): Likewise.
326         * sparc.cc (Target_sparc): Likewise.
327         * tilegx.cc (Target_tilegx): Likewise.
328         * x86_64.cc (Target_x86_64): Likewise.
329         * dwarf_reader.h (Dwarf_info_reader): Remove unused members
330         type_signature_, type_offset_.
331         * plugin.h (Plugin_hook): Remove unused member layout_.
332         * readsyms.h (Add_symbols): Remove unused members dirpath_, dirindex_,
333         mapfile_.
334         (Read_member): Remove unused members input_objects_, symtab_,
335         mapfile_, layout_.
336         (Check_library): Remove unused member symtab_.
337         * archive.h (Lib_group): Remove unused member lib_.
338         * archive.cc (Lib_group::Lib_group): Update initializer.
339         * incremental.h (Incremental_binary): Remove unused member target_.
340         (Incremental_script_entry): Removed unused member script_.
341         * layout.h (Write_symbols_task): Remove unused member input_objects_.
342         * icf.h (Icf): Remove unused member num_tracked_relocs.
343
344         * gold-threads.h (Once): Conditionalize member was_run_lock_ on
345         [ENABLE_THREADS && __GCC_HAVE_SYNC_COMPARE_AND_SWAP_4], matching
346         its only use.
347         * gold-threads.cc (Once::Once): Likewise conditionalize initializer.
348
349         * archive.h: Use struct rather than class for forward declaration
350         of Read_symbols_data.
351
352 2013-10-07  Cary Coutant  <ccoutant@google.com>
353
354         PR gold/16010
355         * testsuite/Makefile.am (icf_test): Fix dependencies.
356         (icf_safe_test): Likewise.
357         (icf_safe_so_test): Likewise.
358         (large_symbol_alignment): Add empty _LDADD rule.
359         * testsuite/Makefile.in: Regenerate.
360
361 2013-09-03  Pavel Chupin  <pavel.v.chupin@intel.com>
362
363         PR gold/15927
364         * x86_64.cc (Target_x86_64<size>::Scan::global): Use relative
365         relocation for R_X86_64_32 on x32.
366
367 2013-08-27  Roland McGrath  <mcgrathr@google.com>
368
369         * output.cc (Output_segment::set_section_addresses): Take new
370         Target* argument.  If target->isolate_execinstr() and the segment
371         is executable and starts at a target->abi_pagesize() boundary,
372         pad its end out to a target->abi_pagesize() boundary with code fill.
373         * output.h (Output_segment::set_section_addresses): Update decl.
374         * layout.h (Layout::check_output_data_for_reset_values): Take new
375         argument RELAX_OUTPUTS.
376         (Layout): New member relax_output_list_.
377         (Layout::add_relax_output): New method.
378         * layout.cc (Layout::Layout): Update constructor.
379         (Layout::reset_relax_output): New method.
380         (Layout::clean_up_after_relaxation): Call it.
381         (Layout::prepare_for_relaxation): Update caller.
382         (Layout::set_segment_offsets): Update callers of set_section_addresses.
383         Call reset_relax_output before re-processing segments for
384         isolate_execinstr case.
385         (Layout::write_data): Handle relax_output_list_.
386         (Layout::Relaxation_debug_check::check_output_data_for_reset_values):
387         Take new argument RELAX_OUTPUTS.  Assert it's an empty collection.
388
389 2013-08-23  Yuri Chornoivan  <yurchor@ukr.net>
390
391         PR binutils/15834
392         * object.h: Fix typos.
393
394 2013-08-16  Roland McGrath  <mcgrathr@google.com>
395
396         * i386.cc (Target_i386_nacl::do_code_fill): New virtual function.
397         * x86_64.cc (Target_x86_64_nacl::do_code_fill): New virtual function.
398
399 2013-08-07  Cary Coutant  <ccoutant@google.com>
400
401         Revert support for v2 DWP files:
402
403         2013-03-01  Cary Coutant  <ccoutant@google.com>
404
405             Add dwp support for v2 DWARF package file format.
406             * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
407             tu_length parameter.  Adjust all callers.
408             * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
409             * dwp.cc: Include dwarf.h.
410             (Section_bounds): New struct type.
411             (Unit_set): New struct type.
412             (Dwo_file::Dwo_file): Initialize new data member.
413             (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
414             Combine and rename to...
415             (Dwo_file::read_unit_index): ...this.
416             (Dwo_file::sized_read_compunit_index)
417             (Dwo_file::sized_read_typeunit_index): Combine and rename to...
418             (Dwo_file::sized_read_unit_index): ...this.
419             (Dwo_file::copy_section): Remove section_name, is_str_offsets
420             parameters; add section_id parameter.
421             (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
422             (Dwo_file::add_unit_set): ...this.
423             (Dwo_file::shndx_map_): Remove.
424             (Dwo_file::sect_offsets_): New data member.
425             (Dwp_output_file::Dwp_output_file): Initialize new data members.
426             (Dwp_output_file::add_section): Rename to...
427             (Dwp_output_file::add_contribution): ...this.
428             (Dwp_output_file::add_cu_set): Combine parameters into a struct.
429             (Dwp_output_file::add_tu_set): Likewise.
430             (Dwp_output_file::Contribution): New type.
431             (Dwp_output_file::Section::contributions): New data member.
432             (Dwp_output_file::Cu_or_tu_set): Remove.
433             (Dwp_output_file::Section::Section): New ctor.
434             (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
435             (Dwp_output_file::Dwp_index::Section_table): New type.
436             (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
437             (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
438             parameter.
439             (Dwp_output_file::Dwp_index::shndx_pool): Remove.
440             (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
441             (Dwp_output_file::Dwp_index::section_table): New member function.
442             (Dwp_output_file::Dwp_index::section_table_end): New member function.
443             (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
444             (Dwp_output_file::Dwp_index::section_table_rows): New member function.
445             (Dwp_output_file::Dwp_index::section_table_cols): New member function.
446             (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
447             (Dwp_output_file::Dwp_index::section_table_): New data member.
448             (Dwp_output_file::Dwp_index::section_mask_): New data member.
449             (Dwp_output_file::add_output_section): New member function.
450             (Dwp_output_file::write_new_section): New member function.
451             (Dwp_output_file::write_contributions): New member function.
452             (Dwp_output_file::section_id_map_): New data member.
453             (class Dwo_id_info_reader): Remove.
454             (class Unit_reader): New class.
455             (get_dwarf_section_name): New function.
456             (Dwo_file::read_executable): Adjust initializations of class data.
457             (Dwo_file::read): Add support for v2 package file format.
458             (Dwo_file::read_unit_index): Likewise.
459             (Dwo_file::sized_read_unit_index): Likewise.
460             (Dwo_file::copy_section): Likewise.
461             (Dwo_file::add_unit_set): Likewise.
462             (Dwp_output_file::add_output_section): Likewise.
463             (Dwp_output_file::add_contribution): Likewise.
464             (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
465             for empty slot.
466             (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
467             file format.
468             (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
469             slot.
470             (Dwp_output_file::initialize): Remove unused function.
471             (Dwp_output_file::finalize): Add support for v2 package file format.
472             (Dwp_output_file::write_index): Likewise.
473             * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
474             function prototype.
475
476 2013-07-31  Cary Coutant  <ccoutant@google.com>
477
478         * object.cc (Sized_relobj::do_output_section_address): New function.
479         (Sized_relobj): Instantiate explicitly.
480         * object.h (Object::output_section_address): New function.
481         (Object::do_output_section_address): New function.
482         (Sized_relobj::do_output_section_address): New function.
483         * powerpc.cc (Target_powerpc::symval_for_branch): Use it.
484
485 2013-07-30  Cary Coutant  <ccoutant@google.com>
486             Sasa Stankovic  <Sasa.Stankovic@imgtec.com>
487
488         * parameters.cc (Parameters::entry): Return target-specific entry
489         symbol name.
490         * target.h (Target::entry_symbol_name): New function.
491         (Target_info::entry_symbol_name): New data member.
492
493         * arm.cc (Target_arm::arm_info): Add entry_symbol_name.
494         * i386.cc (Target_i386::i386_info): Likewise.
495         (Target_i386_nacl::i386_nacl_info): Likewise.
496         * sparc.cc (Target_sparc::sparc_info): Likewise.
497         * tilegx.cc (Target_tilegx::tilegx_info): Likewise.
498         * x86_64.cc: (Target_x86_64::x86_64_info) Likewise.
499         (Target_x86_64_nacl::x86_64_nacl_info) Likewise.
500         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
501
502 2013-07-22  Sterling Augustine  <saugustine@google.com>
503
504         * dwarf_reader.cc (Dwarf_pubnames_table::read_section):
505         Convert parameter shndx to local variable. Add parameters symtab
506         and symtab_size.  Scan over section names.  Find relocation
507         section corresponding to current section.  Create and initialize
508         reloc_mapper_ and reloc_type_.
509         (Dwarf_pubnames_table::read_header):  Add assertion.  Change
510         unit_length to off_t.  Initialize member unit_length_.  Fill in field
511         cu_offset_.
512         * dwarf_reader.h (Dwarf_pubnames_table::Dwarf_pubnames_table):
513         Initialize new fields unit_length_ and cu_offset_.
514         (Dwarf_pubnames_table::read_section): Update prototype.
515         (Dwarf_pubnames_table::cu_offset): New member function.
516         (Dwarf_pubnames_table::subsection_size): Likewise.
517         (Dwarf_pubnames_table::cu_offset_, Dwarf_pubnames_table::unit_length):
518         New fields.
519         (Dwarf_info_reader::symtab, Dwarf_info_reader::symtab_size): Make
520         member functions public.
521         * gdb_index.cc (Gdb_index_info_reader::read_pubnames_and_pubtypes):
522         Update comment.  Rework logic.  Move repeated parts to...
523         (Gdb_index_info_reader::read_pubtable): ...here. New function.
524         (Gdb_index::Gdb_index): Initialize new fields, pubnames_table_,
525         pubtypes_table_, and stmt_list_offset.
526         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
527         Gdb_index::find_pubtype_offset,
528         Gdb_index::map_pubnames_and_types_to_dies): Define new functions.
529         (Gdb_index::pubnames_read): Update prototype and rework logic.
530         * gdb_index.h (Gdb_index_info_reader, Dwarf_pubnames_table):
531         Forward declare.
532         (Gdb_index::map_pubtable_to_dies, Gdb_index::find_pubname_offset,
533         Gdb_index::find_pubtype_offset, Gdb_index::pubnames_table)
534         Gdb_index::pubtypes_table, Gdb_index::map_pubnames_and_types_to_dies,
535         Gdb_index::map_pubtable_to_dies):
536         Declare functions.
537         (Gdb_index::pubnames_read): Update declaration.
538         (Gdb_index::Pubname_offset_map): New type.
539         (Gdb_index::cu_pubname_map_, Gdb_index::cu_pubtype_map_,
540         Gdb_index::pubnames_table_, Gdb_index::pubtypes_table_,
541         Gdb_index::stmt_list_offset): Declare.
542         (Gdb_index::pubnames_shndx_, Gdb_index::pubnames_offet_,
543         Gdb_index::pubtypes_object_, Gdb_index::pubtypes_shndx_)
544         Gdb_index::pubtypes_offset_): Remove.
545
546 2013-07-19  Roland McGrath  <mcgrathr@google.com>
547
548         * options.h (General_options): Add -Trodata-segment option.
549         * parameters.cc (Parameters::check_rodata_segment): New function.
550         (Parameters::set_target_once): Call it.
551         * parameters.h (Parameters): Declare it (private member function).
552         * layout.cc (load_seg_unusable_for_headers): New function, broken
553         out of Layout::relaxation_loop_body.  If TARGET->isolate_execinstr()
554         then validate rodata segment rather than text segment.
555         (relaxation_loop_body): Call that.
556         (is_text_segment): New function.  Don't admit a non-executable
557         segment if TARGET->isolate_execinstr().
558         (set_segment_offsets): Call it.  Honor -Trodata-segment option.
559
560 2013-07-15  Shawn Landden  <shawnlandden@gmail.com>
561
562         PR gold/15070
563         * fileread.h (File_read::get_view): Clarify comment about ALIGNED.
564         * nacl.h (Sniff_file::View::View): Request aligned view.
565
566 2013-07-11  Cary Coutant  <ccoutant@google.com>
567
568         * powerpc.cc (Target_powerpc::write_branch_lookup_table): Use
569         correct BRLT entry size.
570
571 2013-07-03  Alan Modra  <amodra@gmail.com>
572
573         * powerpc.cc (Target_powerpc::Relocate::relocate): Update self-call
574         comment.
575
576 2013-07-01  Cary Coutant  <ccoutant@google.com>
577
578         * dwarf_reader.cc (Dwarf_ranges_table::read_ranges_table): Save
579         reloc_type_.
580         (Dwarf_ranges_table::read_range_list): Call lookup_reloc.
581         (Dwarf_ranges_table::lookup_reloc): New function.
582         * dwarf_reader.h (Dwarf_ranges_table::Dwarf_ranges_table): Initialize
583         reloc_type_.
584         (Dwarf_ranges_table::lookup_reloc): New function.
585         (Dwarf_ranges_table::reloc_type_): New data member.
586
587 2013-06-27  Jing Yu  <jingyu@google.com>
588
589         PR gold/15662
590         * powerpc.cc (Output_data_brlt_powerpc::reset_brlt_sizes): New
591         function.
592         (Output_data_brlt_powerpc::finalize_brlt_sizes): New function.
593         (Target_powerpc::do_relax): Call the above.
594
595 2013-06-27  Cary Coutant  <ccoutant@google.com>
596
597         * powerpc.cc (Target_powerpc::symval_for_branch): Don't assert
598         on garbage collected .opd section.
599
600 2013-06-27  Alan Modra  <amodra@gmail.com>
601
602         * powerpc.cc (Target_powerpc::do_gc_add_reference): Test dst_shndx
603         is non-zero.
604         (Target_powerpc::do_gc_mark_symbols): Likewise for sym->shndx().
605         (Target_powerpc::do_function_location): Likewise for loc->shndx.
606
607 2013-06-14  Cary Coutant  <ccoutant@google.com>
608
609         * resolve.cc (Symbol::override_base): Don't override st_type
610         from plugin placeholder symbols.
611         (Symbol_table::resolve): Likewise.
612         (Symbol_table::should_override): Don't complain about TLS mismatch
613         if the TO symbol is a plugin placeholder.
614         * testsuite/Makefile.am (plugin_test_tls): New test.
615         * testsuite/Makefile.in: Regenerate.
616         * testsuite/plugin_test_tls.sh: New test script.
617         * testsuite/two_file_test_2_tls.cc: New test source.
618         * testsuite/two_file_test_tls.cc: New test source.
619
620 2013-06-05  Alexander Ivchenko  <alexander.ivchenko@intel.com>
621
622         * layout.cc (Layout::set_segment_offsets): Taking care of the case when
623         the maximum segment alignment is larger than the page size.
624         * testsuite/Makefile.am (large_symbol_alignment): Test that Gold
625         correctly aligns the symbols with large alignemnt.
626         * testsuite/Makefile.in: Regenerate.
627         * testsuite/large_symbol_alignment.cc: New file.
628
629 2013-05-30  Alexander Ivchenko  <alexander.ivchenko@intel.com>
630             Sriraman Tallam  <tmsriram@google.com>
631
632         * options.h (sort_section): New option.
633         * output.h (Input_section_sort_section_prefix_special_ordering_compare):
634         Rename from Input_section_sort_section_name_special_ordering_compare.
635         (Input_section_sort_section_name_compare): New struct.
636         * output.cc (Output_section::Input_section_sort_section_name_compare::
637         operator()): New function.
638         (Output_section::sort_attached_input_sections): Use new sort function
639         for .text if --sort-section=name is specified.
640         * layout.cc (Layout::make_output_section):
641         Add sorting by name when --sort-section=name is specified.
642         * testsuite/Makefile.am (text_section_grouping): Test option
643         --sort-section=name.
644         * testsuite/Makefile.in: Regenerate.
645         * testsuite/section_sorting_name.cc: New file.
646         * testsuite/section_sorting_name.sh: New file.
647
648 2013-05-21  Cary Coutant  <ccoutant@google.com>
649
650         * symtab.h (Symbol::is_cxx_vtable): New function.
651         * target-reloc.h (relocate_section): Check for vtable symbol.
652         * testsuite/Makefile.am (missing_key_func.sh): New test case.
653         * testsuite/Makefile.in: Regenerate.
654         * testsuite/missing_key_func.cc: New test source.
655         * testsuite/missing_key_func.sh: New test script.
656
657 2013-05-21  Cary Coutant  <ccoutant@google.com>
658
659         * object.cc (Sized_relobj_file::get_symbol_location_info): Set
660         type of enclosing symbol.
661         (Relocate_info::location): Check symbol type when describing symbol.
662         * object.h (Symbol_location_info): Remove unused line_number;
663         add enclosing_symbol_type.
664         * testsuite/debug_msg.sh: Adjust expected output.
665
666 2013-05-13  Cary Coutant  <ccoutant@google.com>
667
668         * configure.ac: Export DEFAULT_TARGET.
669         * configure: Regenerate.
670         * Makefile.in: Regenerate.
671         * testsuite/Makefile.am: Add .EXPORT_ALL_VARIABLES.
672         * testsuite/Makefile.in: Regenerate.
673         * testsuite/debug_msg.sh: Delete duplicate tests.
674         Don't check undef_int error message match for powerpc where the
675         source file and line number aren't available.
676
677 2013-05-10  Roland McGrath  <mcgrathr@google.com>
678
679         * options.h (General_options): Add --rosegment-gap option.
680         * options.cc (finalize): --rosegment-gap implies --rosegment.
681         * layout.cc (set_segment_offsets): Let user option override
682         target->rosegment_gap().
683
684 2013-05-10  Roland McGrath  <mcgrathr@google.com>
685
686         * options.h (General_options): Remove leading space from help
687         messages for -nostdlib and --rosegment.
688
689 2013-05-03  Maciej W. Rozycki  <macro@codesourcery.com>
690
691         PR ld/15365
692         * layout.cc (Layout::finalize): Make __ehdr_start STV_HIDDEN.
693
694 2013-05-03  Alan Modra  <amodra@gmail.com>
695
696         * merge.cc (Output_merge_string::do_add_input_section): Correct
697         scan for number of strings.  Rename vars to avoid shadowing.
698         Include missing terminator in input_size_.
699
700 2013-05-01  H.J. Lu  <hongjiu.lu@intel.com>
701
702         * merge.cc (Output_merge_string<Char_type>::do_add_input_section):
703         Restore empty string handling.
704
705 2013-05-01  Cary Coutant  <ccoutant@google.com>
706
707         * stringpool.cc (Stringpool_template::new_key_offset): Fix
708         uninitialized warning.
709
710 2013-04-29  Alexander Ivchenko  <alexander.ivchenko@intel.com>
711
712         * output.cc (Output_section::add_merge_input_section): Allow
713         to merge sections if the alignment is more than character size.
714         * merge.h (Output_merge_string::Output_merge_string): Remove
715         assert.
716         * merge.cc (Output_merge_string<Char_type>::do_add_input_section): Count
717         only not-null strings. Check the alignment of strings.
718         * stringpool.h
719         (Stringpool_template<Stringpool_char>::Stringpool_template): Add
720         alignment as the argument.
721         (Stringpool_template<Stringpool_char>::addralign_): New class member.
722         * stringpool.cc (Stringpool_template<Stringpool_char>::new_key_offset):
723         Align non-zero length strings according to the addralign_.
724         (Stringpool_template<Stringpool_char>::set_string_offsets):
725         Updating offsets according to the given alignment.
726         * testsuite/Makefile.am (text_section_grouping): Test if string
727         literals are getting merged.
728         * testsuite/Makefile.in: Regenerate.
729         * testsuite/merge_string_literals_1.c: New file.
730         * testsuite/merge_string_literals_2.c: Ditto.
731         * testsuite/merge_string_literals.sh: Ditto.
732
733 2013-04-26  Ian Lance Taylor  <iant@google.com>
734
735         * target-reloc.h (relocate_section): If the reloc offset is out of
736         range, pass VIEW as NULL to relocate.relocate.
737         * arm.cc (Target_arm:Relocate::relocate): Check for a NULL view.
738         * i386.cc (Target_i386::Relocate::relocate): Likewise.
739         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
740         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
741         * tilegx.cc (Target_tilegx::Relocate::relocate): Likewise.
742         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
743
744 2013-04-26  Geoff Pike  <gpike@chromium.org>
745
746         * gold.cc (queue_final_tasks): invoke layout->queue_build_id_tasks().
747         * layout.cc (Hash_task): New class.
748         (Layout::queue_build_id_tasks): New function.
749         (Layout::write_build_id): Handle single-thread portion of build ID
750         computation.  (In some cases, all of it is single-threaded.)  Replace
751         {sha1,md5}_process_bytes with {sha1,md5}_buffer to get the same
752         functionality in fewer lines of code.
753         * layout.h (Layout::queue_build_id_tasks): New function declaration.
754         * options.h (General_options): make "--build-id" default to tree
755         rather than sha1.  Add two new options related to --build-id=tree:
756         --build-id-chunk-size-for-treehash and
757         --build-id-min-file-size-for-treehash.
758         * Makefile.am: add testing of --build-id=tree and related new options
759         (these tests will be invoked by "make check").
760         * Makefile.in: Regenerate.
761
762 2013-04-25  Alan Modra  <amodra@gmail.com>
763
764         * configure.tgt: Add powerpcle and powerpc64le.
765
766 2013-04-22  Alan Modra  <amodra@gmail.com>
767
768         PR gold/15355
769         * layout.cc (Layout::segment_precedes): Allow more than one
770         segment with the same type and flags.
771
772 2013-04-15  Cary Coutant  <ccoutant@google.com>
773
774         * layout.cc (Layout::set_relocatable_section_offsets): Don't
775         allocate space in file for BSS sections.
776
777 2013-04-15  Cary Coutant  <ccoutant@google.com>
778
779         * script-sections.cc (Orphan_output_section): Reset address
780         to zero after each orphaned section for relocatable links.
781
782 2013-04-15  Cary Coutant  <ccoutant@google.com>
783
784         * symtab.cc (Symbol_table::sized_write_globals): Subtract
785         section starting address for relocatable link.
786         * testsuite/Makefile.am (script_test_11): New test.
787         * testsuite/Makefile.in: Regenerate.
788         * testsuite/script_test_11.c: New source file.
789         * testsuite/script_test_11.t: New linker script.
790
791 2013-04-13  Alan Modra  <amodra@gmail.com>
792
793         * powerpc.cc (Stub_control::can_add_to_stub_group): Don't set
794         owner when sections are not adjacent and exceed group size.
795         (Target_powerpc::group_sections): Handle corner case.
796         (Target_powerpc::Branch_info::make_stub): Handle case where
797         stub table doesn't exist due to branches in non-exec sections.
798         (Target_powerpc::Relocate::relocate): Likewise.
799
800 2013-04-11  Alan Modra  <amodra@gmail.com>
801
802         PR gold/15354
803         * powerpc.cc (Target_powerpc::make_brlt_section): Name section
804         .branch_lt to match bfd ld.  Adjust comments throughout file.
805
806 2013-04-04  Ian Lance Taylor  <iant@google.com>
807
808         GCC PR c++/56840
809         * object.cc (do_layout_deferred_sections): Handle .eh_frame
810         sections before checking whether they are included in the link.
811
812 2013-03-29  Sriraman Tallam  <tmsriram@google.com>
813
814         * archive.cc (Archive::get_elf_object_for_member):  Create the elf
815         object before calling the plugin claim_file handler.  Pass the elf
816         object of the archive to the plugin. Delete the elf object if the
817         plugin claims the file.
818
819 2013-03-21  Alan Modra  <amodra@gmail.com>
820
821         * layout.cc (Layout::set_segment_offsets): Accept writable .text
822         segment when omagic.
823
824 2013-03-21  Alan Modra  <amodra@gmail.com>
825
826         * dwp.cc (Dwp_output_file::add_contribution): Avoid signed/unsigned
827         comparison warning.
828         * layout.cc (Layout::create_dynamic_symtab): Avoid "may be used
829         uninitialized" warning.
830
831 2013-03-20  Alan Modra  <amodra@gmail.com>
832
833         * symtab.h (Symbol::clear_version): New function.
834         * symtab.cc (Symbol_table::set_dynsym_indexes): Don't set object
835         is_needed by weak references.  Clear version for symbols defined
836         in as-needed objects that are not needed.
837
838 2013-03-15  Alan Modra  <amodra@gmail.com>
839
840         * powerpc.cc (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Make
841         static and public.  Add report_err param.  Return false for data refs.
842         (Target_powerpc::rela_dyn_section): New overloaded function.
843         (Target_powerpc::plt_, iplt_): Elucidate.
844         (Output_data_plt_powerpc::entry_count): Handle current_data_size()==0.
845         (Output_data_plt_powerpc::do_write): Don't write .iplt.
846         (Output_data_plt_powerpc::plt_entry_count): Don't add .iplt entries.
847         (Target_powerpc::Scan::local, global): Adjust reloc_needs_plt_for_ifunc
848         calls.  Put ifunc dynamic relocs in irela_dyn_section.  Only
849         push_branch and make_plt_entry for ifunc syms when
850         reloc_needs_plt_for_ifunc.
851         (Target_powerpc::Relocate::relocate): Don't use plt entry value
852         for ifunc unless reloc_needs_plt_for_ifunc.
853
854 2013-03-15  Alan Modra  <amodra@gmail.com>
855
856         * gc.h (gc_process_relocs): Don't look through function descriptors.
857         * icf.cc (get_section_contents): Do so here instead.
858
859 2013-03-13  Alan Modra  <amodra@gmail.com>
860
861         * powerpc.cc (is_branch_reloc): Forward declare.
862         (Target_powerpc::do_can_check_for_function_pointers): New predicate.
863         (Target_powerpc::Scan::local_reloc_may_be_function_pointer): Return
864         false for 64-bit, true for 32-bit non-branch relocs.
865         (Target_powerpc::Scan::global_reloc_may_be_function_pointer): Likewise.
866         * testsuite/Makefile.am (icf_test): Use linker map file instead of
867         nm output.
868         (icf_safe_test): Generate linker map file as well as nm output.
869         (icf_safe_so_test): Likewise.
870         * testsuite/Makefile.in: Regenerate.
871         * testsuite/icf_test.sh: Parse linker map file to determine
872         section folding.
873         * testsuite/icf_safe_test.sh: Likewise.  Expect folding for PowerPC.
874         * testsuite/icf_safe_so_test.sh: Likewise.
875         (X86_32_or_ARM_specific_safe_fold): Merge into..
876         (arch_specific_safe_fold): ..this.
877         (X86_64_specific_safe_fold): Delete unused function.
878
879 2013-03-12  Alan Modra  <amodra@gmail.com>
880
881         * gc.h (gc_process_relocs): Look through function descriptors
882         to determine shndx, symvalue and addend used by ICF.  Tidy
883         variable duplication.
884
885 2013-03-11  Alan Modra  <amodra@gmail.com>
886
887         * gold.cc (queue_middle_tasks): Move detect_odr_violations..
888         * layout.cc (Layout_task_runner::run): ..to here.
889         * symtab.h (struct Symbol_location): Extract from..
890         (class Symbol_table): ..here.
891         * symtab.cc (Symbol_table::linenos_from_loc): Invoke function_location.
892         * target.h (class Target): Add function_location and
893         do_function_location functions.
894         (class Sized_target): Add do_function_location.
895         * object.h (class Sized_relobj_file): Move find_shdr..
896         (class Object): ..to here.
897         * object.cc: Likewise.  Update to suit.  Instantiate.
898         (Sized_relobj_file::find_eh_frame): Update find_shdr call.
899         * powerpc.cc (class Powerpc_dynobj): New.
900         (Target_powerpc::do_function_location): New function.
901         (Powerpc_relobj::do_find_special_sections): Update find_shdr call.
902         (Powerpc_dynobj::do_read_symbols): New function.
903         (Target_powerpc::do_make_elf_object): Make a Powerpc_dynobj.
904
905 2013-03-08  Ian Lance Taylor  <iant@google.com>
906
907         * options.cc (General_options::string_to_object_format): Accept
908         "default".
909
910 2013-03-08  Alan Modra  <amodra@gmail.com>
911
912         * ehframe.h (Post_fdes) Make it a vector of Post_fde rather than
913         pointer to Post_fde.
914         (struct Post_fde): Move definition to here..
915         * ehframe.cc (struct Post_fde): ..from here.
916         (Cie::write): Don't alloc Post_fde.
917         (Eh_frame::do_sized_write): Update.  Don't free Post_fde.
918
919 2013-03-07  Alan Modra  <amodra@gmail.com>
920
921         * testsuite/discard_locals_relocatable_test.c: Add a powerpc
922         relocation referencing .LC0.
923         * testsuite/discard_locals_test.sh: Remove FIXMEs.
924
925 2013-03-07  Alan Modra  <amodra@gmail.com>
926
927         * testsuite/ifunc-sel.h (ifunc_sel, ifunc_one): Mark
928         always_inline.  Add assembly for powerpc to avoid GOT.
929
930 2013-03-07  Alan Modra  <amodra@gmail.com>
931
932         * testsuite/script_test_10.sh: Don't test .bss section
933         header number.
934
935 2013-03-06  Alan Modra  <amodra@gmail.com>
936
937         * powerpc.cc (class Powerpc_relobj): Move some member functions.
938         (Target_powerpc::symval_for_branch):  Add symtab param.  Update
939         all callers.  Handle folded sections.
940         (Target_powerpc::do_gc_add_reference): Don't cast dynamic object
941         to Powerpc_relobj.
942         (Global_symbol_visitor_opd::operator()): Likewise.
943
944 2013-03-04  Alan Modra  <amodra@gmail.com>
945
946         * testsuite/Makefile.am (final_layout_script.lds): Add .sbss.
947         * testsuite/Makefile.in: Regenerate.
948
949 2013-03-01  Cary Coutant  <ccoutant@google.com>
950
951         Add dwp support for v2 DWARF package file format.
952         * dwarf_reader.cc (Dwarf_info_reader::visit_type_unit): Add
953         tu_length parameter.  Adjust all callers.
954         * dwarf_reader.h (Dwarf_info_reader::visit_type_unit): Likewise.
955         * dwp.cc: Include dwarf.h.
956         (Section_bounds): New struct type.
957         (Unit_set): New struct type.
958         (Dwo_file::Dwo_file): Initialize new data member.
959         (Dwo_file::read_compunit_index, Dwo_file::read_typeunit_index):
960         Combine and rename to...
961         (Dwo_file::read_unit_index): ...this.
962         (Dwo_file::sized_read_compunit_index)
963         (Dwo_file::sized_read_typeunit_index): Combine and rename to...
964         (Dwo_file::sized_read_unit_index): ...this.
965         (Dwo_file::copy_section): Remove section_name, is_str_offsets
966         parameters; add section_id parameter.
967         (Dwo_file::add_cu_set, Dwo_file::add_tu_set): Combine and rename to...
968         (Dwo_file::add_unit_set): ...this.
969         (Dwo_file::shndx_map_): Remove.
970         (Dwo_file::sect_offsets_): New data member.
971         (Dwp_output_file::Dwp_output_file): Initialize new data members.
972         (Dwp_output_file::add_section): Rename to...
973         (Dwp_output_file::add_contribution): ...this.
974         (Dwp_output_file::add_cu_set): Combine parameters into a struct.
975         (Dwp_output_file::add_tu_set): Likewise.
976         (Dwp_output_file::Contribution): New type.
977         (Dwp_output_file::Section::contributions): New data member.
978         (Dwp_output_file::Cu_or_tu_set): Remove.
979         (Dwp_output_file::Section::Section): New ctor.
980         (Dwp_output_file::Dwp_index::Shndx_pool): Remove.
981         (Dwp_output_file::Dwp_index::Section_table): New type.
982         (Dwp_output_file::Dwp_index::Dwp_index): Initialize new data members.
983         (Dwp_output_file::Dwp_index::enter_set): Change type of "set"
984         parameter.
985         (Dwp_output_file::Dwp_index::shndx_pool): Remove.
986         (Dwp_output_file::Dwp_index::shndx_pool_end): Remove.
987         (Dwp_output_file::Dwp_index::section_table): New member function.
988         (Dwp_output_file::Dwp_index::section_table_end): New member function.
989         (Dwp_output_file::Dwp_index::shndx_pool_size): Remove.
990         (Dwp_output_file::Dwp_index::section_table_rows): New member function.
991         (Dwp_output_file::Dwp_index::section_table_cols): New member function.
992         (Dwp_output_file::Dwp_index::shndx_pool_): Remove.
993         (Dwp_output_file::Dwp_index::section_table_): New data member.
994         (Dwp_output_file::Dwp_index::section_mask_): New data member.
995         (Dwp_output_file::add_output_section): New member function.
996         (Dwp_output_file::write_new_section): New member function.
997         (Dwp_output_file::write_contributions): New member function.
998         (Dwp_output_file::section_id_map_): New data member.
999         (class Dwo_id_info_reader): Remove.
1000         (class Unit_reader): New class.
1001         (get_dwarf_section_name): New function.
1002         (Dwo_file::read_executable): Adjust initializations of class data.
1003         (Dwo_file::read): Add support for v2 package file format.
1004         (Dwo_file::read_unit_index): Likewise.
1005         (Dwo_file::sized_read_unit_index): Likewise.
1006         (Dwo_file::copy_section): Likewise.
1007         (Dwo_file::add_unit_set): Likewise.
1008         (Dwp_output_file::add_output_section): Likewise.
1009         (Dwp_output_file::add_contribution): Likewise.
1010         (Dwp_output_file::Dwp_index::find_or_add): Use row index to check
1011         for empty slot.
1012         (Dwp_output_file::Dwp_index::enter_set): Add support for v2 package
1013         file format.
1014         (Dwp_output_file::Dwp_index::grow): Use row index to check for empty
1015         slot.
1016         (Dwp_output_file::initialize): Remove unused function.
1017         (Dwp_output_file::finalize): Add support for v2 package file format.
1018         (Dwp_output_file::write_index): Likewise.
1019         * gdb-index.cc (Gdb_index_info_reader::visit_type_unit): Adjust
1020         function prototype.
1021
1022 2013-03-01  Cary Coutant  <ccoutant@google.com>
1023
1024         * dwarf_reader.cc (Dwarf_info_reader::check_buffer): Move
1025         function into class definition in header file.
1026         (Dwarf_info_reader::warn_corrupt_debug_section): New function.
1027         * dwarf_reader.h (Dwarf_info_reader::warn_corrupt_debug_section):
1028         New function.
1029         (Dwarf_info_reader::check_buffer): Move here from .cc file.
1030
1031 2013-02-28  Alan Modra  <amodra@gmail.com>
1032
1033         * target.h (Target::plt_fde_location, do_plt_fde_location): Declare.
1034         * target.cc (Target::do_plt_fde_location): New function.
1035         * ehframe.h (class FDE): Add post_map field to u_.from_linker,
1036         accessor function, and constructor param.
1037         (struct Post_fde, Post_fdes): Declare.
1038         (Cie::write): Add post_fdes param.
1039         * ehframe.cc (Fde::write): Use plt_fde_location.
1040         (struct Post_fde): Define.
1041         (Cie::write): Stash FDEs added post merge mapping.
1042         (Eh_frame::add_ehframe_for_plt): Assert no new CIEs after mapping.
1043         Adjust Fde constructor call.  Bump final_data_size_ for post map FDEs.
1044         (Eh_frame::do_sized_write): Arrange to write post map FDES after
1045         other FDEs.
1046         * powerpc.cc (Target_powerpc::do_plt_fde_location): New function.
1047         (Target_powerpc::has_glink): New function.
1048         (Target_powerpc::do_relax): Add eh_frame info for stubs.
1049         (struct Eh_cie, eh_frame_cie, glink_eh_frame_fde_64,
1050         glink_eh_frame_fde_32, default_fde): New data.
1051         (Stub_table::eh_frame_added_): New var.
1052         (Stub_table::find_long_branch_entry, stub_address, stub_offset):
1053         Make const.
1054         (Stub_table::add_eh_frame): New function.
1055         (Output_data_glink::add_eh_frame): New function.
1056         (Target_powerpc::make_glink_section): Call add_eh_frame.
1057
1058 2013-02-15  Ian Lance Taylor  <iant@google.com>
1059
1060         * options.h (DEFINE_uint64_alias): Define.
1061         (class General_options): Add -Ttext-segment as an alias for
1062         -Ttext.
1063
1064 2013-02-15  Alan Modra  <amodra@gmail.com>
1065
1066         * powerpc.cc (Stub_table::plt_off): New function, extracted from..
1067         (Stub_table::do_write): ..here, two places.
1068         (Stub_table::plt_call_size): Use it here too.
1069
1070 2013-02-11  Ian Lance Taylor  <iant@google.com>
1071
1072         * descriptors.cc (Descriptors::close_all): New function.
1073         * descriptors.h (class Descriptors): Declare close_all.
1074         (close_all_descriptors): New inline function.
1075         * plugin.cc: Include "descriptors.h".
1076         (Plugin_manager::cleanup): Call close_all_descriptors.
1077
1078 2013-02-06  Alan Modra  <amodra@gmail.com>
1079
1080         * README: Update coding style link.
1081
1082 2013-01-28  Cary Coutant  <ccoutant@google.com>
1083
1084         * dwp.cc (File_list): New typedef.
1085         (Dwo_name_info_reader): New class.
1086         (Dwo_id_info_reader::Dwo_id_info_reader): Remove unused parameters.
1087         (Dwo_id_info_reader::visit_top_die): Remove unused member function.
1088         (Dwo_file::~Dwo_file): Delete input_file_ after obj_.
1089         (Dwo_file::read_executable): New function.
1090         (Dwo_file::read): Move common setup code to ...
1091         (Dwo_file::make_object): ... here.
1092         (dwp_options): Add --exec/-e.
1093         (usage): Likewise.
1094         (main): Likewise.
1095
1096 2013-01-24  Sriraman Tallam  <tmsriram@google.com>
1097
1098         * layout.cc (Layout::layout): Check for option text_reorder.
1099         (Layout::make_output_section): Ditto.
1100         * options.h (text_reorder): New option.
1101         * output.cc (Input_section_sort_compare): Remove special ordering
1102         of section names.
1103         (Output_section::
1104          Input_section_sort_section_name_special_ordering_compare::
1105          operator()): New function.
1106         (Output_section::sort_attached_input_sections): Use new sort function
1107         for .text.
1108         * output.h (Input_section_sort_section_name_special_ordering_compare):
1109         New struct.
1110         * testsuite/Makefile.am (text_section_grouping): Test option
1111         --no-text-reorder
1112         * testsuite/Makefile.in: Regenerate.
1113         * testsuite/text_section_grouping.sh: Check order of functions without
1114         default text reordering.
1115
1116 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1117
1118         * options.h (General_options): Change default to true for new_dtags.
1119
1120 2013-01-18  Mike Frysinger  <vapier@gentoo.org>
1121
1122         * layout.cc (Layout::finish_dynamic_section): Only add DT_RPATH
1123         when enable_new_dtags is false.  Only add DT_RUNPATH when
1124         enable_new_dtags is true.
1125
1126 2013-01-17  Serge Pavlov  <serge.v.pavlov@gmail.com>
1127
1128         * powerpc.cc (Stub_table::find_plt_call_entry): Make types
1129         used in declaration and definition consistent.
1130         (Target_powerpc::symval_for_branch): Ditto.
1131
1132 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1133
1134         * testsuite/plugin_final_layout.cc: Fix comment.
1135
1136 2013-01-16  Sriraman Tallam  <tmsriram@google.com>
1137
1138         * layout.cc (Layout::layout): Do not do default sorting for
1139         text sections when section ordering is specified.
1140         (make_output_section): Ditto.
1141         * testsuite/plugin_final_layout.cc: Name the function sections
1142         to catch reordering issues.
1143
1144 2013-01-15  Alan Modra  <amodra@gmail.com>
1145
1146         * powerpc.cc (Target_powerpc::do_relax): Default shared libs to
1147         plt-thread-safe.
1148
1149 2013-01-15  Alan Modra  <amodra@gmail.com>
1150
1151         * testsuite/Makefile.am (final_layout_script.lds): Handle .got section.
1152         * testsuite/Makefile.in: Regenerate.
1153
1154 2013-01-14  Alan Modra  <amodra@gmail.com>
1155
1156         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add various output files.
1157         * testsuite/Makefile.in: Regenerate.
1158
1159 2013-01-11  Pavel Chupin  <pavel.v.chupin@intel.com>
1160
1161         PR bfd/14430
1162         Fix mingw gold build with plugins enabled
1163         * Makefile.am: Replace -ldl with @DLOPEN_LIBS@.
1164         * configure.ac: Export DLOPEN_LIBS and add headers check.
1165         * plugin.cc: Handle non-dlfcn case.
1166         * Makefile.in: Regenerate.
1167         * config.in: Regenerate.
1168         * configure: Regenerate.
1169         * testsuite/Makefile.in: Regenerate.
1170
1171 2013-01-09  Sriraman Tallam  <tmsriram@google.com>
1172
1173         * output.h (sort_attached_input_sections): Change to be public.
1174         * script-sections.cc
1175         (Output_section_definition::set_section_addresses): Sort
1176         attached input sections according to section order before linker
1177         script assigns section addresses.
1178         (Orphan_output_section::set_section_addresses): Sort
1179         attached input sections according to section order before linker
1180         script assigns section addresses.
1181         * Makefile.am (final_layout.sh): Use a simple linker script to
1182         check if section ordering still works.
1183         * Makefile.in: Regenerate.
1184
1185 2013-01-09  Ben Cheng  <bccheng@google.com>
1186
1187         * arm.cc (Target_arm::attributes_accept_div): New function.
1188         (Target_arm::attributes_forbid_div): New function.
1189         (Target_arm::merge_object_attributes): Merge the Tag_DIV_use
1190         attribute using the same new functions as what bfd/elf32_arm.c
1191         does.
1192
1193 2013-01-07  Cary Coutant  <ccoutant@google.com>
1194
1195         PR gold/14993
1196         * output.cc (Output_section::add_input_section): For incremental
1197         updates, don't track input sections that are allocated from patch
1198         space.
1199
1200 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1201             Ian Lance Taylor  <iant@google.com>
1202
1203         PR gold/14897
1204         * configure.ac (--enable-ld): Removed.
1205         (install_as_default): Set to yes only for --enable-gold=default
1206         or --disable-ld.
1207         * configure: Regenerated.
1208
1209 2013-01-07  H.J. Lu  <hongjiu.lu@intel.com>
1210
1211         * options.h (General_options): Add -fuse-ld= for GCC linker
1212         option compatibility.
1213
1214 2013-01-04  Cary Coutant  <ccoutant@google.com>
1215
1216         * configure.ac: Fix typo restoring CXXFLAGS.
1217         * configure: Regenerate.
1218
1219 2013-01-04  Cary Coutant  <ccoutant@google.com>
1220
1221         * testsuite/Makefile.am (CXXLINK_S): New macro.
1222         (debug_msg_so.err, debug_msg_ndebug.err): Use CXXLINK_S.
1223         * testsuite/Makefile.in: Regenerate.
1224
1225 2013-01-02  H.J. Lu  <hongjiu.lu@intel.com>
1226
1227         * version.cc (print_version): Update copyright year to 2013.
1228
1229 2012-12-20  Ian Lance Taylor  <iant@google.com>
1230
1231         * layout.cc (Layout::special_ordering_of_input_section): New
1232         function.
1233         (Layout::layout): If input section requires special ordering, must
1234         sort input sections.
1235         (Layout::make_output_section): May sort .text input sections.
1236         (Layout::is_section_name_prefix_grouped): Remove.
1237         * layout.h (class Layout): Declare
1238         special_ordering_of_input_section.  Don't declare
1239         is_section_name_prefix_grouped.
1240         * output.cc (Output_section::add_input_section): Revert last
1241         change.
1242         (Output_section::Input_section_sort::match_file_name): Don't crash
1243         if called on output section data.
1244         (Output_section::Input_section_sort_compare): Sort based on
1245         special ordering.
1246         (Output_section::Input_section_sort_section_order_index_compare):
1247         Revert last patch.
1248         (Output_section::sort_attached_input_sections): Likewise.
1249
1250 2012-12-18  Sriraman Tallam  <tmsriram@google.com>
1251
1252         * layout.cc (Layout::is_section_name_prefix_grouped): New function.
1253         * layout.h (Layout::is_section_name_prefix_grouped): New function.
1254         * output.cc (Output_section::add_input_section): Check if section
1255         name contains special prefix.  Keep input sections to sort such
1256         sections.
1257         (Output_section::Input_section_sort_section_order_index_compare
1258          ::operator()): Group sections according to prefixes.
1259         (Output_section::sort_attached_input_sections): Add condition to
1260         Input_section_entry constructor call.
1261         * testsuite/Makefile.am (text_section_grouping): New test.
1262         * testsuite/Makefile.in: Regenerate.
1263         * testsuite/text_section_grouping.cc: New file.
1264         * testsuite/text_section_grouping.sh: New file.
1265
1266 2012-12-17  Nick Clifton  <nickc@redhat.com>
1267
1268         * Makefile.am: Add copyright notice.
1269         * NEWS: Likewise.
1270         * README: Likewise.
1271         * configure.ac: Likewise.
1272         * ftruncate.c: Likewise.
1273         * Makefile.in: Regenerate.
1274
1275 2012-12-14  Cary Coutant  <ccoutant@google.com>
1276
1277         * testsuite/Makefile.am (exception_separate_shared_12_test): Add
1278         --no-as-needed flag.
1279         (exception_separate_shared_12_test): Likewise.
1280         (incremental_copy_test): Likewise.
1281         * testsuite/Makefile.in: Regenerate.
1282
1283 2012-12-14  Cary Coutant  <ccoutant@google.com>
1284
1285         * dwp.cc (Dwp_output_file::add_cu_set): Check for duplicate CUs.
1286         (Dwp_output_file::Dwp_index::enter_set): Add assert.
1287
1288 2012-12-12  Alan Modra  <amodra@gmail.com>
1289
1290         * powerpc.cc (class Track_tls): New.
1291         (class Relocate, class Scan): Inherit Track_tls.
1292         (Target_powerpc::Scan::local, global): Track tls optimization
1293         and avoid creating plt entry for __tls_get_addr if all uses
1294         are optimized away.
1295         (Target_powerpc::Relocate::relocate): Update to use Track_tls.
1296
1297 2012-12-12  Alan Modra  <amodra@gmail.com>
1298
1299         * options.h (General_options): Add --toc-sort/--no-toc-sort.
1300         Replace no_toc_optimize with toc_optimize.
1301         * output.h (Output_section::input_sections): Provide non-const variant.
1302         * powerpc.cc (Powerpc_relobj::has_small_toc_reloc_,
1303         set_has_small_toc_reloc, has_small_toc_reloc): New variable and
1304         accessors.
1305         (Target_powerpc::Scan::local, global): Call set_has_small_toc_reloc.
1306         (class Sort_toc_sections): New.
1307         (Target_powerpc::do_finalize_sections): Sort toc sections.
1308         (Target_powerpc::Relocate::relocate): Update toc_optimize test.
1309
1310 2012-12-10  Roland McGrath  <mcgrathr@google.com>
1311
1312         * testsuite/binary_unittest.cc (read_all): New function.
1313         (Sized_binary_test): Use it instead of ::read.
1314         * fileread.cc (do_read): Don't assume pread always reads the whole
1315         amount in a single call.
1316
1317 2012-12-10  Alan Modra  <amodra@gmail.com>
1318
1319         * powerpc.cc (Target_selector_powerpc::Target_selector_powerpc):
1320         Set EM_PPC64 or EM_PPC here.
1321         (Target_selector_powerpc::do_recognize): Delete.
1322
1323 2012-12-10  Alan Modra  <amodra@gmail.com>
1324
1325         * powerpc.cc (Powerpc_relobj::Powerpc_relobj): Init has14_ and
1326         stub_table_.
1327         (Target_powerpc::Branch_info::make_stub): Don't omit addend.
1328
1329 2012-12-07  Roland McGrath  <mcgrathr@google.com>
1330
1331         * testsuite/binary_unittest.cc (Sized_binary_test):
1332         Use open_descriptor rather than ::open.
1333
1334 2012-12-07  Alan Modra  <amodra@gmail.com>
1335
1336         * powerpc.cc (Stub_table::do_write): Delete redundant Address
1337         typedef and invalid_address constant.
1338         (Output_data_glink, Stub_table, Target_powerpc): Explicitly
1339         instantiate constants.
1340
1341 2012-12-06  Roland McGrath  <mcgrathr@google.com>
1342
1343         * configure.ac (HAVE_ZLIB): Use AM_ZLIB instead of AC_SEARCH_LIBS.
1344         Use $ac_cv_header_zlib_h = yes as the condition in AM_CONDITIONAL.
1345         * aclocal.m4: Regenerate.
1346         * configure: Regenerate.
1347         * Makefile.in: Regenerate.
1348         * testsuite/Makefile.in: Regenerate.
1349
1350 2012-12-07  Alan Modra  <amodra@gmail.com>
1351
1352         * options.h (General_options): Add no_toc_optimize.
1353         * powerpc.cc (ok_lo_toc_insn): New function.
1354         (Target_powerpc::Relocate::relocate): Optimize toc access sequences.
1355
1356 2012-12-06  Alan Modra  <amodra@gmail.com>
1357
1358         * options.h (General_options): Add plt_align, plt_static_chain,
1359         plt_thread_safe.  Update stub_group_size help text.
1360         * powerpc.cc (Target_powerpc::plt_thread_safe): New access function
1361         for new plt_thread_safe_ var.
1362         (use_plt_offset): Correct comments.
1363         (Target_powerpc::do_relax): Look for thread creation symbols to
1364         determine default plt_thread_safe value.  Clear plt call stubs
1365         as well as branch stubs each iteration.
1366         (add_2_2_11, add_12_12_11, bnectr_p4, cmpldi_2_0, xor_11_11_11): New
1367         insn constants.
1368         (l, hi, ha, write_insn): Move earlier.
1369         (Stub_table): Delete prev_size, add last_plt_size and last_branch_size.
1370         (Stub_table::clear_stubs): Rename from clear_long_branch_stubs, clear
1371         plt stubs too.
1372         (Stub_table::update_size): Adjust.
1373         (Stub_table::prev_size, set_prev_size): Delete.
1374         (Stub_table::stub_align): Let --plt-align affect result.
1375         (Stub_table::plt_call_size): Calculate sizes for various stubs.
1376         (Stub_table::branch_stub_size): Use last_plt_size in address calc.
1377         (Stub_table::add_plt_call_stub): Pass iterator to plt_call_size.
1378         (Stub_table::do_write): Support more stub variants.
1379
1380 2012-12-04  Alan Modra  <amodra@gmail.com>
1381
1382         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Delete.
1383         (Target_powerpc::do_define_standard_symbols): New function.
1384
1385 2012-12-03  Alan Modra  <amodra@gmail.com>
1386
1387         * output.h: Formatting, whitespace.
1388
1389 2012-12-03  Alan Modra  <amodra@gmail.com>
1390
1391         * layout.h (Layout::get_executable_sections): Declare.
1392         * layout.cc (Layout::get_executable_sections): New function.
1393         * arm.cc (Target_arm::group_sections): Use it.
1394         (Arm_output_section::group_sections): Delete now redundant test.
1395         * output.cc (Output_reloc::Output_reloc): Add is_relative.
1396         param to handle relative relocs.
1397         * output.h (Output_reloc::Output_reloc <absolute reloc>): Likewise.
1398         (Output_data_reloc::add_absolute): Adjust.
1399         (Output_data_reloc::add_relative): New function.
1400         (Output_data::reset_data_size): New function.
1401         (Output_relaxed_input_section::set_relobj, set_shndx): New functions.
1402         (Output_section::set_addralign): New function.
1403         (Output_section::checkpoint_set_addralign): New function.
1404         (Output_section::clear_section_offsets_need_adjustment): New function.
1405         (Output_section::input_sections): Make public.
1406         * powerpc.cc (class Output_data_brlt_powerpc): New.
1407         (class Stub_table, class Stub_control): New.
1408         (Powerpc_relobj::has14_, set_has_14bit_branch, has_14bit_branch,
1409         stub_table_, set_stub_table, stub_table): New vectors and accessor
1410         functions.
1411         (Target_powerpc::do_may_relax, do_relax, push_branch,
1412         new_stub_table, stub_tables, brlt_section, group_sections,
1413         add_branch_lookup_table, find_branch_lookup_table,
1414         write_branch_lookup_table, make_brlt_section): New functions.
1415         (Target_powerpc::struct Sort_sections, class Branch_info): New.
1416         (Target_powerpc::brlt_section_, stub_tables_, branch_lookup_table_,
1417         branch_info_): New vars.
1418         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Don't
1419         make call stubs here.
1420         (Output_data_glink): Remove all call stub handling from this class.
1421         (Target_powerpc::Scan::local, global): Save interesting branch
1422         relocs and relocs for ifunc.  Adjust calls to plt entry functions.
1423         (Target_powerpc::do_finalize_sections): Only make reg save/restore
1424         functions on final link.
1425         (Target_powerpc::Relocate::relocate): Adjust lookup of call stubs.
1426         Handle long branch destinations too.
1427         (Target_powerpc::do_dynsym_value, do_plt_address_for_global,
1428         do_plt_address_for_local): Adjust lookup of plt call stubs.
1429
1430 2012-11-30  Alan Modra  <amodra@gmail.com>
1431
1432         * powerpc.c (Target_powerpc::Scan::global): Don't emit relative
1433         relocs against protected symbols when building 32-bit shared libs.
1434
1435 2012-11-30  Alan Modra  <amodra@gmail.com>
1436
1437         * powerpc.cc (Target_powerpc::make_plt_section): Add symtab
1438         param.  Call got_section() to make .got.  Update all callers
1439         and their callers and so on.
1440
1441 2012-11-30  Alan Modra  <amodra@gmail.com>
1442
1443         * powerpc.cc (Powerpc_relobj::do_scan_relocs): Make STB_LOCAL
1444         _GLOBAL_OFFSET_TABLE_ rather than STB_WEAK.
1445         (Output_data_got_powerpc::make_header): Update _GLOBAL_OFFSET_TABLE_
1446         value if it already exists.
1447
1448 2012-11-19  H.J. Lu  <hongjiu.lu@intel.com>
1449
1450         PR gold/14858
1451         * x86_64.cc (Relocate::tls_ld_to_le): Support x32.
1452
1453 2012-11-14  Roland McGrath  <mcgrathr@google.com>
1454
1455         * arm.cc (Output_data_plt_arm_nacl::first_plt_entry): Use bic rather
1456         than bfc instruction for data sandboxing.
1457
1458 2012-11-08  Alan Modra  <amodra@gmail.com>
1459
1460         * po/POTFILES.in: Regenerate.
1461
1462 2012-11-05  Alan Modra  <amodra@gmail.com>
1463
1464         * configure.ac: Apply 2012-09-10 change to config.in here.
1465         * configure: Regenerate.
1466
1467 2012-11-05  Alan Modra  <amodra@gmail.com>
1468
1469         * powerpc.cc (Powerpc_relobj): Delete "Offset" typedef.
1470         (struct Opd_ent): Use "Address" rather than "Offset".
1471         (Output_data_got_powerpc::got_base_offset): Return Valtype.
1472         (Target_powerpc::got_section): Make public.
1473         (Target_powerpc::scan_relocs): Move code setting symbols..
1474         (Powerpc_relobj::do_scan_relocs): ..to here, new function.
1475         Create _SDA_BASE_ only when referenced.
1476
1477 2012-11-02  Roland McGrath  <mcgrathr@google.com>
1478
1479         * i386.cc (Target_i386::relocate_relocs): Remove extraneous typename
1480         from last change.
1481
1482 2012-11-01  Roland McGrath  <mcgrathr@google.com>
1483
1484         * target.h (Sized_target::relocate_relocs): Use Elf_Off
1485         for offset_in_output_section parameter.
1486         (Sized_target::relocate_special_relocatable): Likewise.
1487         * arm.cc (Target_arm::relocate_relocs): Likewise.
1488         (Target_arm::relocate_special_relocatable): Likewise.
1489         * i386.cc (Target_i386::relocate_relocs): Likewise.
1490         * powerpc.cc (Target_powerpc::relocate_relocs): Likewise.
1491         * sparc.cc (Target_sparc::relocate_relocs): Likewise.
1492         * target-reloc.h (relocate_relocs): Likewise.
1493         * testsuite/testfile.cc (Target_test): Likewise.
1494         * tilegx.cc (Target_tilegx::relocate_relocs): Likewise.
1495         * x86_64.cc (Target_x86_64::relocate_relocs): Likewise.
1496
1497         * system.h: Move inclusion of <clocale> to after <libintl.h> in
1498         [ENABLE_NLS] section, and separately at top of [!ENABLE_NLS] section.
1499
1500         * descriptors.cc (set_close_on_exec): Add ATTRIBUTE_UNUSED to the
1501         parameter, which is unused in the [!F_SETFD] case.
1502
1503         * dwarf_reader.cc (Sized_elf_reloc_mapper::symbol_section): Cast
1504         SYMNDX to off_t before comparing it to this->data_size().
1505         * output.cc (Output_symtab_xindex::endian_do_write): Likewise.
1506         * incremental.cc (Output_section_incremental_inputs::do_write):
1507         Cast GLOBAL_SYM_COUNT to off_t before comparing it to SYMTAB_SIZE.
1508
1509         * nacl.cc: Include "libiberty.h" for vasprintf declaration.
1510
1511 2012-10-30  Steve McIntyre  <steve.mcintyre@linaro.org>
1512
1513         * gold.cc (Target_arm::do_adjust_elf_header): Add the
1514         hard-float/soft-float ABI flag as appropriate for ET_DYN/ET_EXEC
1515         in EABI_VER5.
1516
1517 2012-10-29  Cary Coutant  <ccoutant@google.com>
1518
1519         * dwp.cc (usage): Add file and exit status parameters;
1520         add --help and --version options.
1521         (print_version): New function.
1522         (main): Add --help and --version options.
1523
1524 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1525
1526         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add
1527         final_layout_sequence.txt.
1528         * testsuite/Makefile.in: Regenerated.
1529
1530 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1531
1532         * testsuite/Makefile.am (COMPILE1): New variable. Renamed from
1533         COMPILE generated by automake.
1534         (LINK1): Likewise.
1535         (CXXCOMPILE1): Likewise.
1536         (CXXLINK1): Likewise.
1537         (COMPILE): Strip out -Wp,-D_FORTIFY_SOURCE= from COMPILE1.
1538         (LINK): Likewise.
1539         (CXXCOMPILE): Likewise.
1540         (CXXLINK): Likewise.
1541         * testsuite/Makefile.in: Regenerated.
1542
1543 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1544
1545         * dwp.cc (Dwo_file::record_target_info): Issue a fatal error
1546         on bad fwrite return.
1547
1548 2012-10-25  H.J. Lu  <hongjiu.lu@intel.com>
1549
1550         * dwp.cc (Dwo_file::remap_str_offset): Use section_offset_type
1551         on val.
1552
1553 2012-10-23  Cary Coutant  <ccoutant@google.com>
1554
1555         * testsuite/Makefile.am (TEST_OBJCOPY): New macro.
1556         * testsuite/Makefile.in: Regenerate.
1557         * testsuite/dwp_test.h: New source file.
1558         * testsuite/dwp_test_1.cc: New source file.
1559         * testsuite/dwp_test_1.s: New source file.
1560         * testsuite/dwp_test_1.sh: New source file.
1561         * testsuite/dwp_test_1b.cc: New source file.
1562         * testsuite/dwp_test_1b.s: New source file.
1563         * testsuite/dwp_test_2.cc: New source file.
1564         * testsuite/dwp_test_2.s: New source file.
1565         * testsuite/dwp_test_2.sh: New source file.
1566         * testsuite/dwp_test_main.cc: New source file.
1567         * testsuite/dwp_test_main.s: New source file.
1568
1569 2012-10-23  Cary Coutant  <ccoutant@google.com>
1570
1571         * dwp.h: New header file.
1572         * dwp.cc: New source file.
1573         * gold.h: Move shared declarations to system.h.
1574         * system.h: New header file.
1575         * Makefile.am: Add dwp.
1576         * Makefile.in: Regenerate.
1577
1578 2012-10-23  Cary Coutant  <ccoutant@google.com>
1579
1580         * dwarf_reader.cc (Dwarf_ranges_table::read_range_list): Call
1581         Dwarf_info_reader::read_from_pointer.
1582         (Dwarf_pubnames_table::read_header): Likewise.
1583         (Dwarf_pubnames_table::next_name): Likewise.
1584         (Dwarf_die::read_attributes): Likewise.
1585         (Dwarf_die::skip_attributes): Likewise.
1586         (Dwarf_info_reader::read_from_pointer): New function template.
1587         * dwarf_reader.h (Dwarf_ranges_table): Add dwinfo_.
1588         (Dwarf_pubnames_table): Likewise.
1589         (Dwarf_info_reader::read_from_pointer): New function template.
1590         * gdb-index.cc (Gdb_index_info_reader): Adjust call to
1591         Dwarf_pubnames_table ctor.
1592
1593 2012-10-23  Cary Coutant  <ccoutant@google.com>
1594
1595         * dwarf_reader.cc (Dwarf_info_reader::do_parse): Use stored
1596         abbrev_shndx.
1597         * dwarf_reader.h (Dwarf_info_reader::Dwarf_info_reader): Initialize
1598         abbrev_shndx_.
1599         (Dwarf_info_reader::set_abbrev_shndx): New method.
1600         (Dwarf_info_reader::abbrev_shndx_): New data member.
1601
1602 2012-10-23  Cary Coutant  <ccoutant@google.com>
1603
1604         * dwarf_reader.cc (make_elf_reloc_mapper): Check size and endianness
1605         from object, not parameters.
1606         (Dwarf_info_reader::parse): Likewise.
1607         * object.h (Relobj::elfsize, Relobj::is_big_endian): New methods.
1608         (Relobj::do_elfsize, Relobj::do_is_big_endian): New methods.
1609         (Sized_relobj::do_elfsize, Sized_relobj::do_is_big_endian): New
1610         methods.
1611
1612 2012-10-23  Cary Coutant  <ccoutant@google.com>
1613
1614         * fileread.cc (Input_file::Input_file): New constructor.
1615         * fileread.h (class Input_file): Add new constructor.
1616
1617 2012-10-18  Alan Modra  <amodra@gmail.com>
1618
1619         PR gold/14727
1620         * object.cc (Relobj::is_section_name_included): Also match
1621         .sdata personality section.
1622
1623 2012-10-18  Alan Modra  <amodra@gmail.com>
1624
1625         * target-reloc.h (class Default_comdat_behavior): New, package up..
1626         (get_comdat_behaviour): ..this.
1627         (relocate_section): Add Relocate_comdat_behavior template arg,
1628         adjust code to suit.
1629         * arm.cc (Target_arm::relocate_section): Adjust to suit.
1630         (Target_arm::scan_reloc_section): Likewise.
1631         * i386.cc (Target_i386::relocate_section): Likewise.
1632         * sparc.cc (Target_sparc::relocate_section): Likewise.
1633         * tilegx.cc (Target_tilegx::relocate_section): Likewise.
1634         * x86_64.cc (Target_x86_64::relocate_section): Likewise.
1635         * powerpc.cc (class Relocate_comdat_behavior): New.
1636         (Target_powerpc::relocate_section): Don't zap opd relocs.  Supply
1637         gold::relocate_section with new template arg.
1638
1639 2012-10-18  Alan Modra  <amodra@gmail.com>
1640
1641         * powerpc.cc (Target_powerpc::Scan::local, global): Always emit
1642         dynamic relocs for GOT_TPREL got entries, without symbol if
1643         resolving locally.
1644         (Target_powerpc::do_gc_add_reference): Don't add for dynamic objects.
1645         (Target_powerpc::scan_relocs): Define _GLOBAL_OFFSET_TABLE_ early.
1646         (Target_powerpc::Relocate:relocate): REL32 reloc may be unaligned.
1647
1648 2012-10-17  Alan Modra  <amodra@gmail.com>
1649
1650         PR gold/14726
1651         * gold.cc (queue_middle_tasks): Call gc_mark_symbol on _init and _fini.
1652
1653 2012-10-16  Sriraman Tallam  <tmsriram@google.com>
1654
1655         * layout.cc (Layout::include_section): Keep sections marked
1656         SHF_EXCLUDE when doing relocatable links.
1657
1658 2012-10-16  Alan Modra  <amodra@gmail.com>
1659
1660         * powerpc.cc (Target_powerpc::define_save_restore_funcs): New func.
1661         (Target_powerpc::do_finalize_sections): Call it.
1662         (Output_data_save_res): New class and supporting functions.
1663         (Target_powerpc::symval_for_branch): Only look up .opd entry for
1664         normal symbols defined in object files.
1665
1666 2012-10-12  Alan Modra  <amodra@gmail.com>
1667
1668         * powerpc.cc (Powerpc_relobj::add_gc_mark, process_gc_mark): New.
1669         (struct Opd_ent): Make "discard" a bit field.  Add "gc_mark".
1670         (Target_powerpc::do_gc_mark_symbol): Delay marking function code
1671         section if scan_opd_relocs not yet called.
1672         (Target_powerpc::gc_process_relocs): Call process_gc_mark.
1673
1674 2012-10-12  Alan Modra  <amodra@gmail.com>
1675
1676         * powerpc.cc (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1677         add_local_ifunc_entry): Revert last change.
1678         (Target_powerpc::make_plt_entry, make_local_ifunc_plt_entry): Likewise.
1679
1680 2012-10-05  Alan Modra  <amodra@gmail.com>
1681
1682         * powerpc.cc (Target_powerpc::do_plt_address_for_local,
1683         do_plt_address_for_global): New functions.
1684         (Output_data_got_powerpc::do_write): Don't segfault when linking
1685         statically.
1686         (Output_data_plt_powerpc::add_entry, add_ifunc_entry,
1687         add_local_ifunc_entry): Return true on adding entry..
1688         (Target_powerpc::make_plt_entry): ..use to avoid unnecessary
1689         glink->add_entry call.  Remove unused symtab param.  Adjust calls.
1690         (Target_powerpc::make_local_ifunc_plt_entry): Likewise.
1691         (Target_powerpc::make_iplt_section): Remove symtab param.  Don't
1692         set up symbols here.
1693         (Target_powerpc::do_finalize_sections): Instead set up __rela_iplt
1694         syms here.  Do so even when no .iplt.  Don't segfault when linking
1695         statically.
1696         (Output_data_glink::add_entry, find_entry): Rearrange params.  Add
1697         new variants without reloc param.
1698         (Glink_sym_ent::Glink_sym_ent): Likewise.
1699         (Target_powerpc::Scan::reloc_needs_plt_for_ifunc): Accept any
1700         reloc when refs will resolve to plt call stub.
1701         (Target_powerpc::Scan::local): Correct ifunc handling.  Allow
1702         R_PPC_PLTREL24 to resolve locally.
1703         (Target_powerpc::Scan::global): Correct ifunc handling.
1704         (Target_powerpc::Relocate::relocate): Correct local sym glink
1705         lookup.  Don't destroy "value" when we have a plt call stub,
1706         and when checking plt call validity.
1707         (Target_powerpc::do_dynsym_value): Simplify.
1708
1709 2012-10-05  Alan Modra  <amodra@gmail.com>
1710
1711         * i386.cc (Output_data_plt_i386::address_for_global,
1712         address_for_local): Add plt offset to returned value.  Adjust uses.
1713         * sparc.cc (Output_data_plt_sparc::address_for_global,
1714         address_for_local): Likewise.
1715         * tilegx.cc (Output_data_plt_tilegx::address_for_global,
1716         address_for_local): Likewise.
1717         * x86_64.cc (Output_data_plt_x86_64::address_for_global,
1718         address_for_local): Likewise.
1719         * target.h (Target::plt_address_for_global, plt_address_for_local):
1720         Update comment.
1721         * output.cc (Output_reloc::symbol_value): Don't add plt offset here.
1722         (Output_data_got::Got_entry::write): Nor here.
1723         * output.h: Comment fix.
1724
1725 2012-10-02  Jiong Wang  <jiwang@tilera.com>
1726
1727         * tilegx.cc (Target_tilegx::do_finalize_sections): Adjust
1728         global_offset_table_ value for larget got.
1729         (Target_tilegx::Relocate::relocate): Handle adjusted got value.
1730
1731 2012-09-29  Alan Modra  <amodra@gmail.com>
1732
1733         * powerpc.cc (Target_powerpc::iplt_): New output section.
1734         (Target_powerpc::iplt_section, make_iplt_section,
1735         reloc_needs_plt_for_ifunc, make_local_ifunc_plt_entry): New functions.
1736         (Target_powerpc::make_plt_entry): Handle ifunc syms.
1737         Target_powerpc::plt_entry_count): Count iplt entries too.
1738         (Output_data_plt_powerpc::Output_data_plt_powerpc): Don't create
1739         reloc section in constructor.  New params.
1740         (Target_powerpc::make_plt_section): Create reloc section here instead.
1741         (Output_data_plt_powerpc::add_ifunc_entry, add_local_ifunc_entry): New
1742         functions.
1743         (Output_data_plt_powerpc::initial_plt_entry_size_, name_): New vars.
1744         (Output_data_glink::add_entry, find_entry): New functions to
1745         deal with local syms.
1746         (Glink_sym_ent): Add support for local syms.
1747         (Output_data_glink::do_write): Handle ifunc plt entries.
1748         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1749         (Target_powerpc::Scan::local, global): Handle ifunc syms.
1750         (Target_powerpc::Relocate::relocate): Likewise.
1751         (Target_powerpc::do_dynsym_value): Use glink stub, not plt entry.
1752
1753 2012-09-25  Alan Modra  <amodra@gmail.com>
1754
1755         * object.h (Sized_relobj_file::adjust_local_symbol,
1756         do_adjust_local_symbol): New functions.
1757         * object.cc (Sized_relobj_file::do_count_local_symbols): Use the above.
1758         * powerpc.cc (Powerpc_relobj::do_adjust_local_symbol): New function.
1759         (Powerpc_relobj::scan_opd_relocs): Warn on unexpected opd relocs
1760         and irregular opd entry spacing.
1761         (Powerpc_relobj::do_read_relocs): Add opd size checks.
1762         (Global_symbol_visitor_opd): New functor.
1763         (Target_powerpc::do_finalize_sections): Omit global symbols defined
1764         on deleted opd entries.
1765
1766 2012-09-15  Jiong Wang  <jiwang@tilera.com>
1767
1768         * tilegx.cc: New file.
1769         * Makefile.am (TARGETSOURCES): Add tilegx.cc
1770         (ALL_TARGETOBJS): Add tilegx.$(OBJEXT)
1771         * configure.tgt: Add entries for tilegx*.
1772         * configure.ac: Likewise.
1773         * Makefile.in: Rebuild.
1774         * configure: Likewise.
1775         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Handle
1776         tilegx.
1777
1778 2012-09-13  Alan Modra  <amodra@gmail.com>
1779
1780         * target-reloc.h (scan_relocs): Call scan.local for relocs
1781         against symbols in discarded sections.  Pass is_discarded
1782         param.
1783         * arm.cc, * i386.cc, * sparc.cc, * x86_64.cc (Target_*::Scan::local):
1784         Add is_discarded param.
1785         * powerpc (Target_powerpc::Scan::local): Likewise.  Use
1786         is_discarded to flag opd entry as discarded.  Don't emit dyn
1787         relocs on such entries.
1788         (Target_powerpc::Scan::global): Similarly detect and handle
1789         such opd entries.
1790         (Powerpc_relobj): Replace opd_ent_shndx_ and opd_ent_off_ with
1791         opd_ent_.  Update all uses.
1792         (Powerpc_relobj::get_opd_discard, set_opd_discard): New functions.
1793         (Target_powerpc::relocate_section): Zero out discarded opd
1794         entry relocs.
1795
1796 2012-09-12  Ian Lance Taylor  <iant@google.com>
1797
1798         PR gold/14570
1799         * output.cc: Rename Output_data_got template parameter from size
1800         to got_size for all functions.  Compile all variants of
1801         Output_data_got.
1802         (Output_data_got::Got_entry::write): Correct use of size for
1803         symbol value.  Use local_is_tls rather than casting to
1804         Sized_relobj_file.
1805         * object.h (class Object): Add local_is_tls and do_local_is_tls.
1806         (class Sized_relobj_file): Add do_local_is_tls.
1807         * incremental.h (class Sized_relobj_incr): Add do_local_is_tls.
1808
1809 2012-09-11  Alan Modra  <amodra@gmail.com>
1810
1811         PR gold/14566
1812         * layout.cc (Layout::set_segment_offsets): When using
1813         common-page-size alignment, ensure we are on a new max-page-size
1814         page.
1815         * output.cc (Output_segment::set_section_addresses): Use
1816         abi_pagesize, not common_pagesize for relro boundary.
1817         (Output_segment::set_offset): Likewise.
1818
1819 2012-09-11  Alan Modra  <amodra@gmail.com>
1820
1821         * output.h (Output_data_got::add_global_tls, add_local_tls,
1822         add_local_tls_pair): New functions.
1823         (Output_data_got::add_local_pair_with_rel): Remove second
1824         reloc param.  Expand comment.
1825         (Output_data_got::Got_entry): Rename use_plt_offset_ to
1826         use_plt_or_tls_offset_, similarly for constructor param.
1827         (Output_data_got::Got_entry::write): Add got_index param.
1828         * output.cc (Output_data_got::add_global_tls, add_local_tls,
1829         add_local_tls_pair): New functions.
1830         (Output_data_got::Got_entry::write): Handle tls symbols
1831         with use_plt_or_tls_offset_ set specially.
1832         (Output_data_got::add_local_pair_with_rel): Only one reloc.
1833         (Output_data_got::do_write): Replace iterator with index, pass
1834         index to entry write function.
1835         * target.h (Target::tls_offset_for_local, tls_offset_for_global,
1836         do_tls_offset_for_local, do_tls_offset_for_global): New functions.
1837         * arm.cc (Target_arm::Scan::local): Update add_local_pair_with_rel
1838         call.
1839         * i386.cc (Target_i386::Scan::local): Likewise.
1840         * sparc.cc (Target_sparc::Scan::local): Likewise.
1841         * x86_64.cc (Target_x86_64::Scan::local): Likewise.
1842         * powerpc.cc (Target_powerpc::do_tls_offset_for_local,
1843         do_tls_offset_for_global): New functions.
1844         (Target_powerpc::Scan::local): Correct TLS relocations and got
1845         entry values.
1846         (Target_powerpc::Scan::global): Don't emit unnecessary
1847         dynamic relocations on TLS GOT entries.
1848
1849 2012-09-10  Matthias Klose  <doko@ubuntu.com>
1850
1851         * config.in: Disable sanity check for kfreebsd.
1852
1853 2012-09-10  Sterling Augustine  <saugustine@google.com>
1854
1855         * gdb-index.cc (Gdb_index::pubnames_read): New parameter.
1856         (Gdb_index::pubtypes_read): New parameter.
1857         (Gdb_index_info_reader::read_pubnames_and_pubtypes): Add parameters
1858         to calls.
1859         * gdb-index.h (Gdb_index): New fields pubnames_object_ and
1860         pubtypes_object_.
1861
1862 2012-09-09  Alan Modra  <amodra@gmail.com>
1863
1864         * target.h (Target::gc_mark_symbol, do_gc_mark_symbol): New functions.
1865         (Sized_target::gc_add_reference, do_gc_add_reference): New functions.
1866         * gc.h (gc_process_relocs): Call target gc_add_reference.
1867         * gold.cc (queue_middle_tasks): Use gc_mark_symbol on start sym.
1868         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Use gc_mark_symbol.
1869         (Symbol_table::gc_mark_symbol): Call target gc_mark_symbol. Remove
1870         unnecessary cast.
1871         * powerpc.cc (Powerpc_relobj::get_opd_ent): Rearrange parameters
1872         to cater for when we don't need code offset.  Update use.
1873         (Powerpc_relobj::access_from_map_, opd_valid_): New vars.
1874         (Powerpc_relobj::access_from_map, add_reference, opd_valid,
1875         set_opd_valid): New functions.
1876         (Target_powerpc::do_gc_add_reference): New function.
1877         (Target_powerpc::gc_process_relocs): Call gc()->add_reference on
1878         stashed refs.
1879         (Target_powerpc::do_gc_mark_symbol): New function.
1880
1881 2012-09-06  Cary Coutant  <ccoutant@google.com>
1882
1883         * dwarf_reader.cc (Dwarf_die::read_attributes): Add
1884         DW_FORM_GNU_addr_index and DW_FORM_GNU_str_index.
1885         (Dwarf_die::skip_attributes): Likewise.
1886         * object.cc (Read_symbols_data::~Read_symbols_data): Update comment.
1887         * testsuite/gdb_index_test.cc (inline_func_1): New function.
1888         (main): Call it.
1889         * testsuite/gdb_index_test_comm.sh: Check index for inline function.
1890
1891 2012-09-05  H.J. Lu  <hongjiu.lu@intel.com>
1892
1893         * testsuite/script_test_3.t: Add .got.plt output section
1894         statement.
1895         * testsuite/script_test_4.t: Likewise.
1896
1897 2012-09-05  Alan Modra  <amodra@gmail.com>
1898
1899         * powerpc.cc (Powerpc_relocate_functions): Upcase enum values,
1900         update all uses and lose "enum" when using type.
1901
1902 2012-09-05  Alan Modra  <amodra@gmail.com>
1903
1904         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): False for powerpc.
1905         * configure: Regenerate.
1906         * testsuite/Makefile.am (final_layout.stdout): Pass --synthetic to nm.
1907         (plugin_final_layout.stdout): Likewise.
1908         (memory_test): Set page sizes to 0x1000.
1909         * testsuite/Makefile.in: Regenerate.
1910         * testsuite/discard_locals_test.sh: Add FIXME comment.
1911         * testsuite/justsyms_exec.c: Disable function test for powerpc64.
1912         * testsuite/pr14265.t: Add .got output section statement.
1913         * testsuite/script_test_2.t: Likewise.
1914         * testsuite/script_test_3.t: Likewise.
1915         * testsuite/script_test_4.t: Likewise.
1916         * testsuite/script_test_5.t: Likewise.
1917         * testsuite/script_test_6.t: Likewise.
1918         * testsuite/script_test_7.t: Likewise.
1919         * testsuite/script_test_9.t: Likewise.
1920
1921 2012-09-05  Alan Modra  <amodra@gmail.com>
1922
1923         * powerpc.cc (Powerpc_relobj::get_opd_ent): Make const.
1924         (Powerpc_relocate_functions::Status): New typedef.
1925         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1926         (Target_powerpc::Scan::local): Handle REL64.
1927         (Target_powerpc::Scan::global): Likewise, and dynamic relocs
1928         for REL32 and REL64.
1929         (Target_powerpc::symval_for_branch): New function, extracted from..
1930         (Target_powerpc::Relocate::relocate): ..here.  Correct plt call
1931         checks.  Report overflow errors.
1932
1933 2012-09-05  Alan Modra  <amodra@gmail.com>
1934
1935         * object.h (Sized_relobj_file::emit_relocs): Delete.
1936         (Sized_relobj_file::emit_relocs_reltype): Delete.
1937         * reloc.cc (Sized_relobj_file::do_relocate_sections): Call target
1938         relocate_relocs for --emit-relocs.
1939         (Sized_relobj_file::emit_relocs, emit_relocs_reltype): Delete.
1940         * output.h: Update comment.
1941         (Output_segment::first_section): New function.
1942         (Output_segment::first_section_load_address): Use first_section.
1943         * output.cc (Output_segment::first_section): New function extracted..
1944         (Output_segment::first_section_load_address): ..from here.  Delete.
1945         * target-reloc.h (relocate_for_relocatable): Rename to relocate_relocs.
1946         * target.h (Sized_target::relocate_for_relocatable): Likewise.
1947         * arm.cc (Target_arm::relocate_for_relocatable): Likewise, and
1948         adjust call to target.h function.
1949         * i386.cc (Target_i386): Likewise.
1950         * sparc.cc (Target_sparc): Likewise.
1951         * x86_64.cc (Target_x86_64): Likewise.
1952         * powerpc.cc (Target_powerpc): Likewise.
1953         (Target_powerpc::Scan::local, global): Handle R_POWERPC_TLS.  Ensure
1954         first tls section has section symbol for optimised local dynamic
1955         output relocs.
1956         (Target_powerpc::Relocate::relocate): Correct local dynamic value.
1957         (Target_powerpc::relocate_relocs): Adjust relocs emitted for
1958         optimised tls code.
1959         * testsuite/testfile.cc (Target_test::relocate_for_relocatable):
1960         Rename to relocate_relocs.  Update error message.
1961
1962 2012-09-04  Andreas Schwab  <schwab@linux-m68k.org>
1963
1964         * powerpc.cc (do_make_elf_object): Allow ET_EXEC files with
1965         --just-symbols.
1966
1967 2012-08-31  Alan Modra  <amodra@gmail.com>
1968
1969         * powerpc.cc (Powerpc_relobj): Add and use Address typedef.
1970         (Powerpc_relobj::toc_base_offset): New stub function.
1971         (Target_powerpc): Add tp_offset, dtp_offset.  Rename
1972         got_mod_index_offset to tlsld_got_offset.  Update all refs.
1973         (Target_powerpc::Relocate::enum skip_tls): New.
1974         (Target_powerpc::call_tls_get_addr_): New var.
1975         (Target_powerpc::is_branch_reloc): Move to file scope.
1976         (Target_powerpc::relocate_tls, optimize_tls_reloc): Delete.
1977         (Target_powerpc::optimize_tls_gd, optimize_tls_ld, optimize_tls_ie):
1978         New functions.
1979         (Target_powerpc::enum Got_type): Delete old values, add new ones.
1980         (powerpc_info): Correct common_pagesize for ppc64.
1981         (at_tls_transform, needs_dynamic_reloc, use_plt_offset): New functions.
1982         (Powerpc_relocate_functions): Add overflow check enums and functions.
1983         Add non-shift version of rela, rela_ua.  Delete all rel public
1984         functions.  Delete addr16_lo.  Add addr64, addr64_u, addr32,
1985         addr32_u, addr24, addr16_u, addr16_hi2, addr16_ha2, addr16_hi3,
1986         addr16_ha3, addr14 functions.
1987         (Output_data_got_powerpc::add_constant_pair): New function.
1988         (Output_data_got_powerpc::got_base_offset): Likewise.
1989         (Output_data_got_powerpc::do_write): Correct 64-bit got header.
1990         (instruction constants): Sort, add some more.
1991         (Output_data_glink::do_write): Add and use Address typedef.  Use
1992         object->toc_base_offset() stub for 64-bit.
1993         (Target_powerpc::tlsld_got_offset): Use add_constant_pair.
1994         (Target_powerpc::Scan::get_reference_flags): Handle more relocs.
1995         (Target_powerpc::Scan::local, global): Emit relative dynamic reloc
1996         for R_PPC64_TOC.  Handle more relocs.  Generate got entries for TLS.
1997         Always treat .opd relocs as against locally defined symbol.
1998         Correct condition for RELATIVE relocs.
1999         (Target_powerpc::do_finalize_sections): Test for NULL sections.
2000         (Target_powerpc::Relocate::relocate): Use plt call stub as value
2001         for 32-bit syms with a plt entry.  Correct ppc64 toc base
2002         calculations.  Handle TLS relocs, and more.  Add overflow
2003         checking and adjust for Powerpc_relocate_functions changes.
2004         (Target_powerpc::relocate_for_relocatable): Handle zero r_sym.
2005         Reinstate --emit-relocs code with FIXME.
2006
2007 2012-08-30  Alan Modra  <amodra@gmail.com>
2008
2009         * layout.cc (Layout::set_segment_offsets): Set p_align to
2010         abi_pagesize, not common_pagesize.
2011         (Layout::relaxation_loop_body): Similarly use abi_pagesize
2012         to determine whether file header can go in segment.
2013
2014 2012-08-30  Alan Modra  <amodra@gmail.com>
2015
2016         * output.h (Output_reloc::Output_reloc <output section>): Add
2017         is_relative param.  Adjust calls.
2018         (Output_reloc::add_output_section_relative): New functions.
2019         * output.cc (Output_reloc::Output_reloc <output section>): Handle
2020         is_relative.
2021         (Output_reloc::symbol_value): Handle SECTION_CODE.
2022
2023 2012-08-24  Sriraman Tallam  <tmsriram@google.com>
2024
2025         * gold.cc (queue_middle_tasks): Call layout again when unique
2026         segments for sections is desired.
2027         * layout.cc (Layout::Layout): Initialize new members.
2028         (Layout::get_output_section_flags): New function.
2029         (Layout::choose_output_section): Call get_output_section_flags.
2030         (Layout::layout): Make output section for mapping to a unique segment.
2031         (Layout::insert_section_segment_map): New function.
2032         (Layout::attach_allocated_section_to_segment): Make unique segment for
2033         output sections marked so.
2034         (Layout::segment_precedes): Check for unique segments when sorting.
2035         * layout.h (Layout::Unique_segment_info): New struct.
2036         (Layout::Section_segment_map): New typedef.
2037         (Layout::insert_section_segment_map): New function.
2038         (Layout::get_output_section_flags): New function.
2039         (Layout::is_unique_segment_for_sections_specified): New function.
2040         (Layout::set_unique_segment_for_sections_specified): New function.
2041         (Layout::unique_segment_for_sections_specified_): New member.
2042         (Layout::section_segment_map_): New member.
2043         * object.cc (Sized_relobj_file<size, big_endian>::do_layout):
2044         Rename is_gc_pass_one to is_pass_one.
2045         Rename is_gc_pass_two to is_pass_two.
2046         Rename is_gc_or_icf to is_two_pass.
2047         Check for which pass based on whether symbols data is present.
2048         Make it two pass when unique segments for sections is desired.
2049         * output.cc (Output_section::Output_section): Initialize new
2050         members.
2051         * output.h (Output_section::is_unique_segment): New function.
2052         (Output_section::set_is_unique_segment): New function.
2053         (Output_section::is_unique_segment_): New member.
2054         (Output_section::extra_segment_flags): New function.
2055         (Output_section::set_extra_segment_flags): New function.
2056         (Output_section::extra_segment_flags_): New member.
2057         (Output_section::segment_alignment): New function.
2058         (Output_section::set_segment_alignment): New function.
2059         (Output_section::segment_alignment_): New member.
2060         (Output_segment::Output_segment): Initialize is_unique_segment_.
2061         (Output_segment::is_unique_segment): New function.
2062         (Output_segment::set_is_unique_segment): New function.
2063         (Output_segment::is_unique_segment_): New member.
2064         * plugin.cc (allow_unique_segment_for_sections): New function.
2065         (unique_segment_for_sections): New function.
2066         (Plugin::load): Add new functions to transfer vector.
2067         * Makefile.am (plugin_final_layout.readelf.stdout): Add readelf output.
2068         * Makefile.in: Regenerate.
2069         * testsuite/plugin_final_layout.sh: Check if unique segment
2070         functionality works.
2071         * testsuite/plugin_section_order.c (onload): Check if new interfaces
2072         are available.
2073         (allow_unique_segment_for_sections): New global.
2074         (unique_segment_for_sections): New global.
2075         (claim_file_hook): Call allow_unique_segment_for_sections.
2076         (all_symbols_read_hook): Call unique_segment_for_sections.
2077
2078 2012-08-22  Cary Coutant  <ccoutant@google.com>
2079
2080         * layout.cc (Layout::include_section): Don't assert on GROUP
2081         sections with --emit-relocs.
2082
2083 2012-08-21  Cary Coutant  <ccoutant@google.com>
2084
2085         * symtab.cc (Symbol_table::gc_mark_undef_symbols): Don't assert
2086         if --export-dynamic-symbol names an undef symbol.
2087
2088 2012-08-18  Alan Modra  <amodra@gmail.com>
2089
2090         * powerpc.cc: Formatting and white space.
2091         (Powerpc_relobj): Rename got2_section_ to special_.
2092         Add opd_ent_shndx_ and opd_ent_off_ vectors.
2093         (Powerpc_relobj::opd_shndx, init_opd, get_opd_ent, set_opd_ent,
2094         scan_opd_relocs, do_read_relocs, opd_ent_ndx): New functions.
2095         (Target_powerpc): Add Address typedef and invalid_address.  Use
2096         throughout.
2097         (Target_powerpc::is_branch_reloc): New function.
2098         (Powerpc_relocate_functions): Add Address typedef, use throughout.
2099         (Powerpc_relocate_functions:rela, rela_ua): Correct type used
2100         for dst_mask, value and addend.
2101         (Powerpc_relobj::do_find_special_sections): Find .opd for 64-bit.
2102         (ld_2_1, cror_15_15_15, cror_31_31_31): New insn constants.
2103         (Output_data_glink::do_write): Correct toc base.  Don't try to use
2104         uint16_t for 24-bit offset.  Use get_output_section_offset and
2105         check return.
2106         (Target_powerpc::Scan::local): Handle more relocs.
2107         (Target_powerpc::do_finalize_sections): Set up DT_PPC64_GLINK.
2108         (Target_powerpc::Relocate::relocate): Correct toc base calculation.
2109         Plug in toc restoring insn after plt calls.  Translate branches
2110         to function descriptor symbols to corresponding entry point.
2111         (Target_powerpc::relocate_for_relocatable): Check return from
2112         get_output_section_offset.
2113         * symtab.h: Comment typo.
2114
2115 2012-08-14  Ian Lance Taylor  <iant@google.com>
2116
2117         * x86_64.cc (Target_x86_64::Scan::global): Fix erroneous call to
2118         unsupported_relocal_local to call unsupported_reloc_global.
2119
2120 2012-08-14  Nick Clifton  <nickc@redhat.com>
2121
2122         PR ld/14265
2123         * script-sections.cc (Sections_element::output_section_name): Add
2124         keep return parameter.
2125         (Output_section_element::match_name): Add keep return parameter.
2126         Return the value of the keep_ member.
2127         * script-sections.h (class Output_section): Update
2128         output_section_name prototype.
2129         * layout.cc (Layout::keep_input_section): New public member
2130         function.
2131         (Layout::choose_output_section): Pass keep parameter to
2132         output_section_name.
2133         * layout.h (class Layout): Add keep_input_section.
2134         * object.cc (Sized_relobj_file::do_layout): Check for kept input
2135         sections.
2136         * testsuite/Makefile.am: Add a test.
2137         * testsuite/Makefile.in: Regenerate.
2138         * testsuite/pr14265.c: Source file for the test.
2139         * testsuite/pr14265.t: Linker script for the test.
2140         * testsuite/pr14265.sh: Shell script for the test.
2141
2142 2012-08-14  Alan Modra  <amodra@gmail.com>
2143
2144         * target.h (Target::output_section_name): New function.
2145         (Target::do_output_section_name): New function.
2146         * layout.cc (Layout::choose_output_section): Call the above.
2147         * powerpc.cc (Target_powerpc::do_output_section_name): New function.
2148
2149 2012-08-14  Alan Modra  <amodra@gmail.com>
2150
2151         * powerpc.cc: Update for renamed R_PPC_REL16 relocs.
2152         (Output_data_got_powerpc::do_write): Don't rely on base class lookup
2153         for replace_constant call.
2154         (Output_data_plt_powerpc::do_print_to_mapfile): New function.
2155         (Output_data_glink::do_print_to_mapfile): New function.
2156         (Target_powerpc::Scan::local): Ignore R_PPC64_TOCSAVE.
2157         (Target_powerpc::Relocate::relocate): Likewise.
2158
2159 2012-08-14  Alan Modra  <amodra@gmail.com>
2160
2161         * powerpc.cc (Powerpc_relobj::set_got2_shndx): Delete.
2162         (Powerpc_relobj::do_find_special_sections): Don't use set_got2_shndx.
2163         (Output_data_glink::add_entry,find_entry): Remove shndx param.
2164         (class Glink_sym_ent): Rename from struct Glink_sym_ent.  Remove
2165         all references to shndx_.  Handle special case for R_PPC_PLTREL24
2166         here.
2167         (class Glink_sym_ent_hash): Rename from struct Glink_sym_ent_hash.
2168         (Output_data_glink::do_write): Retrieve got2_shdnx from object.
2169         (Target_powerpc::make_plt_entry): Don't special case R_PPC_PLTREL24
2170         here.
2171         (Target_powerpc::Scan::global): Nor on make_plt_entry call.
2172         (Target_powerpc::Relocate::relocate): Nor on glink->find_entry call.
2173
2174 2012-08-12  Alan Modra  <amodra@gmail.com>
2175
2176         * powerpc.cc: Whitespace fixes.  Wrap overly long lines.
2177         (glink insn constants): Use uint32_t.
2178         (Output_data_glink::add_entry): Use insert, not [] operator.
2179
2180 2012-08-11  Alan Modra  <amodra@gmail.com>
2181
2182         * object.h (Sized_relobj_file::find_shdr): New function.
2183         (Sized_relobj_file::find_special_sections): New function.
2184         * object.cc (Sized_relobj_file::find_shdr): New function.
2185         (Sized_relobj_file::find_eh_frame): Use find_shdr.
2186         (Sized_relobj_file::find_special_sections): New function, split out..
2187         (Sized_relobj_file::do_read_symbols): ..from here.
2188         * output.h (Output_data_got::replace_constant): New function.
2189         (Output_data_got::num_entries): New function.
2190         (Output_data_got::last_got_offset,set_got_size): Use num_entries.
2191         (Output_data_got::got_offset): Protected rather than private.
2192         (Output_data_got::replace_got_entry): New function.
2193         * output.cc (Output_data_got::replace_got_entry): New function.
2194         * powerpc.cc (class Powerpc_relobj): New.
2195         (class Powerpc_relocate_functions): Delete all psymval variants or
2196         convert to value,addend type.  Delete pcrela, pcrela_unaligned.
2197         Implement _ha functions using corresponding _hi function.
2198         (Powerpc_relobj::find_special_sections): New function.
2199         (Target_powerpc::do_make_elf_object): New function.
2200         (class Output_data_got_powerpc): New.
2201         (class Output_data_glink): New.
2202         (class Powerpc_scan_relocatable_reloc): New.
2203         Many more changes througout file.
2204
2205 2012-08-09  Nick Clifton  <nickc@redhat.com>
2206
2207         * po/vi.po: Updated Vietnamese translation.
2208
2209 2012-08-07  Ian Lance Taylor  <iant@google.com>
2210
2211         * layout.cc (Layout::add_target_dynamic_tags): If
2212         dynrel_includes_plt but no dyn_rel, emit dynamic reloc tags for
2213         plt_rel.
2214
2215 2012-07-30  Nick Clifton  <nickc@redhat.com>
2216
2217         * po/gold.pot: Updated template.
2218         * po/es.po: Updated Spanish translation.
2219
2220 2012-07-18  Cary Coutant  <ccoutant@google.com>
2221
2222         PR gold/14344
2223         * configure.ac: Add check for -gpubnames support.
2224         * configure: Regenerate.
2225         * testsuite/Makefile.am (gdb_index_test_1): Add check for -gpubnames
2226         support; force -gno-pubnames.
2227         (gdb_index_test_2, gdb_index_test_3): Add check for -gpubnames
2228         support.
2229         (gdb_index_test_4): New test.
2230         * testsuite/Makefile.in: Regenerate.
2231         * testsuite/gdb_index_test_1.sh: Refactor code into common file.
2232         * testsuite/gdb_index_test_2.sh: Likewise.
2233         * testsuite/gdb_index_test_3.sh: Don't look for space after colon.
2234         * testsuite/gdb_index_test_4.sh: New script.
2235         * testsuite/gdb_index_test_comm.sh: New script with common code;
2236         don't look for space after colon.
2237
2238 2012-07-16  Sriraman Tallam  <tmsriram@google.com>
2239
2240         * gold.cc (queue_middle_tasks): Update function order only after
2241         deferred objects due to plugins are processed.
2242
2243 2012-07-11  Ian Lance Taylor  <iant@google.com>
2244
2245         * arm.cc (Arm_relocate_functions::abs16): Remove unused typedef.
2246         (Arm_exidx_cantunwind::do_fixed_endian_write): Likewise.
2247         (Target_arm::scan_reloc_for_stub): Likewise.
2248         * common.cc (Symbol_table::do_allocate_commons_list): Likewise.
2249         * dwarf_reader.cc (Dwarf_die::skip_attributes): Likewise.
2250         * ehframe.cc (Eh_frame::do_add_ehframe_input_section): Likewise.
2251         * incremental.cc (Sized_incr_dynobj::do_add_symbols): Likewise.
2252         * powerpc.cc (Target_powerpc::relocate_tls): Likewise.
2253
2254 2012-07-10  Dodji Seketeli  <dodji@redhat.com>
2255             Ian Lance Taylor  <iant@google.com>
2256
2257         PR gold/14309
2258         * configure.ac: Test whether std::tr1::hash<off_t> works.
2259         * gold.h: Add a specialization for std::tr1::hash<off_t> if
2260         needed.
2261         * output.h (class Output_fill): Add virtual destructor.
2262         * configure, config.in: Rebuild.
2263
2264 2012-06-22  Roland McGrath  <mcgrathr@google.com>
2265
2266         * layout.cc (finalize): Define __ehdr_start symbol if applicable.
2267
2268 2012-06-12  Rafael Ávila de Espíndola <respindola@mozilla.com>
2269
2270         * plugin.cc (Plugin::load): Handle position independent executables.
2271
2272 2012-06-06  Cary Coutant  <ccoutant@google.com>
2273
2274         * layout.cc (gdb_sections): Remove ".debug_" prefixes,
2275         add .debug_macro.
2276         (lines_only_debug_sections): Likewise.
2277         (gdb_fast_lookup_sections): New static array.
2278         (is_gdb_debug_section): Rename formal parameter.
2279         (is_lines_only_debug_section): Likewise.
2280         (is_gdb_fast_lookup_section): New function.
2281         (Layout::include_section): Check for ".zdebug_" prefix; pass
2282         section name suffix to is_gdb_debug_section, et al.; check for
2283         fast-lookup sections when building .gdb_index.
2284         * options.h (--strip-debug-gdb): Update GDB version number.
2285
2286 2012-06-06  Cary Coutant  <ccoutant@google.com>
2287
2288         * configure.ac: Add check for fallocate.
2289         * configure: Regenerate.
2290         * config.in: Regenerate.
2291
2292         * options.h (class General_options): Add --mmap-output-file and
2293         --posix-fallocate options.
2294         * output.cc: (posix_fallocate): Remove; replace with...
2295         (gold_fallocate): New function.
2296         (Output_file::map_no_anonymous): Call gold_fallocate.
2297         (Output_file::map): Check --mmap-output-file option.
2298
2299 2012-06-05  Jing Yu  <jingyu@google.com>
2300
2301         * gold.h (textdomain): Add do {} to empty while(0).
2302         (bindtextdomain): Likewise.
2303
2304 2012-06-04  Cary Coutant  <ccoutant@google.com>
2305
2306         * dynobj.cc (Sized_dynobj::do_get_global_symbol_counts): Call
2307         has_dynsym_index.
2308
2309 2012-05-25  Sriraman Tallam  <tmsriram@google.com>
2310
2311         * symtab.cc (Symbol_table::define_special_symbol):
2312         Initialize *poldsym to prevent uninitialized variable errors.
2313
2314 2012-05-23  Cary Coutant  <ccoutant@google.com>
2315
2316         * layout.cc (Layout::section_name_mapping): Add rules to handle
2317         exact match on .data.rel.ro.local or .data.rel.ro.
2318         (Layout::output_section_name): Check for exact matches.
2319
2320 2012-05-23  Cary Coutant  <ccoutant@google.com>
2321
2322         * layout.cc (Layout::section_name_mapping): Match .data.rel.ro.*
2323         more carefully.
2324
2325 2012-05-22  Cary Coutant  <ccoutant@google.com>
2326
2327         * symtab.cc (Symbol::should_add_dynsym_entry): Check for relocatable
2328         object before exporting symbol.
2329
2330 2012-05-21  H.J. Lu  <hongjiu.lu@intel.com>
2331
2332         * testsuite/tls_test.cc: Include "config.h" first.
2333         * testsuite/tls_test_c.c: Likewise.
2334
2335 2012-05-17  Daniel Richard G.  <skunk@iskunk.org>
2336             Nick Clifton  <nickc@redhat.com>
2337
2338         PR 14072
2339         * configure.in: Add check that sysdep.h has been included before
2340         any system header files.
2341         * configure: Regenerate.
2342         * config.in: Regenerate.
2343
2344 2012-05-14  Cary Coutant  <ccoutant@google.com>
2345
2346         * layout.cc (Layout::make_output_section): Mark .tdata section
2347         as RELRO.
2348         * testsuite/relro_test.cc: Add a TLS variable.
2349
2350 2012-05-10  H.J. Lu  <hongjiu.lu@intel.com>
2351
2352         PR gold/14091
2353         * x86_64.cc (Target_x86_64::Scan::local): For x32, generate
2354         R_X86_64_RELATIVE64 instead of R_X86_64_RELATIVE in case of
2355         R_X86_64_64.
2356
2357 2012-05-08  Cary Coutant  <ccoutant@google.com>
2358
2359         * layout.cc (gdb_sections): Update GDB version, add .debug_addr.
2360         (lines_only_debug_sections): Likewise.
2361
2362 2012-05-02  Roland McGrath  <mcgrathr@google.com>
2363
2364         * nacl.cc: New file.
2365         * nacl.h: New file.
2366         * Makefile.am (CCFILES, HFILES): Add them.
2367         * Makefile.in: Regenerate.
2368         * i386.cc (Output_data_plt_i386_nacl): New class.
2369         (Output_data_plt_i386_nacl_exec): New class.
2370         (Output_data_plt_i386_nacl_dyn): New class.
2371         (Target_i386_nacl): New class.
2372         (Target_selector_i386_nacl): New class.
2373         (target_selector_i386): Use it instead of Target_selector_i386.
2374         * x86_64.cc (Output_data_plt_x86_64_nacl): New class.
2375         (Target_x86_64_nacl): New class.
2376         (Target_selector_x86_64_nacl): New class.
2377         (target_selector_x86_64, target_selector_x32): Use it instead of
2378         Target_selector_x86_64.
2379         * arm.cc (Output_data_plt_arm_nacl): New class.
2380         (Target_arm_nacl): New class.
2381         (Target_selector_arm_nacl): New class.
2382         (target_selector_arm, target_selector_armbe): Use it instead of
2383         Target_selector_arm.
2384
2385         * target-select.cc (select_target): Take new Input_file* and off_t
2386         arguments, pass them on to recognize method of selector.
2387         * object.cc (make_elf_sized_object): Update caller.
2388         * parameters.cc (parameters_force_valid_target): Likewise.
2389         * incremental.cc (make_sized_incremental_binary): Likewise.
2390         * target-select.h: Update decl.
2391         (Target_selector::recognize): Take new Input_file* argument,
2392         pass it on to do_recognize.
2393         (Target_selector::do_recognize): Take new Input_file* argument.
2394         * freebsd.h (Target_selector_freebsd::do_recognize): Likewise.
2395         * powerpc.cc (Target_selector_powerpc::do_recognize): Likewise.
2396         * sparc.cc (Target_selector_sparc::do_recognize): Likewise.
2397         * testsuite/testfile.cc (Target_selector::do_recognize): Likewise.
2398
2399         * target.h (Target::Target_info): New members isolate_execinstr
2400         and rosegment_gap.
2401         (Target::isolate_execinstr, Target::rosegment_gap): New methods.
2402         * arm.cc (Target_arm::arm_info): Update initializer.
2403         * i386.cc (Target_i386::i386_info): Likewise.
2404         * powerpc.cc (Target_powerpc::powerpc_info): Likewise.
2405         * sparc.cc (Target_sparc::sparc_info): Likewise.
2406         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
2407         * testsuite/testfile.cc (Target_test::test_target_info): Likewise.
2408         * layout.cc (Layout::attach_allocated_section_to_segment):
2409         Take new const Target* argument.  If target->isolate_execinstr(), act
2410         like --rosegment.
2411         (Layout::find_first_load_seg): Take new const Target* argument;
2412         if target->isolate_execinstr(), reject PF_X segments.
2413         (Layout::relaxation_loop_body): Update caller.
2414         (Layout::set_segment_offsets): If target->isolate_execinstr(),
2415         reset file offset to zero when we hit LOAD_SEG, and then do a second
2416         loop over the segments before LOAD_SEG to reassign offsets after
2417         addresses have been determined.  Handle target->rosegment_gap().
2418         (Layout::attach_section_to_segment): Take new const Target* argument;
2419         pass it to attach_allocated_section_to_segment.
2420         (Layout::make_output_section): Update caller.
2421         (Layout::attach_sections_to_segments): Take new const Target* argument;
2422         pass it to attach_section_to_segment.
2423         * gold.cc (queue_middle_tasks): Update caller.
2424         * layout.h (Layout): Update method decls with new arguments.
2425
2426         * arm.cc (Target_arm::Target_arm): Take optional argument for the
2427         Target_info pointer to use.
2428         (Target_arm::do_make_data_plt): New virtual method.
2429         (Target_arm::make_data_plt): New method that calls it.
2430         (Target_arm::make_plt_entry): Use it.
2431         (Output_data_plt_arm::Output_data_plt_arm): Take additional argument
2432         for the section alignment.
2433         (Output_data_plt_arm::do_first_plt_entry_offset): New abstract virtual
2434         method.
2435         (Output_data_plt_arm::first_plt_entry_offset): Call it.
2436         (Output_data_plt_arm::do_get_plt_entry_size): New abstract virtual
2437         method.
2438         (Output_data_plt_arm::get_plt_entry_size): Call it.
2439         (Output_data_plt_arm::do_fill_plt_entry): New abstract virtual method.
2440         (Output_data_plt_arm::fill_plt_entry): New method that calls it.
2441         (Output_data_plt_arm::do_fill_first_plt_entry): New abstract virtual
2442         method.
2443         (Output_data_plt_arm::fill_first_plt_entry): New method that calls it.
2444         (Output_data_plt_arm::set_final_data_size): Use get_plt_entry_size
2445         method instead of sizeof(plt_entry).
2446         (Output_data_plt_arm::add_entry): Likewise.
2447         Use first_plt_entry_offset method instead of sizeof(first_plt_entry).
2448         (Target_arm::first_plt_entry_offset): Call method on this->plt_ rather
2449         than static method.
2450         (Target_arm::plt_entry_size): Likewise.
2451         (Output_data_plt_arm::first_plt_entry, Output_data_plt_arm::plt_entry):
2452         Move to ...
2453         (Output_data_plt_arm_standard): ... here, new class.
2454         (Output_data_plt_arm::do_write): Move guts of PLT filling to...
2455         (Output_data_plt_arm_standard::do_fill_first_plt_entry): ... here ...
2456         (Output_data_plt_arm_standard::do_fill_plt_entry): ... and here.
2457
2458         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
2459         Take additional argument for the PLT entry size.
2460         (Output_data_plt_x86_64::get_tlsdesc_plt_offset):
2461         Use get_plt_entry_size method rather than plt_entry_size variable.
2462         (Output_data_plt_x86_64::reserve_slot): Likewise.
2463         (Output_data_plt_x86_64::do_adjust_output_section): Likewise.
2464         (Output_data_plt_x86_64::add_entry): Likewise.
2465         (Output_data_plt_x86_64::add_local_ifunc_entry): Likewise.
2466         (Output_data_plt_x86_64::address_for_global): Likewise.
2467         (Output_data_plt_x86_64::address_for_local): Likewise.
2468         (Output_data_plt_x86_64::set_final_data_size): Likewise.
2469         (Output_data_plt_x86_64::first_plt_entry_offset): Likewise.
2470         Make method non-static.
2471         (Output_data_plt_x86_64::do_get_plt_entry_size): New abstract virtual
2472         method.
2473         (Output_data_plt_x86_64::get_plt_entry_size): Just call that.
2474         (Output_data_plt_x86_64::do_add_eh_frame): New abstract virtual method.
2475         (Output_data_plt_x86_64::add_eh_frame): New method to call it.
2476         (Output_data_plt_x86_64::do_fill_first_plt_entry): New abstract
2477         virtual method.
2478         (Output_data_plt_x86_64::fill_first_plt_entry): New method to call it.
2479         (Output_data_plt_x86_64::do_fill_plt_entry): New abstract
2480         virtual method.
2481         (Output_data_plt_x86_64::fill_plt_entry): New method to call it.
2482         (Output_data_plt_x86_64::do_fill_tlsdesc_entry): New abstract
2483         virtual method.
2484         (Output_data_plt_x86_64::fill_tlsdesc_entry): New method to call it.
2485         (Output_data_plt_x86_64::plt_entry_size)
2486         (Output_data_plt_x86_64::first_plt_entry)
2487         (Output_data_plt_x86_64::plt_entry)
2488         (Output_data_plt_x86_64::tlsdesc_plt_entry)
2489         (Output_data_plt_x86_64::plt_eh_frame_fde_size)
2490         (Output_data_plt_x86_64::plt_eh_frame_fde): Move to ...
2491         (Output_data_plt_x86_64_standard): ... here, new class.
2492         (Target_x86_64::Target_x86_64): Take optional argument for the
2493         Target_info pointer to use.
2494         (Target_x86_64::do_make_data_plt): New virtual method.
2495         (Target_x86_64::make_data_plt): New method to call it.
2496         (Target_x86_64::init_got_plt_for_update): Use that.
2497         Call this->plt_->add_eh_frame method here.
2498         (Output_data_plt_x86_64::init): Don't do add_eh_frame_for_plt here.
2499         (Target_x86_64::first_plt_entry_offset): Call method on this->plt_
2500         rather than static method.
2501         (Target_x86_64::plt_entry_size): Likewise.
2502         (Output_data_plt_x86_64::do_write): Use get_plt_entry_size method
2503         rather than plt_entry_size variable.  Move guts of PLT filling to...
2504         (Output_data_plt_x86_64_standard::do_fill_first_plt_entry): ... here ...
2505         (Output_data_plt_x86_64_standard::do_fill_plt_entry): ... and here ...
2506         (Output_data_plt_x86_64_standard::do_fill_tlsdesc_entry): ... and here.
2507
2508         * i386.cc (Output_data_plt_i386::Output_data_plt_i386): Take
2509         additional argument for the section alignment.
2510         Don't do add_eh_frame_for_plt here.
2511         (Output_data_plt_i386::first_plt_entry_offset): Make the method
2512         non-static.  Use get_plt_entry_size method rather than plt_entry_size
2513         variable.
2514         (Output_data_plt_i386::do_get_plt_entry_size): New abstract virtual
2515         method.
2516         (Output_data_plt_i386::get_plt_entry_size): Call it.
2517         (Output_data_plt_i386::do_add_eh_frame): New abstract virtual method.
2518         (Output_data_plt_i386::add_eh_frame): New method to call it.
2519         (Output_data_plt_i386::do_fill_first_plt_entry): New abstract virtual
2520         method.
2521         (Output_data_plt_i386::fill_first_plt_entry): New method to call it.
2522         (Output_data_plt_i386::do_fill_plt_entry): New abstract virtual
2523         method.
2524         (Output_data_plt_i386::fill_plt_entry): New method to call it.
2525         (Output_data_plt_i386::set_final_data_size): Use get_plt_entry_size
2526         method instead of plt_entry_size.
2527         (Output_data_plt_i386::plt_entry_size)
2528         (Output_data_plt_i386::plt_eh_frame_fde_size)
2529         (Output_data_plt_i386::plt_eh_frame_fde): Move to ...
2530         (Output_data_plt_i386_standard): ... here, new class.
2531         (Output_data_plt_i386_exec): New class.
2532         (Output_data_plt_i386::exec_first_plt_entry): Move to ...
2533         (Output_data_plt_i386_exec::first_plt_entry): ... here.
2534         (Output_data_plt_i386::exec_plt_entry): Move to ...
2535         (Output_data_plt_i386_exec::plt_entry): ... here.
2536         (Output_data_plt_i386_dyn): New class.
2537         (Output_data_plt_i386::first_plt_entry): Move to ...
2538         (Output_data_plt_i386_dyn::first_plt_entry): ... here.
2539         (Output_data_plt_i386::dyn_plt_entry): Move to ...
2540         (Output_data_plt_i386_dyn::plt_entry): ... here.
2541         (Target_i386::Target_i386): Take optional argument for the Target_info
2542         pointer to use.
2543         (Target_i386::do_make_data_plt): New virtual method.
2544         (Target_i386::make_data_plt): New method to call it.
2545         (Target_i386::make_plt_section): Use that.
2546         Call this->plt_->add_eh_frame method here.
2547         (Output_data_plt_i386::add_entry): Use get_plt_entry_size method
2548         rather than plt_entry_size variable.
2549         (Output_data_plt_i386::add_local_ifunc_entry): Likewise.
2550         (Output_data_plt_i386::address_for_local): Likewise.
2551         (Output_data_plt_i386::do_write): Likewise.
2552         Move guts of PLT filling to...
2553         (Output_data_plt_i386_exec::do_fill_first_plt_entry): ... here ...
2554         (Output_data_plt_i386_exec::do_fill_plt_entry): ... and here ...
2555         (Output_data_plt_i386_dyn::do_fill_first_plt_entry): ... and here ...
2556         (Output_data_plt_i386_dyn::do_fill_plt_entry): ... and here.
2557
2558 2012-05-01  Cary Coutant  <ccoutant@google.com>
2559
2560         * dwarf_reader.cc (Dwarf_die::read_attributes)
2561         (Dwarf_die::skip_attributes, Dwarf_die::int_attribute)
2562         (Dwarf_die::uint_attribute): Remove DW_FORM_null.
2563         * reduced_debug_output.cc
2564         (Output_reduced_debug_info_section::get_die_end): Remove
2565         DW_FORM_GNU_ref_index.  Add default case.
2566
2567 2012-04-26  Mark Wielaard  <mjw@redhat.com>
2568
2569         * dwarf_reader.cc (Dwarf_die::address_attribute): New function.
2570         * dwarf_reader.h (Dwarf_die::address_attribute): Likewise.
2571         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Handle
2572         DW_AT_high_pc as offset from DW_AT_low_pc.
2573
2574         * testsuite/Makefile.am (gdb_index_test_3.sh): New test case.
2575         * testsuite/Makefile.in: Regenerate.
2576         * testsuite/gdb_index_test_3.c: New test source file.
2577         * testsuite/gdb_index_test_3.sh: New test source file.
2578
2579 2012-04-25  Ian Lance Taylor  <iant@google.com>
2580
2581         * arm.cc (Target_arm::do_is_defined_by_abi): Make sym a const
2582         pointer.
2583         (Stub_addend_reader::operator()): Declare Arm_relocate_functions
2584         as a class, not a struct.
2585         (Target_arm::scan_span_for_cortex_a8_erratum): Likewise.
2586         (Target_arm::apply_cortex_a8_workaround): Likewise.
2587         * gc.h: Declare Reloc_types as a struct, not a class.
2588         * object.h: Declare Symbols_data as a struct.
2589         * reloc.h: Declare Read_relocs_data as a struct.
2590         * target.h: Declare Relocate_info as a struct.
2591
2592 2012-04-24  David S. Miller  <davem@davemloft.net>
2593
2594         * sparc.cc (Target_sparc::Relocate::relax_call): New function.
2595         (Target_sparc::Relocate::relocate): Call it for R_SPARC_WDISP30
2596         and R_SPARC_WPLT30.
2597
2598 2012-04-24  Cary Coutant  <ccoutant@google.com>
2599
2600         * incremental-dump.cc (find_input_containing_global): Replace
2601         magic number with symbolic constant.
2602         (dump_incremental_inputs): Update version number.
2603         * incremental.cc (Output_section_incremental_inputs): Update version
2604         number; import symbolic constants from Incremental_inputs_reader.
2605         (Incremental_inputs::create_data_sections): Align relocations
2606         section correctly for 64-bit targets.
2607         (Output_section_incremental_inputs::set_final_data_size): Use symbolic
2608         constants; add padding.
2609         (Output_section_incremental_inputs::write_header): Add assert for
2610         header_size.
2611         (Output_section_incremental_inputs::write_input_files): Add assert
2612         for input_entry_size.
2613         (Output_section_incremental_inputs::write_info_blocks): Add padding;
2614         add assert for object_info_size, input_section_entry_size,
2615         global_sym_entry_size.
2616         * incremental.h (Incremental_inputs_reader): Add symbolic constants
2617         for data structure sizes; use them.
2618         (Incremental_input_entry_reader): Import symbolic constants from
2619         Incremental_inputs_reader; use them.
2620
2621 2012-04-23  David S. Miller  <davem@davemloft.net>
2622
2623         * sparc.cc (class Target_sparc): Add elf_machine_, elf_flags_,
2624         and elf_flags_set_.
2625         (Target_sparc::Target_sparc): Initialize new fields.
2626         (Target_sparc::do_make_elf_object): New function.
2627         (Target_sparc::do_adjust_elf_header): New function.
2628
2629 2012-04-23  Cary Coutant  <ccoutant@google.com>
2630
2631         * gdb-index.cc (Gdb_index::do_write): Use Swap_aligned32 for writing
2632         CU range table of gdb index.
2633
2634 2012-04-20  David S. Miller  <davem@davemloft.net>
2635
2636         * target.cc (Sized_target::do_adjust_elf_header): Use big_endian
2637         instead of false.
2638
2639 2012-04-16  David S. Miller  <davem@davemloft.net>
2640
2641         * sparc.cc (Target_sparc::got_address): New function.
2642         (Sparc_relocate_functions::gdop_hix22): New function.
2643         (Sparc_relocate_functions::gdop_lox10): New function.
2644         (Target_sparc::Scan::local): Do not emit a GOT entry for GOTDATA
2645         relocs.
2646         (Target_sparc::Scan::local): Likewise if the global symbol is not
2647         preemptible and is not IFUNC.
2648         (Target_sparc::Relocate::relocate): Perform GOTDATA code
2649         transformations for local and non-preemptible non-IFUNC global
2650         symbols.
2651
2652         * gdb-index.cc (Gdb_index::do_write): Use Swap_unaligned when
2653         writing out 64-bit part of ranges.
2654
2655         * Makefile.am: Build IFUNC tests with -fPIC and -fPIE instead of
2656         -fpic and -fpie respectively.
2657         * Makefile.in: Regenerate.
2658
2659         * sparc.cc (class Target_sparc): Add rela_ifunc_.
2660         (Target_sparc::Target_sparc): Initialize new field.
2661         (Target_sparc::do_plt_section_for_global): New function.
2662         (Target_sparc::do_plt_section_for_local): New function.
2663         (Target_sparc::reloc_needs_plt_for_ifunc): New function.
2664         (Target_sparc::make_plt_section): New function, broken out of
2665         make_plt_entry.  Use ORDER_NON_RELRO_FIRST for ".plt".
2666         (Target_sparc::make_plt_entry): Call make_plt_section.
2667         (Target_sparc::make_local_ifunc_plt_entry): New function.
2668         (Target_sparc::rela_ifunc_section): New function.
2669         (Target_sparc::plt_section): Remove const.
2670         (Output_data_plt_sparc): Update declarations.  Define Global_ifunc
2671         and Local_ifunc types.  Add global_ifuncs_, local_ifuncs_, ifunc_rel_,
2672         and ifunc_count_ fields.
2673         (Output_data_plt_sparc::Output_data_plt_sparc): Initialize new fields.
2674         (Output_data_plt_sparc::add_entry): Handle IFUNC symbols.
2675         (Output_data_plt_sparc::add_local_ifunc_entry): New function.
2676         (Output_data_plt_sparc::rela_ifunc): New function.
2677         (Output_data_plt_sparc::emit_pending_ifunc_relocs): New function.
2678         (Output_data_plt_sparc::has_ifunc_section): New function.
2679         (Output_data_plt_sparc::entry_count): Include ifunc_count_.
2680         (Output_data_plt_sparc::address_for_global): New function.
2681         (Output_data_plt_sparc::address_for_local): New function.
2682         (Output_data_plt_sparc::plt_index_to_offset): New function.
2683         (Output_data_plt_sparc::set_final_data_size): Use plt_index_to_offset
2684         and entry_count.
2685         (Output_data_plt_sparc::do_write): Use first_plt_entry_offset and
2686         entry_count.
2687         (Target_sparc::Scan::get_reference_flags): Add R_SPARC_IRELATIVE and
2688         R_SPARC_JMP_IREL to switch.
2689         (Target_sparc::Scan::check_non_pic): Likewise.
2690         (Target_sparc::Scan::local): Handle IFUNC symbols.
2691         (Target_sparc::Scan::local): Likewise.
2692         (Target_sparc::Relocate::relocate): Likewise, use plt_address_for_global
2693         and plt_address_for_local.
2694         (Target_sparc::do_finalize_sections): Call emit_pending_ifunc_relocs.
2695         Define __rel_iplt_start and __rel_iplt_end if doing a static link.
2696
2697         * output.h (Output_reloc): Allow use_plt_offset for global relocs too.
2698         (class Output_data_reloc): Adjust calls to Output_reloc_type.
2699         (Output_data_reloc::add_global_relative): (RELA only) Add use_plt_offset.
2700         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag for
2701         global relocs too.
2702         (Output_reloc::symbol_value): Respect use_plt_offset_ for global symbols.
2703         * powerpc.cc (Target_powerpc::Scan::global): Adjust add_global_relative
2704         calls.
2705         * sparc.cc (Target_sparc::Scan::global): Likewise.
2706         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
2707
2708 2012-04-16  Cary Coutant  <ccoutant@google.com>
2709
2710         * archive.cc (Library_base::should_include_member): Check for
2711         --export-dynamic-symbol.
2712         * options.h (class General_options): Add --export-dynamic-symbol.
2713         * symtab.cc (Symbol::should_add_dynsym_entry): Check for
2714         --export-dynamic-symbol.
2715         (Symbol_table::gc_mark_undef_symbols): Likewise.
2716         (Symbol_table::do_add_undefined_symbols_from_command_line): Likewise.
2717
2718 2012-04-12  David S. Miller  <davem@davemloft.net>
2719
2720         * sparc.cc (Reloc::wdisp10): New relocation method.
2721         (Reloc::h34): Likewise.
2722         (Target_sparc::Scan::check_non_pic): Handle R_SPARC_H34.
2723         (Target_sparc::Scan::get_reference_flags): Handle R_SPARC_H34 and
2724         R_SPARC_WDISP10.
2725         (Target_sparc::Scan::local): Likewise.
2726         (Target_sparc::Scan::global): Likewise.
2727         (Target_sparc::Relocate::relocate): Likewise.
2728
2729 2012-04-09  Cary Coutant  <ccoutant@google.com>
2730
2731         * gdb-index.cc (Gdb_index_info_reader::record_cu_ranges): Allow
2732         low_pc == 0.
2733
2734 2012-04-06  Ian Lance Taylor  <iant@google.com>
2735
2736         * timer.cc: #include <unistd.h>.
2737
2738 2012-04-06  Roland McGrath  <mcgrathr@google.com>
2739
2740         * configure.in (AC_CHECK_HEADERS): Add locale.h.
2741         * config.in: Regenerate.
2742         * configure: Regenerate.
2743
2744 2012-04-05  Nick Clifton  <nickc@redhat.com>
2745
2746         * configure.ac (AC_CHECK_FUNCS): Add setlocale.
2747         (AM_LC_MESSAGES): Add.
2748         * aclocal.m4: Regenerate.
2749         * config.in: Regenerate.
2750         * configure: Regenerate.
2751
2752 2012-03-21  Cary Coutant  <ccoutant@google.com>
2753
2754         * Makefile.am: Add gdb-index.cc, gdb-index.h.
2755         * Makefile.in: Regenerate.
2756         * dwarf_reader.cc (Sized_elf_reloc_mapper::do_initialize): New function.
2757         (Sized_elf_reloc_mapper::symbol_section): New function.
2758         (Sized_elf_reloc_mapper::do_get_reloc_target): New function.
2759         (make_elf_reloc_mapper): New function.
2760         (Dwarf_abbrev_table::clear_abbrev_codes): New function.
2761         (Dwarf_abbrev_table::do_read_abbrevs): New function.
2762         (Dwarf_abbrev_table::do_get_abbrev): New function.
2763         (Dwarf_ranges_table::read_ranges_table): New function.
2764         (Dwarf_ranges_table::read_range_list): New function.
2765         (Dwarf_pubnames_table::read_section): New function.
2766         (Dwarf_pubnames_table::read_header): New function.
2767         (Dwarf_pubnames_table::next_name): New function.
2768         (Dwarf_die::Dwarf_die): New function.
2769         (Dwarf_die::read_attributes): New function.
2770         (Dwarf_die::skip_attributes): New function.
2771         (Dwarf_die::set_name): New function.
2772         (Dwarf_die::set_linkage_name): New function.
2773         (Dwarf_die::attribute): New function.
2774         (Dwarf_die::string_attribute): New function.
2775         (Dwarf_die::int_attribute): New function.
2776         (Dwarf_die::uint_attribute): New function.
2777         (Dwarf_die::ref_attribute): New function.
2778         (Dwarf_die::child_offset): New function.
2779         (Dwarf_die::sibling_offset): New function.
2780         (Dwarf_info_reader::check_buffer): New function.
2781         (Dwarf_info_reader::parse): New function.
2782         (Dwarf_info_reader::do_parse): New function.
2783         (Dwarf_info_reader::do_read_string_table): New function.
2784         (Dwarf_info_reader::lookup_reloc): New function.
2785         (Dwarf_info_reader::get_string): New function.
2786         (Dwarf_info_reader::visit_compilation_unit): New function.
2787         (Dwarf_info_reader::visit_type_unit): New function.
2788         (Sized_dwarf_line_info::Sized_dwarf_line_info): Use
2789         Sized_elf_reloc_mapper.
2790         (Sized_dwarf_line_info::symbol_section): Remove function.
2791         (Sized_dwarf_line_info::read_relocs): Use Sized_elf_reloc_mapper.
2792         (Sized_dwarf_line_info::read_line_mappings): Remove object
2793         parameter, adjust callers.
2794         (Sized_dwarf_line_info::format_file_lineno): Fix type of cast.
2795         * dwarf_reader.h: Include <sys/types.h>.
2796         (class Track_relocs): Remove forward declaration.
2797         (class Elf_reloc_mapper): New class.
2798         (class Sized_elf_reloc_mapper): New class.
2799         (class Dwarf_abbrev_table): New class.
2800         (class Dwarf_range_list): New class.
2801         (class Dwarf_ranges_table): New class.
2802         (class Dwarf_pubnames_table): New class.
2803         (class Dwarf_die): New class.
2804         (class Dwarf_info_reader): New class.
2805         (Sized_dwarf_line_info::read_line_mappings): Remove object parameter.
2806         (Sized_dwarf_line_info::symbol_section): Remove member function.
2807         * dynobj.h (Sized_dynobj::do_section_contents): Refactor code from
2808         base class.
2809         * gdb-index.cc: New source file.
2810         * gdb-index.h: New source file.
2811         * incremental.cc (Sized_relobj_incr::do_layout): Track .debug_info
2812         and .debug_types sections, call Layout::add_to_gdb_index.
2813         (Sized_relobj_incr::do_section_name): Implement.
2814         (Sized_relobj_incr::do_section_contents): Adjust parameter list and
2815         return type; Implement.
2816         (Sized_incr_dynobj::do_section_contents): Adjust parameter list and
2817         return type.
2818         * incremental.h (Sized_relobj_incr::do_section_contents): Adjust
2819         parameter list and return type.
2820         (Sized_incr_dynobj::do_section_contents): Likewise.
2821         * layout.cc: Include gdb-index.h.
2822         (Layout::Layout): Initialize gdb_index_data_.
2823         (Layout::init_fixed_output_section): Check for .gdb_index section.
2824         (Layout::add_to_gdb_index): New function. Instantiate.
2825         * layout.h: Add forward declaration for class Gdb_index.
2826         (Layout::add_to_gdb_index): New member function.
2827         (Layout::gdb_index_data_): New data member.
2828         * main.cc: Include gdb-index.h.
2829         (main): Print statistics for gdb index.
2830         * object.cc (Object::section_contents): Move code into
2831         do_section_contents.
2832         (need_decompressed_section): Check for sections needed when building
2833         gdb index.
2834         (build_compressed_section_map): Likewise.
2835         (Sized_relobj_file::do_read_symbols): Need local symbols when building
2836         gdb index.
2837         (Sized_relobj_file::do_layout): Track .debug_info and .debug_types
2838         sections; call Layout::add_to_gdb_index.
2839         (Sized_relobj_file::do_decompressed_section_contents): Call
2840         do_section_contents directly.
2841         * object.h (Object::do_section_contents): Adjust parameter list and
2842         return type.
2843         (Object::do_decompressed_section_contents): Call do_section_contents
2844         directly.
2845         (Sized_relobj_file::do_section_contents): Adjust parameter list and
2846         return type.
2847         * options.h (class General_options): Add --gdb-index option.
2848         * plugin.cc (Sized_pluginobj::do_section_contents): Adjust parameter
2849         list and return type.
2850         * plugin.h (Sized_pluginobj::do_section_contents): Likewise.
2851         * reloc.h (Track_relocs::checkpoint): New function.
2852         (Track_relocs::reset): New function.
2853
2854         * testsuite/Makefile.am (gdb_index_test_1.sh, gdb_index_test_2.sh):
2855         New test cases.
2856         * testsuite/Makefile.in: Regenerate.
2857         * testsuite/gdb_index_test.cc: New test source file.
2858         * testsuite/gdb_index_test_1.sh: New test source file.
2859         * testsuite/gdb_index_test_2.sh: New test source file.
2860
2861 2012-03-19  Doug Kwan  <dougkwan@google.com>
2862
2863         * arm.cc (Target_arm::do_define_standard_symbols): New method.
2864         (Target_arm::do_finalize_sections): Remove code which defines
2865         __exidx_start and __exidx_end.  Make symbol table parameter
2866         anonymous as it is not used.
2867         * gold.cc (queue_middle_tasks): Call target hook to define any
2868         target-specific symbols.
2869         * target.h (Target::define_standard_symbols): New method.
2870         (Target::do_define_standard_symbols): Same.
2871         * testsuite/Makefile.am (arm_exidx_test): Dump relocations also.
2872         * testsuite/Makefile.in: Regenerate.
2873         * testsuite/arm_exidx.s: Generate data relocations for __exidx_start
2874         and __exidx_end.
2875         * testsuite/arm_exidx_test.sh: Check that no unused dynamic
2876         relocations are generated for __exidx_start and __exidx_end.
2877
2878 2012-03-16  Doug Kwan  <dougkwan@google.com>
2879
2880         * testsuite/Makefile.am: Disable test initpri3b.
2881         * testsuite/Makefile.in: Regenerate.
2882
2883 2012-03-15  Doug Kwan  <dougkwan@google.com>
2884
2885         * arm.cc (Target_arm::got_section): Make .got section read-only
2886         if -z now is given.
2887
2888 2012-03-15  Ian Lance Taylor  <iant@google.com>
2889
2890         PR gold/13850
2891         * layout.cc (Layout::make_output_section): Correctly mark
2892         SHT_INIT_ARRAY, et. al., as relro.
2893
2894 2012-03-14  Doug Kwan  <dougkwan@google.com>
2895
2896         * gold/arm.cc (Target_arm::Scan::global): Generate R_ARM_GLOB_DAT
2897         dynamic relocations for protected symbols in shared objects.
2898
2899 2012-03-13  Ian Lance Taylor  <iant@google.com>
2900
2901         * resolve.cc (Symbol_table::resolve): When merging common symbols,
2902         keep the larger alignment.
2903
2904 2012-03-12  Cary Coutant  <ccoutant@google.com>
2905
2906         * dwarf_reader.cc (Sized_dwarf_line_info::process_one_opcode): Fix
2907         handling of DW_LNE_define_file.
2908
2909 2012-03-12  Cary Coutant  <ccoutant@google.com>
2910
2911         * reduced_debug_output.cc
2912         (Output_reduced_debug_info_section::get_die_end): Add new FORM
2913         codes to switch.
2914
2915 2012-02-29  Cary Coutant  <ccoutant@google.com>
2916
2917         * object.cc (need_decompressed_section): Add #ifdef ENABLE_THREADS.
2918
2919 2012-02-29  Cary Coutant  <ccoutant@google.com>
2920
2921         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
2922         Call Object::decompressed_section_contents.
2923         * dwarf_reader.h (Sized_dwarf_line_info::~Sized_dwarf_line_info):
2924         New dtor.
2925         (Sized_dwarf_line_info::buffer_start_): New data member.
2926         * merge.cc (Output_merge_data::do_add_input_section): Call
2927         Object::decompressed_section_contents.
2928         (Output_merge_string::do_add_input_section): Likewise.
2929         * object.cc (need_decompressed_section): New function.
2930         (build_compressed_section_map): Decompress sections needed later.
2931         (Sized_relobj_file::do_decompressed_section_contents): New function.
2932         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2933         * object.h (Object::decompressed_section_contents): New function.
2934         (Object::discard_decompressed_sections): New function.
2935         (Object::do_decompressed_section_contents): New function.
2936         (Object::do_discard_decompressed_sections): New function.
2937         (Compressed_section_info): New type.
2938         (Compressed_section_map): Include decompressed section contents.
2939         (Sized_relobj_file::do_decompressed_section_contents): New function.
2940         (Sized_relobj_file::do_discard_decompressed_sections): New function.
2941
2942 2012-02-16  Cary Coutant  <ccoutant@google.com>
2943
2944         * testsuite/Makefile.am (initpri2): Add --ctors-in-init-array option.
2945         * testsuite/Makefile.in: Regenerate.
2946
2947 2012-02-14  Cary Coutant  <ccoutant@google.com>
2948
2949         * options.cc (General_options::finalize): Disallow -pie and -static.
2950
2951 2012-02-03  Doug Kwan  <dougkwan@google.com>
2952
2953         * arm.cc (Arm_relocate_functions::abs8,
2954         Arm_relocate_functions::abs16): Use
2955         Bits::has_signed_unsigned_overflow32.
2956         (Arm_relocate_functions::thm_abs8): Correct range of
2957         overflow check.
2958         * reloc.h (Bits class): Change minimum number of bits from 0 to 1
2959         in assertions.
2960
2961 2012-02-02  Doug Kwan  <dougkwan@google.com>
2962
2963         * arm.cc (Reloc_stub::stub_type_for_reloc): Use PIC stubs in all
2964         position independent outputs, not just shared objects.
2965
2966 2012-01-30  H.J. Lu  <hongjiu.lu@intel.com>
2967
2968         * configure.ac: Check if -fpic -mtls-dialect=gnu2 works.
2969         * configure: Regenerated.
2970
2971 2012-01-27  Ian Lance Taylor  <iant@google.com>
2972
2973         * reloc.h (Bits): New class with static functions, copied from
2974         namespace utils in arm.cc.
2975         * arm.cc (namespace utils): Remove.  Rewrite all uses to use Bits
2976         instead.
2977
2978 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2979
2980         * incremental.cc (write_info_blocks): Correct relocation offset.
2981
2982 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2983
2984         * x86_64.cc (Relocate::tls_gd_to_ie): Support x32.
2985         (Relocate::tls_gd_to_le): Likewise.
2986
2987 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2988
2989         * x86_64.cc (Scan::global): Support x32 IFUNC function pointer.
2990
2991 2012-01-27  H.J. Lu  <hongjiu.lu@intel.com>
2992
2993         * configure.ac: Check if -mcmodel=medium works.
2994         * configure: Regenerated.
2995
2996 2012-01-24  Cary Coutant  <ccoutant@google.com>
2997
2998         * int_encoding.cc (read_unsigned_LEB_128): Replaced with inline
2999         definition and ...
3000         (read_unsigned_LEB_128_x): ... this new function.
3001         (read_signed_LEB_128): Replaced with inline definition and ...
3002         (read_signed_LEB_128_x): ... this new function.
3003         * int_encoding.h  (read_unsigned_LEB_128_x): New function.
3004         (read_unsigned_LEB_128): Add inline definition.
3005         (read_signed_LEB_128_x): New function.
3006         (read_signed_LEB_128): Add inline definition.
3007         * testsuite/Makefile.am (leb128_unittest): New unit test.
3008         * testsuite/Makefile.in: Regenerate.
3009         * testsuite/leb128_unittest.cc: New unit test.
3010
3011 2012-01-23  Ian Lance Taylor  <iant@google.com>
3012
3013         PR gold/13617
3014         * i386.cc (Target_i386::do_code_fill): When using a jmp
3015         instruction, pad with nop instructions.
3016         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3017
3018 2012-01-22  H.J. Lu  <hongjiu.lu@intel.com>
3019
3020         * x86_64.cc (gc_process_relocs): Add typename on types used in
3021         template.
3022         (scan_relocs): Likewise.
3023         (relocate_section): Likewise.
3024         (apply_relocation): Likewise.
3025
3026 2012-01-10  H.J. Lu  <hongjiu.lu@intel.com>
3027
3028         * x86_64.cc (Scan::check_non_pic): Allow R_X86_64_32 for x32.
3029         (Scan::local): Use R_X86_64_RELATIVE relocation for R_X86_64_32
3030         under x32.
3031
3032 2012-01-09  H.J. Lu  <hongjiu.lu@intel.com>
3033
3034         * x86_64.cc: Initial support for x32.
3035
3036 2012-01-03  Cary Coutant  <ccoutant@google.com>
3037
3038         * gold/incremental.cc (Sized_incremental_binary::do_process_got_plt):
3039         Use abstract base class for GOT.
3040         * gold/output.h (class Output_data_got_base): New abstract base class.
3041         (class Output_data_got): Derive from new base class, adjust ctors.
3042         (Output_data_got::reserve_slot): Make virtual; rename to
3043         do_reserve_slot; Adjust callers.
3044         * gold/target.h (Sized_target::init_got_plt_for_update): Return
3045         pointer to abstract base class.
3046         * gold/x86_64.cc (Target_x86_64::init_got_plt_for_update): Likewise.
3047
3048 2011-12-18  Ian Lance Taylor  <iant@google.com>
3049
3050         * object.h (Relobj::local_symbol_value): New function.
3051         (Relobj::local_plt_offset): New function.
3052         (Relobj::local_has_got_offset): New function.
3053         (Relobj::local_got_offset): New function.
3054         (Relobj::set_local_got_offset): New function.
3055         (Relobj::do_local_symbol_value): New pure virtual function.
3056         (Relobj::do_local_plt_offset): Likewise.
3057         (Relobj::do_local_has_got_offset): Likewise.
3058         (Relobj::do_local_got_offset): Likewise.
3059         (Relobj::do_set_local_got_offset): Likewise.
3060         (Sized_relobj::do_local_has_got_offset): Rename from
3061         local_has_got_offset.
3062         (Sized_relobj::do_local_got_offset): Rename from local_got_offset.
3063         (Sized_relobj::do_set_local_got_offset): Rename from
3064         set_local_got_offset.
3065         (Sized_relobj_file::do_local_plt_offset): Rename from
3066         local_plt_offset.
3067         (Sized_relobj_file::do_local_symbol_value): New function.
3068         * object.cc (Sized_relobj_file::do_local_plt_offset): Rename from
3069         local_plt_offset.
3070         * output.cc (Output_data_got::Got_entry::write): Change object to
3071         Relobj.  Use local_symbol_value.
3072         (Output_data_got::add_global_with_rel): Change rel_dyn to
3073         Output_data_reloc_generic*.  Use add_global_generic.
3074         (Output_data_got::add_global_with_rela): Remove.  Change all
3075         callers to use add_global_with_rel.
3076         (Output_data_got::add_global_pair_with_rel): Change rel_dyn to
3077         Output_data_reloc_generic*.  Use add_global_generic.
3078         (Output_data_got::add_global_pair_with_rela): Remove.  Change all
3079         callers to use add_global_pair_with_rel.
3080         (Output_data_got::add_local): Change object to Relobj*.
3081         (Output_data_got::add_local_plt): Likewise.
3082         (Output_data_got::add_local_with_rel): Change object to Relobj*,
3083         change rel_dyn to Output_data_reloc_generic*.  Use
3084         add_local_generic.
3085         (Output_data_got::add_local_with_rela): Remove.  Change all
3086         callers to use all_local_with_rel.
3087         (Output_data_got::add_local_pair_with_rel): Change object to
3088         Relobj*, change rel_dyn to Output_data_reloc_generic*.  Use
3089         add_output_section_generic.
3090         (Output_data_got::add_local_pair_with_rela): Remove.  Change all
3091         callers to use add_local_pair_with_rel.
3092         (Output_data_got::reserve_local): Change object to Relobj*.
3093         * output.h: (class Output_data_reloc_generic): Add pure virtual
3094         declarations for add_global_generic, add_local_generic,
3095         add_output_section_generic.
3096         (class Output_data_reloc) [SHT_REL, SHT_RELA]: Implement new
3097         functions for Output_data_reloc_generic.  Update declarations for
3098         changes listed in output.cc.
3099         (class Output_data_got): Change template parameter to got_size.
3100         Don't define Rel_dyn or Rela_dyn.  Update declarations per above.
3101         * incremental.h (Sized_relobj_incr::do_local_symbol_value): New
3102         function.
3103         (Sized_relobj_incr::do_local_plt_offset): New function.
3104         * copy-relocs.cc (Copy_relocs::Copy_reloc_entry::emit): Call
3105         add_global_generic.
3106
3107 2011-12-17  Cary Coutant  <ccoutant@google.com>
3108
3109         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Add casts.
3110         * resolve.cc (Symbol_table::resolve): Likewise.
3111         * i386.cc (Target_i386::do_code_fill): Use char constants for nop
3112         arrays.
3113         * x86_64.cc (Target_x86_64::do_code_fill): Likewise.
3114
3115 2011-12-16  Ian Lance Taylor  <iant@google.com>
3116
3117         * output.h (Output_data_reloc_generic::add): Only call
3118         add_dynamic_reloc if this is a dynamic reloc section.
3119
3120 2011-12-15  H.J. Lu  <hongjiu.lu@intel.com>
3121
3122         PR gold/13505
3123         * target-reloc.h (apply_relocation): Replace <64, false> with
3124         <size, big_endian>.
3125
3126 2011-11-25  Nick Clifton  <nickc@redhat.com>
3127
3128         * po/it.po: New Italian translation.
3129
3130 2011-11-17  Sterling Augustine  <saugustine@google.com>
3131
3132         * script.cc (script_include_directive): Implement.
3133         (read_script_file): New local variables name and search_path. Update
3134         comment. Call IS_ABSOLUTE_PATH and Dirsearch::find_file_in_dir_list.
3135         * dirsearch.h (Dirsearch::find_file_in_dir_list): Declare new method.
3136         * dirsearch.cc (Dirsearch::find_file_in_dir_list): Implement it.
3137
3138 2011-11-11  Sterling Augustine  <saugustine@google.com>
3139
3140         * yyscript.y (section_cmd): Add support for INCLUDE directive.
3141         (file_or_sections_cmd): Likewise.
3142
3143 2011-11-11  Doug Kwan  <dougkwan@google.com>
3144
3145         * arm.cc (Target_arm::do_make_elf_object): Allow executable also
3146         if --just-symbols is given.
3147
3148 2011-11-10  Doug Kwan  <dougkwan@google.com>
3149
3150         PR gold/13362
3151         * arm.cc (Target_arm::Relocate::relocate_tls): Do unaligned accesses
3152         when processing data relocs.
3153         * reloc.h (Relocate_functions::rel_unaligned): New method.
3154         (Relocate_functions::pcrel_unaligned): Ditto.
3155         (Relocate_functions::rel32_unaligned): Ditto.
3156         (Relocate_functions::pcrel32_unaligned): Ditto.
3157
3158 2011-11-09  Doug Kwan  <dougkwan@google.com>
3159
3160         PR gold/13362
3161         * arm.cc (Arm_scan_relocatable_relocs::Default_scan_relocatable_relocs):
3162         Use unaligned 4-byte relocs for static 32-bit data as required by EABI.
3163         * reloc.h (Relocatable_relocs::Reloc_strategy): New enum
3164         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3165         (Relocate_functions::rel_unaligned): New.
3166         (Relocate_functions::rel32_unaligned): New.
3167         * target-reloc.h (relocate_for_relocatable): Add code to handle
3168         RELOC_ADJUST_FOR_SECTION_4_UNALIGNED.
3169         * testsuite/Makefile.am (arm_unaligned_reloc_r.stdout,
3170         arm_unaligned_reloc_r): New targets.
3171         * testsuite/Makefile.in: Regenerate.
3172         * arm_unaligned_reloc.sh: Check unaligned relocs in relocatable
3173         linking.
3174
3175 2011-11-02  Ian Lance Taylor  <iant@google.com>
3176
3177         * configure.ac: Add --with-lib-path option.  Define LIB_PATH and
3178         NATIVE_LINKER.
3179         * Makefile.am (AM_CPPFLAGS): Define TOOLLIBDIR.
3180         * options.cc (General_options::finalize): Use library search path
3181         from configure script if specified.  If not native and no sysroot,
3182         only search TOOLLIBDIR.
3183         * options.h (Search_directory::Search_directory): Change name to
3184         const std::string&.
3185         (General_options::add_to_library_path_with_sysroot): Change arg to
3186         const std::string&.
3187         * configure, Makefile.in, config.in: Rebuild.
3188
3189 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3190
3191         * arm.cc (Target_arm::may_use_v5t_interworking): Check whether
3192         we are working around the ARM1176 Erratum.
3193         * options.h (General_options::fix_arm1176): Add option.
3194         * testsuite/Makefile.am: Add testcases, and keep current ones
3195         working.
3196         * testsuite/Makefile.in: Regenerate.
3197         * testsuite/arm_fix_1176.s: New file.
3198         * testsuite/arm_fix_1176.sh: Likewise.
3199
3200 2011-11-02  Matthew Gretton-Dann  <matthew.gretton-dann@arm.com>
3201
3202         * arm.cc (Target_arm::Target_arm): Remove initialisation of
3203         may_use_blx_.
3204         (Target_arm::may_use_blx): Remove method.
3205         (Target_arm::set_may_use_blx): Likewise.
3206         (Target_arm::may_use_v4t_interworking): New method.
3207         (Target_arm::may_use_v5t_interworking): Likewise.
3208         (Target_arm::may_use_blx_): Remove member variable.
3209         (Arm_relocate_functions::arm_branch_common): Check for v5T
3210         interworking.
3211         (Arm_relocate_functions::thumb_branch_common): Likewise.
3212         (Reloc_stub::stub_type_for_reloc): Likewise.
3213         (Target_arm::do_finalize_sections): Correct interworking checks.
3214         * testsuite/Makefile.am: Add new tests.
3215         * testsuite/Makefile.in: Regenerate.
3216         * testsuite/arm_farcall_arm_arm.s: New test.
3217         * testsuite/arm_farcall_arm_arm.sh: Likewise.
3218         * testsuite/arm_farcall_arm_thumb.s: Likewise.
3219         * testsuite/arm_farcall_arm_thumb.sh: Likewise.
3220         * testsuite/arm_farcall_thumb_arm.s: Likewise.
3221         * testsuite/arm_farcall_thumb_arm.sh: Likewise.
3222         * testsuite/arm_farcall_thumb_thumb.s: Likewise.
3223         * testsuite/arm_farcall_thumb_thumb.sh: Likewise.
3224
3225 2011-10-31  Cary Coutant  <ccoutant@google.com>
3226
3227         PR gold/13023
3228         * expression.cc (Expression::eval_with_dot): Add
3229         is_section_dot_assignment parameter.
3230         (Expression::eval_maybe_dot): Likewise.  Adjust value when rhs is
3231         absolute and assigning to dot within a section.
3232         * script-sections.cc
3233         (Output_section_element_assignment::set_section_addresses): Pass
3234         dot_section to set_if_absolute.
3235         (Output_section_element_dot_assignment::finalize_symbols): Pass TRUE
3236         as is_section_dot_assignment flag to eval_with_dot.
3237         (Output_section_element_dot_assignment::set_section_addresses):
3238         Likewise.
3239         * script.cc (Symbol_assignment::set_if_absolute): Add dot_section
3240         parameter.  Also set value if relative to dot_section; set the
3241         symbol's output_section.
3242         * script.h (Expression::eval_with_dot): Add is_section_dot_assignment
3243         parameter.  Adjust all callers.
3244         (Expression::eval_maybe_dot): Likewise.
3245         (Symbol_assignment::set_if_absolute): Add dot_section parameter.
3246         Adjust all callers.
3247         * testsuite/script_test_2.t: Test assignment of an absolute value
3248         to dot within an output section element.
3249
3250 2011-10-31  Cary Coutant  <ccoutant@google.com>
3251
3252         * options.h (class General_options): Add --[no-]gnu-unique options.
3253         * symtab.cc (Symbol_table::sized_write_globals): Convert
3254         STB_GNU_UNIQUE to STB_GLOBAL if --no-gnu-unique.
3255
3256 2011-10-31  Cary Coutant  <ccoutant@google.com>
3257
3258         PR gold/13359
3259         * i386.cc (Target_i386::Relocate::relocate_tls): Remove
3260         unnecessary assertion.
3261         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Likewise.
3262
3263 2011-10-31 Sriraman Tallam  <tmsriram@google.com>
3264
3265         * symtab.h (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3266         gc_mark_symbol.
3267         * symtab.cc (Symbol_table::gc_mark_symbol_for_shlib): Rename to
3268         gc_mark_symbol.
3269         Change to just keep the section associated with symbol.
3270         (Symbol_table::add_from_relobj): Mark symbols as not garbage when
3271         they are externally visible and --export-dynamic is turned on.
3272         (Symbol_table::gc_mark_dyn_syms): Call gc_mark_symbol.
3273
3274 2011-10-19  Ian Lance Taylor  <iant@google.com>
3275
3276         PR gold/13163
3277         * script-sections.cc
3278         (Output_section_element_dot_assignment::needs_output_section): New
3279         function.
3280
3281 2011-10-19  Ian Lance Taylor  <iant@google.com>
3282
3283         PR gold/13204
3284         * layout.cc (Layout::segment_precedes): Don't assert failure if a
3285         --section-start option was seen.
3286         * options.h (General_options::any_section_start): New function.
3287
3288 2011-10-18  David S. Miller  <davem@davemloft.net>
3289
3290         PR binutils/13301
3291         * sparc.cc (Target_sparc::Relocate::reloc_adjust_addr_): New
3292         member to track relocation locations that have moved during TLS
3293         reloc optimizations.
3294         (Target_sparc::Relocate::Relocate): Initialize to NULL.
3295         (Target_sparc::Relocate::relocate): Adjust view down by 4
3296         bytes if it matches reloc_adjust_addr_.
3297         (Target_sparc::Relocate::relocate_tls): Always move the
3298         __tls_get_addr call delay slot instruction forward 4 bytes when
3299         performing relaxation.
3300
3301 2011-10-18  Cary Coutant  <ccoutant@google.com>
3302
3303         * output.cc (posix_fallocate): Return 0 on success, errno on failure.
3304         (Output_file::map_no_anonymous): Check for non-zero
3305         return code from posix_fallocate.
3306
3307 2011-10-17  Cary Coutant  <ccoutant@google.com>
3308
3309         PR gold/13245
3310         * plugin.cc (is_visible_from_outside): Check for symbols
3311         referenced from dynamic objects.
3312         * resolve.cc (Symbol_table::resolve): Don't count references
3313         from dynamic objects as references from real ELF files.
3314         * testsuite/plugin_test_2.sh: Adjust expected result.
3315
3316 2011-10-17  Cary Coutant  <ccoutant@google.com>
3317
3318         * gold.cc: Include timer.h.
3319         (queue_middle_tasks): Stamp time.
3320         (queue_final_tasks): Likewise.
3321         * main.cc (main): Store timer in parameters.  Print timers
3322         for each pass.
3323         * parameters.cc (Parameters::Parameters): Initialize timer_.
3324         (Parameters::set_timer): New function.
3325         (set_parameters_timer): New function.
3326         * parameters.h (Parameters::set_timer): New function.
3327         (Parameters::timer): New function.
3328         (Parameters::timer_): New data member.
3329         (set_parameters_timer): New function.
3330         * timer.cc (Timer::stamp): New function.
3331         (Timer::get_pass_time): New function.
3332         * timer.h (Timer::stamp): New function.
3333         (Timer::get_pass_time): New function.
3334         (Timer::pass_times_): New data member.
3335
3336 2011-10-17  Cary Coutant  <ccoutant@google.com>
3337
3338         * readsyms.cc (Read_symbols::run): Don't queue an unblocker
3339         task for members of lib groups.
3340
3341 2011-10-17  Cary Coutant  <ccoutant@google.com>
3342
3343         PR gold/13288
3344         * fileread.cc (File_read::find_view): Add assert.
3345         (File_read::make_view): Move bounds check (replace with assert)...
3346         (File_read::find_or_make_view): ... to here.
3347
3348 2011-10-12  Cary Coutant  <ccoutant@google.com>
3349
3350         * output.cc (Output_file::open_base_file): Handle case where
3351         ::read returns less than requested size.
3352
3353 2011-10-10  Cary Coutant  <ccoutant@google.com>
3354
3355         * incremental.cc (Sized_relobj_incr::Sized_relobj_incr):
3356         Initialize defined_count_.
3357         (Sized_relobj_incr::do_add_symbols): Count defined symbols.
3358         (Sized_relobj_incr::do_get_global_symbol_counts): Rewrite.
3359         (Sized_incr_dynobj::Sized_incr_dynobj): Initialize defined_count_.
3360         (Sized_incr_dynobj::do_add_symbols): Count defined symbols.
3361         (Sized_incr_dynobj::do_get_global_symbol_counts): Rewrite.
3362         * incremental.h (Sized_relobj_incr::defined_count_): New data
3363         member.
3364         (Sized_incr_dynobj::defined_count_): New data member.
3365         * plugin.cc (Sized_pluginobj::do_get_global_symbol_counts):
3366         Return zeroes instead of internal error.
3367
3368 2011-10-10  Cary Coutant  <ccoutant@google.com>
3369
3370         PR gold/13249
3371         * output.cc (Output_reloc::Output_reloc): Add use_plt_offset flag.
3372         (Output_reloc::symbol_value): Return PLT offset if flag is set.
3373         * output.h (class Output_reloc): Add use_plt_offset flag.
3374         (Output_reloc::type_): Adjust size of bit field.
3375         (Output_reloc::use_plt_offset_): New bit field.
3376         (class Output_data_reloc): Adjust all calls to Output_reloc_type.
3377         (Output_data_reloc::add_local_relative): (RELA only) Add use_plt_offset
3378         flag.  Adjust all callers.
3379         * x86_64.cc (Target_x86_64::Scan::local): Check for IFUNC when
3380         creating RELATIVE relocations.
3381
3382 2011-10-10  Nick Clifton  <nickc@redhat.com>
3383
3384         * po/es.po: Updated Spanish translation.
3385         * po/fi.po: Updated Finnish translation.
3386
3387 2011-10-03   Diego Novillo  <dnovillo@google.com>
3388
3389         * options.cc (parse_uint): Fix dereference of RETVAL.
3390
3391 2011-09-29  Sriraman Tallam  <tmsriram@google.com>
3392
3393         * layout.h (section_order_map_): New member.
3394         (get_section_order_map): New member function.
3395         * output.cc (Output_section::add_input_section): Check for patterns
3396         only when --section-ordering-file is specified.
3397         * gold.cc (queue_middle_tasks): Delay updating order of sections till
3398         output_sections have been formed.
3399         * layout.cc (Layout_Layout): Initialize section_order_map_.
3400         * plugin.cc (update_section_order): Store order in order_map. Do not
3401         update the order.
3402         * testsuite/Makefile.am: Add test case for plugin_final_layout.
3403         * testsuite/Makefile.in: Regenerate.
3404         * testsuite/plugin_section_order.c: New file.
3405         * testsuite/plugin_final_layout.cc: New file.
3406         * testsuite/plugin_final_layout.sh: New file.
3407
3408 2011-09-29  Cary Coutant  <ccoutant@google.com>
3409
3410         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
3411         Check for NULL.
3412         * symtab.cc (Symbol_table::add_from_relobj): Ignore version
3413         symbols during incremental update.
3414         (Symbol_table::add_from_dynobj): Likewise.
3415
3416 2011-09-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
3417             Ian Lance Taylor  <iant@google.com>
3418
3419         * symtab.cc (Symbol_table::define_special_symbol): Always
3420         canonicalize version string.
3421
3422 2011-09-26  Cary Coutant  <ccoutant@google.com>
3423
3424         * gold.cc (queue_initial_tasks): Move option checks ...
3425         * options.cc (General_options::finalize): ... to here. Disable
3426         some options; make others fatal.
3427
3428 2011-09-26  Cary Coutant  <ccoutant@google.com>
3429
3430         gcc PR lto/47247
3431         * plugin.cc (get_symbols_v2): New function.
3432         (Plugin::load): Add LDPT_GET_SYMBOLS_V2.
3433         (is_referenced_from_outside): New function.
3434         (Pluginobj::get_symbol_resolution_info): Add version parameter, return
3435         LDPR_PREVAILING_DEF_IRONLY_EXP when using new version.
3436         (get_symbols): Pass version parameter.
3437         (get_symbols_v2): New function.
3438         * plugin.h (Pluginobj::get_symbol_resolution_info): Add version
3439         parameter.
3440         * testsuite/plugin_test.c (get_symbols_v2): New static variable.
3441         (onload): Add LDPT_GET_SYMBOLS_V2.
3442         (all_symbols_read_hook): Use get_symbols_v2; check for
3443         LDPR_PREVAILING_DEF_IRONLY_EXP.
3444         * testsuite/plugin_test_3.sh: Update expected results.
3445
3446 2011-09-23  Simon Baldwin  <simonb@google.com>
3447
3448         * configure.ac: Add new --with-gold-ldadd and --with-gold-ldflags
3449         configuration options.
3450         * configure: Regenerate.
3451         * Makefile.am: Handle GOLD_LDADD and GOLD_LDFLAGS.
3452         * Makefile.in: Regenerate.
3453         * testsuite/Makefile.in: Regenerate.
3454
3455 2011-09-19  Sriraman Tallam  <tmsriram@google.com>
3456
3457         * plugin.h (should_defer_layout): Modify to check for any_claimed_.
3458
3459 2011-09-19  Cary Coutant  <ccoutant@google.com>
3460
3461         * incremental.cc (can_incremental_update): Fix typo in comment.
3462         * incremental.h (can_incremental_update): Likewise.
3463
3464 2011-09-18  Cary Coutant  <ccoutant@google.com>
3465
3466         * incremental.cc (can_incremental_update): New function.
3467         * incremental.h (can_incremental_update): New function.
3468         * layout.cc (Layout::init_fixed_output_section): Call it.
3469         (Layout::make_output_section): Don't allow patch space in .eh_frame.
3470         * object.cc (Sized_relobj_file::do_layout): Call
3471         can_incremental_update.
3472
3473 2011-09-13  Cary Coutant  <ccoutant@google.com>
3474
3475         * configure.ac: Check for glibc support for gnu_indirect_function
3476         support with static linking, setting automake conditional
3477         IFUNC_STATIC.
3478         * Makefile.in: Regenerate.
3479         * configure: Regenerate.
3480
3481         * testsuite/Makefile.am (ifuncmain1static, ifuncmain2static)
3482         (ifuncmain4static, ifuncmain5static, ifuncmain7static): Add check
3483         for IFUNC_STATIC.
3484         * testsuite/Makefile.in: Regenerate.
3485
3486 2011-09-13  Cary Coutant  <ccoutant@google.com>
3487
3488         * incremental.cc (Sized_relobj_incr::do_layout): Call
3489         report_comdat_group for kept comdat sections.
3490         * testsuite/Makefile.am (incremental_comdat_test_1): New test.
3491         * testsuite/Makefile.in: Regenerate.
3492         * testsuite/incr_comdat_test_1.cc: New source file.
3493         * testsuite/incr_comdat_test_2_v1.cc: New source file.
3494         * testsuite/incr_comdat_test_2_v2.cc: New source file.
3495         * testsuite/incr_comdat_test_2_v3.cc: New source file.
3496
3497 2011-09-13  Ian Lance Taylor  <iant@google.com>
3498
3499         * object.cc (Sized_relobj_file::do_layout): Remove unused local
3500         variable external_symbols_offset.
3501
3502 2011-09-12  Ian Lance Taylor  <iant@google.com>
3503
3504         * object.cc (Sized_relobj_file::do_layout): Remove assertion which
3505         triggered if object has no symbols.
3506
3507 2011-09-09  David S. Miller  <davem@davemloft.net>
3508
3509         * output.cc (Output_fill_debug_info::do_write): Use Swap_unaligned.
3510         (Output_fill_debug_line::do_write): Likewise.
3511
3512 2011-08-29  Cary Coutant  <ccoutant@google.com>
3513
3514         * output.cc: (Output_fill_debug_info::do_minimum_hole_size): Add
3515         casts to match formatting specs.
3516         (Output_fill_debug_line::do_minimum_hole_size): Likewise.
3517
3518 2011-08-26  Cary Coutant  <ccoutant@google.com>
3519
3520         * layout.cc (Free_list::allocate): Provide guarantee of minimum
3521         remaining hole size when allocating.
3522         (Layout::make_output_section): Set fill methods for debug sections.
3523         * layout.h (Free_list::Free_list_node): Move from private to
3524         public.
3525         (Free_list::set_min_hole_size): New function.
3526         (Free_list::begin, Free_list::end): New functions.
3527         (Free_list::min_hole_): New data member.
3528         * output.cc: Include dwarf.h.
3529         (Output_fill_debug_info::do_minimum_hole_size): New function.
3530         (Output_fill_debug_info::do_write): New function.
3531         (Output_fill_debug_line::do_minimum_hole_size): New function.
3532         (Output_fill_debug_line::do_write): New function.
3533         (Output_section::Output_section): Initialize new data member.
3534         (Output_section::set_final_data_size): Ensure patch space is larger
3535         than minimum hole size.
3536         (Output_section::do_write): Fill holes in debug sections.
3537         * output.h (Output_fill): New class.
3538         (Output_fill_debug_info): New class.
3539         (Output_fill_debug_line): New class.
3540         (Output_section::set_free_space_fill): New function.
3541         (Output_section::free_space_fill_): New data member.
3542         * testsuite/Makefile.am (incremental_test_3): Add
3543         --incremental-patch option.
3544         (incremental_test_4): Likewise.
3545         (incremental_test_5): Likewise.
3546         (incremental_test_6): Likewise.
3547         (incremental_copy_test): Likewise.
3548         (incremental_common_test_1): Likewise.
3549         * testsuite/Makefile.in: Regenerate.
3550
3551 2011-08-26  Nick Clifton  <nickc@redhat.com>
3552
3553         * po/es.po: Updated Spanish translation.
3554
3555 2011-08-01  Cary Coutant  <ccoutant@google.com>
3556
3557         * gold/testsuite/Makefile.am (justsyms_exec): New testcase.
3558         * gold/testsuite/Makefile.in: Regenerate.
3559         * gold/testsuite/justsyms_exec.c: New source file.
3560         * gold/testsuite/justsyms_lib.c: New source file.
3561
3562 2011-08-01  Cary Coutant  <ccoutant@google.com>
3563
3564         * layout.cc (Layout::set_segment_offsets): Don't realign text
3565         segment if -Ttext was specified.
3566         * object.cc (Sized_relobj_file::Sized_relobj_file): Store the ELF
3567         file type.
3568         * object.h (Sized_relobj_file::e_type): New function.
3569         (Sized_relobj_file::e_type_): New data member.
3570         * symtab.cc (Symbol_table::add_from_relobj): Don't add section
3571         base address for ET_EXEC files.
3572         * target.cc (Target::do_make_elf_object_implementation): Allow
3573         ET_EXEC files with --just-symbols option.
3574
3575 2011-07-28  Cary Coutant  <ccoutant@google.com>
3576
3577         * workqueue-internal.h (Workqueue_threader::should_cancel_thread):
3578         Add thread_number parameter.
3579         (Workqueue_threader_threadpool::should_cancel_thread): Likewise.
3580         * workqueue-threads.cc
3581         (Workqueue_threader_threadpool::should_cancel_thread): Cancel
3582         current thread if its thread number is greater than desired thread
3583         count.
3584         * workqueue.cc (Workqueue_threader_single::should_cancel_thread):
3585         Add thread_number parameter.
3586         (Workqueue::should_cancel_thread): Likewise.
3587         (Workqueue::find_runnable_or_wait): Pass thread_number to
3588         should_cancel_thread.
3589         * workqueue.h (Workqueue::should_cancel_thread): Add thread_number
3590         parameter.
3591
3592 2011-07-22  Sriraman Tallam  <tmsriram@google.com>
3593
3594         * symtab.cc (Symbol_table::add_from_relobj): Mark symbol as referenced
3595         only after checking if it cannot be forced local.
3596         * symtab.h (is_externally_visible): Check if the symbol is not forced
3597         local.
3598
3599 2011-07-15  Ian Lance Taylor  <iant@google.com>
3600
3601         * options.h (class General_options): Add --print-output-format.
3602         Move -EL next to -EB, for  better --help output.
3603         * target-select.cc: Include <cstdio>, "options.h", and
3604         "parameters.h".
3605         (Target_selector::do_target_bfd_name): New function.
3606         (print_output_format): New function.
3607         * target-select.h (class Target_selector): Update declarations.
3608         (Target_selector::target_bfd_name): New function.
3609         (print_output_format): Declare.
3610         * main.cc: Include "target-select.h".
3611         (main): Handle --print-output-format.
3612         * gold.cc: Include "target-select.h".
3613         (queue_initial_tasks): Handle --print-output-format when there are
3614         no input files.
3615         * parameters.cc (parameters_force_valid_target): Give a better
3616         error message if -EB/-EL does not match target.
3617         * freebsd.h (Target_selector_freebsd::do_target_bfd_name): New
3618         function.
3619
3620 2011-07-15  Ian Lance Taylor  <iant@google.com>
3621
3622         * i386.cc (class Output_data_plt_i386): Add layout_ field.
3623         (Output_data_plt_i386::Output_data_plt_i386): Initialize layout_.
3624         (Output_data_plt_i386::do_write): Write address of .dynamic
3625         section to first entry in .got.plt section.
3626         * x86_64.cc (class Output_data_plt_x86_64): Add layout_ field.
3627         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3628         Initialize layout_.
3629         (Output_data_plt_x86_64::do_write): Write address of .dynamic
3630         section to first entry in .got.plt section.
3631         * layout.h (Layout::dynamic_section): New function.
3632
3633 2011-07-13  Sriraman Tallam  <tmsriram@google.com>
3634
3635         * archive.cc (Archive::get_elf_object_for_member): Add extra parameter
3636         to claim_file call.
3637         * layout.cc (Layout::Layout): Initialize section_ordering_specified_,
3638         input_section_position_, and input_section_glob_.
3639         (read_layout_from_file): Call function section_ordering_specified.
3640         * layout.h (is_section_ordering_specified): New function.
3641         (section_ordering_specified): New function.
3642         (section_ordering_specified_): New boolean member.
3643         * main.cc(main): Call load_plugins after layout object is defined.
3644         * output.cc (Output_section::add_input_section): Use
3645         function section_ordering_specified to check if section ordering is
3646         needed.
3647         * output.cc (Output_section::add_relaxed_input_section): Use
3648         function section_ordering_specified to check if section ordering is
3649         needed.
3650         (Output_section::update_section_layout): New function.
3651         (Output_section::sort_attached_input_sections): Check if input section
3652         must be reordered.
3653         * output.h (Output_section::update_section_layout): New function.
3654         * plugin.cc (get_section_count): New function.
3655         (get_section_type): New function.
3656         (get_section_name): New function.
3657         (get_section_contents): New function.
3658         (update_section_order): New function.
3659         (allow_section_ordering): New function.
3660         (Plugin::load): Add the new interfaces to the transfer vector.
3661         (Plugin_manager::load_plugins): New parameter.
3662         (Plugin_manager::all_symbols_read): New parameter.
3663         (Plugin_manager::claim_file): New parameter. Save the elf object for
3664         unclaimed objects.
3665         (Plugin_manager::get_elf_object): New function.
3666         (Plugin_manager::get_view): Change to directly use the bool to check
3667         if get_view is called from claim_file_hook.
3668         * plugin.h (input_objects): New function
3669         (Plugin__manager::load_plugins): New parameter.
3670         (Plugin_manager::claim_file): New parameter.
3671         (Plugin_manager::get_elf_object): New function.
3672         (Plugin_manager::in_claim_file_handler): New function.
3673         (Plugin_manager::in_claim_file_handler_): New member.
3674         (layout): New function.
3675         * readsyms.cc (Read_symbols::do_read_symbols): Call the claim_file
3676         handler with an extra parameter. Make the elf object before calling
3677         claim_file handler.
3678         * testsuite/plugin_test.c (get_section_count): New function pointer.
3679         (get_section_type): New function pointer.
3680         (get_section_name): New function pointer.
3681         (get_section_contents): New function pointer.
3682         (update_section_order): New function pointer.
3683         (allow_section_ordering): New function pointer.
3684         (onload): Check if the new interfaces exist.
3685
3686 2011-07-13  Ian Lance Taylor  <iant@google.com>
3687
3688         * i386.cc (Target_i386::got_section): If -z now, make .got.plt a
3689         relro section.
3690         * x86_64.cc (Target_x86_64::got_section): Likewise.
3691         * testsuite/Makefile.am (check_PROGRAMS): Add relro_now_test.
3692         (relro_now_test_SOURCES): New variable.
3693         (relro_now_test_DEPENDENCIES): New variable.
3694         (relro_now_test_LDFLAGS): New variable.
3695         (relro_now_test_LDADD): New variable.
3696         (relro_now_test.so): New target.
3697         * testsuite/Makefile.in: Rebuild.
3698
3699 2011-07-12  Ian Lance Taylor  <iant@google.com>
3700
3701         PR gold/12980
3702         * i386.cc (Target_i386::Scan::global): For a GOT reloc, use a
3703         GLOB_DAT relocation rather than a RELATIVE relocation for a
3704         protected symbol when creating a shared library.
3705         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
3706         * testsuite/protected_1.cc (f2, get_f2_addr): New functions.
3707         * testsuite/protected_main_1.cc (main): Test that protected
3708         function has same address.
3709
3710 2011-07-11  Ian Lance Taylor  <iant@google.com>
3711
3712         PR gold/12979
3713         * options.h (class General_options): Add -Bgroup.
3714         * options.cc (General_options::finalize): If -Bgroup is set,
3715         default to --unresolved-symbols=report-all.
3716         * layout.cc (Layout::finish_dynamic_section): Implement -Bgroup.
3717         * target-reloc.h (issue_undefined_symbol_error): Handle
3718         --unresolved-symbols=report-all.
3719
3720 2011-07-08  Ian Lance Taylor  <iant@google.com>
3721
3722         PR gold/11985
3723         * layout.cc (Layout::create_initial_dynamic_sections): Don't crash
3724         if linker script discards key sections.
3725         (Layout::create_dynamic_symtab): Likewise.
3726         (Layout::assign_local_dynsym_offsets): Likewise.
3727         (Layout::sized_create_version_sections): Likewise.
3728         (Layout::create_interp): Likewise.
3729         (Layout::finish_dynamic_section): Likewise.
3730         (Layout::set_dynamic_symbol_size): Likewise.
3731
3732 2011-07-08  Ian Lance Taylor  <iant@google.com>
3733
3734         PR gold/12386
3735         * options.h (class General_options): Add --unresolved-symbols.
3736         * target-reloc.h (issue_undefined_symbol_error): Check
3737         --unresolved-symbols.  Add comments.
3738
3739 2011-07-08  Ian Lance Taylor  <iant@google.com>
3740
3741         * testsuite/odr_violation2.cc (Ordering::operator()): Make
3742         expression more complex.
3743
3744 2011-07-08  Ian Lance Taylor  <iant@google.com>
3745
3746         PR gold/11317
3747         * target-reloc.h (issue_undefined_symbol_error): New inline
3748         function, broken out of relocate_section.
3749         (relocate_section): Call issue_undefined_symbol_error.
3750         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3751         there is no TLS segment if we are about to issue an undefined
3752         symbol error.
3753         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3754
3755 2011-07-08  Ian Lance Taylor  <iant@google.com>
3756
3757         PR gold/12279
3758         * resolve.cc (Symbol_table::should_override): Add fromtype
3759         parameter.  Change all callers.  Give error when linking together
3760         TLS and non-TLS symbol.
3761         (Symbol_table::should_override_with_special): Add fromtype
3762         parameter.  Change all callers.
3763         * i386.cc (Target_i386::Relocate::relocate_tls): Don't crash if
3764         there is no TLS segment if we have reported some errors.
3765         * x86_64.cc (Target_x86_64::relocate_tls): Likewise.
3766
3767 2011-07-08  Ian Lance Taylor  <iant@google.com>
3768
3769         PR gold/12372
3770         * target.h (Target::plt_address_for_global): New function.
3771         (Target::plt_address_for_local): New function.
3772         (Target::plt_section_for_global): Remove.
3773         (Target::plt_section_for_local): Remove.
3774         (Target::do_plt_address_for_global): New virtual function.
3775         (Target::do_plt_address_for_local): New virtual function.
3776         (Target::do_plt_section_for_global): Remove.
3777         (Target::do_plt_section_for_local): Remove.
3778         (Target::register_global_plt_entry): Add Symbol_table and Layout
3779         parameters.
3780         * output.cc (Output_data_got::Got_entry::write): Use
3781         plt_address_for_global and plt_address_for_local.
3782         * layout.cc (Layout::add_target_dynamic_tags): Use size and
3783         address of output section.
3784         * i386.cc (class Output_data_plt_i386): Add irelative_rel_,
3785         got_irelative_, and irelative_count_ fields.  Update
3786         declarations.
3787         (Output_data_plt_i386::has_irelative_section): New function.
3788         (Output_data_plt_i386::entry_count): Add irelative_count_.
3789         (Output_data_plt_i386::set_final_data_size): Likewise.
3790         (class Target_i386): Add got_irelative_ and rel_irelative_
3791         fields.  Update declarations.
3792         (Target_i386::Target_i386): Initialize new fields.
3793         (Target_i386::do_plt_address_for_global): New function replacing
3794         do_plt_section_for_global.
3795         (Target_i386::do_plt_address_for_local): New function replacing
3796         do_plt_section_for_local.
3797         (Target_i386::got_section): Create got_irelative_.
3798         (Target_i386::rel_irelative_section): New function.
3799         (Output_data_plt_i386::Output_data_plt_i386): Initialize new
3800         fields.  Don't define __rel_iplt_{start,end}.
3801         (Output_data_plt_i386::add_entry): Add symtab and layout
3802         parameters.  Change all callers.  Use different PLT and GOT for
3803         IFUNC symbols.
3804         (Output_data_plt_i386::add_local_ifunc_entry): Add symtab and
3805         layout parameters.  Change all callers.  Use different PLT and
3806         GOT.
3807         (Output_data_plt_i386::rel_tls_desc): Fix formatting.
3808         (Output_data_plt_i386::rel_irelative): New function.
3809         (Output_data_plt_i386::address_for_global): New function.
3810         (Output_data_plt_i386::address_for_local): New function.
3811         (Output_data_plt_i386::do_write): Write out IRELATIVE area.  Use
3812         IRELATIVE GOT when changing IFUNC GOT entries.
3813         (Target_i386::Scan::global): Use IRELATIVE GOT for IRELATIVE
3814         reloc.
3815         (Target_i386::do_finalize_sections): Create the __rel_iplt symbols
3816         if we didn't create an IRELATIVE GOT.
3817         (Target_i386::Relocate::relocate): Use plt_address_for_global and
3818         plt_address_for_local.
3819         (Target_i386::do_dynsym_value): Use plt_address_for_global.
3820         * x86_64.cc (class Output_data_plt_x86_64): Add irelative_rel_,
3821         got_irelative_, and irelative_count_ fields.  Update
3822         declarations.
3823         (Output_data_plt_x86_64::Output_data_plt_x86_64) [both versions]:
3824         Initialize new fields.  Remove symtab parameter.  Change all
3825         callers.
3826         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): Add
3827         irelative_count_.
3828         (Output_data_plt_x86_64::has_irelative_section): New function.
3829         (Output_data_plt_x86_64::entry_count): Add irelative_count_.
3830         (class Target_x86_64): Add got_irelative_ and rel_irelative_
3831         fields.  Update declarations.
3832         (Target_x86_64::Target_x86_64): Initialize new fields.
3833         (Target_x86_64::do_plt_address_for_global): New function replacing
3834         do_plt_section_for_global.
3835         (Target_x86_64::do_plt_address_for_local): New function replacing
3836         do_plt_section_for_local.
3837         (Target_x86_64::got_section): Create got_irelative_.
3838         (Target_x86_64::rela_irelative_section): New function.
3839         (Output_data_plt_x86_64::init): Remove symtab parameter.  Change
3840         all callers.  Don't create __rel_iplt_{start,end}.
3841         (Output_data_plt_x86_64::add_entry): Add symtab and layout
3842         parameters.  Change all callers.  Use different PLT and GOT for
3843         IFUNC symbols.
3844         (Output_data_plt_x86_64::add_local_ifunc_entry): Add symtab and
3845         layout parameters.  Change all callers.  Use different PLT and
3846         GOT.
3847         (Output_data_plt_x86_64::add_relocation): Add symtab and layout
3848         parameters.  Change all callers.  Use different PLT and GOT for
3849         IFUNC symbols.
3850         (Output_data_plt_x86_64::rela_tlsdesc): Fix formatting.
3851         (Output_data_plt_x86_64::rela_irelative): New function.
3852         (Output_data_plt_x86_64::address_for_global): New function.
3853         (Output_data_plt_x86_64::address_for_local): New function.
3854         (Output_data_plt_x86_64::set_final_data_size): Likewise.
3855         (Output_data_plt_x86_64::do_write): Write out IRELATIVE area.
3856         (Target_x86_64::init_got_plt_for_update): Create got_irelative_.
3857         (Target_x86_64::register_global_plt_entry): Add symtab and layout
3858         parameters.
3859         (Target_x86_64::Scan::global): Use IRELATIVE GOT for IRELATIVE
3860         reloc.
3861         (Target_x86_64::do_finalize_sections): Create the __rela_iplt
3862         symbols if we didn't create an IRELATIVE GOT.
3863         (Target_x86_64::Relocate::relocate): Use plt_address_for_global and
3864         plt_address_for_local.
3865         (Target_x86_64::do_dynsym_value): Use plt_address_for_global.
3866         * testsuite/ifuncvar1.c: New test file.
3867         * testsuite/ifuncvar2.c: New test file.
3868         * testsuite/ifuncvar3.c: New test file.
3869         * testsuite/Makefile.am (check_PROGRAMS): Add ifuncvar.
3870         (ifuncvar1_pic.o, ifuncvar2_pic.o, ifuncvar.so): New targets.
3871         (ifuncvar_SOURCES, ifuncvar_DEPENDENCIES): New variables.
3872         (ifuncvar_LDFLAGS, ifuncvar_LDADD): New variables.
3873         * testsuite/Makefile.in: Rebuild.
3874
3875 2011-07-07  Cary Coutant  <ccoutant@google.com>
3876
3877         * testsuite/Makefile.am (two_file_test_1_v1_ndebug.o): New target.
3878         (two_file_test_1_ndebug.o): Likewise.
3879         (two_file_test_1b_ndebug.o): Likewise.
3880         (two_file_test_2_ndebug.o): Likewise.
3881         (two_file_test_main_ndebug.o): Likewise.
3882         (incremental_test_2): Link with no-debug versions.
3883
3884 2011-07-06  Cary Coutant  <ccoutant@google.com>
3885
3886         * gold/incremental.cc
3887         (Output_section_incremental_inputs::write_info_blocks): Check for
3888         hidden and internal symbols.
3889
3890 2011-07-06  Cary Coutant  <ccoutant@google.com>
3891
3892         * incremental.cc (Sized_incremental_binary::do_file_has_changed):
3893         Check disposition for startup file.
3894         (Incremental_inputs::report_command_line): Ignore
3895         --incremental-startup-unchanged option.
3896         * options.cc (General_options::parse_incremental_startup_unchanged):
3897         New function.
3898         (General_options::General_options): Initialize new data member.
3899         * options.h (Incremental_disposition): Add INCREMENTAL_STARTUP.
3900         (General_options): Add --incremental-startup-unchanged option.
3901         (General_options::incremental_startup_disposition): New function.
3902         (General_options::incremental_startup_disposition_): New data member.
3903
3904 2011-07-06  Cary Coutant  <ccoutant@google.com>
3905
3906         * incremental.cc (Sized_incremental_binary::setup_readers): Pass
3907         input file index to Script_info ctor.
3908         (Sized_incremental_binary::do_file_has_changed): Find the
3909         command-line argument for files named in scripts.
3910         * incremental.h (Script_info::Script_info): New ctor
3911         with input file index.
3912         (Script_info::input_file_index): New function.
3913         (Script_info::input_file_index_): New data member.
3914         (Incremental_binary::get_library): Add const.
3915         (Incremental_binary::get_script_info): Add const.
3916         * readsyms.cc (Read_member::is_runnable): Check for this_blocker_.
3917         * testsuite/Makefile.am (incremental_test_5): New test case.
3918         (incremental_test_6): New test case.
3919         * testsuite/Makefile.in: Regenerate.
3920
3921 2011-07-06  Cary Coutant  <ccoutant@google.com>
3922
3923         * incremental.cc (Sized_incremental_binary::do_check_inputs): Add
3924         debug output when command lines differ.
3925
3926 2011-07-06  Cary Coutant  <ccoutant@google.com>
3927
3928         * incremental.cc (Incremental_inputs::report_command_line): Ignore
3929         --incremental-patch option.
3930         * layout.cc (Free_list::allocate): Extend allocation beyond original
3931         end if enabled.
3932         (Layout::make_output_section): Mark sections that should get
3933         patch space.
3934         * options.cc (parse_percent): New function.
3935         * options.h (parse_percent): New function.
3936         (DEFINE_percent): New macro.
3937         (General_options): Add --incremental-patch option.
3938         * output.cc (Output_section::Output_section): Initialize new data
3939         members.
3940         (Output_section::add_input_section): Print section name when out
3941         of patch space.
3942         (Output_section::add_output_section_data): Likewise.
3943         (Output_section::set_final_data_size): Add patch space when
3944         doing --incremental-full.
3945         (Output_section::do_reset_address_and_file_offset): Remove patch
3946         space.
3947         (Output_segment::set_section_list_addresses): Print debug output
3948         only if --incremental-update.
3949         * output.h (Output_section::set_is_patch_space_allowed): New function.
3950         (Output_section::is_patch_space_allowed_): New data member.
3951         (Output_section::patch_space_): New data member.
3952         * parameters.cc (Parameters::incremental_full): New function.
3953         * parameters.h (Parameters::incremental_full): New function
3954         * testsuite/Makefile.am (incremental_test_2): Add test for
3955         --incremental-patch option.
3956         * testsuite/Makefile.in: Regenerate.
3957         * testsuite/two_file_test_1_v1.cc (t1, t2, t3): Add comments.
3958         (t18): Remove function body.
3959
3960 2011-07-05  Doug Kwan  <dougkwan@google.com>
3961
3962         PR gold/12771
3963         * arm.cc (Arm_relocate_functions::abs8): Use int32_t for addend and
3964         Arm_Address type for relocation result.
3965         (Arm_relocate_functions::abs16): Use unaligned access.  Also fix
3966         overflow check.
3967         (Arm_relocate_functions::abs32): Use unaligned access.
3968         (Arm_relocate_functions::rel32): Ditto.
3969         (Arm_relocate_functions::prel31): Ditto.
3970         (Arm_exidix_cantunwind::do_fixed_endian_write): Ditto.
3971         * testsuite/Makefile.am: Add new test arm_unaligned_reloc for unaligned
3972         static data relocations.
3973         * testsuite/Makefile.in: Regnerate.
3974         * testsuite/arm_unaligned_reloc.{s,sh}: New files.
3975
3976 2011-07-05  Ian Lance Taylor  <iant@google.com>
3977
3978         PR gold/12392
3979         * i386.cc (Target_i386::do_finalize_sections): Define __rel_iplt
3980         symbols if necessary.
3981         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
3982
3983 2011-07-05  Ian Lance Taylor  <iant@google.com>
3984
3985         PR gold/12952
3986         * resolve.cc (Symbol::override_base_with_special): Simply override
3987         version with special symbol version, ignoring previous version.
3988
3989 2011-07-05  Ian Lance Taylor  <iant@google.com>
3990
3991         * object.cc (Sized_relobj_file::include_section_group): Add
3992         information to comment about signature location.
3993
3994 2011-07-02  Ian Lance Taylor  <iant@google.com>
3995
3996         PR gold/12957
3997         * options.h (class General_options): Add -f and -F.
3998         * options.cc (General_options::finalize): Fatal error if -f/-F
3999         are used without -shared.
4000         * layout.cc (Layout::finish_dynamic_section): Implement -f/-F.
4001
4002 2011-07-02  Ian Lance Taylor  <iant@google.com>
4003
4004         * dirsearch.cc (Dir_cache::read_files): Ignore ENOTDIR errors.
4005
4006 2011-07-01  Ian Lance Taylor  <iant@google.com>
4007
4008         PR gold/12525
4009         PR gold/12952
4010         * resolve.cc (Symbol::override_base_with_special): Don't override
4011         the version if the overriding symbol has a different name.
4012         * dynobj.cc (Versions::add_def): Add dynpool parameter.  Change
4013         all callers.  If we give an error about an undefined version,
4014         define the base version if necessary.
4015         * dynobj.h (class Versions): Update declaration.
4016         * testsuite/weak_alias_test_5.cc: New file.
4017         * testsuite/weak_alias_test.script: New file.
4018         * testsuite/weak_alias_test_main.cc: Check that versioned_symbol
4019         and versioned_alias have the right value, and call t2.
4020         * testsuite/Makefile.am (weak_alias_test_DEPENDENCIES): Add
4021         weak_alias_test_5.so.
4022         (weak_alias_test_LDADD): Likewise.
4023         (weak_alias_test_5_pic.o, weak_alias_test_5.so): New targets.
4024         * testsuite/Makefile.in: Rebuild.
4025
4026 2011-07-01  Ian Lance Taylor  <iant@google.com>
4027
4028         PR gold/12525
4029         * options.h (class General_options): Support -z notext.
4030         * testsuite/Makefile.am (two_file_shared_1_nonpic.so): Use
4031         -Wl,-z,notext.
4032         (two_file_shared_nonpic.so): Likewise.
4033         (two_file_shared_mixed.so): Likewise.
4034         (two_file_shared_mixed_1.so): Likewise.
4035         (weak_undef_lib_nonpic.so): Likewise.
4036         (alt/weak_undef_lib_nonpic.so): Likewise.
4037         (tls_test_shared_nonpic.so): Likewise.
4038         * testsuite/Makefile.in: Rebuild.
4039
4040 2011-07-01  Ian Lance Taylor  <iant@google.com>
4041
4042         PR gold/12525
4043         * configure.ac: Test whether static linking works, setting
4044         the automake conditional HAVE_STATIC.
4045         * testsuite/Makefile.am: Disable tests using -static if
4046         HAVE_STATIC is not true.
4047         * configure, testsuite/Makefile.in: Rebuild.
4048
4049 2011-07-01  Ian Lance Taylor  <iant@google.com>
4050
4051         PR gold/12525
4052         * ehframe.cc (Eh_frame_hdr::get_fde_pc): Handle DW_EH_PE_datarel.
4053         Assert if we see DW_EH_PE_indirect.
4054         * target.h (Target::ehframe_datarel_base): New function.
4055         (Target::do_ehframe_datarel_base): New target function.
4056         * i386.cc (Target_i386::do_ehframe_datarel_base): New function.
4057         * x86_64.cc (Target_x86_64::do_ehframe_datarel_base): New
4058         function.
4059
4060 2011-07-01  Ian Lance Taylor  <iant@google.com>
4061
4062         PR gold/12571
4063         * options.h (class General_options): Add
4064         --ld-generated-unwind-info.
4065         * ehframe.cc (Fde::write): Add address parameter.  Change all
4066         callers.  If associated with PLT, fill in address and size.
4067         (Cie::set_output_offset): Only add merge mapping if there is an
4068         object.
4069         (Cie::write): Add address parameter.  Change all callers.
4070         (Eh_frame::add_ehframe_for_plt): New function.
4071         * ehframe.h (class Fde): Update declarations.  Move shndx_ and
4072         input_offset_ fields into union u_, with new plt field.
4073         (Fde::Fde): Adjust for new union field.
4074         (Fde::Fde) [Output_data version]: New constructor.
4075         (Fde::add_mapping): Only add merge mapping if there is an object.
4076         (class Cie): Update declarations.
4077         (class Eh_frame): Declare add_ehframe_for_plt.
4078         * layout.cc (Layout::layout_eh_frame): Break out code into
4079         make_eh_frame_section, and call it.
4080         (Layout::make_eh_frame_section): New function.
4081         (Layout::add_eh_frame_for_plt): New function.
4082         * layout.h (class Layout): Update declarations.
4083         * merge.cc (Merge_map::add_mapping): Add assertion.
4084         * i386.cc: Include "dwarf.h".
4085         (class Output_data_plt_i386): Make first_plt_entry,
4086         dyn_first_plt_entry, exec_plt_entry, and dyn_plt_entry const.  Add
4087         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4088         and plt_eh_frame_fde.
4089         (Output_data_plt_i386::Output_data_plt_i386): Align to 16-byte
4090         boundary.  Call add_eh_frame_for_plt if appropriate.
4091         * x86_64.cc: Include "dwarf.h".
4092         (class Output_data_plt_x86_64): Align to 16-byte boundary.  Make
4093         first_plt_entry, plt_entry and tlsdesc_plt_entry const.  Add
4094         plt_eh_frame_cie_size, plt_eh_frame_fde_size, plt_eh_frame_cie,
4095         and plt_eh_frame_fde.
4096         (Output_data_plt_x86_64::init): Call add_eh_frame_for_plt if
4097         appropriate.
4098
4099 2011-06-29  Ian Lance Taylor  <iant@google.com>
4100
4101         PR gold/12629
4102         * object.cc (Sized_relobj_file::layout_section): Change shdr
4103         parameter to be const.
4104         (Sized_relobj_file::layout_eh_frame_section): New function, broken
4105         out of do_layout.
4106         (Sized_relobj_file::do_layout): Defer .eh_frame sections if
4107         appropriate.  Call layout_eh_frame_section.
4108         (Sized_relobj_file::do_layout_deferred_sections): Handle .eh_frame
4109         sections.
4110         * object.h (class Sized_relobj_file): Update declarations.
4111
4112 2011-06-29  Ian Lance Taylor  <iant@google.com>
4113
4114         PR gold/12652
4115         * script.cc (Token::integer_value): Accept trailing M/m/K/k
4116         modifier.
4117         (Lex::gather_token): Accept trailing M/m/K/k for integers.
4118
4119 2011-06-29  Ian Lance Taylor  <iant@google.com>
4120
4121         PR gold/12675
4122         * object.cc (Sized_relobj_file::check_eh_frame_flags): Check for
4123         SHT_X86_64_UNWIND.
4124         * layout.cc (Layout::layout_eh_frame): Likewise.
4125
4126 2011-06-29  Ian Lance Taylor  <iant@google.com>
4127
4128         PR gold/12695
4129         * layout.cc (Layout::symtab_section_shndx): New function.
4130         * layout.h (class Layout): Declare symtab_section_shndx.
4131         * output.cc (Output_section::write_header): Call it.
4132
4133 2011-06-29  Ian Lance Taylor  <iant@google.com>
4134
4135         PR gold/12818
4136         * symtab.cc (Symbol::should_add_dynsym_entry): Don't add undefined
4137         symbols which are not used in a relocation.
4138
4139 2011-06-28  Ian Lance Taylor  <iant@google.com>
4140
4141         PR gold/12898
4142         * layout.cc (Layout::segment_precedes): Don't crash if a linker
4143         script create indistinguishable segments.
4144         (Layout::set_segment_offsets): Use stable_sort when sorting
4145         segments.  Pass this to Compare_segments constructor.
4146         * layout.h (class Layout): Make segment_precedes non-static.
4147         (class Compare_segments): Change from struct to class.  Add
4148         layout_ field.  Add constructor.
4149         * script-sections.cc
4150         (Script_sections::attach_sections_using_phdrs_clause): Rename
4151         local orphan to is_orphan.  Don't report failure to put empty
4152         section in segment.  On attachment failure, report name of
4153         section, and attach to first PT_LOAD segment.
4154
4155 2011-06-28  Ian Lance Taylor  <iant@google.com>
4156
4157         PR gold/12934
4158         * target-select.cc (Target_selector::Target_selector): Add
4159         emulation parameter.  Change all callers.
4160         (select_target_by_bfd_name): Rename from select_target_by_name.
4161         Change all callers.
4162         (select_target_by_emulation): New function.
4163         (supported_emulation_names): New function.
4164         * target-select.h (class Target_selector): Add emulation_ field.
4165         Update declarations.
4166         (Target_selector::recognize_by_bfd_name): Rename from
4167         recognize_by_name.  Change all callers.
4168         (Target_selector::supported_bfd_names): Rename from
4169         supported_names.  Change all callers.
4170         (Target_selector::recognize_by_emulation): New function.
4171         (Target_selector::supported_emulations): New function.
4172         (Target_selector::emulation): New function.
4173         (Target_selector::do_recognize_by_bfd_name): Rename from
4174         do_recognize_by_name.  Change all callers.
4175         (Target_selector::do_supported_bfd_names): Rename from
4176         do_supported_names.  Change all callers.
4177         (Target_selector::do_recognize_by_emulation): New function.
4178         (Target_selector::do_supported_emulations): New function.
4179         (select_target_by_bfd_name): Change name in declaration.
4180         (select_target_by_emulation): Declare.
4181         (supported_emulation_names): Declare.
4182         * parameters.cc (parameters_force_valid_target): Try to find
4183         target based on emulation from -m option.
4184         * options.h (class General_options): Change doc string for -m.
4185         * options.cc (help): Print emulations.
4186         (General_options::parse_V): Likewise.
4187         * freebsd.h (Target_selector_freebsd::Target_selector_freebsd):
4188         Add emulation parameter.  Change all callers.
4189
4190 2011-06-28  Ian Lance Taylor  <iant@google.com>
4191
4192         * target.h (class Target): Add osabi_ field.
4193         (Target::osabi): New function.
4194         (Target::set_osabi): New function.
4195         (Target::Target): Initialize osabi_.
4196         (Target::do_adjust_elf_header): Make pure virtual.
4197         (Sized_target::do_adjust_elf_header): Declare.
4198         * target.cc (Sized_target::do_adjust_elf_header): New function.
4199         (class Sized_target): Instantiate all versions.
4200         * freebsd.h (class Target_freebsd): Remove.
4201         (Target_selector_freebsd::do_recognize): Call set_osabi on
4202         Target.
4203         (Target_selector_freebsd::do_recognize_by_name): Likewise.
4204         (Target_selector_freebsd::set_osabi): Remove.
4205         * i386.cc (class Target_i386): Inherit from Sized_target rather
4206         than Target_freebsd.
4207         * x86_64.cc (class Target_x86_64): Likewise.
4208
4209 2011-06-28  Ian Lance Taylor  <iant@google.com>
4210
4211         * target.h (Target::can_check_for_function_pointers): Rewrite.
4212         Make non-virtual.
4213         (Target::can_icf_inline_merge_sections): Likewise.
4214         (Target::section_may_have_icf_unsafe_poineters): Likewise.
4215         (Target::Target_info): Add can_icf_inline_merge_sections field.
4216         (Target::do_can_check_for_function_pointers): New virtual
4217         function.
4218         (Target::do_section_may_have_icf_unsafe_pointers): Likewise.
4219         * arm.cc (Target_arm::do_can_check_for_function_pointers): Rename
4220         from can_check_for_function_pointers, move in file.
4221         (Target_arm::do_section_may_have_icf_unsafe_pointers): Rename from
4222         section_may_have_icf_unsafe_poineters, move in file.
4223         (Target_arm::arm_info): Initialize can_icf_inline_merge_sections.
4224         * i386.cc (Target_i386::do_can_check_for_function_pointers):
4225         Rename from can_check_for_function_pointers, move in file.
4226         (Target_i386::can_icf_inline_merge_sections): Remove.
4227         (Target_i386::i386_info): Initialize
4228         can_icf_inline_merge_sections.
4229         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
4230         Initialize can_icf_inline_merge_sections.
4231         * sparc.cc (Target_sparc::sparc_info) [both version]: Likewise.
4232         * x86_64.cc (Target_x86_64::do_can_check_for_function_pointers):
4233         Rename from can_check_for_function_pointers, move in file.
4234         (Target_x86_64::can_icf_inline_merge_sections): Remove.
4235         (Target_x86_64::x86_64_info): Initialize
4236         can_icf_inline_merge_sections.
4237         * testsuite/testfile.cc (Target_test::test_target_info):
4238         Likewise.
4239         * icf.cc (get_section_contents): Correct formatting.
4240
4241 2011-06-27  Ian Lance Taylor  <iant@google.com>
4242
4243         * symtab.cc (Symbol::versioned_name): New function.
4244         (Symbol_table::add_to_final_symtab): Use versioned_name when
4245         appropriate.
4246         (Symbol_table::sized_write_symbol): Likewise.
4247         * symtab.h (class Symbol): Declare versioned_name.
4248         * stringpool.h (class Stringpool_template): Add variant of add
4249         which takes a std::basic_string.
4250         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_12.
4251         (ver_test_12_SOURCES, ver_test_12_DEPENDENCIES): New variables.
4252         (ver_test_12_LDFLAGS, ver_test_12_LDADD): New variables.
4253         (ver_test_12.o): New target.
4254         * testsuite/Makefile.in: Rebuild.
4255
4256 2011-06-27  Doug Kwan  <dougkwan@google.com>
4257
4258         * arm.cc (Arm_relocate_functions::thm_jump8,
4259         Arm_relocate_functions::thm_jump11): Use a wider signed
4260         type to compute offset.
4261         * testsuite/Makefile.am: Add new tests arm_thm_jump11 and
4262         arm_thm_jump8.
4263         * testsuite/Makefile.in: Regenerate.
4264         * testsuite/arm_branch_in_range.sh: Check test results of
4265         arm_thm_jump11 and arm_thm_jump8.
4266         * testsuite/arm_thm_jump11.s: New test source file.
4267         * testsuite/arm_thm_jump11.t: New linker script.
4268         * testsuite/arm_thm_jump8.s: New test source file.
4269         * testsuite/arm_thm_jump8.t: New linker script.
4270
4271 2011-06-24  Ian Lance Taylor  <iant@google.com>
4272
4273         * layout.cc: Include "object.h".
4274         (ctors_sections_in_init_array): New static variable.
4275         (Layout::is_ctors_in_init_array): New function.
4276         (Layout::layout): Add entry to ctors_sections_in_init_array if
4277         appropriate.
4278         * layout.h (class Layout): Declare is_ctors_in_init_array.
4279         * reloc.cc (Sized_relobj_file::do_relocate): Call reverse_words if
4280         is_ctors_reverse_view is set.
4281         (Sized_relobj_file::write_sections): Add layout parameter.  Change
4282         all callers.  Set is_ctors_reverse_view field of View_size.
4283         (Sized_relobj_file::reverse_words): New function.
4284         * object.h (Sized_relobj_file::View_size): Add
4285         is_ctors_reverse_view field.
4286         (class Sized_relobj_file): Update declarations.
4287         * testsuite/initpri3.c: New test.
4288         * testsuite/Makefile.am: (check_PROGRAMS): Add initpri3a and
4289         initpri3b.
4290         (initpri3a_SOURCES, initpri3a_DEPENDENCIES): New variables.
4291         (initpri3a_LDFLAGS, initpri3a_LDADD): New variables.
4292         (initpri3b_SOURCES, initpri3b_DEPENDENCIES): New variables.
4293         (initpri3b_LDFLAGS, initpri3b_LDADD): New variables.
4294         * testsuite/Makefile.in: Rebuild.
4295
4296 2011-06-24  Cary Coutant  <ccoutant@google.com>
4297
4298         * testsuite/Makefile.am: Add in-tree assembler to gcctestdir.
4299         (debug_msg_cdebug.o, odr_violation1_cdebug.o, odr_violation2_cdebug.o)
4300         (debug_msg_cdebug.err): New targets.
4301         * testsuite/Makefile.in: Regenerate.
4302         * testsuite/debug_msg.sh: Check output of link with compressed debug.
4303         Fix checks for link with shared library.
4304
4305 2011-06-24  Doug Kwan  <dougkwan@google.com>
4306
4307         * arm.cc (Arm_output_section::append_text_sections_to_list): Do not
4308         skip empty text sections.
4309         * testsuite/arm_exidx_test.s: Test handling of an empty text section.
4310
4311 2011-06-22  Ian Lance Taylor  <iant@google.com>
4312
4313         PR gold/12910
4314         * options.h (class General_options): Add --ctors-in-init-array.
4315         * layout.cc (Layout::get_output_section): Treat SHT_INIT_ARRAY and
4316         friends as SHT_PROGBITS for merging sections.
4317         (Layout::layout): Remove special handling of .init_array and
4318         friends.  Don't sort if doing relocatable link.  Sort for .ctors
4319         and .dtors if ctors_in_init_array.
4320         (Layout::make_output_section): Force correct section types for
4321         .init_array and friends.  Don't sort if doing relocatable link,
4322         Don't sort .ctors and .dtors if ctors_in_init_array.
4323         (Layout::section_name_mapping): Remove .ctors. and .dtorso.
4324         (Layout::output_section_name): Add relobj parameter.  Change all
4325         callers.  Handle .ctors. and .dtors. in code rather than table.
4326         Handle .ctors and .dtors if ctors_in_init_array.
4327         (Layout::match_file_name): New function, moved from output.cc.
4328         * layout.h (class Layout): Update declarations.
4329         * output.cc: Include "layout.h".
4330         (Input_section_sort_entry::get_priority): New function.
4331         (Input_section_sort_entry::match_file_name): Just call
4332         Layout::match_file_name.
4333         (Output_section::Input_section_sort_init_fini_compare::operator()):
4334         Handle .ctors and .dtors.  Sort by explicit priority rather than
4335         by name.
4336         * configure.ac: Remove CONSTRUCTOR_PRIORITY test and conditional.
4337         * testsuite/initpri2.c: New test.
4338         * testsuite/Makefile.am: Don't test CONSTRUCTOR_PRIORITY.
4339         (check_PROGRAMS): Add initpri2.
4340         (initpri2_SOURCES, initpri2_DEPENDENCIES): New variables.
4341         (initpri2_LDFLAGS, initpri2_LDADD): New variables.
4342         * configure, testsuite/Makefile.in: Rebuild.
4343
4344 2011-06-19  Ian Lance Taylor  <iant@google.com>
4345
4346         PR gold/12880
4347         * layout.cc (Layout::attach_allocated_section_to_segment): Add a
4348         .interp section to a PT_INTERP segment even if we have seen a
4349         --dynamic-linker option.  Don't do it if we have seen a PHDRS
4350         clause in a linker script.
4351         (Layout::finalize): Don't create a .interp section if we've
4352         already create a PT_INTERP segment.
4353         (Layout::create_interp): Always call choose_output_section (revert
4354         patch of 2011-06-17).  Don't create PT_INTERP segment.
4355         * script-sections.cc
4356         (Script_sections::create_note_and_tls_segments): Add a .interp
4357         section to a PT_INTERP segment even if we have seen a
4358         --dynamic-linker option.
4359
4360 2011-06-18  Ian Lance Taylor  <iant@google.com>
4361
4362         * layout.cc (Layout::finish_dynamic_section): Don't set DT_TEXTREL
4363         merely because a non-PT_LOAD segment has a dynamic reloc.
4364
4365 2011-06-18  Ian Lance Taylor  <iant@google.com>
4366
4367         * layout.cc (Layout::finish_dynamic_section): Don't create
4368         DT_FLAGS entry if not needed.
4369
4370 2011-06-18  Ian Lance Taylor  <iant@google.com>
4371
4372         PR gold/12745
4373         * layout.cc (Layout::layout_eh_frame): Correct handling of
4374         writable .eh_frame section.
4375
4376 2011-06-17  Ian Lance Taylor  <iant@google.com>
4377
4378         PR gold/12893
4379         * resolve.cc (Symbol_table::resolve): Don't give an error if a
4380         symbol is redefined with the exact same object and value.
4381
4382 2011-06-17  Ian Lance Taylor  <iant@google.com>
4383
4384         PR gold/12880
4385         * layout.h (class Layout): Add interp_segment_ field.
4386         * layout.cc (Layout::Layout): Initialize interp_segment_ field.
4387         (Layout::attach_allocated_section_to_segment): If making shared
4388         library, put .interp section in PT_INTERP segment.
4389         (Layout::finalize): Also call create_interp if -dynamic-linker
4390         option was used.
4391         (Layout::create_interp): Assert that there is no PT_INTERP
4392         segment.  If not using a SECTIONS clause, use make_output_section.
4393         (Layout::make_output_segment): Set interp_segment_ if PT_INTERP.
4394         * script-sections.cc
4395         (Script_sections::create_note_and_tls_segments): If making shared
4396         library, put .interp section in PT_INTERP segment.
4397
4398 2011-06-17  Ian Lance Taylor  <iant@google.com>
4399
4400         * object.cc (Sized_relobj_file::do_layout): Keep warning sections
4401         when making a shared library.
4402
4403 2011-06-17  Ian Lance Taylor  <iant@google.com>
4404
4405         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Add gsym
4406         parameter.  Change all callers.  Don't issue warning about PC32
4407         against locally defined symbol.
4408
4409 2011-06-16  Ian Lance Taylor  <iant@google.com>
4410
4411         * symtab.cc (Warnings::issue_warning): Don't warn if relocation
4412         occurs in same object.
4413
4414 2011-06-14  Alan Modra  <amodra@gmail.com>
4415
4416         * po/POTFILES.in: Regenerate.
4417
4418 2011-06-09  Ian Lance Taylor  <iant@google.com>
4419
4420         * script-sections.cc
4421         (Orphan_output_section::set_section_addresses): For a relocatable
4422         link set address to 0.
4423
4424 2011-06-09  Cary Coutant  <ccoutant@google.com>
4425
4426         PR gold/12804
4427         * gold/gold.cc (queue_initial_tasks): Warn if --incremental is
4428         used with --compress-debug-sections.
4429         * gold/object.cc (Sized_relobj_file::do_layout): Report
4430         uncompressed size of compressed input sections.
4431
4432 2011-06-08  Cary Coutant  <ccoutant@google.com>
4433
4434         PR gold/12804
4435         * testsuite/two_file_test_2_v1.cc: Change initialization of
4436         v2 to keep it in .data.
4437
4438 2011-06-07  Cary Coutant  <ccoutant@google.com>
4439
4440         * common.cc (Symbol_table::do_allocate_commons_list): Call
4441         gold_fallback.
4442         * errors.cc (Errors::fatal): Adjust call to gold_exit.
4443         (Errors::fallback): New function.
4444         (gold_fallback): New function.
4445         * errors.h (Errors::fallback): New function.
4446         * gold.cc (gold_exit): Change status parameter to enum; adjust
4447         all callers.
4448         (queue_initial_tasks): Call gold_fallback.
4449         * gold.h: Include cstdlib.
4450         (Exit_status): New enum type.
4451         (gold_exit): Change status parameter to enum.
4452         (gold_fallback): New function.
4453         * layout.cc (Layout::set_section_offsets): Call gold_fallback.
4454         (Layout::create_symtab_sections): Likewise.
4455         (Layout::create_shdrs): Likewise.
4456         * main.cc (main): Adjust call to gold_exit.
4457         * output.cc (Output_data_got::add_got_entry): Call gold_fallback.
4458         (Output_data_got::add_got_entry_pair): Likewise.
4459         (Output_section::add_input_section): Likewise.
4460         (Output_section::add_output_section_data): Likewise.
4461         (Output_segment::set_section_list_addresses): Likewise.
4462         * x86_64.cc (Output_data_plt_x86_64::add_entry): Likewise.
4463
4464 2011-06-07  Cary Coutant  <ccoutant@google.com>
4465
4466         * layout.cc (Layout::set_segment_offsets): Don't adjust layout
4467         for incremental links.
4468         * output.cc (Output_segment::set_section_list_addresses): Remove
4469         FIXME and test for TLS or BSS.
4470
4471 2011-06-07  Cary Coutant  <ccoutant@google.com>
4472
4473         * testsuite/Makefile.am: Add incremental_copy_test,
4474         incremental_common_test_1.
4475         * testsuite/Makefile.in: Regenerate.
4476         * testsuite/common_test_1_v1.c: New source file.
4477         * testsuite/common_test_1_v2.c: New source file.
4478         * testsuite/copy_test_v1.cc: New source file.
4479
4480 2011-06-07  Cary Coutant  <ccoutant@google.com>
4481
4482         * common.cc (Symbol_table::do_allocate_commons_list): For incremental
4483         update, allocate common from bss section's free list.
4484         * incremental-dump.cc (dump_incremental_inputs): Print flag for
4485         linker-defined symbols.
4486         * incremental.cc (Sized_incremental_binary::do_process_got_plt):
4487         Skip GOT and PLT entries that are no longer referenced.
4488         (Output_section_incremental_inputs::write_info_blocks): Mark
4489         linker-defined symbols.
4490         (Sized_incr_relobj::do_add_symbols): Process linker-defined symbols.
4491         * output.cc (Output_section::allocate): New function.
4492         * output.h (Output_section::allocate): New function.
4493         * resolve.cc (Symbol_table::report_resolve_problem): Add case for
4494         linker-defined symbols.
4495         (Symbol::override_base_with_special): Copy is_predefined_ flag.
4496         * symtab.cc (Symbol::init_fields): Initialize is_predefined_ flag.
4497         (Symbol::init_base_output_data): Likewise.
4498         (Symbol::init_base_output_segment): Likewise.
4499         (Symbol::init_base_constant): Likewise.
4500         (Sized_symbol::init_output_data): Likewise.
4501         (Sized_symbol::init_output_segment): Likewise.
4502         (Sized_symbol::init_constant): Likewise.
4503         (Symbol_table::do_define_in_output_data): Likewise.
4504         (Symbol_table::do_define_in_output_segment): Likewise.
4505         (Symbol_table::do_define_as_constant): Likewise.
4506         * symtab.h (Symbol::is_predefined): New function.
4507         (Symbol::init_base_output_data): Add is_predefined parameter.
4508         (Symbol::init_base_output_segment): Likewise.
4509         (Symbol::init_base_constant): Likewise.
4510         (Symbol::is_predefined_): New data member.
4511         (Sized_symbol::init_output_data): Add is_predefined parameter.
4512         (Sized_symbol::init_output_segment): Likewise.
4513         (Sized_symbol::init_constant): Likewise.
4514         (enum Symbol_table::Defined): Add INCREMENTAL_BASE.
4515
4516 2011-06-07  Cary Coutant  <ccoutant@google.com>
4517
4518         * copy-relocs.cc (Copy_relocs::copy_reloc): Call make_copy_reloc
4519         instead of emit_copy_reloc.
4520         (Copy_relocs::emit_copy_reloc): Refactor.
4521         (Copy_relocs::make_copy_reloc): New function.
4522         (Copy_relocs::add_copy_reloc): Remove.
4523         * copy-relocs.h (Copy_relocs::emit_copy_reloc): Move to public
4524         section.
4525         (Copy_relocs::make_copy_reloc): New function.
4526         (Copy_relocs::add_copy_reloc): Remove.
4527         * gold.cc (queue_middle_tasks): Emit old COPY relocations from
4528         unchanged input files.
4529         * incremental-dump.cc (dump_incremental_inputs): Print "COPY" flag.
4530         * incremental.cc (Sized_incremental_binary::do_reserve_layout):
4531         Reserve BSS space for COPY relocations.
4532         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4533         (Output_section_incremental_inputs::write_info_blocks): Record
4534         whether a symbol is copied from a shared object.
4535         (Sized_incr_dynobj::do_add_symbols): Record COPY relocations.
4536         * incremental.h (enum Incremental_shlib_symbol_flags): New type.
4537         (INCREMENTAL_SHLIB_SYM_FLAGS_SHIFT): New constant.
4538         (Incremental_input_entry_reader::get_output_symbol_index): Add
4539         is_copy parameter.
4540         (Incremental_binary::emit_copy_relocs): New function.
4541         (Incremental_binary::do_emit_copy_relocs): New function.
4542         (Sized_incremental_binary::Sized_incremental_binary): Initialize
4543         new data member.
4544         (Sized_incremental_binary::add_copy_reloc): New function.
4545         (Sized_incremental_binary::do_emit_copy_relocs): New function.
4546         (Sized_incremental_binary::Copy_reloc): New struct.
4547         (Sized_incremental_binary::Copy_relocs): New typedef.
4548         (Sized_incremental_binary::copy_relocs_): New data member.
4549         * symtab.cc (Symbol_table::add_from_incrobj): Change return type.
4550         * symtab.h (Symbol_table::add_from_incrobj): Change return type.
4551         * target.h (Sized_target::emit_copy_reloc): New function.
4552         * x86_64.cc (Target_x86_64::emit_copy_reloc): New function.
4553
4554 2011-06-02  Cary Coutant  <ccoutant@google.com>
4555
4556         PR gold/12163
4557         * gold/archive.cc (Archive::Archive): Initialize new data member.
4558         (Archive::include_all_members): Return if archive has already been
4559         included.
4560         * gold/archive.h (Archive::include_all_members_): New data member.
4561
4562 2011-06-02  Nick Clifton  <nickc@redhat.com>
4563
4564         * dynobj.h: Fix spelling mistake in comment.
4565         * output.cc: Likewise.
4566
4567 2011-05-31  Doug Kwan  <dougkwan@google.com>
4568             Asier Llano
4569
4570         PR gold/12826
4571         * arm.cc (Target_arm::tag_cpu_arch_combine): Fix handling of
4572         arch value that equals to elfcpp::MAX_TAG_CPU_ARCH.
4573         * testsuite/Makefile.am: (MOSTLYCLEANFILES): Clean up.  Remove
4574         redundant arm_exidx_test.so.
4575         * testsuite/Makefile.in: Regenerate.
4576         (check_SCRIPTS): Add pr12826.sh
4577         (check_DATA): Add pr12826.stdout
4578         (pr12826.stdout, pr12826.so, pr12826_1.o, pr12826_2.o): New rules.
4579         * testsuite/pr12826.sh: New file.
4580         * testsuite/pr12826_1.s: Ditto.
4581         * testsuite/pr12826_1.s: Ditto.
4582
4583 2011-05-30  Ian Lance Taylor  <iant@google.com>
4584
4585         * reloc.cc (Sized_relobj_file::do_read_relocs): Ignore empty reloc
4586         sections.
4587
4588 2011-05-29  Ian Lance Taylor  <iant@google.com>
4589
4590         PR gold/12804
4591         * testsuite/Makefile.am: Use different file name for two_file_test
4592         temporary file for each incremental test.
4593         * testsuite/Makefile.in: Rebuild.
4594
4595 2011-05-29  Ian Lance Taylor  <iant@google.com>
4596
4597         * binary.cc (Binary_to_elf::sized_convert): Don't crash if the
4598         binary input file is empty.
4599
4600 2011-05-27  Ian Lance Taylor  <iant@google.com>
4601
4602         * testsuite/Makefile.am (ver_test_2.so): Use -Wl,-R,.
4603         (ver_test_9.so): Likewise.
4604         * testsuite/Makefile.in: Rebuild.
4605
4606 2011-05-26 Cary Coutant  <ccoutant@google.com>
4607
4608         * incremental-dump.cc (dump_incremental_inputs): Print COMDAT groups.
4609         * incremental.cc (Incremental_inputs::report_input_section): Fix
4610         comment, indentation.
4611         (Incremental_inputs::report_comdat_group): New function.
4612         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4613         of data for incremental input file entry.
4614         (Output_section_incremental_inputs::write_info_blocks): Write COMDAT
4615         group count, COMDAT group signatures.
4616         (Sized_incr_relobj::do_layout): Record kept COMDAT group info from
4617         an unchanged input file.
4618         * incremental.h (Incremental_object_entry::Incremental_object_entry):
4619         Initialize new data member.
4620         (Incremental_object_entry::add_comdat_group): New function.
4621         (Incremental_object_entry::get_comdat_group_count): New function.
4622         (Incremental_object_entry::get_comdat_signature_key): New function.
4623         (Incremental_object_entry::groups_): New data member.
4624         (Incremental_inputs::report_comdat_group): New function.
4625         (Incremental_input_entry_reader::get_symbol_offset): Adjust size of
4626         data for incremental input file entry.
4627         (Incremental_input_entry_reader::get_comdat_group_count): New function.
4628         (Incremental_input_entry_reader::get_input_section): Adjust size of
4629         data for incremental input file entry.
4630         (Incremental_input_entry_reader::get_global_symbol_reader): Likewise.
4631         (Incremental_input_entry_reader::get_comdat_group_signature): New
4632         function.
4633         * object.cc (Sized_relobj::include_section_group): Report kept
4634         COMDAT groups for incremental links.
4635
4636 2011-05-24  David Meyer  <pdox@google.com>
4637
4638         * dirsearch.cc (Dirsearch::find): Replace n1 and n2 parameters
4639         with name parameter.  Add found_name parameter.
4640         * fileread.cc (Input_file::find_file): Adjust code accordingly.
4641         * dirsearch.h (class Dirsearch): Update declaration.
4642
4643 2011-05-24  Ian Lance Taylor  <iant@google.com>
4644
4645         * archive.cc (Library_base::should_include_member): Pull in object
4646         from archive if it defines the entry symbol.
4647         * parameters.cc (Parameters::entry): New function.
4648         * parameters.h (class Parameters): Declare entry.
4649         * output.h (class Output_file_header): Remove entry_ field.
4650         * output.cc (Output_file_header::Output_file_header): Remove entry
4651         parameter.  Change all callers.
4652         (Output_file_header::entry): Use parameters->entry.
4653         * gold.cc (queue_middle_tasks): Likewise.
4654         * plugin.cc (Plugin_hook::run): Likewise.
4655
4656 2011-05-24 Cary Coutant  <ccoutant@google.com>
4657
4658         * gold.cc (queue_initial_tasks): Pass incremental base filename
4659         to Output_file::open_base_file; don't print error message.
4660         * incremental-dump.cc (main): Adjust call to
4661         Output_file::open_for_modification.
4662         * incremental-dump.cc (main): Likewise.
4663         * incremental.cc (Incremental_inputs::report_command_line):
4664         Ignore --incremental-base option when comparing command lines.
4665         Ignore parameter when given as separate argument.
4666         * options.h (class General_options): Add --incremental-base.
4667         * output.cc (Output_file::Output_file):
4668         (Output_file::open_base_file): Add base_name and writable parameters;
4669         read base file into new file; print error message here.
4670         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4671         callers.
4672         * output.h (Output_file::open_for_modification): Rename to...
4673         (Output_file::open_base_file): ...this; add base_name and
4674         writable parameters; adjust all callers.
4675         (Output_file::map_no_anonymous): Add writable parameter; adjust all
4676         callers.
4677         * testsuite/Makefile.am (incremental_test_4): Test
4678         --incremental-base.
4679         * testsuite/Makefile.in: Regenerate.
4680
4681 2011-05-24 Cary Coutant  <ccoutant@google.com>
4682
4683         * testsuite/Makefile.am: Add incremental_test_2, incremental_test_3,
4684         incremental_test_4.
4685         * testsuite/Makefile.in: Regenerate.
4686         * testsuite/two_file_test_1_v1.cc: New test source file.
4687         * testsuite/two_file_test_1b_v1.cc: New test source file.
4688         * testsuite/two_file_test_2_v1.cc: New test source file.
4689
4690 2011-05-24 Cary Coutant  <ccoutant@google.com>
4691
4692         * dynobj.h (Dynobj::do_dynobj): New function.
4693         * incremental-dump.cc (dump_incremental_inputs): Print as_needed
4694         flag and soname for shared objects.
4695         * incremental.cc (Incremental_inputs::report_object): Make
4696         either Incremental_object_entry or Incremental_dynobj_entry; add
4697         soname to string table.
4698         (Incremental_inputs::report_input_section): Add assertion.
4699         (Output_section_incremental_inputs::set_final_data_size): Adjust
4700         type of input file entry for shared libraries; adjust size of
4701         shared library info entry.
4702         (Output_section_incremental_inputs::write_input_files): Write
4703         as_needed flag for shared libraries.
4704         (Output_section_incremental_inputs::write_info_blocks): Adjust type
4705         of input file entry for shared libraries; write soname.
4706         (Sized_incr_dynobj::Sized_incr_dynobj): Read as_needed flag and
4707         soname from incremental info.
4708         * incremental.h (enum Incremental_input_flags): Add
4709         INCREMENTAL_INPUT_AS_NEEDED.
4710         (Incremental_input_entry::Incremental_input_entry): Initialize new
4711         data member.
4712         (Incremental_input_entry::set_as_needed): New function.
4713         (Incremental_input_entry::as_needed): New function.
4714         (Incremental_input_entry::do_dynobj_entry): New function.
4715         (Incremental_input_entry::as_needed_): New data member.
4716         (Incremental_object_entry::Incremental_object_entry): Don't check
4717         for shared library.
4718         (Incremental_object_entry::do_type): Likewise.
4719         (class Incremental_dynobj_entry): New class.
4720         (Incremental_input_entry_reader::as_needed): New function.
4721         (Incremental_input_entry_reader::get_soname): New function.
4722         (Incremental_input_entry_reader::get_global_symbol_count): Rewrite.
4723         (Incremental_input_entry_reader::get_output_symbol_index): Adjust
4724         size of shared library info entry.
4725         * layout.cc (Layout::finish_dynamic_section): Don't test for
4726         incremental link when adding DT_NEEDED entries.
4727         * object.h (Object::Object): Initialize new data member.
4728         (Object::dynobj): New function.
4729         (Object::set_as_needed): New function.
4730         (Object::as_needed): New function.
4731         (Object::do_dynobj): New function.
4732         (Object::as_needed_): New data member.
4733
4734 2011-05-24 Cary Coutant  <ccoutant@google.com>
4735
4736         * incremental-dump.cc (dump_incremental_inputs): Print dynamic reloc
4737         info; adjust display of GOT entries.
4738         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
4739         vector of input objects; remove file_status_.
4740         (Sized_incremental_binary::do_reserve_layout): Remove file_status_.
4741         (Sized_incremental_binary::do_process_got_plt): Adjust calls to
4742         got_plt reader; call target hooks to reserve GOT entries.
4743         (Output_section_incremental_inputs::set_final_data_size): Adjust size
4744         of input file info header and GOT info entry.
4745         (Output_section_incremental_inputs::write_info_blocks): Write dynamic
4746         relocation info.
4747         (Got_plt_view_info::got_descriptor): Remove.
4748         (Got_plt_view_info::sym_index): New data member.
4749         (Got_plt_view_info::input_index): New data member.
4750         (Local_got_offset_visitor::visit): Write input file index.
4751         (Global_got_offset_visitor::visit): Write 0 for input file index.
4752         (Global_symbol_visitor_got_plt::operator()): Replace got_descriptor
4753         with sym_index and input_index.
4754         (Output_section_incremental_inputs::write_got_plt): Adjust size of
4755         incremental info GOT entry; replace got_descriptor with input_index.
4756         (Sized_relobj_incr::Sized_relobj_incr): Adjust initializers; record
4757         map from input file index to object.
4758         (Sized_relobj_incr::do_layout): Replace direct data member reference
4759         with accessor function.
4760         (Sized_relobj_incr::do_for_all_local_got_entries): Move to base class.
4761         * incremental.h (Incremental_input_entry_reader::get_symbol_offset):
4762         Adjust size of input file info header.
4763         (Incremental_input_entry_reader::get_first_dyn_reloc): New function.
4764         (Incremental_input_entry_reader::get_dyn_reloc_count): New function.
4765         (Incremental_input_entry_reader::get_input_section): Adjust size of
4766         input file info header.
4767         (Incremental_got_plt_reader::Incremental_got_plt_reader): Adjust size
4768         of incremental info GOT entry.
4769         (Incremental_got_plt_reader::get_got_desc): Remove.
4770         (Incremental_got_plt_reader::get_got_symndx): New function.
4771         (Incremental_got_plt_reader::get_got_input_index): New function.
4772         (Sized_incremental_binary::Sized_incremental_binary): Remove
4773         file_status_; add input_objects_.
4774         (Sized_incremental_binary::~Sized_incremental_binary): Remove.
4775         (Sized_incremental_binary::set_file_is_unchanged): Remove.
4776         (Sized_incremental_binary::file_is_unchanged): Remove.
4777         (Sized_incremental_binary::set_input_object): New function.
4778         (Sized_incremental_binary::input_object): New function.
4779         (Sized_incremental_binary::file_status_): Remove.
4780         (Sized_incremental_binary::input_objects_): New data member.
4781         (Sized_relobj_incr): Rename Sized_incr_relobj to this; adjust all
4782         references.
4783         (Sized_relobj_incr::invalid_address): Move to base class.
4784         (Sized_relobj_incr::is_output_section_offset_invalid): Move to base
4785         class.
4786         (Sized_relobj_incr::do_output_section_offset): Likewise.
4787         (Sized_relobj_incr::do_for_all_local_got_entries): Likewise.
4788         (Sized_relobj_incr::section_offsets_): Likewise.
4789         * object.cc (Sized_relobj::do_for_all_local_got_entries): New
4790         function.
4791         (Sized_relobj_file::Sized_relobj_file): Remove local_got_offsets_.
4792         (Sized_relobj_file::layout_section): Replace refs to section_offsets_
4793         with accessor function.
4794         (Sized_relobj_file::do_layout): Likewise.
4795         (Sized_relobj_file::do_layout_deferred_sections): Likewise.
4796         (Sized_relobj_file::do_for_all_local_got_entries): Move to base class.
4797         (Sized_relobj_file::compute_final_local_value): Replace refs to
4798         section_offsets_ with accessor function.
4799         (Sized_relobj_file::do_finalize_local_symbols): Likewise.
4800         * object.h (Relobj::Relobj): Initialize new data members.
4801         (Relobj::add_dyn_reloc): New function.
4802         (Relobj::first_dyn_reloc): New function.
4803         (Relobj::dyn_reloc_count): New function.
4804         (Relobj::first_dyn_reloc_): New data member.
4805         (Relobj::dyn_reloc_count_): New data member.
4806         (Sized_relobj): Rename Sized_relobj_base to this; adjust all
4807         references.
4808         (Sized_relobj::Address): New typedef.
4809         (Sized_relobj::invalid_address): Move here from child class.
4810         (Sized_relobj::Sized_relobj): Initialize new data members.
4811         (Sized_relobj::sized_relobj): New function.
4812         (Sized_relobj::is_output_section_offset_invalid): Move here from
4813         child class.
4814         (Sized_relobj::get_output_section_offset): Likewise.
4815         (Sized_relobj::local_has_got_offset): Likewise.
4816         (Sized_relobj::local_got_offset): Likewise.
4817         (Sized_relobj::set_local_got_offset): Likewise.
4818         (Sized_relobj::do_for_all_local_got_entries): Likewise.
4819         (Sized_relobj::clear_got_offsets): New function.
4820         (Sized_relobj::section_offsets): Move here from child class.
4821         (Sized_relobj::do_output_section_offset): Likewise.
4822         (Sized_relobj::do_set_section_offset): Likewise.
4823         (Sized_relobj::Local_got_offsets): Likewise.
4824         (Sized_relobj::local_got_offsets_): Likewise.
4825         (Sized_relobj::section_offsets_): Likewise.
4826         (Sized_relobj_file): Rename Sized_relobj to this; adjust all
4827         references.
4828         (Sized_relobj_file::is_output_section_offset_invalid): Move to base
4829         class.
4830         (Sized_relobj_file::sized_relobj): New function
4831         (Sized_relobj_file::local_has_got_offset): Move to base class.
4832         (Sized_relobj_file::local_got_offset): Likewise.
4833         (Sized_relobj_file::set_local_got_offset): Likewise.
4834         (Sized_relobj_file::get_output_section_offset): Likewise.
4835         (Sized_relobj_file::do_for_all_local_got_entries): Likewise.
4836         (Sized_relobj_file::do_output_section_offset): Likewise.
4837         (Sized_relobj_file::do_set_section_offset): Likewise.
4838         (Sized_relobj_file::Local_got_offsets): Likewise.
4839         (Sized_relobj_file::local_got_offsets_): Likewise.
4840         (Sized_relobj_file::section_offsets_): Likewise.
4841         * output.cc (Output_reloc::Output_reloc): Adjust type of relobj
4842         (all constructors).
4843         (set_needs_dynsym_index): Convert relobj to derived class pointer.
4844         (Output_reloc::get_symbol_index): Likewise.
4845         (Output_reloc::local_section_offset): Likewise.
4846         (Output_reloc::get_address): Likewise.
4847         (Output_reloc::symbol_value): Likewise.
4848         (Output_data_got::reserve_slot): Move to class definition.
4849         (Output_data_got::reserve_local): New function.
4850         (Output_data_got::reserve_slot_for_global): Remove.
4851         (Output_data_got::reserve_global): New function.
4852         * output.h (Output_reloc::Output_reloc): Adjust type of relobj
4853         (all constructors, two instantiations).
4854         (Output_reloc::get_relobj): New function (two instantiations).
4855         (Output_reloc::u1_.relobj, Output_reloc::u2_.relobj): Adjust type.
4856         (Output_data_reloc_base::add): Convert relobj to derived class pointer.
4857         (Output_data_reloc::add_global): Adjust type of relobj.
4858         (Output_data_reloc::add_global_relative): Likewise.
4859         (Output_data_reloc::add_symbolless_global_addend): Likewise.
4860         (Output_data_reloc::add_local): Likewise.
4861         (Output_data_reloc::add_local_relative): Likewise.
4862         (Output_data_reloc::add_symbolless_local_addend): Likewise.
4863         (Output_data_reloc::add_local_section): Likewise.
4864         (Output_data_reloc::add_output_section): Likewise.
4865         (Output_data_reloc::add_absolute): Likewise.
4866         (Output_data_reloc::add_target_specific): Likewise.
4867         (Output_data_got::reserve_slot): Move definition here.
4868         (Output_data_got::reserve_local): New function.
4869         (Output_data_got::reserve_global): New function.
4870         * reloc.cc (Sized_relobj_file::do_read_relocs): Replace refs to
4871         section_offsets_ with accessor function.
4872         (Sized_relobj_file::write_sections): Likewise.
4873         (Sized_relobj_file::do_relocate_sections): Likewise.
4874         * target.h (Sized_target::reserve_local_got_entry): New function.
4875         (Sized_target::reserve_global_got_entry): New function.
4876         * x86_64.cc (Target_x86_64::reserve_local_got_entry): New function.
4877         (Target_x86_64::reserve_global_got_entry): New function.
4878         (Target_x86_64::init_got_plt_for_update): Create rela_dyn section.
4879
4880 2011-05-23 Cary Coutant  <ccoutant@google.com>
4881
4882         * gold.cc (queue_middle_tasks): Process existing GOT/PLT entries.
4883         * incremental-dump.cc (dump_incremental_inputs): Mask high-order
4884         bit when checking got_type.
4885         * incremental.cc (Sized_incremental_binary::setup_readers):
4886         Store symbol table and string table locations; initialize bit vector
4887         of file status flags.
4888         (Sized_incremental_binary::do_reserve_layout): Set bit flag for
4889         unchanged files.
4890         (Sized_incremental_binary::do_process_got_plt): New function.
4891         (Sized_incremental_binary::get_symtab_view): Use stored locations.
4892         (Output_section_incremental_inputs::set_final_data_size): Record
4893         file index for each input file.
4894         (Output_section_incremental_inputs::write_got_plt): Store file index
4895         instead of input entry offset for each GOT entry.
4896         * incremental.h
4897         (Incremental_input_entry::Incremental_input_entry): Initialize new
4898         data member.
4899         (Incremental_input_entry::set_offset): Store file index.
4900         (Incremental_input_entry::get_file_index): New function.
4901         (Incremental_input_entry::file_index_): New data member.
4902         (Incremental_binary::process_got_plt): New function.
4903         (Incremental_binary::do_process_got_plt): New function.
4904         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
4905         data members.
4906         (Sized_incremental_binary::~Sized_incremental_binary): New destructor.
4907         (Sized_incremental_binary::set_file_is_unchanged): New function.
4908         (Sized_incremental_binary::file_is_unchanged): New function.
4909         (Sized_incremental_binary::do_process_got_plt): New function.
4910         (Sized_incremental_binary::file_status_): New data member.
4911         (Sized_incremental_binary::main_symtab_loc_): New data member.
4912         (Sized_incremental_binary::main_strtab_loc_): New data member.
4913         * output.cc (Output_data_got::Got_entry::write): Add case
4914         RESERVED_CODE.
4915         (Output_data_got::add_global): Call add_got_entry.
4916         (Output_data_got::add_global_plt): Likewise.
4917         (Output_data_got::add_global_with_rel): Likewise.
4918         (Output_data_got::add_global_with_rela): Likewise.
4919         (Output_data_got::add_global_pair_with_rel): Call add_got_entry_pair.
4920         (Output_data_got::add_global_pair_with_rela): Likewise.
4921         (Output_data_got::add_local): Call add_got_entry.
4922         (Output_data_got::add_local_plt): Likewise.
4923         (Output_data_got::add_local_with_rel): Likewise.
4924         (Output_data_got::add_local_with_rela): Likewise.
4925         (Output_data_got::add_local_pair_with_rel): Call add_got_entry_pair.
4926         (Output_data_got::add_local_pair_with_rela): Likewise.
4927         (Output_data_got::reserve_slot): New function.
4928         (Output_data_got::reserve_slot_for_global): New function.
4929         (Output_data_got::add_got_entry): New function.
4930         (Output_data_got::add_got_entry_pair): New function.
4931         (Output_section::add_output_section_data): Edit FIXME.
4932         * output.h
4933         (Output_section_data_build::Output_section_data_build): New
4934         constructor with size parameter.
4935         (Output_data_space::Output_data_space): Likewise.
4936         (Output_data_got::Output_data_got): Initialize new data member; new
4937         constructor with size parameter.
4938         (Output_data_got::add_constant): Call add_got_entry.
4939         (Output_data_got::reserve_slot): New function.
4940         (Output_data_got::reserve_slot_for_global): New function.
4941         (class Output_data_got::Got_entry): Add RESERVED_CODE.
4942         (Output_data_got::add_got_entry): New function.
4943         (Output_data_got::add_got_entry_pair): New function.
4944         (Output_data_got::free_list_): New data member.
4945         * target.h (Sized_target::init_got_plt_for_update): New function.
4946         (Sized_target::register_global_plt_entry): New function.
4947         * x86_64.cc (Output_data_plt_x86_64::Output_data_plt_x86_64):
4948         Initialize new data member; call init; add constructor with PLT count.
4949         (Output_data_plt_x86_64::init): New function.
4950         (Output_data_plt_x86_64::add_relocation): New function.
4951         (Output_data_plt_x86_64::reserve_slot): New function.
4952         (Output_data_plt_x86_64::free_list_): New data member.
4953         (Target_x86_64::init_got_plt_for_update): New function.
4954         (Target_x86_64::register_global_plt_entry): New function.
4955         (Output_data_plt_x86_64::add_entry): Allocate from free list for
4956         incremental updates.
4957         (Output_data_plt_x86_64::add_relocation): New function.
4958         * testsuite/object_unittest.cc (Object_test): Set default options.
4959
4960 2011-05-16  Ian Lance Taylor  <iant@google.com>
4961
4962         * options.h (class General_options): Make -i a synonym for -r.
4963
4964 2011-05-16  Ian Lance Taylor  <iant@google.com>
4965
4966         * testsuite/tls_test_main.cc: Use semaphores instead of mutexes.
4967
4968 2011-05-10 Cary Coutant  <ccoutant@google.com>
4969
4970         * object.cc (Sized_relobj::do_count_local_symbols): Check for
4971         strip_all (-s).
4972
4973 2011-05-06  Ian Lance Taylor  <iant@google.com>
4974
4975         * layout.cc (Layout::layout): If the output section flags change,
4976         update the ordering.
4977
4978 2011-04-25 Cary Coutant  <ccoutant@google.com>
4979
4980         * incremental-dump.cc (dump_incremental_inputs): Print local
4981         symbol info for each input file.
4982         * incremental.cc
4983         (Output_section_incremental_inputs::set_final_data_size): Add local
4984         symbol info to input file entries in incremental info.
4985         (Output_section_incremental_inputs::write_info_blocks): Likewise.
4986         (Sized_incr_relobj::Sized_incr_relobj): Initialize new data members.
4987         (Sized_incr_relobj::do_add_symbols): Cosmetic change.
4988         (Sized_incr_relobj::do_count_local_symbols): Replace stub with
4989         implementation.
4990         (Sized_incr_relobj::do_finalize_local_symbols): Likewise.
4991         (Sized_incr_relobj::do_relocate): Write the local symbols.
4992         (Sized_incr_dynobj::do_add_symbols): Cosmetic change.
4993         * incremental.h (Incremental_inputs_reader::get_symbol_offset):
4994         Adjust size of input file header.
4995         (Incremental_inputs_reader::get_local_symbol_offset): New function.
4996         (Incremental_inputs_reader::get_local_symbol_count): New function.
4997         (Incremental_inputs_reader::get_input_section): Adjust size of input
4998         file header.
4999         (Incremental_inputs_reader::get_global_symbol_reader): Likewise.
5000         (Sized_incr_relobj::This): New typedef.
5001         (Sized_incr_relobj::sym_size): New const data member.
5002         (Sized_incr_relobj::Local_symbol): New struct.
5003         (Sized_incr_relobj::do_output_local_symbol_count): New function.
5004         (Sized_incr_relobj::do_local_symbol_offset): New function.
5005         (Sized_incr_relobj::local_symbol_count_): New data member.
5006         (Sized_incr_relobj::output_local_dynsym_count_): New data member.
5007         (Sized_incr_relobj::local_symbol_index_): New data member.
5008         (Sized_incr_relobj::local_symbol_offset_): New data member.
5009         (Sized_incr_relobj::local_dynsym_offset_): New data member.
5010         (Sized_incr_relobj::local_symbols_): New data member.
5011         * object.h (Relobj::output_local_symbol_count): New function.
5012         (Relobj::local_symbol_offset): New function.
5013         (Relobj::do_output_local_symbol_count): New function.
5014         (Relobj::do_local_symbol_offset): New function.
5015         (Sized_relobj::do_output_local_symbol_count): New function.
5016         (Sized_relobj::do_local_symbol_offset): New function.
5017
5018 2011-04-22  Vladimir Simonov  <sv@sw.ru>
5019
5020         * descriptors.cc (set_close_on_exec): New function.
5021         (Descriptors::open): Use set_close_on_exec.
5022         * output.cc (S_ISLNK): Define if not defined.
5023
5024 2011-04-22 Cary Coutant  <ccoutant@google.com>
5025
5026         * incremental.cc (Sized_incremental_binary::setup_readers): Allocate
5027         global symbol map.
5028         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5029         (Sized_incr_relobj::do_add_symbols): Add symbols to global symbol map.
5030         (Sized_incr_relobj::do_relocate): Remap section indices in incremental
5031         relocations.
5032         (Sized_incr_dynobj::do_add_symbols): Add symbols to global symbol map.
5033         (Sized_incr_dynobj::do_for_all_global_symbols): Remove FIXME.
5034         (Sized_incr_dynobj::do_for_all_local_got_entries): Likewise.
5035         * incremental.h
5036         (Incremental_inputs_reader::global_symbol_reader_at_offset): New
5037         function.
5038         (Incremental_binary::apply_incremental_relocs): New function.
5039         (Incremental_binary::do_apply_incremental_relocs): New function.
5040         (Sized_incremental_binary::Sized_incremental_binary): Initialize new
5041         data member.
5042         (Sized_incremental_binary::add_global_symbol): New function.
5043         (Sized_incremental_binary::global_symbol): New function.
5044         (Sized_incremental_binary::do_apply_incremental_relocs): New function.
5045         (Sized_incremental_binary::symbol_map_): New data member.
5046         * layout.cc (Layout_task_runner::run): Apply incremental relocations.
5047         * target.h (Sized_target::apply_relocation): New function.
5048         * target-reloc.h (apply_relocation): New function.
5049         * x86_64.cc (Target_x86_64::apply_relocation): New function.
5050
5051 2011-04-22  Doug Kwan  <dougkwan@google.com>
5052
5053         * arm.cc (Arm_output_section::Arm_output_section): Set SHF_LINK_ORDER
5054         flag of a SHT_ARM_EXIDX section.
5055         * testsuite/Makefile.am (arm_exidx_test): New test rules.
5056         * testsuite/Makefile.in: Regenerate.
5057         * testsuite/arm_exidx_test.s: New file.
5058         * testsuite/arm_exidx_test.sh: Same.
5059
5060 2011-04-20 Cary Coutant  <ccoutant@google.com>
5061
5062         PR gold/12689
5063         * archive.h (Incremental_archive_entry::Archive_member):
5064         Initialize arg_serial_ (second constructor).
5065
5066 2011-04-17  Ian Lance Taylor  <iant@google.com>
5067
5068         * object.cc (Relocate_info::location): Simplify location string.
5069         * errors.cc (Errors::error_at_location): Don't print program
5070         name.
5071         (Errors::warning_at_location): Likewise.
5072         (Errors::undefined_symbol): Likewise.
5073         * testsuite/debug_msg.sh: Update accordingly.
5074
5075 2011-04-14 Cary Coutant  <ccoutant@google.com>
5076
5077         * gold/layout.cc (Layout::symtab_section_offset): New function.
5078         * gold/layout.h (Layout::symtab_section_offset): New function.
5079         * gold/reloc.cc (Sized_relobj::do_relocate): Call it.
5080
5081 2011-04-12  Ian Lance Taylor  <iant@google.com>
5082
5083         * configure.ac: Check for sys/mman.h and mmap.  Check for mremap
5084         with MREMAP_MAYMOVE.
5085         * output.h (class Output_file): Add map_is_allocated_ field.
5086         * output.cc: Only #include <sys/mman.h> if it exists.  If mmap is
5087         not available, provide stubs.  If mremap is not available, #define
5088         it to gold_mremap.
5089         (MREMAP_MAYMOVE): Define if not defined.
5090         (Output_file::Output_file): Initialize map_is_allocated_.
5091         (Output_file::resize): Check map_is_allocated_.
5092         (Output_file::map_anonymous): If mmap fails, use malloc.
5093         (Output_file::unmap): Don't do anything for an anonymous map.
5094         * fileread.cc: Only #include <sys/mman.h> if it exists.  If mmap
5095         is not available, provide stubs.
5096         (File_read::View::~View): Use free rather than delete[].
5097         (File_read::make_view): Use malloc rather than new[].  If mmap
5098         fails, use malloc.
5099         (File_read::find_or_make_view): Use malloc rather than new[].
5100         * gold.h: Remove HAVE_REMAP code.
5101         * mremap.c: #include <errno.h>.  Only #include <sys/mman.h> if it
5102         exists.  Rename mremap to gold_mremap.  If mmap is not available
5103         don't do anything.
5104         * configure, config.in: Rebuild.
5105
5106 2011-04-11  Ian Lance Taylor  <iant@google.com>
5107
5108         * incremental.cc (Sized_incr_relobj::do_add_symbols): Always
5109         initialize local variable v.
5110
5111 2011-04-11  Cary Coutant  <ccoutant@google.com>
5112
5113         * archive.cc (Archive::include_member): Adjust call to
5114         report_object.
5115         (Add_archive_symbols::run): Track argument serial numbers.
5116         (Lib_group::include_member): Likewise.
5117         (Add_lib_group_symbols::run): Adjust call to report_archive_begin.
5118         * archive.h (Incremental_archive_entry::Archive_member):
5119         Initialize arg_serial_.
5120         (Archive_member::arg_serial_): New data member.
5121         * dynobj.cc (Dynobj::Dynobj): Allow input_file_ to be NULL.
5122         (Sized_dynobj::do_add_symbols): Track symbols when doing an
5123         incremental link.
5124         (Sized_dynobj::do_for_all_local_got_entries): New function.
5125         * dynobj.h: (Sized_dynobj::do_for_all_local_got_entries): New
5126         function.
5127         * fileread.cc (get_mtime): New function.
5128         * fileread.h (get_mtime): New function.
5129         * gold.cc (queue_initial_tasks): Check for incremental update.
5130         (process_incremental_input): New function.
5131         (queue_middle_tasks): Don't force valid target for incremental
5132         update.
5133         * incremental-dump.cc (find_input_containing_global): Adjust
5134         size of symbol info entry.
5135         (dump_incremental_inputs): Dump argument serial number and
5136         in_system_directory flag; bias shndx by 1; print symbol names
5137         when dumping per-file symbol lists; use new symbol info readers.
5138         * incremental.cc
5139         (Output_section_incremental_inputs:update_data_size): New function.
5140         (Sized_incremental_binary::setup_readers): Setup input readers
5141         for each input file; build maps for files added from libraries
5142         and scripts.
5143         (Sized_incremental_binary::check_input_args): New function.
5144         (Sized_incremental_binary::do_check_inputs): Build map of argument
5145         serial numbers to input arguments.
5146         (Sized_incremental_binary::do_file_has_changed): Rename
5147         do_file_is_unchanged to this; compare file modification times.
5148         (Sized_incremental_binary::do_init_layout): New function.
5149         (Sized_incremental_binary::do_reserve_layout): New function.
5150         (Sized_incremental_binary::do_get_input_reader): Remove.
5151         (Sized_incremental_binary::get_symtab_view): New function.
5152         (Incremental_checker::can_incrementally_link_output_file): Remove.
5153         (Incremental_inputs::report_command_line): Exclude --debug options.
5154         (Incremental_inputs::report_archive_begin): Add parameter; track
5155         argument serial numbers; don't put input file entry for archive
5156         before archive members.
5157         (Incremental_inputs::report_archive_end): Put input file entry
5158         for archive after archive members.
5159         (Incremental_inputs::report_object): Add parameter; track argument
5160         serial numbers and in_system_directory flag.
5161         (Incremental_inputs::report_script): Add parameter; track argument
5162         serial numbers.
5163         (Output_section_incremental_inputs::set_final_data_size): Adjust
5164         size of symbol info entry; check for forwarding symbols.
5165         (Output_section_incremental_inputs::write_input_files): Write
5166         in_system_directory flag and argument serial number.
5167         (Output_section_incremental_inputs::write_info_blocks): Map section
5168         indices between incremental info and original input file; store
5169         input section index for each symbol.
5170         (class Local_got_offset_visitor): Derive from Got_offset_list::Visitor;
5171         change operator() to visit().
5172         (class Global_got_offset_visitor): Likewise.
5173         (class Global_symbol_visitor_got_plt):
5174         (Output_section_incremental_inputs::write_got_plt): Use new visitor
5175         classes.
5176         (Sized_incr_relobj::Sized_incr_relobj): New constructor.
5177         (Sized_incr_relobj::do_read_symbols): New function.
5178         (Sized_incr_relobj::do_layout): New function.
5179         (Sized_incr_relobj::do_layout_deferred_sections): New function.
5180         (Sized_incr_relobj::do_add_symbols): New function.
5181         (Sized_incr_relobj::do_should_include_member): New function.
5182         (Sized_incr_relobj::do_for_all_global_symbols): New function.
5183         (Sized_incr_relobj::do_for_all_local_got_entries): New function.
5184         (Sized_incr_relobj::do_section_size): New function.
5185         (Sized_incr_relobj::do_section_name): New function.
5186         (Sized_incr_relobj::do_section_contents): New function.
5187         (Sized_incr_relobj::do_section_flags): New function.
5188         (Sized_incr_relobj::do_section_entsize): New function.
5189         (Sized_incr_relobj::do_section_address): New function.
5190         (Sized_incr_relobj::do_section_type): New function.
5191         (Sized_incr_relobj::do_section_link): New function.
5192         (Sized_incr_relobj::do_section_info): New function.
5193         (Sized_incr_relobj::do_section_addralign): New function.
5194         (Sized_incr_relobj::do_initialize_xindex): New function.
5195         (Sized_incr_relobj::do_get_global_symbol_counts): New function.
5196         (Sized_incr_relobj::do_read_relocs): New function.
5197         (Sized_incr_relobj::do_gc_process_relocs): New function.
5198         (Sized_incr_relobj::do_scan_relocs): New function.
5199         (Sized_incr_relobj::do_count_local_symbols): New function.
5200         (Sized_incr_relobj::do_finalize_local_symbols): New function.
5201         (Sized_incr_relobj::do_set_local_dynsym_indexes): New function.
5202         (Sized_incr_relobj::do_set_local_dynsym_offset): New function.
5203         (Sized_incr_relobj::do_relocate): New function.
5204         (Sized_incr_relobj::do_set_section_offset): New function.
5205         (Sized_incr_dynobj::Sized_incr_dynobj): New function.
5206         (Sized_incr_dynobj::do_read_symbols): New function.
5207         (Sized_incr_dynobj::do_layout): New function.
5208         (Sized_incr_dynobj::do_add_symbols): New function.
5209         (Sized_incr_dynobj::do_should_include_member): New function.
5210         (Sized_incr_dynobj::do_for_all_global_symbols): New function.
5211         (Sized_incr_dynobj::do_for_all_local_got_entries): New function.
5212         (Sized_incr_dynobj::do_section_size): New function.
5213         (Sized_incr_dynobj::do_section_name): New function.
5214         (Sized_incr_dynobj::do_section_contents): New function.
5215         (Sized_incr_dynobj::do_section_flags): New function.
5216         (Sized_incr_dynobj::do_section_entsize): New function.
5217         (Sized_incr_dynobj::do_section_address): New function.
5218         (Sized_incr_dynobj::do_section_type): New function.
5219         (Sized_incr_dynobj::do_section_link): New function.
5220         (Sized_incr_dynobj::do_section_info): New function.
5221         (Sized_incr_dynobj::do_section_addralign): New function.
5222         (Sized_incr_dynobj::do_initialize_xindex): New function.
5223         (Sized_incr_dynobj::do_get_global_symbol_counts): New function.
5224         (make_sized_incremental_object): New function.
5225         (Incremental_library::copy_unused_symbols): New function.
5226         (Incremental_library::do_for_all_unused_symbols): New function.
5227         * incremental.h (enum Incremental_input_flags): New type.
5228         (class Incremental_checker): Remove.
5229         (Incremental_input_entry::Incremental_input_entry): Add argument
5230         serial number.
5231         (Incremental_input_entry::arg_serial): New function.
5232         (Incremental_input_entry::set_is_in_system_directory): New function.
5233         (Incremental_input_entry::is_in_system_directory): New function.
5234         (Incremental_input_entry::arg_serial_): New data member.
5235         (Incremental_input_entry::is_in_system_directory_): New data member.
5236         (class Script_info): Move here from script.h.
5237         (Script_info::Script_info): Add filename parameter.
5238         (Script_info::filename): New function.
5239         (Script_info::filename_): New data member.
5240         (Incremental_script_entry::Incremental_script_entry): Add argument
5241         serial number.
5242         (Incremental_object_entry::Incremental_object_entry): Likewise.
5243         (Incremental_object_entry::add_input_section): Build list of input
5244         sections with map to original shndx.
5245         (Incremental_object_entry::get_input_section_index): New function.
5246         (Incremental_object_entry::shndx_): New data member.
5247         (Incremental_object_entry::name_key_): Rename; adjust all refs.
5248         (Incremental_object_entry::sh_size_): Rename; adjust all refs.
5249         (Incremental_archive_entry::Incremental_archive_entry): Add argument
5250         serial number.
5251         (Incremental_inputs::report_archive_begin): Likewise.
5252         (Incremental_inputs::report_object): Likewise.
5253         (Incremental_inputs::report_script): Likewise.
5254         (class Incremental_global_symbol_reader): New class.
5255         (Incremental_input_entry_reader::Incremental_input_entry_reader): Read
5256         and store flags and input file type.
5257         (Incremental_input_entry_reader::arg_serial): New function.
5258         (Incremental_input_entry_reader::type): Extract type from flags.
5259         (Incremental_input_entry_reader::is_in_system_directory): New function.
5260         (Incremental_input_entry_reader::get_input_section_count): Call
5261         accessor function for type.
5262         (Incremental_input_entry_reader::get_symbol_offset): Call accessor
5263         function for type; adjust size of global symbol entry.
5264         (Incremental_input_entry_reader::get_global_symbol_count): Call
5265         accessor function for type.
5266         (Incremental_input_entry_reader::get_object_count): Likewise.
5267         (Incremental_input_entry_reader::get_object_offset): Likewise.
5268         (Incremental_input_entry_reader::get_member_count): Likewise.
5269         (Incremental_input_entry_reader::get_unused_symbol_count): Likewise.
5270         (Incremental_input_entry_reader::get_member_offset): Likewise.
5271         (Incremental_input_entry_reader::get_unused_symbol): Likewise.
5272         (Incremental_input_entry_reader::Global_symbol_info): Remove.
5273         (Incremental_input_entry_reader::get_global_symbol_info): Remove.
5274         (Incremental_input_entry_reader::get_global_symbol_reader): New
5275         function.
5276         (Incremental_input_entry_reader::get_output_symbol_index): New
5277         function.
5278         (Incremental_input_entry_reader::type_): Remove.
5279         (Incremental_input_entry_reader::flags_): New data member.
5280         (Incremental_inputs_reader::input_file_offset): New function.
5281         (Incremental_inputs_reader::input_file_index): New function.
5282         (Incremental_inputs_reader::input_file): Call input_file_offset.
5283         (Incremental_inputs_reader::input_file_at_offset): New function.
5284         (Incremental_relocs_reader::get_r_type): Reformat.
5285         (Incremental_relocs_reader::get_r_shndx): Reformat.
5286         (Incremental_relocs_reader::get_r_offset): Reformat.
5287         (Incremental_relocs_reader::data): New function.
5288         (Incremental_binary::Incremental_binary): Initialize new data members.
5289         (Incremental_binary::check_inputs): Add cmdline parameter.
5290         (Incremental_binary::file_is_unchanged): Remove.
5291         (Input_reader::arg_serial): New function.
5292         (Input_reader::get_unused_symbol_count): New function.
5293         (Input_reader::get_unused_symbol): New function.
5294         (Input_reader::do_arg_serial): New function.
5295         (Input_reader::do_get_unused_symbol_count): New function.
5296         (Input_reader::do_get_unused_symbol): New function.
5297         (Incremental_binary::input_file_count): New function.
5298         (Incremental_binary::get_input_reader): Change signature to use
5299         index instead of filename.
5300         (Incremental_binary::file_has_changed): New function.
5301         (Incremental_binary::get_input_argument): New function.
5302         (Incremental_binary::get_library): New function.
5303         (Incremental_binary::get_script_info): New function.
5304         (Incremental_binary::init_layout): New function.
5305         (Incremental_binary::reserve_layout): New function.
5306         (Incremental_binary::output_file): New function.
5307         (Incremental_binary::do_check_inputs): New function.
5308         (Incremental_binary::do_file_is_unchanged): Remove.
5309         (Incremental_binary::do_file_has_changed): New function.
5310         (Incremental_binary::do_init_layout): New function.
5311         (Incremental_binary::do_reserve_layout): New function.
5312         (Incremental_binary::do_input_file_count): New function.
5313         (Incremental_binary::do_get_input_reader): Change signature.
5314         (Incremental_binary::input_args_map_): New data member.
5315         (Incremental_binary::library_map_): New data member.
5316         (Incremental_binary::script_map_): New data member.
5317         (Sized_incremental_binary::Sized_incremental_binary): Initialize
5318         new data members.
5319         (Sized_incremental_binary::output_section): New function.
5320         (Sized_incremental_binary::inputs_reader): Add const.
5321         (Sized_incremental_binary::symtab_reader): Add const.
5322         (Sized_incremental_binary::relocs_reader): Add const.
5323         (Sized_incremental_binary::got_plt_reader): Add const.
5324         (Sized_incremental_binary::get_symtab_view): New function.
5325         (Sized_incremental_binary::Inputs_reader): New typedef.
5326         (Sized_incremental_binary::Input_entry_reader): New typedef.
5327         (Sized_incremental_binary::do_check_inputs): Add cmdline parameter.
5328         (Sized_incremental_binary::do_file_is_unchanged): Remove.
5329         (Sized_incremental_binary::do_file_has_changed): New function.
5330         (Sized_incremental_binary::do_init_layout): New function.
5331         (Sized_incremental_binary::do_reserve_layout): New function.
5332         (Sized_input_reader::Inputs_reader): Remove.
5333         (Sized_input_reader::Input_entry_reader): Remove.
5334         (Sized_input_reader::do_arg_serial): New function.
5335         (Sized_input_reader::do_get_unused_symbol_count): New function.
5336         (Sized_input_reader::do_get_unused_symbol): New function.
5337         (Sized_incremental_binary::do_input_file_count): New function.
5338         (Sized_incremental_binary::do_get_input_reader): Change signature;
5339         use index instead of filename.
5340         (Sized_incremental_binary::section_map_): New data member.
5341         (Sized_incremental_binary::input_entry_readers_): New data member.
5342         (class Sized_incr_relobj): New class.
5343         (class Sized_incr_dynobj): New class.
5344         (make_sized_incremental_object): New function.
5345         (class Incremental_library): New class.
5346         * layout.cc (Free_list::num_lists): New static data member.
5347         (Free_list::num_nodes): New static data member.
5348         (Free_list::num_removes): New static data member.
5349         (Free_list::num_remove_visits): New static data member.
5350         (Free_list::num_allocates): New static data member.
5351         (Free_list::num_allocate_visits): New static data member.
5352         (Free_list::init): New function.
5353         (Free_list::remove): New function.
5354         (Free_list::allocate): New function.
5355         (Free_list::dump): New function.
5356         (Free_list::print_stats): New function.
5357         (Layout_task_runner::run): Resize output file for incremental updates.
5358         (Layout::Layout): Initialize new data members.
5359         (Layout::set_incremental_base): New function.
5360         (Layout::init_fixed_output_section): New function.
5361         (Layout::layout_eh_frame): Do not build .eh_frame_hdr section for
5362         incremental updates.
5363         (Layout::create_gold_note): Do not create gold note section for
5364         incremental updates.
5365         (Layout::set_segment_offsets): Do not recalculate RELRO alignment
5366         for incremental updates.
5367         (Layout::set_section_offsets): For incremental updates, allocate space
5368         from free list.
5369         (Layout::create_symtab_sections): Layout with offsets relative to
5370         start of section; for incremental updates, allocate space from free
5371         list.
5372         (Layout::create_shdrs): For incremental updates, allocate space from
5373         free list.
5374         (Layout::finish_dynamic_section): For incremental updates, do not
5375         check --as-needed (fixed in subsequent patch).
5376         * layout.h (class Free_list): New class.
5377         (Layout::set_incremental_base): New function.
5378         (Layout::incremental_base): New function.
5379         (Layout::init_fixed_output_section): New function.
5380         (Layout::allocate): New function.
5381         (Layout::incremental_base_): New data member.
5382         (Layout::free_list_): New data member.
5383         * main.cc (main): Print Free_list statistics.
5384         * object.cc (Relobj::finalize_incremental_relocs): Add
5385         clear_counts parameter; clear counts only when clear_counts is set.
5386         (Sized_relobj::Sized_relobj): Initialize new base class.
5387         (Sized_relobj::do_layout): Don't report special sections.
5388         (Sized_relobj::do_for_all_local_got_entries): New function.
5389         (Sized_relobj::write_local_symbols): Add symtab_off parameter; add
5390         symtab_off to all symbol table offsets.
5391         (Sized_relobj::do_get_global_symbol_counts): Add typename keyword.
5392         * object.h (class Got_offset_list): Move to top of file.
5393         (Object::Object): Allow case where input_file == NULL.
5394         (Object::~Object): Likewise.
5395         (Object::input_file): Assert that input_file != NULL.
5396         (Object::lock): Allow case where input_file == NULL.
5397         (Object::unlock): Likewise.
5398         (Object::is_locked): Likewise.
5399         (Object::token): Likewise.
5400         (Object::release): Likewise.
5401         (Object::is_incremental): New function.
5402         (Object::get_mtime): New function.
5403         (Object::for_all_local_got_entries): New function.
5404         (Object::clear_view_cache_marks): Allow case where input_file == NULL.
5405         (Object::set_is_in_system_directory): New function.
5406         (Object::is_in_system_directory): New function.
5407         (Object::do_is_incremental): New function.
5408         (Object::do_get_mtime): New function.
5409         (Object::do_for_all_local_got_entries): New function.
5410         (Object::is_in_system_directory_): New data member.
5411         (Relobj::finalize_incremental_relocs): Add clear_counts parameter.
5412         (class Sized_relobj_base): New class.
5413         (class Sized_relobj): Derive from Sized_relobj_base.
5414         (class Sized_relobj::Symbols): Redeclare from base class.
5415         (class Sized_relobj::local_got_offset_list): Remove.
5416         (class Sized_relobj::Output_sections): Redeclare from base class.
5417         (class Sized_relobj::do_for_all_local_got_entries): New function.
5418         (class Sized_relobj::write_local_symbols): Add offset parameter.
5419         (class Sized_relobj::local_symbol_offset_): Update comment.
5420         (class Sized_relobj::local_dynsym_offset_): Update comment.
5421         * options.cc (Input_arguments::add_file): Remove const.
5422         * options.h (Input_file_argument::Input_file_argument):
5423         Initialize arg_serial_ (all constructors).
5424         (Input_file_argument::set_arg_serial): New function.
5425         (Input_file_argument::arg_serial): New function.
5426         (Input_file_argument::arg_serial_): New data member.
5427         (Input_arguments::Input_arguments): Initialize file_count_.
5428         (Input_arguments::add_file): Remove const.
5429         (Input_arguments::number_of_input_files): New function.
5430         (Input_arguments::file_count_): New data member.
5431         (Command_line::number_of_input_files): Call
5432         Input_arguments::number_of_input_files.
5433         * output.cc (Output_segment_headers::Output_segment_headers):
5434         Set current size.
5435         (Output_section::Input_section::current_data_size): New function.
5436         (Output_section::Output_section): Initialize new data members.
5437         (Output_section::add_input_section): Don't do merge sections for
5438         an incremental link; allocate space from free list for an
5439         incremental update.
5440         (Output_section::add_output_section_data): Allocate space from
5441         free list for an incremental update.
5442         (Output_section::update_data_size): New function.
5443         (Output_section::set_fixed_layout): New function.
5444         (Output_section::reserve): New function.
5445         (Output_segment::set_section_addresses): Remove const.
5446         (Output_segment::set_section_list_addresses): Remove const; allocate
5447         space from free list for an incremental update.
5448         (Output_segment::set_offset): Adjust size of RELRO segment for an
5449         incremental update.
5450         * output.h (Output_data::current_data_size): Move here from
5451         child classes.
5452         (Output_data::pre_finalize_data_size): New function.
5453         (Output_data::update_data_size): New function.
5454         (Output_section_headers::update_data_size): new function.
5455         (Output_section_data_build::current_data_size): Move to Output_data.
5456         (Output_data_strtab::update_data_size): New function.
5457         (Output_section::current_data_size): Move to Output_data.
5458         (Output_section::set_fixed_layout): New function.
5459         (Output_section::has_fixed_layout): New function.
5460         (Output_section::reserve): New function.
5461         (Output_section::update_data_size): New function.
5462         (Output_section::has_fixed_layout_): New data member.
5463         (Output_section::free_list_): New data member.
5464         (Output_segment::set_section_addresses): Remove const.
5465         (Output_segment::set_section_list_addresses): Remove const.
5466         * plugin.cc (Sized_pluginobj::do_for_all_local_got_entries):
5467         New function.
5468         * plugin.h (Sized_pluginobj::do_for_all_local_got_entries):
5469         New function.
5470         * readsyms.cc (Read_symbols::do_read_symbols): Add library
5471         parameter when calling Add_symbols constructor; store argument
5472         serial number for members of a lib group.
5473         (Add_symbols::locks): Allow case where token == NULL.
5474         (Add_symbols::run): Report libraries denoted by --start-lib/--end-lib.
5475         (Read_member::~Read_member): New function.
5476         (Read_member::is_runnable): New function.
5477         (Read_member::locks): New function.
5478         (Read_member::run): New function.
5479         (Check_script::~Check_script): New function.
5480         (Check_script::is_runnable): New function.
5481         (Check_script::locks): New function.
5482         (Check_script::run): New function.
5483         (Check_library::~Check_library): New function.
5484         (Check_library::is_runnable): New function.
5485         (Check_library::locks): New function.
5486         (Check_library::run): New function.
5487         * readsyms.h (Add_symbols::Add_symbols): Add library parameter.
5488         (Add_symbols::library_): New data member.
5489         (class Read_member): New class.
5490         (class Check_script): New class.
5491         (class Check_library): New class.
5492         * reloc.cc (Read_relocs::is_runnable): Allow case where
5493         token == NULL.
5494         (Read_relocs::locks): Likewise.
5495         (Scan_relocs::locks): Likewise.
5496         (Relocate_task::locks): Likewise.
5497         (Sized_relobj::do_scan_relocs): Tell finalize_incremental_relocs
5498         to clear counters.
5499         (Sized_relobj::incremental_relocs_scan): Fix comment.
5500         (Sized_relobj::do_relocate): Pass output file offset to
5501         write_local_symbols.
5502         (Sized_relobj::incremental_relocs_write_reltype): Use reloc_size
5503         from class declaration.
5504         * script.cc (read_input_script): Allocate Script_info; pass
5505         argument serial number to report_script.
5506         * script.h (class Script_info): Move to incremental.h.
5507         * symtab.cc (Symbol_table::add_from_incrobj): New function.
5508         * symtab.h (Symbol_table::add_from_incrobj): New function.
5509         (Symbol_table::set_file_offset): New function.
5510
5511 2011-04-05  Cary Coutant  <ccoutant@google.com>
5512
5513         * incremental-dump.cc (dump_incremental_inputs): Change signature
5514         to take a Sized_incremental_binary; change caller.  Use readers
5515         in Sized_incremental_binary.
5516         * incremental.cc
5517         (Sized_incremental_binary::find_incremental_inputs_sections):
5518         Rename do_find_incremental_inputs_sections to this.
5519         (Sized_incremental_binary::setup_readers): New function.
5520         (Sized_incremental_binary::do_check_inputs): Check
5521         has_incremental_info_ flag; move setup code to setup_readers;
5522         use input readers.
5523         (Sized_incremental_binary::do_file_is_unchanged): New function.
5524         (Sized_incremental_binary::do_get_input_reader): New function.
5525         * incremental.h (class Incremental_binary): Move to end of file.
5526         (Incremental_binary::file_is_unchanged): New function.
5527         (Incremental_binary::do_file_is_unchanged): New function.
5528         (Incremental_binary::Input_reader): New class.
5529         (Incremental_binary::get_input_reader): New function.
5530         (class Sized_incremental_binary): Move to end of file.
5531         (Sized_incremental_binary::Sized_incremental_binary): Setup the
5532         input section reader classes.
5533         (Sized_incremental_binary::has_incremental_info): New function.
5534         (Sized_incremental_binary::inputs_reader): New function.
5535         (Sized_incremental_binary::symtab_reader): New function.
5536         (Sized_incremental_binary::relocs_reader): New function.
5537         (Sized_incremental_binary::got_plt_reader): New function.
5538         (Sized_incremental_binary::do_file_is_unchanged): New function.
5539         (Sized_incremental_binary::Sized_input_reader): New class.
5540         (Sized_incremental_binary::get_input_reader): New function.
5541         (Sized_incremental_binary::find_incremental_inputs_sections):
5542         Rename do_find_incremental_inputs_sections to this.
5543         (Sized_incremental_binary::setup_readers): New function.
5544         (Sized_incremental_binary::has_incremental_info_): New data member.
5545         (Sized_incremental_binary::inputs_reader_): New data member.
5546         (Sized_incremental_binary::symtab_reader_): New data member.
5547         (Sized_incremental_binary::relocs_reader_): New data member.
5548         (Sized_incremental_binary::got_plt_reader_): New data member.
5549         (Sized_incremental_binary::current_input_file_): New data member.
5550
5551 2011-04-05  Paul Pluzhnikov  <ppluzhnikov@google.com>
5552
5553         PR gold/12640
5554         * dwarf_reader.cc (Sized_dwarf_line_info): Fix vector bounds
5555         violation.
5556
5557 2011-03-30  Cary Coutant  <ccoutant@google.com>
5558
5559         * archive.cc (Archive::include_member): Adjust call to report_object.
5560         (Add_archive_symbols::run): Add script_info to call to
5561         report_archive_begin.
5562         (Lib_group::include_member): Adjust call to report_object.
5563         (Add_lib_group_symbols::run): Adjust call to report_object.
5564         * incremental-dump.cc (dump_incremental_inputs): Remove unnecessary
5565         blocks.  Add object count for script input files.
5566         * incremental.cc (Incremental_inputs::report_archive_begin): Add
5567         script_info parameter; change all callers.
5568         (Incremental_inputs::report_object): Add script_info parameter;
5569         change all callers.
5570         (Incremental_inputs::report_script): Store backpointer to
5571         incremental info entry.
5572         (Output_section_incremental_inputs::set_final_data_size): Record
5573         additional information for scripts.
5574         (Output_section_incremental_inputs::write_info_blocks): Likewise.
5575         * incremental.h (Incremental_script_entry::add_object): New function.
5576         (Incremental_script_entry::get_object_count): New function.
5577         (Incremental_script_entry::get_object): New function.
5578         (Incremental_script_entry::objects_): New data member; adjust
5579         constructor.
5580         (Incremental_inputs::report_archive_begin): Add script_info parameter.
5581         (Incremental_inputs::report_object): Add script_info parameter.
5582         (Incremental_inputs_reader::get_object_count): New function.
5583         (Incremental_inputs_reader::get_object_offset): New function.
5584         * options.cc (Input_arguments::add_file): Return reference to
5585         new input argument.
5586         * options.h (Input_argument::set_script_info): New function.
5587         (Input_argument::script_info): New function.
5588         (Input_argument::script_info_): New data member; adjust all
5589         constructors.
5590         (Input_file_group::add_file): Return reference to new input argument.
5591         (Input_file_lib::add_file): Likewise.
5592         (Input_arguments::add_file): Likewise.
5593         * readsyms.cc (Add_symbols::run): Adjust call to report_object.
5594         * script.cc (Parser_closure::Parser_closure): Add script_info
5595         parameter; adjust all callers.
5596         (Parser_closure::script_info): New function.
5597         (Parser_closure::script_info_): New data member.
5598         (read_input_script): Report scripts earlier to incremental info.
5599         (script_add_file): Set script_info in Input_argument.
5600         (script_add_library): Likewise.
5601         * script.h (Script_options::Script_info): Rewrite class.
5602
5603 2011-03-29  Cary Coutant  <ccoutant@google.com>
5604
5605         * archive.cc (Library_base::should_include_member): Move
5606         method here from class Archive.
5607         (Archive::Archive): Initialize base class.
5608         (Archive::should_include_member): Move to base class.
5609         (Archive::do_for_all_unused_symbols): New function.
5610         (Add_archive_symbols::run): Remove redundant access to
5611         incremental_inputs.
5612         (Lib_group::Lib_group): Initialize base class.
5613         (Lib_group::do_filename): New function.
5614         (Lib_group::include_member): Pass pointer to Lib_group to
5615         report_object.
5616         (Lib_group::do_for_all_unused_symbols): New function.
5617         (Add_lib_group_symbols::run): Report archive information for
5618         incremental links.
5619         * archive.h (class Library_base): New base class.
5620         (class Archive): Derive from Library_base.
5621         (Archive::filename): Move to base class.
5622         (Archive::set_incremental_info): Likewise.
5623         (Archive::incremental_info): Likewise.
5624         (Archive::Should_include): Likewise.
5625         (Archive::should_include_member): Likewise.
5626         (Archive::Armap_entry): Remove.
5627         (Archive::Unused_symbol_iterator): Remove.
5628         (Archive::unused_symbols_begin): Remove.
5629         (Archive::unused_symbols_end): Remove.
5630         (Archive::do_filename): New function.
5631         (Archive::do_get_mtime): New function.
5632         (Archive::do_for_all_unused_symbols): New function.
5633         (Archive::task_): Move to base class.
5634         (Archive::incremental_info_): Likewise.
5635         (class Lib_group): Derive from Library_base.
5636         (Lib_group::do_filename): New function.
5637         (Lib_group::do_get_mtime): New function.
5638         (Lib_group::do_for_all_unused_symbols): New function.
5639         (Lib_group::task_): Move to base class.
5640         * dynobj.cc (Sized_dynobj::do_for_all_global_symbols): New
5641         function.
5642         * dynobj.h (Sized_dynobj::do_for_all_global_symbols): New
5643         function.
5644         * incremental.cc (Incremental_inputs::report_archive_begin):
5645         Use Library_base; call library's get_mtime; add incremental inputs
5646         entry before members.
5647         (class Unused_symbol_visitor): New class.
5648         (Incremental_inputs::report_archive_end): Use Library_base; use
5649         visitor class to record unused symbols; don't add incremental inputs
5650         entry after members.
5651         (Incremental_inputs::report_object): Use Library_base.
5652         * incremental.h
5653         (Incremental_archive_entry::Incremental_archive_entry): Remove
5654         unused Archive parameter.
5655         (Incremental_inputs::report_archive_begin): Use Library_base.
5656         (Incremental_inputs::report_archive_end): Likewise.
5657         (Incremental_inputs::report_object): Likewise.
5658         * object.cc (Sized_relobj::do_for_all_global_symbols): New
5659         function.
5660         * object.h (Object::for_all_global_symbols): New function.
5661         (Object::do_for_all_global_symbols): New function.
5662         (Sized_relobj::do_for_all_global_symbols): New function.
5663         * plugin.cc (Sized_pluginobj::do_for_all_global_symbols):  New
5664         function.
5665         * plugin.h (Sized_pluginobj::do_for_all_global_symbols):  New
5666         function.
5667
5668 2011-03-27  Ian Lance Taylor  <iant@google.com>
5669
5670         * archive.cc (Archive::interpret_header): Return -1 if something
5671         goes wrong.  Change callers accordingly.
5672
5673 2011-03-25  Cary Coutant  <ccoutant@google.com>
5674
5675         * testsuite/Makefile.am (final_layout.stdout): Use -n option with nm.
5676         * testsuite/Makefile.in: Regenerate.
5677
5678 2011-03-23  Rafael Ávila de Espíndola <respindola@mozilla.com>
5679
5680         * plugin.cc (get_view): New.
5681         (Plugin::load): Pass get_view to the plugin.
5682         (Plugin_manager::get_view): New.
5683
5684 2011-03-21  Ian Lance Taylor  <iant@google.com>
5685
5686         * testsuite/final_layout.sh: Rewrite to not use dc.
5687         * testsuite/relro_test.sh: Fail if dc is not present.
5688
5689 2011-03-21  Sriraman Tallam  <tmsriram@google.com>
5690
5691         * testsuite/icf_safe_so_test.sh: Add #!/bin/sh to start.
5692         Change == to -eq.
5693         * testsuite/icf_string_merge_test.sh: Add #!/bin/sh to start.
5694         * testsuite/icf_safe_test.sh: Add #!/bin/sh to start.
5695         Change == to -eq.
5696         * testsuite/icf_sht_rel_addend_test.sh: Add #!/bin/sh to start.
5697         * testsuite/icf_preemptible_functions_test.sh: Add #!/bin/sh to start.
5698
5699 2011-03-14  Ian Lance Taylor  <iant@google.com>
5700
5701         * script-sections.cc (Sort_output_sections::script_compare):
5702         Rename from is_before, change return type.
5703         (Sort_output_sections::operator()): Adjust accordingly.
5704
5705 2011-03-11  Jeffrey Yasskin  <jyasskin@google.com>
5706
5707         PR gold/12572
5708         * testsuite/odr_violation2.cc: Add comment to make all error line
5709         numbers double digits.
5710         * testsuite/debug_msg.sh: Adjust expected errors.
5711
5712 2011-03-09  Jeffrey Yasskin  <jyasskin@google.com>
5713
5714         * dwarf_reader.cc (Sized_dwarf_line_info): Include all lines,
5715         but mark earlier ones as non-canonical
5716         (offset_to_iterator): Update search target and example
5717         (do_addr2line): Return extra lines in a vector*
5718         (format_file_lineno): Extract from do_addr2line
5719         (one_addr2line): Add vector* out-param
5720         * dwarf_reader.h (Offset_to_lineno_entry): New field recording
5721         when a lineno entry appeared last for its instruction
5722         (Dwarf_line_info): Add vector* out-param
5723         * object.cc (Relocate_info): Pass NULL for the vector* out-param
5724         * symtab.cc (Odr_violation_compare): Include the lineno in the
5725         comparison again.
5726         (linenos_from_loc): New. Combine the canonical line for an
5727         address with its other lines.
5728         (True_if_intersect): New. Helper functor to make
5729         std::set_intersection a query.
5730         (detect_odr_violations): Compare sets of lines instead of just
5731         one line for each function. This became less deterministic, but
5732         has fewer false positives.
5733         * symtab.h: Declarations.
5734         * testsuite/Makefile.am (odr_violation2.o): Compile with -O2 to
5735         mix an optimized and non-optimized object in the same binary
5736         (odr_violation2.so): Same.
5737         * testsuite/Makefile.in: Regenerate from Makefile.am.
5738         * testsuite/debug_msg.cc (main): Make OdrDerived classes.
5739         * testsuite/debug_msg.sh: Update line numbers and add
5740         assertions.
5741         * testsuite/odr_violation1.cc: Use OdrDerived, in a
5742         non-optimized context.
5743         * testsuite/odr_violation2.cc: Make sure Ordering::operator()
5744         isn't inlined, and use OdrDerived in an optimized context.
5745         * testsuite/odr_header1.h: Defines OdrDerived, where
5746         optimization will change the
5747         first-instruction-in-the-destructor's file and line number.
5748         * testsuite/odr_header2.h: Defines OdrBase.
5749
5750 2011-03-09  Ian Lance Taylor  <iant@google.com>
5751
5752         * fileread.cc (File_read::clear_views): Don't delete the whole
5753         file view.
5754
5755 2011-03-08  Ian Lance Taylor  <iant@google.com>
5756
5757         PR gold/12525
5758         * fileread.cc: #include <climits>.
5759         (GOLD_IOV_MAX): Define.
5760         (File_read::read_multiple): Limit number of entries by iov_max.
5761         * fileread.h (class File_read): Always set max_readv_entries to
5762         128.
5763
5764 2011-03-07  Ian Lance Taylor  <iant@google.com>
5765
5766         PR gold/12525
5767         * options.h (class General_options): Add -dy and -dn.
5768
5769 2011-03-02  Cary Coutant  <ccoutant@google.com>
5770
5771         * testsuite/script_test_9.t: Add TLS segment.
5772
5773 2011-03-02  Simon Baldwin  <simonb@google.com>
5774
5775         * configure.ac: Add check for gnu_indirect_function support in
5776         the toolchain building binutils.
5777         * configure: Rebuild.
5778
5779 2011-02-18  Rafael Ávila de Espíndola <respindola@mozilla.com>
5780
5781         * symtab.cc (Symbol::should_add_dynsym_entry) Return false for
5782         plugin only symbols.
5783         (Symbol_table::sized_finalize_symbol) Mark symbol only present
5784         in plugin files as not needed in the symbol table.
5785
5786 2011-02-11  Sriraman Tallam  <tmsriram@google.com>
5787
5788         * output.cc (Output_section::add_input_section): Delay fill
5789         generation for section ordering.
5790
5791 2011-02-09  Ian Lance Taylor  <iant@google.com>
5792
5793         PR gold/12316
5794         * object.h (class Sized_relobj): Remove clear_local_symbols.
5795         * reloc.cc (Sized_relobj::do_relocate): Don't call
5796         clear_local_symbols.
5797
5798 2011-02-08  Rafael Ávila de Espíndola <respindola@mozilla.com>
5799
5800         * plugin.cc (is_visible_from_outside): Return true for symbols
5801         in the -u option.
5802
5803 2011-02-04  Jeffrey Yasskin  <jyasskin@google.com>
5804
5805         * symtab.cc (Odr_violation_compare::operator()): Sort by just the
5806         filename.
5807
5808 2011-02-02  Sriraman Tallam  <tmsriram@google.com>
5809
5810         * icf.h (is_section_foldable_candidate): Change type of parameter
5811         to std::string.
5812         * icf.cc (Icf::find_identical_sections): Change type of local variable
5813         section_name to be std::string.
5814         (is_function_ctor_or_dtor): Change type of parameter to std::string.
5815
5816 2011-01-25  Ian Lance Taylor  <iant@google.com>
5817
5818         * script.cc (script_add_extern): Rewrite to use
5819         add_symbol_reference.
5820
5821 2011-01-25  Doug Kwan  <dougkwan@google.com>
5822
5823         * icf.cc (get_section_contents): Always lock section's object.
5824
5825 2011-01-24  Ian Lance Taylor  <iant@google.com>
5826
5827         * options.h (class General_options): Accept
5828         --no-detect-odr-violations.
5829
5830 2011-01-24  Ian Lance Taylor  <iant@google.com>
5831
5832         * version.cc (version_string): Bump to 1.11.
5833
5834 2011-01-24  Ian Lance Taylor  <iant@google.com>
5835
5836         * plugin.cc (class Plugin_rescan): Define new class.
5837         (Plugin_manager::claim_file): Set any_claimed_.
5838         (Plugin_manager::save_archive): New function.
5839         (Plugin_manager::save_input_group): New function.
5840         (Plugin_manager::all_symbols_read): Create Plugin_rescan task if
5841         necessary.
5842         (Plugin_manager::new_undefined_symbol): New function.
5843         (Plugin_manager::rescan): New function.
5844         (Plugin_manager::rescannable_defines): New function.
5845         (Plugin_manager::add_input_file): Set any_added_.
5846         * plugin.h (class Plugin_manager): define new fields rescannable_,
5847         undefined_symbols_, any_claimed_, and any_added_.  Declare
5848         Plugin_rescan as friend.  Declare new functions.
5849         (Plugin_manager::Rescannable): Define type.
5850         (Plugin_manager::Rescannable_list): Define type.
5851         (Plugin_manager::Undefined_symbol_list): Define type.
5852         (Plugin_manager::Plugin_manager): Initialize new fields.
5853         * archive.cc (Archive::defines_symbol): New function.
5854         (Add_archive_symbols::run): Pass archive to plugins if any.
5855         * archive.h (class Archive): Declare defines_symbol.
5856         * readsyms.cc (Input_group::~Input_group): New function.
5857         (Finish_group::run): Pass input_group to plugins if any.
5858         * readsyms.h (class Input_group): Declare destructor.
5859         * symtab.cc (add_from_object): Pass undefined symbol to plugins if
5860         any.
5861
5862 2011-01-10  Ian Lance Taylor  <iant@google.com>
5863
5864         * layout.cc (Layout::layout_eh_frame): Mark a writable .eh_frame
5865         section as relro.
5866         (Layout::set_segment_offsets): Reset increase_relro before calling
5867         set_section_addresses a second time.
5868
5869 2011-01-04  Cary Coutant  <ccoutant@google.com>
5870
5871         * script-sections.cc (Sort_output_sections::operator()): Sort TLS
5872         sections before NOBITS sections.
5873
5874 2011-01-01  H.J. Lu  <hongjiu.lu@intel.com>
5875
5876         * version.cc (print_version): Update copyright to 2011.
5877
5878 2010-12-23  Cary Coutant  <ccoutant@google.com>
5879
5880         * output.h (Output_data_reloc::add_output_section): Pass OD instead
5881         of OS to this->add.  Add OD parameter to second form of the function.
5882
5883 2010-12-20  Ian Lance Taylor  <iant@google.com>
5884
5885         * dwarf_reader.cc (Sized_dwarf_line_info::read_lines): Only keep
5886         second of two consecutive entries with same offset.
5887
5888 2010-12-16  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5889
5890         * testsuite/Makefile.am (ifuncmain2static_LDADD)
5891         (ifuncmain2_LDADD, ifuncmain4static_LDADD, ifuncmain4_LDADD)
5892         (ifuncmain7static_LDADD, ifuncmain7_LDADD): New empty variables,
5893         to avoid unneeded links against $(LDADD).
5894         * testsuite/Makefile.in: Regenerate.
5895
5896 2010-12-15  Ian Lance Taylor  <iant@google.com>
5897
5898         PR gold/12324
5899         * x86_64.cc (Target_x86_64::Scan::check_non_pic): Give an error
5900         for R_X86_64_32 and R_X86_64_PC32.
5901         * testsuite/Makefile.am (ver_matching_def.so): Depend on and use
5902         ver_matching_def_pic.o.
5903         (ver_matching_def_pic.o): New target.
5904
5905 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5906
5907         * fileread.cc (file_counts_lock, file_counts_initialize_lock)
5908         (total_mapped_bytes, current_mapped_bytes, maximum_mapped_bytes):
5909         Move definition before File_read::View member definitions.
5910         (File_read::View::~View): Initialize and hold lock before
5911         updating current_mapped_bytes.
5912
5913 2010-12-14  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
5914
5915         * dwarf_reader.cc: Remove outdated comment.
5916         * gold-threads.cc: Fix typo in error message.
5917         * archive.cc: Fix typos in comments.
5918         * archive.h: Likewise.
5919         * arm-reloc-property.cc: Likewise.
5920         * arm-reloc-property.h: Likewise.
5921         * arm-reloc.def: Likewise.
5922         * arm.cc: Likewise.
5923         * attributes.h: Likewise.
5924         * cref.cc: Likewise.
5925         * ehframe.cc: Likewise.
5926         * fileread.h: Likewise.
5927         * gold.h: Likewise.
5928         * i386.cc: Likewise.
5929         * icf.cc: Likewise.
5930         * incremental.h: Likewise.
5931         * int_encoding.cc: Likewise.
5932         * layout.h: Likewise.
5933         * main.cc: Likewise.
5934         * merge.h: Likewise.
5935         * object.cc: Likewise.
5936         * object.h: Likewise.
5937         * options.cc: Likewise.
5938         * readsyms.cc: Likewise.
5939         * reduced_debug_output.cc: Likewise.
5940         * reloc.cc: Likewise.
5941         * script-sections.cc: Likewise.
5942         * sparc.cc: Likewise.
5943         * symtab.h: Likewise.
5944         * target-reloc.h: Likewise.
5945         * target.cc: Likewise.
5946         * target.h: Likewise.
5947         * timer.cc: Likewise.
5948         * timer.h: Likewise.
5949         * x86_64.cc: Likewise.
5950
5951 2010-12-09  Cary Coutant  <ccoutant@google.com>
5952
5953         * layout.cc (Layout::layout_gnu_stack): Add warnings for executable
5954         stack.
5955         * layout.h (Layout::layout_gnu_stack): Add pointer to Object
5956         parameter; change all callers.
5957         * object.cc (Sized_relobj::do_layout): Adjust call to layout_gnu_stack.
5958         * options.h (warn_execstack): New option.
5959
5960 2010-12-07  Doug Kwan  <dougkwan@google.com>
5961
5962         * arm.cc (Target_arm::Scan::get_reference_flags): Treat R_ARM_PREL31
5963         like function call relocations.
5964
5965 2010-12-07  Ian Lance Taylor  <iant@google.com>
5966
5967         * archive.cc (Archive::get_elf_object_for_member): Permit
5968         punconfigured to be NULL.
5969         (Archive::read_symbols): Pass NULL to get_elf_object_for_member.
5970         (Archive::include_member): Pass NULL to get_elf_object_for_member
5971         if we searched for the archive and this is the first included
5972         object.
5973
5974 2010-12-01  Ian Lance Taylor  <iant@google.com>
5975
5976         * dwarf_reader.h (class Sized_dwarf_line_info): Add
5977         track_relocs_type_ field.
5978         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
5979         Set track_relocs_type_.
5980         (Sized_dwarf_line_info::process_one_opcode): Ignore the section
5981         contents when using RELA relocs.
5982         (Sized_dwarf_line_info::read_relocs): Add the reloc addend to
5983         reloc_map_.
5984         * reloc.cc (Track_relocs::next_addend): New function.
5985         * reloc.h (class Track_relocs): Declare next_addend.
5986
5987 2010-12-01  Ian Lance Taylor  <iant@google.com>
5988
5989         * testsuite/icf_virtual_function_folding_test.cc (class Bar): Add
5990         virtual destructor.
5991
5992 2010-12-01  Ian Lance Taylor  <iant@google.com>
5993
5994         * README: Update compilers known to work and fail.
5995
5996 2010-11-23  Matthias Klose  <doko@ubuntu.com>
5997
5998         * configure.in: For --enable-gold, handle value `default' instead of
5999         `both*'.  Always install ld as ld.bfd, install as ld if gold is
6000         not the default.
6001         * configure: Regenerate.
6002
6003 2010-11-18  Doug Kwan  <dougkwan@google.com>
6004
6005         * expression.cc (BINARY_EXPRESSION): Initialize left_alignment
6006         and right_alignment to be zero.  Store result alignment only if it is
6007         greater than existing alignment.
6008
6009 2010-11-16  Cary Coutant  <ccoutant@google.com>
6010
6011         PR gold/12220
6012         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
6013         Check for ".zdebug_line".
6014
6015 2010-11-16  Doug Kwan  <dougkwan@google.com>
6016             Cary Coutant  <ccoutant@google.com>
6017
6018         * output.h (Output_segment::set_section_addresses): Pass increase_relro
6019         by reference; adjust all callers.
6020         * output.cc (Output_segment::set_section_addresses): Adjust references
6021         to increase_relro. Add padding to *increase_relro when ORDER_RELRO_LAST
6022         list is empty.
6023         (Output_segment::set_offset): Assert if PT_GNU_RELRO segment does not
6024         end at page boundary.
6025
6026 2010-11-16  Cary Coutant  <ccoutant@google.com>
6027
6028         PR gold/12220
6029         * layout.cc (Layout::choose_output_section): Transform names of
6030         compressed sections even when using a script with a SECTIONS clause.
6031         (Layout::output_section_name): Remove code to transform
6032         compressed debug section names.
6033         * output.cc (Output_section::add_input_section): Use uncompressed
6034         section size when tracking input sections.
6035
6036 2010-11-11  Richard Sandiford  <richard.sandiford@linaro.org>
6037
6038         * symtab.h (Symbol::NON_PIC_REF): Remove.
6039         (Symbol::RELATIVE_REF, Symbol::TLS_REF): New Reference_flags.
6040         (Symbol::FUNCTION_CALL): Renumber.  Reword comment.
6041         (Symbol::needs_dynamic_reloc): Don't check NON_PIC_REF.
6042         (Symbol::use_plt_offset): Take a flags argument and pass it
6043         directly to needs_dynamic_reloc.  Restrict check for undefined
6044         weak symbols to function calls.
6045         * arm.cc (Target_arm::Scan::get_reference_flags): New function.
6046         (Target_arm::Scan::global): Use it.
6047         (Target_arm::Scan::scan_reloc_for_stub): Likewise.
6048         (Target_arm::Relocate::relocate): Likewise.
6049         (Target_arm::Relocate::should_apply_static_reloc): Replace flags
6050         parameter with an r_type parameter.  Use get_reference_flags
6051         to get the flags.
6052         (Target_arm::Relocate::relocate): Update accordingly.
6053         * i386.cc (Target_i386::Scan::get_reference_flags): New function.
6054         (Target_i386::Scan::reloc_needs_plt_for_ifunc): Use it.
6055         (Target_i386::Scan::global): Likewise.
6056         (Target_i386::Relocate::relocate): Likewise.
6057         (Target_i386::Relocate::should_apply_static_reloc): Replace flags
6058         parameter with an r_type parameter.  Use get_reference_flags
6059         to get the flags.
6060         (Target_i386::Relocate::relocate): Update accordingly.
6061         * powerpc.cc (Target_powerpc::Scan::get_reference_flags): New function.
6062         (Target_powerpc::Scan::global): Use it.
6063         (Target_powerpc::Scan::scan_reloc_for_stub): Likewise.
6064         (Target_powerpc::Relocate::relocate): Likewise.
6065         * sparc.cc (Target_sparc::Scan::get_reference_flags): New function.
6066         (Target_sparc::Scan::global): Use it.
6067         (Target_sparc::Scan::scan_reloc_for_stub): Likewise.
6068         (Target_sparc::Relocate::relocate): Likewise.
6069         * x86_64.cc (Target_x86_64::Scan::get_reference_flags): New function.
6070         (Target_x86_64::Scan::reloc_needs_plt_for_ifunc): Use it.
6071         (Target_x86_64::Scan::global): Likewise.
6072         (Target_x86_64::Relocate::relocate): Likewise.
6073
6074 2010-11-08  Doug Kwan  <dougkwan@google.com>
6075             Cary Coutant  <ccoutant@google.com>
6076
6077         * arm.cc (Arm_exidx_merge_section::build_contents): New method.
6078         (Arm_exidx_merge_section::section_contents_): New data member.
6079         (Arm_input_section::Arm_input_section): Initialize original_contents_.
6080         (Arm_input_section::~Arm_input_section): De-allocate memory.
6081         (Arm_input_section::original_contents_): New data member.
6082         (Arm_exidx_fixup::process_exidx_section): Pass EXIDX section contents
6083         in parameters instead of calling Object::section_contents without
6084         locking.
6085         (Arm_output_section::group_section): New parameter TASK.  Pass it
6086         to callees that need locking objects.
6087         (Arm_output_section::fix_exidx_coverage): New parameter TASK.  Use it
6088         to lock EXIDX input sections.  Fix a formatting issue.  Call
6089         Arm_exidx_merged_section::build_contents to create merged section
6090         contents.
6091         (Arm_output_section::create_stub_group): New parameter TASK.  Use it
6092         to lock object of stub table owner.
6093         (Arm_exidx_input_section::Arm_exidx_input_section): Add new parameter
6094         TEXT_SIZE to initialize data member TEXT_SIZE_.
6095         (Arm_exidx_input_section::addralign): Fix typo in comment.
6096         (Arm_exidx_input_section::text_size): New method.
6097         (Target_arm::do_relax): New parameter TASK.  Pass it to callees
6098         that require locking objects.  Lock objects before scanning for stubs
6099         and updating local symbols.
6100         (Arm_input_section<big_endian>::init): Copy contents of original
6101         input section.
6102         (Arm_input_section<big_endian>::do_write): Use saved contents of
6103         original input section instead of calling Object::section_contents
6104         without locking.
6105         (Arm_exidx_cantunwind::do_fixed_endian_write): Find out text section
6106         size without calling Object::section_size().
6107         (Arm_exidx_merged_section::Arm_exidx_merged_section): Add sanity check
6108         for size.  Allocate a buffer for merged EXIDX entries.
6109         (Arm_exidx_merged_section::build_contents): New method.
6110         (Arm_exidx_merged_section::do_write): Move merge section contents
6111         building code to Arm_exidx_merged_section::build_contetns.  Write
6112         out contetns in buffer instead of building it on the fly.
6113         (Arm_relobj::make_exidx_input_section): Also pass text section size
6114         to Arm_exidx_input_section constructor.
6115         (Arm_relobj::do_read_symbols): Fix memory leak.  Fix a formatting issue.
6116         (Arm_dynobj::do_read_symbols): Fix memory leak.
6117         * layout.cc (Layout::finalize): Pass TASK to Target::relax().
6118         * target.h: (class Task): Add forward declaration.
6119         (Target::relax): Add new parameter TASK and pass it to
6120         Target::do_relax().
6121         (Target::do_relax):: New parameter TASK.  Fix a formatting issue.
6122
6123 2010-11-05  Cary Coutant  <ccoutant@google.com>
6124
6125         PR gold/10708
6126         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Hold a lock on the
6127         object when reading from the file.
6128         * gold.cc (queue_middle_tasks): Hold a lock on the object when doing
6129         second layout pass.
6130         * icf.cc (preprocess_for_unique_sections): Hold a lock on the object
6131         when reading section contents.
6132         (get_section_contents): Likewise.
6133         (icf::find_identical_sections): Likewise.
6134         * mapfile.cc (Mapfile::print_discarded_sections): Hold a lock on the
6135         object when reading from the file.
6136         * plugin.cc (Plugin_manager::layout_deferred_objects): Hold a lock on
6137         the object when doing deferred section layout.
6138
6139 2010-11-03  Nick Clifton  <nickc@redhat.com>
6140
6141         PR gold/12001
6142         * script.h (class Symbol_assignment: name): New member.  Returns
6143         the name of the symbol.
6144         * scrfipt.cc (Script_options::is_pending_assignment): New member.
6145         Returns true if the given symbol name is on the list of
6146         assignments wating to be processed.
6147         * archive.cc (should_incldue_member): If the symbol is undefined,
6148         check to see if it is on the list of symbols pending assignment.
6149
6150 2010-11-03  Ryan Mansfield  <rmansfield@qnx.com>
6151
6152         * script-sections.cc (Script_sections::find_memory_region): Check
6153         for a NULL output section pointer.
6154
6155 2010-10-29  Doug Kwan  <dougkwan@google.com>
6156
6157         * arm.cc (Arm_outout_section::fix_exidx_coverage): Adjust call to
6158         Output_section::add_relaxed_input_section.
6159         * output.cc (Output_section::add_relaxed_input_section): Add new
6160         arguments LAYOUT and NAME.  Set section order index.
6161         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
6162         Copy section order index.
6163         * output.h (Output_section::add_relaxed_input_section): Add new
6164         arguments LAYOUT and NAME.
6165
6166 2010-10-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6167
6168         * testsuite/Makefile.am: Move gcctestdir/ld rule to
6169         NATIVE_OR_CROSS_LINKER.
6170         * testsuite/Makefile.in: Regenerate.
6171
6172 2010-10-20  Doug Kwan  <dougkwan@google.com>
6173
6174         * arm.cc (Arm_relobj::do_read_symbols): Warn about ARM EXIDX sections
6175         without SHF_LINK_ORDER flags.
6176         * layout.cc (Layout::choose_output_section): Do not filter
6177         SHF_LINK_ORDER flag in a relocatable link.
6178
6179 2010-10-17  Cary Coutant  <ccoutant@google.com>
6180
6181         * output.h (Output_segment::set_section_addresses): Change function
6182         signature.  Update all callers.
6183         * output.cc (Output_segment::is_first_section_relro): Ignore TLS
6184         sections.
6185         (Output_segment::set_section_addresses): Align after last TLS
6186         section.  Add padding before last relro section instead of after.
6187
6188 2010-10-17  Doug Kwan  <dougkwan@google.com>
6189
6190         * gold/arm.cc (Target_arm::got_section): Use correct order and set
6191         GOT output section to be writable.
6192
6193 2010-10-14  Cary Coutant  <ccoutant@google.com>
6194
6195         * debug.h (DEBUG_INCREMENTAL): New flag.
6196         (debug_string_to_enum): Add DEBUG_INCREMENTAL).
6197         * gold.cc (queue_initial_tasks): Check parameters for incremental link
6198         mode.
6199         * incremental.cc (report_command_line): Ignore all forms of
6200         --incremental.
6201         * layout.cc (Layout::Layout): Check parameters for incremental link
6202         mode.
6203         * options.cc (General_options::parse_incremental): New function.
6204         (General_options::parse_no_incremental): New function.
6205         (General_options::parse_incremental_full): New function.
6206         (General_options::parse_incremental_update): New function.
6207         (General_options::incremental_mode_): New data member.
6208         (General_options::finalize): Check incremental_mode_.
6209         * options.h (General_options): Update help text for --incremental.
6210         Add --no-incremental, --incremental-full, --incremental-update.
6211         (General_options::Incremental_mode): New enum type.
6212         (General_options::incremental_mode): New function.
6213         (General_options::incremental_mode_): New data member.
6214         * parameters.cc (Parameters::incremental_mode_): New data member.
6215         (Parameters::set_options): Set incremental_mode_.
6216         (Parameters::set_incremental_full): New function.
6217         (Parameters::incremental): New function.
6218         (Parameters::incremental_update): New function.
6219         (set_parameters_incremental_full): New function.
6220         * parameters.h (Parameters::set_incremental_full): New function.
6221         (Parameters::incremental): New function.
6222         (Parameters::incremental_update): New function.
6223         (Parameters::incremental_mode_): New data member.
6224         (set_parameters_incremental_full): New function.
6225         * plugin.cc (Plugin_manager::add_input_file): Check parameters for
6226         incremental link mode.
6227         * reloc.cc (Sized_relobj::do_read_relocs): Likewise.
6228         (Sized_relobj::do_relocate_sections): Likewise.
6229         * testsuite/Makefile.am (incremental_test): Use --incremental-full
6230         option.
6231         * testsuite/Makefile.in: Regenerate.
6232         * testsuite/incremental_test.sh: Filter all forms of --incremental.
6233
6234 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6235
6236         * script-sections.h (class Script_sections): Make
6237         Sections_elements typedef public.
6238         * script-sections.cc (class Sort_output_sections): Add elements_
6239         field.  Add constructor which sets it; change all callers.
6240         (Sort_output_sections::is_before): New function.
6241         (Sort_output_sections::operator()): Call is_before.
6242         * configure.ac (NATIVE_OR_CROSS_LINKER): New automake
6243         conditional.
6244         * testsuite/script_test_10.sh: New test. Test script section
6245         order.
6246         * testsuite/script_test_10.t: Likewise.
6247         * testsuite/script_test_10.s: Likewise.
6248         * testsuite/Makefile.am: Wrap the cross linker tests and the
6249         common tests into NATIVE_OR_CROSS_LINKER.
6250         (check_SCRIPTS): Add script_test_10.sh.
6251         (check_DATA): Add script_test_10.stdout.
6252         (script_test_10.o, script_test_10): New targets.
6253         (script_test_10.stdout): New target.
6254         * configure, testsuite/Makefile.in: Regenerate.
6255
6256 2010-10-12  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
6257
6258         * arm.cc (Target_arm::Scan::local): Report the unsupported reloc
6259         error for the deprecated relocations.
6260         (Target_arm::Scan::global): Likewise.
6261         (Target_arm::Relocate::relocate): Likewise.
6262
6263 2010-10-12  Richard Sandiford  <richard.sandiford@linaro.org>
6264
6265         * fileread.cc (Input_file::find_file): Initialize *found_name
6266         and *namep when using the fallback search for case 4.
6267
6268 2010-10-11  Cary Coutant  <ccoutant@google.com>
6269
6270         * options.h (class General_options): Redefine -z lazy as an alias for
6271         the negation of -z now.
6272
6273 2010-10-11  Ian Lance Taylor  <iant@google.com>
6274
6275         * resolve.cc (symbol_to_bits): Report the value of the unsupported
6276         binding.
6277
6278 2010-10-06  Nick Clifton  <nickc@redhat.com>
6279
6280         * script-sections.cc(class Memory_region): Remove
6281         current_lma_offset_ field.  Rename current_vma_offset_ to
6282         current_offset_.  Add last_section_ field.
6283         (Memory_region::get_current_vma_address): Rename to
6284         get_current_address.
6285         (Memory_region::get_current_lma_address): Delete.
6286         (Memory_region::increment_vma_offset): Rename to
6287         increment_offset.
6288         (Memory_region::increment_lma_offset): Delete.
6289         (Memory_region::attributes_compatible): New method.  Returns
6290         true if the provided section is compatible with the region.
6291         (Memory_region::get_last_section): New method.  Returns the last
6292         section to use the region.
6293         (Memory_region::set_last_section): New method.  Stores the last
6294         section to use the region.
6295         (Script_sections::block_in_region): New method.  Returns true if
6296         a block of memory is contained within a region.
6297         (Script_sections::find_memory_region): New method.  Locates a
6298         memory region to be used to set a VMA or LMA address.
6299         (Output_section_definition::set_section_addresses): Add code to
6300         check for addresses set by memory regions.
6301         (Output_segment::set_section_addresses): Remove memory region
6302         walking code.
6303         (Script_sections::create_segment): Add a warning if a header
6304         segment is created outside of any region.
6305         * script-sections.h (class Script_sections): Add prototypes for
6306         find_memory_region and block_in_region methods.
6307         * testsuite/memory_test.s: Use .long instead of .word.
6308         * testsuite/memory_test.t: Add some more output sections.
6309         * testsuite/memory_test.sh: Update expected output.
6310
6311 2010-10-02  Doug Kwan  <dougkwan@google.com>
6312
6313         * symtab.cc (Symbol_table::Symbol_table_hash::operator()): Move
6314         defintion to symtab.h
6315         * symtab.h (Symbol_table::Symbol_table_hash::operator()): Change
6316         declaration to defintion.
6317
6318 2010-10-01  Nick Clifton  <nickc@redhat.com>
6319
6320         * expression.cc (eval): Replace dummy argument with NULL.
6321         (eval_maybe_dot): Check for a NULL result section pointer.
6322         (Symbol_expression::value): Likewise.
6323         (Dot_expression::value): Likewise.
6324         (BINARY_EXPRESSION): Likewise.
6325         (Max_expression::value): Likewise.
6326         (Min_expression::value): Likewise.
6327         (Absolute_expression::value): Likewise.
6328         (Addr_expression::value_from_output_section): Likewise.
6329         (Loaddddr_expression::value_from_output_section): Likewise.
6330         (Segment_start_expression::value): Likewise.
6331         * script-sections.cc
6332         (Sections_elememt_dot_assignment::finalize_symbols): Replace dummy
6333         argument with NULL.
6334         (Sections_elememt_dot_assignment::set_section_addresses):
6335         Likewise.
6336         (Output_data_expression::do_write_to_buffer): Likewise.
6337         (Output_section_definition::finalize_symbols): Likewise.
6338         (Output_section_definition::set_section_addresses): Likewise.
6339
6340 2010-09-30  Doug Kwan  <dougkwan@google.com>
6341
6342         * gold/testsuite/arm_branch_out_of_range.sh: Fix broken tests.
6343
6344 2010-09-28  Sriraman Tallam  <tmsriram@google.com>
6345
6346         * target.h (Target::can_icf_inline_merge_sections): New virtual
6347         function.
6348         * x86_64.cc (Target__x86_64::can_icf_inline_merge_sections): New
6349         virtual function.
6350         * i386.cc (Target_i386::can_icf_inline_merge_sections): New
6351         virtual function.
6352         * icf.cc (get_section_contents): Inline merge sections only when
6353         target allows it.
6354
6355 2010-09-27  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
6356
6357         * configure: Regenerate.
6358
6359 2010-09-17  Ian Lance Taylor  <iant@google.com>
6360
6361         * testsuite/memory_test.sh: Adjust for change of 2010-09-10.
6362         * testsuite/Makefile.am (memory_test.o): New target.
6363         (memory_test): Depend on memory_test.o, gcctestdir/ld, and
6364         memory_test.t.
6365         * testsuite/Makefile.in: Rebuild.
6366
6367 2010-09-17  Doug Kwan  <dougkwan@google.com>
6368
6369         * arm.cc (Target_arm::Relocate::relocate): Ignore symbol type and
6370         defintion if relocation uses GOT entries of the symbol.
6371         * testsuite/icf_safe_test.sh: Fix test.
6372         * testsuite/icf_safe_so_test.sh: Fix test.
6373
6374 2010-09-16  Cary Coutant  <ccoutant@google.com>
6375
6376         * script_sections.cc (class Memory_region): Remove "NULL" from
6377         vector initializations.
6378
6379 2010-09-15  Cary Coutant  <ccoutant@google.com>
6380
6381         * incremental.cc (Output_section_incremental_inputs::write_info_blocks):
6382         Resolve forwarding symbols.
6383
6384 2010-09-15  Doug Kwan  <dougkwan@google.com>
6385
6386         * gold/testsuite/script_test_3.t: Add ARM special sections.
6387         * gold/testsuite/script_test_4.t: Same.
6388         * gold/testsuite/script_test_5.t: Same.
6389         * gold/testsuite/script_test_6.t: Same.
6390         * gold/testsuite/script_test_7.t: Same.
6391         * gold/testsuite/script_test_7.t: Same.
6392         * gold/testsuite/thumb_blx_out_of_range.s: Fix instruction alignment.
6393
6394 2010-09-14  Cary Coutant  <ccoutant@google.com>
6395
6396         * x86_64.cc (Target_x86_64::saw_tls_block_reloc_): Remove member.
6397         (Target_x86_64::Relocate::relocate_tls): Replace check for
6398         saw_tls_block_reloc_ with test for executable section.
6399
6400 2010-09-12  Cary Coutant  <ccoutant@google.com>
6401
6402         * symtab.h (Symbol::needs_dynamic_reloc): Non-PIC calls from
6403         position-independent executables to shared libraries need dynamic
6404         relocations.
6405         (Symbol::may_need_copy_reloc): Do not generate COPY relocs in
6406         position-independent executables.
6407         * testsuite/Makefile.am (two_file_mixed_pie_test): New test.
6408         * testsuite/Makefile.in: Regenerate.
6409
6410 2010-09-10  Nick Clifton  <nickc@redhat.com>
6411
6412         PR gold/11997
6413         * testsuite/memory_test.t: Discard any sections that are not
6414         needed.
6415
6416 2010-09-09  H.J. Lu  <hongjiu.lu@intel.com>
6417
6418         PR gold/11996
6419         * object.cc (Sized_relobj::do_finalize_local_symbols): Remove
6420         "This::" to work around a bug in gcc 4.2.
6421
6422         * testsuite/ifuncmain7.c (foo_ifunc): Add __attribute__ ((used)).
6423
6424 2010-09-09  Rafael Espindola  <espindola@google.com>
6425
6426         * layout.cc (Layout::attach_allocated_section_to_segment): Don't put
6427         sections with different PF_X flags in the same segment.
6428         (Layout::find_first_load_seg): Search all segments to find the first
6429         one.
6430         * options.h (rosegment): New.
6431
6432 2010-09-08  Rafael Espindola  <espindola@google.com>
6433
6434         * layout.cc (Layout::set_segment_offsets): Always advance to a new page.
6435
6436 2010-09-08  Doug Kwan  <dougkwan@google.com>
6437
6438         * arm.cc (Arm_exidx_cantunwind::do_print_to_mapfile): New method.
6439         (Arm_relobj::do_relocate_sections): Add new parameter for output
6440         file to match the parent.
6441         (Target_arm::scan_reloc_section_for_stubs): Use would-be final values
6442         of local symbols instead of input values.  Update code to track
6443         changes in gold::relocate_section.
6444         * object.cc (Sized_relobj::compute_final_local_value): New methods.
6445         (Sized_relobj::compute_final_local_value_internal): New methods.
6446         (Sized_relobj::do_finalize_local_symbols): Move code from loop
6447         body into private version of Sized_relobj::compute_final_local_value.
6448         Call the inline method.
6449         * object.h (Symbol_value::Symbol_value): Define destructor.  Free
6450         merged symbol value if there is one.
6451         (Symbol_value::has_output_value): New method defintiion.
6452         (Sized_relobj::Compute_final_local_value_status): New enum type.
6453         (Sized_relobj::compute_final_local_value): New methods.
6454         (Sized_relobj::compute_final_local_value_internal): New methods.
6455         * Makefile.am (check_SCRIPTS): Add arm_branch_out_of_range.sh
6456         and arm_cortex_a8.sh.
6457         (thumb_bl_out_of_range_local, arm_cortex_a8_b_cond, arm_cortex_a8_bl,
6458         arm_cortex_a8_blx, arm_cortex_a8_local, arm_corte_a8_local_reloc):
6459         New tests.
6460         * Makefile.in: Regenerate.
6461         * testsuite/arm_bl_out_of_range.s: Update test.
6462         * testsuite/thumb_bl_out_of_range.s: Ditto.
6463         * testsuite/thumb_blx_out_of_range.s: Ditto.
6464         * testsuite/arm_branch_out_of_range.sh: New file.
6465         * testsuite/arm_cortex_a8.sh: Ditto.
6466         * testsuite/arm_cortex_a8_b.s: Ditto.
6467         * testsuite/arm_cortex_a8_b_cond.s: Ditto.
6468         * testsuite/arm_cortex_a8_b_local.s: Ditto.
6469         * testsuite/arm_cortex_a8_bl.s: Ditto.
6470         * testsuite/arm_cortex_a8_blx.s: Ditto.
6471         * testsuite/arm_cortex_a8_local.s: Ditto.
6472         * testsuite/arm_cortex_a8_local_reloc.s: Ditto.
6473         * testsuite/thumb_bl_out_of_range_local.s: Ditto.
6474
6475 2010-09-08  Rafael Espindola  <espindola@google.com>
6476
6477         * Makefile.am (memory_test.stdout): Run readelf with -W.
6478         * Makefile.in: Regenerate.
6479         * testsuite/memory_test.sh: Make the regexps accept both 32 and
6480         64 bit output.
6481
6482 2010-09-08  Rafael Espindola  <espindola@google.com>
6483
6484         * script-sections.cc (Script_sections::add_memory_region): Convert
6485         field precision to int.
6486         * script.cc (script_set_section_region, script_set_section_region):
6487         Convert field precision to int.
6488
6489 2010-09-08  Rafael Espindola  <espindola@google.com>
6490
6491         * arm.cc (do_finalize_sections): Create the __exidx_start and
6492         __exdix_end symbols even when the section is missing.
6493
6494 2010-09-08  Nick Clifton  <nickc@redhat.com>
6495
6496         * README: Remove claim that MEMORY is not supported.
6497         * expression.cc (script_exp_function_origin)
6498         (script_exp_function_length): Move from here to ...
6499         * script.cc: ... here.
6500         (script_set_section_region, script_add_memory)
6501         (script_parse_memory_attr, script_include_directive): New
6502         functions.
6503         * script-sections.cc
6504         (class Memory_region): New class.
6505         (class Output_section_definition): Add set_memory_region,
6506         set_section_vma, set_section_lma and get_section_name methods.
6507         (class Script_Sections): Add add_memory_region,
6508         find_memory_region, find_memory_region_origin,
6509         find_memory_region_length and set_memory_region methods.
6510         Have set_section_addresses method walk the list of set memory
6511         regions.
6512         Extend the print methos to display memory regions.
6513         * script-sections.h: Add prototypes for new methods.
6514         Add enum for MEMORY region attributes.
6515         * yyscript.y: Add support for parsing MEMORY regions.
6516         * script-c.h: Add prototypes for new functions.
6517         * testsuite/Makefile.am: Add test of MEMORY region functionality.
6518         * testsuite/Makefile.in: Regenerate.
6519         * testsuite/memory_test.sh: New script.
6520         * testsuite/memory_test.s: New assembler source file.
6521         * testsuite/memory_test.t: New linker script.
6522
6523 2010-08-27  Doug Kwan  <dougkwan@google.com>
6524
6525         * gold/resolve.cc (Symbol_table::should_override): Let a weak
6526         reference override an existing dynamic weak reference.
6527         * testsuite/Makefile.am: Add new test dyn_weak_ref.
6528         * testsuite/Makefile.in: Regenerate.
6529         * testsuite/dyn_weak_ref.sh: New file.
6530         * testsuite/dyn_weak_ref_1.c: Ditto.
6531         * testsuite/dyn_weak_ref_2.c: Ditto.
6532
6533 2010-08-27  Ian Lance Taylor  <iant@google.com>
6534
6535         * incremental.h (class Incremental_input_entry): Add virtual
6536         destructor.
6537
6538 2010-08-27  Ian Lance Taylor  <iant@google.com>
6539
6540         * testsuite/start_lib_test_3.c: Mark t3 as used.
6541
6542 2010-08-27  Nick Clifton  <nickc@redhat.com>
6543
6544         * options.cc (version_script): Fix small typo in previous
6545         whitespace tidyup.
6546
6547 2010-08-25  Nick Clifton  <nickc@redhat.com>
6548
6549         * archive.cc: Formatting fixes: Remove whitespace between
6550         typename and following asterisk.  Remove whitespace between
6551         function name and opening parenthesis.
6552         * archive.h: Likewise.
6553         * arm.cc: Likewise.
6554         * attributes.cc: Likewise.
6555         * attributes.h: Likewise.
6556         * common.cc: Likewise.
6557         * copy-relocs.cc: Likewise.
6558         * dirsearch.h: Likewise.
6559         * dynobj.cc: Likewise.
6560         * ehframe.cc: Likewise.
6561         * ehframe.h: Likewise.
6562         * expression.cc: Likewise.
6563         * fileread.cc: Likewise.
6564         * fileread.h: Likewise.
6565         * gc.h: Likewise.
6566         * gold-threads.cc: Likewise.
6567         * gold.cc: Likewise.
6568         * i386.cc: Likewise.
6569         * icf.h: Likewise.
6570         * incremental-dump.cc: Likewise.
6571         * incremental.cc: Likewise.
6572         * layout.cc: Likewise.
6573         * layout.h: Likewise.
6574         * main.cc: Likewise.
6575         * merge.cc: Likewise.
6576         * merge.h: Likewise.
6577         * object.cc: Likewise.
6578         * object.h: Likewise.
6579         * options.cc: Likewise.
6580         * options.h: Likewise.
6581         * output.cc: Likewise.
6582         * output.h: Likewise.
6583         * plugin.cc: Likewise.
6584         * plugin.h: Likewise.
6585         * powerpc.cc: Likewise.
6586         * reloc.cc: Likewise.
6587         * script-c.h: Likewise.
6588         * script-sections.cc: Likewise.
6589         * script.cc: Likewise.
6590         * stringpool.cc: Likewise.
6591         * symtab.cc: Likewise.
6592         * symtab.h: Likewise.
6593         * target.cc: Likewise.
6594         * timer.cc: Likewise.
6595         * timer.h: Likewise.
6596         * version.cc: Likewise.
6597         * x86_64.cc: Likewise.
6598
6599 2010-08-24  Nick Clifton  <nickc@redhat.com>
6600
6601         PR 11899
6602         * layout.cc (segment_precedes): Sort segments by their physical
6603         addresses, if they have been set.
6604
6605 2010-08-23  Cary Coutant  <ccoutant@google.com>
6606
6607         * archive.cc (Lib_group::add_symbols): Lock object before deleting its
6608         symbols data.
6609         (Lib_group::include_member): Unlock object after deleting its
6610         symbols data.
6611         * testsuite/start_lib_test_3.c: Remove all global symbols to trigger
6612         the bug fixed here.
6613
6614 2010-08-19  Neil Vachharajani  <nvachhar@google.com>
6615             Cary Coutant  <ccoutant@google.com>
6616
6617         * gold/archive.h (Add_lib_group_symbols): Add readsyms_blocker_, adjust
6618         constructor, and set_blocker.
6619         * gold/archive.cc (Add_lib_group_symbols::is_runnable): Also check
6620         readsyms_blocker_.
6621         * gold/readsyms.cc (Read_symbols::do_lib_group): Also pass
6622         this->this_blocker_ to Add_lib_group_symbols::set_blocker.
6623         * testsuite/Makefile.am (start_lib_test): New test case.
6624         * testsuite/Makefile.in: Regenerate.
6625         * testsuite/start_lib_test_main.c: New file.
6626         * testsuite/start_lib_test_1.c: New file.
6627         * testsuite/start_lib_test_2.c: New file.
6628         * testsuite/start_lib_test_3.c: New file.
6629
6630 2010-08-19  Ian Lance Taylor  <iant@google.com>
6631
6632         * Makefile.in: Rebuild with automake 1.11.1.
6633         * aclocal.m4: Likewise.
6634         * testsuite/Makefile.in: Likewise.
6635
6636 2010-08-19  Ian Lance Taylor  <iant@google.com>
6637
6638         PR 10893
6639         * i386.cc (class Output_data_plt_i386): Update declarations.
6640         Define Global_ifunc and Local_ifunc types.  Add global_ifuncs_ and
6641         local_ifuncs_ fields.
6642         (Target_i386::do_plt_section_for_global): New function.
6643         (Target_i386::do_plt_section_for_local): New function.
6644         (Output_data_plt_i386::Output_data_plt_i386): Add symtab
6645         parameter; change all callers.  Initialize global_ifuncs_ and
6646         local_ifuncs_.  If doing a static link define __rel_iplt_start and
6647         __rel_iplt_end.
6648         (Output_data_plt_i386::add_entry): Handle IFUNC symbols.
6649         (Output_data_plt_i386::add_local_ifunc_entry): New function.
6650         (Output_data_plt_i386::do_write): Fix GOT entries for IFUNC
6651         symbols.
6652         (Target_i386::make_plt_section): New function, broken out of
6653         make_plt_entry.  Set sh_info field of .rel.plt to point to .plt.
6654         (Target_i386::make_plt_entry): Call make_plt_section.
6655         (Target_i386::make_local_ifunc_plt_entry): New function.
6656         (Target_i386::Scan::reloc_needs_iplt_for_ifunc): New function.
6657         (Target_i386::Scan::local): Handle IFUNC symbols.  Add
6658         R_386_IRELATIVE to switch.
6659         (Target_i386::Scan::global): Likewise.
6660         (Target_i386::Relocate::relocate): Likewise.
6661         (Target_i386::Relocatable_size_for_reloc): Add R_386_IRELATIVE to
6662         switch.
6663         * x86_64.cc (class Output_data_plt_x86_64): Update declarations.
6664         (Target_x86_64::do_plt_section_for_global): New function.
6665         (Target_x86_64::do_plt_section_for_local): New function.
6666         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add symtab
6667         parameter; change all callers.  If doing a static link define
6668         __rela_iplt_start and __rela_iplt_end.
6669         (Output_data_plt_x86_64::add_entry): Handle IFUNC symbols.
6670         (Output_data_plt_x86_64::add_local_ifunc_entry): New function.
6671         (Target_x86_64::make_plt_section): Set sh_info field of .rel.plt
6672         to point to .plt.
6673         (Target_x86_64::make_local_ifunc_plt_entry): New function.
6674         (Target_x86_64::Scan::check_non_pic): Add R_X86_64_IRELATIVE to
6675         switch.
6676         (Target_x86_64::Scan::reloc_needs_iplt_for_ifunc): New function.
6677         (Target_x86_64::Scan::local): Handle IFUNC symbols.  Add
6678         R_X86_64_IRELATIVE to switch.
6679         (Target_x86_64::Scan::global): Likewise.
6680         (Target_x86_64::Relocate::relocate): Likewise.
6681         (Target_x86_64::Relocatable_size_for_reloc): Add R_X86_64_IRELATIVE to
6682         switch.
6683         * target.h (class Target): Add plt_section_for_global and
6684         plt_section_for_local functions.  Add do_plt_section_for_global
6685         and do_plt_section_for_local virtual functions.
6686         * symtab.h (Symbol::needs_plt_entry): Handle IFUNC symbol.  Add
6687         clarifying comments.
6688         (Symbol::use_plt_offset): Handle IFUNC symbol.
6689         * object.cc (Sized_relobj::Sized_relobj): Initialize
6690         local_plt_offsets_.
6691         (Sized_relobj::local_has_plt_offset): New function.
6692         (Sized_relobj::local_plt_offset): New function.
6693         (Sized_relobj::set_local_plt_offset): New function.
6694         (Sized_relobj::do_count): Handle IFUNC symbol.
6695         * object.h (class Symbol_value): Add is_ifunc_symbol_ field.  Take
6696         a bit away from input_shndx_ field.  Add set_is_func_symbol and
6697         is_ifunc_symbol functions.
6698         (class Sized_relobj): Update declarations.  Remove Tls_got_entry
6699         and Local_tls_got_offsets.  Define Local_plt_offsets.  Add
6700         local_plt_offsets_ field.
6701         (Sized_relobj::clear_local_symbols): Clear local_plt_offsets_.
6702         * output.h (class Output_section_data): Add non-const
6703         output_section function.
6704         (class Output_data_got): Update declarations.
6705         (class Output_data_got::Got_entry): Add use_plt_offset_ field.
6706         Add use_plt_offset parameter to global and local constructors.
6707         Change all callers.  Change local_sym_index_ field to 31 bits.
6708         Change GSYM_CODE and CONSTANT_CODE accordingly.
6709         * output.cc (Output_data_reloc_base::do_adjust_output_section): If
6710         doing a static link don't set sh_link field.
6711         (Output_data_got::Got_entry::write): Use PLT offset if
6712         appropriate.
6713         (Output_data_got::add_global_plt): New function.
6714         (Output_data_got::add_local_plt): New function.
6715         * target-reloc.h (relocate_section): Handle IFUNC symbol.
6716         * defstd.cc (in_section): Remove entries for __rel_iplt_start,
6717         __rel_iplt_end, __rela_iplt_start, and __rela_iplt_end.
6718         * configure.ac: Set IFUNC automake conditional for glibc >= 2.11.
6719         * testsuite/Makefile.am: Add a bunch of IFUNC tests, all within
6720         IFUNC conditional.
6721         * testsuite/ifunc-sel.h: New file.
6722         * testsuite/ifuncmain1.c: New file.
6723         * testsuite/ifuncmain1vis.c: New file.
6724         * testsuite/ifuncmod1.c: New file.
6725         * testsuite/ifuncdep2.c: New file.
6726         * testsuite/ifuncmain2.c: New file.
6727         * testsuite/ifuncmain3.c: New file.
6728         * testsuite/ifuncmod3.c: New file.
6729         * testsuite/ifuncmain4.c: New file.
6730         * testsuite/ifuncmain5.c: New file.
6731         * testsuite/ifuncmod5.c: New file.
6732         * testsuite/ifuncmain6pie.c: New file.
6733         * testsuite/ifuncmod6.c: New file.
6734         * testsuite/ifuncmain7.c: New file.
6735         * configure, testsuite/Makefile.in: Rebuild.
6736
6737 2010-08-18  Ian Lance Taylor  <iant@google.com>
6738
6739         * incremental.cc
6740         (Output_section_incremental_inputs::write_input_files): Add cast
6741         to avoid signed/unsigned comparison warning.
6742         (Output_section_incremental_inputs::write_info_blocks): Likewise.
6743
6744 2010-08-12  Cary Coutant  <ccoutant@google.com>
6745
6746         * common.cc (Sort_commons::operator()): Remove unnecessary code.
6747
6748 2010-08-13  Ian Lance Taylor  <iant@google.com>
6749
6750         * testsuite/incremental_test_1.c: Add prototype to avoid warning.
6751
6752 2010-08-12  Cary Coutant  <ccoutant@google.com>
6753             Doug Kwan  <dougkwan@google.com>
6754
6755         * resolve.cc (Symbol_table::should_override): When a weak dynamic
6756         defintion overrides non-weak undef, remember that the original undef
6757         is not weak.
6758         * symtab.cc (Symbol_table::sized_write_global): For undef without
6759         an original weak binding, set binding to global in output.
6760         * testsuite/Makefile.am: Add new test strong_ref_weak_def.
6761         * testsuite/Makefile.in: Regenerate.
6762         * testsuite/strong_ref_weak_def.sh: New file.
6763         * testsuite/strong_ref_weak_def_1.c: Ditto.
6764         * testsuite/strong_ref_weak_def_2.c: Ditto.
6765
6766 2010-08-12  Cary Coutant  <ccoutant@google.com>
6767
6768         * testsuite/incremental_test.sh: Rewrite.
6769         * testsuite/incremental_test_1.c: Rewrite.
6770         * testsuite/incremental_test_2.c: Rewrite.
6771
6772 2010-08-12  Cary Coutant  <ccoutant@google.com>
6773
6774         * arm.cc (Target_arm::got_size): Add const.
6775         (Target_arm::got_entry_count): New function.
6776         (Target_arm::plt_entry_count): New function.
6777         (Target_arm::first_plt_entry_offset): New function.
6778         (Target_arm::plt_entry_size): New function.
6779         (Output_data_plt_arm::entry_count): New function.
6780         (Output_data_plt_arm::first_plt_entry_offset): New function.
6781         (Output_data_plt_arm::get_plt_entry_size): New function.
6782         * i386.cc (Target_i386::got_size): Add const.
6783         (Target_i386::got_entry_count): New function.
6784         (Target_i386::plt_entry_count): New function.
6785         (Target_i386::first_plt_entry_offset): New function.
6786         (Target_i386::plt_entry_size): New function.
6787         (Output_data_plt_i386::entry_count): New function.
6788         (Output_data_plt_i386::first_plt_entry_offset): New function.
6789         (Output_data_plt_i386::get_plt_entry_size): New function.
6790         * incremental-dump.cc (dump_incremental_inputs): Adjust call to
6791         find_incremental_inputs_sections.  Dump incremental_got_plt section.
6792         * incremental.cc: Include target.h.
6793         (Sized_incremental_binary::do_find_incremental_inputs_sections): Add
6794         parameter.  Adjust all callers.  Find incremental_got_plt section.
6795         (Incremental_inputs::create_data_sections): Create incremental_got_plt
6796         section.
6797         (Output_section_incremental_inputs::set_final_data_size): Calculate
6798         size of incremental_got_plt section.
6799         (Output_section_incremental_inputs::do_write): Write the
6800         incremental_got_plt section.
6801         (Got_plt_view_info): New struct.
6802         (Local_got_offset_visitor): New class.
6803         (Global_got_offset_visitor): New class.
6804         (Global_symbol_visitor_got_plt): New class.
6805         (Output_section_incremental_inputs::write_got_plt): New function.
6806         * incremental.h (Incremental_binary::find_incremental_inputs_sections):
6807         Add parameter.  Adjust all callers.
6808         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6809         (Incremental_inputs::got_plt_section): New function.
6810         (Incremental_inputs::got_plt_section_): New data member.
6811         (Incremental_got_plt_reader): New class.
6812         * layout.cc (Layout::create_incremental_info_sections): Add the
6813         incremental_got_plt section.
6814         * object.h (Got_offset_list::get_list): New function.
6815         (Got offset_list::for_all_got_offsets): New function.
6816         (Sized_relobj::local_got_offset_list): New function.
6817         * powerpc.cc (Target_powerpc::got_size): Add const.
6818         (Target_powerpc::got_entry_count): New function.
6819         (Target_powerpc::plt_entry_count): New function.
6820         (Target_powerpc::first_plt_entry_offset): New function.
6821         (Target_powerpc::plt_entry_size): New function.
6822         (Output_data_plt_powerpc::entry_count): New function.
6823         (Output_data_plt_powerpc::first_plt_entry_offset): New function.
6824         (Output_data_plt_powerpc::get_plt_entry_size): New function.
6825         * sparc.cc (Target_sparc::got_size): Add const.
6826         (Target_sparc::got_entry_count): New function.
6827         (Target_sparc::plt_entry_count): New function.
6828         (Target_sparc::first_plt_entry_offset): New function.
6829         (Target_sparc::plt_entry_size): New function.
6830         (Output_data_plt_sparc::entry_count): New function.
6831         (Output_data_plt_sparc::first_plt_entry_offset): New function.
6832         (Output_data_plt_sparc::get_plt_entry_size): New function.
6833         * symtab.h (Symbol::got_offset_list): New function.
6834         (Symbol_table::for_all_symbols): New function.
6835         * target.h (Sized_target::got_entry_count): New function.
6836         (Sized_target::plt_entry_count): New function.
6837         (Sized_target::plt_entry_size): New function.
6838         * x86_64.cc (Target_x86_64::got_size): Add const.
6839         (Target_x86_64::got_entry_count): New function.
6840         (Target_x86_64::plt_entry_count): New function.
6841         (Target_x86_64::first_plt_entry_offset): New function.
6842         (Target_x86_64::plt_entry_size): New function.
6843         (Output_data_plt_x86_64::entry_count): New function.
6844         (Output_data_plt_x86_64::first_plt_entry_offset): New function.
6845         (Output_data_plt_x86_64::get_plt_entry_size): New function.
6846
6847 2010-08-12  Cary Coutant  <ccoutant@google.com>
6848
6849         * archive.cc: Include incremental.h.
6850         (Archive::Archive): Initialize incremental_info_.
6851         (Archive::include_member): Record archive members in incremental info.
6852         (Add_archive_symbols::run): Record begin and end of an archive in
6853         incremental info.
6854         (Lib_group::include_member): Record objects in incremental info.
6855         * archive.h (Incremental_archive_entry): Forward declaration.
6856         (Archive::set_incremental_info): New member function.
6857         (Archive::incremental_info): New member function.
6858         (Archive::Unused_symbol_iterator): New class.
6859         (Archive::unused_symbols_begin): New member function.
6860         (Archive::unused_symbols_end): New member function.
6861         (Archive::incremental_info_): New data member.
6862         * incremental-dump.cc (find_input_containing_global): New function.
6863         (dump_incremental_inputs): Dump new incremental info sections.
6864         * incremental.cc: Include symtab.h.
6865         (Output_section_incremental_inputs): New class.
6866         (Sized_incremental_binary::do_find_incremental_inputs_sections): Support
6867         new incremental info sections.
6868         (Sized_incremental_binary::do_check_inputs): Likewise.
6869         (Incremental_inputs::report_archive): Remove.
6870         (Incremental_inputs::report_archive_begin): New function.
6871         (Incremental_inputs::report_archive_end): New function.
6872         (Incremental_inputs::report_object): New function.
6873         (Incremental_inputs::finalize_inputs): Remove.
6874         (Incremental_inputs::report_input_section): New function.
6875         (Incremental_inputs::report_script): Rewrite.
6876         (Incremental_inputs::finalize): Do nothing but finalize string table.
6877         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6878         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6879         (Incremental_inputs::create_data_sections): New function.
6880         (Incremental_inputs::relocs_entsize): New function.
6881         (Output_section_incremental_inputs::set_final_data_size): New function.
6882         (Output_section_incremental_inputs::do_write): New function.
6883         (Output_section_incremental_inputs::write_header): New function.
6884         (Output_section_incremental_inputs::write_input_files): New function.
6885         (Output_section_incremental_inputs::write_info_blocks): New function.
6886         (Output_section_incremental_inputs::write_symtab): New function.
6887         * incremental.h (Incremental_script_entry): Forward declaration.
6888         (Incremental_object_entry): Forward declaration.
6889         (Incremental_archive_entry): Forward declaration.
6890         (Incremental_inputs): Forward declaration.
6891         (Incremental_inputs_header_data): Remove.
6892         (Incremental_inputs_header): Remove.
6893         (Incremental_inputs_header_write): Remove.
6894         (Incremental_inputs_entry_data): Remove.
6895         (Incremental_inputs_entry): Remove.
6896         (Incremental_inputs_entry_write): Remove.
6897         (enum Incremental_input_type): Add INCREMENTAL_INPUT_ARCHIVE_MEMBER.
6898         (Incremental_binary::find_incremental_inputs_sections): Add parameters.
6899         (Incremental_binary::do_find_incremental_inputs_sections): Likewise.
6900         (Sized_ncremental_binary::do_find_incremental_inputs_sections):
6901         Likewise.
6902         (Incremental_input_entry): New class.
6903         (Incremental_script_entry): New class.
6904         (Incremental_object_entry): New class.
6905         (Incremental_archive_entry): New class.
6906         (Incremental_inputs::Incremental_inputs): Initialize new data members.
6907         (Incremental_inputs::report_inputs): Remove.
6908         (Incremental_inputs::report_archive): Remove.
6909         (Incremental_inputs::report_archive_begin): New function.
6910         (Incremental_inputs::report_archive_end): New function.
6911         (Incremental_inputs::report_object): Change prototype.
6912         (Incremental_inputs::report_input_section): New function.
6913         (Incremental_inputs::report_script): Change prototype.
6914         (Incremental_inputs::get_reloc_count): New function.
6915         (Incremental_inputs::set_reloc_count): New function.
6916         (Incremental_inputs::create_data_sections): New function.
6917         (Incremental_inputs::create_incremental_inputs_section_data): Remove.
6918         (Incremental_inputs::inputs_section): New function.
6919         (Incremental_inputs::symtab_section): New function.
6920         (Incremental_inputs::relocs_section): New function.
6921         (Incremental_inputs::get_stringpool): Add const.
6922         (Incremental_inputs::command_line): Add const.
6923         (Incremental_inputs::inputs): Remove.
6924         (Incremental_inputs::command_line_key): New function.
6925         (Incremental_inputs::input_file_count): New function.
6926         (Incremental_inputs::input_files): New function.
6927         (Incremental_inputs::relocs_entsize): New function.
6928         (Incremental_inputs::sized_create_inputs_section_data): Remove.
6929         (Incremental_inputs::finalize_inputs): Remove.
6930         (Incremental_inputs::Input_info): Remove.
6931         (Incremental_inputs::lock_): Remove.
6932         (Incremental_inputs::inputs_): Change type.
6933         (Incremental_inputs::inputs_map_): Remove.
6934         (Incremental_inputs::current_object_entry_): New data member.
6935         (Incremental_inputs::inputs_section_): New data member.
6936         (Incremental_inputs::symtab_section_): New data member.
6937         (Incremental_inputs::relocs_section_): New data member.
6938         (Incremental_inputs::reloc_count_): New data member.
6939         (Incremental_inputs_reader): New class.
6940         (Incremental_symtab_reader): New class.
6941         (Incremental_relocs_reader): New class.
6942         * layout.cc (Layout::finalize): Move finalization of incremental info
6943         and creation of incremental info sections to follow finalization of
6944         symbol table.  Set offsets for postprocessing sections.
6945         (Layout::create_incremental_info_sections): Call
6946         Incremental_inputs::create_data_sections.  Add incremental symtab
6947         and relocs sections.  Set sh_entsize and sh_link fields.  Arrange for
6948         sections to layout after input sections.
6949         * layout.h (struct Timespec): Forward declaration.
6950         (Layout::incremental_inputs): Add const.
6951         (Layout::create_incremental_info_sections): Add parameter.
6952         * main.cc (main): Remove call to Incremental_inputs::report_inputs.
6953         * object.cc: Include incremental.h.
6954         (Relobj::finalize_incremental_relocs): New function.
6955         (Sized_relobj::do_layout): Record input sections in incremental info.
6956         * object.h (Object::output_section): New function.
6957         (Object::output_section_offset): Moved from Relobj.
6958         (Object::get_incremental_reloc_base): New function.
6959         (Object::get_incremental_reloc_count): New function.
6960         (Object::do_output_section): New function.
6961         (Object::do_output_section_offset): Moved from Relobj.
6962         (Object::do_get_incremental_reloc_base): New function.
6963         (Object::do_get_incremental_reloc_count): New function.
6964         (Object::Object): Initialize new data members.
6965         (Relobj::output_section): Renamed do_output_section and moved to
6966         protected.
6967         (Relobj::output_section_offset): Moved to Object.
6968         (Relobj::do_get_incremental_reloc_base): New function.
6969         (Relobj::do_get_incremental_reloc_count): New function.
6970         (Relobj::allocate_incremental_reloc_counts): New function.
6971         (Relobj::count_incremental_reloc): New function.
6972         (Relobj::finalize_incremental_relocs): New function.
6973         (Relobj::next_incremental_reloc_index): New function.
6974         (Relobj::reloc_counts_): New data member.
6975         (Relobj::reloc_bases_): New data member.
6976         (Sized_relobj::do_relocate_sections): Add parameter.  Change caller.
6977         (Sized_relobj::relocate_sections): Add parameter.  Change all callers.
6978         (Sized_relobj::incremental_relocs_scan): New function.
6979         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6980         (Sized_relobj::incremental_relocs_write): New function.
6981         (Sized_relobj::incremental_relocs_write_reltype): New function.
6982         * plugin.cc (Plugin_manager::add_input_file): Rewrite test for
6983         incremental link.
6984         * readsyms.cc (Read_symbols::do_read_symbols): Move reporting of
6985         archives and object files elsewhere.
6986         (Add_symbols::run): Report object files here.
6987         (Finish_group::run): Report end of archive at end of group.
6988         * reloc.cc: Include layout.h, incremental.h.
6989         (Sized_relobj::do_read_relocs): Need relocations for incremental link.
6990         (Sized_relobj::do_scan_relocs): Record relocations for incremental link.
6991         (Sized_relobj::incremental_relocs_scan): New function.
6992         (Sized_relobj::incremental_relocs_scan_reltype): New function.
6993         (Sized_relobj::do_relocate_sections): Write incremental relocations.
6994         (Sized_relobj::incremental_relocs_write): New function.
6995         (Sized_relobj::incremental_relocs_write_reltype): New function.
6996         * script.cc (read_input_script): Rewrite test for incremental link.
6997         Change call to Incremental_inputs::report_script.
6998         * symtab.h (Symbol_table::first_global_index): New function.
6999         (Symbol_table::output_count): New function.
7000
7001 2010-08-12  Doug Kwan  <dougkwan@google.com>
7002
7003         * arm.cc (Target_arm::merge_object_attributes): Check command line
7004         options --no-wchar-size-warning and --no-enum-size-warning.
7005         * options.h (General_options): Add ld-compatible options
7006         --no-enum-size-warning and --no-wchar-size-warning.
7007
7008 2010-08-04  Ian Lance Taylor  <iant@google.com>
7009
7010         * x86_64.cc (Target_x86_64::Scan::local): Use
7011         R_X86_64_GNU_VTINHERIT instead of R_386_GNU_VTINHERIT and
7012         R_X86_64_GNU_VTENTRY instead of R_386_GNU_VTENTRY.
7013         (Target_x86_64::Scan::global): Likewise.
7014         (Target_x86_64::Relocate::relocate): Likewise.
7015         (Target_x86_64::Relocatable_size_for_reloc::get_size_for_reloc):
7016         Likewise.
7017
7018 2010-08-03  Cary Coutant  <ccoutant@google.com>
7019
7020         * merge.cc (Output_merge_string::do_add_input_section): Count strings
7021         to reserve space in merged_strings vector. Keep total input size
7022         for stats.
7023         (Output_merge_string::do_print_merge_stats): Print total input size.
7024         * merge.h (Output_merge_string): Add input_size_ field.
7025         * stringpool.cc (Stringpool_template::string_length): Move
7026         implementations out of Stringpool_template class and place in
7027         stringpool.h.
7028         * stringpool.h (string_length): Move out of Stringpool_template.
7029
7030 2010-08-03  Ian Lance Taylor  <iant@google.com>
7031
7032         PR 11712
7033         * layout.cc (relaxation_loop_body): If address of load segment is
7034         set, adjust address to include headers if possible.
7035
7036 2010-08-03  Ian Lance Taylor  <iant@google.com>
7037
7038         * version.cc (version_string): Bump to 1.10.
7039
7040 2010-08-03  Ian Lance Taylor  <iant@google.com>
7041
7042         PR 11805
7043         * layout.h (enum Output_section_order): Define.
7044         (class Layout): Update declarations.
7045         * layout.cc (Layout::get_output_section): Add order parameter.
7046         Remove is_interp, is_dynamic_linker_section, is_last_relro, and
7047         is_first_non_relro parameters.  Change all callers.
7048         (Layout::choose_output_section): Likewise.
7049         (Layout::add_output_section_data): Likewise.
7050         (Layout::make_output_section): Likewise.  Set order.
7051         (Layout::default_section_order): New function.
7052         (Layout::layout_eh_frame): Call add_output_section_to_nonload.
7053         * output.cc (Output_section::Output_section): Initialize order_.
7054         Don't initialize deleted fields.
7055         (Output_segment::Output_segment): Don't initialize deleted
7056         fields.
7057         (Output_segment::add_output_section_to_load): New function
7058         replacing add_output_section.  Change all callers to call this or
7059         add_output_section_to_nonload.
7060         (Output_segment::add_output_section_to_nonload): New function.
7061         (Output_segment::remove_output_section): Rewrite.
7062         (Output_segment::add_initial_output_data): Likewise.
7063         (Output_segment::has_any_data_sections): Likewise.
7064         (Output_segment::is_first_section_relro): Likewise.
7065         (Output_segment::maximum_alignment): Likewise.
7066         (Output_segment::has_dynamic_reloc): New function replacing
7067         dynamic_reloc_count.  Change all callers.
7068         (Output_segment::has_dynamic_reloc_list): New function replacing
7069         dynamic_reloc_count_list.  Change all callers.
7070         (Output_segment::set_section_addresses): Rewrite.
7071         (Output_segment::set_offset): Rewrite.
7072         (Output_segment::find_first_and_last_list): Remove.
7073         (Output_segment::set_tls_offsets): Rewrite.
7074         (Output_segment::first_section_load_address): Likewise.
7075         (Output_segment::output_section_count): Likewise.
7076         (Output_segment::section_with_lowest_load_address): Likewise.
7077         (Output_segment::write_section_headers): Likewise.
7078         (Output_segment::print_sections_to_map): Likewise.
7079         * output.h (class Output_data): Remove dynamic_reloc_count_
7080         field.  Add has_dynamic_reloc_ field.  Make bools into bitfields.
7081         (Output_data::add_dynamic_reloc): Rewrite.
7082         (Output_data::has_dynamic_reloc): New function.
7083         (Output_data::dynamic_reloc_count): Remove.
7084         (class Output_section): Add order_ field.  Remvoe is_relro_local_,
7085         is_last_relro_, is_first_non_relro_, is_interp_,
7086         is_dynamic_linker_section_ fields.  Add order and set_order
7087         functions.  Remove is_relro_local, set_is_relro_local,
7088         is_last_relro, set_is_last_relro, is_first_non_relro,
7089         set_is_first_non_relro functions, is_interp, set_is_interp,
7090         is_dynamic_linker_section, and set_is_dynamic_linker_section
7091         functions.
7092         (class Output_segment): Change Output_data_list from std::list to
7093         std:;vector.  Add output_lists_ field.  Remove output_data_ and
7094         output_bss_ fields.  Update declarations.
7095
7096 2010-08-02  Ian Lance Taylor  <iant@google.com>
7097
7098         * arm.cc (Target_arm::gc_process_relocs): Use typename.
7099         * powerpc.cc (Target_powerpc::gc_process_relocs): Likewise.
7100         * sparc.cc (Target_sparc::gc_process_relocs): Likewise.
7101
7102 2010-08-02  Ian Lance Taylor  <iant@google.com>
7103
7104         PR 11855
7105         * script.cc (Script_options::Script_options): Initialize
7106         symbol_definitions_ and symbol_references_.
7107         (Script_options::add_symbol_assignment): Update
7108         symbol_definitions_ and symbol_references_.
7109         (Script_options::add_symbol_reference): New function.
7110         (script_symbol): New function.
7111         * script.h (class Script_options): Add symbol_definitions_ and
7112         symbol_references_ fields.
7113         (Script_options::referenced_const_iterator): New type.
7114         (Script_options::referenced_begin): New function.
7115         (Script_options::referenced_end): New function.
7116         (Script_options::is_referenced): New function.
7117         (Script_options::any_unreferenced): New function.
7118         * script-c.h (script_symbol): Declare.
7119         * yyscript.y (exp): Call script_symbol.
7120         * symtab.cc: Include "script.h".
7121         (Symbol_table::gc_mark_undef_symbols): Add layout parameter.
7122         Change all callers.  Check symbols referenced by scripts.
7123         (Symbol_table::add_undefined_symbols_from_command_line): Add
7124         layout parameter.  Change all callers.
7125         (Symbol_table::do_add_undefined_symbols_from_command_line):
7126         Likewise.  Break out loop body.  Check symbols referenced by
7127         scripts.
7128         (Symbol_table::add_undefined_symbol_from_command_line): New
7129         function broken out of
7130         do_add_undefined_symbols_from_command_line.
7131         * symtab.h (class Symbol_table): Update declarations.
7132         * archive.cc: Include "layout.h".
7133         (Archive::should_include_member): Add layout parameter.  Change
7134         all callers.  Check for symbol mentioned in expression.
7135         * archive.h (class Archive): Update declaration.
7136         * object.cc (Sized_relobj::do_should_include_member): Add layout
7137         parameter.
7138         * object.h (Object::should_include_member): Add layout parameter.
7139         Change all callers.
7140         (Object::do_should_include_member): Add layout parameter.
7141         (class Sized_relobj): Update declaration.
7142         * dynobj.cc (Sized_dynobj::do_should_include_member): Add layout
7143         parameter.
7144         * dynobj.h (class Sized_dynobj): Update declaration.
7145         * plugin.cc (Sized_pluginobj::do_should_include_member): Add
7146         layout parameter.
7147         * plugin.h (class Sized_pluginobj): Update declaration.
7148
7149 2010-08-02  Ian Lance Taylor  <iant@google.com>
7150
7151         PR 11866
7152         * output.cc (Output_segment::set_offset): Search for the first and
7153         last sections rather than assuming that the list is in order.
7154         (Output_segment::find_first_and_last_list): New function.
7155         * output.h (class Output_segment): Update declarations.
7156         * testsuite/Makefile.am (check_PROGRAMS): Add relro_strip_test.
7157         (relro_strip_test_SOURCES): New variable.
7158         (relro_strip_test_DEPENDENCIES): New variable.
7159         (relro_strip_test_LDFLAGS): New variable.
7160         (relro_strip_test_LDADD): New variable.
7161         (relro_strip_test.so): New target.
7162
7163 2010-08-02  Ian Lance Taylor  <iant@google.com>
7164
7165         * i386.cc (class Target_i386): Add got_tlsdesc_ field.
7166         (Target_i386::Target_i386):: Initialize got_tlsdesc_.
7167         (Target_i386::got_tlsdesc_section): New function.
7168         (Target_i386::got_section): Create space for GOT entries for
7169         TLSDESC relocations.
7170         (Target_i386::Scan::local): Use TLSDESC GOT for unoptimized
7171         R_386_TLS_GOTDESC.
7172         (Target_i386::Scan::global): Likewise.
7173         (Target_i386::Relocate::relocate_tls): Adjust GOT offset when
7174         using TLSDESC GOT.
7175         * x86_64.cc (class Target_x86_64): Add got_tlsdesc_ field.
7176         (Target_x86_64::Target_x86_64):: Initialize got_tlsdesc_.
7177         (Target_x86_64::got_tlsdesc_section): New function.
7178         (Target_x86_64::got_section): Create space for GOT entries for
7179         TLSDESC relocations.
7180         (Target_x86_64::Scan::local): Use TLSDESC GOT for unoptimized
7181         R_386_TLS_GOTDESC.
7182         (Target_x86_64::Scan::global): Likewise.
7183         (Target_x86_64::Relocate::relocate_tls): Adjust GOT offset when
7184         using TLSDESC GOT.
7185
7186 2010-08-02  Ian Lance Taylor  <iant@google.com>
7187
7188         * testsuite/final_layout.sh: Use dc to convert from hex to
7189         decimal.
7190
7191 2010-07-29  Sriraman Tallam  <tmsriram@google.com>
7192
7193         * arm.cc (Target_arm<big_endian>::gc_process_relocs): Add template
7194         paramter to the call to gold::gc_process_relocs.
7195         * i386.cc (Target_i386<big_endian>::gc_process_relocs): Add template
7196         paramter to the call to gold::gc_process_relocs.
7197         * x86_64.cc (Target_x86_64<big_endian>::gc_process_relocs): Add template
7198         parameter to the call to gold::gc_process_relocs.
7199         * powerpc.cc (Target_powerpc<big_endian>::gc_process_relocs): Add
7200         template parameter to the call to gold::gc_process_relocs.
7201         * sparc.cc (Target_sparc<big_endian>::gc_process_relocs): Add template
7202         paramter to the call to gold::gc_process_relocs.
7203         * gc.h (get_embedded_addend_size): New function.
7204         (gc_process_relocs): Save the size of the reloc for use by ICF.
7205         * icf.cc (get_section_contents): Get the addend from the text section
7206         for SHT_REL relocation sections.
7207         * icf.h (Icf::Reloc_addend_size_info): New typedef.
7208         (Icf::Reloc_info): Add new member reloc_addend_size_info.
7209         * int_encoding.h (read_from_pointer): New overloaded function.
7210         * testsuite/Makefile.am (icf_sht_rel_addend_test): New test.
7211         * testsuite/icf_sht_rel_addend_test.sh: New file.
7212         * testsuite/icf_sht_rel_addend_test_1.cc: New file.
7213         * testsuite/icf_sht_rel_addend_test_2.cc: New file.
7214
7215 2010-07-28  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7216
7217         * configure.ac (AM_INIT_AUTOMAKE): Use parallel-tests option.
7218         * Makefile.in: Regenerate.
7219         * testsuite/Makefile.in: Regenerate.
7220
7221 2010-07-27  Jeffrey Yasskin  <jyasskin@google.com>
7222
7223         * testsuite/debug_msg.sh: Test mixed weak/strong symbol behavior.
7224         * gold/testsuite/debug_msg.cc: Likewise.
7225         * gold/testsuite/odr_violation1.cc
7226         * gold/testsuite/odr_violation2.cc
7227
7228 2010-07-21  Cary Coutant  <ccoutant@google.com>
7229
7230         * merge.h (Output_merge_string::Merged_string): Remove object, shndx,
7231         string, and length fields.
7232         (Output_merge_string::Merged_strings_list): New type.
7233         (Output_merge_string::Merged_strings_lists): New typedef.
7234         (Output_merge_string): Replace merged_strings_ with
7235         merged_strings_lists_.
7236         * merge.cc (Output_merge_string::do_add_input_section): Allocate new
7237         Merged_strings_list per input object and section.  Don't store pointer
7238         to the string.  Don't store length with each merged string entry.
7239         (Output_merge_string::finalize_merged_data): Loop over list of merged
7240         strings lists.  Recompute length of each merged string.
7241
7242 2010-07-15  Cary Coutant  <ccoutant@google.com>
7243
7244         * plugin.cc (Plugin_finish::run): Don't call cleanup handlers from
7245         here.
7246
7247 2010-07-14  Ian Lance Taylor  <iant@google.com>
7248
7249         * descriptors.cc (Descriptors::open): Report correct name in error
7250         message.
7251
7252 2010-07-13  Doug Kwan  <dougkwan@google.com>
7253
7254         * arm.cc (Arm_input_section::Arm_input_section): For a
7255         SHT_ARM_EXIDX section, always keeps the input sections.
7256         (Arm_input_section::set_exidx_section_link): New method.
7257         (Arm_exidx_input_section::Arm_exidx_input_section): Initialize
7258         has_errors_ to false.
7259         (Arm_exidx_input_section::has_errors,
7260         Arm_exidx_input_section::set_has_errors): New methods.
7261         (Arm_exidx_input_section::has_errors_): New data member.
7262         (Arm_relobj::get_exidx_shndx_list): New method.
7263         (Arm_output_section::append_text_sections_to_list): Do not skip
7264         section without SHF_EXECINSTR.
7265         (Arm_output_section::fix_exidx_coverage): Skip input sections with
7266         errors.
7267         (Arm_relobj::make_exidx_input_section): Add new parameter for text
7268         section header.  Make error messages more verbose.  Check for
7269         a non-executable section linked to an EXIDX section.
7270         (Arm_relobj::do_read_symbols): Remove error checking, which has been
7271         moved to Arm_relobj::make_exidx_input_section.  Add an assertion to
7272         check that there is no deferred EXIDX section if we exit early.
7273         Instead of not making an EXIDX section in case of an error, make one
7274         and set the has_errors flag of it.
7275         (Target_arm::do_finalize_sections): Fix up links of EXIDX sections
7276         in a relocatable link.
7277         (Target_arm::do_relax): Look for the EXIDX output section instead of
7278         assuming that it is called .ARM.exidx.
7279         (Target_arm::fix_exidx_coverage): Add a new parameter for input
7280         section list.  Do not check for SHF_EXECINSTR section flags but
7281         skip any input section with errors.
7282         * output.cc (Output_section::Output_section): Initialize
7283         always_keeps_input_sections_ to false.
7284         (Output_section::add_input_section): Check for
7285         always_keeps_input_sections_.
7286         *  output.h (Output_section::always_keeps_input_sections,
7287         Output_section::set_always_keeps_input_sections): New methods.
7288         (Output_section::always_keeps_input_sections): New data member.
7289
7290 2010-07-13  Rafael Espindola  <espindola@google.com>
7291
7292         * fileread.cc (try_extra_search_path, find_file): Move to Input_file.
7293         * fileread.h (Input_file): Add try_extra_search_path and find_file.
7294
7295 2010-07-13  Philip Herron  <herron.philip@googlemail.com>
7296             Ian Lance Taylor  <iant@google.com>
7297
7298         * output.h (Output_section_lookup_maps::add_merge_section):
7299         Correct check of whether value was inserted.
7300         (Output_section_lookup_maps::add_merge_input_section): Likewise.
7301         (Output_section_lookup_maps::add_relaxed_input_section):
7302         Likewise.
7303         * arm.cc (Target_arm::got_section): Remove used local os.
7304         * i386.cc (Target_i386::got_section): Likewise.
7305         * x86_64.cc (Target_x86_64::got_section): Likewise.
7306         * sparc.cc (Target_sparc::got_section): Likewise.
7307         (Target_sparc::relocate): Remove unused local have_got_offset.
7308         * powerpc.cc (Target_powerpc::relocate): Likewise.
7309
7310 2010-07-13  Ian Lance Taylor  <iant@google.com>
7311
7312         * compressed_output.cc (zlib_decompress): Fix signature in
7313         !HAVE_ZLIB_H case.
7314
7315         * archive.cc (Archive::include_member): Unlock an external member
7316         of a thin archive.  Don't bother to delete an object we know is
7317         NULL.
7318
7319 2010-07-12  Cary Coutant  <ccoutant@google.com>
7320
7321         * compressed_output.cc (zlib_decompress): New function.
7322         (get_uncompressed_size): New function.
7323         (decompress_input_section): New function.
7324         * compressed_output.h (get_uncompressed_size): New function.
7325         (decompress_input_section): New function.
7326         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info)
7327         Handle compressed debug sections.
7328         * layout.cc (is_compressed_debug_section): New function.
7329         (Layout::output_section_name): Map compressed section names to
7330         canonical names.
7331         * layout.h (is_compressed_debug_section): New function.
7332         (is_debug_info_section): Recognize compressed debug sections.
7333         * merge.cc: Include compressed_output.h.
7334         (Output_merge_data::do_add_input_section): Handle compressed
7335         debug sections.
7336         (Output_merge_string::do_add_input_section): Handle compressed
7337         debug sections.
7338         * object.cc: Include compressed_output.h.
7339         (Sized_relobj::Sized_relobj): Initialize new data members.
7340         (build_compressed_section_map): New function.
7341         (Sized_relobj::do_read_symbols): Handle compressed debug sections.
7342         * object.h (Object::section_is_compressed): New method.
7343         (Object::do_section_is_compressed): New method.
7344         (Sized_relobj::Compressed_section_map): New type.
7345         (Sized_relobj::do_section_is_compressed): New method.
7346         (Sized_relobj::compressed_sections_): New data member.
7347         * output.cc (Output_section::add_input_section): Handle compressed
7348         debug sections.
7349         * reloc.cc: Include compressed_output.h.
7350         (Sized_relobj::write_sections): Handle compressed debug sections.
7351
7352 2010-07-08  Cary Coutant  <ccoutant@google.com>
7353
7354         * resolve.cc (Symbol_table::resolve): Remember whether undef was
7355         weak when resolving to a dynamic def.
7356         (Symbol_table::should_override): Add adjust_dyndef flag; set it
7357         for weak undef/dynamic def cases. Adjust callers.
7358         * symtab.cc (Symbol::init_fields): Initialize undef_binding_set_ and
7359         undef_binding_weak_.
7360         (Symbol_table::sized_write_globals): Adjust symbol binding.
7361         (Symbol_table::sized_write_symbol): Add binding parameter.
7362         * symtab.h (Symbol::set_undef_binding): New method.
7363         (Symbol::is_undef_binding_weak): New method.
7364         (Symbol::undef_binding_set_, Symbol::undef_binding_weak_): New members.
7365         (Symbol_table::should_override): Add new parameter.
7366         (Symbol_table::sized_write_symbol): Add new parameter.
7367
7368         * testsuite/weak_undef_file1.cc: Add new test case.
7369         * testsuite/weak_undef_file2.cc: Fix header comment.
7370         * testsuite/weak_undef_test.cc: Add new test case.
7371
7372 2010-06-29  Doug Kwan  <dougkwan@google.com>
7373
7374         * arm-reloc-property.cc (Arm_reloc_property::Arm_reloc_property):
7375         Initialize USE_SYMBOL_.
7376         * arm-reloc-property.h (Arm_reloc_property::uses_symbol): New method
7377         definition.
7378         (Arm_reloc_property::uses_symbol_): New data member declaration.
7379         * arm.cc (Target_arm::Relocate::relocate): Exit early if relocation
7380         uses symbol value and symbol is undefined but not weakly undefined.
7381
7382 2010-06-28  Rafael Espindola  <espindola@google.com>
7383
7384         * plugin.cc (Plugin::load): Use dlerror.
7385
7386 2010-06-26  Jeffrey Yaskin  <jyasskin@google.com>
7387
7388         * symtab.cc (detect_odr_violations): When reporting an ODR
7389         violation, report an object where the symbol is defined.
7390
7391 2010-06-25  Doug Kwan  <dougkwan@google.com>
7392
7393         * arm.cc (Target_arm::can_check_for_functions_pointers): Return true.
7394         (Target_arm::section_may_have_icf_unsafe_pointers): New method
7395         definition.
7396         (Target_arm::Scan::local_reloc_may_be_function_pointer,
7397         Target_arm::Scan::global_reloc_may_be_function_pointer): Implement
7398         target hook to detect function points.
7399         (Target_arm::Scan::possible_function_pointer_reloc): New method.
7400         * icf.h (Icf::check_section_for_function_pointers): Change type of
7401         parameter SECTION_NAME to const reference to std::string.  Use
7402         target hook to determine if section may have unsafe pointers.
7403         * target.h (Target::section_may_have_icf_unsafe_pointers): New
7404         method definition.
7405
7406 2010-06-21  Rafael Espindola  <espindola@google.com>
7407
7408         * fileread.cc (Input_file::find_fie): New
7409         (Input_file::open): Use Input_file::find_fie.
7410         * fileread.h (Input_file::find_fie): New
7411         * plugin.cc (set_extra_library_path): New.
7412         (Plugin::load): Add set_extra_library_path to the transfer vector.
7413         (Plugin_manager::set_extra_library_path): New.
7414         (Plugin_manager::add_input_file): Use the extra search path if set.
7415         (set_extra_library_path(): New.
7416         * plugin.h (Plugin_manager): Add set_extra_library_path and
7417         extra_search_path_.
7418
7419 2010-06-19  Cary Coutant  <ccoutant@google.com>
7420
7421         * layout.cc (gdb_sections): Add .debug_types.
7422         (lines_only_debug_sections): Likewise.
7423
7424 2010-06-18  Rafael Espindola  <espindola@google.com>
7425
7426         * plugin.cc (add_input_file,add_input_library)
7427         (Plugin_manager::add_input_file): Make filename arguments const.
7428         * plugin.h (Plugin_manager::add_input_file): Make filename arguments
7429         const.
7430
7431 2010-06-16  Doug Kwan  <dougkwan@google.com>
7432
7433         * arm.cc (Target_arm::do_finalize_sections): Do not emit an
7434         .ARM.attributes section if we have not merged any input
7435         attributes sections.
7436
7437 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7438
7439         * arm.cc: Allow combining objects with no EABI version
7440         information.
7441
7442 2010-06-15  Rafael Espindola  <espindola@google.com>
7443
7444         * plugin.cc (Plugin_hook::run): Set in_real_elf for the start symbol.
7445
7446 2010-06-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7447
7448         * fileread.cc: Only #include <sys/uio.h> if HAVE_READV.
7449         (struct iovec): Correct !HAVE_READV definition.
7450
7451 2010-06-10  Cary Coutant  <ccoutant@google.com>
7452
7453         * object.cc (Sized_relobj::do_layout): Defer layout for reloc sections.
7454         (Sized_relobj::do_layout_deferred_sections): Do layout for deferred
7455         reloc sections.
7456         * object.h (Sized_relobj::deferred_layout_relocs_): New data member.
7457
7458         PR 11683
7459         * symtab.h (Symbol::is_placeholder): New member function.
7460         * target-reloc.h (relocate_section): Check for placeholder symbols.
7461
7462         * testsuite/Makefile.am (plugin_test_8): New test.
7463         (plugin_test_9): New test.
7464         * testsuite/Makefile.in: Regenerate.
7465
7466 2010-06-09  Nick Clifton  <nickc@redhat.com>
7467
7468         * yyscript.y (input_list_element): Allow strings prefixed with
7469         the '-' character.  Treat these as libraries.
7470         * script.cc (script_add_library): New function.  Adds a library
7471         specified by "-l<name>" found in an input script.
7472         * script-c.h: Add prototype for script_add_library.
7473
7474 2010-06-07  Doug Kwan  <dougkwan@google.com>
7475
7476         * arm.cc (Target_arm::do_relax): Reserve more space for stubs.
7477         Restrict stub-group size to be within long conditional branch
7478         range when working around cortex-A8 erratum.
7479
7480 2010-06-07  Damien Diederen  <dd@crosstwine.com>
7481
7482         * gold-threads.cc (Lock_impl_threads::Lock_impl_threads): Correct
7483         #ifdef typo.
7484
7485 2010-06-03  Sriraman Tallam  <tmsriram@google.com>
7486
7487         PR gold/11658
7488         * output.cc
7489         (Output_section::Input_section_sort_entry::compare_section_ordering):
7490         Change to return non-zero correctly.
7491         (Output_section::Input_section_sort_section_order_index_compare
7492         ::operator()): Change to fix ambiguity in comparisons.
7493
7494 2010-06-01  Sriraman Tallam  <tmsriram@google.com>
7495
7496         * gold.h (is_wildcard_string): New function.
7497         * layout.cc (Layout::layout): Pass this pointer to add_input_section.
7498         (Layout::layout_eh_frame): Ditto.
7499         (Layout::find_section_order_index): New method.
7500         (Layout::read_layout_from_file): New method.
7501         * layout.h (Layout::find_section_order_index): New method.
7502         (Layout::read_layout_from_file): New method.
7503         (Layout::input_section_position_): New private member.
7504         (Layout::input_section_glob_): New private member.
7505         * main.cc (main): Call read_layout_from_file here.
7506         * options.h (--section-ordering-file): New option.
7507         * output.cc (Output_section::input_section_order_specified_): New
7508         member.
7509         (Output_section::Output_section): Initialize new member.
7510         (Output_section::add_input_section): Add new parameter.
7511         Keep input sections when --section-ordering-file is used.
7512         (Output_section::set_final_data_size): Sort input sections when
7513         section ordering file is specified.
7514         (Output_section::Input_section_sort_entry): Add new parameter.
7515         Check sorting type.
7516         (Output_section::Input_section_sort_entry::compare_section_ordering):
7517         New method.
7518         (Output_section::Input_section_sort_compare::operator()): Change to
7519         consider section_order_index.
7520         (Output_section::Input_section_sort_init_fini_compare::operator()):
7521         Change to consider section_order_index.
7522         (Output_section::Input_section_sort_section_order_index_compare
7523         ::operator()): New method.
7524         (Output_section::sort_attached_input_sections): Change to sort
7525         according to section order when specified.
7526         (Output_section::add_input_section<32, true>): Add new parameter.
7527         (Output_section::add_input_section<64, true>): Add new parameter.
7528         (Output_section::add_input_section<32, false>): Add new parameter.
7529         (Output_section::add_input_section<64, false>): Add new parameter.
7530         * output.h (Output_section::add_input_section): Add new parameter.
7531         (Output_section::input_section_order_specified): New
7532         method.
7533         (Output_section::set_input_section_order_specified): New method.
7534         (Input_section::Input_section): Initialize section_order_index_.
7535         (Input_section::section_order_index): New method.
7536         (Input_section::set_section_order_index): New method.
7537         (Input_section::section_order_index_): New member.
7538         (Input_section::Input_section_sort_section_order_index_compare): New
7539         struct.
7540         (Output_section::input_section_order_specified_): New member.
7541         * script-sections.cc (is_wildcard_string): Delete and move modified
7542         method to gold.h.
7543         (Output_section_element_input::Output_section_element_input): Modify
7544         call to is_wildcard_string.
7545         (Output_section_element_input::Input_section_pattern
7546         ::Input_section_pattern): Ditto.
7547         (Output_section_element_input::Output_section_element_input): Ditto.
7548         * testsuite/Makefile.am (final_layout): New test case.
7549         * testsuite/Makefile.in: Regenerate.
7550         * testsuite/final_layout.cc: New file.
7551         * testsuite/final_layout.sh: New file.
7552
7553 2010-06-01  Rafael Espindola  <espindola@google.com>
7554
7555         * plugin.cc (Plugin::load): Pass the output name to the plugin.
7556
7557 2010-06-01  Rafael Espindola  <espindola@google.com>
7558
7559         * plugin.cc (Sized_pluginobj::::do_add_symbols): Correctly set the
7560         visibility of symbols.
7561
7562 2010-05-27  Doug Kwan  <dougkwan@google.com>
7563
7564         * object.cc (Sized_relobj::do_finalize_local_symbols): Use offset
7565         from start of output section instead of address for a local symbol
7566         in a merged or relaxed section when doing a relocatable link.
7567
7568 2010-05-26  Rafael Espindola  <espindola@google.com>
7569
7570         PR 11604
7571         * gold/object.cc(Sized_relobj::do_layout_deferred_sections): Avoid
7572         adding sections the garbage collector removed.
7573         * gold/testsuite/Makefile.am: Add test.
7574         * gold/testsuite/Makefile.in: Regenerate.
7575         * gold/testsuite/plugin_test_7.sh: New.
7576         * gold/testsuite/plugin_test_7_1.c: New.
7577         * gold/testsuite/plugin_test_7_2.c: New.
7578
7579 2010-05-26  Rafael Espindola  <espindola@google.com>
7580
7581         * script-sections.cc (Output_section_definition::set_section_addresses):
7582         Check for --section-start.
7583
7584 2010-05-26  Doug Kwan  <dougkwan@google.com>
7585
7586         * arm.cc (Arm_scan_relocatable_relocs): New class.
7587         (Target_arm::relocate_special_relocatable): New method.
7588         (Arm_relocate_functions::arm_branch_common): Handle relocatable link.
7589         (Arm_relocate_functions::thumb_branch_common): Same.
7590         (Target_arm::scan_relocatable_relocs): Use Arm_scan_relocatable_relocs
7591         instead of Default_scan_relocatable_relocs.
7592         * target-reloc.h (relocate_for_relocatable): Let target handle
7593         relocation strategy Relocatable_relocs::RELOC_SPECIAL.
7594         * target.h (Sized_target::relocate_special_relocatable): New method.
7595
7596 2010-05-25  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
7597
7598         * timer.cc: Only #include <sys/times.h> if HAVE_TIMES is defined.
7599
7600 2010-05-23  Doug Kwan  <dougkwan@google.com>
7601
7602         * arm.cc (Arm_input_section::do_output_offset): Use convert_types
7603         instead of a cast.
7604         (Target_arm::apply_cortex_a8_workaround): Rewrite a conditional branch
7605         with a direct branch, not a conditional branch, to a stub.
7606         * merge.cc (Output_merge_base::record_input_section): New method
7607         defintion.
7608         (Output_merge_data::do_add_input_section): Record input section if
7609         keeps-input-sections flag is set.
7610         (Output_merge_string::do_add_input_section): Ditto.
7611         * merge.h (Output_merge_base::Output_merge_base): Initialize new data
7612         members KEEPS_INPUT_SECTIONS_, FIRST_RELOBJ_, FIRST_SHNDX_ and
7613         INPUT_SECTIONS_.
7614         (Output_merge_base::keeps_input_sections,
7615         Output_merge_base::set_keeps_input_sections,
7616         Output_merge_base::first_relobj, Output_merge_base::first_shndx): New
7617         method definitions.
7618         (Output_merge_base::Input_sections): New type declaration.
7619         (Output_merge_base::input_sections_begin,
7620         Output_merge_base::input_sections_end,
7621         Output_merge_base::do_set_keeps_input_sections): New method definitions.
7622         (Output_merge_base::bool keeps_input_sections_,
7623         Output_merge_base::first_relobj_, Output_merge_base::first_shndx_,
7624         Output_merge_base::input_sections_): New data members.
7625         (Output_merge_data::do_set_keeps_input_sections): New method
7626         defintion.
7627         (Output_merge_string::do_set_keeps_input_sections): Ditto.
7628         * output.cc (Output_section::Input_section::relobj): Move method
7629         defintion from class declaration to here and handle merge sections.
7630         (Output_section::Input_section::shndx): Ditto.
7631         (Output_section::Output_section): Remove initializations of removed
7632         data members and initialize new data member LOOKUP_MAPS_.
7633         (Output_section::add_input_section): Set keeps-input-sections flag
7634         for a newly created merge output section as appropriate.  Adjust code
7635         to use Output_section_lookup_maps class.
7636         (Output_section::add_relaxed_input_section): Adjst code for lookup
7637         maps code refactoring.
7638         (Output_section::add_merge_input_section): Add a new parameter
7639         KEEPS_INPUT_SECTION.  Adjust code to use Output_section_lookup_maps
7640         class.  If adding input section to a newly created merge output
7641         section fails, remove the new merge section.
7642         (Output_section::convert_input_sections_in_list_to_relaxed_input_sections):
7643         Adjust code for use of the Output_section_lookup_maps class.
7644         (Output_section::find_merge_section): Ditto.
7645         (Output_section::build_lookup_maps): New method defintion.
7646         (Output_section::find_relaxed_input_section): Adjust code to use
7647         Output_section_lookup_maps class.
7648         (Output_section::get_input_sections): Export merge sections.  Adjust
7649         code to use Output_section_lookup_maps class.
7650         (Output_section:::add_script_input_section): Adjust code to use
7651         Output_section_lookup_maps class.  Update lookup maps for merge
7652         sections also.
7653         (Output_section::discard_states): Use Output_section_lookup_maps.
7654         (Output_section::restore_states): Same.
7655         * output.h (Merge_section_properties): Move class defintion out of
7656         Output_section.
7657         (Output_section_lookup_maps): New class.
7658         (Output_section::Input_section::is_merge_section): New method
7659         defintion.
7660         (Output_section::Input_section::relobj): Move defintion out of class
7661         defintion.  Declare method only.
7662         (Output_section::Input_section::shndx): Ditto.
7663         (Output_section::Input_section::output_merge_base): New method defintion.
7664         (Output_section::Input_section::u2_.pomb): New union field.
7665         (Output_section::Merge_section_by_properties_map,
7666         Output_section::Output_section_data_by_input_section_map,
7667         Output_section::Ouptut_relaxed_input_section_by_input_section_map):
7668         Remove types.
7669         (Output_section::add_merge_input_section): Add new parameter
7670         KEEPS_INPUT_SECTIONS.
7671         (Output_section::build_lookup_maps): New method declaration.
7672         (Output_section::merge_section_map_,
7673         Output_section::merge_section_by_properties_map_,
7674         Output_section::relaxed_input_section_map_,
7675         Output_section::is_relaxed_input_section_map_valid_): Remove data
7676         members.
7677         (Output_section::lookup_maps_): New data member.
7678
7679 2010-05-21  Doug Kwan  <dougkwan@google.com>
7680
7681         PR gold/11619
7682         * arm.cc (Arm_input_section::do_output_offset): Add a cast to
7683         avoid a compilation error.
7684
7685 2010-05-19  Rafael Espindola  <espindola@google.com>
7686
7687         * script-sections.cc (Output_section_definition::allocate_to_segment):
7688         Update the phdrs_list even when the output section is NULL.
7689         * testsuite/Makefile.am: Add test.
7690         * testsuite/Makefile.in: Regenerate.
7691         * testsuite/script_test_9.cc: New.
7692         * testsuite/script_test_9.sh: New.
7693         * testsuite/script_test_9.t: New.
7694
7695 2010-05-19  Doug Kwan  <dougkwan@google.com>
7696
7697         * arm.cc (Arm_input_section::original_size): New method.
7698         (Arm_input_section::do_addralign): Add a cast.
7699         (Arm_input_section::do_output_offset): Remove static cast.
7700         (Arm_input_section::original_addralign,
7701          Arm_input_section::original_size_): Change type to uint32_t.
7702         (Arm_input_section::init): Add safe casts for section alignment
7703         and size.
7704         (Arm_input_section::set_final_data_size): Do not set address and
7705         offset of stub table.
7706         (Arm_output_section::fix_exidx_coverage): Change use of of
7707         Output_section::Simple_input_section to that of
7708         Output_section::Input_section.
7709         (Target_arm::do_relax): Set addresses and file offsets of Stub_tables
7710         except for the first pass.
7711         * output.cc (Output_section::get_input_sections): Change type of
7712         input_sections to std::list<Input_section>.
7713         (Output_section::add_script_input_section): Rename from
7714         Output_section::add_simple_input_section.  Change type of SIS
7715         parameter from Simple_input_section to Input_section.
7716         * output.h (Output_section::Simple_input_section): Remove class.
7717         (Output_section::Input_section): Change class visibility to public.
7718         (Output_section::Input_section::addralign): Use stored alignments
7719         for special input sections if set.
7720         (Output_section::Input_section::set_addralign): New method.
7721         (Output_section::get_input_sections): Change parameter type from
7722         list of Simple_input_section to list of Input_section.
7723         (Output_section::add_script_input_section): Rename from
7724         Output_section::add_simple_input_section. Change first parameter's
7725         type from Simple_input_section to Input_section and remove the
7726         second and third parameters.
7727         * script-sections.cc (Input_section::Input_section_list): Change
7728         type to list of Output_section::Input_section/
7729         (Input_section_info::Input_section_info): Change parameter type of
7730         INPUT_SECTION to Output_section::Input_section.
7731         (Input_section_info::input_section): Change return type.
7732         (Input_section_info::input_section_): Change type to
7733         Output_section::Input_section.
7734         (Output_section_element_input::set_section_addresses): Adjust code
7735         to use Output_section::Input_section instead of
7736         Output_section::Simple_input_section.  Adjust code for renaming
7737         of Output_section::add_simple_input_section.
7738         (Orphan_output_section::set_section_addresses): Ditto.
7739
7740 2010-05-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
7741
7742         * gold.h (Unordered_multimap, Unordered_map): Fix defines for
7743         when neither HAVE_TR1_UNORDERED_MAP nor HAVE_EXT_HASH_MAP are set.
7744
7745 2010-05-18  Rafael Espindola  <espindola@google.com>
7746
7747         * options.cc (General_options::finalize): Handle -nostdlib.
7748         * options.h (nostdlib): New option.
7749         * script.cc (script_add_search_dir): Handle -nostdlib.
7750
7751 2010-05-12  Doug Kwan  <dougkwan@google.com>
7752
7753         * arm.cc (Target_arm::do_finalize_sections): Create an empty
7754         attributes section only if there no attributes section after merging.
7755         (Target_arm::merge_object_attributes): Move value of
7756         Tag_MPextension_use_legacy to that of Tag_MPextension_use.
7757         Handle Tag_DIV_use and Tag_MPextension_use_legacy.
7758         * testsuite/Makefile.am (check_SCRIPTS): Add arm_attr_merge.sh
7759         (check_DATA): Add arm_attr_merge_6.stdout, arm_attr_merge_6r_stdout
7760         and arm_attr_merge_7.stdout.
7761         (arm_attr_merge_6.stdout, arm_attr_merge_6 arm_attr_merge_6a.o
7762         arm_attr_merge_6b.o, arm_attr_merge_6r.stdout, arm_attr_merge_6r,
7763         arm_attr_merge_7.stdout, arm_attr_merge_7, arm_attr_merge_7a.o,
7764         arm_attr_merge_7b.o): New rules.
7765         (MOSTLYCLEANFILES): Add arm_attr_merge_6, arm_attr_merge_6r and
7766         arm_attr_merge_7
7767         * testsuite/Makefile.in: Regenerate.
7768         * testsuite/arm_attr_merge.sh: New file.
7769         * testsuite/arm_attr_merge_[67][ab].s: Same.
7770
7771 2010-05-05  Nick Clifton  <nickc@redhat.com>
7772
7773         * po/es.po: Updated Spanish translation.
7774
7775 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7776
7777         * Makefile.am (install-exec-local): Properly install gold as
7778         default cross linker.
7779         * Makefile.in: Regenerated.
7780
7781 2010-04-27  H.J. Lu  <hongjiu.lu@intel.com>
7782             Nick Clifton  <nickc@redhat.com>
7783
7784         * configure.ac (install_as_default): Define and set to false
7785         unless --enable-gold or --enable-gold=both/gold has been
7786         specified.
7787         * configure: Regenerate.
7788
7789         * Makefile.am (install-exec-local): Install the executable as
7790         'ld.gold'.  If install_as_default is true then also install it as
7791         'ld'.
7792         * Makefile.in: Regenerated.
7793
7794 2010-04-24  Ian Lance Taylor  <iant@google.com>
7795
7796         * layout.cc (Layout::layout_reloc): In relocatable link don't
7797         combine reloc sections for grouped sections.
7798
7799 2010-04-23  Sriraman Tallam  <tmsriram@google.com>
7800
7801         * gc.h (gc_process_relocs): Pass information on relocs pointing to
7802         sections that are not ordinary to icf.
7803         * icf.cc (get_section_contents): Handle relocation pointing to section
7804         with no object or shndx information.
7805         * testsuite/Makefile.am: Remove icf_virtual_function_folding_test.sh
7806         * testsuite/Makefile.in: Regenerate.
7807         * testsuite/icf_virtual_function_folding_test.cc: Remove printf.
7808         * testsuite/icf_virtual_function_folding_test.sh: Delete file.
7809
7810 2010-04-22  Ian Lance Taylor  <iant@google.com>
7811
7812         * expression.cc (Expression::Expression_eval_info): Add
7813         result_alignment_pointer field.
7814         (Expression::eval_with_dot): Add result_alignment_pointer
7815         parameter.  Change all callers.
7816         (Expression::eval_maybe_dot): Likewise.
7817         (class Binary_expression): Add alignment_pointer parameter to
7818         left_value and right_value.  Change all callers.
7819         (BINARY_EXPRESSION): Set result alignment.
7820         (class Trinary_expression): Add alignment_pointer parameter to
7821         arg2_value and arg3_value.  Change all callers.
7822         (Trinary_cond::value): Set result alignment.
7823         (Max_expression::value, Min_expression::value): Likewise.
7824         (Align_expression::value): Likewise.
7825         * script-sections.cc (class Sections_element): Add dot_alignment
7826         parameter to set_section_addresses virtual function.  Update
7827         instantiations.
7828         (class Output_section_element): Likewise.
7829         (Script_sections::create_segments): Add dot_alignment parameter.
7830         Change all callers.
7831         (Script_sections::create_segments_from_phdrs_clause): Likewise.
7832         (Script_sections::set_phdrs_clause_addresses): Likewise.
7833         * script-sections.h: Update declarations.
7834         * script.h: Update declarations.
7835         * output.h (Output_segment::set_minimum_p_align): Don't decrease
7836         min_p_align.
7837         * testsuite/script_test_3.t: Set large alignment.
7838         * testsuite/script_test_3.sh: Make sure that at least one LOAD
7839         segment has expected alignment.
7840
7841 2010-04-22  Nick Clifton  <nickc@redhat.com>
7842
7843         * po/gold.pot: Updated by the Translation project.
7844         * po/vi.po: Updated Vietnamese translation.
7845
7846 2010-04-22  H.J. Lu  <hongjiu.lu@intel.com>
7847
7848         * testsuite/Makefile.am (check_PROGRAMS): Add
7849         icf_virtual_function_folding_test.
7850         * testsuite/Makefile.in: Regenerated.
7851
7852 2010-04-15  Andrew Haley  <aph@redhat.com>
7853
7854         * options.h (merge_exidx_entries): New option.
7855         * arm.cc (class Arm_exidx_fixup): Add new arg, merge_exidx_entries.
7856         (class Arm_exidx_fixup::merge_exidx_entries_): New member.
7857         (Output_section::fix_exidx_coverage): Add new arg, merge_exidx_entries.
7858         (Target_arm::merge_exidx_entries): New function.
7859         (process_exidx_entry): Don't merge if merge_exidx_entries_ is false.
7860         (Arm_output_section::fix_exidx_coverage): Pass merge_exidx_entries
7861         to Arm_exidx_fixup constructor.
7862         Add new arg, merge_exidx_entries.
7863         (Target_arm::fix_exidx_coverage): pass merge_exidx_entries to
7864         Arm_output_section::fix_exidx_coverage.
7865
7866 2010-04-18  Sriraman Tallam  <tmsriram@google.com>
7867
7868         * icf.cc (get_section_contents): Check for preemptible functions.
7869         Ignore addend when appropriate.
7870         * symtab.cc (should_add_dynsym_entry): Add new parameter.  Check for
7871         section folded.
7872         (add_from_relobj): Check for section folded.
7873         (set_dynsym_indexes): Fix call to should_add_dynsym_entry.
7874         * symtab.h (should_add_dynsym_entry): Add new parameter.
7875         * target-reloc.h (scan_relocs): Check for section folded.
7876         * x86_64.cc (Target_x86_64::Scan::possible_function_pointer_reloc):
7877         Check reloc types for function pointers in shared objects.
7878         * testsuite/Makefile.am (icf_virtual_function_folding_test): New test
7879         case.
7880         (icf_preemptible_functions_test): New test case.
7881         (icf_string_merge_test): New test case.
7882         * testsuite.Makefile.in: Regenerate.
7883         * testsuite/icf_safe_so_test.sh: Change to not fold foo_glob and
7884         bar_glob.  Refactor code.
7885         * testsuite/icf_preemptible_functions_test.cc: New file.
7886         * testsuite/icf_preemptible_functions_test.sh: New file.
7887         * testsuite/icf_string_merge_test.cc: New file.
7888         * testsuite/icf_string_merge_test.sh: New file.
7889         * testsuite/icf_virtual_function_folding_test.cc: New file.
7890         * testsuite/icf_virtual_function_folding_test.sh: New file.
7891
7892 2010-04-14  Doug Kwan  <dougkwan@google.com>
7893
7894         * arm.cc (Arm_output_section::fix_exidx_coverage): Mark object
7895         for local symbol recounting if we remove a section due to ICF.
7896         * gold.cc (queue_middle_gc_tasks): Create a dummy blocker if
7897         there are no regular objects in input.
7898
7899 2010-04-13  Doug Kwan  <dougkwan@google.com>
7900
7901         * arm.cc (Arm_input_section::set_final_data_size): Compute
7902         accurate final data size instead of using current data size.
7903
7904 2010-04-09  Doug Kwan  <dougkwan@google.com>
7905
7906         * layout.cc (Layout::choose_output_section): Handle script section
7907         types.
7908         (Layout::make_output_section_for_script): Add section type parameter.
7909         Handle script section types.
7910         * layout.h (Layout::make_output_section_for_script): Add section
7911         type parameter.
7912         * output.cc (Output_section::Output_section): Initialize data member
7913         is_noload_.
7914         (Output_section::do_reset_address_and_file_offset): Do not set address
7915         to 0 if section is a NOLOAD section.
7916         * output.h (Output_section::is_noload): New method.
7917         (Output_section::set_is_noload): Ditto.
7918         (Output_section::is_noload_): New data member.
7919         * script-c.h (Script_section_type): New enum type.
7920         (struct Parser_output_section_header): Add new file section_type.
7921         * script-sections.cc (Sections_element::output_section_name): Add
7922         parameter for returning script section type.
7923         (Output_section_definition::output_section_name): Ditto.
7924         (Output_section_definition::section_type)P; New method.
7925         (Output_section_definiton::script_section_type_name): Ditto.
7926         (Output_section_definition::script_section_type_): New data member.
7927         (Output_section_definition::Output_section_definition): Initialize
7928         data member Output_section_definition::script_section_type_.
7929         (Output_section_definition::create_sections): Pass script section type
7930         to Layout::make_output_section_for_script.
7931         (Output_section_definition::output_section_name): Return script
7932         section type to caller.
7933         (Output_section_definition::set_section_address): Do not advance
7934         dot value and load address if section type is NOLOAD.  Set address
7935         of NOLOAD sections regardless of section flags.
7936         (Output_section_definition::print): Print section type if it is
7937         not SCRIPT_SECTION_TYPE_NONE.
7938         (Output_section_definition::section_type): New method.
7939         (Output_section_definition::script_section_type_name): Ditto.
7940         (Script_sections::output_section_name): Add new parameter
7941         PSECTION_TYPE for returning script section type.  Pass it to
7942         section elements.  Handle discard sections.
7943         (Sort_output_sections::operator()): Handle NOLOAD sections.
7944         * script-sections.h (Script_sections::Section_type): New enum type.
7945         (Script_sections::output_section_name): Add a new parameter for
7946         returning script section type.
7947         * script.cc (script_keyword_parsecodes): Add keywords COPY, DSECT,
7948         INFO and NOLOAD.
7949         * yyscript.y (union): Add new field SECTION_TYPE.
7950         (COPY, DSECT, INFO, NOLOAD): New tokens.
7951         (opt_address_and_section_type): Change type to output_section_header.
7952         (section_type): New non-terminal
7953         (section_header): Handle section type.
7954         (opt_address_and_section_type): Return section type value.
7955
7956 2010-04-09  H.J. Lu  <hongjiu.lu@intel.com>
7957
7958         * testsuite/plugin_common_test_1.c (foo): Add prototype.
7959         * testsuite/plugin_common_test_2.c (foo): Likewise.
7960
7961 2010-04-08  Doug Kwan  <dougkwan@google.com>
7962
7963         * merge.cc (Output_merge_data::set_final_data_size): Handle empty
7964         Output_merge_data.
7965         * output.cc (Output_section::add_merge_input_section): Simplify
7966         code and return status of Output_merge_base::add_input_section.
7967         Update merge section map only if Output_merge_base::add_input_section
7968         returns true.
7969
7970 2010-04-07  Doug Kwan  <dougkwan@google.com>
7971
7972         * arm.cc (Arm_relobj::scan_section_for_cortex_a8_erratum): Warn
7973         if section is marked as containing instructions but has no mapping
7974         symbols.
7975         (Arm_relobj::do_count_local_symbols): Call adjust_sym_shndx to get
7976         correct section index.
7977         (Arm_relobj::find_linked_text_section): Ditto.
7978
7979 2010-04-07  Cary Coutant  <ccoutant@google.com>
7980
7981         * archive.cc (include_member): Destroy Read_symbols_data object before
7982         releasing file.
7983         * object.cc (Read_symbols_data::~Read_symbols_data) New destructor.
7984         * object.h (Read_symbols_data::Read_symbols_data) New constructor.
7985         (Read_symbols_data::~Read_symbols_data) New destructor.
7986         (Section_relocs::Section_relocs) New constructor.
7987         (Section_relocs::~Section_relocs) New destructor.
7988         (Read_relocs_data::Read_relocs_data) New constructor.
7989         (Read_relocs_data::~Read_relocs_data) New destructor.
7990         * testsuite/binary_unittest.cc (Sized_binary_test): Set sd member
7991         pointers to NULL after deleting.
7992
7993 2010-04-07  Doug Kwan  <dougkwan@google.com>
7994
7995         * arm.cc: Replace "endianity" with "endianness" in comments.
7996         (Arm_exidx_cantunwind): Ditto.
7997         (Arm_relobj::Arm_relobj): Initialize merge_flags_and_attribures.
7998         (Arm_relobj::merge_flags_and_attributes): New method.
7999         (Arm_relobj::merge_flags_and_attributes_): New data member.
8000         (Arm_exidx_cantunwind::do_fixed_endian_write): Fix formatting.
8001         (Arm_relobj::scan_sections_for_stubs): Ditto.
8002         (Arm_relobj::do_read_symbols): Check to see if we really want to
8003         merge processor-specific flags and attributes.  Exit early if
8004         an object is empty except for section names and the undefined symbol.
8005         (Target_arm::do_finalize_sections): Move check for ELF format to
8006         Arm_relobj::do_read_symbols.  Merge processor specific flags and
8007         attributes from a regular object only when we have determined that
8008         it is aapropriate.  Do not create an .ARM.attributes section in
8009         output if there is no regular input object.
8010         (Target_arm::merge_processor_specific_flags): Check
8011         --warn-mismatch before printing any error.
8012         (Target_arm::merge_object_attributes): Ditto.
8013         * gold.cc (queue_middle_tasks): Handle the case in which there is
8014         no regular object in input.
8015         * options.cc (General_options::parse_EB): New method.
8016         (General_options::parse_EL): Same.
8017         (General_options::General_options): Initialize endianness_.
8018         * options.h (-EB, -EL, -no-pipeline-knowledge, -p, --warn-mismatch):
8019         New options.
8020         (General_options::Endianness): New enum.
8021         (General_options::endianness): New method.
8022         (General_options::endianness_): New data member.
8023         * parameters.cc (Parameters::set_options): Check target endianness.
8024         (Parameters::set_target_once): Ditto.
8025         (Parameters::check_target_endianness): New method.
8026         (parameters_force_valid_target): If either -EL or -EB is specified,
8027         use it to define endianness of default target.
8028         * parameters.h (Parameters::check_target_endianness): New method
8029         declaration.
8030         * target.h (class Target): Change "endianity" to "endianness"
8031         in comments.
8032
8033 2010-04-07  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
8034
8035         * configure.ac (AM_INIT_AUTOMAKE): Add option no-dist.
8036         * configure: Regenerate.
8037         * Makefile.in: Regenerate.
8038         * testsuite/Makefile.in: Regenerate.
8039
8040 2010-04-06  Cary Coutant  <ccoutant@google.com>
8041
8042         gcc PR lto/42757
8043         * plugin.cc (Pluginobj::get_symbol_resolution_info): Check for
8044         prevailing definitions of common symbols.
8045         * testsuite/plugin_test_6.sh: New test case.
8046         * testsuite/plugin_common_test_1.c: New test case.
8047         * testsuite/plugin_common_test_2.c: New test case.
8048         * testsuite/Makefile.am (plugin_test_6): New test case.
8049         * testsuite/Makefile.in: Regenerate.
8050
8051 2010-04-06  Nick Clifton  <nickc@redhat.com>
8052
8053         * po/vi.po: New Vietnamese translation.
8054
8055 2010-03-30  Doug Kwan  <dougkwan@google.com>
8056
8057         * arm.cc (Target_arm::using_thumb_only): Handle v6-M
8058
8059 2010-03-25  Doug Kwan  <dougkwan@google.com>
8060
8061         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Rearrange code
8062         to avoid a conversion warning on a 32-bit host.
8063
8064 2010-03-24  Ian Lance Taylor  <iant@google.com>
8065
8066         * testsuite/script_test_3.t: Add a TLS segment.
8067         * testsuite/Makefile.am (check_PROGRAMS): Add
8068         tls_phdrs_script_test.
8069         (tls_phdrs_script_test_SOURCES): Define.
8070         (tls_phdrs_script_test_DEPENDENCIES): Define.
8071         (tls_phdrs_script_test_LDFLAGS): Define.
8072         (tls_phdrs_script_test_LDADD): Define.
8073         * testsuite/Makefile.in: Rebuild.
8074
8075 2010-03-23  Cary Coutant  <ccoutant@google.com>
8076
8077         * fileread.cc (find_or_make_view): Fix comment.
8078
8079 2010-03-23  Ian Lance Taylor  <iant@google.com>
8080
8081         * script-sections.cc (class Orphan_section_placement): Define
8082         PLACE_TLS and PLACE_TLS_BSS.
8083         (Orphan_section_placement::Orphan_section_placement): Initialize
8084         new places.
8085         (Orphan_section_placement::find_place): Handle SHF_TLS sections.
8086         * testsuite/Makefile.am (check_PROGRAMS): Add tls_script_test.
8087         (tls_script_test_SOURCES): Define.
8088         (tls_script_test_DEPENDENCIES): Define.
8089         (tls_script_test_LDFLAGS): Define.
8090         (tls_script_test_LDADD): Define.
8091         * testsuite/Makefile.in: Rebuild.
8092
8093 2010-03-22  Doug Kwan  <dougkwan@google.com>
8094
8095         * arm.cc (Arm_relocate_functions::abs8,
8096         Arm_relocate_functions::abs16): Use correct check for overflow
8097         specified in the ARM ELF specs.
8098         (Arm_relocate_functions): thumb_branch_common.  Handle bit 1 of branch
8099         target of a BLX instruction specially.
8100         (Reloc_stub::stub_type_for_reloc): Ditto.
8101         (Relocate::relocate): Use symbolic names instead of numeric relocation
8102         codes to report error.
8103         (Target_arm::do_relox): Reduce default stub-group size for Cortex-A8
8104         workaround.
8105         * testsuite/Makefile.am (check_DATA): add thumb_blx_in_range.stdout,
8106         thumb_blx_out_of_range.stdout, thumb2_blx_in_range.stdout and
8107         thumb2_blx_out_of_range.stdout
8108         (thumb_bl_out_of_range, thumb_bl_out_of_range.o,
8109         thumb2_bl_out_of_range, thumb2_bl_out_of_range.o): Fix dependenices.
8110         (thumb_blx_in_range.stdout, thumb_blx_in_range, thumb_blx_in_range.o,
8111         thumb_blx_out_of_range.stdout, thumb_blx_out_of_range,
8112         thumb_blx_out_of_range.o, thumb2_blx_in_range.stdout,
8113         thumb2_blx_in_range, thumb2_blx_in_range.o,
8114         thumb2_blx_out_of_range.stdout, thumb2_blx_out_of_range,
8115         thumb2_blx_out_of_range.o): New rules.
8116         (MOSTLYCLEANFILES): Add thumb_blx_in_range, thumb_blx_out_of_range,
8117         thumb2_blx_in_range and thumb2_blx_out_of_range.
8118         * testsuite/Makefile.in: Regenerate.
8119         * arm_branch_in_range.sh: Add tests for THUMB BLX.
8120         * testsuite/thumb_blx_in_range.s: New file.
8121         * testsuite/thumb_blx_out_of_range.s: New file.
8122
8123 2010-03-22  Rafael Espindola  <espindola@google.com>
8124
8125         * archive.cc (Should_include): Move to archive.h.
8126         (should_include_member): Make it a member of Archive.
8127         (Lib_group): New.
8128         (Add_lib_group_symbols): New.
8129         * archive.h: Include options.h.
8130         (Archive_member): Moved from Archive.
8131         (Should_include): Moved from archive.cc.
8132         (Lib_group): New.
8133         (Add_lib_group_symbols): New.
8134         * dynobj.cc (do_should_include_member): New.
8135         * dynobj.h (do_should_include_member): New.
8136         * gold.cc (queue_initial_tasks): Update call to queue.
8137         * main.cc (main): Print lib group stats.
8138         * object.cc (do_should_include_member): New.
8139         * object.h: Include archive.h.
8140         (Object::should_include_member): New.
8141         (Object::do_should_include_member): New.
8142         (Sized_relobj::do_should_include_member): New.
8143         * options.cc (General_options::parse_start_lib): New.
8144         (General_options::parse_end_lib): New.
8145         (Input_arguments::add_file): Handle lib groups.
8146         (Input_arguments::start_group): Check we are not in a lib.
8147         (Input_arguments::start_lib): New.
8148         (Input_arguments::end_lib): New.
8149         * options.h (General_options): Add start_lib and end_lib.
8150         (Input_argument::lib_): New.
8151         (Input_argument::lib): New.
8152         (Input_argument::is_lib): New.
8153         (Input_file_lib): New.
8154         (Input_arguments::in_lib_): New.
8155         (Input_arguments::in_lib): New.
8156         (Input_arguments::start_lib): New.
8157         (Input_arguments::end_lib_): New.
8158         * plugin.cc (Pluginobj::get_symbol_resolution_info): Mark symbols
8159         in unused members as preempted.
8160         (Sized_pluginobj::do_should_include_member): New.
8161         * plugin.h (Sized_pluginobj::do_should_include_member): New.
8162         * readsyms.cc (Read_symbols::locks): If we are just reading a member,
8163         return the blocker.
8164         (Read_symbols::do_whole_lib_group): New.
8165         (Read_symbols::do_lib_group): New.
8166         (Read_symbols::do_read_symbols): Handle lib groups.
8167         (Read_symbols::get_name): Handle lib groups.
8168         * readsyms.h (Read_symbols): Add an archive member pointer.
8169         (Read_symbols::do_whole_lib_group): New.
8170         (Read_symbols::do_lib_group): New.
8171         (Read_symbols::member_): New.
8172         * script.cc (read_input_script): Update call to queue_soon.
8173
8174 2010-03-19  Doug Kwan  <dougkwan@google.com>
8175
8176         * arm.cc (Stub_table::Stub_table): Initialize new data members
8177         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8178         (Stub_table::add_reloc_stub): Assign stub offset and update
8179         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_.
8180         (Stub_table::reloc_stubs_size_, Stub_table::reloc_stubs_addralign_):
8181         New data members.
8182         (Stub_table::update_data_size_and_addralign): Use
8183         Stub_table::reloc_stubs_size_ and Stub_table::reloc_stubs_addralign_
8184         instead of going over all reloc stubs.
8185         (Stub_table::finalize_stubs): Do not assign reloc stub offsets.
8186         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8187         Stringpool_template::offset_ to size of Stringpool_char.
8188         (Stringpool_template::new_key_offset): Remove code to initialize
8189         Stringpool_template::offset_.
8190         * stringpool.h (Stringpool_template::set_no_zero_null): Set
8191         Stringpool_template::offset_ to zero.
8192
8193 2010-03-15  Doug Kwan  <dougkwan@google.com>
8194
8195         * stringpool.cc (Stringpool_template::Stringpool_template): Initialize
8196         offset_.
8197         (Stringpool_template::new_key_offset): New method.
8198         (Stringpool_template::add_string): Assign offsets when adding new
8199         strings.
8200         (Stringpool_template::set_string_offsets): Do not set string offsets
8201         when not optimizing.
8202         * stringpool.h (Chunked_vector::Chunked_vector): Initialize data
8203         member size_.
8204         (Chunked_vector::clear): Clear size_.
8205         (Chunked_vector::reserve): Call reserve method of all Element_vectors.
8206         (Chunked_vector::size): Return size_.
8207         (Chunked_vector::push_back): Use size_ to find insert position.
8208         (Chunked_vector::size_): New data member.
8209         (Stringpool_template::set_no_zero_null): Assert string set is empty.
8210         (Stringpool_template::new_key_offset): New method declaration.
8211         (Stringpool_template::offset_): New data member.
8212
8213 2010-03-15   Rafael Espindola  <espindola@google.com>
8214
8215         * readsyms.cc (Read_symbols::do_read_symbols): Update calls to
8216         Add_symbols' constructor.
8217         * readsyms.h (Add_symbols): Remove the input_group member.
8218
8219 2010-03-10  Ian Lance Taylor  <iant@google.com>
8220
8221         * reloc.cc (Sized_relobj::split_stack_adjust_reltype): Call the
8222         target to ask whether a reference to a symbol requires a stack
8223         split.
8224         * target.h (Target::is_call_to_non_split): New function.
8225         (Target::do_is_call_to_non_split): Declare virtual function.
8226         * target.cc: Include "symtab.h".
8227         (Target::do_is_call_to_non_split): New function.
8228         * i386.cc (Target_i386::do_is_call_to_non_split): New function.
8229
8230 2010-03-10  Cary Coutant  <ccoutant@google.com>
8231
8232         * fileread.cc (File_read::~File_read): Don't delete whole_file_view_.
8233         (File_read::open[1]): Remove initial mapping of whole_file_view_.
8234         (File_read::open[2]): Add whole_file_view_ to list of views.
8235         (File_read::make_view): Remove test of whole_file_view_.
8236         (File_read::find_or_make_view): Create whole_file_view_ if
8237         necessary.
8238         (File_read::clear_views): Replace bool parameter with enum;
8239         adjust all callers.  Don't delete views with permanent data;
8240         do delete cached views and views from archives if
8241         --no-keep-files-mapped is set.  Set whole_file_view_ to NULL
8242         if clearing the corresponding view.
8243         * fileread.h (File_read::Clear_views_mode): New enum.
8244         (File_read::View::is_permanent_view): New method.
8245         (File_read::clear_views): Replace bool parameter
8246         with enum; adjust all callers.
8247         * options.h (General_options): Change keep_files_mapped option;
8248         add map_whole_files.
8249         * readsyms.cc (Add_symbols::run): Delete sd_ object before
8250         releasing the file.
8251         * reloc.cc (Scan_relocs::run): Delete rd_ object before releasing
8252         the file.
8253
8254 2010-03-10  David S. Miller  <davem@davemloft.net>
8255
8256         * sparc.cc (Target_sparc::Scan::local): Accept R_SPARC_WPLT30.
8257
8258 2010-03-09  Sriraman Tallam  <tmsriram@google.com>
8259
8260         * icf.cc (get_section_contents): Add '@' marker after processing the
8261         merge reloc.
8262
8263 2010-03-08  Doug Kwan  <dougkwan@google.com>
8264
8265         * gold/arm.cc (Arm_exidx_fixup::update_offset_map): Fix build breakage
8266         due to a conversion warning.
8267         (Arm_relobj::update_output_local_symbol_count): Check for local
8268         symbol with unset output index.
8269
8270 2010-03-05  Ian Lance Taylor  <iant@google.com>
8271
8272         * options.h (class General_options): Add --spare-dynamic-tags.
8273         * output.cc (Output_data_dynamic::set_final_data_size): Implement
8274         --spare-dynamic-tags.
8275
8276 2010-03-05  Ian Lance Taylor  <iant@google.com>
8277
8278         * incremental.cc: Include "libiberty.h".
8279
8280 2010-03-05  Rainer Orth  <ro@CeBiTec.Uni-Bielefeld.DE>
8281
8282         * dynobj.h (Verdef::Verdef): Add is_info arg, is_info member
8283         function, is_info_ member.
8284         * dynobj.cc (Verdef::write): Set VER_FLG_INFO if this->is_info_.
8285         (Versions::Versions): Update caller.
8286         (Versions::define_base_version): Likewise.
8287         (Versions::add_def): Likewise.
8288
8289 2010-03-03  Sriraman Tallam  <tmsriram@google.com>
8290
8291         * i386.cc (Target_i386::can_check_for_function_pointers): New function.
8292         (Scan::possible_function_pointer_reloc): New function.
8293         (Scan::local_reloc_may_be_function_pointer): Change to call
8294         possible_function_pointer_reloc.
8295         (Scan::global_reloc_may_be_function_pointer): Ditto.
8296         * icf.h (Icf::check_section_for_function_pointers): Change to reject
8297         relocations in ".data.rel.ro._ZTV" section.
8298         * testsuite/icf_safe_so_test.sh: Change to pass i386.
8299         * testsuite/icf_safe_so_test.cc: Ditto.
8300         * testsuite/icf_safe_test.cc: Ditto.
8301         * testsuite/icf_safe_test.sh: Ditto.
8302
8303 2010-03-03  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8304             Ian Lance Taylor  <iant@google.com>
8305
8306         * target-reloc.h (relocate_section): Check the symbol table index
8307         for -1U before setting the local symbol index.
8308         (scan_relocatable_relocs): If copying the relocation, record that
8309         the local symbol is required.
8310         * object.h (Symbol_value::is_output_symtab_index_set): New
8311         function.
8312         (Symbol_value::may_be_discarded_from_output_symtab): New
8313         function.
8314         (Symbol_value::has_output_symtab_entry): New function.
8315         (Symbol_value::needs_output_symtab_entry): Remove.
8316         (Symbol_value::output_symtab_index): Make sure the symbol index is
8317         set.
8318         (Symbol_value::set_output_symtab_index): Make sure the symbol
8319         index is not set.  Make sure the new index is valid.
8320         (Symbol_value::set_must_have_output_symtab_entry): New function.
8321         (Symbol_value::has_output_dynsym_entry): New function.
8322         (Symbol_value::set_output_dynsym_index): Make sure the new index
8323         is valid.
8324         (Sized_relobj::set_must_have_output_symtab_entry): New function.
8325         * object.cc (Sized_relobj::do_count_local_symbols): Only discard a
8326         local symbol if permitted.
8327         (Sized_relobj::do_finalize_local_symbols): Call
8328         is_output_symtab_index_set rather than needs_output_symtab_entry.
8329         (Sized_relobj::write_local_symbols): Call has_output_symtab_entry
8330         rather than needs_output_symtab_entry.  Call
8331         has_output_dynsym_entry rather than needs_output_dynsym_entry.
8332         * arm.cc (Arm_relobj::update_output_local_symbol_count): Call
8333         is_output_symtab_index_set rather than needs_output_symtab_entry.
8334         * testsuite/discard_locals_relocatable_test.c: New file.
8335         * testsuite/discard_locals_test.sh: Test -r.
8336         * testsuite/Makefile.am (check_DATA): Add
8337         discard_locals_relocatable_test1.syms,
8338         discard_local_relocatable_test2.syms.
8339         (MOSTLYCLEANFILES): Likewise.  Also add
8340         discard_locals_relocatable_test1.lout and
8341         discard_locals_relocatable_test2.out.
8342         (discard_locals_relocatable_test1.syms): New target.
8343         (discard_locals_relocatable_test.o): New target.
8344         (discard_locals_relocatable_test1.out): New target.
8345         (discard_locals_relocatable_test2.syms): New target.
8346         (discard_locals_relocatable_test2.out): New target.
8347         (various): Add missing ../ld-new dependencies.
8348         * testsuite/Makefile.in: Rebuild.
8349
8350 2010-03-03  Nick Clifton  <nickc@redhat.com>
8351
8352         * po/fi.po: New Finnish translation.
8353
8354 2010-03-01  Doug Kwan  <dougkwan@google.com>
8355
8356         * layout.cc (Layout::Layout): Force section types of .init_array*,
8357         .preinit_array* and .fini_array* sections.
8358         * output.cc (Output_section::Input_section_sort_entry::has_priority):
8359         Fix check of return value of std::string::find.().
8360         (Output_section::Input_section_sort_compare::operator()): Remove
8361         comment about .init_array.
8362         (Output_section::Input_section_sort_init_fini_compare::operator()):
8363         New method.
8364         (Output_section::sort_attached_input_sections): Handle .init_array
8365         and .fini_array specially.
8366         * output.h (Output_section::Inut_section_sort_compare): Update
8367         comment.
8368         (Output_section::Input_section_sort_init_fini_compare): New struct.
8369
8370 2010-02-26  Doug Kwan  <dougkwan@google.com>
8371
8372         * arm.cc (Target_arm::Relocate::reloc_is_non_pic): Treat
8373         R_ARM_PREL31 and R_ARM_SBREL31 as position independent.
8374         * testsuite/debug_msg.sh: Avoid matching source line number for
8375         use of global variable undef_int.
8376
8377 2010-02-26  Doug Kwan  <dougkwan@google.com>
8378
8379         * arm.cc (Target_arm::scan_reloc_for_stub): Move code handling
8380         R_ARM_V4BX to Target_arm::scan_reloc_section_for_stubs.
8381         (Target_arm::scan_reloc_section_for_stubs): Instead of calling
8382         scan_reloc_for_stub, do all processing of R_ARM_V4BX here.
8383         * options.cc (General_options::General_options): Initialize member
8384         fix_v4bx_.
8385         * testsuite/Makefile.am (check_SCRIPTS): Add arm_fix_v4bx.sh
8386         (check_DATA): Add arm_fix_v4bx.stdout, arm_fix_v4bx_interworking.stdout
8387         and rm_no_fix_v4bx.stdout
8388         (arm_fix_v4bx.stdout, arm_fix_v4bx, arm_fix_v4bx.o,
8389         arm_fix_v4bx_interworking.stdout, arm_fix_v4bx_interworking,
8390         arm_no_fix_v4bx.stdout, arm_no_fix_v4bx): New make rules.
8391         (MOSTLYCLEANFILES): Add arm_fix_v4bx, arm_fix_v4bx_interworking
8392         and arm_no_fix_v4bx.
8393         * Makefile.in: Regenerate.
8394         * testsuite/arm_fix_v4bx.s: New file.
8395         * testsuite/arm_fix_v4bx.sh: Ditto.
8396
8397 2010-02-24  Doug Kwan  <dougkwan@google.com>
8398
8399         * arm.cc (Target_arm::got_section): Make the .got section the first
8400         non RELRO section in the data segment.
8401         * testsuite/script_test_5.sh: Fix match patterns to avoid matching
8402         suffixes of section names.
8403
8404 2010-02-24  Doug Kwan  <dougkwan@google.com>
8405
8406         * arm.cc (Target_arm::do_finalize_sections): Skip processor specific
8407         flags and attributes merging if an input file is a binary file.
8408         * fileread.cc (Input_file::open): Record format of original file.
8409         * fileread.h (Input_file::Format): New enum type.
8410         (Input_file::Input_file): Initialize data member format_.
8411         (Input_file::format): New method definition.
8412         (Input_file::format_):: New data member.
8413
8414 2010-02-24  Doug Kwan  <dougkwan@google.com>
8415
8416         * arm.cc (Arm_output_data_got): New class.
8417         (ARM_TCB_SIZE): New constant
8418         (Target_arm): Use Arm_output_data_got instead of Output_data_got.
8419         (Arm_output_section::fix_exidx_coverage): Add a parameter for layout.
8420         If user uses a script with a SECTIONS clause, issue only a warning
8421         for a misplaced EXIDX input section.  Otherwise, issue an error.
8422         (Arm_relobj::do_gc_process_relocs): Exit early if we are not doing
8423         garbage collection.
8424         (Target_arm::got_mode_index_entry): Handle static linking.
8425         (Target_arm::Scan::local): Ditto.
8426         (Target_arm::Scan::global): Ditto.
8427         (Target_arm::Relocate::relocate_tls): Handle static linking.  Fix
8428         all incorrectly implemented relocations.
8429         (Target_arm::fix_exidx_coverage): Pass layout to
8430         Arm_output_section::fix_exidx_coverage.
8431         * layout.cc (Layout::section_name_mapping): Remove trailing dots
8432         from ".ARM.exidx." and ".ARM.extab.".
8433
8434 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8435
8436         * arm.cc (Target_arm::do_finalize_sections): Create attribute
8437         section if it does not already exist.
8438         * attributes.cc (Attributes_section_data::Attributes_section_data):
8439         Don't crash if size is zero.
8440
8441 2010-02-23  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8442             Ian Lance Taylor  <iant@google.com>
8443
8444         * gold.cc (queue_middle_tasks): If no input files were opened,
8445         exit.
8446         * workqueue.h (Task_function::Task_function): Assert that there is
8447         a blocker.
8448
8449 2010-02-22  Doug Kwan  <dougkwan@google.com>
8450
8451         * gold-threads.h (Once::~Once): Explicitly define virtual destructor.
8452         * icf.cc (get_section_contents): Cast snprintf arguments to long long
8453         types to avoid warnings due to different uint64_t implementations
8454         on different hosts.
8455
8456 2010-02-21  Doug Kwan  <dougkwan@google.com>
8457
8458         * arm.cc (Arm_relocate_functions::arm_branch_common): Fix bug in
8459         handling of the maximum backward branch offset.
8460         (Arm_relocate_functions::thumb_branch_common): Ditto.
8461         * testsuite/Makefile.am (check_SCRIPTS): Add arm_branch_in_range.sh.
8462         (check_DATA): Add arm_bl_in_range.stdout, arm_bl_out_of_range.stdout
8463         thumb_bl_in_range.stdout, thumb_bl_out_of_range.stdout,
8464         thumb2_bl_in_range.stdout and thumb2_bl_out_of_range.stdout.
8465         (arm_bl_in_range.stdout, arm_bl_in_range, arm_bl_in_range.o,
8466         arm_bl_out_of_range.stdout, arm_bl_out_of_range,
8467         arm_bl_out_of_range.o, thumb_bl_in_range.stdout, thumb_bl_in_range,
8468         thumb_bl_in_range.o, thumb_bl_out_of_range.stdout,
8469         thumb_bl_out_of_range thumb_bl_out_of_range.o,
8470         thumb2_bl_in_range.stdout, thumb2_bl_in_range, thumb2_bl_in_range.o
8471         thumb2_bl_out_of_range.stdout, thumb2_bl_out_of_range,
8472         thumb2_bl_out_of_range.o): New rules.
8473         (MOSTLYCLEANFILES): Add arm_bl_in_range, arm_bl_out_of_range,
8474         thumb_bl_in_range, thumb_bl_out_of_range, thumb2_bl_in_range and
8475         thumb2_bl_out_of_range
8476         * testsuite/Makefile.in: Regenerate.
8477         * testsuite/arm_bl_in_range.s: New file.
8478         * testsuite/arm_bl_out_of_range.s: Ditto.
8479         * testsuite/arm_branch_in_range.sh: Ditto.
8480         * testsuite/arm_branch_range.t: Ditto.
8481         * testsuite/thumb2_branch_range.t: Ditto.
8482         * testsuite/thumb_bl_in_range.s: Ditto.
8483         * testsuite/thumb_bl_out_of_range.s: Ditto.
8484         * testsuite/thumb_branch_range.t: Ditto.
8485
8486 2010-02-20  Sriraman Tallam  <tmsriram@google.com>
8487
8488         * gc.h (gc_process_relocs): Change vectors to point to the new list.
8489         Add reloc offset information.
8490         * icf.cc (get_section_contents): Change iterators to point to the new
8491         vectors. Add reloc offset information to the contents.
8492         * icf.h (Icf::Sections_reachable_info): New typedef.
8493         (Icf::Sections_reachable_list): New typedef.
8494         (Icf::Offset_info): New typedef.
8495         (Icf::Reloc_info): New struct typedef.
8496         (Icf::Reloc_info_list): New typedef.
8497         (Icf::symbol_reloc_list): Delete method.
8498         (Icf::addend_reloc_list): Delete method.
8499         (Icf::section_reloc_list): Delete method.
8500         (Icf::reloc_info_list): New method.
8501         (Icf::reloc_info_list_): New member.
8502
8503 2010-02-19  Doug Kwan  <dougkwan@google.com>
8504
8505         * arm-reloc.def: Mark R_ARM_TLS_GD32, R_ARM_TLS_LDM32,
8506         R_ARM_TLS_LDO32, R_ARM_TLS_IE32 and R_ARM_TLS_LE32 are implemented.
8507         * arm.cc (Arm_relocation_functions): New forward declaration.
8508         (Target_arm::Target_arm): Initialize new data members
8509         got_mod_index_offset_ and tls_base_symbol_defined_.
8510         (Target_arm::Relocate::relocate_tls): New method.
8511         (Target_arm::optimize_tls_reloc, Target_arm::define_tls_base_symbol,
8512          Target_arm::got_mod_index_entry, Target_arm::rel_tls_desc_section):
8513         New methods.
8514         (Target_arm::Got_type): Add GOT_TYPE_TLS_NOFFSET, GOT_TYPE_OFFSET,
8515         GOT_TYPE_TLS_PAIR and GOT_TYPE_TLS_DESC.
8516         (Target_arm::got_mod_index_offset_,
8517         Target_arm::tls_base_symbol_defined_): New data members.
8518         (Target_arm::Scan::local, Target::Scan::global,
8519         Target_arm::Relocate::relocate): Handle 32-bit initial TLS
8520         relocations.
8521
8522 2010-02-18  Doug Kwan  <dougkwan@google.com>
8523
8524         * arm.cc (Arm_relobj::find_linked_text_section): New method.
8525         (Arm_relobj::make_exidx_input_section): Pass section index of linked
8526         text section as a parameter becuase some broken tools may not set
8527         the link in section header.
8528         (Target_arm::has_got_section): New method.
8529         (Target_arm::scan_section_for_cortex_a8_stubs): Treat an input section
8530         without any mapping symbol as data only.  Remove warning.
8531         (Arm_relobj::do_read_synbols): If an EXIDX input section has no
8532         link in its section header, try to discover the link by inspecting the
8533         REL31 relocation at the beginning of the section.
8534         (Target_arm::Scan::check_non_pic): Report name of offending relocation
8535         in error message.
8536         (Target_arm::Scan::global): Treat any reference to the symbol
8537         _GLOBAL_OFFSET_TABLE_ as a GOT access.
8538
8539 2010-02-12  Sriraman Tallam  <tmsriram@google.com>
8540
8541         * arm.cc (Scan::local_reloc_may_be_function_pointer): New function.
8542         (Scan::global_reloc_may_be_function_pointer): New function.
8543         * sparc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8544         (Scan::global_reloc_may_be_function_pointer): New function.
8545         * powerpc.cc (Scan::local_reloc_may_be_function_pointer): New function.
8546         (Scan::global_reloc_may_be_function_pointer): New function.
8547         * i386.cc (Scan::local_reloc_may_be_function_pointer): New function.
8548         (Scan::global_reloc_may_be_function_pointer): New function.
8549         * x86_64.cc (Scan::local_reloc_may_be_function_pointer): New function.
8550         (Scan::global_reloc_may_be_function_pointer): New function.
8551         (Scan::possible_function_pointer_reloc): New function.
8552         (Target_x86_64::can_check_for_function_pointers): New function.
8553         * gc.h (gc_process_relocs): Scan relocation types to determine if
8554         function pointers were taken for targets that support it.
8555         * icf.cc (Icf::find_identical_sections): Include functions for
8556         folding in safe ICF whose pointer is not taken.
8557         * icf.h (Secn_fptr_taken_set): New typedef.
8558         (fptr_section_id_): New member.
8559         (section_has_function_pointers): New function.
8560         (set_section_has_function_pointers): New function.
8561         (check_section_for_function_pointers): New function.
8562         * options.h: Fix comment for safe ICF option.
8563         * target.h (can_check_for_function_pointers): New function.
8564         * testsuite/Makefile.am: Add icf_safe_so_test test case.
8565         Modify icf_safe_test for X86-64.
8566         * testsuite/Makefile.in: Regenerate.
8567         * testsuite/icf_safe_so_test.cc: New file.
8568         * testsuite/icf_safe_so_test.sh: New file.
8569         * testsuite/icf_safe_test.cc (kept_func_3): New function.
8570         (main): Change to take pointer to function kept_func_3.
8571         * testsuite/icf_safe_test.sh (arch_specific_safe_fold): Check if safe
8572         folding is done correctly for X86-64.
8573
8574 2010-02-12  David S. Miller  <davem@davemloft.net>
8575
8576         * output.h (Output_reloc<SHT_REL>::Output_reloc): Add
8577         is_symbolless parameter.
8578         (Output_reloc<SHT_REL>::is_symbolless): New.
8579         (Output_reloc<SHT_REL>::is_symbolless_): New.
8580         (Output_reloc<SHT_REL>::type_): Decrease to 29 bits.
8581         (Output_reloc<SHT_RELA>::Output_reloc): Add is_symbolless parameter.
8582         (Output_reloc<SHT_RELA>::is_symbolless): New.
8583         (Output_data_reloc::add_global): Handle is_symbolless.
8584         (Output_data_reloc::add_global_relative): Likewise.
8585         (Output_data_reloc::add_local): Likewise.
8586         (Output_data_reloc::add_local_relative): Likewise.
8587         (Output_data_reloc::add_symbolless_global_addend): New.
8588         (Output_data_reloc::add_symbolless_local_addend): New.
8589         * output.cc (Output_reloc<SHT_REL>::Output_reloc): Handle
8590         is_symbolless.
8591         (Output_reloc::set_needs_dynsym_index): Test ->is_symbolless_
8592         instead of ->is_relative_
8593         (Output_reloc::write): Likewise.
8594         (Output_reloc::get_symbol_index): Return 0 when ->is_symbolless_
8595         (Output_reloc::write_rel): Simplify.
8596
8597         * sparc.cc (Target_sparc::Scan::local): Use
8598         ->add_symbolless_local_addend as needed.
8599         (Target_sparc::Scan::global): Use ->add_symbolless_global_addend as
8600         needed.  Also, emit appropriate unaligned vs. aligned dynamic reloc
8601         based upon relocation offset.
8602
8603 2010-02-11  Doug Kwan  <dougkwan@google.com>
8604
8605         * arm.cc (Target_arm::Scan::local): Fix bugs in relocation handling.
8606         (Target_arm::Scan::global): Ditto.  Also remove a comment before the
8607         beginning of function.
8608         (Target_arm::Relocate::relocate): Remove error messages for MOVW_ABS
8609         and MOVT_ABS relocations.  Those are non issued in scanning.  Fix
8610         parameter is_32bit in calls to should_apply_static_reloc.
8611         * testsuite/Makefile.am (check_SCRIPTS): Add arm_abs_global.sh.
8612         (check_DATA): Add arm_abs_global.stdout.
8613         (arm_abs_lib.o, libarm_abs.so, arm_abs_global.o, arm_abs_global,
8614         arm_abs_global.stdout): New rules.
8615         (MOSTLLYCLEANFILES): Add arm_abs_global
8616         * Makefile.in: Regenerate.
8617         * testsuite/arm_abs_global.s: New file.
8618         * testsuite/arm_abs_global.sh: Ditto.
8619         * testsuite/arm_abs_lib.s: Ditto.
8620
8621 2010-02-11  Ian Lance Taylor  <iant@google.com>
8622
8623         * gold.cc (queue_middle_gc_tasks): Use a separate blocker for each
8624         Read_relocs task.
8625         (queue_middle_tasks): Likewise, and also for Scan_relocs.  Run
8626         Allocate_commons_task first.
8627         * reloc.cc (Read_relocs::run): Pass next_blocker_ down to next
8628         task, rather than symtab_lock_.
8629         (Gc_process_relocs::~Gc_process_relocs): New function.
8630         (Gc_process_relocs::is_runnable): Check this_blocker_.
8631         (Gc_process_relocs::locks): Use next_blocker_ rather than
8632         blocker_.
8633         (Scan_relocs::~Scan_relocs): New function.
8634         (Scan_relocs::is_runnable): Check this_blocker_ rather than
8635         symtab_lock_.
8636         (Scan_relocs::locks): Drop symtab_lock_ and blocker_.  Add
8637         next_blocker_.
8638         * reloc.h (class Read_relocs): Drop symtab_lock_ and blocker_
8639         fields.  Add this_blocker_ and next_blocker_ fields.  Adjust
8640         constructor accordingly.
8641         (class Gc_process_relocs): Likewise.
8642         (class Scan_relocs): Likewise.
8643         * common.h (class Allocate_commons_task): Remove symtab_lock_
8644         field, and corresponding constructor parameter.
8645         * common.cc (Allocate_commons_tasK::is_runnable): Remove use of
8646         symtab_lock_.
8647         (Allocate_commons_task::locks): Likewise.
8648
8649 2010-02-11  Ian Lance Taylor  <iant@google.com>
8650
8651         * gold-threads.h (class Once): Define.
8652         (class Initialize_lock): Rewrite as child of Once.
8653         * gold-threads.cc (class Once_initialize): Define.
8654         (once_pointer_control): New static variable.
8655         (once_pointer, once_arg): New static variables.
8656         (c_run_once): New static function.
8657         (Once::Once, Once::run_once, Once::internal_run): New functions.
8658         (class Initialize_lock_once): Remove.
8659         (initialize_lock_control): Remove.
8660         (initialize_lock_pointer): Remove.
8661         (initialize_lock_once): Remove.
8662         (Initialize_lock::Initialize_lock): Move to gold-threads.h.
8663         (Initialize_lock::initialize): Rewrite.
8664         (Initialize_lock::do_run_once): New function.
8665         * archive.cc (Archive::interpret_header): Only clear name if it is
8666         not already empty.
8667         * fileread.cc: Include "gold-threads.h"
8668         (file_counts_lock): New static variable.
8669         (file_counts_initialize_lock): Likewise.
8670         (File_read::release): Only increment counts when using --stats.
8671         Use a lock around the increment.
8672         * parameters.cc (class Set_parameters_target_once): Define.
8673         (set_parameters_target_once): New static variable.
8674         (Parameters::Parameters): Move here from parameters.h.
8675         (Parameters::set_target): Rewrite.
8676         (Parameters::set_target_once): New function.
8677         (Parameters::clear_target): Move here and rewrite.
8678         * parameters.h (class Parameters): Update declarations.  Add
8679         set_parameters_target_once_ field.
8680         (Parameters::Parameters): Move to parameters.cc.
8681         (Parameters::clear_target): Likewise.
8682         * readsyms.cc (Read_symbols::do_group): Create a Start_group
8683         task.
8684         (Start_group::~Start_group): New function.
8685         (Start_group::is_runnable): New function.
8686         (Start_group::locks, Start_group::run): New functions.
8687         (Finish_group::run): Change saw_undefined to size_t.
8688         * readsyms.h (class Start_group): Define.
8689         (class Finish_group): Change saw_undefined_ field to size_t.
8690         (Finish_group::Finish_group): Remove saw_undefined and
8691         this_blocker parameters.  Change all callers.
8692         (Finish_group::set_saw_undefined): New function.
8693         (Finish_group::set_blocker): New function.
8694         * symtab.h (class Symbol_table): Change saw_undefined to return
8695         size_t.  Change saw_undefined_ field to size_t.
8696         * target-select.cc (Set_target_once::do_run_once): New function.
8697         (Target_selector::Target_selector): Initialize set_target_once_
8698         field.  Don't initialize lock_ and initialize_lock_ fields.
8699         (Target_selector::instantiate_target): Rewrite.
8700         (Target_selector::set_target): New function.
8701         * target-select.h (class Set_target_once): Define.
8702         (class Target_selector): Update declarations.  Make
8703         Set_target_once a friend.  Remove lock_ and initialize_lock_
8704         fields.  Add set_target_once_ field.
8705
8706 2010-02-10  Ian Lance Taylor  <iant@google.com>
8707
8708         * dirsearch.cc (Dirsearch::initialize): Add all blockers before
8709         queueing any tasks.
8710         * gold.cc (queue_middle_gc_tasks): Likewise.  Fix final blocker.
8711         (queue_middle_tasks): Add all blockers before queueing any tasks.
8712         (queue_final_tasks): Likewise.
8713         * token.h (Task_token::add_blockers): New function.
8714         * object.h (Input_objects::number_of_relobjs): New function.
8715
8716 2010-02-10  Ian Lance Taylor  <iant@google.com>
8717
8718         * i386.cc (Relocate::relocate_tls): A local symbol is final if not
8719         shared, not if not position independent.
8720         * x86_64.cc (Relocate::relocate_tls): Likewise.
8721         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_pic_test.
8722         (tls_pie_pic_test): New target.
8723         * testsuite/Makefile.in: Rebuild.
8724
8725         * testsuite/Makefile.am (check_PROGRAMS): Add tls_pie_test.
8726         (tls_test_main_pie.o, tls_test_pie.o): New targets.
8727         (tls_test_file2_pie.o, tls_test_c_pie.o, tls_pie_test): Likewise.
8728         * testsuite/Makefile.in: Rebuild.
8729
8730 2010-02-09  David S. Miller  <davem@davemloft.net>
8731
8732         * sparc.cc (Target_sparc::Scan::local): Do not emit relocs other than
8733         R_SPARC_RELATIVE using ->add_local_relative().
8734         (Target_sparc::Scan::global): Likewise for ->add_global_relative().
8735
8736         * output.h (Output_data_dynamic::add_section_size): New method
8737         that takes two Output_data objects.
8738         (Output_data_dynamic::Dynamic_entry): Create storage for secondary
8739         entry param.  Handle it in initializers.
8740         * output.cc (Output_data_dynamic::Dynamic_entry::write): For
8741         DYNAMIC_SECTION_SIZE, add in second object size if non-NULL.
8742         * layout.h (Layout::add_target_dynamic_tags): Add dynrel_includes_plt
8743         arg.
8744         * layout.cc (Layout::add_target_dynamic_tags): If dynrel_includes_plt,
8745         and .rela.plt exists, set DT_REL{,A}SZ to sum of .rela.dyn and .rela.plt
8746         * arm.cc (Target_arm::do_finalize_sections): Update to pass false
8747         for dynrel_includes_plt.
8748         * i386.cc (Target_i386::do_finalize_sections): Likewise.
8749         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
8750         * sparc.cc (Target_sparc::make_plt_entry): Force .rela.dyn to be output
8751         before .rela.plt
8752         (Target_sparc::do_finalize_sections): Update to pass true for
8753         dynrel_includes_plt.
8754         * powerpc.cc (Target_powerpc::make_plt_entry): Force .rela.dyn to be
8755         output before .rela.plt
8756         (Target_powerpc::do_finalize_sections): Update to pass true for
8757         dynrel_includes_plt when 32-bit.
8758
8759 2010-02-08  Doug Kwan  <dougkwan@google.com>
8760
8761         * arm.cc (Arm_relobj::simple_input_section_output_address): New
8762         method.
8763         (Arm_relobj::section_needs_cortex_a8_stub_scanning,
8764         Arm_relobj::scan_section_for_cortex_a8_stubs,
8765         Arm_relobj::do_relocation_section): Instead of calling
8766         Output_section::output_address, use faster
8767         Arm_relobj::simple_input_section_output_address.
8768
8769 2010-02-08  David S. Miller  <davem@davemloft.net>
8770
8771         * sparc.cc (Target_sparc::Relocate::relocate): If relocation offset is
8772         unaligned for R_SPARC_16, R_SPARC_32, or R_SPARC_64, use the unaligned
8773         relocation helper function.
8774
8775         * sparc.cc (Target_sparc::Scan::local): Handle R_SPARC_GOTDATA_OP*
8776         just like R_SPARC_GOT{10,13,22}.
8777         (Target_sparc::Scan::local): Likewise.
8778         (Target_sparc::Relocate:relocate): Likewise.
8779
8780 2010-02-06  Ian Lance Taylor  <iant@google.com>
8781
8782         * configure.ac: Rewrite targetobjs duplicate removal code to use
8783         only shell constructs.
8784         * configure: Rebuild.
8785
8786 2010-02-05  Doug Kwan  <dougkwan@google.com>
8787
8788         PR 11247
8789         * arm.cc (Arm_relobj::section_is_scannable): New method.
8790         (Arm_relobj::section_needs_reloc_stub_scanning): Use it.
8791         (Arm_relobj::section_needs_cortex_a8_stub_scanning): Same.
8792
8793 2010-02-04  Doug Kwan  <dougkwan@google.com>
8794
8795         PR 11247
8796         * arm-reloc-property.cc (cstdio): Include.
8797         * configure.ac (targetobjs): Remove duplicates.
8798         * configure: Regenerate.
8799         * resolve.cc (Symbol_table::resolve): Explicit instantiate both
8800         big and little endian version for a given address size.
8801
8802 2010-02-03  Doug Kwan  <dougkwan@google.com>
8803
8804         * arm-reloc-property.cc
8805         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8806         definition.
8807         * arm-reloc-property.h
8808         (Arm_reloc_property_table::get_implemented_static_reloc_property):
8809         New method definition.
8810         (Arm_reloc_property_table::reloc_name_in_error_message): New method
8811         declaration.
8812         * arm-reloc.def (THM_MOVT_ABS, THM_MOVT_PREL, THM_MOVT_BREL): Change
8813         overflow to N.
8814         (GOT_PREL): Change implemented to Y.
8815         * arm.cc (Target_arm::reloc_uses_thumb_bit): Remove method.
8816         (Target_arm::Relocate::reloc_needs_sym_origin): Remove method.
8817         (Arm_relocate_functions::movw_abs_nc): Remove method.
8818         (Arm_relocate_functions::movt_abs): Ditto.
8819         (Arm_relocate_functions::thm_movw_abs_nc): Ditto.
8820         (Arm_relocate_functions::thm_movt_abs): Ditto.
8821         (Arm_relocate_functions::movw_rel_nc): Ditto.
8822         (Arm_relocate_functions::movw_rel): Ditto.
8823         (Arm_relocate_functions::movt_rel): Ditto.
8824         (Arm_relocate_functions:thm_movw_rel_nc): Ditto.
8825         (Arm_relocate_functions:thm_movw_rel): Ditto.
8826         (Arm_relocate_functions:thm_movt_rel): Ditto.
8827         (Arm_relocate_functions::movw, Arm_relocate_functions::movt,
8828         (Arm_relocate_functions::thm_movw, Arm_relocate_functions::thm_movt):
8829         New method definitions.
8830         (Arm_relocation_functions::arm_grp_alu): Add assertion for group index.
8831         (Arm_relocation_functions::arm_grp_ldr): Ditto.
8832         (Arm_relocation_functions::arm_grp_ldrs): Ditto.
8833         (Arm_relocation_functions::arm_grp_ldc): Ditto.
8834         (Target_arm::Relocate::relocate): Check for non-static or
8835         unimplemented relocation code and exit early.  Change calls to
8836         Target_arm::reloc_uses_thumb_bit and
8837         Target_arm::Reloc::reloc_needs_sym_origin to use relocation property
8838         instead.  Refactor code to handle similar relocations to increase
8839         code sharing.  Remove check for unsupported relocation code in switch
8840         statement.
8841         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Use
8842         relocation property table to find out size.  Change error message to
8843         print out the name of a relocation code instead of the numeric value.
8844         (Target_arm::scan_reloc_for_stub): Use relocation property table
8845         instead of calling Target_arm::reloc_uses_thumb_bit().
8846
8847 2010-02-02  Doug Kwan  <dougkwan@google.com>
8848
8849         * arm.cc (Target_arm::relocate_section): Do view adjustment for all
8850         types of relaxed input section.
8851
8852 2010-02-02  Doug Kwan  <dougkwan@google.com>
8853
8854         * Makefile.am (HFILES): Add arm-reloc-property.h.
8855         (DEFFILES): New.
8856         (TARGETSOURCES): Add arm-reloc-property.cc
8857         (ALL_TARGETOBJS): Add arm-reloc-property.$(OBJEXT)
8858         (libgold_a_SOURCES): $(DEFFILES)
8859         * Makefile.in: Regenerate.
8860         * arm-reloc-property.cc: New file.
8861         * arm-reloc-property.h: New file.
8862         * arm-reloc.def: New file.
8863         * arm.cc: Update comments.
8864         (arm-reloc-property.h): New included header.
8865         (arm_reloc_property_table): New global variable.
8866         (Target_arm::do_select_as_default_target): New method definition.
8867         * configure.tgt (armeb*-*-*,armbe*-*-*,arm*-*-*): Add
8868         arm-reloc-property to targ_extra_obj.
8869         * parameters.cc (set_parameters_target): Call
8870         Target::select_as_default_target().
8871         * target.h (Target::select_as_default_target): New method definition.
8872         (Target::do_select_as_default_target): Same.
8873
8874 2010-02-01  Doug Kwan  <dougkwan@google.com>
8875
8876         * arm.cc (Arm_exidx_fixup::Arm_exidx_fixup): Initialize
8877         first_output_text_section_.
8878         (Arm_exidx_fixup::first_output_text_section): New method definition.
8879         (Arm_exidx_fixup::first_output_text_section_): New data member.
8880         (Arm_exidx_fixup::process_exidx_section): Record the first text
8881         output section seen.
8882         (Arm_output_section::fix_exidx_coverage): Set correct linked section
8883         and entsize in output section header.
8884
8885 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8886
8887         * gold/arm.cc: Added support for the ARM relocations: R_ARM_THM_PC8,
8888         R_ARM_THM_PC12, R_ARM_THM_ALU_PREL_11_0.
8889         (Arm_relocate_functions::thm_alu11): New Method.
8890         (Arm_relocate_functions::thm_pc8): New Method.
8891         (Arm_relocate_functions::thm_pc12): New Method.
8892         (Target_arm::Scan::local): Handle the relocations.
8893         (Target_arm::Scan::global): Likewise.
8894         (Target_arm::Relocate::relocate): Likewise.
8895         (Target_arm:Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
8896
8897 2010-01-29  Doug Kwan  <dougkwan@google.com>
8898
8899         * arm.cc (Target_arm::Scan::global): General PLTs for the same set
8900         of relocation types as ld.
8901
8902 2010-01-29  Doug Kwan  <dougkwan@google.com>
8903
8904         * arm.cc (Arm_relocate_functions::arm_branch_common) Change visibility
8905         to public.
8906         (Arm_relocate_functions::thumb_branch_common): Ditto.
8907         (Arm_relocate_functions::thm_call, Arm_relocate_functions::thm_jump24,
8908         Arm_relocate_functions::thm_xpc22, Arm_relocate_functions::plt32,
8909         Arm_relocate_functions::xpc25, Arm_relocate_functions::call,
8910         Arm_relocate_functions::jump24): Remove.
8911         (Target_arm::Relocate::relocate): Adjust code to call
8912         Arm_relocation_functions::arm_branch_common and
8913         Arm_relocation_functions::thumb_branch_common instead of their removed
8914         wrappers.  Merge switch-cases together to reduce source code size.
8915
8916 2010-01-29  Doug Kwan  <dougkwan@google.com>
8917
8918         * arm.cc (Arm_relobj::Arm_relobj): Initialize new data member
8919         output_local_symbol_count_needs_update_.
8920         (Arm_relobj::output_local_symbol_count_needs_update,
8921          Arm_relobj::set_output_local_symbol_count_needs_update,
8922          Arm_relobj::update_output_local_symbol_count): New methods.
8923         (Arm_relobj::output_local_symbol_count_needs_update_): New data
8924         member.
8925         (Arm_exidx_cantunwind::do_fixed_endian_write): Write address
8926         of pointed function as in a R_ARM_PREL31 relocation.
8927         (Arm_output_section<big_endian>::fix_exidx_coverage): Mark objects
8928         for output local symbol count updating.
8929         (Target_arm::do_relax): Update output local symbol counts in objects
8930         if necessary.
8931         * object.h (Sized_relobj::set_output_local_symbol_count): New method.
8932
8933 2010-01-29  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8934
8935         * arm.cc: Added support for the ARM relocations:
8936         R_ARM_MOVW_BREL_NC, R_ARM_MOVT_BREL, R_ARM_MOVW_BREL,
8937         R_ARM_THM_MOVW_BREL_NC, R_ARM_THM_MOVT_BREL, R_ARM_THM_MOVW_BREL.
8938         (Arm_relocate_functions::movw_rel_nc): Renamed (was
8939         movw_prel_nc).
8940         (Arm_relocate_functions::movw_rel): New method.
8941         (Arm_relocate_functions::movt_rel): Renamed (was movt_prel).
8942         (Arm_relocate_functions::thm_movw_rel_nc): Renamed (was
8943         thm_movw_prel_nc).
8944         (Arm_relocate_functions::thm_movw_rel): New method.
8945         (Arm_relocate_functions::thm_movt_rel): Renamed (was
8946         thm_movt_prel).
8947         (Target_arm::Scan::local): Handle MOVW_BREL/MOVT_BREL
8948         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-27  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
8955
8956         * arm.cc: Added support for ARM group relocations.
8957         (Target_arm::reloc_needs_sym_origin): New method.
8958         (Arm_relocate_functions::calc_grp_kn): New method.
8959         (Arm_relocate_functions::calc_grp_residual): New method.
8960         (Arm_relocate_functions::calc_grp_gn): New method.
8961         (Arm_relocate_functions::arm_grp_alu): New Method.
8962         (Arm_relocate_functions::arm_grp_ldr): New Method.
8963         (Arm_relocate_functions::arm_grp_ldrs): New Method.
8964         (Arm_relocate_functions::arm_grp_ldc): New Method.
8965         (Target_arm::Scan::local): Handle the ARM group relocations.
8966         (Target_arm::Scan::global): Likewise.
8967         (Target_arm::Relocate::relocate): Likewise.
8968         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
8969         Likewise.
8970
8971 2010-01-26  Doug Kwan  <dougkwan@google.com>
8972
8973         * arm.cc (set): Include.
8974         (class Arm_exidx_fixup): Change type of last_input_section_ to const
8975         pointer type.
8976         (Arm_output_section::Text_section_list): New type.
8977         (Arm_output_section::append_text_sections_to_list): New method.
8978         (Arm_output_section::fix_exidx_coverage): Ditto.
8979         (Arm_relobj::Arm_relobj): Initialize exidx_section_map_.
8980         (Arm_relobj::convert_input_section_to_relaxed_section): Use
8981         Relobj::set_section_offset() instead of
8982         Sized_relobj::invalidate_section_offset().
8983         (Arm_relobj::section_needs_reloc_stub_scanning): Add an extra
8984         parameter for section headers. Ignore relocation sections for
8985         unallocated sections and EXIDX sections.
8986         (Target_arm::fix_exidx_coverage): New method.
8987         (Target_arm::output_section_address_less_than): New type.
8988         (Arm_exidx_fixup::add_exidx_cantunwind_as_needed): Use index of the
8989         linked text section instead of the EXIDX section.
8990         (Arm_output_section::create_stub_group): Add an assertion to check
8991         that this is not an EXIDX output section.
8992         (Arm_output_section::append_text_sections_to_list): New method.
8993         (Arm_output_section::fix_exidx_coverage): Ditto.
8994         (Arm_relobj::scan_sections_for_stubs): Adjust call to
8995         Arm_relobj::section_needs_reloc_stub_scanning.
8996         (Target_arm::do_relax): Fix EXIDX output section coverage in the
8997         first pass.
8998         (Target_arm::fix_exidx_coverage): New method.
8999         * object.h (Relobj::set_output_section): New method.
9000         (Sized_relobj::invalidate_section_offset): Remove method.
9001         (Sized_relobj::do_invalidate_section_offset): Remove method.
9002         (Sized_relobj::do_set_section_offset): Handle offset value -1.
9003
9004 2010-01-25  Doug Kwan  <dougkwan@google.com>
9005
9006         * arm.cc (Arm_exidx_merged_section::do_output_offset):
9007         Fix warning due to signed and unsigned comparison on a 32-bit host.
9008
9009 2010-01-22  Doug Kwan  <dougkwan@google.com>
9010
9011         * arm.cc (Target_arm::do_relax): Record an output section for section
9012         offset adjustment it contains any stub table that has changed.
9013         * layout.cc (Layout::clean_up_after_relaxation): Adjust section
9014         offsets in an output section if necessary.
9015         * output.cc (Output_section::Output_section): Initialize
9016         section_offsets_need_adjustments_.
9017         (Output_section::add_input_section_for_script): Renamed to
9018         Output_section::add_simple_input_section.
9019         (Output_section::save_states): Add a comment.
9020         (Output_section::discard_states): New method defintion.
9021         (Output_section::adjust_section_offsets): Same.
9022         * output.h (Output_section::add_input_section_for_script): Renamed to
9023         Output_section::add_simple_input_section.
9024         (Output_section::discard_states): New method declaration.
9025         (Output_section::adjust_section_offsets): Same.
9026         (Output_section::section_offsets_need_adjustment,
9027         Output_section::set_section_offsets_need_adjustment): New method
9028         definitions.
9029         (Output_section::section_offsets_need_adjustment_): New data member.
9030         * script-sections.cc
9031         (Output_section_element_input::set_section_address): Adjust code for
9032         renaming of Output_section::add_input_section_for_script.
9033         (Orphan_output_section::set_section_address): Same.
9034
9035 2010-01-22  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9036
9037         * gold/arm.cc (Target_arm): Updated fix_v4bx method and usage of
9038         Fix_v4bx enum values .
9039         * gold/options.h (General_options): New option definitions.
9040         (General_options::fix_v4bx): New method.
9041         (General_options::Fix_v4bx): New enum.
9042         * gold/options.cc (General_options::parse_fix_v4bx): New method.
9043         (General_options::parse_fix_v4bx_interworking): New method.
9044
9045 2010-01-22  Doug Kwan  <dougkwan@google.com>
9046
9047         * arm.cc (Arm_exidx_fixup): New class.
9048
9049 2010-01-21  Doug Kwan  <dougkwan@google.com>
9050
9051         * arm.cc (Arm_exidx_cantunwind, Arm_exidx_merged_section): New
9052         classes.
9053         (Arm_exidx_section_offset_map): New type.
9054
9055 2010-01-21  Doug Kwan  <dougkwan@google.com>
9056
9057         * arm.cc (Arm_exidx_input_section): New class.
9058         (Arm_relobj::exidx_input_section_by_link,
9059         Arm_relobj::exidx_input_section_by_shndx,
9060         Arm_relobj::make_exidx_input_section): New methods.
9061         (read_arm_attributes_section): Remove.
9062         (Arm_relobj::do_read_symbols): Look for ARM.exidx sections and record
9063         information about them.
9064         (Arm_dynobj::do_read_symbols): Move code in read_arm_attributes_section
9065         to here.
9066
9067 2010-01-20  Doug Kwan  <dougkwan@google.com>
9068
9069         * arm.cc (Target_arm::Arm_input_section_map): Change key type from
9070         Input_section_specifier to Section_id.
9071         (Target_arm::new_arm_input_section: Adjust code for change of key
9072         type.
9073         (Target_arm::find_arm_input_section): Ditto.
9074         * gc.h (object.h): Include for Section_id nand Section_id_hash.
9075         (Section_id): Remove.
9076         (Garbage_collection::Section_id_hash): Remove.
9077         * icf.h (object.h): Include for Section_id nand Section_id_hash.
9078         (Section_id): Remove.
9079         (Icf::Section_id_hash): Remove.
9080         * object.h (Section_id, Const_section_id, Section_id_hash,
9081         Const_section_id_hash): New type definitions.
9082         * output.cc (Output_section::add_relaxed_input_section): Change to
9083         use Const_section_id instead of Input_section_specifier as key type.
9084         (Output_section::add_merge_input_section): Ditto.
9085         (Output_section::build_relaxation_map): Change to use Section_id
9086         instead of Input_section_specifier as key type.
9087         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
9088         Ditto.
9089         (Output_section::convert_input_sections_to_relaxed_sections): Change
9090         to use Const_section_id instead of Input_section_specifier as key type.
9091         (Output_section::find_merge_section): Ditto.
9092         (Output_section::find_relaxed_input_section): Ditto.
9093         * output.h (Input_section_specifier): Remove class.
9094         (Output_section::Output_section_data_by_input_section_map): Change
9095         key type to Const_section_id.
9096         (Output_section::Output_relaxed_input_section_by_input_section_map):
9097         Ditto.
9098         (Output_section::Relaxation_map): Change key type to Section_id.
9099
9100 2010-01-20  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9101
9102         * gold/arm.cc: Added support for R_ARM_V4BX relocation
9103         (class Arm_v4bx_stub): New class.
9104         (DEF_STUBS): Updated definition to support v4_veneer_bx.
9105         (Stub_factory::make_arm_v4bx_stub): New method.
9106         (Stub_factory::elf32_arm_stub_v4_veneer_bx): New veneer template.
9107         (Stub_table::empty): Handle v4bx stubs.
9108         (Stub_table::add_arm_v4bx_stub): New method.
9109         (Stub_table::find_arm_v4bx_stub): New method.
9110         (Arm_relocate_functions::v4bx): New method.
9111         (Target_arm::fix_v4bx): New method.
9112         (Target_arm::Target_arm): Handle R_ARM_V4BX.
9113         (Stub_table::relocate_stubs): Likewise.
9114         (Stub_table::do_write): Likewise.
9115         (Stub_table::update_data_size_and_addralign): Likewise.
9116         (Stub_table::finalize_stubs):  Likewise.
9117         (Target_arm::Scan::local): Likewise.
9118         (Target_arm::Scan::global): Likewise.
9119         (Target_arm::do_finalize_sections): Likewise.
9120         (Target_arm::Relocate::relocate): Likewise.
9121         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9122         Likewise.
9123         (Target_arm::scan_reloc_for_stub): Likewise.
9124         (Target_arm::scan_reloc_section_for_stubs): Likewise.
9125
9126 2010-01-19  Ian Lance Taylor  <iant@google.com>
9127
9128         * output.cc (Output_section_headers::do_sized_write): Write large
9129         segment count to sh_info field.
9130         (Output_file_header::do_sized_write): For large segment count,
9131         write PN_XNUM to e_phnum field.
9132
9133 2010-01-15  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9134
9135         * arm.cc (Arm_relocate_functions::thm_jump6): New function.
9136         (Arm_relocate_functions::thm_jump8): New function.
9137         (Arm_relocate_functions::thm_jump11): New function.
9138         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP6, R_ARM_THM_JUMP8,
9139         R_ARM_THM_JUMP11.
9140         (Target_arm::Scan::global): Likewise.
9141         (Target_arm::Relocate::relocate): Likewise.
9142         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
9143         Likewise.
9144
9145 2010-01-14  Doug Kwan  <dougkwan@google.com>
9146
9147         * arm.cc (map, utility): Include headers.
9148         (Target_arm::apply_cortex_a8_workaround): New method.
9149         (Arm_relobj::do_relocate_sections): Apply any Cortex-A8 workaround.
9150         (Target_arm::Scan::local): Handle R_ARM_THM_JUMP24, R_ARM_THM_JUMP19.
9151         (Target_arm::Scan::global): R_ARM_THM_JUMP19.
9152         (Target_arm::do_finalize_sections): Set fix_cortex_a8_ according to
9153         the --[no-]fix-cortex-a8 command line options.
9154         (Target_arm::Relocate::relocate): Handle R_ARM_JUMP19.
9155         (Target_arm::relocate_stub): Use addend in instruction template.
9156         * options.h (DEFINE_bool): Set the user-set flag.
9157         (General_options): Add --[no-]-fix-cortex options.
9158         * output.cc (Output_section::convert_input_sections_to_relaxed_sections)
9159         : Update fast look-up map after conversion.
9160
9161 2010-01-14  Sriraman Tallam  <tmsriram@google.com>
9162
9163         * object.cc (Sized_relobj::do_layout): Change to call layout_gnu_stack
9164         in the first pass of do_layout.
9165
9166 2010-01-13  Doug Kwan  <dougkwan@google.com>
9167
9168         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9169         Arm_relobj::scan_sections_for_stubs): Rearrange code to avoid an
9170         apparent compiler problem of not folding static constant integral
9171         data members of elfcpp::Elf_sizes<32>.
9172
9173 2010-01-13  Doug Kwan  <dougkwan@google.com>
9174
9175         * arm.cc (Arm_relobj::section_needs_reloc_stub_scanning,
9176         Arm_relobj::section_needs_cortex_a8_stub_scanning,
9177         Arm_relobj::scan_section_for_cortex_a8_erratum,
9178         Arm_relobj::scan_span_for_cortex_a8_erratum): New methods.
9179         (Arm_relobj::scan_sections_for_stubs): Move code deciding what
9180         sections to scan for relocation stubs into a new method
9181         Arm_relobj::section_needs_reloc_stub_scanning.  Handle both
9182         relocation and Cortex-A8 stub scanning.
9183         (Target_arm::do_relax): Force stubs to be after stubbed sections
9184         if fixing the Cortex-A8 erratum.  Remove all Cortex-A8 stubs at
9185         the beginning of a new relaxation pass.  Update a comment.
9186         (Target_arm::scan_span_for_cortex_a8_erratum): New method definition.
9187
9188 2010-01-12  Ian Lance Taylor  <iant@google.com>
9189
9190         * target-reloc.h (visibility_error): New inline function.
9191         (relocate_section): Call visibility_error.
9192         * testsuite/Makefile.am (check_DATA): Add protected_3.err.
9193         (MOSTLYCLEANFILES): Likewise.
9194         (protected_4_pic.o, protected_3.err): New targets.
9195         * testsuite/protected_4.cc: New file.
9196
9197 2010-01-12  Doug Kwan  <dougkwan@google.com>
9198
9199         * arm.cc (Cortex_a8_reloc): New class.
9200         (Target_arm::Target_arm): Initialize new data members fix_cortex_a8_
9201         and cortex_a8_relocs_info_.
9202         (Target_arm::fix_cortex_a8): New method definition.
9203         (Target_arm::Cortex_a8_relocs_info): New type.
9204         (Target_arm::fix_cortex_a8_, Target_arm::cortex_a8_relocs_info_):
9205         New data member declarations.
9206         (Target_arm::scan_reloc_for_stub): Record information about
9207         relocations for THUMB branches that might be exempted from the
9208         Cortex-A8 workaround.
9209         (Target_arm::do_relax): Clear all Cortex-A8 relocation information
9210         at the beginning of a relaxation pass.
9211
9212 2010-01-12  Doug Kwan  <dougkwan@google.com>
9213
9214         * arm.cc (Arm_relobj::mapping_symbols_info_): New data member.
9215         (Arm_relobj::Mapping_symbol_position,
9216          Arm_reloj::Mapping_symbol_position_less,
9217          Arm_relobj::Mapping_symbols_info): New types.
9218         (Target_arm::is_mapping_symbol_name): New method definition.
9219         (Arm_relobj::do_count_local_symbols): Save information about mapping
9220         symbols.
9221
9222 2010-01-11  Doug Kwan  <dougkwan@google.com>
9223
9224         * arm.cc (Arm_relocate_functions::thumb32_branch_offset,
9225         Arm_relocate_functions::thumb32_branch_upper,
9226         Arm_relocate_functions::thumb32_branch_lower,
9227         Arm_relocate_functions::thumb32_cond_branch_offset,
9228         Arm_relocate_functions::thumb32_cond_branch_upper,
9229         Arm_relocate_functions::thumb32_cond_branch_lower,
9230         Arm_relocate_functions::thm_jump19): New methods to handle THUMB
9231         branch offset encoding.
9232         (Arm_relocate_functions::thumb_branch_common): Use new branch
9233         offset encoding methods to avoid code duplication.
9234         (Stub_template::Stub_template) Handle THUMB16_SPECIAL_TYPE.
9235         (Stub_addend_reader::operator()): Use new branch encoding method
9236         to avoid code duplication.
9237
9238 2010-01-11  Doug Kwan  <dougkwan@google.com>
9239
9240         * arm.cc (Arm_relobj::do_gc_process_relocs): New method.
9241         (Target_arm::do_finalize_sections): Define special EXIDX section
9242         symbols only if referenced.
9243         * gc.h (Garbage_collection::add_reference): New method.
9244         (gc_process_relocs): Use Garbage_collection::add_reference to avoid
9245         code duplication.
9246
9247 2010-01-11  Ian Lance Taylor  <iant@google.com>
9248
9249         * script.cc (Version_script_info::build_expression_list_lookup):
9250         Change complaing about duplicate wildcard match from error to
9251         warning.
9252
9253         * script.cc (class Lazy_demangler): Recreate--revert part of patch
9254         of 2009-12-30.
9255         (Version_script_info::Version_script_info): Initialize globs_,
9256         default_version_, default_is_global_, and exact_.  Don't
9257         initialize globals_ or locals_.
9258         (Version_script_info::build_lookup_tables): Build local symbols
9259         first.
9260         (Version_script_info::unquote): New function.
9261         (Version_script_info::add_exact_match): New function.
9262         (Version_script_info::build_expression_list_lookup): Remove lookup
9263         parameter.  Add is_global parameter.  Change all callers.  Handle
9264         wildcard pattern specially.  Unquote pattern.  Call
9265         add_exact_match.
9266         (Version_script_info::get_name_to_match): New function.
9267         (Version_script_info::get_symbol_version): New function.
9268         (Version_script_info::get_symbol_version_helper): Remove.
9269         (Version_script_info::check_unmatched_names): Call unquote.
9270         * script.h (class Version_script_info): Change get_symbol_version
9271         to be non-inline and add is_global parameter; change all callers.
9272         Rewrite symbol_is_local.  Update declarations.  Define struct
9273         Version_tree_match, Exact, Globs.  Don't define struct Lookup.
9274         Remove globals_ and locals_ members.  Add exact_, globs_,
9275         default_version_, is_global_.
9276         (Version_script_info::Glob): Remove pattern, add expression and
9277         is_global.  Update constructor.  Change all callers.
9278         * dynobj.cc (Versions::finalize): Mark the version symbol as the
9279         default version.
9280         (Versions::symbol_section_contents): If a symbol is undefined, or
9281         defined in a dynamic object, set the version index to
9282         VER_NDX_LOCAL.
9283         * symtab.cc (Symbol_table::add_from_relobj): Don't call
9284         symbol_is_local.
9285         (Symbol_table::add_from_pluginobj): Likewise.
9286         * testsuite/ver_matching_test.sh: blaza1 and blaza go into V2.
9287
9288 2010-01-11  Doug Kwan  <dougkwan@google.com>
9289
9290         * Makefile.am (incremental_dump_DEPENDENCIES): Add libintl dependency.
9291         (incremental_dump_LDADD): Add linking option for libintl.
9292         * Makefile.in: Regenerate.
9293
9294 2010-01-11  H.J. Lu  <hongjiu.lu@intel.com>
9295
9296         PR gold/11144
9297         * testsuite/Makefile.am (dynamic_list.stdout): Use --dyn-syms
9298         instead of -Ds.
9299         * testsuite/Makefile.in: Regenerated.
9300
9301 2010-01-10  Doug Kwan  <dougkwan@google.com>
9302
9303         * options.h (DEFINE_var): Use parentheses around argument varname__
9304         in macro body to avoid any unintended subsequent substitutions.
9305
9306 2010-01-10  Ian Lance Taylor  <iant@google.com>
9307
9308         * resolve.cc (Symbol_table::resolve): Add symbols to list of ODR
9309         candidates before doing symbol resolution.
9310
9311         * resolve.cc (Symbol_table::resolve): Add symbols to the list of
9312         ODR candidates if only one is weak.
9313
9314 2010-01-08  Ian Lance Taylor  <iant@google.com>
9315
9316         * script.cc (Version_script_info::build_expression_list_lookup):
9317         Don't warn about ambiguous version, just record the ambiguity.
9318         (Version_script_info::get_symbol_version_helper): Give error if
9319         version is ambiguous.
9320
9321 2010-01-08  Doug Kwan  <dougkwan@google.com>
9322
9323         * arm.cc (Stub_table::Stub_table): Initalize cortex_a8_stubs_,
9324         prev_data_size_ and prev_addralign_.  Remove initializer for
9325         deleted data member has_been_changed_.
9326         (Stub_table::empty): Look at both reloc_stubs_ and cortex_a8_stubs_
9327         to determine if the table is empty.
9328         (Stub_table::has_been_changed, Stub_table_set_has_been_changed):
9329         Remove.
9330         (Stub_table::add_reloc_stub): Define method in class definition
9331         instead of just declaring it there.
9332         (Stub_table::add_cortex_a8_stub): New method definition.
9333         (Stub_table::update_data_size_and_addralign): Ditto.
9334         (Stub_table::finalize_stubs): Ditto.
9335         (Stub_table::apply_cortex_a8_workaround_to_address_range): Ditto.
9336         (Stub_table::do_addralign_): Return address alignment in the
9337         (Stub_table::do_reset_address_and_file_offset): Define method in
9338         class definition instead of declaring it there.  Set current data
9339         size to be the data size of the previous pass.
9340         (Stub_table::set_final_data_size): Use current data size as the
9341         final data size.
9342         (Stub_table::relocate_stub): Change parameter type of stub from
9343         Reloc_stub pointer to Stub pointer.
9344         (Stub_table::addralign_, Stub_table::has_been_changed_): Remove.
9345         (Stub_table::Cortex_a8_stub_list): New typedef.
9346         (Stub_table::cortex_a8_stubs_, Stub_table::prev_data_size_,
9347          Stub_table::prev_addralign_): New data member.
9348         (Arm_relobj::Arm_relobj): Initialize data member
9349         section_has_cortex_a8_workaround_.
9350         (Arm_relobj::section_has_cortex_a8_workaround,
9351          Arm_relobj::mark_section_for_cortex_a8_workaround): New method
9352          definitions.
9353         (Arm_relobj::section_has_cortex_a8_workaround_): New data member
9354         declarations.
9355         (Target_arm::relocate_stub): Change parameter type of stub from
9356         Reloc_stub pointer to Stub pointer.
9357         (Insn_template::size, Insn_template::alignment): Handle
9358         THUMB16_SPECIAL_TYPE.
9359         (Stub_table::remove_all_cortex_a8_stubs, Stub_table::finalize_stubs,
9360          Stub_table::update_data_size_and_addralign,
9361          Stub_table::apply_cortex_a8_workaround_to_address_range): New method
9362         definitions.
9363         (Stub_table::relocate_stubs): Handle Cortex-A8 stubs.
9364         (Stub_table::do_write): Ditto.
9365         (Target_arm::do_relax): Adjust code for changes in Stub_table.
9366
9367 2010-01-08  Ian Lance Taylor  <iant@google.com>
9368
9369         PR 11108
9370         * symtab.h (class Symbol): Remove fields is_target_special_ and
9371         has_plt_offset_.  Add field is_defined_in_discarded_section_.
9372         (Symbol::is_defined_in_discarded_section): New function.
9373         (Symbol::set_is_defined_in_discarded_section): New function.
9374         (Symbol::has_plt_offset): Rewrite.
9375         (Symbol::set_plt_offset): Verify that new offset is not -1U.
9376         * symtab.cc (Symbol::init_fields): Initialize plt_offset_ to -1U.
9377         Don't initialize is_target_special_ or has_plt_offset_.
9378         Initialize is_defined_in_discarded_section_.
9379         (Symbol_table::add_from_relobj): If appropriate, set
9380         is_defined_in_discarded_section.
9381         * resolve.cc (Symbol::override_base_with_special): Don't test
9382         is_target_special_.  Change has_plt_offset_ to has_plt_offset().
9383         * target-reloc.h (relocate_section): Do special handling for
9384         symbols defined in discarded sections for global symbols as well
9385         as local symbols.
9386
9387 2010-01-08  Ian Lance Taylor  <iant@google.com>
9388
9389         * dynobj.cc (big_endian>::find_dynsym_sections): Set pi to NULL in
9390         the SHT_SYMTAB case.
9391
9392 2010-01-08  Ian Lance Taylor  <iant@google.com>
9393
9394         * object.cc (Sized_relobj::do_layout): Don't get confused if
9395         layout_eh_frame returns NULL.
9396
9397 2010-01-08  Ian Lance Taylor  <iant@google.com>
9398
9399         PR 11084
9400         * dynobj.cc (Sized_dynobj::find_dynsym_sections): If there is no
9401         dynamic symbol table, use the normal symbol table.
9402         (Sized_dynobj::do_read_symbols): Remove assertion about type of
9403         symbol table.
9404
9405 2010-01-08  Ian Lance Taylor  <iant@google.com>
9406
9407         PR 11072
9408         * layout.cc (Layout::include_section): Remove .gnu_debuglink
9409         sections.
9410
9411 2010-01-08  H.J. Lu  <hongjiu.lu@intel.com>
9412
9413         * version.cc (print_version): Change to "Copyright 2010".
9414
9415 2010-01-08  Ian Lance Taylor  <iant@google.com>
9416
9417         PR 10287
9418         PR 11063
9419         * i386.cc (class Target_i386): Change return type of plt_section
9420         to be non-const.
9421         (class Output_data_plt_i386): Add tls_desc_rel_ field.
9422         (Output_data_plt_i386::Output_data_plt_i386): Initialize
9423         tls_desc_rel_ field.
9424         (Output_data_plt_i386::rel_tls_desc): New function.
9425         (Target_i386::rel_tls_desc_section): New function.
9426         (Target_i386::Scan::local): Rewrite R_386_TLS_GOTDESC handling.
9427         (Target_i386::Scan::global): For R_386_TLS_GOTDESC put
9428         R_386_TLS_DESC reloc in rel_tls_desc_section.
9429         * x86_64.cc (class Target_x86_64): Add tlsdesc_reloc_info_ field.
9430         Define struct Tlsdesc_info.
9431         (Target_x86_64::Target_x86_64): Initialize tlsdesc_reloc_info_.
9432         (Target_x86_64::do_reloc_symbol_index): New function.
9433         (Target_x86_64::add_tlsdesc_info): New function.
9434         (class Output_data_plt_x86_64): Add tlsdesc_rel_ field.
9435         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize
9436         tlsdesc_rel_ field.
9437         (Output_data_plt_x86_64::rela_plt): Rename from rel_plt.  Change
9438         all callers.
9439         (Output_data_plt_x86_64::rela_tlsdesc): New function.
9440         (Target_x86_64::rela_tlsdesc_section): New function.
9441         (Target_x86_64::Scan::local): Rewrite R_X86_64_GOTPC32_TLSDESC
9442         handling.
9443         (Target_x86_64::Scan::global): For R_X86_64_GOTPC32_TLSDESC put
9444         (Target_x86_64::do_reloc_addend): New function.
9445         R_X86_64_TLSDESC reloc in rela_tlsdesc_section.
9446         * output.h (class Output_reloc) [SHT_REL]: Add new constructor
9447         declarations.  Define TARGET_CODE.  Add arg field to u1_ union.
9448         (Output_reloc::type): New function.
9449         (Output_reloc::is_local_section_symbol): Check for TARGET_CODE.
9450         (Output_reloc::is_target_specific): New function.
9451         (Output_reloc::target_arg): New function.
9452         (class Output_reloc) [SHT_RELA]: Add four new constructors for
9453         absolute relocs and target specific relocs.
9454         (class Output_data_reloc) [SHT_REL]: Add add_absolute and
9455         add_target_specific.
9456         (class Output_data_reloc) [SHT_RELA]: Likewise.
9457         * output.cc (Output_reloc::Output_reloc): Add four new versions
9458         for absolute relocs and target specific relocs.
9459         (Output_reloc::set_needs_dynsym_index): Add TARGET_CODE case.
9460         (Output_reloc::get_symbol_index): Likewise.
9461         (Output_reloc::local_section_offset): Check that local_sym_index_
9462         is not TARGET_CODE or 0.
9463         (Output_reloc::symbol_value): Likewise.
9464         (Output_reloc::write) [SHT_RELA]: Call target for target specific
9465         reloc.
9466         * target.h (class Target): Add reloc_symbol_index and reloc_addend
9467         functions.  Add do_reloc_symbol_index and do_reloc_addend virtual
9468         functions.
9469         * layout.cc (add_target_dynamic_tags): Use output section for
9470         DT_PLTRELSZ and DT_JMPREL.
9471
9472 2010-01-07  Ian Lance Taylor  <iant@google.com>
9473
9474         PR 11061
9475         * output.h (class Output_reloc) [SHT_RELA]: Add is_relative
9476         function.
9477         (class Output_data_reloc_generic): Define.
9478         (class Output_data_reloc_base): Change base class to
9479         Output_data_reloc_generic.  Change add() method to call
9480         bump_relative_reloc_count for a relative reloc.  Remove
9481         sort_relocs_ field.
9482         * output.cc (Output_data_reloc_base::do_write): Change sort_reloc_
9483         to sort_relocs().
9484         * layout.cc (Layout::add_target_dynamic_tags): Change dyn_rel to
9485         Output_data_reloc_generic*.  Add DT_RELCOUNT/DT_RELACOUNT tag if
9486         appropriate.
9487         * layout.h (class Layout): Update declaration.
9488
9489 2010-01-07  Ian Lance Taylor  <iant@google.com>
9490
9491         * output.h (class Output_data): Add const version of
9492         output_section and do_output_section.
9493         (class Output_section_data): Add const version of
9494         do_output_section.
9495         (class Output_section): Likewise.
9496         * layout.cc (Layout::add_target_dynamic_tags): New function.
9497         * layout.h (class Layout): Update declarations.
9498         * arm.cc (Target_arm::do_finalize_sections): Use
9499         add_target_dynamic_tags.
9500         * i386.cc (Target_i386::do_finalize_sections): Likewise.
9501         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
9502         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
9503         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
9504
9505 2010-01-07  Ian Lance Taylor  <iant@google.com>
9506
9507         PR 11042
9508         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Mark the dynamic
9509         object as needed.
9510
9511 2010-01-07  Dmitry Gorbachev  <d.g.gorbachev@gmail.com>
9512             Ian Lance Taylor  <iant@google.com>
9513
9514         PR 11019
9515         * object.cc: Instantiate Xindex::initialize_symtab_xindex and
9516         Xindex::read_symtab_xindex.
9517
9518 2010-01-07  Doug Kwan  <dougkwan@google.com>
9519
9520         * arm.cc (Insn_template::Type): New enum value THUMB16_SPECIAL_TYPE.
9521         (Insn_template::thumb16_bcond_insn): New method declaration.
9522         (Insn_template): Fix spelling.
9523         (Stub::thumb16_special): New method declaration.
9524         (Stub::do_write): Define virtual method which was previously pure
9525         virtual.
9526         (Stub::do_thumb16_special): New method declaration.
9527         (Stub::do_fixed_endian_write): New template member.
9528         (Reloc_stub::do_write): Remove.
9529         (Reloc_stub::do_fixed_endian_write): Remove.
9530         (Cortex_a8_stub): New class definition.
9531         (Stub_factory::make_cortex_a8_stub): New method definition.
9532         (Stub_factory::Stub_factory): Add missing static storage class
9533         qualifier for elf32_arm_stub_a8_veneer_blx.
9534
9535 2010-01-07  Ian Lance Taylor  <iant@google.com>
9536
9537         PR 10980
9538         * options.h (class General_options): Add --warn-unresolved-symbols
9539         and --error-unresolved-symbols.
9540         * errors.cc (Errors::undefined_symbol): Implement
9541         --warn-unresolved-symbols.
9542
9543         * options.h (class General_options): Add -z text and -z textoff.
9544         * layout.cc (Layout::finish_dynamic_section): Implement -z text.
9545
9546 2010-01-06  Sriraman Tallam  <tmsriram@google.com>
9547
9548         * gc.h (Garbage_collection::Cident_section_map): New typedef.
9549         (Garbage_collection::cident_sections): New function.
9550         (Garbage_collection::add_cident_section): New function.
9551         (Garbage_collection::cident_sections_): New member.
9552         (gc_process_relocs): Add references to sections whose names are C
9553         identifiers.
9554         * gold.h (cident_section_start_prefix): New constant.
9555         (cident_section_stop_prefix): New constant.
9556         (is_cident): New function.
9557         * layout.cc (Layout::define_section_symbols): Replace string constants
9558         with the newly defined constants.
9559         * object.cc (Sized_relobj::do_layout): Track sections whose names are
9560         C identifiers.
9561         * testsuite/Makefile.am: Add gc_orphan_section_test.
9562         * testsuite/Makefile.in: Regenerate.
9563         * testsuite/gc_orphan_section_test.cc: New file.
9564         * testsuite/gc_orphan_section_test.sh: New file.
9565
9566 2010-01-06  Ian Lance Taylor  <iant@google.com>
9567
9568         PR 10980
9569         * options.h (class General_options): Add --warn-shared-textrel.
9570         * layout.cc (Layout::finish_dynamic_section): Implement
9571         --warn-shared-textrel.
9572
9573         PR 10980
9574         * options.h (class General_options): Add --warn-multiple-gp.
9575
9576 2010-01-06  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
9577
9578         * Makefile.am (incremental_dump_DEPENDENCIES): Remove
9579         $(THREADSLIB) and $(LIBDL).
9580         * Makefile.in: Rebuild.
9581
9582 2010-01-06  Ian Lance Taylor  <iant@google.com>
9583
9584         PR 10980
9585         * options.cc (General_options::parse_section_start): New function.
9586         (General_options::section_start): New function.
9587         (General_options::General_options): Initialize all members.
9588         * options.h: Include <map>
9589         (class General_options): Add --section-start.  Add section_starts_
9590         member.
9591         * layout.cc (Layout::attach_allocated_section_to_segment): If
9592         --section-start was used, set the address of the segment.  Remove
9593         local sort_sections.
9594         (Layout::relaxation_loop_body): If the address of the load segment
9595         has been set by --section-start, don't use it.
9596         * output.h (Output_segment::update_flags_for_output_section): New
9597         function.
9598         * output.cc (Output_segment::add_output_section): Call
9599         update_flags_for_output_section.
9600
9601 2010-01-05  Ian Lance Taylor  <iant@google.com>
9602
9603         PR 10980
9604         * options.h (class General_options): Add --undefined-version.
9605         * script.cc (struct Version_expression): Add was_matched_by_symbol
9606         field.
9607         (Version_script_info::matched_symbol): New function.
9608         (Version_script_info::get_symbol_version_helper): Call
9609         matched_symbol.
9610         (Version_script_info::check_unmatched_names): New function.
9611         * script.h (class Version_script_info): Update declarations.
9612         * gold.cc (queue_middle_tasks): Handle --no-undefined-version.
9613
9614         * options.h (class General_options): Use DEFINE_bool_alias for
9615         allow_multiple_definition.
9616         * resolve.cc (Symbol_table::should_override): Don't test
9617         allow_multiple_definition.
9618
9619         PR 10980
9620         * options.h (class General_options): Add --cref.
9621         * main.cc (main): Print cref table if --cref.  Don't close mapfile
9622         until after printing cref table.
9623         * cref.cc: Include "symtab.h".
9624         (class Cref_inputs): Define Cref_table_compare and Cref_table.
9625         (Cref_table_compare::operator()): New function.
9626         (Cref_inputs::gather_cref): New function.
9627         (filecol): New static const.
9628         (Cref_inputs::print_cref): New function.
9629         (Cref::print_cref): New function.
9630         * cref.h: Include <cstdio>.
9631         (class Cref): Update declarations.
9632         * mapfile.h (Mapfile::file): New function.
9633         * object.h (class Object): Define Symbols.  Declare virtual
9634         do_get_global_symbols.
9635         (Object::get_global_symbols): New function.
9636         * object.cc (Input_objects::add_object): Pass object to cref_ if
9637         --cref.
9638         (Input_objects::archive_start): Likewise.
9639         (Input_objects::archive_stop): Likewise.
9640         (Input_objects::print_cref): New function.
9641         * dynobj.h (Sized_dynobj::do_get_global_symbols): New function.
9642         * dynobj.cc (big_endian>::do_add_symbols): Create symbols_ if
9643         --cref.
9644         * plugin.cc (Sized_pluginobj::do_get_global_symbols): New
9645         function.
9646         * plugin.h (class Sized_pluginobj): Update declarations.
9647
9648 2010-01-05  Ian Lance Taylor  <iant@google.com>
9649
9650         * symtab.cc (Symbol_table::add_from_object): Rename def parameter
9651         to is_default_version.  Rename insdef to insdefault.
9652         (Symbol_table::add_from_relobj): Rename def to is_default_version
9653         and local to is_forced_local.
9654         (Symbol_table::add_from_pluginobj): Likewise.
9655         (Symbol_table::add_from_dynobj): Likewise.
9656         (Symbol_table::define_special_symbol): Rename insdef to
9657         insdefault.
9658
9659 2010-01-04  Ian Lance Taylor  <iant@google.com>
9660
9661         PR 10980
9662         * options.h (class General_options): Add
9663         --allow-multiple-definition and -z muldefs.
9664         * resolve.cc (Symbol_table::should_override): Don't warn about a
9665         multiple symbol definition if --allow-multiple-definition or -z
9666         muldefs.
9667
9668         PR 10980
9669         * options.h (class General_options): Add --add-needed and
9670         --copy-dt-needed-entries.  Tweak --as-needed help entry.
9671         * object.cc (Input_objects::check_dynamic_dependencies): Give an
9672         error if --copy-dt-needed-entries aka --add-needed is used and
9673         would cause a change in behaviour.
9674
9675         PR 10980
9676         * options.h (class General_options): Add -G as a short version of
9677         --shared.  Add no-op options -assert, -g, and -i.
9678
9679 2010-01-04  Sriraman Tallam  <tmsriram@google.com>
9680
9681         * gc.h (gc_process_relocs): Call is_section_foldable_candidate to
9682         check for .text or .gnu.linkonce.t sections.
9683         * icf.cc (Icf::find_identical_sections): Ditto.
9684         Change the detection for mangled function name within the section
9685         name.
9686         * icf.h (is_section_foldable_candidate): New function.
9687
9688 2009-12-30  Ian Lance Taylor  <iant@google.com>
9689
9690         PR 10980
9691         * options.h (class General_options): Permit two dashes with
9692         --retain-symbols-file.
9693
9694 2009-12-30  Ian Lance Taylor  <iant@google.com>
9695
9696         PR 10979
9697         * layout.cc (Layout::relaxation_loop_body): If -Ttext was used,
9698         don't put the file header and segment headers in the text
9699         segment.
9700
9701         PR 10979
9702         * common.cc (Sort_commons::operator()): Stabilize sort when both
9703         entries are NULL.
9704         (Symbol_table::do_allocate_commons_list): When allocating common
9705         symbols, skip a symbol which is no longer common.
9706         * symtab.h (Symbol::is_common): Test whether the symbol comes from
9707         an object before checking its type.
9708         * testsuite/common_test_2.c: New file.
9709         * testsuite/common_test_3.c: New file.
9710         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_2.
9711         (common_test_2_SOURCES, common_test_2_DEPENDENCIES): Define.
9712         (common_test_2_LDFLAGS, common_test_2_LDADD): Define.
9713         (common_test_2_pic.o, common_test_2.so): New targets.
9714         (common_test_3_pic.o, common_test_3.so): New targets.
9715         * testsuite/Makefile.in: Rebuild.
9716
9717         PR 10979
9718         * script.cc (read_input_script): If we see a new SECTIONS clause,
9719         and we have added an input section, give an error.
9720         * layout.h (class Layout): Add have_added_input_section function.
9721         Add have_added_input_section_ field.
9722         * layout.cc (Layout::Layout): Initialize
9723         have_added_input_section_.
9724         (Layout::layout): Set have_added_input_section_.
9725         (Layout::layout_eh_frame): Likewise.
9726
9727 2009-12-30  Ian Lance Taylor  <iant@google.com>
9728
9729         PR 10931
9730         * options.h (class General_options): Add --sort-common option.
9731         * symtab.h (class Symbol_table): Define Sort_commons_order enum.
9732         * common.cc (Sort_common): Add sort_order parameter to
9733         constructor.  Add sort_order_ field.
9734         (Sort_commons::operator): Check sort_order_.
9735         (Symbol_table::allocate_commons): Determine the sort order.
9736         (Symbol_table::do_allocate_commons): Add sort_order parameter.
9737         Change all callers.
9738         (Symbol_table::do_allocate_commons_list): Likewise.
9739
9740 2009-12-30  Ian Lance Taylor  <iant@google.com>
9741
9742         PR 10916
9743         * symtab.cc (Symbol_table::add_from_relobj): When not exporting
9744         symbols from this object, don't change the visibility of an
9745         undefined symbol.
9746         * testsuite/exclude_libs_test_1.c (lib1_ref): New function.
9747
9748 2009-12-30  Ian Lance Taylor  <iant@google.com>
9749
9750         PR 10861
9751         * script.h (class Version_script_info): Define Language enum.
9752         Update declarations.  Define Glob, Exact, and Lookup types.  Add
9753         new fields globals_, locals_, and is_finalized_.
9754         * script.cc: Various formatting fixes.
9755         (class Parser_closure): Change language_stack_ from a vector of
9756         std::string to one of Version_script_info::Language.  Adjust all
9757         uses accordingly.
9758         (class Lazy_demangler): Remove.
9759         (struct Version_expression): Change language from std::string to
9760         Version_script_info::Language.
9761         (Version_script_info::Version_script_info): New function.
9762         (Version_script_info::~Version_script_info): Don't call clear.
9763         (Version_script_info::finalize): New function.
9764         (Version_script_info::build_lookup_tables): New function.
9765         (Version_script_info::build_expression_list_lookup): New
9766         function.
9767         (Version_script_info::get_symbol_version_helper): Rewrite to use
9768         lookup tables.
9769         (Version_script_info::print_expression_list): Adjust to use
9770         Version_script_info::Language.
9771         (script_push_lex_into_version_mode): Check that the version script
9772         has not been finalized.
9773         (version_script_push_lang): Change language string to
9774         Version_script_info::Language.
9775         * options.cc (Command_line::version_script): New function.
9776         * options.h (class General_options): Add finalize_dynamic_list
9777         function.  Change version_script from declaration to definition.
9778         * testsuite/ver_test_4.script: Remove duplicate def of t2_2.
9779         * testsuite/version_script.map: Remove duplicate def of foo.
9780         * testsuite/Makefile.am (ver_matching_def.so): Depend upon
9781         version_script.map.
9782         * testsuite/Makefile.in: Rebuild.
9783
9784 2009-12-30  Ian Lance Taylor  <iant@google.com>
9785
9786         PR 10843
9787         * target-reloc.h (relocate_for_relocatable): When copying a reloc,
9788         if the input symbol index is 0, make the output symbol index 0.
9789
9790 2009-12-30  Ian Lance Taylor  <iant@google.com>
9791
9792         PR 10670
9793         * options.h (class General_options): Add -x/--discard-all.
9794         * object.cc (Sized_relobj::do_count_local_symbols): Handle
9795         --discard-all.  If the local symbol needs a dynamic entry, check
9796         that before handling --discard-locals.
9797
9798 2009-12-30  Ian Lance Taylor  <iant@google.com>
9799
9800         PR 10450
9801         * output.cc (Output_segment::Output_segment): If PT_TLS, set the
9802         flags to PF_R.
9803         (Output_segment::add_output_section): Don't change the flags if
9804         the type is PT_TLS.
9805
9806         PR 10450
9807         * dynobj.cc (Dynobj::create_gnu_hash_table): Add symbols to the
9808         GNU hash table if they need a dynamic value.  Otherwise, don't add
9809         them if they are defined in a dynamic object or are forced local.
9810
9811 2009-12-29  Ian Lance Taylor  <iant@google.com>
9812
9813         PR 10450
9814         * layout.cc (Layout::create_dynamic_symtab): Only set entsize of
9815         .gnu.hash table for a 32-bit target.
9816
9817         PR 10450
9818         * symtab.h (Symbol::needs_dynsym_entry): A symbol in both a
9819         regular and a dynamic object only needs a dynamic symbol table
9820         entry if it is externally visible.
9821
9822         PR 10450
9823         * i386.cc (class Target_i386): Initialize global_offset_table_ in
9824         constructor.  Add global_offset_table_ field.
9825         (Target_i386::got_section): Set global_offset_table_.
9826         (Target_i386::do_finalize_sections): Set global_offset_table_
9827         size.
9828         * x86_64.cc (class Target_x86_64): Initialize global_offset_table_
9829         in constructor.  Add global_offset_table_ field.
9830         (Target_x86_64::got_section): Set global_offset_table_.
9831         (Target_x86_64::do_finalize_sections): Set global_offset_table_
9832         size.
9833
9834         * layout.cc (Layout::Layout): Initialize increase_relro_.
9835         (Layout::get_output_section): Add is_relro, is_last_relro, and
9836         is_first_non_relro parameters.  Change all callers.
9837         (Layout::choose_output_section): Likewise.
9838         (Layout::add_output_section_data): Likewise.
9839         (Layout::make_output_section): Likewise.
9840         (Layout::set_segment_offsets): Clear increase_relro when using a
9841         linker script.
9842         * layout.h (class Layout): Add increase_relro method.  Add
9843         increase_relro_ field.  Update declarations.
9844         * output.cc (Output_section::Output_section): Initialize
9845         is_last_relro_ and is_first_non_relro_.
9846         (Output_segment::add_output_section): Group relro sections is
9847         do_sort is true.  Handle is_last_relro and is_first_non_relro.
9848         (Output_segment::maximum_alignment): Remove relro handling.
9849         (Output_segment::set_section_addresses): Add increase_relro
9850         parameter.  Change all callers.  Add initial alignment to align
9851         relro sections on separate page.  Remove old relro handling.
9852         (Output_segment::set_section_list_addresses): Remove in_relro
9853         parameter.  Change all callers.
9854         (Output_segment::set_offset): Add increase parameter.  Change all
9855         callers.  Remove old relro handling.
9856         * output.h (class Output_section): Add new methods: is_last_relro,
9857         set_is_last_relro, is_first_non_relro, set_is_first_non_relro.
9858         Add is_last_relro_ and is_first_non_relro_ fields.
9859         * i386.cc (Target_i386::got_section): Don't call set_is_relro.
9860         Create separate .got.plt section.  Call increase_relro.
9861         * x86_64.cc (Target_x86_64::got_section): Likewise.
9862         * testsuite/relro_script_test.t: Add .got.plt.
9863
9864         PR 10450
9865         * layout.cc (Layout::Layout): Initialize dynamic_symbol_ field.
9866         (Layout::create_initial_dynamic_sections): Set dynamic_symbol_.
9867         (Layout::finalize): Call set_dynamic_symbol_size.
9868         (Layout::set_dynamic_symbol_size): New function.
9869         * layout.h (class Layout): Add dynamic_symbol_ field.  Declare
9870         set_dynamic_symbol_size.
9871
9872         PR 10450
9873         * output.h (class Output_section): Add is_entsize_zero_ field.
9874         * output.cc (Output_section::Output_section): Initialize
9875         is_entsize_zero_.
9876         (Output_section::set_entsize): If two different entsizes are
9877         requested, force it to zero.
9878         (Output_section::add_input_section): Set flags for .debug_str
9879         before updating section flags.  Set entsize.
9880         (Output_section::update_flags_for_input_section): Set SHF_MERGE
9881         and SHF_STRING if all input sections have those flags.
9882
9883 2009-12-29   Rafael Espindola  <espindola@google.com>
9884
9885         * main.cc (main): Fix the sys time reporting.
9886         * workqueue.cc (Workqueue::find_and_run_task): Fix the sys time
9887         reporting.
9888
9889 2009-12-29  Sriraman Tallam  <tmsriram@google.com>
9890
9891         * options.cc (General_options::parse_version): Allow -v to exit
9892         without an error if there is nothing to link.
9893
9894 2009-12-29  Ian Lance Taylor  <iant@google.com>
9895
9896         * configure.ac: Set the MCMODEL_MEDIUM conditional to false if
9897         using a version of gcc before 4.1.
9898         * configure: Rebuild.
9899
9900 2009-12-28  Chris Demetriou  <cgd@google.com>
9901
9902         * attributes.cc (Output_attributes_section_data::do_write): Use
9903         std::vector::front rather than std::vector::data.
9904
9905 2009-12-28  Ian Lance Taylor  <iant@google.com>
9906
9907         * symtab.h (class Symbol_table): Add enum Defined.
9908         * resolve.cc (Symbol_table::should_override): Add defined
9909         parameter.  Change all callers.  Test whether object is NULL
9910         before calling a method on it.
9911         (Symbol_table::report_resolve_problem): Add defined parameter.
9912         Change all callers.
9913         (Symbol_table::should_override_with_special): Likewise.
9914         * symtab.cc (Symbol_table::define_in_output_data): Add defined
9915         parameter.  Change all callers.
9916         (Symbol_table::do_define_in_output_data): Likewise.
9917         (Symbol_table::define_in_output_segment): Likewise.
9918         (Symbol_table::do_define_in_output_segment): Likewise.
9919         (Symbol_table::define_as_constant): Likewise.
9920         (Symbol_table::do_define_as_constant): Likewise.
9921         * script.h (class Symbol_assignment): Add is_defsym parameter to
9922         constructor; change all callers.
9923         * script.cc (Script_options::add_symbol_assignment): Add is_defsym
9924         parameter.  Change all callers.  Add is_defsym_ field.
9925         (class Parser_closure): Add parsing_defsym parameter to
9926         constructor; change all callers.  Add parsing_defsym accessor
9927         function.  Add parsing_defsym_ field.
9928
9929 2009-12-28  Ian Lance Taylor  <iant@google.com>
9930
9931         * gold.cc (queue_middle_tasks): Fix formatting.
9932         * object.cc (Relobj::is_section_name_included): Likewise.
9933
9934 2009-12-23  Ian Lance Taylor  <iant@google.com>
9935
9936         * i386.cc (Target_i386::do_calls_non_split): Recognize
9937         -fsplit-stack prologue for a function with a static chain.
9938         * x86_64.cc (Target_x86_64::do_calls_non_split): Recognize
9939         -fsplit-stack prologue when using %r11.
9940
9941 2009-12-21  Sriraman Tallam  <tmsriram@google.com>
9942
9943         * options.cc (General_options::parse_version): Make -v continue and do
9944         the link like GNU ld does.
9945
9946 2009-12-17  Rafael Avila de Espindola  <espindola@google.com>
9947
9948         * Makefile.am (CCFILES): Add timer.cc.
9949         (HFILES): Add timer.h.
9950         * configure.ac: Check for sysconf and times.
9951         * main.cc: include timer.h.
9952         (main): Use Timer instead of get_run_time.
9953         * timer.cc: New.
9954         * timer.h: New.
9955         * workqueue.cc: include timer.h.
9956         (Workqueue::find_and_run_task):
9957         Report user, sys and wall time.
9958         * Makefile.in: Regenerate.
9959         * config.in: Regenerate.
9960         * configure: Regenerate.
9961
9962 2009-12-16  Doug Kwan  <dougkwan@google.com>
9963
9964         * arm.cc (Arm_relobj::scan_sections_for_stubs): Exclude ICF-eliminated
9965         sections.
9966         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle
9967         relaxed input sections.
9968         * output.cc (Output_section::find_relaxed_input_section): Change
9969         return type to Output_relaxed_input_section pointer.  Adjust code
9970         for new type of relaxed_input_section_map_.
9971         * output.h (Output_section::find_relaxed_input_section): Change
9972         return type to Output_relaxed_input_section pointer.
9973         (Output_section::Output_relaxed_input_section_by_input_section_map):
9974         New type.
9975         (Output_section::relaxed_input_section_map_): Change type to
9976         Output_section::Output_relaxed_input_section_by_input_section_map.
9977         * symtab.cc (Symbol_table::compute_final_value): Handle relaxed
9978         input section.
9979
9980 2009-12-15  Ian Lance Taylor  <iant@google.com>
9981
9982         * layout.cc (Layout::create_shstrtab): Only write out after input
9983         sections if we are compressing debug sections.
9984
9985 2009-12-15  Ian Lance Taylor  <iant@google.com>
9986
9987         * archive.cc (Archive::add_symbols): Only look up a symbol without
9988         a version if there is, in fact, a version.
9989
9990 2009-12-14  Ian Lance Taylor  <iant@google.com>
9991
9992         Revert -Wshadow changes, all changes from:
9993         2009-12-11  Doug Kwan  <dougkwan@google.com>
9994         2009-12-11  Nick Clifton  <nickc@redhat.com>
9995         * configure.ac: Remove -Wshadow when setting WARN_CXXFLAGS.
9996
9997 2009-12-11  Doug Kwan  <dougkwan@google.com>
9998
9999         * arm.cc (Target_arm::do_finalize_sections): Fix build breakage
10000         due to -Wshadow.
10001         * attributes.cc (Object_attribute::size): Ditto.
10002         (Attributes_section_data::size): Ditto.
10003         (Attributes_section_data::Attributes_section_data): Ditto.
10004         (Output_attributes_section_data::do_write): Ditto.
10005         * attributes.h (Object_attribute::set_type): Ditto.
10006         * testsuite/tls_test_main.cc (safe_lock, safe_unlock): Ditto.
10007
10008 2009-12-11  Nick Clifton  <nickc@redhat.com>
10009
10010         * archive.cc: Fix shadowed variable warnings.
10011         * arm.cc: Likewise.
10012         * compressed_output.cc: Likewise.
10013         * compressed_output.h: Likewise.
10014         * configure: Likewise.
10015         * dwarf_reader.cc: Likewise.
10016         * dynobj.cc: Likewise.
10017         * dynobj.h: Likewise.
10018         * ehframe.cc: Likewise.
10019         * ehframe.h: Likewise.
10020         * errors.cc: Likewise.
10021         * expression.cc: Likewise.
10022         * fileread.cc: Likewise.
10023         * fileread.h: Likewise.
10024         * freebsd.h: Likewise.
10025         * i386.cc: Likewise.
10026         * icf.cc: Likewise.
10027         * incremental.h: Likewise.
10028         * layout.cc: Likewise.
10029         * layout.h: Likewise.
10030         * mapfile.cc: Likewise.
10031         * merge.cc: Likewise.
10032         * merge.h: Likewise.
10033         * object.cc: Likewise.
10034         * object.h: Likewise.
10035         * options.h: Likewise.
10036         * output.cc: Likewise.
10037         * output.h: Likewise.
10038         * parameters.cc: Likewise.
10039         * plugin.cc: Likewise.
10040         * powerpc.cc: Likewise.
10041         * reduced_debug_output.cc: Likewise.
10042         * reduced_debug_output.h: Likewise.
10043         * reloc.cc: Likewise.
10044         * reloc.h: Likewise.
10045         * resolve.cc: Likewise.
10046         * script-sections.cc: Likewise.
10047         * script.cc: Likewise.
10048         * script.h: Likewise.
10049         * sparc.cc: Likewise.
10050         * symtab.cc: Likewise.
10051         * symtab.h: Likewise.
10052         * target-select.cc: Likewise.
10053         * target-select.h: Likewise.
10054         * token.h: Likewise.
10055         * workqueue.cc: Likewise.
10056         * workqueue.h: Likewise.
10057         * x86_64.cc: Likewise.
10058
10059 2009-12-10  Doug Kwan  <dougkwan@google.com>
10060
10061         * arm.cc (attributes.h): New include.
10062         (Arm_relobj::Arm_relobj): Initialize attributes_section_data_.
10063         (Arm_relobj::~Arm_relobj): Delete object pointed by
10064         attributes_section_data_.
10065         (Arm_relobj::attributes_section_data): New method definition.
10066         (Arm_relobj::attributes_section_data_): New data member declaration.
10067         (Arm_dynobj::Arm_dynobj): Initialize attributes_section_data_.
10068         (Arm_dynobj::~Arm_dynobj): Delete object pointed by
10069         attributes_section_data_.
10070         (Arm_dynobj::attributes_section_data): New method definition.
10071         (Arm_dynobj::attributes_section_data_): New data member declaration.
10072         (Target_arm::Target_arm): Initialize attributes_section_data_.  Change
10073         initialization value of may_use_blx_ to false.
10074         (Target_arm::using_thumb2, Target_arm::using_thumb_only,
10075         Target_arm::may_use_arm_nop, Target_arm::may_use_thumb2_nop): Use
10076         object attributes to compute results instead of hard-coding.
10077         (Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order,
10078         Target_arm::get_secondary_compatible_arch,
10079         Target_arm::set_secondary_compatible_arch
10080         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10081         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes):
10082         New method declarations.
10083         (Target_arm::get_aeabi_object_attribute): New method definition.
10084         (Target_arm::attributes_section_data_): New data member declaration.
10085         (read_arm_attributes_section): New template definition.
10086         (Arm_relobj::do_read_symbols): Read attributes section if it exists.
10087         (Arm_dynobj::do_read_symbols): Ditto.
10088         (Target_arm::do_finalize_sections): Merge attributes sections from
10089         input.  Check for BLX use after attributes section merging.
10090         Fix __exidx_start and __exidx_end visibility.  Create an
10091         .ARM.attributes section if necessary.
10092         (Target_arm::get_secondary_compatible_arch,
10093         Target_arm::set_secondary_compatible_arch,
10094         Target_arm::tag_cpu_arch_combine, Target_arm::aeabi_enum_name,
10095         Target_arm::tag_cpu_name_value, Target_arm::merge_object_attributes,
10096         Target_arm::do_attribute_arg_type, Target_arm::do_attributes_order):
10097         New method definitions.
10098
10099 2009-12-09  Ian Lance Taylor  <iant@google.com>
10100
10101         * plugin.cc (Plugin::load): Don't cast from void* to a function
10102         pointer.
10103
10104 2009-12-09  Ian Lance Taylor  <iant@google.com>
10105
10106         * dynobj.cc (Sized_dynobj::do_read_symbols): Clear version
10107         information fields.
10108
10109 2009-12-09  H.J. Lu  <hongjiu.lu@intel.com>
10110
10111         * testsuite/Makefile.am (two_file_shared_1_pic_2_test_DEPENDENCIES):
10112         Replace two_file_shared_1.so with two_file_shared_2.so.
10113         * testsuite/Makefile.in: Regenerated.
10114
10115 2009-12-08  Doug Kwan  <dougkwan@google.com>
10116
10117         * Makefile.am (CCFILES): Add attributes.cc and int_encoding.cc.
10118         (HFILES): Add attributes.h and int_encoding.h.
10119         * Makefile.in: Regenerate.
10120         * dwarf_reader.cc (read_unsigned_LEB_128, read_signed_LEB_128): Move
10121         function definitions to int_encoding.cc
10122         * dwarf_reader.h (read_unsigned_LEB_128, read_signed_LEB_128): Move
10123         prototypes to int_encoding.h
10124         * reduced_debug_output.cc (int_encoding.h): New include.
10125         (write_unsigned_LEB_128, get_length_as_unsigned_LEB_128): Move
10126         function definitions to int_encoding.cc
10127         (insert_into_vector, read_from_pointer): Move template definitions to
10128         int_encoding.h
10129         * attributes.cc: New file.
10130         * attributes.h: New file.
10131         * int_encoding.cc: New file.
10132         * int_encoding.h: New file.
10133
10134 2009-12-07  Rafael Avila de Espindola  <espindola@google.com>
10135
10136         PR gold/11055
10137         * incremental-dump.cc (dump_incremental_inputs): New.
10138         (main): Use dump_incremental_inputs.
10139
10140 2009-12-07  H.J. Lu  <hongjiu.lu@intel.com>
10141
10142         PR gold/10893
10143         * i386.cc (Target_i386::Scan::globa): Use is_func instead of
10144         checking elfcpp::STT_FUNC.
10145         (Target_i386::Relocate::relocate): Likewise.
10146         * x86_64.cc (Target_x86_64::Scan::global): Likewise.
10147
10148         * symtab.cc (Symbol_table::sized_write_symbol): Turn IFUNC
10149         symbols from shared libraries into normal FUNC symbols.
10150
10151         * symtab.h (Symbol): Add is_func and use it.
10152
10153 2009-12-05  Doug Kwan  <dougkwan@google.com>
10154
10155         * arm.cc (Target_arm::arm_info): Initialize new fields
10156         attributes_section and attributes_vendor.
10157         * i386.cc (Target_i386::i386_info): Same.
10158         * object.cc (Sized_relobj::do_layout): Skip attribute section.
10159         * gold/powerpc.cc (Target_powerpc::powerpc_info): Initialize new
10160         fields attributes_section and attributes_vendor.
10161         * sparc.cc (Target_sparc::sparc_info): Same.
10162         * target.h (Target::attributes_section, Target::attributes_vendor,
10163         Target::is_attributes_section, Target::attribute_arg_type,
10164         Target::attributes_order): New method definitions.
10165         (Target::Target_info::attributes_section,
10166         Target::Target_info::attributes_vendor): New fields.
10167         (Target::do_attribute_arg_type, Target::do_attributes_order): New
10168         virtual method definitions.
10169         * x86_64.cc (Target_x86_64::x86_64_info): Initialize new fields
10170         attributes_section and attributes_vendor.
10171         * testsuite/testfile.cc (Target_test::test_target_info): Same.
10172
10173 2009-12-05  Doug Kwan  <dougkwan@google.com>
10174
10175         * arm.cc: Update comments about interworking and stub generation.
10176         (Target_arm::Relocate::reloc_is_non_pic): Update list of relocations
10177         considered as non-PIC.
10178         (Arm_relocate_functions::base_abs): Fix formatting.
10179         (Arm_relocate_functions::got_prel): Fix comment.  Change interface
10180         of function to use GOT entry address instead of offset.
10181         (Target_arm::Scan::global): Issue an error if a symbol would need a
10182         PLT does not get one because it is untyped.  Remove code to create
10183         dynamic symbols for relative branches.
10184         (Target_arm::Relocate::relocate: Use 0 instead of false since function
10185         takes unsigned integer instead of boolean.
10186
10187 2009-12-05  H.J. Lu  <hongjiu.lu@intel.com>
10188
10189         * testsuite/Makefile.am (constructor_test_LDADD): New. Empty.
10190         (two_file_test_LDADD): Likewise.
10191         (common_test_1_LDADD): Likewise.
10192         (exception_test_LDADD) Likewise.
10193         (weak_test_LDADD): Likewise.
10194         (many_sections_test_LDADD): Likewise.
10195         (initpri1_LDADD): Likewise.
10196         (script_test_1_LDADD): Likewise.
10197         (script_test_2_LDADD): Likewise.
10198         (justsyms_LDADD): Likewise.
10199         (binary_test_LDADD): Likewise.
10200         (large_LDADD): Likewise.
10201         * testsuite/Makefile.in: Regenerated.
10202
10203 2009-12-04  H.J. Lu  <hongjiu.lu@intel.com>
10204
10205         * resolve.cc (symbol_to_bits): Treat STB_GNU_UNIQUE as STB_GLOBAL.
10206         (Symbol_table::override_with_special): Likewise.
10207         (Symbol_table::add_from_object): Likewise.
10208
10209 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10210
10211         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10212         Don't set the data_offset twice.
10213
10214 2009-12-04  Rafael Avila de Espindola  <espindola@google.com>
10215
10216         * testsuite/Makefile.in: Regenerate.
10217
10218 2009-12-03  Doug Kwan  <dougkwan@google.com>
10219
10220         * arm.cc: Remove comment about missing .ARM.exidx section symbols.
10221         (Target_arm::do_finalize_sections): Add parameter for symbol table
10222         pointer.  Add __exidx_start and __exidx_end symbols as appropriate.
10223         * i386.cc (Target_i386::do_finalize_sections): Add an additional
10224         parameter for symbol table pointer.
10225         * layout.cc (Layout::finalize): Call Target::finalize_sections with
10226         an additional parameter for a pointer to symbol table.
10227         * powerpc.cc (Target_powerpc::do_finalize_sections): Add an additional
10228         parameter for a symbol table pointer.
10229         * sparc.cc (Target_sparc::do_finalize_sections): Ditto.
10230         * target.h (Target::finalize_sections, Target::do_finalize_sections):
10231         Ditto.
10232         * x86_64.cc (Target_x86_64::do_finalize_sections): Add an additional
10233         parameter for a symbol table pointer.
10234
10235 2009-12-03  Rafael Avila de Espindola  <espindola@google.com>
10236
10237         * incremental.cc (Incremental_inputs_header)
10238         (Incremental_inputs_header_write, Incremental_inputs_entry)
10239         (Incremental_inputs_entry_write): Move ...
10240         * incremental.h (Incremental_inputs_header)
10241         (Incremental_inputs_header_write, Incremental_inputs_entry)
10242         (Incremental_inputs_entry_write): here.
10243
10244 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10245
10246         * incremental.cc (make_sized_incremental_binary): Set the target.
10247         Error if it is incompatible.
10248         * output.h (Output_file): Add filename method.
10249
10250 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10251
10252         * incremental.cc (Incremental_inputs_entry): Remove unused argument
10253         from the get_* methods.
10254
10255 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10256
10257         * incremental-dump.cc (main): Check that the offeset of a script is 0.
10258         * incremental.cc (Incremental_inputs::sized_create_inputs_section_data):
10259         Write 0 for the data_offset of scripts.
10260
10261 2009-12-02  Rafael Avila de Espindola  <espindola@google.com>
10262
10263         * testsuite/Makefile.am: Add the incremental_test.sh test.
10264         * testsuite/incremental_test.sh: New.
10265         * testsuite/incremental_test_1.c: New.
10266         * testsuite/incremental_test_2.c: New.
10267
10268 2009-12-01  Rafael Avila de Espindola  <espindola@google.com>
10269
10270         * incremental-dump.cc (main): Fix typos.
10271
10272 2009-11-27  Rafael Avila de Espindola  <espindola@google.com>
10273
10274         PR gold/11025
10275         * incremental-dump.cc (main): Use llu to print 64 bit values.
10276
10277 2009-11-26  Per Øyvind Karlsen <peroyvind@mandriva.org>
10278             H.J. Lu  <hongjiu.lu@intel.com>
10279
10280         * Makefile.am (incremental_dump_DEPENDENCIES): Add $(THREADSLIB)
10281         $(LIBDL).
10282         (incremental_dump_LDADD): Likewise.
10283         * Makefile.in: Regenerated.
10284
10285 2009-11-25  Doug Kwan  <dougkwan@google.com>
10286
10287         Revert:
10288
10289         2009-11-25  Doug Kwan  <dougkwan@google.com>
10290
10291                 * arm.cc (Target_arm::Target_arm): Move method definition
10292                 outside of class definition.  Add code to handle
10293                 --target1-rel, --target1-abs and --target2= options.
10294                 (Target_arm::get_reloc_reloc_type): Change method to be
10295                 non-static and const.
10296                 (Target_arm::target1_is_rel_, Target_arm::target2_reloc_):
10297                 New data member declaration.
10298                 (Target_arm::Scan::local, Target_arm::Scan::global,
10299                 Target_arm::Relocate::relocate,
10300                 Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
10301                 Adjust call to Target_arm::get_real_reloc_type.
10302                 (Target_arm::get_real_reloc_type): Use command line options
10303                 to determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10304                 * options.h (--target1-rel, --target1-abs, --target2): New
10305                 ARM-only options.
10306
10307 2009-11-25  Doug Kwan  <dougkwan@google.com>
10308
10309         * arm.cc (Target_arm::Target_arm): Move method definition outside of
10310         class definition.  Add code to handle --target1-rel, --target1-abs
10311         and --target2= options.
10312         (Target_arm::get_reloc_reloc_type): Change method to be non-static
10313         and const.
10314         (Target_arm::target1_is_rel_, Target_arm::target2_reloc_): New data
10315         member declaration.
10316         (Target_arm::Scan::local, Target_arm::Scan::global,
10317         Target_arm::Relocate::relocate,
10318         Target_arm::Relocatable_size_for_reloc::get_size_for_reloc): Adjust
10319         call to Target_arm::get_real_reloc_type.
10320         (Target_arm::get_real_reloc_type): Use command line options to
10321         determine real types of R_ARM_TARGET1 and R_ARM_TARGET2.
10322         * options.h (--target1-rel, --target1-abs, --target2): New ARM-only
10323         options.
10324
10325 2009-11-25  Doug Kwan  <dougkwan@google.com>
10326
10327         * arm.cc (Target_arm::may_use_thumb2_nop): New method definition.
10328         (Arm_relocate_functions::thumb_branch_common): New metod declaration.
10329         (Arm_relocate_functions::abs12, Arm_relocate_functions::abs16): Fix
10330         formatting.
10331         (Arm_relocate_functions::thm_call): Replace body with a call to
10332         Arm_relocate_functions::thumb_branch_common.
10333         (Arm_relocate_functions::thm_jump24,
10334         Arm_relocate_functions::thm_xpc22): New method definitions.
10335         (Arm_relocate_functions::thumb_branch_common): New method definition.
10336         (Reloc_stub::stbu_type_for_reloc): Fix incorrect uses of bit-wise-or
10337         operator.
10338         (Target_arm::Relocate::relocate): Adjust call to thm_call.
10339         Add code to handle R_ARM_THM_XPC22 and R_ARM_THM_JUMP24.
10340
10341 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10342
10343         * Makefile.am: Build incremental-dump
10344         * Makefile.in: Regenerate.
10345         * incremental-dump.cc: New.
10346         * incremental.cc (Incremental_inputs_header_data,
10347         Incremental_inputs_entry_data): Move to incremental.h
10348         * incremental.h: (Incremental_inputs_header_data,
10349         Incremental_inputs_entry_data): Move from incremental.cc
10350
10351 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10352
10353         * incremental.cc (Incremental_inputs_header,
10354         Incremental_inputs_header_write, Incremental_inputs_entry,
10355         Incremental_inputs_entry_write): Add a typedef with the data type.
10356
10357 2009-11-24  Rafael Avila de Espindola  <espindola@google.com>
10358
10359         * incremental.cc (Incremental_inputs_header,
10360         Incremental_inputs_header_write, Incremental_inputs_entry,
10361         Incremental_inputs_entry_write): Update comment about which
10362         type has the filed descriptions.
10363
10364 2009-11-15  Doug Kwan  <dougkwan@google.com>
10365
10366         * arm.cc (Target_arm::may_use_arm_nop): New method definition.
10367         (Arm_relocate_functions::arm_branch_common): Change method defintion
10368         in class definition to a method declaration and update list of formal
10369         parameters.
10370         (Arm_relocate_functions::plt32, Arm_relocate_functions::call,
10371         Arm_relocation_functions::jump24): Adjust call to
10372         Arm_relocate_functions::arm_branch_common.  Update list of formal
10373         parameters.
10374         (Arm_relocate_functions::xpc25): New method definition.
10375         (Arm_relocate_functions::arm_branch_common): Move method defintion
10376         out from class definition.  Use stubs for mode-switching and extending
10377         branch ranges.
10378         (Target_arm::Relocate::relocate): Handle weakly-undefined symbols
10379         specially.  Change code to enable use of stubs in ARM branches.
10380
10381 2009-11-10  Doug Kwan  <dougkwan@google.com>
10382
10383         * arm.cc (Arm_relobj::do_relocate_sections): Remove options parameter
10384         in method declaration.
10385         (Target_arm::relocate_stub): New method declaration.
10386         (Target_arm::default_target): Change to return a pointer instead of
10387         a const reference.
10388         (Reloc_stub::stub_type_for_reloc): Adjust for the change in
10389         Target_arm::default_target.
10390         (Arm_Relobj::do_relocate_sections): Remove options paramater in
10391         method definition.
10392         (Target_arm::relocate_section): Adjust view.
10393         (Target_arm::relocate_stub): New method definition.
10394
10395 2009-11-10  Doug Kwan  <dougkwan@google.com>
10396
10397         * i386.cc (Target_i386::do_calls_non_split): Add a cast to avoid
10398         a format warning.
10399         * incremental.cc (open_incremental_binary): Initialized local
10400         variables to avoid warnings.
10401         * object.cc (make_elf_object): Ditto.
10402         * x86_64.cc (Target_x86_64::do_calls_non_split): Add a cast to avoid
10403         a format warning.
10404
10405 009-11-09  H.J. Lu  <hongjiu.lu@intel.com>
10406
10407         PR gold/10930
10408         * testsuite/plugin_test.c: Include "config.h".
10409
10410 2009-11-09  Doug Kwan  <dougkwan@google.com>
10411
10412         * arm.cc (Target_arm::fake_relnum_for_stubs): New constant.
10413         (arm_symbol_value): Remove.
10414         (Arm_relocate_functions::arm_branch_common,
10415         Arm_relocate_functions::abs8, Arm_relocate_functions::thm_abs5,
10416         Arm_relocate_functions::abs12, Arm_relocate_functions::abs16,
10417         Arm_relocate_functions::abs32, Arm_relocate_functions::rel32,
10418         Arm_relocate_functions::thm_call, Arm_relocate_functions::plt32,
10419         Arm_relocate_functions::call, Arm_relocate_functions::jump24,
10420         Arm_relocate_functions::prel31, Arm_relocate_functions::mov_abs_nc,
10421         Arm_relocate_functions::movt_abs, Arm_relocate_functions::movw_abs_nc,
10422         Arm_relocate_functions::thm_mobw_abs_nc,
10423         Arm_relocate_functions::thm_mov_abs,
10424         Arm_relocate_functions::movw_prel_nc,
10425         Arm_relocate_functions::thm_movt_abs,
10426         Arm_relocate_functions::movt_prel,
10427         Arm_relocate_functions::thm_movw_prel_nc,
10428         Arm_relocate_functions::thm_movt_prel): Adjust callers of the above.
10429         (Target_arm::Relocate::relocate): Only decompose address into two
10430         parts if relocation type uses the thumb-bit and pass the actual
10431         bit instead of a flag indicating that the thumb-bit is used.  Adjust
10432         calls to methods in Arm_relocate_functions for this change.
10433
10434 2009-11-08  Ian Lance Taylor  <iant@google.com>
10435
10436         PR 10925
10437         * reloc.cc: Instantiate
10438         Sized_relobj::initialize_input_to_output_maps and
10439         Sized_relobj:free_input_to_output_maps.
10440
10441 2009-11-06  Ian Lance Taylor  <iant@google.com>
10442
10443         PR 10876
10444         * defstd.cc (in_segment): Set only_if_ref true for "end".
10445
10446 2009-11-06  Doug Kwan  <dougkwan@google.com>
10447
10448         * arm.cc (class Reloc_stub): Correct a comment.
10449         (Target_arm::Target_arm): Initialize arm_input_section_map_.
10450         (Target_arm::scan_section_for_stubs): New method declaration.
10451         (Target_arm::do_make_elf_object, Target_arm::do_make_output_section):
10452         Change methods from private to protected.
10453         (Target_arm::do_may_relax): New method definition.
10454         (Target_arm::do_relax, Target_arm::group_sections,
10455         Target_arm::scan_reloc_for_stub,
10456         Target_arm::scan_reloc_section_for_stubs): New method declarations.
10457         (Target_arm::arm_input_section_map_): New data member declaration.
10458         (Target_arm::scan_reloc_for_stub,
10459         Target_arm::scan_reloc_section_for_stubs,
10460         Target_arm::scan_section_for_stubs, Target_arm::group_sections,
10461         Target_arm::do_relax): New method definitions.
10462
10463 2009-11-06  Mikolaj Zalewski  <mikolaj@google.com>
10464
10465         * configure.ac: Check for (struct stat)::st_mtim
10466         * fileread.cc (File_read::get_mtime): Use st_mtim if available.
10467         * config.in: Regenerate.
10468         * configure: Regenerate.
10469
10470 2009-11-05  Ian Lance Taylor  <iant@google.com>
10471
10472         PR 10910
10473         * output.cc (Output_segment::add_output_section): Add missing
10474         return statement.
10475
10476 2009-11-04  Ian Lance Taylor  <iant@google.com>
10477
10478         PR 10880
10479         * object.h (class Object): Add is_needed and set_is_needed
10480         methods.  Add is_needed_ field.  Make bool fields into bitfields.
10481         * symtab.cc (Symbol_table::set_dynsym_indexes): If a symbol is
10482         defined in a dynamic object and referenced by a regular object,
10483         set is_needed for the dynamic object.
10484         * layout.cc (Layout::finish_dynamic_section): Don't add DT_NEEDED
10485         if the file is marked with as_needed and it is not needed.
10486
10487 2009-11-04  Ian Lance Taylor  <iant@google.com>
10488
10489         PR 10887
10490         * arm.cc (Target_arm::do_finalize_sections): Don't add dynamic
10491         tags if data is discarded by linker script.
10492         * i386.cc (Target_i386::do_finalize_sections): Likewise.
10493         * powerpc.cc (Target_powerpc::do_finalize_sections): Likewise.
10494         * sparc.cc (Target_sparc::do_finalize_sections): Likewise.
10495         * x86_64.cc (Target_x86_64::do_finalize_sections): Likewise.
10496
10497 2009-11-04  Ian Lance Taylor  <iant@google.com>
10498
10499         * layout.cc (Layout::get_output_section): Add is_interp and
10500         is_dynamic_linker_section parameters.  Change all callers.
10501         (Layout::choose_output_section): Likewise.
10502         (Layout::make_output_section): Likewise.
10503         (Layout::add_output_section_data): Add is_dynamic_linker_section
10504         parameter.  Change all callers.
10505         * layout.h (class Layout): Update declarations.
10506         * output.h (class Output_section): Add is_interp, set_is_interp,
10507         is_dynamic_linker_section, set_is_dynamic_linker_section methods.
10508         Add is_interp_, is_dynamic_linker_section_ fields.  Change
10509         generate_code_fills_at_write_ to a bitfield.
10510         * output.cc (Output_section::Output_sections): Initialize new
10511         fields.
10512         (Output_segment::add_output_section): Add do_sort parameter.
10513         Change all callers.
10514
10515 2009-11-03  Ian Lance Taylor  <iant@google.com>
10516
10517         PR 10860
10518         * options.h (class General_options): Add --warn-common.
10519         * resolve.cc (Symbol_table::resolve): Handle --warn-common when
10520         merging two common symbols.
10521         (Symbol_table::should_override): Handle --warn-common when merging
10522         a common symbol with a defined symbol.  Use report_resolve_problem
10523         for multiple definitions.
10524         (Symbol_table::report_resolve_problem): New function.
10525         * symtab.h (class Symbol_table): Declare report_resolve_problem.
10526
10527 2009-11-03  Doug Kwan  <dougkwan@google.com>
10528
10529         * arm.cc (Target_arm::Target_arm): Initialize stub_tables_ and
10530         stub_factory_.
10531         (Target_arm::stub_factory): New method definition.
10532         (Target_arm::new_arm_input_section,
10533         Target_arm::find_arm_input_section, Target_arm::new_stub_table,
10534         Target_arm::reloc_uses_thumb_bit): New method declarations.
10535         (Target_arm::Stub_table_list, Target_arm::Arm_input_section_map):
10536         New type definitions.
10537         (Target_arm::stub_tables_, Target_arm::stub_factory_): New data
10538         member declarations.
10539         (Target_arm::reloc_uses_thumb_bit, Target_arm::new_arm_input_section,
10540         Target_arm::find_arm_input_section, Target_arm::new_stub_table):
10541         New method definitions.
10542
10543 2009-11-03  Ian Lance Taylor  <iant@google.com>
10544
10545         * options.h (class General_options): Add --warn_constructors.
10546
10547 2009-11-03  Ian Lance Taylor  <iant@google.com>
10548
10549         PR 10893
10550         * defstd.cc (in_section): Add entries for __rel_iplt_start,
10551         __rel_iplt_end, __rela_iplt_start, __rela_iplt_end, and __stack.
10552
10553 2009-11-03  Ian Lance Taylor  <iant@google.com>
10554
10555         PR 10895
10556         * po/Make-in ($(srcdir)/$(PACKAGE).pot): Pass -C and
10557         --msgid-bugs-address.
10558         (install-pdf): New target.
10559         (install-data_yes): Look up one directory to find mkinstalldirs.
10560
10561 2009-11-03  H.J. Lu  <hongjiu.lu@intel.com>
10562
10563         * po/Make-in (.po.gmo): Don't generate .gmo files in source
10564         tree.
10565
10566 2009-10-30  Doug Kwan  <dougkwan@google.com>
10567
10568         * arm.cc (Stub_addend_reader): Fix bug in previouls check-in.
10569
10570 2009-10-30  Doug Kwan  <dougkwan@google.com>
10571
10572         * arm.cc (Stub_addend_reader): New struct template definition
10573         and partial specializations.
10574         (Stub_addend_reader::operator()): New method definition for a
10575         partially specialized template.
10576
10577 2009-10-30  Doug Kwan  <dougkwan@google.com>
10578
10579         * arm.cc (Arm_relobj::processor_specific_flags): New method
10580         definition.
10581         (Arm_relobj::do_read_symbols): New method declaration.
10582         (Arm_relobj::processor_specific_flags_): New data member declaration.
10583         (Arm_dynobj): New class definition.
10584         (Target_arm::do_finalize_sections): Add input_objects parameter.
10585         (Target_arm::do_adjust_elf_header): New method declaration.
10586         (Target_arm::are_eabi_versions_compatible,
10587         (Target_arm::merge_processor_specific_flags): New method declaration.
10588         (Target_arm::do_make_elf_object): New overloaded method definitions
10589         and declaration.
10590         (Arm_relobj::do_read_symbols): New method definition.
10591         (Arm_dynobj::do_read_symbols): Ditto.
10592         (Target_arm::do_finalize_sections): Add input_objects parameters.
10593         Merge processor-specific flags from all input objects.
10594         (Target_arm::are_eabi_versions_compatible,
10595         Target_arm::merge_processor_specific_flags,
10596         Target_arm::do_adjust_elf_header, Target_arm::do_make_elf_object):
10597         New method definitions.
10598         * i386.cc (Target_i386::do_finalize_sections): Add unnamed
10599         Input_objects pointer type parameter.
10600         * layout.cc (Layout::finalize): Pass input objects to target's.
10601         finalize_sections function.
10602         * output.cc (Output_file_header::do_sized_write): Set ELF file
10603         header's processor-specific flags.
10604         * powerpc.cc (Target_powerpc::do_finalize_sections): Add unnamed
10605         Input_objects pointer type parameter.
10606         * sparc.cc (Target_sparc::do_finalize_sections): Same.
10607         * target.h (Input_objects): New forward class declaration.
10608         (Target::processor_specific_flags,
10609         Target::are_processor_specific_flags_sect): New method definitions.
10610         (Target::finalize_sections): Add input_objects parameter.
10611         (Target::Target): Initialize processor_specific_flags_ and
10612         are_processor_specific_flags_set_.
10613         (Target::do_finalize_sections): Add unnamed Input_objects pointer type
10614         parameter.
10615         (Target::set_processor_specific_flags): New method definition.
10616         (Target::processor_specific_flags_,
10617         Target::are_processor_specific_flags_set_): New data member
10618         declarations.
10619         * x86_64.cc (Target_x86_64::do_finalize_sections): Add unnamed
10620         Input_objects pointer type parameter.
10621
10622 2009-10-30  Doug Kwan  <dougkwan@google.com>
10623
10624         * arm.cc: Use Arm_address instead of elfcpp::Elf_types<32>::Elf_Addr.
10625
10626 2009-10-28  Ian Lance Taylor  <iant@google.com>
10627
10628         * object.h (class Relobj): Drop options parameter from
10629         gc_process_relocs, scan_relocs, relocate, do_gc_process_relocs,
10630         do_scan_relocs, do_relocate.  Change all callers.
10631         (class Sized_relobj): Drop options parameters from
10632         do_gc_process_relocs, do_scan_relocs, do_relocate,
10633         do_relocate_sections, relocate_sections, emit_relocs_scan,
10634         emit_relocs_scan_reltype.  Change all callers.
10635         (struct Relocate_info): Remove options field and all references to
10636         it.
10637         * reloc.h (class Read_relocs): Remove options constructor
10638         parameter and options_ field.  Change all callers.
10639         (class Gc_process_relocs, class Scan_relocs): Likewise.
10640         (class Relocate_task): Likewise.
10641         * target-reloc.h (scan_relocs): Remove options parameter.  Change
10642         all callers.
10643         (scan_relocatable_relocs): Likewise.
10644         * target.h (class Sized_target): Remove options parameter from
10645         gc_process_relocs, scan_relocs, scan_relocatable_relocs.  Change
10646         all callers.
10647         * gc.h (gc_process_relocs): Remove options parameter.  Change all
10648         callers.
10649         * arm.cc: Update functions to remove options parameters.
10650         * i386.cc: Likewise.
10651         * powerpc.cc: Likewise.
10652         * sparc.cc: Likewise.
10653         * x86_64.cc: Likewise.
10654         * testsuite/testfile.cc: Likewise.
10655
10656 2009-10-28  Doug Kwan  <dougkwan@google.com>
10657
10658         * arm.cc (Arm_relobj): New class definition.
10659         (Arm_relobj::scan_sections_for_stubs,
10660         Arm_relobj::do_count_local_symbols, Arm_relobj::do_relocate_sections):
10661         New method definitions.
10662
10663 2009-10-28  Cary Coutant  <ccoutant@google.com>
10664
10665         * plugin.h (Plugin::Plugin): Initialize cleanup_done_.
10666         (Plugin::cleanup_done_): New member.
10667         (Plugin_manager::Plugin_manager): Remove cleanup_done_.
10668         (Plugin_manager::cleanup_done_): Remove.
10669         (Plugin_manager::add_input_file): Edit error message.
10670         * plugin.cc (Plugin::cleanup): Test and set cleanup_done_.
10671         (Plugin_manager::cleanup): Remove use of cleanup_done_.
10672
10673 2009-10-27  Mikolaj Zalewski  <mikolajz@google.com>
10674
10675         * fileread.cc: (File_read::View::~View): Use the new
10676         data_ownership_ filed.
10677         (File_read::~File_read): Dispose the new whole_file_view_.
10678         (File_read::open): Mmap the whole file if needed.
10679         (File_read::open): Use whole_file_view_ instead of contents_.
10680         (File_read::find_view): Use whole_file_view_ if applicable.
10681         (File_read::do_read): Use whole_file_view_ instead of contents_.
10682         (File_read::make_view): Use whole_file_view_ instead of contents_,
10683         update File_read::View::View call.
10684         (File_read::find_or_make_view): Update File_read::View::View
10685         call.
10686         * fileread.h: (File_read::File_read): Initialize whole_file_view_,
10687         remove contents_
10688         (File_read::View::Data_ownership): New enum.
10689         (File_read::View::View): Replace bool mapped_ with Data_ownership
10690         argument.
10691         (File_read::View::mapped_): Remove (replaced by data_ownership_).
10692         (File_read::View::data_ownership_): New field.
10693         (File_read::contents_): Remove (replaced by whole_file_view_).
10694         (File_read::whole_file_view_): New field.
10695         * options.h (class General_options): Add --keep-files-mapped.
10696
10697 2009-10-27  Cary Coutant  <ccoutant@google.com>
10698
10699         * symtab.cc (add_from_pluginobj): Pass correct value for is_ordinary.
10700         * testsuite/Makefile.am (plugin_test_5): New test case.
10701         * testsuite/Makefile.in: Regenerate.
10702
10703 2009-10-25  Doug Kwan  <dougkwan@google.com>
10704
10705         * object.h (Sized_relobj::View_size, Sized_relobj::Views): Change
10706         from private to protected to allow access by child class.
10707         (Sized_relobj::do_relocate_sections): New method declaration.
10708         (Sized_relobj::relocate_sections): Virtualize.
10709         * reloc.cc (Sized_relobj::do_relocate_sections): Rename from
10710         Sized_relobj::relocate_sections.  Instantiate template explicitly
10711         for different target sizes and endianity.
10712
10713 2009-10-24  Doug Kwan  <dougkwan@google.com>
10714
10715         * arm.cc (Arm_output_section, Arm_relobj): Forward class declarations.
10716         (Arm_input_section::as_arm_input_section): New method.
10717         (Arm_output_section): New class definition.
10718         (Arm_output_section::create_stub_group,
10719         Arm_output_section::group_sections): New method definitions.
10720
10721 2009-10-22  Doug Kwan  <dougkwan@google.com>
10722
10723         * arm.cc (Arm_input_section): New class definition.
10724         (Arm_input_section::init, Arm_input_section:do_write,
10725         Arm_input_section::set_final_data_size,
10726         Arm_input_section::do_reset_address_and_file_offset): New method
10727         definitions.
10728
10729 2009-10-21  Doug Kwan  <dougkwan@google.com>
10730
10731         * arm.cc (Stub_table, Arm_input_section): New forward class
10732         declarations.
10733         (Stub_table): New class defintion.
10734         (Stub_table::add_reloc_stub, Stub_table::relocate_stubs
10735         Stub_table::do_reset_address_and_file_offset, Stub_table::do_write):
10736         New method definition.
10737
10738 2009-10-21  Doug Kwan  <dougkwan@google.com>
10739
10740         * arm.cc: Update copyright comments.
10741         (Target_arm): New forward class template declaration.
10742         (Arm_address): New type.
10743         (ARM_MAX_FWD_BRANCH_OFFSET, ARM_MAX_BWD_BRANCH_OFFSET,
10744         THM_MAX_FWD_BRANCH_OFFSET, THM_MAX_BWD_BRANCH_OFFSET,
10745         THM2_MAX_FWD_BRANCH_OFFSET, THM2_MAX_BWD_BRANCH_OFFSET): New
10746         constants.
10747         (Insn_template): Same.
10748         (DEF_STUBS): New macro.
10749         (Stub_type): New enum type.
10750         (Stub_template): New class definition.
10751         (Stub): Same.
10752         (Reloc_stub): Same.
10753         (Stub_factory): Same.
10754         (Target_arm::Target_arm): Initialize may_use_blx_ and
10755         should_force_pic_veneer_.
10756         (Target_arm::may_use_blx, Target_arm::set_may_use_blx,
10757         Target_arm::should_force_pic_veneer,
10758         Target_arm::set_should_force_pic_veneer, Target_arm::using_thumb2,
10759         Target_arm::using_thumb_only, Target_arm:;default_target): New
10760         method defintions.
10761         (Target_arm::may_use_blx_, Target_arm::should_force_pic_veneer_):
10762         New data member declarations.
10763         (Insn_template::size, Insn_template::alignment): New method defintions.
10764         (Stub_template::Stub_template): New method definition.
10765         (Reloc_stub::Key::name, Reloc_stub::stub_type_for_reloc,
10766         Reloc_stub::do_fixed_endian_write, Reloc_stub::do_write): Same.
10767         (Stub_factory::Stub_factory): New method definition.
10768         * gold.h (string_hash): New template.
10769         * output.h (Input_section_specifier::hash_value): Use
10770         gold::string_hash.
10771         (Input_section_specifier::string_hash): Remove.
10772         * stringpool.cc (Stringpool_template::string_hash): Use
10773         gold::string_hash.
10774
10775 2009-10-20  Doug Kwan  <dougkwan@google.com>
10776
10777         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle section
10778         symbols of relaxed input sections.
10779         * output.h (Output_section::find_relaxed_input_section): Make
10780         method public.
10781
10782 2009-10-16  Doug Kwan  <dougkwan@google.com>
10783
10784         * dynobj.cc (Versions::Versions): Initialize version_script_.
10785         Only insert base version symbol definition for a shared object
10786         if version script defines any version versions.
10787         (Versions::define_base_version): New method definition.
10788         (Versions::add_def): Check that base version is not needed.
10789         (Versions::add_need): Define base version lazily.
10790         * dynobj.h (Versions::define_base_version): New method declaration.
10791         (Versions::needs_base_version_): New data member declaration.
10792         * testsuite/Makefile.am (check_SCRIPTS): Add no_version_test.sh
10793         (check_DATA): Add no_version_test.stdout.
10794         (libno_version_test.so, no_version_test.o no_version_test.stdout):
10795         New make rules.
10796         * testsuite/Makefile.in: Regenerate.
10797         * testsuite/no_version_test.c: New file.
10798         * testsuite/no_version_test.sh: Ditto.
10799
10800 2009-10-16  Doug Kwan  <dougkwan@google.com>
10801
10802         * expression.cc (class Segment_start_expression): New class definition.
10803         (Segment_start_expression::value): New method definition.
10804         (script_exp_function_segment_start): Return a new
10805         Segment_start_expression.
10806         * gold/script-c.h (script_saw_segment_start_expression): New function
10807         prototype.
10808         * script-sections.cc (Script_sections::Script_sections): Initialize
10809         SAW_SEGMENT_START_EXPRESSION_ to false.
10810         (Script_sections::set_section_addresses): Use -Ttext, -Tdata
10811         and -Tbbs options to specify section addresses if given in
10812         command line and no SEGMENT_START expression is seen in a script.
10813         * script-sections.h (Script_sections::saw_segment_start_expression,
10814         Script_sections::set_saw_segment_start_expression): New method
10815         definition.
10816         (Script_sections::saw_segment_start_expression_): New data member
10817         declaration.
10818         * script.cc (script_saw_segment_start_expression): New function.
10819         * yyscript.y (SEGMENT_START): Call script_saw_segment_start_expression.
10820         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_6.sh,
10821         script_test_7.sh and script_test_8.sh.
10822         (check_DATA): Add script_test_6.stdout, script_test_7.stdout and
10823         script_test_8.stdout.
10824         (MOSTLYCLEANFILES): Add script_test_6, script_test_7 and script_test_8.
10825         (script_test_6, script_test_6.stdout, script_test_7,
10826         script_test_7.stdout, script_test_8, script_test_8.stdout): New rules.
10827         * Makefile.in: Regenerate.
10828         * testsuite/script_test_6.sh: New file.
10829         * testsuite/script_test_6.t: Same.
10830         * testsuite/script_test_7.sh: Same.
10831         * testsuite/script_test_7.t: Same.
10832         * testsuite/script_test_8.sh: Same.
10833
10834 2009-10-16  Doug Kwan  <dougkwan@google.com>
10835
10836         * output.cc (Output_segment::set_section_list_address): Cast
10837         expressions to unsigned long long type to avoid format warnings.
10838
10839 2009-10-15  Ian Lance Taylor  <iant@google.com>
10840
10841         * script.cc (Script_options::add_symbol_assignment): Always add a
10842         dot assignment to script_sections_.
10843         * script-sections.cc (Script_sections::add_dot_assignment):
10844         Initialize if necessary.
10845
10846         * layout.cc (Layout::relaxation_loop_body): Don't crash if we see
10847         program headers with no load segment if there is a linker script.
10848
10849         * layout.cc (Layout::set_segment_offsets): Align the file offset
10850         to the segment aligment for -N or -n with no load segment.
10851         * output.cc (Output_segment::add_output_section): Don't crash if
10852         the first section is a TLS section.
10853         (Output_segment::set_section_list_addresses): Print an error
10854         message if the address moves backward in a linker script.
10855         * script-sections.cc
10856         (Output_section_element_input::set_section_addresses): Don't
10857         increase *dot_value for a SHF_TLS/SHT_NOBITS section.
10858         (Orphan_output_section::set_section_addresses): Likewise.
10859
10860 2009-10-15  Doug Kwan  <dougkwan@google.com>
10861
10862         * layout.cc (Layout::finish_dynamic_section): Generate tags
10863         DT_FINI_ARRAY, DT_FINI_ARRAYSZ, DT_INIT_ARRAY, DT_INIT_ARRAYSZ,
10864         DT_PREINIT_ARRAY, DT_PREINIT_ARRAYSZ as needed. If -Bsymbolic is
10865         used, add DT_SYMBOLIC and set DF_SYMBOLIC in DT_FLAGS.
10866
10867 2009-10-14  Ian Lance Taylor  <iant@google.com>
10868
10869         * object.h (class Relocate_info): Add reloc_shdr and data_shdr
10870         fields.
10871         * object.cc (Sized_relobj::relocate_sections): Set reloc_shdr and
10872         data_shdr fields of relinfo.
10873         * i386.cc (class Target_i386::Relocate): Remove ldo_addrs_ field.
10874         (Target_i386::Relocate::relocate_tls): Don't call fix_up_ldo.  For
10875         R_386_TLS_LDO_32, adjust based on section flags.
10876         (Target_i386::Relocate::fix_up_ldo): Remove.
10877
10878 2009-10-13  Ian Lance Taylor  <iant@google.com>
10879
10880         Add support for -pie.
10881         * options.h (class General_options): Add -pie and
10882         --pic-executable.
10883         (General_options::output_is_position_independent): Test -pie.
10884         (General_options::output_is_executable): Return true if not shared
10885         and not relocatable.
10886         (General_options::output_is_pie): Remove.
10887         * options.cc (General_options::finalize): Reject incompatible uses
10888         of -pie.
10889         * gold.cc (queue_middle_tasks): A -pie link is not static.
10890         * symtab.h (Symbol::needs_plt_entry): Return false if -pie.
10891         * symtab.cc (Symbol::final_value_is_known): Return false if
10892         output_is_position_independent.
10893         * layout.cc (Layout::set_segment_offsets): Start at address 0 if
10894         output_is_position_independent.
10895         * output.cc (Output_file_header::do_sized_write): Use ET_DYN if
10896         output_is_position_independent.
10897         * i386.cc (Output_data_plt_i386::do_write): Use the PIC PLT if
10898         output_is_position_independent.
10899         * testsuite/Makefile.am (check_PROGRAMS): Add basic_pie_test and
10900         two_file_pie_test.
10901         (basic_pie_test.o, basic_pie_test): New targets.
10902         (two_file_test_1_pie.o, two_file_test_1b_pie.o): New targets.
10903         (two_file_test_2_pie.o, two_file_test_main_pie.o): New targets.
10904         (two_file_pie_test): New target.
10905         * testsuite/Makefile.in: Rebuild.
10906         * README: Remove note saying that -pie is not supported.
10907
10908 2009-10-13  Bernhard Reutner-Fischer  <aldot@gcc.gnu.org>
10909
10910         * options.h (class General_options): Add -init and -fini.
10911         * layout.cc (Layout::finish_dynamic_section): Emit
10912         given init and fini functions.
10913
10914 2009-10-13  Sriraman Tallam  <tmsriram@google.com>
10915
10916         * gc.h (gc_process_relocs): Check if icf is enabled using new
10917         function.
10918         * gold.cc (queue_initial_tasks): Likewise.
10919         (queue_middle_tasks): Likewise.
10920         * object.cc (do_layout): Likewise.
10921         * symtab.cc (is_section_folded): Likewise.
10922         * main.cc (main): Likewise.
10923         * reloc.cc (Read_relocs::run): Likewise.
10924         (Sized_relobj::do_scan_relocs): Likewise.
10925         * icf.cc (is_function_ctor_or_dtor): New function.
10926         (Icf::find_identical_sections): Check if function is ctor or dtor when
10927         safe icf is chosen.
10928         * options.h (General_options::icf): Change option to be an enum.
10929         (Icf_status): New enum.
10930         (icf_enabled): New method.
10931         (icf_safe_folding): New method.
10932         (set_icf_status): New method.
10933         (icf_status_): New variable.
10934         * (options.cc) (General_options::finalize): Set icf_status_.
10935         * testsuite/Makefile.am: Add commands to build icf_safe_test. Modify
10936         icf_test and icf_keep_unique_test to use the --icf enum flag.
10937         * testsuite/icf_safe_test.sh: New file.
10938         * testsuite/icf_safe_test.cc: New file.
10939
10940 2009-10-12  Sriraman Tallam  <tmsriram@google.com>
10941
10942         * symtab.h: Check for GOLD_SYMTAB_H before header includes. Remove
10943         includes to gc.h and icf.h.
10944         * arm.cc: Include gc.h.
10945         * gold.cc: Likewise.
10946         * i386.cc: Likewise.
10947         * powerpc.cc: Likewise.
10948         * sparc.cc: Likewise.
10949         * x86_64.cc: Likewise.
10950         * gc.h: Include icf.h.
10951
10952 2009-10-11  Ian Lance Taylor  <iant@google.com>
10953
10954         * plugin.cc: Include "gold.h" before other header files.
10955
10956 2009-10-10  Chris Demetriou  <cgd@google.com>
10957
10958         * options.h (Input_file_argument::Input_file_type): New enum.
10959         (Input_file_argument::is_lib_): Replace with...
10960         (Input_file_argument::type_): New member.
10961         (Input_file_argument::Input_file_argument): Take Input_file_type
10962         'type' rather than boolean 'is_lib' as second argument.
10963         (Input_file_argument::is_lib): Use type_.
10964         (Input_file_argument::is_searched_file): New function.
10965         (Input_file_argument::may_need_search): Handle is_searched_file.
10966         * options.cc (General_options::parse_library): Support -l:filename.
10967         (General_options::parse_just_symbols): Update for Input_file_argument
10968         changes.
10969         (Command_line::process): Likewise.
10970         * archive.cc (Archive::get_file_and_offset): Likewise.
10971         * plugin.cc (Plugin_manager::release_input_file): Likewise.
10972         * script.cc (read_script_file, script_add_file): Likewise.
10973         * fileread.cc (Input_file::Input_file): Likewise.
10974         (Input_file::will_search_for): Handle is_searched_file.
10975         (Input_file::open): Likewise.
10976         * readsyms.cc (Read_symbols::get_name): Likewise.
10977         * testsuite/Makefile.am (searched_file_test): New test.
10978         * testsuite/Makefile.in: Regenerate.
10979         * testsuite/searched_file_test.cc: New file.
10980         * testsuite/searched_file_test_lib.cc: New file.
10981
10982 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10983             Ian Lance Taylor  <iant@google.com>
10984
10985         * descriptor.cc: Include <cstdio> and "binary-io.h".
10986         (Descriptors::open): Open the files in binary mode always.
10987         * script.cc (Lex::get_token): Treat \r as whitespace.
10988
10989 2009-10-09  Ian Lance Taylor  <iant@google.com>
10990
10991         * testsuite/retain_symbols_file_test.sh: Don't test for __tcf_0.
10992
10993 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
10994             Ian Lance Taylor  <iant@google.com>
10995
10996         * configure.ac: Check for readv function also.
10997         * fileread.cc (readv): Define if not HAVE_READV.
10998         * fileread.h (File_read:: max_readv_entries): Set to 1 if readv
10999         does not exist.
11000         * config.in: Regenerate.
11001         * configure: Regenerate.
11002
11003 2009-10-09  Doug Kwan  <dougkwan@google.com>
11004
11005         * layout.cc (Layout::make_output_section): Call target hook to make
11006         ordinary output section.
11007         (Layout::finalize): Adjust parameter list of call the
11008         Target::may_relax().
11009         * layout.h (class Layout::section_list): New method.
11010         * merge.h (Output_merge_base::entsize): Change visibility to public.
11011         (Output_merge_base::is_string, Output_merge_base::do_is_string):
11012         New methods.
11013         (Output_merge_string::do_is_string): New method.
11014         * object.cc (Sized_relobj::do_setup): renamed from
11015         Sized_relobj::set_up.
11016         * object.h (Sized_relobj::adjust_shndx,
11017         Sized_relobj::initializ_input_to_output_maps,
11018         Sized_relobj::free_input_to_output_maps): Change visibilities to
11019         protected.
11020         (Sized_relobj::setup): Virtualize.
11021         (Sized_relobj::do_setup): New method declaration.
11022         (Sized_relobj::invalidate_section_offset,
11023         Sized_relobj::do_invalidate_section_offset): New method decfinitions.
11024         (Sized_relobj::elf_file, Sized_relobj::local_values): New methods.
11025         * options.cc (parse_int): New function.
11026         * options.h (parse_int): New declaration.
11027         (DEFINE_int): New macro.
11028         (stub_group_size): New option.
11029         * output.cc (Output_section::Output_section): Initialize memebers
11030         merge_section_map_, merge_section_by_properties_map_,
11031         relaxed_input_section_map_, is_relaxed_input_section_map_valid_.
11032         (Output_section::add_input_section): Handled deferred code-fill
11033         generation and remove an old comment.
11034         (Output_section::add_relaxed_input_section): New method definition.
11035         (Output_section::add_merge_input_section): Use merge section by
11036         properties map to speed to search.  Update merge section maps
11037         as appropriate.
11038         (Output_section::build_relaxation_map): New method definition.
11039         (Output_section::convert_input_sections_in_list_to_relaxed_sections):
11040         Same.
11041         (Output_section::relax_input_section): Renamed to
11042         Output_section::convert_input_sections_to_relaxed_sections and change
11043         interface to take a vector of pointers to relaxed sections.
11044         (Output_section::find_merge_section,
11045         Output_section::find_relaxed_input_section): New method definitions.
11046         (Output_section::is_input_address_mapped,
11047         Output_section::output_offset, Output_section::output_address):
11048         Use output section data maps to speed up searching.
11049         (Output_section::find_starting_output_address): Add comments.
11050         (Output_section::do_write,
11051         Output_section::write_to_postprocessing_buffer): Do code-fill
11052         generation as appropriate.
11053         (Output_section::get_input_sections): Invalidate relaxed input section
11054         map.
11055         (Output_section::restore_states): Adjust type of checkpoint .
11056         Invalidate relaxed input section map.
11057         * output.h (Output_merge_base): New class declaration.
11058         (Input_section_specifier): New class defintion.
11059         (class Output_relaxed_input_section) Change base class to
11060         Output_section_data_build.
11061         (Output_relaxed_input_section::Output_relaxed_input_section): Adjust
11062         base class initializer.
11063         (Output_section::add_relaxed_input_section): New method declaration.
11064         (Output_section::Input_section): Change visibility to protected.
11065         (Output_section::Input_section::relobj,
11066         Output_section::Input_section::shndx): Handle relaxed input sections.
11067         Output_section::input_sections) Change visibility to protected.  Also
11068         define overload to return a non-const pointer.
11069         (Output_section::Merge_section_properties): New class defintion.
11070         (Output_section::Merge_section_by_properties_map,
11071         Output_section::Output_section_data_by_input_section_map,
11072         Output_section::Relaxation_map): New types.
11073         (Output_section::relax_input_section): Rename method to
11074         Output_section::convert_input_sections_to_relaxed_sections and change
11075         interface to take a vector of relaxed section pointers.
11076         (Output_section::find_merge_section,
11077         Output_section::find_relaxed_input_section,
11078         Output_section::build_relaxation_map,
11079         Output_section::convert_input_sections_in_list_to_relaxed_sections):
11080         New method declarations.
11081         (Output_section::merge_section_map_
11082         Output_section::merge_section_by_properties_map_,
11083         Output_section::relaxed_input_section_map_,
11084         Output_section::is_relaxed_input_section_map_valid_,
11085         Output_section::generate_code_fills_at_write_): New data members.
11086         * script-sections.cc
11087         (Output_section_element_input::set_section_addresses): Call
11088         current_data_size and addralign methods of relaxed input sections.
11089         (Orphan_output_section::set_section_addresses): Call current_data_size
11090         and addralign methods of relaxed input sections.
11091         * symtab.cc (Symbol_table::compute_final_value): Extract template
11092         from the body of Symbol_table::sized_finalize_symbol.
11093         (Symbol_table::sized_finalized_symbol): Call
11094         Symbol_table::compute_final_value.
11095         * symtab.h (Symbol_table::Compute_final_value_status): New enum type.
11096         (Symbol_table::compute_final_value): New templated method declaration.
11097         * target.cc (Target::do_make_output_section): New method defintion.
11098         * target.h (Target::make_output_section): New method declaration.
11099         (Target::relax): Add more parameters for input objects, symbol table
11100         and layout.  Adjust call to do_relax.
11101         (Target::do_make_output_section): New method declaration.
11102         (Target::do_relax): Add parameters for input objects, symbol table
11103         and layout.
11104
11105 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11106
11107         * pread.c: Include stdio.h.
11108
11109 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11110
11111         * plugin.cc: Don't include dlfcn.h when ENABLE_PLUGINS is not
11112         defined.
11113
11114 2009-10-09  Andrew Pinski  <andrew_pinski@playstation.sony.com>
11115
11116         * dwarf_reader.cc (Sized_dwarf_line_info::Sized_dwarf_line_info):
11117         Change read_shndx type to unsigned int.
11118         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11119         int.
11120         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11121         * dwarf_reader.h (Sized_dwarf_line_info::Sized_dwarf_line_info):
11122         Change read_shndx type to unsigned int.
11123         (Sized_dwarf_line_info::read_lines): Change shndx type to unsigned
11124         int.
11125         (Sized_dwarf_line_info::read_line_mappings): Likewise.
11126         * layout.cc (Layout::create_symtab_sections): Cast the result of
11127         local_symcount * symsize to off_t in the gold_assert.
11128
11129 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11130
11131         * arm.cc (Target_arm::relocate::reloc_is_non_pic): Return true for
11132         R_ARM_THM_ABS5, R_ARM_ABS8, R_ARM_ABS12, R_ARM_ABS16,
11133         R_ARM_BASE_ABS.
11134         (Arm_relocate_functions::abs8): Remove has_thumb_bit parameter.
11135         (Arm_relocate_functions::thm_abs5): New function.
11136         (Arm_relocate_functions::abs12): New function.
11137         (Arm_relocate_functions::abs16): New function.
11138         (Arm_relocate_functions::base_abs): New function.
11139         (Scan::check_non_pic): Handle R_ARM_ABS32_NOI.
11140         (Scan::local): Remove special handling of R_ARM_ABS8.  Handle
11141         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, R_ARM_ABS12, R_ARM_ABS16, and
11142         R_ARM_BASE_ABS.
11143         (Scan::global): Likewise.
11144         (Relocate::relocate): Handle R_ARM_ABS12, R_ARM_ABS16,
11145         R_ARM_ABS32_NOI, R_ARM_THM_ABS5, and R_ARM_BASE_ABS.
11146         (Relocatable_size_for_reloc::get_size_for_reloc): Handle
11147         R_ARM_ABS16, R_ARM_THM_ABS5, R_ARM_ABS32_NOI, R_ARM_ABS12, and
11148         R_ARM_BASE_ABS.
11149
11150 2009-10-09  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11151
11152         * arm.cc (Arm_relocate_functions::movw_prel_nc): New function.
11153         (Arm_relocate_functions::movt_prel): New function.
11154         (Arm_relocate_functions::thm_movw_prel_nc): New function.
11155         (Arm_relocate_functions::thm_movt_prel): New function.
11156         (Scan::local): Handle R_ARM_MOVW_PREL_NC, R_ARM_MOVT_PREL,
11157         R_ARM_THM_MOVW_PREL_NC, and R_ARM_THM_MOVT_PREL.
11158         (Scan::global, Relocate::relocate): Likewise.
11159         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11160
11161 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11162
11163         * gold.cc: (queue_initial_tasks): Pass incremental_inputs to
11164         Incremental_checker.
11165         * incremental.cc: (INCREMENTAL_LINK_VERSION): Change type to
11166         unsigned int.
11167         (class Incremental_inputs_header): New class.
11168         (Incremental_inputs_header_writer): Edit comment.
11169         (Incremental_inputs_entry): New class.
11170         (Incremental_inputs_entry_writer): Edit comment.
11171         (Sized_incremental_binary::do_find_incremental_inputs_section):
11172         Add *strtab_shndx parameter, fill it.
11173         (Sized_incremental_binary::do_check_inputs): New method.
11174         (Incremental_checker::can_incrementally_link_output_file): Use
11175         Sized_incremental_binary::check_inputs.
11176         (Incremental_inputs::report_command_line): Save command line in
11177         command_line_.
11178         * incremental.h:
11179         (Incremental_binary::find_incremental_inputs_section): New
11180         method.
11181         (Incremental_binary::do_find_incremental_inputs_section): Add
11182         strtab_shndx parameter.
11183         (Incremental_binary::do_check_inputs): New pure virtual method.
11184         (Sized_incremental_binary::do_check_inputs): Declare.
11185         (Incremental_checker::Incremental_checker): Add incremental_inputs
11186         parameter, use it to initialize incremental_inputs_.
11187         (Incremental_checker::incremental_inputs_): New field.
11188         (Incremental_checker::command_line): New method.
11189         (Incremental_checker::inputs): New method.
11190         (Incremental_checker::command_line_): New field.
11191
11192 2009-10-09  Mikolaj Zalewski  <mikolajz@google.com>
11193
11194         * incremental.cc: Include <cstdarg> and "target-select.h".
11195         (vexplain_no_incremental): New function.
11196         (explain_no_incremental): New function.
11197         (Incremental_binary::error): New method.
11198         (Sized_incremental_binary::do_find_incremental_inputs_section): New
11199         method.
11200         (make_sized_incremental_binary): New function.
11201         (open_incremental_binary): New function.
11202         (can_incrementally_link_file): Add checks if output is ELF and has
11203         inputs section.
11204         * incremental.h: Include "elfcpp_file.h" and "output.h".
11205         (Incremental_binary): New class.
11206         (Sized_incremental_binary): New class.
11207         (open_incremental_binary): Declare.
11208         * object.cc (is_elf_object): Use
11209         elfcpp::Elf_recognizer::is_elf_file.
11210         (make_elf_object): Use elfcpp::Elf_recognizer::is_valid_header.
11211         * output.h (Output_file::filesize): New method.
11212
11213 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11214
11215         * arm.cc (Arm_relocate_functions::extract_arm_movw_movt_addend):
11216         New function.
11217         (Arm_relocate_functions::insert_val_arm_movw_movt): New function.
11218         (Arm_relocate_functions::extract_thumb_movw_movt_addend): New
11219         function.
11220         (Arm_relocate_functions::insert_val_thumb_movw_movt): New
11221         function.
11222         (Arm_relocate_functions::movw_abs_nc): New function.
11223         (Arm_relocate_functions::movt_abs): New function.
11224         (Arm_relocate_functions::thm_movw_abs_nc): New function.
11225         (Arm_relocate_functions::thm_movt_abs): New function.
11226         (Scan::local): Handle R_ARM_MOVW_ABS_NC, R_ARM_MOVT_ABS,
11227         R_ARM_THM_MOVW_ABS_NC, R_ARM_THM_MOVT_ABS.
11228         (Scan::global): Likewise.
11229         (Relocate::relocate): Likewise.
11230         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11231
11232 2009-10-07  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11233
11234         * arm.cc (Arm_relocate_functions::got_prel) New function.
11235         (Scan::local, Scan::global): Handle R_ARM_GOT_PREL.
11236         (Relocate::relocate): Likewise.
11237         (Relocatable_size_for_reloc::get_size_for_reloc): Likewise.
11238
11239 2009-10-06  Ian Lance Taylor  <iant@google.com>
11240
11241         * options.h (class General_options): Define
11242         split_stack_adjust_size parameter.
11243         * object.h (class Object): Add uses_split_stack_ and
11244         has_no_split_stack_ fields.  Add uses_split_stack and
11245         has_no_split_stack accessor functions.  Declare
11246         handle_split_stack_section.
11247         (class Reloc_symbol_changes): Define.
11248         (class Sized_relobj): Define Function_offsets.  Declare
11249         split_stack_adjust, split_stack_adjust_reltype, and
11250         find_functions.
11251         * object.cc (Object::handle_split_stack_section): New function.
11252         (Sized_relobj::do_layout): Call handle_split_stack_section.
11253         * dynobj.cc (Sized_dynobj::do_layout): Call
11254         handle_split_stack_section.
11255         * reloc.cc (Sized_relobj::relocate_sections): Call
11256         split_stack_adjust for executable sections in split_stack
11257         objects.  Pass reloc_map to relocate_section.
11258         (Sized_relobj::split_stack_adjust): New function.
11259         (Sized_relobj::split_stack_adjust_reltype): New function.
11260         (Sized_relobj::find_functions): New function.
11261         * target-reloc.h: Include "object.h".
11262         (relocate_section): Add reloc_symbol_changes parameter.  Change
11263         all callers.
11264         * target.h (class Target): Add calls_non_split method.  Declare
11265         do_calls_non_split virtual method.  Declare match_view and
11266         set_view_to_nop.
11267         * target.cc: Include "elfcpp.h".
11268         (Target::do_calls_non_split): New function.
11269         (Target::match_view): New function.
11270         (Target::set_view_to_nop): New function.
11271         * gold.cc (queue_middle_tasks): Give an error if mixing
11272         split-stack and non-split-stack objects with -r.
11273         * i386.cc (Target_i386::relocate_section): Add
11274         reloc_symbol_changes parameter.
11275         (Target_i386::do_calls_non_split): New function.
11276         * x86_64.cc (Target_x86_64::relocate_section): Add
11277         reloc_symbol_changes parameter.
11278         (Target_x86_64::do_calls_non_split): New function.
11279         * arm.cc (Target_arm::relocate_section): Add reloc_symbol_changes
11280         parameter.
11281         * powerpc.cc (Target_powerpc::relocate_section): Add
11282         reloc_symbol_changes parameter.
11283         * sparc.cc (Target_sparc::relocate_section): Add
11284         reloc_symbol_changes parameter.
11285         * configure.ac: Call AM_CONDITIONAL for the default target.
11286         * configure: Rebuild.
11287         * testsuite/Makefile.am (TEST_AS): New variable.
11288         (check_SCRIPTS): Add split_i386.sh and split_x86_64.sh.
11289         (check_DATA): Add split_i386 and split_x86_64 files.
11290         (SPLIT_DEFSYMS): Define.
11291         (split_i386_[1234n].o): New targets.
11292         (split_i386_[124]): New targets.
11293         (split_i386_[1234r].stdout): New targets.
11294         (split_x86_64_[1234n].o): New targets.
11295         (split_x86_64_[124]): New targets.
11296         (split_x86_64_[1234r].stdout): New targets.
11297         (MOSTLYCLEANFILES): Add new executables.
11298         * testsuite/split_i386.sh: New file.
11299         * testsuite/split_x86_64.sh: New file.
11300         * testsuite/split_i386_1.s: New file.
11301         * testsuite/split_i386_2.s: New file.
11302         * testsuite/split_i386_3.s: New file.
11303         * testsuite/split_i386_4.s: New file.
11304         * testsuite/split_i386_n.s: New file.
11305         * testsuite/split_x86_64_1.s: New file.
11306         * testsuite/split_x86_64_2.s: New file.
11307         * testsuite/split_x86_64_3.s: New file.
11308         * testsuite/split_x86_64_4.s: New file.
11309         * testsuite/split_x86_64_n.s: New file.
11310         * testsuite/testfile.cc (Target_test): Update relocation_section
11311         function.
11312         * testsuite/Makefile.in: Rebuild.
11313
11314 2009-10-06  Ian Lance Taylor  <iant@google.com>
11315
11316         * i386.cc (class Target_i386::Relocate): Add ldo_addrs_ field.
11317         (Target_i386::Relocate::relocate_tls): Call fix_up_ldo before
11318         changing local_dynamic_type_ from LOCAL_DYNAMIC_NONE.  When
11319         handling R_386_TLS_LDO_32, if local_dynamic_type_ is NONE, push
11320         the address on ldo_addrs_.
11321         (Target_i386::Relocate::fix_up_ldo): New function.
11322
11323 2009-10-06   Rafael Espindola  <espindola@google.com>
11324
11325         * plugin.cc (add_input_library): New.
11326         (Plugin::load): Add add_input_library to tv.
11327         (Plugin_manager::add_input_file): Add the is_lib argument.
11328         (add_input_file): Update call to Plugin_manager::add_input_file.
11329         (add_input_library): New.
11330         * plugin.h (Plugin_manager::add_input_file): Add the is_lib argument.
11331
11332 2009-09-30  Doug Kwan  <dougkwan@google.com>
11333
11334         * arm.cc (Target_arm::may_need_copy_reloc): Check for THUMB function
11335         symbol and call Symbol::may_need_copy_reloc to determine if
11336         a copy reloc is needed.
11337         * copy-relocs.cc (Copy_relocs::need_copy_reloc): Return false if -z
11338         nocopyreloc is given in command line.
11339         (Copy_relocs::emit_copy_reloc): Assert that -z nocopyreloc is not
11340         given in command line.
11341         * i386.cc (Target_i386::may_need_copy_reloc): Remove.
11342         (Target_i386::Scan::global): Use Symbol::may_need_copy_reloc instead
11343         of the removed Target_i386::may_need_copy_reloc.
11344         * options.h (copyreloc): New option with default value false.
11345         * powerpc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11346         (Target_powerpc::Scan::global): Use Symbol::may_need_copy_reloc
11347         instead of the removed Target_powerpc::may_need_copy_reloc.
11348         * sparc.cc (Target_powerpc::may_need_copy_reloc): Remove.
11349         (Target_sparc::Scan::global): Use Symbol::may_need_copy_reloc
11350         instead of the removed Target_sparc::may_need_copy_reloc.
11351         * symtab.h (Symbol::may_need_copy_reloc): New method definition.
11352         * x86_64.cc (Target_powerpc::may_need_copy_reloc): Remove.
11353         (Target_x86_64::Scan::global): Use Symbol::may_need_copy_reloc
11354         instead of the removed Target_x86_64::may_need_copy_reloc.
11355
11356 2009-09-30  Ian Lance Taylor  <iant@google.com>
11357
11358         * object.h (class Object): Remove target_ field, and target,
11359         sized_target, and set_target methods.
11360         (Object::sized_target): Remove.
11361         (class Sized_relobj): Update declarations.  Remove sized_target.
11362         * object.cc (Sized_relobj::setup): Remove target parameter.
11363         Change all callers.
11364         (Input_objects::add_object): Don't do anything with the target.
11365         (make_elf_sized_object): Add punconfigured parameter.  Change all
11366         callers.  Set or test parameter target.
11367         * dynobj.cc (Sized_dynobj::target): Remove target parameter.
11368         Change all callers.
11369         * parameters.cc (Parameters::set_target): Change parameter type to
11370         be non-const.
11371         (Parameters::default_target): Remove.
11372         (set_parameters_target): Change parameter type to be non-const.
11373         (parameters_force_valid_target): New function.
11374         (parameters_clear_target): New function.
11375         * parameters.h (class Parameters): Update declarations.  Remove
11376         default_target method.  Add sized_target and clear_target
11377         methods.  Change target_ to be non-const.
11378         (set_parameters_target): Update declaration.
11379         (parameters_force_valid_target): Declare.
11380         (parameters_clear_target): Declare.
11381         * readsyms.cc (Read_symbols::do_read_symbols): Pass punconfigured
11382         as NULL if we aren't searching.
11383         (Add_symbols::run): Don't check for compatible target.
11384         * fileread.cc (Input_file::open_binary): Call
11385         parameters_force_valid_target.
11386         * gold.cc (queue_middle_tasks): Likewise.
11387         * plugin.cc (make_sized_plugin_object): Likewise.  Don't call
11388         set_target on object.
11389         * dynobj.h (class Sized_dynobj): Update declarations.
11390         * archive.cc (Archive::get_elf_object_for_member): Return NULL if
11391         make_elf_object returns NULL.
11392         (Archive::include_member): Don't check whether object target is
11393         compatible.
11394         * output.cc (Output_section::add_input_section): Get target from
11395         parameters.
11396         (Output_section::relax_input_section): Likewise.
11397         * reloc.cc (Sized_relobj::do_gc_process_relocs): Get target from
11398         parameters.
11399         (Sized_relobj::do_scan_relocs): Likewise.
11400         (Sized_relobj::relocate_sections): Likewise.
11401         * resolve.cc (Symbol_table::resolve): Likewise.
11402         * symtab.cc (Symbol_table::wrap_symbol): Likewise.  Remove object
11403         parameter.  Change all callers.
11404         (Symbol_table::add_from_object): Get target from parameters.
11405         (Symbol_table::add_from_relobj): Don't check object target.
11406         (Symbol_table::add_from_dynobj): Likewise.
11407         (Symbol_table::define_special_symbol): Get target from
11408         parameters.
11409         * symtab.h (class Symbol_table): Update declaration.
11410         * testsuite/binary_unittest.cc (gold_testsuite): Remove target
11411         parameter.  Change all callers.  Clear parameter target.
11412         (Binary_test): Test target here.
11413         * testsuite/object_unittest.cc (gold_testsuite): Remove
11414         target_test_pointer parameter.  Change all callers.
11415         (Object_test): Test target here.
11416
11417 2009-09-26  Ian Lance Taylor  <iant@google.com>
11418
11419         * testsuite/initpri1.c: Don't try to use constructor priorities if
11420         compiling with gcc before 4.3.
11421
11422 2009-09-22  Mikolaj Zalewski  <mikolajz@google.com>
11423
11424         * testsuite/retain_symbols_file_test.sh (check_present): Change
11425         output file name to retain_symbols_file_test.stdout.
11426         (check_absent): Likewise.
11427
11428 2009-09-18  Craig Silverstein  <csilvers@google.com>
11429
11430         * object.cc (Sized_relobj::do_count): Test should_retain_symbol map.
11431         * options.cc: Include <cerrno> and <fstream>.
11432         (General_options::finalize): Parse -retain-symbols-file tag.
11433         * options.h: New flag.
11434         (General_options): New method should_retain_symbol, new
11435         variable symbols_to_retain.
11436         * symtab.cc (Symbol_table::sized_finalize_symbol): Test
11437         should_retain_symbol map.
11438         * testsuite/Makefile.am (retain_symbols_file_test): New test.
11439         * testsuite/Makefile.in: Regenerate.
11440         * testsuite/retain_symbols_file_test.sh: New file.
11441
11442 2009-09-18  Nick Clifton  <nickc@redhat.com>
11443
11444         * po/es.po: Updated Spanish translation.
11445
11446 2009-09-17  Doug Kwan  <dougkwan@google.com>
11447
11448         * debug.h (DEBUG_RELAXATION): New constant.
11449         (DEBUG_ALL): Add DEBUG_RELAXATION.
11450         (debug_string_to_enum): Add relaxation debug option.
11451         * layout.cc
11452         (Layout::Relaxation_debug_check::check_output_data_for_reset_values,
11453         Layout::Relaxation_debug_check::read_sections,
11454         Layout::Relaxation_debug_check::read_sections): New method definitions.
11455         (Layout::Layout): Initialize data members
11456         record_output_section_data_from_scrips_,
11457         script_output_section_data_list_ and relaxation_debug_check_.
11458         (Layout::save_segments, Layout::restore_segments,
11459         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11460         Layout::relaxation_loop_body): New method definitions.
11461         (Layout::finalize): Support relaxation.  Move section layout code to
11462         Layout::relaxation_loop_body.
11463         (Layout::set_asection_address_from_script): Move code for orphan
11464         section placement out.
11465         (Layout::place_orphan_sections_in_script): New method definition.
11466         * layout.h (Output_segment_headers, Output_file_header):
11467         New forward class declarations.
11468         (Layout::~Layout): Define.
11469         (Layout::new_output_section_data_from_script): New method definition.
11470         (Layout::place_orphan_sections_in_script): New method declaration.
11471         (Layout::Segment_states): New type declaration.
11472         (Layout::save_segments, Layout::restore_segments,
11473         Layout::clean_up_after_relaxation, Layout::prepare_for_relaxation,
11474         Layout::relaxation_loop_body): New method declarations.
11475         (Layout::Output_section_data_list): New type declaration.
11476         (Layout::Relaxation_debug_check): New class definition.
11477         (Layout::record_output_section_data_from_script_,
11478         Layout::script_output_section_data_list_, Layout::segment_states_,
11479         Layout::relaxation_debug_check_): New data members.
11480         * output.cc: (Output_section_headers::do_size): New method definition.
11481         (Output_section_headers::Output_section_headers): Move size
11482         computation to Output_section_headers::do_size.
11483         (Output_segment_headers::do_size): New method definition.
11484         (Output_file_header::Output_file_header): Move size computation to
11485         Output_file_header::do_size and call it.
11486         (Output_file_header::do_size): New method definition.
11487         (Output_data_group::Output_data_group): Adjust call to
11488         Output_section_data.
11489         (Output_data_dynamic::set_final_data_size): Add DT_NULL tag only once.
11490         (Output_symtab_xindex::do_write): Add array bound check.
11491         (Output_section::Input_section::print_to_mapfile): Handle
11492         RELAXED_INPUT_SECTION_CODE.
11493         (Output_section::Output_section): Initialize data member checkpoint_.
11494         (Output_section::~Output_section): Delete checkpoint object pointed
11495         by checkpoint_.
11496         (Output_section::add_input_section): Always add an Input_section if
11497         relaxing.
11498         (Output_section::add_merge_input_section): Add assert.
11499         (Output_section::relax_input_section): New method definition.
11500         (Output_section::set_final_data_size): Set load address to zero for
11501         an unallocated section.
11502         (Output_section::do_address_and_file_offset_have_reset_values):
11503         New method definition.
11504         (Output_section::Input_section_sort_enty::Input_section_sort_enty):
11505         Handle relaxed input section.
11506         (Output_section::sort_attached_input_sections): Checkpoint input
11507         section list lazily.
11508         (Output_section::get_input_sections): Change type of input_sections to
11509         list of Simple_input_section pointers.  Checkpoint input section list
11510         lazily.  Also handle relaxed input sections.
11511         (Output_section::add_input_section_for_script): Take a reference to
11512         a Simple_input_section object instead of Relobj pointer and section
11513         index as parameter.  Handle relaxed input sections.
11514         (Output_section::save_states, Output_section::restore_states): New
11515         method definitions.
11516         * output.h (Output_data::Output_data): Initialize is_data_size_fixed_.
11517         (Output_data::is_data_size_fixed): New method definition.
11518         (Output_data::reset_addresss_and_file_offset): Do not reset data size
11519         if it is fixed.
11520         (Output_data::address_and_file_offset_have_reset_values): New method
11521         definition.
11522         (Output_data::do_address_and_file_offset_have_reset_values): New method
11523         definition.
11524         (Output_data::set_data_size): Check that data size is not fixed.
11525         (Output_data::fix_data_size): New method definition.
11526         (Output_data::is_data_size_fixed_): New data member.
11527         (Output_section_headers::set_final_data_size): New method definition.
11528         (Output_section_headers::do_size): New method declaration.
11529         (Output_segment_headers::set_final_data_size): New method definition.
11530         (Output_segment_headers::do_size): New method declaration.
11531         (Output_file_header::set_final_data_size)::New method definition.
11532         (Output_file_header::do_size)::New method declaration.
11533         (Output_section_data::Output_section_data): Add new parameter
11534         is_data_size_fixed and use it to fix data size.
11535         (Output_data_const::Output_data_const): Adjust call to base class
11536         constructor and fix data size.
11537         (Output_data_const_buffer::Output_data_const_buffer): Adjust call to
11538         base class constructor and fix data size.
11539         (Output_data_fixed_space::Output_data_fixed_space): Adjust call to
11540         base class constructor and fix data size.
11541         (Output_data_zero_fill::Output_data_zero_fill): Adjust call to base
11542         class constructor and fix data size.
11543         (Output_data_group::set_final_data_size): New method definition.
11544         (Output_data_dynamic::Dynamic_entry::tag): New method definition.
11545         (Output_symtab_xindex::Output_symtab_xindex): Adjust call to base
11546         class constructor and fix data size.
11547         (Output_relaxed_input_section): New class definition.
11548         (Output_section::Simple_input_section): New class definition.
11549         (Output_section::get_input_sections): Adjust parameter list.
11550         (Output_section::add_input_section_for_script): Same.
11551         (Output_section::save_states, Output_section::restore_states,
11552         Output_section::do_address_and_file_offset_have_reset_values,
11553         (Output_section::Input_section::Input_section): Handle
11554         RELAXED_INPUT_SECTION_CODE.  Add new overload for
11555         Output_relaxed_input_section.
11556         (Output_section::Input_section::is_input_section,
11557         Output_section::Input_section::set_output_section): Handle relaxed
11558         input section.
11559         (Output_section::Input_section::is_relaxed_input_section,
11560         Output_section::Input_section::output_section_data,
11561         Output_section::Input_section::relaxed_input_section): New method
11562         definitions.
11563         (Output_section::Input_section::RELAXED_INPUT_SECTION_CODE): New enum
11564         value.
11565         (Output_section::Input_section::u1_): Update comments.
11566         (Output_section::Input_section::u2_): Add new union member poris.
11567         (Output_section::Checkpoint_output_section): New classs definition.
11568         (Output_section::relax_input_section): New method declaration.
11569         (Output_section::checkpoint_): New data member.
11570         (Output_segment): Update comments.
11571         (Output_segment::Output_segment): Un-privatize copy constructor.
11572         (Output_segment::operator=): Un-privatize.
11573         * script-sections.cc (Output_section_element::Input_section_list):
11574         Change element type to Output_section::Simple_input_section.
11575         (Output_section_element_dot_assignment::set_section_addresses):
11576         Register output section data for relaxation clean up.
11577         (Output_data_exression::Output_data_expression): Adjust call to base
11578         constructor to fix data size.
11579         (Output_section_element_data::set_section_addresses): Register
11580         Output_data_expression object for relaxation clean up.
11581         (struct Input_section_info): Replace Relobj pointer and section index
11582         pair with Output_section::Simple_input_section and Convert struct to a
11583         class.
11584         (Input_section_sorter::operator()): Adjust access to
11585         Input_section_info data member to use accessors.
11586         (Output_section_element_input::set_section_addresses): Use layout
11587         parameter.  Adjust code to use Output_section::Simple_input_section
11588         and Input_secction_info classes.  Register filler for relaxation
11589         clean up.
11590         (Orphan_output_section::set_section_addresses): Replace Relobj pointer
11591         and section index pair with Output_section::Simple_input_section
11592         class.  Adjust code accordingly.
11593         (Phdrs_element::release_segment): New method definition.
11594         (Script_sections::attach_sections_using_phdrs_clause): Do not modify
11595         segment list.
11596         (Script_sections::release_segments): New method definition.
11597         * gold/script-sections.h (Script_sections::release_segments): New
11598         method declaration.
11599         * gold/target.h (Target::may_relax, Target::relax,
11600         Target::do_may_relax, Target::do_relax): New method definitions.
11601
11602 2009-09-17  Viktor Kutuzov  <vkutuzov@accesssoftek.com>
11603
11604         * arm.cc (has_signed_unsigned_overflow): New function.
11605         (Arm_relocate_functions::abs8): New function.
11606         (Target_arm::Scan::local): Handle R_ARM_ABS8.
11607         (Target_arm::Scan::global): Likewise.
11608         (Target_arm::relocate::relocate): Likewise.
11609         (Target_arm::Relocatable_size_for_reloc::get_size_for_reloc):
11610         Likewise.
11611
11612 2009-09-16  Cary Coutant  <ccoutant@google.com>
11613
11614         * testsuite/Makefile.am (MOSTLYCLEANFILES): Add more generated files.
11615         * testsuite/Makefile.in: Regenerate.
11616
11617 2009-09-11  Nick Clifton  <nickc@redhat.com>
11618
11619         * po/gold.pot: Updated by the Translation project.
11620
11621 2009-09-08  Cary Coutant  <ccoutant@google.com>
11622
11623         * output.cc (Output_file::open): Add execute permission to empty file.
11624         * testsuite/Makefile.am (permission_test): New test.
11625         * testsuite/Makefile.in: Regenerate.
11626
11627 2009-09-02  Ian Lance Taylor  <iant@google.com>
11628
11629         * output.cc (Output_file::resize): Call map_no_anonymous rather
11630         than map.
11631
11632 2009-09-01  Mikolaj Zalewski  <mikolajz@google.com>
11633
11634         * gold.cc: Include "incremental.h".
11635         (queue_initial_tasks): Call Incremental_checker methods.
11636         * incremental.cc: Include "output.h".
11637         (Incremental_checker::can_incrementally_link_output_file): New
11638         method.
11639         * incremental.h (Incremental_checker): New class.
11640
11641         * output.cc (Output_file::open_for_modification): New method.
11642         (Output_file::map_anonymous): Changed return type to bool.  Record
11643         map in base_ field.
11644         (Output_file::map_no_anonymous): New method, broken out of map.
11645         (Output_file::map): Use map_no_anonymous and map_anonymous.
11646         * output.h (class Output_file): Update declarations.
11647
11648 2009-08-24  Cary Coutant  <ccoutant@google.com>
11649
11650         * options.h (Command_line::Pre_options): New class.
11651         (Command_line::pre_options): New member.
11652         * options.cc (gold::options::ready_to_register): New variable.
11653         (One_option::register_option): Do nothing if not registering options.
11654         Assert if same short option registered twice.
11655         (General_options::General_options): Turn off option registration when
11656         done constructing.
11657         (Command_line::Pre_options::Pre_options): New constructor.
11658
11659 2009-08-24  Cary Coutant  <ccoutant@google.com>
11660
11661         * options.h (General_options::no_keep_memory): Remove incorrect
11662         short option.
11663
11664 2009-08-24  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11665
11666         * Makefile.am (am__skiplex, am__skipyacc): New.
11667         * Makefile.in: Regenerate.
11668
11669 2009-08-22  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
11670
11671         * Makefile.am (AM_CPPFLAGS): Renamed from ...
11672         (INCLUDES): ... this.
11673         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add -Wno-portability.
11674         (AM_CPPFLAGS): Renamed from ...
11675         (INCLUDE): ... this.
11676         * Makefile.in, testsuite/Makefile.in: Regenerate.
11677
11678         * Makefile.in: Regenerate.
11679         * aclocal.m4: Likewise.
11680         * config.in: Likewise.
11681         * configure: Likewise.
11682         * testsuite/Makefile.in: Likewise.
11683
11684         * Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11685         * testsuite/Makefile.am (AUTOMAKE_OPTIONS): Add foreign.
11686         * Makefile.in: Regenerate.
11687         * testsuite/Makefile.in: Regenerate.
11688
11689 2009-08-19  Cary Coutant  <ccoutant@google.com>
11690
11691         * resolve.cc (Symbol_table::resolve): Don't complain about defined
11692         symbols in shared libraries overridden by hidden or internal symbols
11693         in the main program.
11694
11695 2009-08-19  Chris Demetriou  <cgd@google.com>
11696
11697         * testsuite/debug_msg.sh: Match .* rather than ${srcdir} when
11698         checking source file names in error messages.
11699
11700 2009-08-18  Doug Kwan  <dougkwan@google.com>
11701
11702         * dynobj.cc (Sized_dynobj::setup): Take a Target object instead of
11703         an elcpp::Ehdr as parameter.  Adjust call to set_target.
11704         * dynobj.h (Sized_dynobj::setup): Take a Target object instead of
11705         an elfcpp::Ehdr as parameter.
11706         * object.cc (Object::set_target): Remove the version that looks up
11707         a target and sets it.
11708         (Sized_relobj::setup): Take a Target object instead of
11709         an elfcpp::Ehdr as parameter.  Adjust call to set_target.
11710         (make_elf_sized_object): Find target and ask target to
11711         make an ELF object.
11712         * object.h: (Object::set_target): Remove the version that looks up
11713         a target and sets it.
11714         (Sized_relobj::setup): Take a Target object instead of
11715         an elfcpp:Ehdr as parameter.
11716         * target.cc: Include dynobj.h.
11717         (Target::do_make_elf_object_implementation): New.
11718         (Target::do_make_elf_object): New.
11719         * target.h (Target::make_elf_object): New template declaration.
11720         (Target::do_make_elf_object): New method declarations.
11721         (Target::do_make_elf_object_implementation): New template declaration.
11722
11723 2009-08-14  Ian Lance Taylor  <iant@google.com>
11724
11725         * gold.h (FUNCTION_NAME): Define.
11726         (gold_unreachable): Use FUNCTION_NAME.
11727
11728 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11729
11730         * icf.cc (Icf::find_identical_sections): Issue a warning when a
11731         symbol in the --keep-unique list is not found.
11732
11733 2009-08-12  Sriraman Tallam  <tmsriram@google.com>
11734
11735         * icf.cc (Icf::find_identical_sections): Unfold symbols that have
11736         been maked as --keep-unique.
11737         (Icf::unfold_section): New function.
11738         * icf.h (Icf::unfold_section): New function.
11739         * options.h (General_options::keep_unique): New option.
11740         * testsuite/Makefile.am: Add commands to build icf_keep_unique_test.
11741         * testsuite/Makefile.in: Regenerate.
11742         * testsuite/icf_keep_unique_test.sh: New file.
11743         * testsuite/icf_keep_unique_test.cc: New file.
11744
11745 2009-08-12  Cary Coutant  <ccoutant@google.com>
11746
11747         PR 10471
11748         * resolve.cc (Symbol_table::resolve): Check for references from
11749         dynamic objects to hidden and internal symbols.
11750         * testsuite/Makefile.am (hidden_test.sh): New test.
11751         * testsuite/Makefile.in: Regenerate.
11752         * testsuite/hidden_test.sh: New script.
11753         * testsuite/hidden_test_1.c: New test source.
11754         * testsuite/hidden_test_main.c: New test source.
11755
11756 2009-08-11  Doug Kwan  <dougkwan@google.com>
11757
11758         * arm.cc: Update comments.
11759         (Target_arm::do_finalize_sections): Add a special PT_ARM_EXIDX
11760         segment to locate the .ARM.exidx section if present.
11761
11762 2009-08-09  Doug Kwan  <dougkwan@google.com>
11763
11764         * dynobj.h (Sized_dynobj::do_section_entsize): Revert the previous
11765         patch.
11766
11767 2009-08-07  Sriraman Tallam  <tmsriram@google.com>
11768         * dynobj.h (Sized_dynobj::do_section_entsize): Add return to avoid
11769         compiler warnings.
11770
11771 2009-08-06  Sriraman Tallam  <tmsriram@google.com>
11772
11773         * x86_64.cc (Target_x86_64::Relocate::relocate_tls): Check for a
11774         valid tls_segment only for non-debug-section relocations.
11775         * testsuite/Makefile.am: Add gc_tls_test.
11776         * testsuite/Makefile.in: Regenerate.
11777         * testsuite/gc_tls_test.cc: New file.
11778         * testsuite/gc_tls_test.sh: New file.
11779
11780 2009-08-05  Sriraman Tallam  <tmsriram@google.com>
11781
11782         * icf.cc: New file.
11783         * icf.h: New file.
11784         * Makefile.am (CCFILES): Add icf.cc.
11785         (HFILES): Add icf.h
11786         * Makefile.in: Regenerate.
11787         * dynobj.h (Sized_dynobj::do_section_entsize): New function.
11788         * gc.h (gc_process_relocs): Populate lists used by icf to contain
11789         section, symbol and addend information for the relocs.
11790         * gold.cc (queue_middle_tasks): Call identical code folding.
11791         * gold.h: Add defines for multimap.
11792         * layout.cc (Layout::create_symtab_sections): Add symtab as parameter
11793         to the call of finalize_local_symbols.
11794         * main.cc (main): Create object of class Icf.
11795         * object.cc (Sized_relobj::do_layout): Allow this function to be
11796         called twice during icf.
11797         (Sized_relobj::do_finalize_local_symbols): Fold symbols corresponding
11798         to sections marked as identical by icf.
11799         (Sized_relobj::do_section_flags): Get section_flags from Symbols_data
11800         when available.
11801         (Sized_relobj::do_section_entsize): New function.
11802         * object.h (Object::section_entsize): New function.
11803         (Object::do_section_entsize): New pure virtual function.
11804         (Relobj::finalize_local_symbols): Add new parameter.
11805         (Relobj::do_section_entsize): New function.
11806         * options.h (General_options::icf): New option.
11807         (General_options::icf_iterations): New option.
11808         (General_options::print_icf_sections): New option.
11809         * plugin.cc (Sized_pluginobj::do_section_entsize): New function.
11810         * plugin.h (Sized_pluginobj::do_section_entsize): New function.
11811         * reloc.cc (Read_relocs::run): Delay scanning relocs when doing
11812         icf.
11813         * symtab.cc (Symbol_table::is_section_folded): New function.
11814         (Symbol_table::sized_finalize_symbol):  Fold symbols corresponding
11815         to sections marked as identical by icf.
11816         * symtab.h (Symbol_table::set_icf): New function.
11817         (Symbol_table::icf): New function.
11818         (Symbol_table::is_section_folded): New function.
11819         (Symbol_table::icf_): New data member.
11820         * target-reloc.h (relocate_section): Ignore sections folded by icf.
11821         * testsuite/Makefile.am: Add commands to build icf_test.
11822         * testsuite/Makefile.in: Regenerate.
11823         * testsuite/icf_test.sh: New file.
11824         * testsuite/icf_test.cc: New file.
11825
11826 2009-07-24  Chris Demetriou  <cgd@google.com>
11827
11828         * layout.cc (is_compressible_debug_section): Fix incorrect
11829         comment about compressed section names.
11830
11831 2009-07-20  Ian Lance Taylor  <ian@airs.com>
11832
11833         PR 10419
11834         * x86_64.cc (Target_x86_64::do_code_fill): Correct nop sequences.
11835
11836 2009-07-16  Ian Lance Taylor  <iant@google.com>
11837
11838         PR 10400
11839         * layout.h: #include <map>.
11840         (class Kept_section): Change from struct to class.  Add accessors
11841         and setters.  Add section size to Comdat_group mapping.  Change
11842         Comdat_group to std::map.  Add is_comdat_ field.  Add
11843         linkonce_size field in union.
11844         (class Layout): Update declaration of find_or_add_kept_section.
11845         Don't declare find_kept_object.
11846         * layout.cc (Layout::find_or_add_kept_section): Remove candidate
11847         parameter.  Add object, shndx, is_comdat, and is_group_name
11848         parameters.  Change all callers.  Adjust for new Kept_section.
11849         (Layout::find_kept_object): Remove.
11850         * object.cc (Sized_relobj::include_section_group): Update use of
11851         Kept_section.  Rename secnum to shndx.  Only record
11852         Kept_comdat_section if sections are the same size.
11853         (Sized_relobj::include_linkonce_section): Update use of
11854         Kept_section.  Only record Kept_comdat_section if sections are the
11855         same size.  Set size of linkonce section.
11856         (Sized_relobj::map_to_kept_section): Update call to
11857         get_kept_comdat_section.
11858         * object.h (class Sized_relobj): Rename fields in
11859         Kept_comdat_section to drop trailing underscores; change object
11860         field to Relobj*.  Change Kept_comdat_section_table to store
11861         struct rather than pointer.
11862         (Sized_relobj::set_kept_comdat_section): Remove kept parameter.
11863         Add kept_object and kept_shndx parameters.  Change all callers.
11864         (Sized_relobj::get_kept_comdat_section): Change return type to
11865         bool.  Add kept_object and kept_shndx parameters.  Change all
11866         callers.
11867         * plugin.cc (Pluginobj::include_comdat_group): Update call to
11868         Layout::find_or_add_kept_section.
11869
11870 2009-07-09  Ian Lance Taylor  <iant@google.com>
11871
11872         * merge.cc (Object_merge_map::initialize_input_to_output_map):
11873         Reserve space in the hash table.
11874
11875 2009-07-06  Mikolaj Zalewski  <mikolajz@google.com>
11876
11877         * fileread.cc (File_read::get_mtime): New method.
11878         * fileread.h (Timespec): New structure.
11879         (File_read::get_mtime): New method.
11880         * incremental.cc (Incremental_inputs_entry_data::timestamp_usec):
11881         Renamed from timestamp_nsec.
11882         (Incremental_inputs_entry_write::timestamp_sec): Fix argument to
11883         Elf_Xword.
11884         (Incremental_inputs_entry_write::timestamp_usec): Renamed from
11885         timestamp_nsec.
11886         (Incremental_inputs::report_archive): Save mtime; style fix.
11887         (Incremental_inputs::report_obejct): Save mtime; style fix.
11888         (Incremental_inputs::report_script): Save mtime; style fix.
11889         (Incremental_inputs::finalize_inputs): Style fix.
11890         (Incremental_inputs::finalize): Style fix.
11891         (Incremental_inputs::create_input_section_data): Store inputs
11892         mtime.
11893         * incremental.h (Incremental_inputs::report_script): Add mtime
11894         argument.
11895         (Incremental_inputs::Input_info::Input_info): Intialize only one
11896         union member.
11897         (Incremental_inputs::Input_info::archive): Move to nameless
11898         union.
11899         (Incremental_inputs::Input_info::obejct): Move to nameless union.
11900         (Incremental_inputs::Input_info::script): Move to nameless union.
11901         (Incremental_inputs::mtime): New field.
11902         * script.cc (read_input_script): Pass file mtime to
11903         Incremental_input.
11904         * script.h (Script_info::inputs): Style fix.
11905
11906 2009-07-01  Ian Lance Taylor  <ian@airs.com>
11907
11908         * freebsd.h (Target_freebsd::do_adjust_elf_header): Use size
11909         instead of 32.
11910
11911 2009-06-24  Ian Lance Taylor  <iant@google.com>
11912
11913         PR 10156
11914         * layout.cc (Layout::choose_output_section): If we find an
11915         existing section, update the flags.
11916         (Layout::create_notes): New function, broken out of
11917         Layout::finalize.
11918         (Layout::finalize): Don't create note sections.
11919         (Layout::create_note): Don't crash if linker script discards
11920         section.
11921         (Layout::create_gold_note): Likewise.
11922         (Layout::create_build_id): Likewise.  Don't set
11923         after_input_sections on the section.
11924         (Layout::create_executable_stack_info): Remove target parameter.
11925         Change caller.
11926         * layout.h (class Layout): Declare create_notes.  Update
11927         declaration of create_executable_stack_info.
11928         * gold.cc (queue_middle_tasks): Call create_notes.
11929         * output.cc (Output_section::update_flags_for_input_section): Move
11930         here from output.h.  If SHF_ALLOC flag is newly set, mark address
11931         invalid.
11932         * output.h (Output_data::mark_address_invalid): New function.
11933         (class Output_section): Only declare, not define,
11934         update_flags_for_input_section.  Remove set_flags.
11935
11936 2009-06-24  Ian Lance Taylor  <iant@google.com>
11937
11938         * script-sections.cc (Output_section_definition::
11939         set_section_addresses): Rename shadowing local load_address to
11940         laddr.
11941
11942 2009-06-24  Ian Lance Taylor  <iant@google.com>
11943
11944         PR 10244
11945         * reloc.cc (relocate_sections): Skip empty relocation sections.
11946
11947 2009-06-23  Ian Lance Taylor  <iant@google.com>
11948
11949         PR 10156
11950         * layout.cc (Layout::create_note): Use choose_output_section
11951         rather than make_output_section.
11952
11953 2009-06-23  Ian Lance Taylor  <iant@google.com>
11954
11955         PR 10237
11956         * options.cc (General_options::parse_V): Set printed_version_.
11957         (General_options::General_options): Initialize printed_version_.
11958         * options.h (class General_options): Add printed_version_ field.
11959         * gold.cc (queue_initial_tasks): If there are no input files,
11960         don't give a fatal error if we printed the version information.
11961         (queue_middle_tasks): If using -r with a shared object, give a
11962         fatal error rather than an ordinary error.
11963
11964 2009-06-23  Ian Lance Taylor  <iant@google.com>
11965
11966         PR 10219
11967         * layout.cc (Layout::Layout): Initialize have_stabstr_section_.
11968         (Layout::make_output_section): Set have_stabstr_section_ if we see
11969         a .stab*str section.
11970         (Layout::finalize): Call link_stabs_sections.
11971         (Layout::link_stabs_sections): New file.
11972         * layout.h (class Layout): Add have_stabstr_section_ field.
11973         Declare link_stabs_sections.
11974
11975 2009-06-23  Doug Kwan  <dougkwan@google.com>
11976
11977         * Makefile.am (libgold_a_LIBADD): New.
11978         (ld_new_DEPENDENCIES, ld_new_LDADD): Remove LIBOBJS
11979         * Makefile.in: Regenerate.
11980         * config.in (HAVE_DECL_MEMMEM, HAVE_DECL_STRNDUP): New.
11981         * configure: Regenerate.
11982         * configure.ac (AC_CHECK_DECLS): Add strndup and memmem.
11983         * fileread.cc: Include sys/state.h
11984         * gold.h: Declare memmem and strndup if found missing.
11985         * gold_reloc.h: Include byteswap.h if HAVE_BYTESWAP_H is defined.
11986
11987 2009-06-23  Ian Lance Taylor  <iant@google.com>
11988
11989         * configure.ac: Call AC_CHECK_DECLS using C, not C++.
11990         * configure: Rebuild.
11991
11992 2009-06-23  Ian Lance Taylor  <iant@google.com>
11993
11994         PR 10147
11995         * object.cc (Object::section_contents): Don't try to get a view if
11996         the section has length zero.
11997         (Object::handle_gnu_warning_section): If the section is empty, use
11998         the name of the section as the warning.
11999
12000 2009-06-23  Ian Lance Taylor  <iant@google.com>
12001
12002         PR 10133
12003         * stringpool.h (class Stringpool_template): Add optimize_ field.
12004         (Stringpool_template::set_optimize): New function.
12005         * stringpool.cc (Stringpool_template::Stringpool_template):
12006         Initialize optimize_ field.
12007         (Stringpool_template::set_string_offsets): Test local optimize
12008         fild rather than parameter.
12009         * layout.cc (Layout::Layout): Call set_optimize on the section
12010         name stringpool.
12011
12012 2009-06-22  Ian Lance Taylor  <iant@google.com>
12013
12014         PR 10030
12015         * yyscript.y: Parse TARGET.
12016         * script.cc (script_set_target): New function.
12017         * script-c.h (script_set_target): Declare.
12018         * options.cc (General_options::string_to_object_format): Rename
12019         from string_to_object_format in anonymous namespace.  Change
12020         callers.
12021         * options.h (class General_options): Declare
12022         string_to_object_format.
12023
12024 2009-06-22  Ian Lance Taylor  <iant@google.com>
12025
12026         * script-sections.cc (Script_sections::create_segments): Don't put
12027         program headers in a PT_LOAD segment if -n or -N.
12028
12029 2009-06-22  Ian Lance Taylor  <iant@google.com>
12030
12031         PR 10141
12032         * options.h (class General_options): Add -z lazy and -z now.  Sort
12033         -z options into alphabetical order.
12034         * layout.cc (Layout::finish_dynamic_section): Handle -z now.
12035
12036 2009-06-21  Ian Lance Taylor  <iant@google.com>
12037
12038         * layout.cc (Layout::make_output_section): Call
12039         Target::new_output_section.
12040         (Layout::attach_allocated_section_to_segment): Put large section
12041         sections in a separate load segment with the large segment flag
12042         set.
12043         (Layout::segment_precedes): Sort large data segments after other
12044         load segments.
12045         (align_file_offset): New static function.
12046         (Layout::set_segment_offsets): Use align_file_offset.
12047         * output.h (class Output_section): Add is_small_section_ and
12048         is_large_section_ fields.
12049         (Output_section::is_small_section): New function.
12050         (Output_section::set_is_small_section):  New function.
12051         (Output_section::is_large_section): New function.
12052         (Output_section::set_is_large_section): New function.
12053         (Output_section::is_large_data_section): New function.
12054         (class Output_segment): Add is_large_data_segment_ field.
12055         (Output_segment::is_large_data_segment): New function.
12056         (Output_segment::set_is_large_data_segment): New function.
12057         * output.cc (Output_section::Output_section): Initialize new
12058         fields.
12059         (Output_segment::Output_segment): Likewise.
12060         (Output_segment::add_output_section): Add assertion that large
12061         data sections always go in large data segments.  Force small data
12062         sections to the end of the list of data sections.  Force small BSS
12063         sections to the start of the list of BSS sections.  For large BSS
12064         sections to the end of the list of BSS sections.
12065         * symtab.h (class Symbol): Declare is_common_shndx.
12066         (Symbol::is_defined): Check Symbol::is_common_shndx.
12067         (Symbol::is_common): Likewise.
12068         (class Symbol_table): Define enum Commons_section_type.  Update
12069         declarations.  Add small_commons_ and large_commons_ fields.
12070         * symtab.cc (Symbol::is_common_shndx): New function.
12071         (Symbol_table::Symbol_table): Initialize new fields.
12072         (Symbol_table::add_from_object): Put small and large common
12073         symbols in the right list.
12074         (Symbol_table::sized_finalized_symbol): Check
12075         Symbol::is_common_shndx.
12076         (Symbol_table::sized_write_globals): Likewise.
12077         * common.cc (Symbol_table::do_allocate_commons): Allocate new
12078         common symbol lists.  Don't call do_allocate_commons_list if the
12079         list is empty.
12080         (Symbol_table::do_allocate_commons_list): Remove is_tls
12081         parameter.  Add comons_section_type parameter.  Change all
12082         callers.  Handle small and large common symbols.
12083         * object.cc (Sized_relobj::do_finalize_local_symbols): Check
12084         Symbol::is_common_shndx.
12085         * resolve.cc (symbol_to_bits): Likewise.
12086         * target.h (Target::small_common_shndx): New function.
12087         (Target::small_common_section_flags): New function.
12088         (Target::large_common_shndx): New function.
12089         (Target::large_common_section_flags): New function.
12090         (Target::new_output_section): New function.
12091         (Target::Target_info): Add small_common_shndx, large_common_shndx,
12092         small_common_section_flags, and large_common_section_flags
12093         fields.
12094         (Target::do_new_output_section): New virtual function.
12095         * arm.cc (Target_arm::arm_info): Initialize new fields.
12096         * i386.cc (Target_i386::i386_info): Likewise.
12097         * powerpc.cc (Target_powerpc::powerpc_info) [all versions]:
12098         Likewise.
12099         * sparc.c (Target_sparc::sparc_info) [all versions]: Likewise.
12100         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
12101         (Target_x86_64::do_new_output_section): New function.
12102         * configure.ac: Define conditional MCMODEL_MEDIUM.
12103         * testsuite/Makefile.am (check_PROGRAMS): Add large.
12104         (large_SOURCES, large_CFLAGS, large_DEPENDENCIES): Define.
12105         (large_LDFLAGS): Define.
12106         * testsuite/large.c: New file.
12107         * testsuite/testfile.cc (Target_test::test_target_info):
12108         Initialize new fields.
12109         * configure, testsuite/Makefile.in: Rebuild.
12110
12111 2009-06-05  Doug Kwan  <dougkwan@google.com>
12112
12113         * Makefile.am (CCFILES): Add target.cc.
12114         * Makefile.in: Regenerate.
12115         * i386.cc (class Target_i386): Define new virtual method to
12116         override do_is_local_label_name in parent.
12117         * object.cc (Sized_relobj::do_count_local_symbols): Discard
12118         local symbols if --discard-locals or -X is given.
12119         * options.h (class General_options): Declare new options
12120         '--discard-locals' and '-X' for discarding locals.
12121         * target.h (class Target): Define new methods is_local_label_name.
12122         Declare new virtual method do_is_local_label_name.
12123         * target.cc: New file.
12124         * testsuite/Makefile.am (check_PROGRAMS): Add discard_locals_test.
12125         (check_SCRIPTS): Add discard_locals_test.sh.
12126         (check_DATA): Add discard_local_tests.syms.
12127         (discard_locals_test_SOURCES, discard_locals_test_LDFLAGS): Define.
12128         (discard_local_tests.syms, discard_locals_test.o): New make rules.
12129         * testsuite/Makefile.in: Regenerate.
12130         * testsuite/discard_locals_test.c: New file.
12131         * testsuite/discard_locals_test.sh: Same.
12132
12133 2009-06-05  Doug Kwan  <dougkwan@google.com>
12134
12135         * object.cc (Sized_relobj::Sized_relobj): Initialize
12136         discarded_eh_frame_shndx_ to -1U.
12137         (Sized_relobj::do_layout): Record index of a discard .eh_frame
12138         section.
12139         (Sized_relobj::do_count_local_symbols): Skip local symbols in
12140         a discarded .eh_frame section.
12141         (Sized_relobj::do_finalize_local_symbols): Ditto.
12142         * object.h (class Sized_relobj): Declare new member
12143         discarded_eh_frame_shndx_.
12144         * testsuite/Makefile.am (check_PROGRAMS): Add local_labels_test.
12145         (local_labels_test.o, local_labels_test): New rules.
12146         * testsuite/Makefile.in: Regenerate.
12147
12148 2009-06-04  Doug Kwan  <dougkwan@google.com>
12149
12150         * layout.cc (Layout::section_name_mapping): Add mapping for
12151         special ARM sections.
12152
12153 2009-06-03  Doug Kwan  <dougkwan@google.com>
12154
12155         * arm.cc (utils::sign_extend): Reverse test in gold_assert.
12156         (utils::has_overflow): Same.
12157
12158 2009-06-03  Ian Lance Taylor  <iant@google.com>
12159
12160         * layout.cc (Layout::section_name_mapping): New array, replacing
12161         Layout::linkonce_mapping.
12162         (Layout::section_name_mapping_count): New variable, replacing
12163         Layout::linkonce_mapping_count.
12164         (Layout::linkonce_output_name): Remove.
12165         (Layout::output_section_name): Rewrite.
12166         * layout.h (class Layout): Rename Linkonce_mapping to
12167         Section_name_mapping, linkonce_mapping to section_name_mapping,
12168         linkonce_mapping_count to section_name_mapping_count.  Don't
12169         declare linkonce_output_name.
12170
12171 2009-06-03  Doug Kwan  <dougkwan@google.com>
12172
12173         * gold/arm.cc (namespace utils): New.
12174         (Target_arm::reloc_is_non_pic): Define new method.
12175         (class Arm_relocate_functions): New.
12176         (Target_arm::Relocate::relocate): Handle relocation types used by
12177         Android.
12178
12179 2009-06-03  Ian Lance Taylor  <iant@google.com>
12180
12181         * arm.cc (Target_arm::scan::global): Use || instead of |.
12182
12183 2009-06-02  Doug Kwan  <dougkwan@google.com>
12184
12185         * gold/arm.cc (Target_arm::Scan::Scan):  Initialize
12186         issued_non_pic_error_.
12187         (class Target_arm::Scan): Declare new method check_non_pic.
12188         Define new method symbol_needs_plt_entry.
12189         Declare new data member issued_non_pic_error_.
12190         (class Target_arm::Relocate): Declare new method
12191         should_apply_static_reloc.
12192         (Target_arm::may_need_copy_reloc): Handle STT_ARM_TFUNC.
12193         (Target_arm::Scan::check_non_pic): Define new method.
12194         (Target_arm::Scan::local): Handle a small subset of reloc types used
12195         by Android.
12196         (Target_arm::Scan::local): Same.
12197         (Target_arm::Relocate::should_apply_statci_reloc): Define new method.
12198
12199 2009-05-31  Mikolaj Zalewski  <mikolajz@google.com>
12200
12201         * incremental.cc (Incremental_inputs::report_command_line): Filter
12202         out --incremental-* options.
12203
12204 2009-05-29  Doug Kwan  <dougkwan@google.com>
12205
12206         * gold/arm.cc (Output_data_plt_arm): Forward declaration for new
12207         template class.
12208         (class Target_arm): Update comment.
12209         (Target_arm::Target_arm): Initialize new data members GOT_,
12210         PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_ and DYNBSS_.
12211         Declare new methods Target_arm::got_section, Target_arm::make_plt_entry
12212         and Target_arm::rel_dyn_section.
12213         Declare new_enum Target_arm::Got_type.
12214         Declare new data members GOT_, PLT_, GOT_PLT_, REL_DYN_, COPY_RELOCS_
12215         and DYNBSS_.
12216         Update commments for member do_dynsym_value.
12217         (Target_arm::got_size, Target_arm::plt_section,
12218         Target_arm::may_need_copy_reloc and Target_arm::copy_reloc): Define
12219         new methods inside class defintion.
12220         (Target_arm::got_section): Define new method.
12221         (Target_arm::rel_dyn_section): Same.
12222         (Output_data_plt_arm): New template class.
12223         (Output_data_plt_arm::Output_data_plt_arm): Define constructor.
12224         (Output_data_plt_arm:do_adjust_output_section): Define new method.
12225         (Output_data_plt_arm::add_entry): Same.
12226         (Output_data_plt_arm::first_plt_entry): Define new
12227         static data member for PLT instruction template.
12228         (Output_data_plt_arm::plt_entry): Same.
12229         (Output_data_plt_arm::do_write): Define new method.
12230         (Target_arm::make_plt_entry): Same.
12231         (Target_arm::do_finalize_sections): Same.
12232         (Target_arm::do_dynsym_value): Same.
12233
12234 2009-05-28  Doug Kwan  <dougkwan@google.com>
12235
12236         * Makefile.am (TARGETSOURCES): Add arm.cc.
12237         (ALL_TARGETOBJECTS): Add arm.$(OBJEXT)
12238         * Makefile.in: Regenerate.
12239         * arm.cc: New file.
12240         * configure.tgt: Add armbe*-*-*, armeb*-*-* and arm*-*-* targets.
12241
12242 2009-05-26  Doug Kwan  <dougkwan@google.com>
12243
12244         * options.cc (General_options::parse_exclude_libs).  Fix a comment.
12245         (General_options::check_excluded_libs): Strip off directories in
12246         archive name before matching like GNU ld does.
12247         * testsuite/Makefile.am (MOSTLYCLEANFILES,
12248         exclude_libs_test_DEPENDENCIES): Add alt/libexclude_libs_test_3.a
12249         (exclude_libs_test_LDFLAGS): Add linker option
12250         -Wl,--exclude-libs,libexclude_libs_test_3
12251         (exclude_libs_test_LADD): Add alt/libexclude_libs_test_3.a as
12252         an explicit archive without using -l.
12253         (alt/libexclude_libs_test_3.a): New make rule.
12254         * testsuite/Makefile.in: Regenerate.
12255         * testsuite/exclude_libs_test.c : Declare lib3_default().
12256         (main): Call it.
12257         * exclude_libs_test.sh: Add tests for alt/exclude_libs_test_3.a.
12258         * exclude_libs_test_3.c: New file.
12259
12260 2009-05-26  Nick Clifton  <nickc@redhat.com>
12261
12262         * po/id.po: New Indonesian translation.
12263         * po/gold.pot: Updated template file.
12264
12265 2009-05-22  Sriraman Tallam  <tmsriram@google.com>
12266
12267         * testsuite/Makefile.am: Add -ffunction-sections to compile
12268         gc_comdat_test files.  Add -Wl,--gc-sections to build
12269         gc_comdat_test.
12270         * testsuite/Makefile.in: Regenerate.
12271         * testsuite/gc_comdat_test.sh: Fix the condition around grep.
12272
12273 2009-05-21  Sriraman Tallam  <tmsriram@google.com>
12274
12275         * object.cc (Sized_relobj::map_to_kept_section): Return NULL if the
12276         kept comdat section was garbage collected.
12277         * testsuite/Makefile.am: Add test gc_comdat_test.sh.
12278         * testsuite/Makefile.in: Regenerate.
12279         * testsuite/gc_comdat_test.sh: New file.
12280         * testsuite/gc_comdat_test_1.cc: New file.
12281         * testsuite/gc_comdat_test_2.cc: New file.
12282
12283 2009-05-19  Doug Kwan  <dougkwan@google.com>
12284
12285         * archive.cc (Archive::Archive): Move constructor from archive.h
12286         to here.  Initialize no_export_.
12287         (Archive::get_elf_object_for_member): Set no_export flag of object.
12288         * archive.h (Archive::Archive): Move constructor body to
12289         archive.cc.
12290         (Archive::no_export): New method.
12291         (Archive::no_export_): New field.
12292         * object.h (Object::Object): Initialize no_export_ to false.
12293         (Object::no_export, Object::set_no_export): New methods.
12294         (Object::no_export_): New field.
12295         * options.cc (General_options::parse_exclude_libs): New method.
12296         (General_options::check_excluded_libs) Same.
12297         * options.h (exclude_libs): New option.
12298         (General_options::check_excluded_libs): New method declaration.
12299         (General_options::excluded_libs_): New field.
12300         * symtab.cc (Symbol_table::add_from_relobj): Hide symbols with
12301         default or protected visibility if an object has no-export flag set.
12302         testsuite/Makefile.am (check_PROGRAMS): Add exclude_libs_test.
12303         (check_SCRIPTS): Add exclude_libs_test.sh.
12304         (check_DATA): Add exclude_libs_test.syms.
12305         (MOSTLYCLEANFILES): Add exclude_libs_test.syms,
12306         libexclude_libs_test_1.a and libexclude_libs_test_2.a.
12307         (exclude_libs_test_SOURCES, exclude_libs_test_DEPENDENCIES,
12308         exclude_libs_test_LDFLAGS and exclude_libs_test_LDADD): Define.
12309         (exclude_libs_test.syms, libexclude_libs_test_1.a,
12310         libexclude_libs_test_2.a): New rules.
12311         * testsuite/Makefile.in: Regenerate.
12312         * testsuite/exclude_libs_test.c: New file.
12313         * testsuite/exclude_libs_test.sh: Ditto.
12314         * testsuite/exclude_libs_test_1.c: Ditto.
12315         * testsuite/exclude_libs_test_2.c: Ditto.
12316
12317 2009-05-15  Ian Lance Taylor  <iant@google.com>
12318
12319         * configure.ac: Check for declarations for cases where libiberty.h
12320         checks HAVE_DECL_xxx.
12321         * configure, config.in: Rebuild.
12322
12323 2009-05-15  Mikolaj Zalewski  <mikolajz@google.com>
12324
12325         * gold.h (Incremental_argument_list): Remove (invalid) forward
12326         declaration.
12327         * incremental.cc (Incremental_inputs::report_achive): New method.
12328         (Incremental_inputs::report_object): New method.
12329         (Incremental_inputs::report_script): New method.
12330         (Incremental_inputs::finalize_inputs): New method.
12331         (Incremental_inputs::finalize): Call finalize_inputs().
12332         (Incremental_inputs::sized_create_incremental_inputs_section_data):
12333         Create inputs entries.
12334         * incremental.h (Incremental_input_type): New enum.
12335         (Incremental_inputs::Incremental_input): Initialize new fields.
12336         (Incremental_inputs::report_inputs): New method.
12337         (Incremental_inputs::report_achive): New method.
12338         (Incremental_inputs::report_object): New method.
12339         (Incremental_inputs::report_script): New method.
12340         (Incremental_inputs::finalize_inputs): New method.
12341         (Incremental_inputs::Input_info): New struct.
12342         (Incremental_inputs::Input_info_map): New typedef.
12343         (Incremental_inputs::lock_): New field.
12344         (Incremental_inputs::Inputs_): New field.
12345         (Incremental_inputs::Inputs_map): New field.
12346         * main.cc (main): Call Incremental_input::report_inputs.
12347         * options.h (Input_argument_list): Typedef moved from
12348         Input_arguments.
12349         (Input_file_group::Files): Remove, use ::Input_argument_list.
12350         (Input_file_group::Input_argument_list): Remove, use
12351         ::Input_argument_list.
12352         * plugin.cc (Plugin_manager::add_input_file): Add error in
12353         incremental build.
12354         * read_syms.cc (do_read_syms): Call Incremental_input::report_*
12355         functions.
12356         * script.cc (read_input_script): Call
12357         Incremental_input::report_script.
12358         * script.h (Script_info): New class.
12359
12360 2009-04-27  Ian Lance Taylor  <iant@google.com>
12361
12362         * x86_64.cc (do_adjust_output_section): Set entsize to
12363         plt_entry_size.
12364
12365 2009-04-23  Elliott Hughes  <enh@google.com>
12366
12367         * output.cc (Output_file::close): After short writes, continue
12368         writing from the correct offset in the buffer being written.
12369
12370 2009-04-23  Chris Demetriou  <cgd@google.com>
12371
12372         * configure.ac (HAVE_TR1_UNORDERED_MAP_REHASH): New define.
12373         * configure: Regenerate.
12374         * config.in: Regenerate.
12375         * gold.h: Avoid std::tr1::unordered_map and std::tr1::unordered_set
12376         if HAVE_TR1_UNORDERED_MAP_REHASH is not defined.
12377
12378 2009-04-21  Mikolaj Zalewski  <mikolajz@google.com>
12379
12380         * incremental.cc (Incremental_inputs_header_data): Renamed from
12381         Incremental_input_header_data.
12382         (Incremental_inputs_header_data::data_size): New field.
12383         (Incremental_inputs_header_data::put_input_file_count): Renamed
12384         from input_file_count.
12385         (Incremental_inputs_header_data::put_command_line_offset): Renamed
12386         from command_line_offset.
12387         (Incremental_inputs_header_data::put_reserved): Renamed from
12388         put_reserved.
12389         (Incremental_inputs_entry_data): Renamed from
12390         Incremental_input_entry_data.
12391         (Incremental_inputs_entry_data::data_size): New field.
12392         (Incremental_inputs::report_command_line): New method.
12393         (Incremental_inputs::finalize): New method.
12394         (Incremental_inputs::create_incremental_inputs_data): New method.
12395         (Incremental_inputs::sized_create_incremental_inputs_data): New method.
12396         * incremental.h: New file.
12397         * layout.cc (Layout::Layout): Handle new incremental_inputs_.
12398         (Layout::finalize): Create incremental inputs section in
12399         incremental builds.
12400         (Layout::create_incremental_info_sections): New method.
12401         * layout.h (Layout::incremental_inputs): New method.
12402         (Layout::create_incremental_info_sections): New method.
12403         (Layout::incremental_inputs_): New field.
12404         * main.cc (main): Notify Incremental_input of the command line.
12405
12406 2009-04-01  Ian Lance Taylor  <iant@google.com>
12407             Mikolaj Zalewski  <mikolajz@google.com>
12408
12409         * gold.h (reserve_unordered_map): Define, three versions, one for
12410         each version of Unordered_map.
12411         * layout.cc (Layout::Layout): Remove options parameter.  Add
12412         number_of_input_files parameter.  Don't initialize options_.
12413         Initialize number_of_input_files_ and resized_signatures_.  Move
12414         sections_are_attached_.
12415         (Layout::layout_group): Reserve space for group_signatures_.
12416         (Layout::find_or_add_kept_section): Change name parameter to be a
12417         reference.  Resize signatures_ map when it gets large enough.
12418         (Layout::layout_eh_frame): Use parameters->options() instead of
12419         this->options_.
12420         (Layout::make_output_section): Likewise.
12421         (Layout::attach_allocated_section_to_segment): Likewise.
12422         (Layout::finalize, Layout::create_executable_stack): Likewise.
12423         (Layout::set_segment_offsets, Layout::create_interp): Likewise.
12424         (Layout::finish_dynamic_section, Layout::write_binary): Likewise.
12425         * layout.h (class Layout): Update declarations.  Remove options_
12426         field.  Add number_of_input_files_ and resized_signatures_
12427         fields.  Move sections_are_attached_ field.
12428         * main.cc (main): Pass number of input files to Layout
12429         constructor.  Don't pass options.
12430
12431 2009-03-30  Ian Lance Taylor  <iant@google.com>
12432
12433         * ffsll.c (ffsll): Correct implementation.
12434
12435 2009-03-27  Ian Lance Taylor  <iant@google.com>
12436
12437         * ffsll.c: New file.
12438         * configure.ac: Call AC_REPLACE_FUNCS on ffsll.
12439         * gold.h (ffsll): Declare if HAVE_FFSLL is not defined.
12440         * ftruncate.c (ftruncate): Declare before definition.
12441         * mremap.c (mremap): Likewise.
12442         * pread.c (pread): Likewise.
12443         * configure, Makefile.in, config.in: Rebuild.
12444
12445         * mremap.c: New file.
12446         * configure.ac: Call AC_REPLACE_FUNCS on mremap.
12447         * gold.h (MREMAP_MAYMOVE): Define if HAVE_MREMAP is not defined.
12448         (mremap): Declare if HAVE_MREMAP is not defined.
12449         * configure, Makefile.in, config.in: Rebuild.
12450
12451 2009-03-27  Cary Coutant  <ccoutant@google.com>
12452
12453         * powerpc.cc (Target_powerpc::check_non_pic): Assert that output is
12454         position independent.
12455         * sparc.cc (Target_sparc::check_non_pic): Likewise.
12456         * x86_64.cc (Target_x86_64::check_non_pic): Likewise.
12457
12458 2009-03-24  Cary Coutant  <ccoutant@google.com>
12459
12460         * symtab.h (needs_plt_entry): Check for unsatisfied reference from
12461         an executable.
12462         (needs_dynamic_reloc): Likewise.
12463
12464 2009-03-24  Ian Lance Taylor  <iant@google.com>
12465
12466         * yyscript.y (file_cmd): Recognize EXTERN.
12467         (extern_name_list, extern_name_list_body): New nonterminals.
12468         * script.cc (script_add_extern): Define.
12469         * script-c.h (script_add_extern): Declare.
12470
12471 2009-03-24  Rafael Avila de Espindola  <espindola@google.com>
12472
12473         * object.cc (is_elf_object): Define.
12474         * object.h (is_elf_object): Declare.
12475         * archive.cc (Archive::get_elf_object_for_member): Call
12476         is_elf_object.
12477         * readsyms.cc (Read_symbols::do_read_symbols): Likewise.
12478
12479 2009-03-24  Elliott Hughes  <enh@google.com>
12480
12481         * output.cc (Output_file::map_anonymous): Define.
12482         (Output_file::map): Use map_anonymous.  If the regular mmap fails,
12483         try an anonymous one.  Report the size if the mmap fails.
12484         * output.h (class Output_file): Declare map_anonymous.
12485
12486 2009-03-24  Ian Lance Taylor  <iant@google.com>
12487
12488         * target-select.cc (instantiate_target): Don't acquire the lock if
12489         the instantiated_target_ field has already been set.
12490
12491 2009-03-23  Ian Lance Taylor  <iant@google.com>
12492
12493         * gold-threads.h (class Initialize_lock): Define.
12494         * gold-threads.cc (class Initialize_lock_once): Define.
12495         (initialize_lock_control): New static variable.
12496         (initialize_lock_pointer): New static variable.
12497         (initialize_lock_once): New static function.
12498         (Initialize_lock::Initialize_lock): Define.
12499         (Initialize_lock::initialize): Define.
12500         * target-select.h: Include "gold-threads.h".
12501         (class Target_selector): Add lock_ and initialize_lock_ fields.
12502         Don't define instantiate_target, just declare it.
12503         * target-select.cc (Target_selector::Target_selector): Initialize
12504         new fields.
12505         (Target_selector::instantiate_target): Define.
12506         * descriptors.h: Include "gold-threads.h".
12507         (class Descriptors): Add initialize_lock_ field.
12508         * descriptors.cc (Descriptors::Descriptors): Initialize new
12509         field.
12510         (Descriptors::open): Use initialize_lock_ field
12511         * errors.h (class Errors): Add initialize_lock_ field.
12512         * errors.cc (Errors::Errors): Initialize new field.
12513         (Errors::initialize_lock): Use initialize_lock_ field.
12514         * powerpc.cc (class Target_selector_powerpc): Remove
12515         instantiated_target_ field.  In do_recognize call
12516         instantiate_target rather than do_instantiate_target.  In
12517         do_instantiate_target just allocate a new target.
12518         * sparc.cc (class Target_selector_sparc): Likewise.
12519
12520         * freebsd.h: New file.
12521         * i386.cc: Include "freebsd.h".
12522         (Target_i386): Derive from Target_freebsd rather than
12523         Sized_target.
12524         (Target_selector_i386): Derive from Target_selector_freebsd rather
12525         than Target_selector.
12526         * x86_64.cc: Include "freebsd.h".
12527         (Target_x86_64): Derive from Target_freebsd rather than
12528         Sized_target.
12529         (Target_selector_x86_64): Derive from Target_selector_freebsd
12530         rather than Target_selector.
12531         * target.h (class Target): Add adjust_elf_header and
12532         do_adjust_elf_header.
12533         * output.cc (Output_file_header:: do_sized_write): Call target
12534         adjust_elf_header routine.
12535         * configure.tgt: Set targ_osabi.
12536         * configure.ac: Define GOLD_DEFAULT_OSABI.
12537         * parameters.cc (Parameters::default_target): Pass
12538         GOLD_DEFAULT_OSABI to select_target.
12539         * target-select.h (class Target_selector): Make instantiate_target
12540         protected rather than private.
12541         * Makefile.am (HFILES): Add freebsd.h.
12542         * configure, Makefile.in, config.in: Rebuild.
12543
12544         * merge.cc (do_add_input_section): Correct pend value.  Change
12545         message about last entry not being null terminated from error to
12546         warning.
12547
12548 2009-03-20  Mikolaj Zalewski  <mikolajz@google.com>
12549
12550         * incremental.cc: New file.
12551         * Makefile.am (CCFILES): Add incremental.cc.
12552         * Makefile.in: Rebuild.
12553
12554 2009-03-19  Paul Pluzhnikov  <ppluzhnikov@google.com>
12555
12556         * layout.cc (Layout::output_section_name): Preserve names
12557         of '.note.' sections.
12558
12559 2009-03-19  Ian Lance Taylor  <iant@google.com>
12560
12561         * descriptors.cc (Descriptors::open): Check that the options are
12562         valid before using them.
12563
12564 2009-03-18  Ian Lance Taylor  <iant@google.com>
12565
12566         * script-sections.h: Include <list>.
12567         (class Script_sections): Change Sections_elements from std::vector
12568         to std::list.  Typedef public Elements_iterator.  Add
12569         orphan_section_placement_, data_segment_align_start_, and
12570         saw_data_segment_align_ fields.  Remove data_segment_align_index_
12571         field.
12572         * script-sections.cc (class Orphan_section_placement): New class.
12573         (class Sections_element): Add virtual functions is_relro and
12574         orphan_section_init.  Remove virtual function place_orphan_here.
12575         (class Output_section_definition): Add is_relro and
12576         orphan_section_init.  Remove place_orphan_here.
12577         (class Orphan_output_section): Likewise.
12578         (Script_sections::Script_sections): Update for field changes.
12579         (Script_sections::data_segment_align): Set saw_data_segment_align_
12580         and data_segment_align_start_, not data_segment_align_index.
12581         (Script_sections::data_segment_relro_end): Check
12582         saw_data_segment_align_.  Use data_segment_align_start_ rather
12583         than data_segment_align_index_.
12584         (Script_sections::place_orphan): Rewrite to use
12585         Orphan_section_placement.
12586
12587 2009-03-17  Ian Lance Taylor  <iant@google.com>
12588
12589         * archive.cc (Archive::add_symbols): Check for a version attached
12590         to the symbol name in the archive map.
12591         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_11.
12592         (ver_test_11_SOURCES, ver_test_11_DEPENDENCIES): Define.
12593         (ver_test_11_LDFLAGS, ver_test_11_LDADD): Define.
12594         (ver_test_11.a): New target.
12595         * testsuite/Makefile.in: Rebuild.
12596
12597         * configure.ac: Check for chsize and posix_fallocate.  Replace
12598         ftruncate.
12599         * ftruncate.c: New file, from gnulib.
12600         * output.cc (posix_fallocate): Define dummy version if not
12601         HAVE_POSIX_FALLOCATE.
12602         (Output_file::map): Call posix_fallocate rather than lseek and
12603         write.
12604         * gold.h (ftruncate): Declare if not HAVE_FTRUNCATE.
12605         * configure, Makefile.in, config.in: Rebuild.
12606
12607 2009-03-17  Paul Pluzhnikov  <ppluzhnikov@google.com>
12608
12609         * layout.h (Layout::create_note): Add section_name parameter.
12610         * layout.cc (Layout::create_note): Likewise.
12611         (Layout::create_build_id, Layout::create_gold_note): Fix callers.
12612
12613 2009-03-17  Ian Lance Taylor  <iant@google.com>
12614
12615         * descriptors.cc: Include "options.h".
12616         (FD_CLOEXEC, O_CLOEXEC): Define if not defined.
12617         (Descriptors::open): Always use O_CLOEXEC when opening a new
12618         descriptor.  If we have a plugin, and O_CLOEXEC was not defined,
12619         then set FD_CLOEXEC.
12620
12621         * sparc.cc (class Target_sparc): Add has_got_section.
12622         (Target_sparc::Scan::global): If we see _GLOBAL_OFFSET_TABLE_,
12623         make sure we have a GOT section.
12624
12625         * sparc.cc (optimize_tls_reloc): Recognize R_SPARC_TLS_IE_ADD.
12626         (Target_sparc::Scan::local): Likewise.
12627         (Target_sparc::Scan::global): Likewise.
12628         (Target_sparc::Relocate::relocate): Likewise.
12629         (Target_sparc::Relocate::relocate_tls): Likewise.
12630
12631         * symtab.cc (Symbol_table::define_default_version): New function,
12632         broken out of add_from_object.
12633         (Symbol_table::add_from_object): Call define_default_version.
12634         (Symbol_table::define_special_symbol): Add resolve_oldsym
12635         parameter.  Change all callers.  If the version for a symbol comes
12636         from a version script, resolve it with the symbol with the same
12637         name with no version.  Also add the symbol without a version if
12638         appropriate.
12639         (do_define_in_output_data): If resolving with oldsym, don't delete
12640         sym.
12641         (do_define_in_output_segment): Likewise.
12642         (do_define_as_constant): Likewise.
12643         * symtab.h (class Symbol_table): Update declarations.
12644
12645 2009-03-13  Ian Lance Taylor  <iant@google.com>
12646
12647         * readsyms.cc (Read_symbols::incompatible_warning): New function.
12648         (Read_symbols::requeue): New function.
12649         (Read_symbols::do_read_symbols): If make_elf_object fails because
12650         the target type is not configured, and the file was searched for,
12651         issue a warning and retry with the next directory.
12652         (Add_symbols::run): If the file has an incompatible format, and
12653         it was searched for, requeue the Read_symbols task.  On error,
12654         release the object.
12655         * readsyms.h (class Read_symbols): Add dirindex_ field.  Add
12656         dirindex parameter to constructor.  Change all callers.  Declare
12657         incompatible_warning and requeue.
12658         (class Add_symbols): Add dirpath_, dirindex_, mapfile_,
12659         input_argument_ and input_group_ fields.  Add them to
12660         constructor.  Change all callers.
12661         (class Read_script): Add dirindex_ field.  Add it to constructor.
12662         Change all callers.
12663         * archive.cc (Archive::setup): Remove input_objects parameter.
12664         Change all callers.
12665         (Archive::get_file_and_offset): Likewise.
12666         (Archive::read_all_symbols): Likewise.
12667         (Archive::read_symbols): Likewise.
12668         (Archive::get_elf_object_for_member): Remove input_objects
12669         parameter.  Add punconfigured parameter.  Change all callers.
12670         (Archive::add_symbols): Change return type to bool.  Check return
12671         value of include_member.
12672         (Archive::include_all_members): Likewise.
12673         (Archive::include_member): Change return type to bool.  Return
12674         false if first included object has incompatible target.  Set
12675         included_member_ field.
12676         (Add_archive_symbols::run): If add_symbols returns false, requeue
12677         Read_symbols task.
12678         * archive.h (class Archive): Add included_member_ field.
12679         Initialize it in constructor.  Add input_file and searched_for
12680         methods.  Update declarations.
12681         (class Add_archive_symbols): Add dirpath_, dirindex_, and
12682         input_argument_ fields.  Add them to constructor.  Change all
12683         callers.
12684         * script.cc: Include "target-select.h".
12685         (class Parser_closure): Add skip_on_incompatible_target_ and
12686         found_incompatible_target_ fields.  Add
12687         skip_on_incompatible_target parameter to constructor.  Change all
12688         callers.  Add methods skip_on_incompatible_target,
12689         clear_skip_on_incompatible_target, found_incompatible_target, and
12690         set_found_incompatible_target.
12691         (read_input_script): Add dirindex parameter.  Change all callers.
12692         If parser finds an incompatible target, requeue Read_symbols
12693         task.
12694         (script_set_symbol): Clear skip_on_incompatible_target in
12695         closure.
12696         (script_add_assertion, script_parse_option): Likewise.
12697         (script_start_sections, script_add_phdr): Likewise.
12698         (script_check_output_format): New function.
12699         * script.h (read_input_script): Update declaration.
12700         * script-c.h (script_check_output_format): Declare.
12701         * yyscript.y (file_cmd): Handle OUTPUT_FORMAT.
12702         (ignore_cmd): Remove OUTPUT_FORMAT.
12703         * fileread.cc (Input_file::Input_file): Add explicit this.
12704         (Input_file::will_search_for): New function.
12705         (Input_file::open): Add pindex parameter.  Change all callers.
12706         * fileread.h (class Input_file): Add input_file_argument method.
12707         Declare will_search_for.  Update declarations.
12708         * object.cc (make_elf_object): Add punconfigured parameter.
12709         Change all callers.
12710         * object.h (class Object): Make input_file public.  Add
12711         searched_for method.
12712         (make_elf_object): Update declaration.
12713         * dirsearch.cc (Dirsearch::find): Add pindex parameter.  Use it to
12714         restart search.
12715         * dirsearch.h (class Dirsearch): Update declaration.
12716         * options.h (class General_options): Add --warn-search-mismatch.
12717         * parameters.cc (Parameters::is_compatible_target): New function.
12718         * parameters.h (class Parameters): Declare is_compatible_target.
12719         * workqueue.cc (Workqueue::add_blocker): New function.
12720         * workqueue.h (class Workqueue): Declare add_blocker.
12721
12722         * fileread.cc (Input_file::open): Remove options parameter.
12723         Change all callers.
12724         (Input_file::open_binary): Likewise.
12725         * script.cc (read_input_script): Likewise.
12726         * readsyms.h (class Read_symbols): Remove options_ field.  Remove
12727         options parameter from constructor.  Change all callers.
12728         (class Read_script): Likewise.
12729         * fileread.h (class Input_file): Update declarations.
12730         * script.h (read_input_script): Update declaration.
12731
12732 2009-03-10  Nick Clifton  <nickc@redhat.com>
12733
12734         * po/es.po: New Spanish translation.
12735
12736 2009-03-06  Cary Coutant  <ccoutant@google.com>
12737
12738         * options.cc (parse_short_option): Keep dash_z from registering itself.
12739
12740 2009-03-03  Ian Lance Taylor  <iant@google.com>
12741
12742         PR 9918
12743         * target-reloc.h (relocate_section): Pass output_section to
12744         relocate.
12745         * i386.cc (Target_i386::should_apply_static_reloc): Add
12746         output_section parameter.  Change all callers.
12747         (Target_i386::Relocate::relocate): Add output_section parameter.
12748         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12749         * sparc.cc (Target_sparc::Relocate::relocate): Likewise.
12750         * powerpc.cc (Target_powerpc::Relocate::relocate): Likewise.
12751         * testsuite/two_file_shared.sh: New script.
12752         * testsuite/Makefile.am (check_SCRIPTS): Add two_file_shared.sh.
12753         (check_DATA): Add two_file_shared.dbg.
12754         (two_file_shared.dbg): New target.
12755         * testsuite/Makefile.in: Rebuild.
12756
12757 2009-03-01  Ian Lance Taylor  <iant@google.com>
12758
12759         * configure.ac: Check for byteswap.h.
12760         * configure: Rebuild.
12761         * config.in: Rebuild.
12762
12763 2009-03-01  Mikolaj Zalewski  <mikolajz@google.com>
12764
12765         * layout.cc (Layout::find_or_add_kept_section): New function.
12766         (Layout::add_comdat): Removed.
12767         * layout.h (struct Kept_section): Move out of class Layout.
12768         Remove trailing underscores from field names.  Add group_sections
12769         field.  Rename group_ field to is_group.  Change all uses.
12770         (class Layout): Declare find_or_add_kept_section, not add_comdat.
12771         * object.cc (Sized_relobj::Sized_relobj): Don't initialize
12772         comdat_groups_ field.
12773         (Sized_relobj::include_section_group): Use
12774         find_or_add_kept_section and Kept_section::group_sections.
12775         (Sized_relobj::include_linkonce_section): Likewise.
12776         * object.cc (class Sized_relobj): Don't define Comdat_group or
12777         Comdat_group_table.  Remove find_comdat_group and
12778         add_comdat_group.  Remove comdat_groups_ field.
12779         * plugin.cc (include_comdat_group): Use
12780         Layout::find_or_add_kept_section.
12781
12782 2009-02-28  Ian Lance Taylor  <iant@google.com>
12783
12784         * README: --gc-sections and map files are now supported.  Document
12785         some build requirements.
12786
12787         PR 6992
12788         * symtab.cc (Symbol_table::sized_write_section_symbol): In a
12789         relocatable link set the value of the section symbol to zero.
12790         * object.cc (Sized_relobj::do_finalize_local_symbols): In a
12791         relocatable link don't include the section address in the local
12792         symbol value.
12793
12794 2009-02-27  Ian Lance Taylor  <iant@google.com>
12795
12796         PR 6811
12797         * options.h (class Search_directory): Add is_system_directory.
12798         (class General_options): Declare is_in_system_directory.
12799         * options.cc (get_relative_sysroot): Make static.
12800         (get_default_sysroot): Make static.
12801         (General_optoins::is_in_system_directory): New function.
12802         * fileread.cc (Input_file::is_in_system_directory): New function.
12803         * fileread.h (class Input_file): Declare is_in_system_directory.
12804         * object.h (class Object): Add is_in_system_directory.
12805         (class Input_objects): Remove system_library_directory_ field.
12806         * object.cc (Input_objects::add_object): Don't set
12807         system_library_directory_.
12808         (input_objects::found_in_system_library_directory): Remove.
12809         * symtab.cc (Symbol_table::write_globals): Remove input_objects
12810         parameter.  Change all callers.
12811         (Symbol_table::sized_write_globals): Likewise.
12812         (Symbol_table::warn_about_undefined_dynobj_symbol): Likewise.
12813         Call Object::is_in_system_directory.
12814         * symtab.h (class Symbol_table): Update declarations.
12815
12816         PR 5990
12817         * descriptors.h (Open_descriptor): Add is_on_stack field.
12818         * descriptors.cc (Descriptors::open): If the descriptor is on the
12819         top of the stack, remove it.  Initialize is_on_stack field.
12820         (Descriptors::release): Only add pod to stack if it is not on the
12821         stack already.
12822         (Descriptors::close_some_descriptor): Clear stack_next and
12823         is_on_stack fields.
12824
12825         PR 7091
12826         * output.cc (Output_section::find_starting_output_address): Rename
12827         from starting_output_address; add PADDR parameter; change return
12828         type.
12829         * output.h (class Output_section): Declare
12830         find_starting_output_address instead of starting_output_address.
12831         * object.cc (Sized_relobj::do_finalize_local_symbols): Handle a
12832         section symbol for which we can't find a merge section.
12833
12834         PR 9836
12835         * symtab.cc (Symbol_table::add_from_object): If the visibility is
12836         hidden or internal, force the symbol to be local.
12837         * resolve.cc (Symbol::override_visibility): Define.
12838         (Symbol::override_base): Use override_visibility.
12839         (Symbol_table::resolve): Likewise.
12840         (Symbol::override_base_with_special): Likewise.
12841         (Symbol_table::override_with_special): If the visibility is hidden
12842         or internal, force the symbol to be local.
12843         * symtab.h (class Symbol): Add set_visibility and
12844         override_visibility.
12845         * testsuite/ver_test_1.sh: New file.
12846         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_1.sh.
12847         (check_DATA): Add ver_test_1.syms.
12848         (ver_test_1.syms): New target.
12849         * testsuite/Makefile.in: Rebuild.
12850
12851 2009-02-25  Cary Coutant  <ccoutant@google.com>
12852
12853         * layout.cc (Layout::choose_output_section): Don't rename sections
12854         when using a linker script that has a SECTIONS clause.
12855         * Makefile.in: Regenerate.
12856
12857         * testsuite/Makefile.am (script_test_5.sh): New test case.
12858         * testsuite/Makefile.in: Regenerate.
12859         * testsuite/script_test_5.cc: New file.
12860         * testsuite/script_test_5.sh: New file.
12861         * testsuite/script_test_5.t: New file.
12862
12863 2009-02-13  Rafael Avila de Espindola  <espindola@google.com>
12864
12865         * archive.cc (Archive::include_member): Update calls to add_symbols.
12866         * dynobj.cc (Sized_dynobj<size, big_endian>::make_version_map): Add
12867         the Layout argument.
12868         * dynobj.h (do_add_symbols): Add the Layout argument.
12869         * object.cc (Sized_relobj<size, big_endian>::do_add_symbols): Add the
12870         Layout argument.
12871         * object.h (Object::add_symbols): Add the Layout argument.
12872         (Object::do_add_symbols): Add the Layout argument.
12873         (Sized_relobj::do_add_symbols): Add the Layout argument.
12874         * plugin.cc (Sized_pluginobj<size, big_endian>::do_add_symbols):
12875         Unify the two versions.
12876         (Add_plugin_symbols): Remove.
12877         * plugin.h (Pluginobj::add_symbols, Pluginobj::do_add_symbols): Remove.
12878         (Sized_pluginobj::do_add_symbols): Unify the two versions.
12879         (Add_plugin_symbols): Remove.
12880         * readsyms.cc (Read_symbols::do_read_symbols): Update call to
12881         Add_symbols. Use Add_symbols instead of Add_plugin_symbols.
12882         (Add_symbols::run): Make it work with Pulginobj.
12883
12884 2009-02-06  Ian Lance Taylor  <iant@google.com>
12885
12886         * object.cc (Sized_relobj::do_layout): Make info message start
12887         with lower case letter.
12888
12889 2009-02-06  Mikolaj Zalewski  <mikolajz@google.com>
12890
12891         * binary.cc: Fix file comment.
12892
12893         * options.h (enum Incremental_disposition): Define.
12894         (class General_options): Add new options: --incremental,
12895         --incremental_changed, --incremental_unchanged,
12896         --incremental_unknown.  Add incremental_disposition_ and
12897         implicit_incremental_ fields.
12898         (General_options::incremental_disposition): New function.
12899         (class Position_dependent_options): Add incremental_disposition
12900         option.
12901         (Position_dependent_options::copy_from_options): Set incremental
12902         dispositions.
12903         * options.cc (General_options::parse_incremental_changed): New
12904         function.
12905         (General_options::parse_incremental_unchanged): New function.
12906         (General_options::parse_incremental_unknown): New function.
12907         (General_options::General_options): Initialize new fields
12908         incremental_disposition_ and implicit_incremental_.
12909         (General_options::finalize): Check for uasge of --incremental-*
12910         without --incremental.
12911
12912 2009-02-06  Chris Demetriou  <cgd@google.com>
12913
12914         * gold.h (gold_undefined_symbol): Change to take only a Symbol
12915         pointer and to report location as the file name associated with
12916         the symbol.
12917         (gold_undefined_symbol_at_location): New function to replace the
12918         old gold_undefined_symbol functionality.
12919         * target-reloc.h (relocate_section): Update to use
12920         gold_undefined_symbol_at_location.
12921         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
12922         Call gold_undefined_symbol function rather than gold_error.
12923         * errors.h (Errors::undefined_symbol): Take location as a
12924         string, rather than calculating it from a relocation.
12925         * errors.cc (Errors::fatal): Print "fatal error:" before the
12926         formatted message.
12927         (Errors::error, Errors::error_at_location): Print "error: "
12928         before the formatted message.
12929         (Errors::undefined_symbol): Take location as a string, rather
12930         than calculating it from a relocation.
12931         (gold_undefined_symbol_at_location): New function akin to
12932         old gold_undefined_symbol, calculates location from relocation.
12933         (gold_undefined_symbol): Change to take only a Symbol pointer
12934         and to report location as the file name associated with the symbol.
12935         * testsuite/debug_msg.sh: Update for changed error messages.
12936         * testsuite/undef_symbol.sh: Likewise.
12937
12938 2009-02-04  Duncan Sands  <baldrick@free.fr>
12939
12940         PR 9812
12941         * reduced_debug_output.h
12942         (Output_reduced_debug_abbrev_section::failed): Use format for
12943         gold_warning.
12944         (Output_reduced_debug_info_section::faild): Likewise.
12945
12946 2009-01-31  Mikolaj Zalewski  <mikolajz@google.com>
12947
12948         * script.cc (Lazy_demangler): New class.
12949         (Version_script_info::get_symbol_version_helper): Demangle a
12950         symbol only once.
12951
12952 2009-01-29  Cary Coutant  <ccoutant@google.com>
12953
12954         * i386.cc (Target_i386::Relocate::relocate): Recognize non-PIC calls
12955         to __tls_get_addr.
12956         * x86_64.cc (Target_x86_64::Relocate::relocate): Likewise.
12957
12958 2009-01-28  Ian Lance Taylor  <iant@google.com>
12959
12960         * version.cc (version_string): Bump to 1.9.
12961
12962         * gold.h: Include <cstring> and <stdint.h>.
12963         * version.cc: Include <cstdio>.
12964         * object.cc (Sized_relobj::do_layout): Initialize gc_sd to avoid a
12965         warning.
12966         * reduced_debug_output.cc (insert_into_vector): Rename from
12967         Insert_into_vector; change all callers.  Use Swap_unaligned to
12968         avoid aliasing issue; remove union since it is unnecessary.
12969
12970 2009-01-27  Sriraman Tallam  <tmsriram@google.com>
12971
12972         * Makefile.am (CCFILES): Add gc.cc.
12973         (HFILES): Add gc.h.
12974         * Makefile.in: Regenerate.
12975         * gold.cc (Gc_runner): New class.
12976         (queue_initial_tasks): Call garbage collection related tasks
12977         when corresponding options are invoked.
12978         (queue_middle_gc_tasks): New function.
12979         (queue_middle_tasks): Reorder tasks to allow relocs to be read and
12980         processed early before laying out sections during garbage collection.
12981         * gold.h (queue_middle_gc_tasks): New function.
12982         (is_prefix_of): Move from "layout.cc".
12983         * i386.cc (Target_i386::gc_process_relocs): New function.
12984         * layout.cc (is_prefix_of): Remove. Move to "gold.h"
12985         * main.cc (main): Create object of class "Garbage_collection".
12986         * object.cc (Relobj::copy_symbols_data): New function.
12987         (Relobj::is_section_name_included): New function.
12988         (Sized_relobj::do_layout): Allow this function to be called twice
12989         during garbage collection and defer layout of section during the
12990         first call.
12991         * object.h (Relobj::get_symbols_data): New function.
12992         (Relobj::is_section_name_included): New function.
12993         (Relobj::copy_symbols_data): New function.
12994         (Relobj::set_symbols_data): New function.
12995         (Relobj::get_relocs_data): New function.
12996         (Relobj::set_relocs_data): New function.
12997         (Relobj::is_output_section_offset_invalid): New pure virtual function.
12998         (Relobj::gc_process_relocs): New function.
12999         (Relobj::do_gc_process_relocs): New pure virtual function.
13000         (Relobj::sd_): New data member.
13001         (Sized_relobj::is_output_section_offset_invalid): New function.
13002         (Sized_relobj::do_gc_process_relocs): New function.
13003         * options.h (General_options::gc_sections): Modify to not be a no-op.
13004         (General_options::print_gc_sections): New option.
13005         * plugin.cc (Plugin_finish::run): Remove function call to
13006         Plugin_manager::layout_deferred_objects.  Move it to "gold.cc".
13007         * powerpc.cc (Target_powerpc::gc_process_relocs): New function.
13008         * reloc.cc (Read_relocs::run): Add task to process relocs and
13009         determine unreferenced sections when doing garbage collection.
13010         (Gc_process_relocs): New class.
13011         (Sized_relobj::do_gc_process_relocs): New function.
13012         (Sized_relobj::do_scan_relocs): Don't try to scan the relocs for
13013         sections that are garbage collected.
13014         * reloc.h (Gc_process_relocs): New class.
13015         * sparc.cc (Target_sparc::gc_process_relocs): New function.
13016         * symtab.cc (Symbol::should_add_dynsym_entry): Do not add entries for
13017         symbols whose corresponding sections are garbage collected.
13018         (Symbol_table::Symbol_table): Add new parameter for the garbage
13019         collection object.
13020         (Symbol_table::gc_mark_undef_symbols): New function.
13021         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13022         (Symbol_table::gc_mark_dyn_syms): New function.
13023         (Symbol_table::resolve): Do not treat symbols seen in dynamic objects
13024         as garbage.
13025         (Symbol_table::add_from_object): Likewise.
13026         (Symbol_table::add_from_relobj): When building shared objects, do not
13027         treat externally visible symbols as garbage.
13028         (Symbol_table::sized_finalize_symbol): Do not check dynamic symbol
13029         table information for static and relocatable links.
13030         * symtab.h (Symbol_table::set_gc): New function.
13031         (Symbol_table::gc): New function.
13032         (Symbol_table::gc_mark_undef_symbols): New function.
13033         (Symbol_table::gc_mark_symbol_for_shlib): New function.
13034         (Symbol_table::gc_mark_dyn_syms): New function.
13035         (Symbol_table::gc_): New data member.
13036         * target.h (Sized_target::gc_process_relocs): New pure virtual
13037         function.
13038         * x86_64.cc (Target_x86_64::gc_process_relocs): New function.
13039         * testsuite/testfile.cc (Target_test::gc_process_relocs): New function.
13040
13041 2009-01-20  Chris Faylor <me.sourceware@sourceware.org>
13042
13043         * options.h (General_options::gc_sections): Define as a no-op for now.
13044         (General_options::no_keep_memory): Ditto.
13045         (General_options::Bshareable): Define.
13046         * options.cc (General_options::finalize): Honor -Bshareable.
13047
13048 2009-01-20  Andreas Schwab  <schwab@suse.de>
13049
13050         * powerpc.cc (Powerpc_relocate_functions::rel16_ha): Don't try to
13051         read the value in the contents, since we don't use it.  Use the
13052         template endianness when writing.
13053         (Relocate::relocate): Use it for R_PPC_REL16_HA.
13054
13055 2009-01-19  Andreas Schwab  <schwab@suse.de>
13056
13057         * configure.tgt (powerpc64-*): Fix targ_obj.
13058
13059 2009-01-15  Ian Lance Taylor  <iant@google.com>
13060
13061         * object.cc (Sized_relobj::write_local_symbols): Don't write out
13062         local symbols when stripping all symbols.
13063
13064 2009-01-14  Cary Coutant  <ccoutant@google.com>
13065
13066         * output.cc (Output_reloc): Add explicit instantiations.
13067
13068 2009-01-14  Cary Coutant  <ccoutant@google.com>
13069
13070         * archive.cc (Archive::get_elf_object_for_member): Remove call
13071         to File_read::claim_for_plugin.
13072         * descriptors.cc (Descriptors::open): Remove reference to
13073         is_claimed.
13074         (Descriptors::claim_for_plugin): Remove.
13075         * descriptors.h (Descriptors::claim_for_plugin): Remove.
13076         (Descriptors::is_claimed): Remove.
13077         (claim_descriptor_for_plugin): Remove.
13078         * fileread.cc (File_read::claim_for_plugin): Remove.
13079         * fileread.h (File_read::claim_for_plugin): Remove.
13080         (File_read::descriptor): Reopen descriptor if necessary.
13081         * plugin.cc  (Plugin::load): Add two new APIs to transfer vector.
13082         (Plugin_manager::all_symbols_read): Add task parameter. Change
13083         all callers.
13084         (Plugin_manager::get_input_file): New function.
13085         (Plugin_manager::release_input_file): New function.
13086         (Pluginobj::Pluginobj): Add filesize parameter and initialize
13087         corresponding data member.
13088         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter
13089         and pass to base constructor. Change all callers.
13090         (get_input_file, release_input_file): New functions.
13091         (make_sized_plugin_object): Add filesize parameter. Change all callers.
13092         * plugin.h (Plugin_manager::Plugin_manager): Initialize task_ member.
13093         (Plugin_manager::all_symbols_read): Add task parameter.
13094         (Plugin_manager::get_input_file): New function.
13095         (Plugin_manager::release_input_file): New function.
13096         (Plugin_manager::task_): New data member.
13097         (Pluginobj::Pluginobj): Add filesize parameter.
13098         (Pluginobj::filename): New function.
13099         (Pluginobj::descriptor): New function.
13100         (Pluginobj::filesize): New function.
13101         (Pluginobj::filesize_): New data member.
13102         (Sized_pluginobj::Sized_pluginobj): Add filesize parameter.
13103         * readsyms.cc (Read_symbols::do_read_symbols): Remove call to
13104         File_read::claim_for_plugin; use Object::unlock to unlock the file.
13105
13106         * testsuite/Makefile.am (plugin_test_4): New test case for plugins
13107         with archive libraries.
13108         * testsuite/Makefile.in: Regenerate.
13109         * testsuite/plugin_test.c (struct sym_info): New type.
13110         (get_input_file, release_input_file): New static variables.
13111         (onload): Capture new transfer vector entries.
13112         (claim_file_hook): Stop reading at end of file according to filesize.
13113         Factor out parsing of readelf output into separate function.
13114         (all_symbols_read_hook): Exercise get_input_file and release_input_file
13115         APIs and get the source file name from the symbol table.  Convert
13116         source file name to corresponding object file name.  Print info
13117         message when adding new input files.
13118         (parse_readelf_line): New function.
13119         * testsuite/plugin_test_1.sh: Add checks for new info messages.
13120         * testsuite/plugin_test_2.sh: Likewise.
13121         * testsuite/plugin_test_3.sh: Likewise.
13122         * testsuite/plugin_test_4.sh: New test case.
13123
13124 2009-01-07  Ian Lance Taylor  <iant@google.com>
13125
13126         * version.cc (version_string): Bump to 1.8.
13127
13128 2008-12-23  Cary Coutant  <ccoutant@google.com>
13129
13130         * gold.cc (gold_exit): Call plugin cleanup handlers on exit.
13131         * plugin.cc (Plugin_manager::finish): Rename as
13132         layout_deferred_objects.  Move cleanup to separate function.
13133         (Plugin_manager::cleanup): New function.
13134         (Plugin_finish::run): Call layout_deferred_objects and cleanup
13135         separately.
13136         * plugin.h (Plugin_manager::finish): Rename as
13137         layout_deferred_objects.
13138         (Plugin_manager::cleanup): New function.
13139         (Plugin_manager::cleanup_done): New field.
13140
13141 2008-12-23  Cary Coutant  <ccoutant@google.com>
13142
13143         * plugin.cc (is_visible_from_outside): New function.
13144         (Pluginobj::get_symbol_resolution_info): Call is_visible_from_outside
13145         so we don't return "IR only" status for exported symbols or -r links.
13146
13147         * testsuite/Makefile.am (plugin_test_3): New test case.
13148         * testsuite/Makefile.in: Regenerate.
13149         * testsuite/plugin_test_3.sh: New file.
13150
13151 2008-12-22  Cary Coutant  <ccoutant@google.com>
13152
13153         * object.cc (Sized_relobj::layout_section): New function.
13154         (Sized_relobj::do_layout): Defer layout of input sections until after
13155         plugin has provided replacement files.
13156         (Sized_relobj::do_layout_deferred_sections): New function.
13157         * object.h (Relobj::set_section_offset): Remove virtual keyword.
13158         (Relobj::layout_deferred_sections): New function.
13159         (Relobj::do_layout_deferred_sections): New function.
13160         (Sized_relobj::do_layout_deferred_sections): New function.
13161         (Sized_relobj::layout_section): New function.
13162         (Sized_relobj::Deferred_layout): New structure.
13163         (Sized_relobj::deferred_layout_): New field.
13164         * plugin.cc (Plugin_manager::finish): Renamed, was cleanup.
13165         Change all callers.  Layout deferred sections.
13166         (class Plugin_finish): Renamed, was Plugin_cleanup.  Change all
13167         references.
13168         (Plugin_hook::run): Move code from do_plugin_hook inline.
13169         (Plugin_hook::do_plugin_hook): Remove.
13170         * plugin.h (Plugin_manager::Plugin_manager): Add missing initializers.
13171         (Plugin_manager::finish): Renamed, was cleanup.
13172         (Plugin_manager::should_defer_layout): New function.
13173         (Plugin_manager::add_deferred_layout_object): New function.
13174         (Plugin_manager::Deferred_layout_list): New type.
13175         (Plugin_manager::deferred_layout_objects_): New field.
13176         (Plugin_hook::do_plugin_hook): Remove.
13177
13178 2008-12-17  Ian Lance Taylor  <iant@google.com>
13179
13180         * options.h (class General_options): Add --no case for
13181         --export-dynamic.
13182
13183 2008-12-16  Cary Coutant  <ccoutant@google.com>
13184
13185         * plugin.cc (Plugin::load): Move LDPT_MESSAGE to front of transfer
13186         vector.
13187         (Plugin_manager::claim_file): Create plugin object even if
13188         plugin did not call the add_symbols callback.
13189         (Plugin_obj::get_symbol_resolution_info): Guard against plugin
13190         asking for more symbols than were added.
13191         * testsuite/Makefile.am (plugin_test_1): Add test case with
13192         no global symbols.
13193         (empty.syms): New target.
13194         * testsuite/Makefile.in: Regenerate.
13195         * testsuite/plugin_test.c (claim_file_hook): Add new debug
13196         message. Don't call add_symbols if no globals.
13197         (all_symbols_read_hook): Don't provide replacement for empty
13198         claimed file.
13199
13200 2008-12-12  Ian Lance Taylor  <iant@google.com>
13201
13202         * target-reloc.h (Default_scan_relocatable_relocs): Only discard
13203         r_type == 0 for a local symbol with r_sym == 0.
13204         (scan_relocatable_relocs): Pass r_sym to
13205         local_non_section_strategy.
13206         * reloc.cc (Emit_relocs_strategy::local_non_section_strategy): Add
13207         r_sym parameter.
13208
13209         * configure.ac: Update test for TLS descriptors: they are
13210         supported as of glibc 2.9.
13211         * configure: Rebuild.
13212
13213 2008-12-11  Ian Lance Taylor  <iant@google.com>
13214
13215         PR 7091
13216         * target-reloc.h (Default_scan_relocatable_relocs): For each
13217         function, map r_type == 0 to RELOC_DISCARD.
13218
13219 2008-12-10  Cary Coutant  <ccoutant@google.com>
13220
13221         * layout.cc (Layout::add_comdat): Allow COMDAT group from a replacement
13222         object to override a kept COMDAT group from a plugin object.
13223
13224 2008-12-09  Ian Lance Taylor  <iant@google.com>
13225
13226         PR 7088
13227         * yyscript.y (file_cmd): Handle INPUT.
13228
13229         * testsuite/initpri1.c: Change all declarations to be full
13230         prototypes by adding void, to avoid compiler warnings.
13231
13232 2008-12-05  Rafael Avila de Espindola  <espindola@google.com>
13233
13234         * options.cc (General_options::parse_plugin_opt): New.
13235         (General_options::add_plugin): The argument now is just the filename.
13236         (General_options::add_plugin_option): New.
13237         * options.h (plugin_opt): New.
13238         (add_plugin): Change argument name.
13239         (add_plugin_option): New.
13240         * plugin.cc (Plugin::load): Don't parse the plugin option.
13241         * plugin.h (Plugin::Plugin): Rename argument. Init filename_.
13242         (Plugin::add_option): New.
13243         (Plugin::args_): Change type.
13244         (Plugin::filename_): New.
13245         (Plugin_manager::add_plugin_option): New.
13246         * testsuite/Makefile.am (plugin_test_1): Use new syntax.
13247         * testsuite/Makefile.in: Regenerate.
13248
13249 2008-12-05  Cary Coutant  <ccoutant@google.com>
13250
13251         * layout.cc (Layout::include_section): Check for SHF_EXCLUDE.
13252         Handle --strip-lto-sections option.
13253         * options.h (strip_lto_sections): New option.
13254
13255 2008-12-01  Cary Coutant  <ccoutant@google.com>
13256
13257         * plugin.cc (ld_plugin_message): Change format parameter to const.
13258         Fix mismatch between new[] and delete.
13259
13260 2008-11-14  Cary Coutant  <ccoutant@google.com>
13261
13262         * reloc.cc (Sized_relobj::do_read_relocs): Use constant invalid_address
13263         instead of -1U.
13264
13265 2008-11-05  Craig Silverstein  <csilvers@google.com>
13266
13267         * options.cc (General_options::parse_dynamic_list): New function.
13268         * options.h (General_options): New flags dynamic_list,
13269         dynamic_list_data, dynamic_list_cpp_new, and
13270         dynamic_list_cpp_typeinfo.  New variable dynamic_list_.
13271         (General_options::in_dynamic_list): New function.
13272         * script.cc (Lex::Mode): New enum DYNAMIC_LIST.
13273         (Lex::can_start_name): Add support for DYNAMIC_LIST mode.
13274         (Lex::can_continue_name): Likewise.
13275         (yylex): Likewise.
13276         (read_script_file): New parameter script_options.
13277         (read_dynamic_list): New function.
13278         (Script_options::define_dynamic_list): New function.
13279         (dynamic_list_keyword_parsecodes): New variable.
13280         (dynamic_list_keywords): New variable.
13281         * script.h (Script_options::define_dynamic_list): New function
13282         prototype.
13283         (read_dynamic_list): New function prototype.
13284         * symtab.cc (strprefix): New macro.
13285         (Symbol::should_add_dynsym_entry): Support dynamic_list,
13286         dynamic_list_data, dynamic_list_cpp_new, and
13287         dynamic_list_cpp_typeinfo.
13288         * yyscript.y (PARSING_DYNAMIC_LIST): New token.
13289         (dynamic_list_expr): New rule.
13290         (dynamic_list_nodes): Likewise.
13291         (dynamic_list_node): Likewise.
13292         * testsuite/Makefile.am (dynamic_list): New test.
13293         * testsuite/Makefile.in: Regenerated.
13294         * testsuite/dynamic_list.t: New file.
13295         * testsuite/dynamic_list.sh: New file.
13296
13297 2008-11-05  Craig Silverstein  <csilvers@google.com>
13298
13299         * testsuite/tls_test_c.c: Add prototype for t11 and t11_last.
13300         * testsuite/tls_test_c.c (t11): Add explicit "void" to prototype.
13301         (t11_last): Likewise.
13302         * testsuite/ver_test_6.c (main): Likewise.
13303
13304 2008-10-07  Cary Coutant  <ccoutant@google.com>
13305
13306         * options.c (General_options::finalize): Add check for -static and
13307         -shared.
13308         * gold.cc (queue_middle_tasks): Assert that list of dynamic objects
13309         is not empty.
13310
13311 2008-10-02  Cary Coutant  <ccoutant@google.com>
13312
13313         * plugin.cc (make_sized_plugin_object): Fix conditional
13314         compilation to work when not all targets are enabled.
13315
13316 2008-09-29  Cary Coutant  <ccoutant@google.com>
13317
13318         * archive.cc (Archive::get_file_and_offset): Use filename instead
13319         of name to get library path.
13320         (Archive::include_member): Unlock external member of a thin archive.
13321
13322         * testsuite/Makefile.am (TEST_AR): New variable.
13323         (thin_archive_test_1): New test.
13324         (thin_archive_test_2): New test.
13325         * testsuite/Makefile.in: Regenerate.
13326         * testsuite/thin_archive_main.cc: New file.
13327         * testsuite/thin_archive_test_1.cc: New file.
13328         * testsuite/thin_archive_test_2.cc: New file.
13329         * testsuite/thin_archive_test_3.cc: New file.
13330         * testsuite/thin_archive_test_4.cc: New file.
13331
13332 2008-09-29  Cary Coutant  <ccoutant@google.com>
13333
13334         * mapfile.cc (Mapfile::print_input_section): Change -1U to -1ULL.
13335         * object.cc (Sized_relobj::do_layout): Use constant invalid_address
13336         instead of -1U.
13337         (Sized_relobj::do_finalize_local_symbols): Likewise.
13338         (Sized_relobj::map_to_kept_section): Likewise.
13339         * object.h (Sized_relobj::invalid_address): New constant.
13340         (Sized_relobj::do_output_section_offset): Check for invalid_address
13341         and return -1ULL.
13342         * output.cc (Output_reloc::local_section_offset): Use constant
13343         invalid_address instead of -1U.
13344         (Output_reloc::get_address): Likewise.
13345         (Output_section::output_address): Change -1U to -1ULL.
13346         * output.h (Output_reloc::invalid_address): New constant.
13347         * reloc.cc (Sized_relobj::write_sections): Use constant
13348         invalid_address instead of -1U.
13349         (Sized_relobj::relocate_sections): Likewise.
13350         * symtab.cc (Symbol_table::sized_finalize_symbol): Handle symbol
13351         values for merge sections.
13352         * target-reloc.h (relocate_for_relocatable): Use constant
13353         invalid_address instead of -1U.
13354
13355 2008-09-19  Cary Coutant  <ccoutant@google.com>
13356
13357         Add plugin functionality for link-time optimization (LTO).
13358         * configure.ac (plugins): Add --enable-plugins option.
13359         * configure: Regenerate.
13360         * config.in: Regenerate.
13361         * Makefile.am (LIBDL): New variable.
13362         (CCFILES): Add plugin.cc.
13363         (HFILES): Add plugin.h.
13364         (ldadd_var): Add LIBDL.
13365         * Makefile.in: Regenerate.
13366
13367         * archive.cc: Include "plugin.h".
13368         (Archive::setup): Don't preread archive symbols when using a plugin.
13369         (Archive::get_file_and_offset): Add memsize parameter.  Change callers.
13370         (Archive::get_elf_object_for_member): Call plugin hooks for claiming
13371         files.
13372         (Archive::include_member): Add symbols from plugin objects.
13373         * archive.h (Archive::get_file_and_offset): Add memsize parameter.
13374         * descriptors.cc (Descriptors::open): Check for file descriptors
13375         abandoned by plugins.
13376         (Descriptors::claim_for_plugin): New function.
13377         * descriptors.h (Descriptors::claim_for_plugin): New function.
13378         (Open_descriptor::is_claimed): New field.
13379         (claim_descriptor_for_plugin): New function.
13380         * fileread.cc (File_read::claim_for_plugin): New function.
13381         * fileread.h (File_read::claim_for_plugin): New function.
13382         (File_read::descriptor): New function.
13383         * gold.cc: Include "plugin.h".
13384         (queue_initial_tasks): Add task to call plugin hooks for generating
13385         new object files.
13386         * main.cc: Include "plugin.h".
13387         (main): Load plugin libraries.
13388         * object.h (Pluginobj): Declare.
13389         (Object::pluginobj): New function.
13390         (Object::do_pluginobj): New function.
13391         (Object::set_target): New function.
13392         * options.cc: Include "plugin.h".
13393         (General_options::parse_plugin): New function.
13394         (General_options::General_options): Initialize plugins_ field.
13395         (General_options::add_plugin): New function.
13396         * options.h (Plugin_manager): Declare.
13397         (General_options): Add --plugin option.
13398         (General_options::has_plugins): New function.
13399         (General_options::plugins): New function.
13400         (General_options::add_plugin): New function.
13401         (General_options::plugins_): New field.
13402         * plugin.cc: New file.
13403         * plugin.h: New file.
13404         * readsyms.cc: Include "plugin.h".
13405         (Read_symbols::do_read_symbols): Check for archive before checking
13406         for ELF file.  Call plugin hooks to claim files.
13407         * resolve.cc (Symbol_table::resolve): Record when symbol is referenced
13408         from a real object file; force override when processing replacement
13409         files.
13410         * symtab.cc (Symbol::init_fields): Initialize in_real_elf_ field.
13411         (Symbol::init_base_object): Likewise.
13412         (Symbol::init_base_output_data): Likewise.
13413         (Symbol::init_base_output_segment): Likewise.
13414         (Symbol::init_base_constant): Likewise.
13415         (Symbol::init_base_undefined): Likewise.
13416         (Symbol::output_section): Assert that object is not a plugin.
13417         (Symbol_table::add_from_pluginobj): New function.
13418         (Symbol_table::sized_finalize_symbol): Treat symbols from plugins as
13419         undefined.
13420         (Symbol_table::sized_write_globals): Likewise.
13421         (Symbol_table::add_from_pluginobj): Instantiate template.
13422         * symtab.h (Sized_pluginobj): Declare.
13423         (Symbol::in_real_elf): New function.
13424         (Symbol::set_in_real_elf): New function.
13425         (Symbol::in_real_elf_): New field.
13426         (Symbol_table::add_from_pluginobj): New function.
13427
13428         * testsuite/Makefile.am (AM_CFLAGS): New variable.
13429         (LIBDL): New variable.
13430         (LDADD): Add LIBDL.
13431         (check_PROGRAMS): Add plugin_test_1 and plugin_test_2.
13432         (check_SCRIPTS): Add plugin_test_1.sh and plugin_test_2.sh.
13433         (check_DATA): Add plugin_test_1.err and plugin_test_2.err.
13434         (MOSTLYCLEANFILES): Likewise.
13435         * testsuite/Makefile.in: Regenerate.
13436         * testsuite/plugin_test.c: New file.
13437         * testsuite/plugin_test_1.sh: New file.
13438         * testsuite/plugin_test_2.sh: New file.
13439
13440 2008-09-16  Ian Lance Taylor  <iant@google.com>
13441
13442         * target-reloc.h (relocate_section): Check whether a symbol is
13443         defined by the ABI before reporting an undefined symbol error.
13444         * target.h (Target::is_defined_by_abi): Make parameter const.
13445         (Target::do_is_defined_by_abi): Likewise.
13446         * i386.cc (Target_i386::do_is_defined_by_abi): Likewise.
13447         * powerpc.cc (Target_powerpc::do_is_defined_by_abi): Likewise.
13448         * sparc.cc (Target_sparc::do_is_defined_by_abi): Likewise.
13449         * x86_64.cc (Target_x86_64::do_is_defined_by_abi): Likewise.
13450         * testsuite/Makefile.am (tls_test_shared.so): Add -Wl,-z,defs.
13451         * testsuite/Makefile.in: Rebuild.
13452
13453         * fileread.cc (make_view): Add casts to avoid warning.
13454
13455 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13456
13457         * i386.cc (Target_i386::define_tls_base_symbol): Update comments.
13458         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13459
13460 2008-09-16  Alexandre Oliva  <aoliva@redhat.com>
13461
13462         * options.h (General_options::output_is_executable): New.
13463         (General_options::output_is_pie): New.
13464         * i386.cc (Target_i386::define_tls_base_symbol): Use SEGMENT_START
13465         for shared libraries.
13466         * x86_64.cc (Target_x86_64::define_tls_base_symbol): Likewise.
13467
13468 2008-09-11  Chris Demetriou  <cgd@google.com>
13469
13470         * options.h (origin): New -z option.
13471         * layout.cc (Layout:finish_dynamic_section): If "-z origin"
13472         is specified, set DF_ORIGIN in DT_FLAGS and set DF_1_ORIGIN
13473         in DT_FLAGS_1.
13474
13475 2008-09-05  Cary Coutant  <ccoutant@google.com>
13476
13477         * fileread.cc (File_read::make_view): Add check for attempt to map
13478         beyond end of file.
13479
13480 2008-09-05  Cary Coutant  <ccoutant@google.com>
13481
13482         * symtab.cc (Symbol_table::add_from_dynobj): Fix typos in
13483         explicit instantiations.
13484
13485 2008-08-28  Kris Van Hees  <kris.van.hees@oracle.com>
13486
13487         PR gold/6858
13488         * options.cc (General_options::finalize): Allow undefined symbols
13489         in shlibs if linking -shared.
13490
13491         PR gold/6859
13492         * symtab.cc (Symbol::init_base_undefined): Mark explicitly undefined
13493         symbols as not needing a dynsym entry.
13494
13495 2008-08-20  Craig Silverstein  <csilvers@google.com>
13496
13497         * fileread.cc (File_read::open): Do not lock the file unless it
13498         was successfully opened.
13499
13500 2008-08-14  Cary Coutant  <ccoutant@google.com>
13501
13502         * x86_64.cc (Target_x86_64::Relocate::relocat_tls):
13503         Use addend for DTPOFF32, DTPOFF64, and TPOFF32 relocs.
13504         * testsuite/tls_test.cc (struct int128): 128-bit struct
13505         for testing TLS relocs with non-zero addend.
13506         (v12): New TLS variable.
13507         (t12): New test.
13508         (t_last): Add check for v12.
13509         * testsuite/tls_test.h (t12): New function.
13510         * testsuite/tls_test_main.cc (thread_routine): Call new test.
13511
13512 2008-08-13  Ian Lance Taylor  <iant@google.com>
13513
13514         * layout.cc (Layout::attach_allocated_section_to_segment): Don't
13515         set tls_segment_ or relro_segment_.
13516         (Layout::make_output_segment): Set tls_segment_ and relro_segment_
13517         when appropriate.
13518         * output.h (Output_section::clear_is_relro): New function.
13519         * output.cc (Output_segment::add_output_section): Handle SHF_TLS
13520         sections specially even when output_data_ is empty.
13521         (Output_segment::maximum_alignment): When first section is relro,
13522         only force alignment for PT_LOAD segments.
13523         * script.cc (script_data_segment_align): New function.
13524         (script_data_segment_relro_end): New function.
13525         * script-c.h (script_data_segment_align): Declare.
13526         (script_data_segment_relro_end): Declare.
13527         * script-sections.h (class Script_sections): Declare
13528         data_segment_align and data_segment_relro_end.  Add fields
13529         segment_align_index_ and saw_relro_end_.
13530         * script-sections.cc (class Sections_element): Add set_is_relro
13531         virtual function.  Add new bool* parameter to place_orphan_here.
13532         Add get_output_section virtual function.
13533         (class Output_section_definition): Add set_is_relro.  Add new
13534         bool* parameter to place_orphan_here.  Add get_output_section.
13535         Add is_relro_ field.
13536         (Output_section_definition::Output_section_definition): Initialize
13537         evaluated_address_, evaluated_load_address, evaluated_addralign_,
13538         and is_relro_ fields.
13539         (Output_section_definition::place_orphan_here): Add is_relro
13540         parameter.
13541         (Output_section_definition::set_section_addresses): Set relro for
13542         output section.
13543         (Output_section_definition::alternate_constraint): Likewise.
13544         (class Orphan_output_section): Add new bool* parameter to
13545         place_orphan_here.  Add get_output_section.
13546         (Orphan_output_section::place_orphan_here): Add is_relro
13547         parameter.
13548         (Script_sections::Script_sections): Initialize
13549         data_segment_align_index_ and saw_relro_end_.
13550         (Script_sections::data_segment_align): New function.
13551         (Script_sections::data_segment_relro_end): New function.
13552         (Script_sections::place_orphan): Set or clear is_relro.
13553         (Script_sections::set_section_addresses): Force alignment of first
13554         TLS section.
13555         * yyscript.y (exp): Call script_data_segment_align and
13556         script_data_segment_relro_end.
13557         * testsuite/relro_script_test.t: New file.
13558         * testsuite/relro_test.cc (using_script): Declare.
13559         (t1, t2): Test using_script.
13560         * testsuite/Makefile.am (check_PROGRAMS): Add relro_script_test.
13561         (relro_script_test_SOURCES): Define.
13562         (relro_script_test_DEPENDENCIES): Define.
13563         (relro_script_test_LDFLAGS): Define.
13564         (relro_script_test_LDADD): Define.
13565         (relro_script_test.so): New target.
13566         * testsuite/Makefile.in: Rebuild.
13567
13568 2008-08-06  Cary Coutant <ccoutant@google.com>
13569
13570         * archive.cc (Archive::total_archives, Archive::total_members)
13571         (Archive::total_members_loaded): New variables.
13572         (Archive::setup): Add parameter.  Add option to preread
13573         archive symbols.
13574         (Archive::read_armap): Add counter.
13575         (Archive::get_file_and_offset): New function.
13576         (Archive::get_elf_object_for_member): New function.
13577         (Archive::read_all_symbols): New function.
13578         (Archive::read_symbols): New function.
13579         (Archive::add_symbols): Add counters.
13580         (Archive::include_all_members): Use armap to find members if it's
13581         already built.
13582         (Archive::include_member): Skip reading symbols if already read.
13583         Factored code into Archive::get_file_and_offset and
13584         Archive::get_elf_object_for_member.  Changed call to
13585         Mapfile::report_include_archive_member.
13586         (Archive::print_stats): New function.
13587         * archive.h: Declare Object and Read_symbols_data classes.
13588         (Archive::Archive): Add initializers for new members.
13589         (Archive::setup): Add parameter.
13590         (Archive::print_stats): New function.
13591         (Archive::total_archives, Archive::total_members)
13592         (Archive::total_members_loaded): New variables.
13593         (Archive::get_file_and_offset): New function.
13594         (Archive::get_elf_object_for_member): New function.
13595         (Archive::read_all_symbols): New function.
13596         (Archive::read_symbols): New function.
13597         (Archive::Archive_member): New class.
13598         (Archive::members_): New member.
13599         (Archive::num_members_): New member.
13600         * main.cc: Include archive.h.
13601         (main): Call Archive::print_stats.
13602         * mapfile.cc (Mapfile::report_include_archive_member): Delete
13603         archive parameter; member_name is now the fully-decorated name.
13604         * mapfile.h (Mapfile::report_include_archive_member): Likewise.
13605         * options.h: (General_options): Add --preread-archive-symbols option.
13606         * readsyms.cc (Read_symbols::do_read_symbols): Change call to
13607         Archive::setup.
13608
13609 2008-08-04  Ian Lance Taylor  <iant@google.com>
13610
13611         * symtab.h (Symbol::use_plt_offset): New function.
13612         * i386.cc (Relocate::relocate): Call Symbol::use_plt_offset.
13613         * powerpc.cc (Relocate::relocate): Likewise.
13614         * sparc.cc (Relocate::relocate): Likewise.
13615         * x86_64.cc (Relocate::relocate): Likewise.
13616         * testsuite/weak_plt.sh: New test.
13617         * testsuite/weak_plt_main.cc: New test.
13618         * testsuite/weak_plt_shared.cc: New test.
13619         * testsuite/Makefile.am (check_SCRIPTS): Add weak_plt.sh.
13620         (check_PROGRAMS): Add weak_plt.
13621         (check_DATA): Add weak_plt_shared.so.
13622         (weak_plt_main_pic.o, weak_plt): New targets.
13623         (weak_plt_shared_pic.o, weak_plt_shared.so): New targets.
13624         * testsuite/Makefile.in: Rebuild.
13625
13626         * testsuite/Makefile.am (weak_alias_test_1.so): Depend upon
13627         gcctestdir/ld.
13628         (weak_alias_test_2.so, weak_alias_test_4.so): Likewise.
13629         * testsuite/Makefile.in: Rebuild.
13630
13631 2008-08-04  Alan Modra  <amodra@bigpond.net.au>
13632
13633         * Makefile.am (POTFILES.in): Set LC_ALL=C.
13634         * Makefile.in: Regenerate.
13635         * po/POTFILES.in: Regenerate.
13636
13637 2008-07-29  Ian Lance Taylor  <iant@google.com>
13638
13639         * script.cc (Script_options::finalize_symbols): Finalize SECTIONS
13640         symbols before other symbols.
13641         * testsuite/script_test_2.cc (test_addr): Declare.
13642         (test_addr_alias): Declare.
13643         (main): Check that test_addr and test_addr_alias have the right
13644         values.
13645         * testsuite/script_test_2.t: Define test_addr_alias and
13646         test_addr.
13647
13648 2008-07-24  Ian Lance Taylor  <iant@google.com>
13649
13650         PR 5990
13651         * descriptors.cc: New file.
13652         * descriptors.h: New file.
13653         * gold-threads.h (class Hold_optional_lock): New class.
13654         * fileread.cc: Include "descriptors.h".
13655         (File_read::~File_read): Release descriptor rather than closing
13656         it.
13657         (File_read::open) [file]: Call open_descriptor rather than open.
13658         Set is_descriptor_opened_.
13659         (File_read::open) [memory]: Assert that descriptor is not open.
13660         (File_read::reopen_descriptor): New function.
13661         (File_read::release): Release descriptor.
13662         (File_read::do_read): Make non-const.  Reopen descriptor.
13663         (File_read::read): Make non-const.
13664         (File_read::make_view): Reopen descriptor.
13665         (File_read::do_readv): Likewise.
13666         * fileread.h (class File_read): Add is_descriptor_opened_ field.
13667         Update declarations.
13668         * layout.cc: Include "descriptors.h".
13669         (Layout::create_build_id): Use open_descriptor rather than open.
13670         * output.cc: Include "descriptors.h".
13671         (Output_file::open): Use open_descriptor rather than open.
13672         * archive.cc (Archive::const_iterator): Change Archive to be
13673         non-const.
13674         (Archive::begin, Archive::end): Make non-const.
13675         (Archive::count_members): Likewise.
13676         * archive.h (class Archive): Update declarations.
13677         * object.h (Object::read): Make non-const.
13678         * Makefile.am (CCFILES): Add descriptors.cc.
13679         (HFILES): Add descriptors.h.
13680         * Makefile.in: Rebuild.
13681
13682         PR 6716
13683         * gold.h: Always include <clocale>.  Add Solaris workarounds
13684         following code in binutils/sysdep.h.
13685
13686         PR 6048
13687         * ehframe.cc (Eh_frame::add_ehframe_input_section): Check whether
13688         this->eh_frame_hdr_ is NULL before using it.
13689
13690         * dynobj.cc (Versions::Versions): Update comment.
13691
13692         * dynobj.cc (Versions::Versions): If there is an soname, use it as
13693         the base version name.
13694
13695         * stringpool.cc (Stringpool_template::add_with_length): Set key to
13696         array size plus one.
13697         (Stringpool_template::set_string_offsets): Subtract one from key
13698         before using it as an array index.
13699         (Stringpool_template::get_offset_with_length): Likewise.
13700         (Stringpool_template::write_to_buffer): Likewise.
13701         * stringpool.h (Stringpool_template::get_offset_from_key):
13702         Likewise.
13703
13704 2008-07-23  Ian Lance Taylor  <iant@google.com>
13705
13706         PR 6658
13707         * object.h (Merged_symbol_value::value): Do our best to handle a
13708         negative addend.
13709
13710         PR 6647
13711         * script.cc (Version_script_info::get_versions): Don't add empty
13712         version tag to return value.
13713         (Version_script_info::get_symbol_version_helper): Change return
13714         type to bool.  Add pversion parameter.  Change all callers.
13715         (script_register_vers_node): Don't require a non-NULL tag.
13716         * script.h (class Version_script_info): Update declarations.
13717         (Version_script_info::get_symbol_version): Change return type to
13718         bool.  Add version parameter.  Change all callers.
13719         * symtab.cc (Sized_symbol::add_from_relobj): Rework version
13720         handling.  Handle an empty version from a version script.
13721         (Symbol_table::define_special_symbol): Likewise.
13722         * testsuite/ver_test_10.script: New file.
13723         * testsuite/ver_test_10.sh: New file.
13724         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_10.sh.
13725         (check_DATA): Add ver_test_10.syms.
13726         (ver_test_10.syms, ver_test_10.so): New target.
13727         * testsuite/Makefile.in: Rebuild.
13728
13729 2008-07-23  Simon Baldwin  <simonb@google.com>
13730
13731         * symtab.cc (Symbol_table::sized_write_symbol): Only set st_size
13732         to zero for undefined symbols from dynamic libraries.
13733
13734 2008-07-23  Ian Lance Taylor  <iant@google.com>
13735
13736         * symtab.cc (Symbol_table::resolve): Remove version parameter.
13737         Change all callers.
13738         * symtab.h (class Symbol_table): Update declaration.
13739         * testsuite/ver_test_9.cc: New file.
13740         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_9.
13741         (ver_test_9_SOURCES, ver_test_9_DEPENDENCIES): Define.
13742         (ver_test_9_LDFLAGS, ver_test_9_LDADD): Define.
13743         (ver_test_9.so, ver_test_9.o): New targets.
13744         * testsuite/Makefile.in: Rebuild.
13745
13746 2008-07-22  Ian Lance Taylor  <iant@google.com>
13747
13748         * options.h (class General_options): Define --check-sections.
13749         * layout.cc (Layout::set_segment_offsets): Handle
13750         --check-sections.
13751
13752         * options.h (class General_options): Define -n/--nmagic and
13753         -N/--omagic.
13754         * options.cc (General_options::finalize): For -n/--nmagic or
13755         -N/--omagic, set -static.
13756         * layout.cc (Layout::attach_allocated_section_to_segment): If
13757         -N/--omagic, don't put read-only and read-write sections in
13758         different segments.
13759         (Layout::find_first_load_seg): If -N/--omagic, don't insist on
13760         finding a read-only segment.
13761         (Layout::set_segment_offsets): If -N/--omagic or -n/--nmagic,
13762         don't set the minimum segment alignment to the common page size,
13763         and don't set the file offset to the address modulo the page size.
13764         * script-sections.cc (Script_sections::create_segments): If
13765         -n/--omagic, don't put read-only and read-write sections in
13766         different segments.
13767
13768         * cref.cc: New file.
13769         * cref.h: New file.
13770         * options.h (class General_options): Add --print-symbol-counts.
13771         * main.cc (main): Issue defined symbol report if requested.
13772         * archive.cc (Archive::interpret_header): Make into a const member
13773         function.
13774         (Archive::add_symbols): Call Input_objects::archive_start and
13775         archive_stop.
13776         (Archive::const_iterator): Define new class.
13777         (Archive::begin, Archive::end): New functions.
13778         (Archive::include_all_members): Rewrite to use iterator.
13779         (Archive::count_members): New function.
13780         * archive.h (class Archive): Update declarations.
13781         (Archive::filename): New function.
13782         * object.cc: Include "cref.h".
13783         (Sized_relobj::Sized_relobj): Initialize defined_count_.
13784         (Sized_relobj::do_get_global_symbol_counts): New function.
13785         (Input_objects::add_object): Add object to cross-referencer.
13786         (Input_objects::archive_start): New function.
13787         (Input_objects::archive_stop): New function.
13788         (Input_objects::print_symbol_counts): New function.
13789         * object.h: Declare Cref and Archive.
13790         (Object::get_global_symbol_counts): New function.
13791         (Object::do_get_global_symbol_counts): New pure virtual function.
13792         (class Sized_relobj): Add defined_count_ field.  Update
13793         declarations.
13794         (class Input_objects): Add cref_ field.  Update constructor.
13795         Update declarations.
13796         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize symbols_ and
13797         defined_count_.
13798         (Sized_dynobj::do_add_symbols): Allocate symbols_ if printing
13799         symbol counts.
13800         (Sized_dynobj::do_get_global_symbol_counts): New function.
13801         * dynobj.h (class Sized_dynobj): Add fields symbols_ and
13802         defined_count_.  Update declarations.  Define Symbols typedef.
13803         * symtab.cc (Symbol_table::add_from_relobj): Add defined
13804         parameter.  Change all callers.
13805         (Symbol_table::add_from_dynobj): Add sympointers and defined
13806         parameters.  Change all callers.
13807         * symtab.h (class Symbol_table): Update declarations.
13808         * Makefile.am (CCFILES): Add cref.cc.
13809         (HFILES): Add cref.h.
13810         * Makefile.in: Rebuild.
13811
13812 2008-07-22  Simon Baldwin  <simonb@google.com>
13813
13814         * symtab.cc (Symbol_table::sized_write_symbol): Set symbol size
13815         to zero when writing undefined symbols.
13816
13817 2008-07-22  Ian Lance Taylor  <iant@google.com>
13818
13819         * output.cc (Output_section::add_input_section): Don't try to
13820         merge empty merge sections.
13821
13822 2008-07-21  Craig Silverstein  <csilvers@google.com>
13823
13824         * symtab.cc (Symbol_table::warn_about_undefined_dynobj_symbol):
13825         Include symbol version in error message.
13826
13827 2008-07-20  Chris Demetriou  <cgd@google.com>
13828
13829         * configure.ac (gold_cv_c_random_seed): New configured variable.
13830         (RANDOM_SEED_CFLAGS): New substituted variable.
13831         * Makefile.am (AM_CFLAGS, AM_CXXFLAGS): Add $(RANDOM_SEED_CFLAGS).
13832         * configure: Rebuild.
13833         * Makefile.in: Likewise.
13834         * testsuite/Makefile.in: Likewise.
13835
13836 2008-07-18  Ian Lance Taylor  <iant@google.com>
13837
13838         * symtab.cc (Symbol_table::add_from_object): Rewrite the case
13839         where we see NAME/NULL and NAME/VERSION  as separate symbols.
13840         * testsuite/ver_test_main.cc (main): Call t4.
13841         (t4, t4_2a): Define.
13842         * testsuite/ver_test_2.cc (t4_2): Define.
13843         * testsuite/ver_test_2.script: Put t4_2a in VER2.
13844         * testsuite/ver_test_4.cc (t4_2a): Define.
13845         * testsuite/ver_test_4.script: Put t4_2a in VER2.
13846         * testsuite/ver_test.h (t4, t4_2, t4_2a): Declare.
13847
13848 2008-07-17  Ian Lance Taylor  <iant@google.com>
13849
13850         * dynobj.cc (Versions::add_def): If we give an error about a
13851         missing version, go ahead and create the version anyhow.
13852
13853 2008-07-10  Ian Lance Taylor  <iant@google.com>
13854
13855         Handle output sections with more than 0x7fffffff bytes.
13856         * object.h (class Relobj): Change map_to_output_ to
13857         output_sections_, and just keep a section pointer.  Change all
13858         uses.  Move comdat group support to Sized_relobj.
13859         (Relobj::is_section_specially_mapped): Remove.
13860         (Relobj::output_section): Remove poff parameter.  Change all
13861         callers.
13862         (Relobj::output_section_offset): New function.
13863         (Relobj::set_section_offset): Rewrite.
13864         (Relobj::map_to_output): Remove.
13865         (Relobj::output_sections): New function.
13866         (Relobj::do_output_section_offset): New pure virtual function.
13867         (Relobj::do_set_section_offset): Likewise.
13868         (class Sized_relobj): Add section_offsets_ field.  Add comdat
13869         group support from Relobj.  Update declarations.
13870         (Sized_relobj::get_output_section_offset): New function.
13871         (Sized_relobj::do_output_section_offset): New function.
13872         (Sized_relobj::do_set_section_offset): New function.
13873         * object.cc (Relobj::output_section_address): Remove.
13874         (Sized_relobj::Sized_relobj): Initialize new fields.
13875         (Sized_relobj::include_section_group): Cast find_kept_object to
13876         Sized_relobj.
13877         (Sized_relobj::include_linkonce_section): Likewise.
13878         (Sized_relobj::do_layout): Use separate arrays for output section
13879         and output offset.
13880         (Sized_relobj::do_count_local_symbols): Change map_to_output to
13881         output_sections.
13882         (Sized_relobj::do_finalize_local_symbols): Change map_to_output to
13883         output_sections and section_offsets.
13884         (Sized_relobj::write_local_symbols): Likewise.
13885         (map_to_kept_section): Compute output address directly.
13886         * reloc.cc (Sized_relobj::do_read_relocs): Change map_to_output to
13887         output_sections and section_offsets.
13888         (Sized_relobj::write_sections): Likewise.
13889         (Sized_relobj::relocate_sections): Likewise.
13890         * symtab.cc (sized_finalize_symbol): Use output_section_offset.
13891         * output.h (class Output_reloc): Update declarations.  Change
13892         u2_.relobj to Sized_relobj*.
13893         (class Output_data_reloc): Change add functions to use
13894         Sized_relobj*.
13895         * output.cc (Output_reloc::Output_reloc): Change relobj to
13896         Sized_relobj*.
13897         (Output_reloc::local_section_offset): Change return type to
13898         Elf_Addr.  Use get_output_section_offset.
13899         (Output_reloc::get_address): Likewise.
13900         (Output_section::is_input_address_mapped): Don't call
13901         is_section_specially_mapped.
13902         (Output_section::output_offset): Likewise.
13903         (Output_section::output_address): Likewise.
13904         (Output_section::starting_output_address): Likewise.
13905         * copy-relocs.cc (Copy_relocs::copy_reloc): Change object
13906         parameter to Sized_relobj*.
13907         (Copy_relocs::need_copy_reloc): Likewise.
13908         (Copy_relocs::save): Likewise.
13909         * copy-relocs.h (class Copy_relocs): Update declarations.
13910         (class Copy_relocs::Copy_reloc_entry): Change constructor to use
13911         Sized_relobj*.  Change relobj_ field to Sized_relobj*.
13912         * target-reloc.h (relocate_for_relocatable): Change
13913         offset_in_output_section type to Elf_Addr.  Change code that uses
13914         it as well.
13915         * layout.cc (Layout::layout): Always set *off.
13916         * mapfile.cc (Mapfile::print_input_section): Use
13917         output_section_offset.
13918         * i386.cc (Target_i386::copy_reloc): Change object parameter to
13919         Sized_relobj*.
13920         * powerpc.cc (Target_powerpc::copy_reloc): Likewise.
13921         * sparc.cc (Target_sparc::copy_reloc): Likewise.
13922         * x86_64.cc (Target_x86_64::copy_reloc): Likewise.
13923
13924 2008-07-03  Ian Lance Taylor  <iant@google.com>
13925
13926         * layout.cc (Layout::include_section): Do not discard unrecognized
13927         SHT_STRTAB sections.
13928
13929 2008-06-30  Craig Silverstein  <csilvers@cs.stanford.edu>
13930
13931         * script.cc (Lex::can_continue_name): Make '?' allowable in
13932         version-script names.
13933         * testsuite/version_script.map: Change glob pattern to use '?'
13934
13935 2008-06-30  Manish Singh  <yosh@gimp.org>
13936
13937         PR 6585
13938         * symtab.cc (Symbol_table::add_undefined_symbols_from_command_line):
13939         Correct typo.
13940
13941 2008-06-30  Ian Lance Taylor  <iant@google.com>
13942
13943         PR 6660
13944         PR 6682
13945         * powerpc.cc (Powerpc_relocate_functions::addr16_ha) [both
13946         versions]: Don't try to read the value in the contents, since we
13947         don't use it.  Use the template endianness when writing.
13948
13949 2008-06-25  Cary Coutant  <ccoutant@google.com>
13950
13951         * fileread.cc (File_read::make_view): Assert on zero-length view.
13952         * object.cc (Sized_relobj::do_read_symbols): Don't try to read
13953         symbol table when there are no symbols to read.
13954
13955 2008-06-23  Craig Silverstein  <csilvers@google.com>
13956
13957         * version.cc (version_string): Bump to 1.7
13958
13959 2008-06-18  Craig Silverstein  <csilvers@google.com>
13960
13961         * powerpc.cc (Powerpc_relocate_functions::addr16_ha): cast
13962         constant 0xFFFF to type Valtype.
13963         (Powerpc_relocate_functions::rel16_ha): Likewise.
13964
13965 2008-06-17  Ian Lance Taylor  <iant@google.com>
13966
13967         * output.h (Output_section::Input_section): Initialize p2align_ to
13968         zero for Output_section_data constructors.
13969         (Output_section::Input_section::addralign): If not an input
13970         section, return the alignment of the Output_section_data.
13971         * testsuite/copy_test.cc: New file.
13972         * testsuite/copy_test_1.cc: New file.
13973         * testsuite/copy_test_2.cc: New file.
13974         * testsuite/Makefile.am (check_PROGRAMS): Add copy_test.
13975         (copy_test_SOURCES, copy_test_DEPENDENCIES): New variables.
13976         (copy_test_LDFLAGS, copy_test_LDADD): New variables.
13977         (copy_test_1_pic.o, copy_test_1.so): New targets.
13978         (copy_test_2_pic.o, copy_test_2.so): New targets.
13979         * testsuite/Makefile.in: Rebuild.
13980
13981         * script-sections.cc (Script_sections::place_orphan): Initialize
13982         local variable exact.
13983
13984 2008-06-13  David Edelsohn  <edelsohn@gnu.org>
13985
13986         * powerpc.cc (Output_data_plt_powerpc::do_write): 8 + 4 = 0xC.
13987
13988 2008-06-12  David Edelsohn  <edelsohn@gnu.org>
13989             David S. Miller  <davem@davemloft.net>
13990
13991         * powerpc.cc: New file.
13992         * Makefile.am (TARGETSOURCES): Add powerpc.cc
13993         (ALL_TARGETOBJS): Add powerpc.$(OBJEXT)
13994         * configure.tgt: Add entries for powerpc-* and powerpc64-*.
13995         * Makefile.in: Rebuild.
13996
13997 2008-06-09  Ian Lance Taylor  <iant@google.com>
13998
13999         * testsuite/relro_test.cc: Include <cstdio>, <cstdlib>, and
14000         <exception>.
14001         (throwing, orig_terminate): New static variables.
14002         (terminate_handler): New static function.
14003         (t2): Set terminate handler.
14004
14005 2008-06-05  Kris Van Hees  <kris.van.hees@oracle.com>
14006
14007         PR 6584
14008         * binary.cc (Binary_to_elf::sized_convert): Fix .data
14009         alignment.
14010
14011 2008-05-30  Cary Coutant  <ccoutant@google.com>
14012
14013         * archive.cc (Archive::include_all_members) Correct to step
14014         over symbol table and extended name table in thin archives.
14015
14016 2008-05-29  Kris Van Hees  <kris.van.hees@oracle.com>
14017
14018         PR 6407
14019         * target-reloc.h (relocate_for_relocatable): Fix new_offset
14020         calculation.
14021
14022 2008-05-28  Caleb Howe  <cshowe@google.com>
14023
14024         * reduced_debug_output.cc: New file.
14025         * reduced_debug_output.h: New file.
14026         * options.h (class General_options): Add --strip-debug-non-line.
14027         * options.cc (General_options::finalize): Add strip_debug_non_line
14028         to the strip heirarchy.
14029         * layout.h (class Layout): Add debug_abbrev_ and debug_info_
14030         fields.
14031         * layout.cc: Include "reduced_debug_output.h".
14032         (Layout::Layout): Initialize new fields.
14033         (line_only_debug_sections): New static array.
14034         (is_lines_only_debug_sections): New static inline function.
14035         (Layout::include_section): Handle --strip-debug-non-line.
14036         (Layout::make_output_section): If --strip-debug-non-line, build
14037         new output sections for .debug_abbrev and .debug_info.
14038         * dwarf_reader.cc (read_unsigned_LEB_128): Move to namespace
14039         gold.  Warn about possible overflow.
14040         (read_signed_LEB_128): Likewise.
14041         * dwarf_reader.h: (read_unsigned_LEB_128): Declare.
14042         (read_signed_LEB_128): Declare.
14043         * Makefile.am (CCFILES): Add reduced_debug_output.cc.
14044         (HFILES): Add reduced_debug_output.h.
14045         * Makefile.in: Rebuild.
14046
14047 2008-05-21  Ian Lance Taylor  <iant@google.com>
14048
14049         * mapfile.cc: New file.
14050         * mapfile.h: New file.
14051         * options.h (class General_options): Add -M/--print-map and -Map.
14052         * options.cc (General_options::finalize): Make -M equivalent to
14053         -Map -.
14054         * main.cc: Include <cstdio> and "mapfile.h".
14055         (main): Open mapfile if requested.
14056         * gold.cc (class Middle_runner): Add mapfile_ field.  Update
14057         constructor.  Change caller.
14058         (queue_initial_tasks): Add mapfile parameter.  Change caller.
14059         (queue_middle_tasks): Likewise.
14060         * gold.h (queue_initial_tasks, queue_middle_tasks): Update
14061         declarations.
14062         * archive.cc: Include "mapfile.h".
14063         (Archive::add_symbols): Add mapfile parameter.  Change all
14064         callers.  Pass mapfile, symbol, and reason to include_member.
14065         (Archive::include_all_members): Add mapfile parameter.  Change all
14066         callers.
14067         (Archive::include_member): Add mapfile, sym, and why parameters.
14068         Change all callers.  Report inclusion to map file.
14069         * archive.h: Include "fileread.h".
14070         (class Archive): Update declarations.
14071         (Archive::file): New const method.
14072         (class Add_archive_symbols): Add mapfile_ field.  Update
14073         constructor.  Change all callers.
14074         * readsyms.h (class Read_symbols): Likewise.
14075         (class Finish_group): Likewise.
14076         (class Read_script): Likewise.
14077         * common.cc: Include "mapfile.h".
14078         (Symbol_table::allocate_commons): Add mapfile parameter.  Change
14079         all callers.
14080         (Symbol_table::do_allocate_commons): Likewise.
14081         (Symbol_table::do_allocate_commons_list): Likewise.  Report common
14082         symbol allocation to mapfile.
14083         * common.h (class Allocate_commons_task): Add mapfile_ field.
14084         Update constructor.  Change all callers.
14085         * symtab.h (class Symbol_table): Update declarations.
14086         * layout.cc: Include "mapfile.h".
14087         (Layout_task_runner::run): Print information to mapfile.
14088         (Layout::create_gold_note): Change Output_data_fixed_space to
14089         Output_data_zero_fill.
14090         (Layout::create_build_id): Likewise.
14091         (Layout::print_to_mapfile): New function.
14092         * layout.h (class Layout_task_runner): Add mapfile_ field.  Update
14093         constructor.  Change caller.
14094         (class Layout): Declare print_to_mapfile.
14095         * output.cc (Output_section::Input_section::print_to_mapfile): New
14096         function.
14097         (Output_section::add_input_section): If producing a map, always
14098         add to input_sections_ list.
14099         (Output_section::do_print_to_mapfile): New function.
14100         (Output_segment::print_sections_to_mapfile): New function.
14101         (Output_segment::print_section_list_to_mapfile): New function.
14102         * output.h: Include "mapfile.h".
14103         (Output_data::print_to_mapfile): New function.
14104         (Output_data::do_print_to_mapfile): New virtual function.
14105         (Output_segment_headers::do_print_to_mapfile): New function.
14106         (Output_file_header::do_print_to_mapfile): New function.
14107         (Output_data_const::do_print_to_mapfile): New function.
14108         (class Output_data_const_buffer): Add map_name_ field.  Update
14109         constructor.  Change all callers.  Add do_print_to_mapfile
14110         function.
14111         (class Output_data_fixed_space): Likewise.
14112         (class Output_data_space): Likewise.
14113         (class Output_data_zero_fill): New class.
14114         (Output_data_strtab::do_print_to_mapfile): New function.
14115         (Output_data_reloc_base::do_print_to_mapfile): New function.
14116         (Output_relocatable_relocs::do_print_to_mapfile): New function.
14117         (Output_data_group::do_print_to_mapfile): New function.
14118         (Output_data_got::do_print_to_mapfile): New function.
14119         (Output_data_dynamic::do_print_to_mapfile): New function.
14120         (Output_symtab_xindex::do_print_to_mapfile): New function.
14121         (class Output_section): Declare do_print_to_mapflie.  Declare
14122         print_to_mapfile in Input_section.
14123         (class Output_segment): Declare new functions.
14124         * object.h (Sized_relobj::symbol_count): New function.
14125         * script-sections.cc
14126         (Output_section_element_dot_assignment::set_section_addresses):
14127         Change Output_data_fixed_space to Output_data_zero_fill.
14128         (Output_data_expression::do_print_to_mapfile): New function.
14129         * script.cc (read_input_script): Add mapfile parameter.  Change
14130         all callers.
14131         * script.h (read_input_script): Update declaration.
14132         * ehframe.h (Eh_frame_hdr::do_print_to_mapfile): New function.
14133         (Eh_frame::do_print_to_mapfile): New function.
14134         * merge.h (Output_merge_data::do_print_to_mapfile): New function.
14135         (Output_merge_string::do_print_to_mapfile): New function.
14136         * i386.cc (Output_data_plt_i386::do_print_to_mapfile): New
14137         function.
14138         * sparc.cc (Output_data_plt_sparc::do_print_to_mapfile): New
14139         function.
14140         * x86_64.cc (Output_data_plt_x86_64::do_print_to_mapfile): New
14141         function.
14142         * Makefile.am (CCFILES): Add mapfile.cc.
14143         (HFILES): Add mapfile.h.
14144         * Makefile.in: Rebuild.
14145
14146 2008-05-19  Ian Lance Taylor  <iant@google.com>
14147
14148         * options.h (class General_options): Add -z relro.
14149         * layout.cc (Layout::Layout): Initialize relro_segment_.
14150         (Layout::add_output_section_data): Return the output section.
14151         (Layout::make_output_section): Rcognize relro sections and mark
14152         them appropriately.
14153         (Layout::attach_allocated_section_to_segment): Put relro sections
14154         in a PT_GNU_RELRO segment.
14155         (Layout::create_initial_dynamic_sections): Mark the .dynamic
14156         section as relro.
14157         (Layout::segment_precedes): Sort PT_GNU_RELRO segments after
14158         PT_TLS segments.
14159         (Layout::linkonce_mapping): Map d.rel.ro.local to
14160         .data.rel.ro.local.
14161         (Layout::output_section_name): Us .data.rel.ro.local for any
14162         section which begins with that.
14163         * layout.h (class Layout): Update add_output_section_data
14164         declaration.  Add relro_segment_ field.
14165         * output.cc (Output_section::Output_section): Initialize is_relro_
14166         and is_relro_local_ fields.
14167         (Output_segment::add_output_section): Group relro sections.
14168         (Output_segment::is_first_section_relro): New function.
14169         (Output_segment::maximum_alignment): If there is a relro section,
14170         align the segment to the common page size.
14171         (Output_segment::set_section_addresses): Track whether we are
14172         looking at relro sections.  If the last section is a relro
14173         section, align to the common page size.
14174         (Output_segment::set_section_list_addresses): Add in_relro
14175         parameter.  Change all callers.  Align to the page size when
14176         moving from relro to non-relro section.
14177         (Output_segment::set_offset): Align memsz of a PT_GNU_RELRO
14178         segment.
14179         * output.h (class Output_section): Add is_relro_ and
14180         is_relro_local_ fields.
14181         (Output_section::is_relro): New function.
14182         (Output_section::set_is_relro): New function.
14183         (Output_section::is_relro_local): New function.
14184         (Output_section::set_is_relro_local): New function.
14185         (class Output_segment): Update declarations.
14186         * i386.cc (Target_i386::got_section): Mark .got section as relro.
14187         * sparc.cc (Target_sparc::got_section): Likewise.
14188         * x86_64.cc (Target_x86_64::got_section): Likewise.
14189         * testsuite/relro_test_main.cc: New file.
14190         * testsuite/relro_test.cc: New file.
14191         * testsuite/Makefile.am (check_PROGRAMS): Add relro_test.
14192         (relro_test_SOURCES, relro_test_DEPENDENCIES): New variables.
14193         (relro_test_LDFLAGS, relro_test_LDADD): New variables.
14194         (relro_test.so, relro_test_pic.o): New targets.
14195         * testsuite/Makefile.in: Rebuild.
14196
14197 2008-05-16  Ian Lance Taylor  <iant@google.com>
14198
14199         * output.cc (Output_segment::add_output_section): Remove front
14200         parameter.
14201         * output.h (class Output_segment): Remove
14202         add_initial_output_section and overloaded add_output_section.
14203         Update declaration of remaining add_output_section.
14204         * layout.cc (Layout::create_interp): Call add_output_section
14205         rather than add_initial_output_section.
14206         (Layout::finish_dynamic_section): Likewise.
14207
14208         * i386.cc (Target_i386::Relocate::relocate_tls): Set dynamic type
14209         for TLS_GOTDESC and TLS_DESC_CALL.  Only optimize TLS_LDO_32 if we
14210         know the dynamic type.
14211         * x86_64.cc (Target_x86_64::Relocate): Add saw_tls_block_reloc_
14212         field.  Initialize it in constructor.
14213         (Target_x86_64::Relocate::relocate_tls): Record that we saw a TLS
14214         block reloc for TLSGD, GOTPC32_TLSDESC, TLSDESC_CALL, and TLSLD.
14215         Only optimize DTPOFF32 and DTPOFF64 if we have seen a TLS block
14216         reloc.
14217
14218         * output.cc (Output_reloc::get_address): Change return type to
14219         Elf_Addr.
14220         * output.h (class Output_reloc): Update get_address declaration.
14221         * x86_64.cc (Output_data_plt_x86_64::do_write): Use 64-bit types
14222         for section addresses.
14223
14224 2008-05-09  Ian Lance Taylor  <iant@google.com>
14225
14226         PR 6493
14227         * gold.cc (gold_nomem): Use return value of write.
14228
14229 2008-05-08  Ian Lance Taylor  <iant@google.com>
14230
14231         * symtab.c (Symbol::init_base_output_data): Add version
14232         parameter.  Change all callers.
14233         (Symbol::init_base_output_segment): Likewise.
14234         (Symbol::init_base_constant): Likewise.
14235         (Symbol::init_base_undefined): Likewise.
14236         (Sized_symbol::init_output_data): Likewise.
14237         (Sized_symbol::init_output_segment): Likewise.
14238         (Sized_symbol::init_constant): Likewise.
14239         (Sized_symbol::init_undefined): Likewise.
14240         (Symbol_table::do_define_in_output_data): If the new symbol has a
14241         version, mark it as the default.
14242         (Symbol_table::do_define_in_output_segment): Likewise.
14243         (Symbol_table::do_define_as_constant): Likewise.
14244         * symtab.h (class Symbol): Update declarations.
14245         (class Sized_symbol): Likewise.
14246         * resolve.cc (Symbol::override_version): New function.
14247         (Symbol::override_base): Call override_version.
14248         (Symbol::override_base_with_special): Likewise.
14249         * testsuite/ver_script_8.script: New file.
14250         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_8.
14251         (ver_test_8_SOURCES, ver_test_8_DEPENDENCIES): Define.
14252         (ver_test_8_LDFLAGS, ver_test_8_LDADD): Define.
14253         (ver_test_8_1.so, ver_test_8_2.so): New targets.
14254
14255 2008-05-06  Ian Lance Taylor  <iant@google.com>
14256
14257         PR 6049
14258         * options.h (DEFINE_set): Add VARNAME_begin and VARNAME_end
14259         functions.
14260         (class General_options): Remove existing --undefined, and add
14261         --no-undefined instead.  Add new --undefined as synonym for -u.
14262         * archive.cc (Archive::add_symbols): Check whether symbol was
14263         named with -u.
14264         * gold.cc (queue_middle_tasks): Add -u symbols to symbol table.
14265         * symtab.h (class Symbol): Rename CONSTANT to IS_CONSTANT; change
14266         all uses.  Add IS_UNDEFINED.  Update declarations to split
14267         different versions of init_base.  Declare init_base_undefined.
14268         (Symbol::is_defined): Handle IS_UNDEFINED.
14269         (Symbol::is_undefined): Likewise.
14270         (Symbol::is_weak_undefined): Call is_undefined.
14271         (Symbol::is_absolute): Handle IS_CONSTANT.
14272         (class Sized_symbol): Update declarations to split different
14273         versions of init.  Declare init_undefined.
14274         (class Symbol_table): Declare new functions.
14275         * symtab.cc (Symbol::init_base_object): Rename from init_base.
14276         Change all callers.
14277         (Symbol::init_base_output_data): Likewise.
14278         (Symbol::init_base_output_segment): Likewise.
14279         (Symbol::init_base_constant): Likewise.
14280         (Symbol::init_base_undefined): New function.
14281         (Sized_symbol::init_object): Rename from init.  Change all
14282         callers.
14283         (Sized_symbol::init_output_data): Likewise.
14284         (Sized_symbol::init_output_segment): Likewise.
14285         (Sized_symbol::init_constant): Likewise.
14286         (Sized_symbol::init_undefined): New function.
14287         (Symbol_table::add_undefined_symbols_from_command_line): New
14288         function.
14289         (Symbol_table::do_add_undefined_symbols_from_command_line): New
14290         function.
14291         (Symbol::final_value_is_known): Handle IS_UNDEFINED.
14292         (Symbol::output_section): Likewise.
14293         (Symbol::set_output_section): Likewise.
14294         (Symbol_table::sized_finalize_symbol): Likewise.
14295         (Symbol_table::sized_write_globals): Likewise.
14296         * resolve.cc (Symbol_table::should_override): Likewise.
14297         (Symbol::override_base_with_special): Likewise.
14298
14299         * symtab.cc (Symbol_table::add_from_dynobj): If we see a protected
14300         symbol, change it to have default visibility.
14301         * testsuite/protected_1.cc: New file.
14302         * testsuite/protected_2.cc: New file.
14303         * testsuite/protected_3.cc: New file.
14304         * testsuite/protected_main_1.cc: New file.
14305         * testsuite/protected_main_2.cc: New file.
14306         * testsuite/protected_main_3.cc: New file.
14307         * testsuite/Makefile.am (check_PROGRAMS): Add protected_1.
14308         (protected_1_SOURCES, protected_1_DEPENDENCIES): Define.
14309         (protected_1_LDFLAGS, protected_1_LDADD): Define.
14310         (protected_1.so): New target.
14311         (protected_1_pic.o, protected_2_pic.o): New targets.
14312         (protected_3_pic.o): New target.
14313         (check_PROGRAMS): Add protected_2.
14314         (protected_2_SOURCES, protected_2_DEPENDENCIES): Define.
14315         (protected_2_LDFLAGS, protected_2_LDADD): Define.
14316         * testsuite/Makefile.in: Rebuild.
14317
14318         * options.h (DEFINE_var): Add set_user_set_##varname__.
14319         (DEFINE_bool_alias): New macro.
14320         (class General_options): Define -Bstatic using DEFINE_bool_alias
14321         rather than DEFINE_special.  Add --undefined as an alias for -z
14322         defs.
14323         * options.cc (General_options::parse_Bstatic): Remove.
14324
14325         * options.h (class General_options): Add --fatal-warnings.
14326         * main.cc (main): Implement --fatal-warnings.
14327         * errors.h (Errors::warning_count): New function.
14328
14329         * options.h (class General_options): Add -Bsymbolic-functions.
14330         * symtab.h (Symbol::is_preemptible): Check for
14331         -Bsymbolic-functions.
14332
14333 2008-05-05  Ian Lance Taylor  <iant@google.com>
14334
14335         * options.h (DEFINE_bool): For DASH_Z, create the negative option
14336         as noVARNAME rather than no-VARNAME.
14337         (class General_options): Add option -z combreloc.
14338         * output.h (class Output_reloc) [SHT_REL]: Declare compare and
14339         get_address.
14340         (Output_reloc::sort_before) [SHT_REL]: New function.
14341         (Output_reloc::sort_before) [SHT_RELA]: New function.
14342         (class Output_data_reloc_base): Add sort_relocs_ field.  Define
14343         Sort_relocs_comparison.
14344         (Output_data_reloc_base::Output_data_reloc_base): Add sort_relocs
14345         parameter.  Change all callers.
14346         (Output_data_reloc::Output_data_reloc) [both versions]: Add
14347         sort_relocs parameter.  Change all callers.
14348         * output.cc (Output_reloc::get_address): New function, broken out
14349         of write_rel.
14350         (Output_reloc::write_rel): Call it.
14351         (Output_reloc::compare): New function.
14352         (Output_data_reloc_base::do_write): Optionally sort relocs.
14353
14354         * configure.ac: If targ_extra_obj is set, link it in.
14355         * configure.tgt: Initialize all variables.
14356         (x86_64*): Set targ_extra_obj and targ_extra_size.
14357         * configure: Rebuild.
14358
14359         * object.cc (Sized_relobj::include_section_group): Adjust section
14360         indexes read from group data.  Build vector to pass to
14361         layout_group.
14362         * layout.cc (Layout::layout_group): Add flags and shndxes
14363         parameters.  Remove contents parameter.  Change caller.  Update
14364         explicit instantiations.
14365         * layout.h (class Layout): Update layout_group declaration.
14366         * output.cc (Output_data_group::Output_data_group): Add flags and
14367         input_shndxes parameters.  Remove contents parameter.  Change
14368         caller.
14369         (Output_data_group::do_write): Change input_sections_ to
14370         input_shndxes_.
14371         * output.h (class Output_data_group): Update constructor
14372         declaration.  Rename input_sections_ to input_shndxes_.
14373         * testsuite/many_sections_test.cc: Add template.
14374
14375 2008-04-30  Cary Coutant  <ccoutant@google.com>
14376
14377         * target-reloc.h (relocate_section): Fix dead-pointer bug.
14378
14379         * layout.cc (Layout::include_section): Refactored check for debug
14380         info section.
14381         (Layout::add_comdat): Add new parameters.  Change type
14382         of signature parameter.  Add object and shndx to signatures table.
14383         (Layout::find_kept_object): New function.
14384         * layout.h: Include <cstring>.
14385         (Layout::is_debug_info_section): New function.
14386         (Layout::add_comdat): Add new parameters.
14387         (Layout::find_kept_object): New function.
14388         (Layout::Kept_section): New struct.
14389         (Layout::Signatures): Change type of map range.
14390         * object.cc (Relobj::output_section_address): New function.
14391         (Sized_relobj::include_section_group): Add new parameters.  Change
14392         calls to Layout::add_comdat.  Change to build table of kept comdat
14393         groups and table mapping discarded sections to kept sections.
14394         (Sized_relobj::include_linkonce_section): Likewise.  Add new parameter.
14395         (Sized_relobj::do_layout): Change calls to include_section_group and
14396         include_linkonce_section.
14397         (Sized_relobj::do_finalize_local_symbols): Do not set local symbol
14398         value to zero when section is discarded.
14399         (Sized_relobj::map_to_kept_section): New function.
14400         * object.h (Relobj::output_section_address): New function.
14401         (Relobj::Comdat_group): New type.
14402         (Relobj::find_comdat_group): New function.
14403         (Relobj::Comdat_group_table): New type.
14404         (Relobj::Kept_comdat_section): New type.
14405         (Relobj::Kept_comdat_section_table): New type.
14406         (Relobj::add_comdat_group): New function.
14407         (Relobj::set_kept_comdat_section): New function.
14408         (Relobj::get_kept_comdat_section): New function.
14409         (Relobj::comdat_groups_): New field.
14410         (Relobj::kept_comdat_sections_): New field.
14411         (Symbol_value::input_value): Update comment.
14412         (Sized_relobj::map_to_kept_section) New function.
14413         (Sized_relobj::include_linkonce_section): Add new parameter.
14414         * target-reloc.h (Comdat_behavior): New type.
14415         (get_comdat_behavior): New function.
14416         (relocate_section): Add code to map a discarded section to the
14417         corresponding kept section when applying a relocation.
14418
14419 2008-04-30  Craig Silverstein  <csilvers@google.com>
14420
14421         * dwarf_reader.cc (next_generation_count): New static var.
14422         (Addr2line_cache_entry): New struct.
14423         (addr2line_cache): New static var.
14424         (Dwarf_line_info::one_addr2line): Added caching.
14425         (Dwarf_line_info::clear_addr2line_cache): New function.
14426         * dwarf_reader.h (Dwarf_line_info::one_addr2line): Add
14427         cache-size parameter.
14428         (Dwarf_line_info::one_addr2line_cache): New function.
14429         * symtab.cc (Symbol_table::detect_odr_violations): Pass
14430         new cache-size argument to one_addr2line(), and clear cache.
14431
14432 2008-04-28  Cary Coutant  <ccoutant@google.com>
14433
14434         * i386.cc (Relocate::relocate): Fix typos for R_386_PC16 and
14435         R_386_PC8 relocations.
14436
14437 2008-04-23  Ian Lance Taylor  <iant@google.com>
14438
14439         * object.cc (Sized_relobj::include_section_group): Check for
14440         invalid section group.
14441
14442         * object.cc (make_elf_object): Correct test for 64-bit ELF file
14443         header size.
14444
14445         * readsyms.cc (Read_symbols::do_read_symbols): Use get_view rather
14446         than read for file header.
14447         * archive.cc (Archive::include_member): Likewise.
14448
14449 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
14450
14451         * aclocal.m4: Regenerate.
14452         * configure: Regenerate.
14453
14454 2008-04-19  Ian Lance Taylor  <iant@google.com>
14455
14456         * version.cc (version_string): Bump to 1.6.
14457
14458         * testsuite/Makefile.am (many_sections_r_test): New target.
14459         (many_sections_r_test_SOURCES): Remove.
14460         (many_sections_r_test_DEPENDENCIES): Remove.
14461         (many_sections_r_test_LDFLAGS): Remove.
14462         (many_sections_r_test_LDADD): Remove.
14463
14464         * object.cc (Sized_relobj::do_add_symbols): Always pass
14465         local_symbol_count_ to add_from_relobj.
14466
14467         * testsuite/Makefile.am (many_sections_check.h): Only check one in
14468         every thousand variables.
14469         * testsuite/Makefile.in: Rebuild.
14470
14471         * object.cc (Xindex::initialize_symtab_xindex): New function.
14472         (Xindex::read_symtab_xindex): New function.
14473         (Xindex::sym_xindex_to_shndx): New function.
14474         (Sized_relobj::find_symtab): Pick up SHT_SYMTAB_SHNDX section if
14475         available.
14476         (Sized_relobj::do_initialize_xindex): New function.
14477         (Sized_relobj::do_read_symbols): Adjust section links.
14478         (Sized_relobj::symbol_section_and_value): Add is_ordinary
14479         parameter.  Change all callers.
14480         (Sized_relobj::include_section_group): Adjust section links and
14481         symbol section indexes.
14482         (Sized_relobj::do_layout): Adjust section links.
14483         (Sized_relobj::do_count_local_symbols): Adjust section links and
14484         symbol section indexes.
14485         (Sized_relobj::do_finalize_local_symbols): Distinguish between
14486         ordinary and special symbols.
14487         (Sized_relobj::write_local_symbols): Add symtab_xindex and
14488         dynsym_xindex parameters.  Change all callers.  Adjust section
14489         links.  Use SHN_XINDEX when needed.
14490         (Sized_relobj::get_symbol_location_info): Adjust section links.
14491         Don't get fooled by special symbols.
14492         * object.h (class Xindex): Define.
14493         (class Object): Add xindex_ parameter.  Declare virtual functoin
14494         do_initialize_xindex.
14495         (Object::adjust_sym_shndx): New function.
14496         (Object::set_xindex): New protected function.
14497         (class Symbol_value): Add is_ordinary_shndx_ field.
14498         (Symbol_value::Symbol_value): Initialize is_ordinary_shndx_.
14499         (Symbol_value::value): Assert ordinary section.
14500         (Symbol_value::initialize_input_to_output_map): Likewise.
14501         (Symbol_value::set_input_shndx): Add is_ordinary parameter.
14502         Change all callers.
14503         (Symbol_value::input_shndx): Add is_ordinary parameter.  Change
14504         all callers.
14505         (class Sized_relobj): Update declarations.
14506         (Sized_relobj::local_symbol_input_shndx): Add is_ordinary
14507         parameter.  Change all callers.
14508         (Sized_relobj::adjust_shndx): New function.
14509         * dynobj.cc (Sized_dynobj::Sized_dynobj): Initialize dynsym_shndx_
14510         field.
14511         (Sized_dynobj::find_dynsym_sections): Remove pdynsym_shndx
14512         parameter.  Change all callers.  Pick up SHT_DYNSYM_SHNDX section
14513         for SHT_DYNSYM section if available.  Set dynsym_shndx_ field.
14514         (Sized_dynobj::read_dynsym_section): Adjust section links.
14515         (Sized_dynobj::read_dynamic): Likewise.
14516         (Sized_dynobj::do_read_symbols): Use dynsym_shndx_ field.  Adjust
14517         section links.
14518         (Sized_dynobj::do_initialize_xindex): New function.
14519         * dynobj.h (class Sized_dynobj): Add dynsym_shndx_ field.  Declare
14520         do_initialize_xindex.
14521         (Sized_dynobj::adjust_shndx): New function.
14522         * layout.cc (Layout::Layout): Initialize symtab_xindex_ and
14523         dynsym_xindex_ fields.
14524         (Layout::finalize): Add a call to set_section_indexes before
14525         creating the symtab sections.
14526         (Layout::set_section_indexes): Don't do anything if the section
14527         already has a section index.
14528         (Layout::create_symtab_sections): Add shnum parameter.  Change
14529         caller.  Create .symtab_shndx section if needed.
14530         (Layout::create_shdrs): Add shstrtab_section parameter.  Change
14531         caller.
14532         (Layout::allocated_output_section_count): New function.
14533         (Layout::create_dynamic_symtab): Create .dynsym_shndx section if
14534         needed.
14535         * layout.h (class Layout): Add symtab_xindex_ and dynsym_xindex_
14536         fields.  Update declarations.
14537         (Layout::symtab_xindex): New function.
14538         (Layout::dynsym_xindex): New function.
14539         (class Write_symbols_task): Add layout_ field.
14540         (Write_symbols_task::Write_symbols_task): Add layout parameter.
14541         Change caller.
14542         * output.cc (Output_section_headers::Output_section_headers): Add
14543         shstrtab_section parameter.  Change all callers.
14544         (Output_section_headers::do_sized_write): Store overflow values
14545         for section count and section string table section index in
14546         section header zero.
14547         (Output_file_header::do_sized_write): Check for overflow of
14548         section count and section string table section index.
14549         (Output_symtab_xindex::do_write): New function.
14550         (Output_symtab_xindex::endian_do_write): New function.
14551         * output.h (class Output_section_headers): Add shstrtab_section_.
14552         Update declarations.
14553         (class Output_symtab_xindex): Define.
14554         (Output_section::has_out_shndx): New function.
14555         * symtab.cc (Symbol::init_fields): Initialize is_ordinary_shndx_
14556         field.
14557         (Symbol::init_base): Add st_shndx and is_ordinary parameters.
14558         Change all callers.
14559         (Sized_symbol::init): Likewise.
14560         (Symbol::output_section): Check for ordinary symbol.
14561         (Symbol_table::add_from_object): Remove orig_sym parameter.  Add
14562         st_shndx, is_ordinary, and orig_st_shndx parameters.  Change all
14563         callers.
14564         (Symbol_table::add_from_relobj): Add symndx_offset parameter.
14565         Change all callers.  Simplify handling of symbols from sections
14566         not included in the link.
14567         (Symbol_table::add_from_dynobj): Handle ordinary symbol
14568         distinction.
14569         (Weak_alias_sorter::operator()): Assert that symbols are
14570         ordinary.
14571         (Symbol_table::sized_finalize_symbol): Handle ordinary symbol
14572         distinction.
14573         (Symbol_table::write_globals): Add symtab_xindex and dynsym_xindex
14574         parameters.  Change all callers.
14575         (Symbol_table::sized_write_globals): Likewise.  Handle ordinary
14576         symbol distinction.  Use SHN_XINDEX when needed.
14577         (Symbol_table::write_section_symbol): Add symtab_xindex
14578         parameter.  Change all callers.
14579         (Symbol_table::sized_write_section_symbol): Likewise.  Use
14580         SHN_XINDEX when needed.
14581         * symtab.h (class Symbol): Add is_ordinary_shndx_ field.  Update
14582         declarations.
14583         (Symbol::shndx): Add is_ordinary parameter.  Change all callers.
14584         (Symbol::is_defined): Check is_ordinary.
14585         (Symbol::is_undefined, Symbol::is_weak_undefined): Likewise.
14586         (Symbol::is_absolute, Symbol::is_common): Likewise.
14587         (class Sized_symbol): Update declarations.
14588         (class Symbol_table): Update declarations.
14589         * resolve.cc (Symbol::override_base): Add st_shndx and is_ordinary
14590         parameters.  Change all callers.
14591         (Sized_symbol::override): Likewise.
14592         (Symbol_table::override): Likewise.
14593         (symbol_to_bits): Add is_ordinary parameter.  Change all callers.
14594         (Symbol_table::resolve): Remove orig_sym parameter.  Add st_shndx,
14595         is_ordinary, and orig_st_shndx parameters.  Change all callers.
14596         * copy-relocs.cc (Copy_relocs::emit_copy_reloc): Require symbol
14597         to be in an ordinary section.
14598         * dwarf_reader.cc (Sized_dwarf_line_info::symbol_section): Add
14599         object and is_ordinary parameters.  Change all callers.
14600         (Sized_dwarf_line_info::read_relocs): Add object parameter.
14601         Change all callers.  Don't add undefined or non-ordinary symbols
14602         to reloc_map_.
14603         (Sized_dwarf_line_info::read_line_mappings): Add object parameter.
14604         Change all callers.
14605         * dwarf_reader.h (class Sized_dwarf_line_info): Update
14606         declarations.
14607         * ehframe.cc (Eh_frame::read_fde): Check for ordinary symbol.
14608         * reloc.cc (Sized_relobj::do_read_relocs): Adjust section links.
14609         (Sized_relobj::relocate_sections): Likewise.
14610         * target-reloc.h (scan_relocs): Adjust section symbol index.
14611         (scan_relocatable_relocs): Likewise.
14612         * i386.cc (Scan::local): Check for ordinary symbols.
14613         * sparc.cc (Scan::local): Likewise.
14614         * x86_64.cc (Scan::local): Likewise.
14615         * testsuite/binary_unittest.cc (Sized_binary_test): Update calls
14616         to symbol_section_and_value.
14617         * testsuite/many_sections_test.cc: New file.
14618         * testsuite/Makefile.am (BUILT_SOURCES): Define.
14619         (check_PROGRAMS): Add many_sections_test.
14620         (many_sections_test_SOURCES): Define.
14621         (many_sections_test_DEPENDENCIES): Define.
14622         (many_sections_test_LDFLAGS): Define.
14623         (BUILT_SOURCES): Add many_sections_define.h.
14624         (many_sections_define.h): New target.
14625         (BUILT_SOURCES): Add many_sections_check.h.
14626         (many_sections_check.h): New target.
14627         (check_PROGRAMS): Add many_sections_r_test.
14628         (many_sections_r_test_SOURCES): Define.
14629         (many_sections_r_test_DEPENDENCIES): Define.
14630         (many_sections_r_test_LDFLAGS): Define.
14631         (many_sections_r_test_LDADD): Define.
14632         (many_sections_r_test.o): New target.
14633         * testsuite/Makefile.in: Rebuild.
14634
14635 2008-04-17  Cary Coutant  <ccoutant@google.com>
14636
14637         * errors.cc (Errors::info): New function.
14638         (gold_info): New function.
14639         * errors.h (Errors::info): New function.
14640         * gold.h (gold_info): New function.
14641         * object.cc (Input_objects::add_object): Print trace output.
14642         * options.cc (options::parse_set): New function.
14643         (General_options::parse_wrap): Deleted.
14644         (General_options::General_options): Deleted initializer.
14645         * options.h (options::String_set): New typedef.
14646         (options::parse_set): New function.
14647         (DEFINE_set): New macro.
14648         (General_options::wrap): Changed to use DEFINE_set. Changed
14649         callers of any_wrap_symbols and is_wrap_symbol.
14650         (General_options::trace, General_options::trace_symbol):
14651         New options.
14652         (General_options::any_wrap_symbols, General_options::is_wrap_symbol)
14653         (General_options::wrap_symbols_): Deleted.
14654         * symtab.cc (Symbol_table::add_from_object): Print trace output.
14655
14656 2008-04-17  David S. Miller  <davem@davemloft.net>
14657
14658         * options.cc (General_options::parse_V): New function.
14659         * options.h: Add entries for -V and -Qy.
14660
14661 2008-04-17  Ian Lance Taylor  <iant@google.com>
14662
14663         * common.cc (Symbol_table::allocate_commons): Remove options
14664         parameter.  Change caller.
14665         (Symbol_table::do_allocate_commons): Remove options parameter.
14666         Change caller.  Just call do_allocate_commons_list twice.
14667         (Symbol_table::do_allocate_commons_list): New function, broken out
14668         of do_allocate_commons.
14669         * common.h (class Allocate_commons_task): Remove options_ field.
14670         Update constructor.
14671         * symtab.cc (Symbol_table::Symbol_table): Initialize
14672         tls_commons_.
14673         (Symbol_table::add_from_object): Put TLS common symbols on
14674         tls_commons_ list.
14675         (Symbol_table::sized_finalize_symbol): Handle STT_TLS symbols
14676         which are IN_OUTPUT_DATA.
14677         * symtab.h (class Symbol_table): Add tls_commons_ field.  Update
14678         allocate_commons and do_allocate_commons declarations.  Declare
14679         do_allocate_commons_list.
14680         * gold.cc (queue_middle_tasks): Update creation of
14681         Allocate_commons_task to not pass options.
14682         * testsuite/Makefile.am (INCLUDES): Add -I.. .
14683         (TLS_TEST_C_FLAGS): New variable.
14684         (tls_test_c_pic.o): New target.
14685         (tls_test_shared.so): Link in tls_test_c_pic.o.
14686         (tls_test_c_pic_ie.o): New target.
14687         (tls_test_ie_shared.so): Link in tls_test_c_pic_ie.o.
14688         (tls_test_DEPENDENCIES, tls_test_LDADD): Add tls_test_c.o.
14689         (tls_test_c.o): New target.
14690         (tls_pic_test_DEPENDENCIES): Add tls_test_c_pic.o.
14691         (tls_pic_test_LDADD): Likewise.
14692         (tls_shared_gd_to_ie_test_DEPENDENCIES): Add tls_test_c_pic.o.
14693         (tls_shared_gd_to_ie_test_LDADD): Likewise.
14694         (tls_test_c_gnu2.o): New target.
14695         (tls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): Add
14696         tls_test_c_gnu2.o.
14697         (tls_shared_gnu2_gd_to_ie_test_LDADD): Likewise.
14698         (tls_test_gnu2_shared.so): Link in tls_test_c_gnu2.o.
14699         (tls_test_shared_nonpic.so): Link in tls_test_c.o.
14700         * testsuite/tls_test.cc: Include "config.h".
14701         (t_last): Call t11_last.
14702         * testsuite/tls_test.h (t11, t11_last): Declare.
14703         * testsuite/tls_test_c.c: New file.
14704         * testsuite/tls_test_main.cc (thread_routine): Call t11.
14705         * configure.ac: Check for OpenMP support.
14706         * configure, config.in, Makefile.in: Rebuild.
14707         * testsuite/Makefile.in: Rebuild.
14708
14709 2008-04-16  Cary Coutant  <ccoutant@google.com>
14710
14711         * i386.cc (Target_i386::define_tls_base_symbol): New function.
14712         (Target_i386::tls_base_symbol_defined_): New field.
14713         (Target_i386::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14714         (Target_i386::Scan::global): Likewise.
14715         * symtab.cc (sized_finalize_symbol): Add check for TLS symbol.
14716         * x86_64.cc (Target_x86_64::define_tls_base_symbol): New function.
14717         (Target_x86_64::tls_base_symbol_defined_): New field.
14718         (Target_x86_64::Scan::local): Define _TLS_MODULE_BASE_ symbol.
14719         (Target_x86_64::Scan::global): Likewise.
14720
14721 2008-04-16  Cary Coutant  <ccoutant@google.com>
14722
14723         * symtab.h (Symbol::is_strong_undefined): Removed unused function.
14724         (Symbol::needs_plt_entry): Allow weak undefined symbols.
14725         (Symbol::needs_dynamic_reloc): Allow weak undefined symbols when
14726         building shared libraries.
14727         * testsuite/Makefile.am (weak_undef_nonpic_test): New target.
14728         (weak_undef_file1_nonpic.o, weak_undef_file2_nonpic.o)
14729         (weak_undef_lib_nonpic.so, alt/weak_undef_lib_nonpic.so): New targets.
14730         * testsuite/Makefile.in: Rebuild.
14731         * testsuite/weak_undef.h: New file.
14732         * testsuite/weak_undef_file1.cc: Add extra test cases.
14733         * testsuite/weak_undef_file2.cc: Likewise.
14734         * testsuite/weak_undef_test.cc: Likewise.
14735
14736 2008-04-16  David S. Miller  <davem@davemloft.net>
14737
14738         * sparc.cc (Target_sparc::Scan): Change from struct to class.
14739         Add issued_non_pic_error_ field.  Declare check_non_pic.
14740         (Target_sparc::Scan::check_non_pic): New function.
14741         (Target_sparc::Scan::local): Call check_non_pic as appropriate.
14742         (Target_sparc::Scan::global): Likewise.
14743
14744         * configure.ac (FN_PTRS_IN_SO_WITHOUT_PIC): Add sparc64.
14745         * configure: Rebuild.
14746
14747         * options.h (DEFINE_enable): New macro.
14748         (new_dtags): New enable option.
14749         (initfirst, interpose, loadfltr, nodefaultlib,
14750         nodelete, nodlopen, nodump): New -z options.
14751         * layout.cc (Layout:finish_dynamic_section): If new
14752         dtags enabled, emit DT_RUNPATH.  Also, emit a
14753         DT_FLAGS_1 containing any specified -z flags.
14754
14755 2008-04-16  Ian Lance Taylor  <iant@google.com>
14756
14757         * copy-relocs.cc: New file.
14758         * copy-relocs.h: New file.
14759         * reloc.cc: Remove Copy_relocs code.
14760         * reloc.h: Likewise.
14761         * reloc-types.h (struct Reloc_types) [both versions]: Add
14762         get_reloc_addend_noerror.
14763         * output.h (class Output_data_reloc<elfcpp::SHT_REL>): Add
14764         variants of add_global which take an addend which must be zero.
14765         * i386.cc: Include "copy-relocs.h".
14766         (class Target_i386): Change type of copy_relocs_ to variable,
14767         update initializer.
14768         (Target_i386::copy_reloc): Rewrite to pass to Copy_relocs class.
14769         Change all callers.
14770         (Target_i386::do_finalize_sections): Change handling of
14771         copy_relocs_.
14772         * sparc.cc: Include "copy-relocs.h".
14773         (class Target_sparc): Change type of copy_relocs_ to variable,
14774         update initializer.
14775         (Target_sparc::copy_reloc): Rewrite to pass to Copy_relocs class.
14776         Change all callers.
14777         (Target_sparc::do_finalize_sections): Change handling of
14778         copy_relocs_.
14779         * x86_64.cc: Include "copy-relocs.h".
14780         (class Target_x86_64): Change type of copy_relocs_ to variable,
14781         update initializer.
14782         (Target_x86_64::copy_reloc): Rewrite to pass to Copy_relocs
14783         class.  Change all callers.
14784         (Target_x86_64::do_finalize_sections): Change handling of
14785         copy_relocs_.
14786         * Makefile.am (CCFILES): Add copy-relocs.cc.
14787         (HFILES): Add copy-relocs.h.
14788
14789         * Makefile.in, aclocal.m4, testsuite/Makefile.in: Rebuild.
14790
14791         * testsuite/script_test_4.sh: Permit leading zeroes.
14792
14793 2008-04-15  Ian Lance Taylor  <iant@google.com>
14794
14795         * script-sections.cc (Script_sections::create_segments): Use
14796         header_size_adjustment even when there is enough room for the
14797         headers.
14798         * testsuite/script_test_4.sh: New file.
14799         * testsuite/script_test_4.t: New file.
14800         * testsuite/Makefile.am (check_SCRIPTS): Add script_test_4.sh.
14801         (check_DATA): Add script_test_4.stdout.
14802         (MOSTLYCLEANFILES): Likewise.
14803         (script_test_4): New target.
14804         (script_test_4.stdout): New target.
14805         * testsuite/Makefile.in: Rebuild.
14806
14807         * sparc.cc: Add definitions for Output_data_plt_sparc class
14808         constants.
14809
14810 2008-04-14  David S. Miller  <davem@davemloft.net>
14811
14812         * sparc.cc: New file.
14813         * Makefile.am (TARGETSOURCES): Add sparc.cc
14814         (ALL_TARGETOBJS): Add sparc.$(OBJEXT)
14815         * configure.tgt: Document targ_extra_size and
14816         targ_extra_big_endian.  Add entries for sparc-* and
14817         sparc64-*.
14818         * configure.ac: Handle targ_extra_size and
14819         targ_extra_big_endian.
14820         * Makefile.in: Rebuild.
14821         * configure: Likewise.
14822         * po/POTFILES.in: Likewise.
14823         * po/gold.pot: Likewise.
14824
14825 2008-04-14  Ian Lance Taylor  <iant@google.com>
14826
14827         * layout.cc (Layout::Layout): Initialize sections_are_attached_.
14828         (Layout::get_output_section): Ignore SHF_WRITE and SHF_EXECINSTR
14829         in the name/type/flags to section mapping.  Don't call
14830         allocate_output_section.
14831         (Layout::choose_output_section): Change parameter from adjust_name
14832         to is_input_section.  Don't permit input sections after sections
14833         are attached to segments.  Don't call allocate_output_section.
14834         (Layout::layout_eh_frame): Call update_flags_for_input_section,
14835         not write_enable_output_section.
14836         (Layout::make_output_section): Don't push to
14837         unattached_section_list_ nor call attach_to_segment.  Call
14838         attach_section_to_segment if sections are attached.
14839         (Layout::attach_sections_to_segments): New function.
14840         (Layout::attach_section_to_segment): New function.
14841         (Layout::attach_allocated_section_to_segment): Rename from
14842         attach_to_segment.  Remove flags parameter.
14843         (Layout::allocate_output_section): Remove function.
14844         (Layout::write_enable_output_section): Remove function.
14845         * layout.h (class Layout): Update for above changes.  Add new
14846         field sections_are_attached_.
14847         * output.h (Output_section::update_flags_for_input_section): New
14848         function.
14849         * output.cc (Output_section::add_input_section): Call
14850         update_flags_for_input_section.
14851         * gold.cc (queue_middle_tasks): Call attach_sections_to_segments.
14852
14853 2008-04-11  Cary Coutant  <ccoutant@google.com>
14854
14855         * i386.cc (Target_i386::got_mod_index_entry): Restore code previously
14856         thought unnecessary.
14857         * x86_64.cc (Target_x86_64::got_mod_index_entry): Likewise.
14858
14859 2008-04-11  Ian Lance Taylor  <iant@google.com>
14860
14861         * output.h (class Output_section_data): Remove inline definition
14862         of set_addralign.
14863         * output.cc (Output_section_data::set_addralign): New function.
14864
14865 2008-04-11  Cary Coutant  <ccoutant@google.com>
14866
14867         Add support for TLS descriptors for i386 and x86_64.
14868         * i386.cc (Target_i386::Relocate::tls_desc_gd_to_ie): New function.
14869         (Target_i386::Relocate::tls_desc_gd_to_le): New function.
14870         (Target_i386::Got_type): Add GOT_TYPE_TLS_NOFFSET and
14871         GOT_TYPE_TLS_DESC.
14872         (Target_i386::got_mod_index_entry): Remove unnecessary code.
14873         (Target_i386::Scan::local): Implement R_386_TLS_GOTDESC and
14874         R_386_TLS_DESC_CALL relocations.  Fix problem with initial-exec
14875         relocations.
14876         (Target_i386::Scan::global): Fix problem with GD-to-IE relaxation.
14877         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations;
14878         Fix problem with initial-exec relocations.
14879         (Target_i386::Relocate::relocate_tls): Likewise.
14880         (Target_i386::Relocate::tls_gd_to_ie): Fix problem with GD-to-IE
14881         relaxation.
14882         * output.cc (Output_data_dynamic::Dynamic_entry::write): Add
14883         support for section-plus-offset dynamic table entries.
14884         * output.h (Output_data_dynamic::add_section_plus_offset): New function.
14885         (Output_data_dynamic::Dynamic_entry): Add support for
14886         section-plus-offset dynamic table entries.
14887         (Output_data_dynamic::Classification): Likewise.
14888         (Output_data_dynamic::classification_): Renamed offset_.
14889         * x86_64.cc (Target_x86_64::Relocate::tls_desc_gd_to_ie): New function.
14890         (Target_x86_64::Relocate::tls_desc_gd_to_le): New function.
14891         (Target_x86_64::make_plt_section): New function.
14892         (Target_x86_64::reserve_tlsdesc_entries): New function.
14893         (Output_data_plt_x86_64::Output_data_plt_x86_64): Add new parameter.
14894         (Output_data_plt_x86_64::reserve_tlsdesc_entry): New function.
14895         (Output_data_plt_x86_64::has_tlsdesc_entry): New function.
14896         (Output_data_plt_x86_64::get_tlsdesc_got_offset): New function.
14897         (Output_data_plt_x86_64::get_tlsdesc_plt_offset): New function.
14898         (Output_data_plt_x86_64::tlsdesc_plt_entry): New field.
14899         (Output_data_plt_x86_64::set_final_data_size): Move out of line;
14900         add extra PLT entry for TLS descriptors.
14901         (Output_data_plt_x86_64::got_): New field.
14902         (Output_data_plt_x86_64::tlsdesc_got_offset_): New field.
14903         (Output_data_plt_x86_64::Output_data_plt_x86_64): Initialize new
14904         fields.
14905         (Output_data_plt_x86_64::do_write): Write extra PLT entry for TLS
14906         descriptors.
14907         (Target_x86_64::make_plt_entry): Factor out make_plt_section.
14908         (Target_x86_64::got_mod_index_entry): Remove unnecessary code.
14909         (Target_x86_64::Scan::local): Implement R_386_TLS_GOTDESC and
14910         R_386_TLS_DESC_CALL relocations.
14911         (Target_x86_64::Scan::global): Likewise.
14912         (Target_x86_64::do_finalize_sections): Add dynamic table entries
14913         for TLS descriptors.
14914         (Relocate::relocate_tls): Fix problem with GD-to-IE relaxation.
14915         Implement R_386_TLS_GOTDESC and R_386_TLS_DESC_CALL relocations.
14916         (Target_x86_64::Relocate::tls_gd_to_ie): Fix problem with
14917         GD-to-IE relaxation.
14918         * configure.ac: Export new conditional variables TLS_GNU2_DIALECT
14919         and TLS_DESCRIPTORS.
14920         * Makefile.in: Rebuild.
14921         * configure: Rebuild.
14922         * testsuite/Makefile.am (tls_shared_gd_to_ie_test): New target.
14923         (tls_test_shared2.so): New target.
14924         (tls_shared_gd_to_ie_test_SOURCES): New variable.
14925         (tls_shared_gd_to_ie_test_DEPENDENCIES): New variable.
14926         (tls_shared_gd_to_ie_test_LDFLAGS): New variable.
14927         (tls_shared_gd_to_ie_test_LDADD): New variable.
14928         (tls_shared_gnu2_gd_to_ie_test): New target.
14929         (tls_test_gnu2.o, tls_test_file2_gnu2.o, tls_test_gnu2_shared2.so):
14930         New targets.
14931         (tls_shared_gnu2_gd_to_ie_test_SOURCES): New variable.
14932         (ls_shared_gnu2_gd_to_ie_test_DEPENDENCIES): New variable.
14933         (tls_shared_gnu2_gd_to_ie_test_LDFLAGS): New variable.
14934         (tls_shared_gnu2_gd_to_ie_test_LDADD): New variable.
14935         (tls_shared_gnu2_test): New target.
14936         (tls_test_gnu2_shared.so): New target.
14937         (tls_shared_gnu2_test_SOURCES): New variable.
14938         (tls_shared_gnu2_test_DEPENDENCIES): New variable.
14939         (tls_shared_gnu2_test_LDFLAGS): New variable.
14940         (tls_shared_gnu2_test_LDADD): New variable.
14941         * testsuite/Makefile.in: Rebuild.
14942         * testsuite/Makefile.
14943
14944 2008-04-11  Ian Lance Taylor  <iant@google.com>
14945
14946         * testsuite/Makefile.am (justsyms_2r.o): Add dependency on
14947         justsyms.t.
14948         * testsuite/Makefile.in: Rebuild.
14949
14950         * testsuite/script_test_2a.cc (script_test_string_a): Make 8 bytes
14951         long.
14952         * testsuite/script_test_2.cc (main): Adjust test.
14953
14954 2008-04-11  David S. Miller  <davem@davemloft.net>
14955             Ian Lance Taylor  <iant@google.com>
14956
14957         * options.h (General_options): Add entries for '-Y' and
14958         '-relax'.
14959         * options.cc (General_options:finalize): If -Y was used, add those
14960         entries to the library path instead of the default "/lib" and
14961         "/usr/lib".
14962
14963 2008-04-11  David S. Miller  <davem@davemloft.net>
14964
14965         * testsuite/justsyms.t: Start at 0x100.
14966         * testsuite/justsyms_1.cc: Adjust justsyms_string assertion.
14967         * testsuite/script_test_2b.cc (script_test_string_b): Make 8 bytes
14968         long.
14969         * testsuite/script_test_2.cc: Adjust string and section length
14970         checks.
14971
14972 2008-04-09  Ian Lance Taylor  <iant@google.com>
14973
14974         PR gold/5996
14975         * script-sections.cc (Sections_element::allocate_to_segment): Add
14976         orphan parameter.
14977         (Output_section_definition::allocate_to_segment): Likewise.
14978         (Orphan_output_section::allocate_to_segment): Likewise.
14979         (Script_sections::attach_sections_using_phdrs_clause): Don't
14980         propagate non-PT_LOAD segments to orphan sections.
14981         * testsuite/Makefile.am (script_test_3.stdout): Generate using
14982         readelf rather than objdump.
14983         * testsuite/script_test_3.sh: Adjust accordingly.  Test that
14984         .interp section and PT_INTERP segment are the same size.
14985         * testsuite/Makefile.in: Rebuild.
14986
14987         * symtab.cc (Symbol_table::add_from_dynobj): Only look for weak
14988         aliases for symbols defined in the same object.
14989         * testsuite/Makefile.am (check_PROGRAMS): Add weak_alias_test.
14990         (weak_alias_test_SOURCES): New variable.
14991         (weak_alias_test_DEPENDENCIES): New variable.
14992         (weak_alias_test_LDFLAGS): New variable.
14993         (weak_alias_test_LDADD): New variable.
14994         (weak_alias_test_1_pic.o, weak_alias_test_1.so): New targets.
14995         (weak_alias_test_2_pic.o, weak_alias_test_2.so): New targets.
14996         (weak_alias_test_3.o): New target.
14997         (weak_alias_test_4_pic.o, weak_alias_test_4.so): New targets.
14998         * testsuite/weak_alias_test_main.cc: New file.
14999         * testsuite/weak_alias_test_1.cc: New file.
15000         * testsuite/weak_alias_test_2.cc: New file.
15001         * testsuite/weak_alias_test_3.cc: New file.
15002
15003 2008-04-08  Ian Lance Taylor  <iant@google.com>
15004
15005         * options.h (class General_options): Add --noinhibit-exec option.
15006         * main.cc (main): Check --noinhibit-exec.
15007
15008         * options.h (class General_options): Define --wrap as a special
15009         option.  Add wrap_symbols_ field.
15010         (General_options::any_wrap_symbols): New function.
15011         (General_options::is_wrap_symbol): New function.
15012         * options.cc (General_options::parse_wrap): New function.
15013         (General_options::General_options): Initialize wrap_symbols_.
15014         * symtab.cc (Symbol_table::wrap_symbol): New function.
15015         (Symbol_table::add_from_object): Handle --wrap.
15016         * symtab.h (class Symbol_table): Declare wrap_symbol.
15017         * target.h (Target::wrap_char): New function.
15018         (Target::Target_info): Add wrap_char field.
15019         * i386.cc (Target_i386::i386_info): Initialize wrap_char.
15020         * x86_64.cc (Target_x86_64::x86_64_info): Likewise.
15021         * testsuite/testfile.cc (Target_test::test_target_info):
15022         Likewise.
15023
15024         * errors.cc (Errors::undefined_symbol): Mention symbol version if
15025         there is one.
15026
15027         * layout.h (class Layout): Add added_eh_frame_data_ field.
15028         * layout.cc (Layout::Layout): Initialize new field.
15029         (Layout::layout_eh_frame): Don't add eh_frame_data_ to .eh_frame
15030         output section until we find a section we merged successfully.
15031         * object.cc (Sized_relobj::check_eh_frame_flags): Don't require
15032         that the size be non-zero.
15033
15034         * merge.cc (Object_merge_map::get_output_offset): Remove inline
15035         qualifier.
15036
15037 2008-04-08  Craig Silverstein  <csilvers@google.com>
15038
15039         * configure.ac: Export new conditional variable HAVE_ZLIB.
15040         * testsuite/Makefile.am (flagstest_o_specialfile): Condition
15041         on HAVE_ZLIB.
15042         (flagstest_o_specialfile_and_compress_debug_sections): Likewise.
15043         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15044
15045 2008-04-07  Ian Lance Taylor  <iant@google.com>
15046
15047         * version.cc (version_string): Set to "1.5".
15048
15049         * x86_64.cc (Target_x86_64::Scan): Change from struct to class.
15050         Add issued_non_pic_error_ field.  Declare check_non_pic.
15051         (Target_x86_64::Scan::check_non_pic): New function.
15052         (Target_x86_64::Scan::local): Call check_non_pic as appropriate.
15053         (Target_x86_64::Scan::global): Likewise.
15054
15055         * output.cc (Output_reloc<SHT_REL>::local_section_offset): Add
15056         addend parameter.  Change caller.  Handle merge sections.
15057         (Output_reloc<SHT_REL>::symbol_value): Change parameter type from
15058         Address to Addend.  Don't add in the result of
15059         local_section_offset, pass down the addend and use the returned
15060         value.
15061         * output.h (class Output_reloc<SHT_REL>): Add Addend typedef.
15062         Update declarations of local_section_offset and symbol_value.
15063         * testsuite/two_file_test_1.cc (t18): New function.
15064         * testsuite/two_file_test_2.cc (f18): New function.
15065         * testsuite/two_file_test_main.cc (main): Call t18.
15066         * testsuite/two_file_test.h (t18, f18): Declare.
15067
15068         * configure.ac: Don't test for objdump, c++filt, or readelf.
15069         * testsuite/Makefile.am: Remove READELF and OBJDUMP_AND_CPPFILT
15070         conditionals.
15071         (TEST_READELF): New variable.
15072         (TEST_OBJDUMP, TEST_CXXFILT, TEST_STRIP): New variables.
15073         (check_PROGRAMS): Add two_file_strip_test.
15074         (two_file_strip_test): New target.
15075         (check_PROGRAMS): Add two_file_same_shared_strip_test.
15076         (two_file_same_shared_strip_test_SOURCES): New variable.
15077         (two_file_same_shared_strip_test_DEPENDENCIES): New variable.
15078         (two_file_same_shared_strip_test_LDFLAGS): New variable.
15079         (two_file_same_shared_strip_test_LDADD): New variable.
15080         (two_file_shared_strip.so): New target.
15081         (ver_test_2.syms, ver_test_4.syms): Use TEST_READELF.
15082         (ver_test_5.syms, ver_test_7.syms): Likewise.
15083         (ver_matching_test.stdout): Use TEST_OBJDUMP and TEST_CXXFILT.
15084         (strip_test_3.stdout): Use TEST_OBJDUMP.
15085         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15086
15087 2008-04-04  Cary Coutant  <ccoutant@google.com>
15088
15089         * symtab.h (Symbol::is_weak_undefined): New function.
15090         (Symbol::is_strong_undefined): New function.
15091         (Symbol::is_absolute): New function.
15092         (Symbol::needs_plt_entry): Exclude weak undefined symbols.
15093         (Symbol::needs_dynamic_reloc): Exclude weak undefined and
15094         absolute symbols.
15095         * testsuite/Makefile.am (check_PROGRAMS): Add weak_undef_test.
15096         (weak_undef_test): New target.
15097         * testsuite/Makefile.in: Rebuild.
15098         * testsuite/weak_undef_file1.cc: New file.
15099         * testsuite/weak_undef_file2.cc: New file.
15100         * testsuite/weak_undef_test.cc: New file.
15101
15102 2008-04-03  Craig Silverstein  <csilvers@google.com>
15103
15104         * compressed_output.h (class Output_compressed_section): Use
15105         unsigned buffer.
15106         * compressed_output.cc (zlib_compress): Use unsigned buffers,
15107         add zlib header.
15108         (zlib_compressed_suffix): Removed.
15109         (Output_compressed_section::set_final_data_size): Use unsigned
15110         buffers.
15111         * testsuite/Makefile.am (flagstest_compress_debug_sections):
15112         Fix linker invocation.
15113         (flagstest_o_specialfile_and_compress_debug_sections):
15114         Likewise.
15115         * testsuite/Makefile.in: Regenerated.
15116
15117 2008-04-02  David S. Miller  <davem@davemloft.net>
15118
15119         *  dwarf_reader.cc (Sized_dwarf_line_info::read_header_prolog,
15120         Sized_dwarf_line_info::process_one_opcode): Use Swap_unaligned.
15121
15122 2008-04-02  Craig Silverstein  <csilvers@google.com>
15123
15124         * TODO: New file.
15125
15126 2008-04-02  Ian Lance Taylor  <iant@google.com>
15127
15128         * fileread.cc (File_read::find_view): Add byteshift and vshifted
15129         parameters.  Update for new key type to views_.  Change all
15130         callers.
15131         (File_read::read): Adjust for byteshift in returned view.
15132         (File_read::add_view): New function, broken out of
15133         find_and_make_view.
15134         (File_read::make_view): New function, broken out of
15135         find_and_make_view.
15136         (File_read::find_or_make_view): Add offset and aligned
15137         parameters.  Rewrite accordingly.  Change all callers.
15138         (File_read::get_view): Add offset and aligned parameters.  Adjust
15139         for byteshift in return value.
15140         (File_read::get_lasting_view): Likewise.
15141         * fileread.h (class File_read): Update declarations.
15142         (class File_read::View): Add byteshift_ field.  Add byteshift to
15143         constructor.  Add byteshift method.
15144         * archive.h (Archive::clear_uncached_views): New function.
15145         (Archive::get_view): Add aligned parameter.  Change all callers.
15146         * object.h (Object::get_view): Add aligned parameter.  Change all
15147         callers.
15148         (Object::get_lasting_view): Likewise.
15149
15150         * fileread.cc (File_read::release): Don't call clear_views if
15151         there are multiple objects.
15152         * fileread.h (File_read::clear_uncached_views): New function.
15153         * archive.cc (Add_archive_symbols::run): Call clear_uncached_views
15154         on the archive.
15155
15156 2008-03-31  Cary Coutant  <ccoutant@google.com>
15157
15158         Add thin archive support.
15159         * archive.cc (Archive::armagt): New const.
15160         (Archive::setup): Remove task parameter and calls to unlock.
15161         (Archive::unlock_nested_archives): New function.
15162         (Archive::read_header): Add nested_off parameter. Change
15163         all callers.
15164         (Archive::interpret_header): Likewise.
15165         (Archive::include_all_members): Change to handle thin
15166         archives.
15167         (Archive::include_member): Likewise.
15168         * archive.h (Archive::Archive): Add new parameters and
15169         initializers.
15170         (Archive::armagt): New const.
15171         (Archive::setup): Remove task parameter.
15172         (Archive::unlock_nested_archives): New function.
15173         (Archive::read_header): Add nested_off parameter.
15174         (Archive::interpret_header): Likewise.
15175         (Archive::Nested_archive_table): New typedef.
15176         (Archive::is_thin_archive_): New field.
15177         (Archive::nested_archives_): New field.
15178         (Archive::options_): New field.
15179         (Archive::dirpath_): New field.
15180         (Archive::task_): New field.
15181         * readsyms.cc (Read_symbols::do_read_symbols): Add check
15182         for thin archives.  Pass additional parameters to
15183         Archive::Archive.  Unlock the archive file after calling
15184         Archive::setup.
15185
15186 2008-03-29  Ian Lance Taylor  <iant@google.com>
15187
15188         * symtab.cc (Symbol_table::do_define_as_constant): Don't force a
15189         version symbol to be local.
15190         * testsuite/ver_test_4.sh: New file.
15191         * testsuite/Makefile.am (check_SCRIPTS): Add ver_test_4.sh.
15192         (check_DATA): Add ver_test_4.syms.
15193         (ver_test_4.syms): New target.
15194         * testsuite/Makefile.in: Rebuild.
15195
15196         * output.cc
15197         (Output_section::Input_section_sort_entry::has_priority): New
15198         function.
15199         (Output_section::Input_section_sort_entry::match_file_name): New
15200         function.
15201         (Output_section::Input_section_sort_entry::match_section_name):
15202         Remove.
15203         (Output_section::Input_section_sort_entry::match_section_name_prefix):
15204         Remove.
15205         (Output_section::Input_section_sort_entry::match_section_file):
15206         Remove.
15207         (Output_section::Input_section_sort_compare::operator()): Rewrite
15208         using new Input_section_sort_entry functions.  Sort crtbegin and
15209         crtend first.  Sort sections with no priority before sections with
15210         a priority.
15211         * testsuite/initpri1.c (d3): Check j != 4.
15212         (cd5): New constructor/destructor function.
15213         (main): Check j != 2.
15214
15215         * symtab.cc (Symbol_table::add_from_object): If we don't use the
15216         new symbol when resolving, don't call set_is_default.
15217         * testsuite/ver_test_7.cc: New file.
15218         * testsuite/ver_test_7.sh: New file.
15219         * testsuite/Makefile.am (ver_test_7.so): New target.
15220         (ver_test_7.o): New target.
15221         (check_SCRIPTS): Add ver_test_7.sh.
15222         (check_DATA): Add ver_test_7.syms.
15223         (ver_test_7.syms): New target.
15224
15225 2008-03-28  Ian Lance Taylor  <iant@google.com>
15226
15227         * layout.cc (Layout::layout): If we see an input section with a
15228         name that needs sorting, set the must_sort flag for the output
15229         section.
15230         (Layout::make_output_section): If the name of the output section
15231         indicates that it might require sorting, set the may_sort flag.
15232         * output.h (Output_section::may_sort_attached_input_sections): New
15233         function.
15234         (Output_section::set_may_sort_attached_input_sections): New
15235         function.
15236         (Output_section::must_sort_attached_input_sections): New
15237         function.
15238         (Output_section::set_must_sort_attached_input_sections): New
15239         function.
15240         (class Output_section): Declare Input_section_sort_entry.  Define
15241         Input_section_sort_compare.  Declare
15242         sort_attached_input_sections.  Add new fields:
15243         may_sort_attached_input_sections_,
15244         must_sort_attached_input_sections_,
15245         attached_input_sections_are_sorted_.
15246         * output.cc (Output_section::Output_section): Initialize new
15247         fields.
15248         (Output_section::add_input_section): Add an entry to
15249         input_sections_ if may_sort or must_sort are true.
15250         (Output_section::set_final_data_size): Call
15251         sort_attached_input_sections if necessary.
15252         (Output_section::Input_section_sort_entry): Define new class.
15253         (Output_section::Input_section_sort_compare::operator()): New
15254         function.
15255         (Output_section::sort_attached_input_sections): New function.
15256         * configure.ac: Check whether the compiler supports constructor
15257         priorities.  Define a CONSTRUCTOR_PRIORITY automake conditional.
15258         * testsuite/initpri1.c: New file.
15259         * testsuite/Makefile.am (check_PROGRAMS): Add initpri1 if
15260         CONSTRUCTOR_PRIORITY.
15261         (initpri1_SOURCES, initpri1_DEPENDENCIES): New variables.
15262         (initpri1_LDFLAGS): New variable.
15263         * configure, Makefile.in, testsuite/Makefile.in: Rebuild.
15264
15265 2008-03-27  Ian Lance Taylor  <iant@google.com>
15266
15267         * common.cc (Sort_commons::operator): Correct sorting algorithm.
15268         * testsuite/common_test_1.c: New file.
15269         * testsuite/Makefile.am (check_PROGRAMS): Add common_test_1.
15270         (common_test_1_SOURCES): New variable.
15271         (common_test_1_DEPENDENCIES): New variable.
15272         (common_test_1_LDFLAGS): New variable.
15273
15274         * symtab.cc (Symbol_table::add_from_object): Handle saw_undefined_
15275         and commons_ correctly when NAME/VERSION does not override
15276         NAME/NULL.
15277         * testsuite/ver_test_6.c: New file.
15278         * testsuite/Makefile.am (check_PROGRAMS): Add ver_test_6
15279         (ver_test_6_SOURCES, ver_test_6_DEPENDENCIES): New variables.
15280         (ver_test_6_LDFLAGS, ver_test_6_LDADD): New variables.
15281
15282 2008-03-26  Ian Lance Taylor  <iant@google.com>
15283
15284         * symtab.cc (Symbol_table::add_from_relobj): Don't set the version
15285         of an undefined symbol from a version script.
15286         * testsuite/Makefile.am (ver_test_5.so): New target.
15287         (ver_test_5.o): New target.
15288         (check_SCRIPTS): Add ver_test_5.sh.
15289         (check_DATA): Add ver_test_5.syms.
15290         (ver_test_5.syms): New target.
15291         * testsuite/ver_test_5.cc: New file.
15292         * testsuite/ver_test_5.script: New file.
15293         * testsuite/ver_test_5.sh: New file.
15294         * Makefile.in, testsuite/Makefile.in: Rebuild.
15295
15296         PR gold/5986
15297         Fix problems building gold with gcc 4.3.0.
15298         * gold.h (TEMPLATE_ATTRIBUTE_PRINTF_4): Define.
15299         (gold_error_at_location, gold_warning_at_location): Use it.
15300         * configure.ac: Check whether we can compile and use a template
15301         function with a printf attribute.
15302         * x86_64.cc (Target_x86_64::do_code_fill): Swap out a 32-bit value
15303         when jumping over bytes.
15304         * object.cc: Instantiate Object::read_section_data.
15305         * debug.h: Include <cstring>
15306         * dwarf_reader.cc: Include <algorithm>
15307         * main.cc: Include <cstring>.
15308         * options.cc: Include <cstring>.
15309         * output.cc: Include <cstring>.
15310         * script.cc: Include <cstring>.
15311         * script.h: Include <string>.
15312         * symtab.cc: Include <cstring> and <algorithm>.
15313         * target-select.cc: Include <cstring>.
15314         * version.cc: Include <string>.
15315         * testsuite/testmain.cc: Include <cstdlib>.
15316         * configure, config.in: Rebuild.
15317
15318 2008-03-25  Ian Lance Taylor  <iant@google.com>
15319
15320         * options.cc: Include "../bfd/bfdver.h".
15321         (options::help): Print bug reporting address.
15322
15323         * version.cc (print_version): Adjust output for current value of
15324         BFD_VERSION_STRING.
15325
15326         * NEWS: New file.
15327
15328         * options.cc (options::help): Print list of supported targets.
15329         * target-select.h: Include <vector>.
15330         (class Target_selector): Make machine_, size_, and is_big_endian_
15331         fields const.  Add bfd_name_ and instantiated_target_ fields.
15332         (Target_selector::Target_selector): Add bfd_name parameter.
15333         (Target_selector::recognize): Make non-virtual, call
15334         do_recognize.
15335         (Target_selector::recognize_by_name): Make non-virtual, call
15336         do_recognize_by_name.
15337         (Target_selector::supported_names): New function.
15338         (Target_selector::bfd_name): New function.
15339         (Target_selector::do_instantiate_target): New pure virtual
15340         function.
15341         (Target_selector::do_recognize): New virtual function.
15342         (Target_selector::do_recognize_by_name): New virtual function.
15343         (Target_selector::instantiate_target): New private function.
15344         (supported_target_names): Declare.
15345         * target-select.cc (Target_selector::Target_selector): Update for
15346         new parameter and fields.
15347         (select_target_by_name): Check that the name matches before
15348         calling recognize_by_name.
15349         (supported_target_names): New function.
15350         * i386.cc (class Target_selector_i386): Update Target_selector
15351         constructor call.  Remove recognize and recognize_by_name.  Add
15352         do_instantiate_target.
15353         * x86_64.cc (class Target_selector_x86_64): Likewise.
15354         * testsuite/testfile.cc (class Target_selector_test): Update for
15355         changes to Target_selector.
15356
15357         * README: Rewrite, with some notes on unsupported features.
15358
15359 2008-03-24  Cary Coutant  <ccoutant@google.com>
15360
15361         * i386.cc (Target_i386::Got_type): New enum declaration.
15362         (Target_i386::Scan::local): Updated callers of Output_data_got
15363         member functions.
15364         (Target_i386::Scan::global): Likewise.
15365         (Target_i386::Relocate::relocate): Likewise.
15366         (Target_i386::Relocate::relocate_tls): Likewise.
15367         * object.h (Got_offset_list): New class.
15368         (Sized_relobj::local_has_got_offset): Added got_type parameter.
15369         (Sized_relobj::local_got_offset): Likewise.
15370         (Sized_relobj::set_local_got_offset): Likewise.
15371         (Sized_relobj::local_has_tls_got_offset): Removed.
15372         (Sized_relobj::local_tls_got_offset): Removed.
15373         (Sized_relobj::set_local_tls_got_offset): Removed.
15374         (Sized_relobj::Local_got_offsets): Changed to store a list of offsets.
15375         * output.cc (Output_data_got::add_global): Added got_type parameter.
15376         (Output_data_got::add_global_with_rel): Likewise.
15377         (Output_data_got::add_global_with_rela): Likewise.
15378         (Output_data_got::add_global_pair_with_rel): New function.
15379         (Output_data_got::add_global_pair_with_rela): New function.
15380         (Output_data_got::add_local): Added got_type parameter.
15381         (Output_data_got::add_local_with_rel): Likewise.
15382         (Output_data_got::add_local_with_rela): Likewise.
15383         (Output_data_got::add_local_pair_with_rel): New function.
15384         (Output_data_got::add_local_pair_with_rela): New function.
15385         (Output_data_got::add_global_tls): Removed.
15386         (Output_data_got::add_global_tls_with_rel): Removed.
15387         (Output_data_got::add_global_tls_with_rela): Removed.
15388         (Output_data_got::add_local_tls): Removed.
15389         (Output_data_got::add_local_tls_with_rel): Removed.
15390         (Output_data_got::add_local_tls_with_rela): Removed.
15391         * output.h (Output_data_got::add_global): Added got_type parameter.
15392         (Output_data_got::add_global_with_rel): Likewise.
15393         (Output_data_got::add_global_with_rela): Likewise.
15394         (Output_data_got::add_global_pair_with_rel): New function.
15395         (Output_data_got::add_global_pair_with_rela): New function.
15396         (Output_data_got::add_local): Added got_type parameter.
15397         (Output_data_got::add_local_with_rel): Likewise.
15398         (Output_data_got::add_local_with_rela): Likewise.
15399         (Output_data_got::add_local_pair_with_rel): New function.
15400         (Output_data_got::add_local_pair_with_rela): New function.
15401         (Output_data_got::add_global_tls): Removed.
15402         (Output_data_got::add_global_tls_with_rel): Removed.
15403         (Output_data_got::add_global_tls_with_rela): Removed.
15404         (Output_data_got::add_local_tls): Removed.
15405         (Output_data_got::add_local_tls_with_rel): Removed.
15406         (Output_data_got::add_local_tls_with_rela): Removed.
15407         * resolve.cc (Symbol::override_base_with_special): Removed
15408         reference to has_got_offset_ field.
15409         * symtab.cc (Symbol::init_fields): Replaced initialization
15410         of got_offset_ with got_offsets_.  Removed initialization
15411         of has_got_offset_
15412         * symtab.h (Symbol::has_got_offset): Aded got_type parameter.
15413         (Symbol::got_offset): Likewise.
15414         (Symbol::set_got_offset): Likewise.
15415         (Symbol::has_tls_got_offset): Removed.
15416         (Symbol::tls_got_offset): Removed.
15417         (Symbol::set_tls_got_offset): Removed.
15418         (Symbol::got_offset_): Removed.
15419         (Symbol::tls_mod_got_offset_): Removed.
15420         (Symbol::tls_pair_got_offset_): Removed.
15421         (Symbol::got_offsets_): New field.
15422         (Symbol::has_got_offset): Removed.
15423         (Symbol::has_tls_mod_got_offset): Removed.
15424         (Symbol::has_tls_pair_got_offset): Removed.
15425         * x86_64.cc (Target_x86_64::Got_type): New enum declaration.
15426         (Target_x86_64::Scan::local): Updated callers of Output_data_got
15427         member functions.
15428         (Target_x86_64::Scan::global): Likewise.
15429         (Target_x86_64::Relocate::relocate): Likewise.
15430         (Target_x86_64::Relocate::relocate_tls): Likewise.
15431
15432 2008-03-25  Ben Elliston  <bje@au.ibm.com>
15433
15434         * yyscript.y: Fix spelling error in comment.
15435
15436 2008-03-24  Ian Lance Taylor  <iant@google.com>
15437
15438         * options.h (class General_options): Define build_id option.
15439         * layout.h (class Layout): Declare write_build_id, create_note,
15440         create_build_id.  Add build_id_note_ member.
15441         * layout.cc: Include <cerrno>, <fcntl.h>, <unistd.h>,
15442         "libiberty.h", "md5.h", "sha1.h".
15443         (Layout::Layout): Initialize eh_frame_data_,
15444         eh_frame_hdr_section_, and build_id_note_.
15445         (Layout::finalize): Call create_build_id.
15446         (Layout::create_note): New function, broken out of
15447         Layout::create_gold_note.
15448         (Layout::create_gold_note): Call create_note.
15449         (Layout::create_build_id): New function.
15450         (Layout::write_build_id): New function.
15451         (Close_task_runner::run): Call write_build_id.
15452
15453         * x86_64.cc: Correct license to GPLv3.
15454
15455 2008-03-23  Ian Lance Taylor  <iant@google.com>
15456
15457         * options.cc: Include "demangle.h".
15458         (parse_optional_string): New function.
15459         (parse_long_option): Handle takes_optional_argument.
15460         (parse_short_option): Update dash_z initializer.  Handle
15461         takes_optional_argument.
15462         (General_options::General_options): Initialize do_demangle_.
15463         (General_options::finalize): Set do_demangle_.  Handle demangling
15464         style.
15465         * options.h (parse_optional_string): Declare.
15466         (struct One_option): Add optional_arg field.  Update constructor.
15467         Update call constructor calls.  Add takes_optional_argument
15468         function.
15469         (DEFINE_var): Add optional_arg__ parameter.  Change all callers.
15470         (DEFINE_optional_string): Define.
15471         (General_options::demangle): Change from DEFINE_bool to
15472         DEFINE_optional_string.
15473         (General_options::no_demangle): New function.
15474         (General_options::do_demangle): New function.
15475         (General_options::set_do_demangle): New function.
15476         (General_options::execstack_status_): Move definition to end of
15477         class definition.
15478         (General_options::static_): Likewise.
15479         (General_options::do_demangle_): New field.
15480         * object.cc (big_endian>::get_symbol_location_info): Call
15481         Options::do_demangle, not Options::demangle.
15482         * symtab.cc (demangle): Likewise.
15483
15484 2008-03-22  Ian Lance Taylor  <iant@google.com>
15485
15486         * gold.h: Include <cstddef> and <sys/types.h>
15487         * options.h: Include <cstring>.
15488
15489 2008-03-21  Ian Lance Taylor  <iant@google.com>
15490
15491         * Added source code to GNU binutils.
15492 \f
15493 Copyright (C) 2008-2013 Free Software Foundation, Inc.
15494
15495 Copying and distribution of this file, with or without modification,
15496 are permitted in any medium without royalty provided the copyright
15497 notice and this notice are preserved.
15498
15499 Local Variables:
15500 mode: change-log
15501 left-margin: 8
15502 fill-column: 74
15503 version-control: never
15504 End: